scandit-datacapture-frameworks-core 7.1.2 → 7.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -369,11 +369,10 @@ class FactoryMaker {
369
369
  var _a;
370
370
  const item = FactoryMaker.instances.get(clsName);
371
371
  if (item === null || item === undefined) {
372
- console.warn(`Trying to get a non existing instance for ${clsName}`);
373
- return;
372
+ throw new Error(`Trying to get a non existing instance for ${clsName}`);
374
373
  }
375
374
  if (!item.instance && item.builder) {
376
- item.instance = (_a = item.builder) === null || _a === void 0 ? void 0 : _a.call(item);
375
+ item.instance = (_a = item.builder) === null || _a === undefined ? undefined : _a.call(item);
377
376
  }
378
377
  return item.instance;
379
378
  }
@@ -383,7 +382,7 @@ class FactoryMaker {
383
382
  if (item === null || item === undefined) {
384
383
  throw new Error(`Trying to get a non existing instance for ${clsName}`);
385
384
  }
386
- const proxyInstance = (_a = item.builder) === null || _a === void 0 ? void 0 : _a.call(item);
385
+ const proxyInstance = (_a = item.builder) === null || _a === undefined ? undefined : _a.call(item);
387
386
  if (proxyInstance === undefined) {
388
387
  throw new Error(`item.builder?.() returned undefined for ${clsName}`);
389
388
  }
@@ -444,9 +443,6 @@ class BaseController {
444
443
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
445
444
  this.proxyName = proxyName;
446
445
  }
447
- emit(event, payload) {
448
- this.eventEmitter.emit(event, payload);
449
- }
450
446
  }
451
447
  class BaseNewController {
452
448
  get _proxy() {
@@ -487,6 +483,9 @@ const advancedNativeProxyHook = {
487
483
  // $methodName will be redirected to the special _call
488
484
  // method on AdvancedNativeProxy
489
485
  if (prop.startsWith("$")) {
486
+ if (prop in advancedNativeProxy) {
487
+ return advancedNativeProxy[prop];
488
+ }
490
489
  return (args) => {
491
490
  return advancedNativeProxy._call(prop.substring(1), args);
492
491
  };
@@ -512,37 +511,46 @@ class AdvancedNativeProxy extends BaseNativeProxy {
512
511
  this.nativeCaller = nativeCaller;
513
512
  this.events = events;
514
513
  this.eventSubscriptions = new Map();
515
- this.events.forEach((event) => __awaiter(this, void 0, void 0, function* () {
514
+ this.events.forEach((event) => __awaiter(this, undefined, undefined, function* () {
516
515
  yield this._registerEvent(event);
517
516
  }));
518
517
  // Wrapping the AdvancedNativeProxy instance with the JS proxy hook
519
518
  return new Proxy(this, advancedNativeProxyHook);
520
519
  }
521
520
  dispose() {
522
- return __awaiter(this, void 0, void 0, function* () {
521
+ return __awaiter(this, undefined, undefined, function* () {
523
522
  for (const event of this.events) {
524
523
  yield this._unregisterEvent(event);
525
524
  }
525
+ this.eventSubscriptions.clear();
526
+ this.events = [];
526
527
  });
527
528
  }
528
529
  _call(fnName, args) {
529
530
  return this.nativeCaller.callFn(fnName, args);
530
531
  }
531
532
  _registerEvent(event) {
532
- return __awaiter(this, void 0, void 0, function* () {
533
- const handler = (args) => __awaiter(this, void 0, void 0, function* () {
533
+ return __awaiter(this, undefined, undefined, function* () {
534
+ const handler = (args) => __awaiter(this, undefined, undefined, function* () {
534
535
  this.eventEmitter.emit(event.nativeEventName, args);
535
536
  });
536
- this.eventEmitter.on(event.nativeEventName, (args) => __awaiter(this, void 0, void 0, function* () {
537
+ this.eventEmitter.on(event.nativeEventName, (args) => __awaiter(this, undefined, undefined, function* () {
537
538
  // Call to the special method defined on the JS Proxy hook
538
- yield this[`on$${event.name}`](args);
539
+ try {
540
+ const hookArg = this.nativeCaller.eventHook(args);
541
+ yield this[`on$${event.name}`](hookArg);
542
+ }
543
+ catch (e) {
544
+ console.error(`Error while trying to execute handler for ${event.nativeEventName}`, e);
545
+ throw e;
546
+ }
539
547
  }));
540
548
  const subscription = yield this.nativeCaller.registerEvent(event.nativeEventName, handler);
541
549
  this.eventSubscriptions.set(event.name, subscription);
542
550
  });
543
551
  }
544
552
  _unregisterEvent(event) {
545
- return __awaiter(this, void 0, void 0, function* () {
553
+ return __awaiter(this, undefined, undefined, function* () {
546
554
  const subscription = this.eventSubscriptions.get(event.name);
547
555
  yield this.nativeCaller.unregisterEvent(event.nativeEventName, subscription);
548
556
  this.eventEmitter.off(event.nativeEventName);
@@ -561,12 +569,30 @@ class AdvancedNativeProxy extends BaseNativeProxy {
561
569
  * @param eventsEnum
562
570
  */
563
571
  function createAdvancedNativeProxy(nativeCaller, eventsEnum = undefined) {
564
- const eventsList = Object.entries(eventsEnum).map(([key, value]) => ({
572
+ const eventsList = eventsEnum == null ? [] : Object.entries(eventsEnum).map(([key, value]) => ({
565
573
  name: key,
566
574
  nativeEventName: value
567
575
  }));
568
576
  return new AdvancedNativeProxy(nativeCaller, eventsList);
569
577
  }
578
+ /**
579
+ * Function to create a custom AdvancedNativeProxy. This will return an object which will provide dynamically the
580
+ * methods specified in the PROXY interface.
581
+ *
582
+ * The Proxy interface implemented in order to call native methods will require a special mark
583
+ * `$methodName` for method calls
584
+ * `on$methodName` for the listeners added to the events defined in eventsEnum
585
+ * @param klass
586
+ * @param nativeCaller
587
+ * @param eventsEnum
588
+ */
589
+ function createAdvancedNativeFromCtorProxy(klass, nativeCaller, eventsEnum = undefined) {
590
+ const eventsList = Object.entries(eventsEnum).map(([key, value]) => ({
591
+ name: key,
592
+ nativeEventName: value
593
+ }));
594
+ return new klass(nativeCaller, eventsList);
595
+ }
570
596
 
571
597
  function getCoreDefaults() {
572
598
  return FactoryMaker.getInstance('CoreDefaults');
@@ -746,10 +772,10 @@ class Point extends DefaultSerializeable {
746
772
  }
747
773
  __decorate([
748
774
  nameForSerialization('x')
749
- ], Point.prototype, "_x", void 0);
775
+ ], Point.prototype, "_x", undefined);
750
776
  __decorate([
751
777
  nameForSerialization('y')
752
- ], Point.prototype, "_y", void 0);
778
+ ], Point.prototype, "_y", undefined);
753
779
 
754
780
  class Quadrilateral extends DefaultSerializeable {
755
781
  get topLeft() {
@@ -777,16 +803,16 @@ class Quadrilateral extends DefaultSerializeable {
777
803
  }
778
804
  __decorate([
779
805
  nameForSerialization('topLeft')
780
- ], Quadrilateral.prototype, "_topLeft", void 0);
806
+ ], Quadrilateral.prototype, "_topLeft", undefined);
781
807
  __decorate([
782
808
  nameForSerialization('topRight')
783
- ], Quadrilateral.prototype, "_topRight", void 0);
809
+ ], Quadrilateral.prototype, "_topRight", undefined);
784
810
  __decorate([
785
811
  nameForSerialization('bottomRight')
786
- ], Quadrilateral.prototype, "_bottomRight", void 0);
812
+ ], Quadrilateral.prototype, "_bottomRight", undefined);
787
813
  __decorate([
788
814
  nameForSerialization('bottomLeft')
789
- ], Quadrilateral.prototype, "_bottomLeft", void 0);
815
+ ], Quadrilateral.prototype, "_bottomLeft", undefined);
790
816
 
791
817
  class NumberWithUnit extends DefaultSerializeable {
792
818
  get value() {
@@ -806,10 +832,10 @@ class NumberWithUnit extends DefaultSerializeable {
806
832
  }
807
833
  __decorate([
808
834
  nameForSerialization('value')
809
- ], NumberWithUnit.prototype, "_value", void 0);
835
+ ], NumberWithUnit.prototype, "_value", undefined);
810
836
  __decorate([
811
837
  nameForSerialization('unit')
812
- ], NumberWithUnit.prototype, "_unit", void 0);
838
+ ], NumberWithUnit.prototype, "_unit", undefined);
813
839
 
814
840
  var MeasureUnit;
815
841
  (function (MeasureUnit) {
@@ -839,10 +865,10 @@ class PointWithUnit extends DefaultSerializeable {
839
865
  }
840
866
  __decorate([
841
867
  nameForSerialization('x')
842
- ], PointWithUnit.prototype, "_x", void 0);
868
+ ], PointWithUnit.prototype, "_x", undefined);
843
869
  __decorate([
844
870
  nameForSerialization('y')
845
- ], PointWithUnit.prototype, "_y", void 0);
871
+ ], PointWithUnit.prototype, "_y", undefined);
846
872
 
847
873
  class Rect extends DefaultSerializeable {
848
874
  get origin() {
@@ -859,10 +885,10 @@ class Rect extends DefaultSerializeable {
859
885
  }
860
886
  __decorate([
861
887
  nameForSerialization('origin')
862
- ], Rect.prototype, "_origin", void 0);
888
+ ], Rect.prototype, "_origin", undefined);
863
889
  __decorate([
864
890
  nameForSerialization('size')
865
- ], Rect.prototype, "_size", void 0);
891
+ ], Rect.prototype, "_size", undefined);
866
892
 
867
893
  class RectWithUnit extends DefaultSerializeable {
868
894
  get origin() {
@@ -879,10 +905,10 @@ class RectWithUnit extends DefaultSerializeable {
879
905
  }
880
906
  __decorate([
881
907
  nameForSerialization('origin')
882
- ], RectWithUnit.prototype, "_origin", void 0);
908
+ ], RectWithUnit.prototype, "_origin", undefined);
883
909
  __decorate([
884
910
  nameForSerialization('size')
885
- ], RectWithUnit.prototype, "_size", void 0);
911
+ ], RectWithUnit.prototype, "_size", undefined);
886
912
 
887
913
  class ScanditIcon extends DefaultSerializeable {
888
914
  static fromJSON(json) {
@@ -924,26 +950,26 @@ class ScanditIcon extends DefaultSerializeable {
924
950
  __decorate([
925
951
  nameForSerialization('backgroundColor'),
926
952
  ignoreFromSerializationIfNull
927
- ], ScanditIcon.prototype, "_backgroundColor", void 0);
953
+ ], ScanditIcon.prototype, "_backgroundColor", undefined);
928
954
  __decorate([
929
955
  nameForSerialization('backgroundShape'),
930
956
  ignoreFromSerializationIfNull
931
- ], ScanditIcon.prototype, "_backgroundShape", void 0);
957
+ ], ScanditIcon.prototype, "_backgroundShape", undefined);
932
958
  __decorate([
933
959
  nameForSerialization('icon'),
934
960
  ignoreFromSerializationIfNull
935
- ], ScanditIcon.prototype, "_icon", void 0);
961
+ ], ScanditIcon.prototype, "_icon", undefined);
936
962
  __decorate([
937
963
  nameForSerialization('iconColor'),
938
964
  ignoreFromSerializationIfNull
939
- ], ScanditIcon.prototype, "_iconColor", void 0);
965
+ ], ScanditIcon.prototype, "_iconColor", undefined);
940
966
  __decorate([
941
967
  nameForSerialization('backgroundStrokeColor'),
942
968
  ignoreFromSerializationIfNull
943
- ], ScanditIcon.prototype, "_backgroundStrokeColor", void 0);
969
+ ], ScanditIcon.prototype, "_backgroundStrokeColor", undefined);
944
970
  __decorate([
945
971
  nameForSerialization('backgroundStrokeWidth')
946
- ], ScanditIcon.prototype, "_backgroundStrokeWidth", void 0);
972
+ ], ScanditIcon.prototype, "_backgroundStrokeWidth", undefined);
947
973
 
948
974
  class ScanditIconBuilder {
949
975
  constructor() {
@@ -1033,10 +1059,10 @@ class Size extends DefaultSerializeable {
1033
1059
  }
1034
1060
  __decorate([
1035
1061
  nameForSerialization('width')
1036
- ], Size.prototype, "_width", void 0);
1062
+ ], Size.prototype, "_width", undefined);
1037
1063
  __decorate([
1038
1064
  nameForSerialization('height')
1039
- ], Size.prototype, "_height", void 0);
1065
+ ], Size.prototype, "_height", undefined);
1040
1066
 
1041
1067
  class SizeWithAspect extends DefaultSerializeable {
1042
1068
  get size() {
@@ -1053,10 +1079,10 @@ class SizeWithAspect extends DefaultSerializeable {
1053
1079
  }
1054
1080
  __decorate([
1055
1081
  nameForSerialization('size')
1056
- ], SizeWithAspect.prototype, "_size", void 0);
1082
+ ], SizeWithAspect.prototype, "_size", undefined);
1057
1083
  __decorate([
1058
1084
  nameForSerialization('aspect')
1059
- ], SizeWithAspect.prototype, "_aspect", void 0);
1085
+ ], SizeWithAspect.prototype, "_aspect", undefined);
1060
1086
 
1061
1087
  class SizeWithUnit extends DefaultSerializeable {
1062
1088
  get width() {
@@ -1073,10 +1099,10 @@ class SizeWithUnit extends DefaultSerializeable {
1073
1099
  }
1074
1100
  __decorate([
1075
1101
  nameForSerialization('width')
1076
- ], SizeWithUnit.prototype, "_width", void 0);
1102
+ ], SizeWithUnit.prototype, "_width", undefined);
1077
1103
  __decorate([
1078
1104
  nameForSerialization('height')
1079
- ], SizeWithUnit.prototype, "_height", void 0);
1105
+ ], SizeWithUnit.prototype, "_height", undefined);
1080
1106
 
1081
1107
  var SizingMode;
1082
1108
  (function (SizingMode) {
@@ -1181,16 +1207,16 @@ class SizeWithUnitAndAspect {
1181
1207
  }
1182
1208
  __decorate([
1183
1209
  nameForSerialization('widthAndHeight')
1184
- ], SizeWithUnitAndAspect.prototype, "_widthAndHeight", void 0);
1210
+ ], SizeWithUnitAndAspect.prototype, "_widthAndHeight", undefined);
1185
1211
  __decorate([
1186
1212
  nameForSerialization('widthAndAspectRatio')
1187
- ], SizeWithUnitAndAspect.prototype, "_widthAndAspectRatio", void 0);
1213
+ ], SizeWithUnitAndAspect.prototype, "_widthAndAspectRatio", undefined);
1188
1214
  __decorate([
1189
1215
  nameForSerialization('heightAndAspectRatio')
1190
- ], SizeWithUnitAndAspect.prototype, "_heightAndAspectRatio", void 0);
1216
+ ], SizeWithUnitAndAspect.prototype, "_heightAndAspectRatio", undefined);
1191
1217
  __decorate([
1192
1218
  nameForSerialization('shorterDimensionAndAspectRatio')
1193
- ], SizeWithUnitAndAspect.prototype, "_shorterDimensionAndAspectRatio", void 0);
1219
+ ], SizeWithUnitAndAspect.prototype, "_shorterDimensionAndAspectRatio", undefined);
1194
1220
 
1195
1221
  class MarginsWithUnit extends DefaultSerializeable {
1196
1222
  get left() {
@@ -1221,16 +1247,16 @@ class MarginsWithUnit extends DefaultSerializeable {
1221
1247
  }
1222
1248
  __decorate([
1223
1249
  nameForSerialization('left')
1224
- ], MarginsWithUnit.prototype, "_left", void 0);
1250
+ ], MarginsWithUnit.prototype, "_left", undefined);
1225
1251
  __decorate([
1226
1252
  nameForSerialization('right')
1227
- ], MarginsWithUnit.prototype, "_right", void 0);
1253
+ ], MarginsWithUnit.prototype, "_right", undefined);
1228
1254
  __decorate([
1229
1255
  nameForSerialization('top')
1230
- ], MarginsWithUnit.prototype, "_top", void 0);
1256
+ ], MarginsWithUnit.prototype, "_top", undefined);
1231
1257
  __decorate([
1232
1258
  nameForSerialization('bottom')
1233
- ], MarginsWithUnit.prototype, "_bottom", void 0);
1259
+ ], MarginsWithUnit.prototype, "_bottom", undefined);
1234
1260
 
1235
1261
  class Color {
1236
1262
  get redComponent() {
@@ -1334,6 +1360,9 @@ class Brush extends DefaultSerializeable {
1334
1360
  this.fill = { color: fillColor };
1335
1361
  this.stroke = { color: strokeColor, width: strokeWidth };
1336
1362
  }
1363
+ static fromJSON(brushJson) {
1364
+ return new Brush(Color.fromHex(brushJson.fillColor), Color.fromHex(brushJson.strokeColor), brushJson.strokeWidth);
1365
+ }
1337
1366
  }
1338
1367
 
1339
1368
  var Anchor;
@@ -1401,7 +1430,7 @@ class Observable extends DefaultSerializeable {
1401
1430
  }
1402
1431
  __decorate([
1403
1432
  ignoreFromSerialization
1404
- ], Observable.prototype, "listeners", void 0);
1433
+ ], Observable.prototype, "listeners", undefined);
1405
1434
 
1406
1435
  class HtmlElementPosition {
1407
1436
  constructor(top, left) {
@@ -1444,8 +1473,8 @@ class HTMLElementState {
1444
1473
  var _a, _b, _c, _d;
1445
1474
  if (!other)
1446
1475
  return true;
1447
- const positionChanged = (_b = (_a = this.position) === null || _a === void 0 ? void 0 : _a.didChangeComparedTo(other.position)) !== null && _b !== void 0 ? _b : (this.position !== other.position);
1448
- const sizeChanged = (_d = (_c = this.size) === null || _c === void 0 ? void 0 : _c.didChangeComparedTo(other.size)) !== null && _d !== void 0 ? _d : (this.size !== other.size);
1476
+ const positionChanged = (_b = (_a = this.position) === null || _a === undefined ? undefined : _a.didChangeComparedTo(other.position)) !== null && _b !== undefined ? _b : (this.position !== other.position);
1477
+ const sizeChanged = (_d = (_c = this.size) === null || _c === undefined ? undefined : _c.didChangeComparedTo(other.size)) !== null && _d !== undefined ? _d : (this.size !== other.size);
1449
1478
  return positionChanged || sizeChanged || this.shouldBeUnderContent !== other.shouldBeUnderContent;
1450
1479
  }
1451
1480
  }
@@ -1461,7 +1490,7 @@ class ImageFrameSourceController {
1461
1490
  this._proxy = FactoryMaker.getInstance('ImageFrameSourceProxy');
1462
1491
  }
1463
1492
  getCurrentState() {
1464
- return __awaiter(this, void 0, void 0, function* () {
1493
+ return __awaiter(this, undefined, undefined, function* () {
1465
1494
  const result = yield this._proxy.getCurrentCameraState(this.imageFrameSource.position);
1466
1495
  if (result == null) {
1467
1496
  return FrameSourceState.Off;
@@ -1475,7 +1504,7 @@ class ImageFrameSourceController {
1475
1504
  subscribeListener() {
1476
1505
  var _a, _b;
1477
1506
  this._proxy.registerListenerForEvents();
1478
- (_b = (_a = this._proxy).subscribeDidChangeState) === null || _b === void 0 ? void 0 : _b.call(_a);
1507
+ (_b = (_a = this._proxy).subscribeDidChangeState) === null || _b === undefined ? undefined : _b.call(_a);
1479
1508
  this.eventEmitter.on(FrameSourceListenerEvents.didChangeState, (data) => {
1480
1509
  const event = EventDataParser.parse(data);
1481
1510
  if (event === null) {
@@ -1566,19 +1595,19 @@ class ImageFrameSource extends DefaultSerializeable {
1566
1595
  }
1567
1596
  __decorate([
1568
1597
  nameForSerialization('id')
1569
- ], ImageFrameSource.prototype, "_id", void 0);
1598
+ ], ImageFrameSource.prototype, "_id", undefined);
1570
1599
  __decorate([
1571
1600
  nameForSerialization('desiredState')
1572
- ], ImageFrameSource.prototype, "_desiredState", void 0);
1601
+ ], ImageFrameSource.prototype, "_desiredState", undefined);
1573
1602
  __decorate([
1574
1603
  ignoreFromSerialization
1575
- ], ImageFrameSource.prototype, "listeners", void 0);
1604
+ ], ImageFrameSource.prototype, "listeners", undefined);
1576
1605
  __decorate([
1577
1606
  ignoreFromSerialization
1578
- ], ImageFrameSource.prototype, "_context", void 0);
1607
+ ], ImageFrameSource.prototype, "_context", undefined);
1579
1608
  __decorate([
1580
1609
  ignoreFromSerialization
1581
- ], ImageFrameSource.prototype, "controller", void 0);
1610
+ ], ImageFrameSource.prototype, "controller", undefined);
1582
1611
 
1583
1612
  class PrivateFrameData {
1584
1613
  get imageBuffers() {
@@ -1623,7 +1652,7 @@ class CameraController {
1623
1652
  return this.camera;
1624
1653
  }
1625
1654
  static getFrame(frameId) {
1626
- return __awaiter(this, void 0, void 0, function* () {
1655
+ return __awaiter(this, undefined, undefined, function* () {
1627
1656
  const result = yield CameraController._proxy.getFrame(frameId);
1628
1657
  if (result == null) {
1629
1658
  return PrivateFrameData.empty();
@@ -1633,7 +1662,7 @@ class CameraController {
1633
1662
  });
1634
1663
  }
1635
1664
  static getFrameOrNull(frameId) {
1636
- return __awaiter(this, void 0, void 0, function* () {
1665
+ return __awaiter(this, undefined, undefined, function* () {
1637
1666
  const result = yield CameraController._proxy.getFrame(frameId);
1638
1667
  if (result == null) {
1639
1668
  return null;
@@ -1643,7 +1672,7 @@ class CameraController {
1643
1672
  });
1644
1673
  }
1645
1674
  getCurrentState() {
1646
- return __awaiter(this, void 0, void 0, function* () {
1675
+ return __awaiter(this, undefined, undefined, function* () {
1647
1676
  const result = yield CameraController._proxy.getCurrentCameraState(this.privateCamera.position);
1648
1677
  if (result == null) {
1649
1678
  return FrameSourceState.Off;
@@ -1652,7 +1681,7 @@ class CameraController {
1652
1681
  });
1653
1682
  }
1654
1683
  getIsTorchAvailable() {
1655
- return __awaiter(this, void 0, void 0, function* () {
1684
+ return __awaiter(this, undefined, undefined, function* () {
1656
1685
  const result = yield CameraController._proxy.isTorchAvailable(this.privateCamera.position);
1657
1686
  if (result == null) {
1658
1687
  return false;
@@ -1666,13 +1695,13 @@ class CameraController {
1666
1695
  subscribeListener() {
1667
1696
  var _a, _b;
1668
1697
  CameraController._proxy.registerListenerForCameraEvents();
1669
- (_b = (_a = CameraController._proxy).subscribeDidChangeState) === null || _b === void 0 ? void 0 : _b.call(_a);
1698
+ (_b = (_a = CameraController._proxy).subscribeDidChangeState) === null || _b === undefined ? undefined : _b.call(_a);
1670
1699
  this.eventEmitter.on(FrameSourceListenerEvents.didChangeState, (data) => {
1671
1700
  const event = EventDataParser.parse(data);
1672
1701
  if (event) {
1673
1702
  this.privateCamera.listeners.forEach(listener => {
1674
1703
  var _a;
1675
- (_a = listener === null || listener === void 0 ? void 0 : listener.didChangeState) === null || _a === void 0 ? void 0 : _a.call(listener, this.camera, event.state);
1704
+ (_a = listener === null || listener === undefined ? undefined : listener.didChangeState) === null || _a === undefined ? undefined : _a.call(listener, this.camera, event.state);
1676
1705
  });
1677
1706
  }
1678
1707
  });
@@ -1804,7 +1833,7 @@ class Camera extends DefaultSerializeable {
1804
1833
  return this.didChange();
1805
1834
  }
1806
1835
  didChange() {
1807
- return __awaiter(this, void 0, void 0, function* () {
1836
+ return __awaiter(this, undefined, undefined, function* () {
1808
1837
  if (this.context) {
1809
1838
  yield this.context.update();
1810
1839
  }
@@ -1813,22 +1842,22 @@ class Camera extends DefaultSerializeable {
1813
1842
  }
1814
1843
  __decorate([
1815
1844
  serializationDefault({})
1816
- ], Camera.prototype, "settings", void 0);
1845
+ ], Camera.prototype, "settings", undefined);
1817
1846
  __decorate([
1818
1847
  nameForSerialization('desiredTorchState')
1819
- ], Camera.prototype, "_desiredTorchState", void 0);
1848
+ ], Camera.prototype, "_desiredTorchState", undefined);
1820
1849
  __decorate([
1821
1850
  ignoreFromSerialization
1822
- ], Camera.prototype, "_desiredState", void 0);
1851
+ ], Camera.prototype, "_desiredState", undefined);
1823
1852
  __decorate([
1824
1853
  ignoreFromSerialization
1825
- ], Camera.prototype, "listeners", void 0);
1854
+ ], Camera.prototype, "listeners", undefined);
1826
1855
  __decorate([
1827
1856
  ignoreFromSerialization
1828
- ], Camera.prototype, "_context", void 0);
1857
+ ], Camera.prototype, "_context", undefined);
1829
1858
  __decorate([
1830
1859
  ignoreFromSerialization
1831
- ], Camera.prototype, "controller", void 0);
1860
+ ], Camera.prototype, "controller", undefined);
1832
1861
  __decorate([
1833
1862
  ignoreFromSerialization
1834
1863
  ], Camera, "coreDefaults", null);
@@ -1858,11 +1887,11 @@ class ControlImage extends DefaultSerializeable {
1858
1887
  __decorate([
1859
1888
  ignoreFromSerializationIfNull,
1860
1889
  nameForSerialization('data')
1861
- ], ControlImage.prototype, "_data", void 0);
1890
+ ], ControlImage.prototype, "_data", undefined);
1862
1891
  __decorate([
1863
1892
  ignoreFromSerializationIfNull,
1864
1893
  nameForSerialization('name')
1865
- ], ControlImage.prototype, "_name", void 0);
1894
+ ], ControlImage.prototype, "_name", undefined);
1866
1895
 
1867
1896
  class ContextStatus {
1868
1897
  static fromJSON(json) {
@@ -1922,23 +1951,15 @@ class DataCaptureContextController {
1922
1951
  static forDataCaptureContext(context) {
1923
1952
  const controller = new DataCaptureContextController();
1924
1953
  controller.context = context;
1925
- controller.initialize();
1926
1954
  return controller;
1927
1955
  }
1928
- static forDataCaptureContextAsync(context) {
1929
- return __awaiter(this, void 0, void 0, function* () {
1930
- const controller = new DataCaptureContextController();
1931
- controller.context = context;
1932
- yield controller.initialize();
1933
- return controller;
1934
- });
1935
- }
1936
1956
  constructor() {
1957
+ this._listenerRegistered = false;
1937
1958
  this._proxy = FactoryMaker.getInstance('DataCaptureContextProxy');
1938
1959
  this.eventEmitter = FactoryMaker.getInstance('EventEmitter');
1939
1960
  }
1940
1961
  updateContextFromJSON() {
1941
- return __awaiter(this, void 0, void 0, function* () {
1962
+ return __awaiter(this, undefined, undefined, function* () {
1942
1963
  try {
1943
1964
  yield this._proxy.updateContextFromJSON(JSON.stringify(this.context.toJSON()));
1944
1965
  }
@@ -1971,7 +1992,7 @@ class DataCaptureContextController {
1971
1992
  return this.initializeContextFromJSON();
1972
1993
  }
1973
1994
  initializeContextFromJSON() {
1974
- return __awaiter(this, void 0, void 0, function* () {
1995
+ return __awaiter(this, undefined, undefined, function* () {
1975
1996
  try {
1976
1997
  yield this._proxy.contextFromJSON(JSON.stringify(this.context.toJSON()));
1977
1998
  }
@@ -1982,7 +2003,7 @@ class DataCaptureContextController {
1982
2003
  });
1983
2004
  }
1984
2005
  static getOpenSourceSoftwareLicenseInfo() {
1985
- return __awaiter(this, void 0, void 0, function* () {
2006
+ return __awaiter(this, undefined, undefined, function* () {
1986
2007
  const proxy = FactoryMaker.getInstance('DataCaptureContextProxy');
1987
2008
  const result = yield proxy.getOpenSourceSoftwareLicenseInfo();
1988
2009
  return new OpenSourceSoftwareLicenseInfo(result.data);
@@ -1990,9 +2011,12 @@ class DataCaptureContextController {
1990
2011
  }
1991
2012
  subscribeListener() {
1992
2013
  var _a, _b, _c, _d;
2014
+ if (this._listenerRegistered) {
2015
+ return;
2016
+ }
1993
2017
  this._proxy.registerListenerForDataCaptureContext();
1994
- (_b = (_a = this._proxy).subscribeDidChangeStatus) === null || _b === void 0 ? void 0 : _b.call(_a);
1995
- (_d = (_c = this._proxy).subscribeDidStartObservingContext) === null || _d === void 0 ? void 0 : _d.call(_c);
2018
+ (_b = (_a = this._proxy).subscribeDidChangeStatus) === null || _b === undefined ? undefined : _b.call(_a);
2019
+ (_d = (_c = this._proxy).subscribeDidStartObservingContext) === null || _d === undefined ? undefined : _d.call(_c);
1996
2020
  this.eventEmitter.on(DataCaptureContextEvents.didChangeStatus, (data) => {
1997
2021
  const event = EventDataParser.parse(data);
1998
2022
  if (event === null) {
@@ -2005,9 +2029,10 @@ class DataCaptureContextController {
2005
2029
  this.eventEmitter.on(DataCaptureContextEvents.didStartObservingContext, () => {
2006
2030
  this.privateContext.listeners.forEach(listener => {
2007
2031
  var _a;
2008
- (_a = listener.didStartObservingContext) === null || _a === void 0 ? void 0 : _a.call(listener, this.context);
2032
+ (_a = listener.didStartObservingContext) === null || _a === undefined ? undefined : _a.call(listener, this.context);
2009
2033
  });
2010
2034
  });
2035
+ this._listenerRegistered = true;
2011
2036
  }
2012
2037
  notifyListenersOfDeserializationError(error) {
2013
2038
  const contextStatus = ContextStatus
@@ -2028,6 +2053,12 @@ class DataCaptureContextController {
2028
2053
  }
2029
2054
 
2030
2055
  class DataCaptureContext extends DefaultSerializeable {
2056
+ static get sharedInstance() {
2057
+ if (DataCaptureContext._instance == null) {
2058
+ DataCaptureContext._instance = new DataCaptureContext('', '', null);
2059
+ }
2060
+ return DataCaptureContext._instance;
2061
+ }
2031
2062
  static get coreDefaults() {
2032
2063
  return getCoreDefaults();
2033
2064
  }
@@ -2045,22 +2076,33 @@ class DataCaptureContext extends DefaultSerializeable {
2045
2076
  return DataCaptureContext.deviceID;
2046
2077
  }
2047
2078
  static forLicenseKey(licenseKey) {
2048
- return DataCaptureContext.create(licenseKey, null, null);
2079
+ const instance = DataCaptureContext.create(licenseKey, null, null);
2080
+ // Call initialize to ensure the shared instance is updated.
2081
+ instance.controller.initialize();
2082
+ return instance;
2049
2083
  }
2050
2084
  static forLicenseKeyWithSettings(licenseKey, settings) {
2051
- return DataCaptureContext.create(licenseKey, null, settings);
2085
+ const instance = DataCaptureContext.create(licenseKey, null, settings);
2086
+ // Call initialize to ensure the shared instance is updated.
2087
+ instance.controller.initialize();
2088
+ return instance;
2052
2089
  }
2053
2090
  static forLicenseKeyWithOptions(licenseKey, options) {
2054
- return DataCaptureContext.create(licenseKey, options, null);
2091
+ const instance = DataCaptureContext.create(licenseKey, options, null);
2092
+ // Call initialize to ensure the shared instance is updated.
2093
+ instance.controller.initialize();
2094
+ return instance;
2095
+ }
2096
+ static initialize(licenseKey, options = null, settings = null) {
2097
+ DataCaptureContext.create(licenseKey, options, settings);
2098
+ DataCaptureContext.sharedInstance.controller.initialize();
2099
+ return DataCaptureContext.sharedInstance;
2055
2100
  }
2056
2101
  static create(licenseKey, options, settings) {
2057
- if (options == null) {
2058
- options = { deviceName: null };
2059
- }
2060
- if (!DataCaptureContext.instance) {
2061
- DataCaptureContext.instance = new DataCaptureContext(licenseKey, options.deviceName || '', settings);
2062
- }
2063
- return DataCaptureContext.instance;
2102
+ DataCaptureContext.sharedInstance.licenseKey = licenseKey;
2103
+ DataCaptureContext.sharedInstance.deviceName = (options === null || options === undefined ? undefined : options.deviceName) || '';
2104
+ DataCaptureContext.sharedInstance.settings = settings || new DataCaptureContextSettings();
2105
+ return DataCaptureContext.sharedInstance;
2064
2106
  }
2065
2107
  constructor(licenseKey, deviceName, settings) {
2066
2108
  super();
@@ -2073,10 +2115,14 @@ class DataCaptureContext extends DefaultSerializeable {
2073
2115
  this.view = null;
2074
2116
  this.modes = [];
2075
2117
  this.listeners = [];
2118
+ this.licenseKey = licenseKey;
2119
+ this.deviceName = deviceName;
2076
2120
  if (settings) {
2077
2121
  this.settings = settings;
2078
2122
  }
2079
- this.initialize();
2123
+ if (this.controller == null) {
2124
+ this.controller = DataCaptureContextController.forDataCaptureContext(this);
2125
+ }
2080
2126
  }
2081
2127
  setFrameSource(frameSource) {
2082
2128
  if (this._frameSource) {
@@ -2107,6 +2153,17 @@ class DataCaptureContext extends DefaultSerializeable {
2107
2153
  this.controller.addModeToContext(mode);
2108
2154
  }
2109
2155
  }
2156
+ setMode(mode) {
2157
+ if (this.modes.length > 0) {
2158
+ this.removeAllModes();
2159
+ }
2160
+ this.addMode(mode);
2161
+ }
2162
+ removeCurrentMode() {
2163
+ if (this.modes.length > 0) {
2164
+ this.removeMode(this.modes[0]);
2165
+ }
2166
+ }
2110
2167
  removeMode(mode) {
2111
2168
  if (this.modes.includes(mode)) {
2112
2169
  this.modes.splice(this.modes.indexOf(mode), 1);
@@ -2126,8 +2183,7 @@ class DataCaptureContext extends DefaultSerializeable {
2126
2183
  if (!this.controller) {
2127
2184
  return;
2128
2185
  }
2129
- DataCaptureContext.instance = null;
2130
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.dispose();
2186
+ (_a = this.view) === null || _a === undefined ? undefined : _a.dispose();
2131
2187
  this.removeAllModes();
2132
2188
  this.controller.dispose();
2133
2189
  }
@@ -2136,25 +2192,10 @@ class DataCaptureContext extends DefaultSerializeable {
2136
2192
  return this.update();
2137
2193
  }
2138
2194
  static getOpenSourceSoftwareLicenseInfo() {
2139
- return __awaiter(this, void 0, void 0, function* () {
2195
+ return __awaiter(this, undefined, undefined, function* () {
2140
2196
  return DataCaptureContextController.getOpenSourceSoftwareLicenseInfo();
2141
2197
  });
2142
2198
  }
2143
- // Called when the capture view is shown, that is the earliest point that we need the context deserialized.
2144
- initialize() {
2145
- if (this.controller) {
2146
- return;
2147
- }
2148
- this.controller = DataCaptureContextController.forDataCaptureContext(this);
2149
- }
2150
- initializeAsync() {
2151
- return __awaiter(this, void 0, void 0, function* () {
2152
- if (this.controller) {
2153
- return;
2154
- }
2155
- this.controller = yield DataCaptureContextController.forDataCaptureContextAsync(this);
2156
- });
2157
- }
2158
2199
  update() {
2159
2200
  if (!this.controller) {
2160
2201
  return Promise.resolve();
@@ -2162,42 +2203,34 @@ class DataCaptureContext extends DefaultSerializeable {
2162
2203
  return this.controller.updateContextFromJSON();
2163
2204
  }
2164
2205
  }
2165
- DataCaptureContext.instance = null;
2166
2206
  __decorate([
2167
2207
  ignoreFromSerialization
2168
- ], DataCaptureContext.prototype, "controller", void 0);
2208
+ ], DataCaptureContext.prototype, "controller", undefined);
2169
2209
  __decorate([
2170
2210
  nameForSerialization('framework')
2171
- ], DataCaptureContext.prototype, "_framework", void 0);
2211
+ ], DataCaptureContext.prototype, "_framework", undefined);
2172
2212
  __decorate([
2173
2213
  nameForSerialization('frameworkVersion')
2174
- ], DataCaptureContext.prototype, "_frameworkVersion", void 0);
2214
+ ], DataCaptureContext.prototype, "_frameworkVersion", undefined);
2175
2215
  __decorate([
2176
2216
  nameForSerialization('frameSource')
2177
- ], DataCaptureContext.prototype, "_frameSource", void 0);
2217
+ ], DataCaptureContext.prototype, "_frameSource", undefined);
2218
+ __decorate([
2219
+ ignoreFromSerialization
2220
+ ], DataCaptureContext.prototype, "view", undefined);
2178
2221
  __decorate([
2179
2222
  ignoreFromSerialization
2180
- ], DataCaptureContext.prototype, "view", void 0);
2223
+ ], DataCaptureContext.prototype, "modes", undefined);
2181
2224
  __decorate([
2182
2225
  ignoreFromSerialization
2183
- ], DataCaptureContext.prototype, "modes", void 0);
2226
+ ], DataCaptureContext.prototype, "listeners", undefined);
2184
2227
  __decorate([
2185
2228
  ignoreFromSerialization
2186
- ], DataCaptureContext.prototype, "listeners", void 0);
2229
+ ], DataCaptureContext, "_instance", undefined);
2187
2230
  __decorate([
2188
2231
  ignoreFromSerialization
2189
2232
  ], DataCaptureContext, "coreDefaults", null);
2190
2233
 
2191
- class DataCaptureContextFeatures {
2192
- static isFeatureSupported(feature) {
2193
- return this._featureFlags.get(feature);
2194
- }
2195
- static setIsFeatureSupported(feature, value) {
2196
- this._featureFlags.set(feature, value);
2197
- }
2198
- }
2199
- DataCaptureContextFeatures._featureFlags = new Map();
2200
-
2201
2234
  var DataCaptureViewEvents;
2202
2235
  (function (DataCaptureViewEvents) {
2203
2236
  DataCaptureViewEvents["didChangeSize"] = "DataCaptureViewListener.onSizeChanged";
@@ -2216,13 +2249,13 @@ class DataCaptureViewController extends BaseController {
2216
2249
  super('DataCaptureViewProxy');
2217
2250
  }
2218
2251
  viewPointForFramePoint(point) {
2219
- return __awaiter(this, void 0, void 0, function* () {
2252
+ return __awaiter(this, undefined, undefined, function* () {
2220
2253
  const result = yield this._proxy.viewPointForFramePoint(JSON.stringify(point.toJSON()));
2221
2254
  return Point.fromJSON(JSON.parse(result.data));
2222
2255
  });
2223
2256
  }
2224
2257
  viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
2225
- return __awaiter(this, void 0, void 0, function* () {
2258
+ return __awaiter(this, undefined, undefined, function* () {
2226
2259
  const result = yield this._proxy.viewQuadrilateralForFrameQuadrilateral(JSON.stringify(quadrilateral.toJSON()));
2227
2260
  return Quadrilateral.fromJSON(JSON.parse(result.data));
2228
2261
  });
@@ -2237,7 +2270,7 @@ class DataCaptureViewController extends BaseController {
2237
2270
  return this._proxy.hide();
2238
2271
  }
2239
2272
  createNativeView() {
2240
- return __awaiter(this, void 0, void 0, function* () {
2273
+ return __awaiter(this, undefined, undefined, function* () {
2241
2274
  yield this.createView();
2242
2275
  this.subscribeListener();
2243
2276
  });
@@ -2257,7 +2290,7 @@ class DataCaptureViewController extends BaseController {
2257
2290
  subscribeListener() {
2258
2291
  var _a, _b;
2259
2292
  this._proxy.registerListenerForViewEvents();
2260
- (_b = (_a = this._proxy).subscribeDidChangeSize) === null || _b === void 0 ? void 0 : _b.call(_a);
2293
+ (_b = (_a = this._proxy).subscribeDidChangeSize) === null || _b === undefined ? undefined : _b.call(_a);
2261
2294
  this.eventEmitter.on(DataCaptureViewEvents.didChangeSize, (data) => {
2262
2295
  const event = EventDataParser.parse(data);
2263
2296
  if (event === null) {
@@ -2357,6 +2390,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2357
2390
  constructor(autoCreateNativeView) {
2358
2391
  super();
2359
2392
  this._context = null;
2393
+ this.viewId = null;
2360
2394
  this.overlays = [];
2361
2395
  this.controls = [];
2362
2396
  this.listeners = [];
@@ -2429,7 +2463,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2429
2463
  this.controller.updateView();
2430
2464
  }
2431
2465
  createNativeView() {
2432
- return __awaiter(this, void 0, void 0, function* () {
2466
+ return __awaiter(this, undefined, undefined, function* () {
2433
2467
  if (this.isViewCreated) {
2434
2468
  return Promise.resolve();
2435
2469
  }
@@ -2438,7 +2472,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
2438
2472
  });
2439
2473
  }
2440
2474
  removeNativeView() {
2441
- return __awaiter(this, void 0, void 0, function* () {
2475
+ return __awaiter(this, undefined, undefined, function* () {
2442
2476
  if (!this.isViewCreated) {
2443
2477
  return Promise.resolve();
2444
2478
  }
@@ -2463,7 +2497,6 @@ class BaseDataCaptureView extends DefaultSerializeable {
2463
2497
  if (!this.context) {
2464
2498
  throw new Error('There should be a context attached to a view that should be shown');
2465
2499
  }
2466
- this.privateContext.initialize();
2467
2500
  return this.controller.show();
2468
2501
  }
2469
2502
  hide() {
@@ -2475,43 +2508,46 @@ class BaseDataCaptureView extends DefaultSerializeable {
2475
2508
  }
2476
2509
  __decorate([
2477
2510
  ignoreFromSerialization
2478
- ], BaseDataCaptureView.prototype, "_context", void 0);
2511
+ ], BaseDataCaptureView.prototype, "_context", undefined);
2479
2512
  __decorate([
2480
2513
  ignoreFromSerialization
2481
- ], BaseDataCaptureView.prototype, "viewComponent", void 0);
2514
+ ], BaseDataCaptureView.prototype, "viewComponent", undefined);
2482
2515
  __decorate([
2483
2516
  ignoreFromSerialization
2484
2517
  ], BaseDataCaptureView.prototype, "coreDefaults", null);
2485
2518
  __decorate([
2486
2519
  nameForSerialization('scanAreaMargins')
2487
- ], BaseDataCaptureView.prototype, "_scanAreaMargins", void 0);
2520
+ ], BaseDataCaptureView.prototype, "_scanAreaMargins", undefined);
2521
+ __decorate([
2522
+ ignoreFromSerializationIfNull
2523
+ ], BaseDataCaptureView.prototype, "viewId", undefined);
2488
2524
  __decorate([
2489
2525
  nameForSerialization('pointOfInterest')
2490
- ], BaseDataCaptureView.prototype, "_pointOfInterest", void 0);
2526
+ ], BaseDataCaptureView.prototype, "_pointOfInterest", undefined);
2491
2527
  __decorate([
2492
2528
  nameForSerialization('logoAnchor')
2493
- ], BaseDataCaptureView.prototype, "_logoAnchor", void 0);
2529
+ ], BaseDataCaptureView.prototype, "_logoAnchor", undefined);
2494
2530
  __decorate([
2495
2531
  nameForSerialization('logoOffset')
2496
- ], BaseDataCaptureView.prototype, "_logoOffset", void 0);
2532
+ ], BaseDataCaptureView.prototype, "_logoOffset", undefined);
2497
2533
  __decorate([
2498
2534
  nameForSerialization('focusGesture')
2499
- ], BaseDataCaptureView.prototype, "_focusGesture", void 0);
2535
+ ], BaseDataCaptureView.prototype, "_focusGesture", undefined);
2500
2536
  __decorate([
2501
2537
  nameForSerialization('zoomGesture')
2502
- ], BaseDataCaptureView.prototype, "_zoomGesture", void 0);
2538
+ ], BaseDataCaptureView.prototype, "_zoomGesture", undefined);
2503
2539
  __decorate([
2504
2540
  nameForSerialization('logoStyle')
2505
- ], BaseDataCaptureView.prototype, "_logoStyle", void 0);
2541
+ ], BaseDataCaptureView.prototype, "_logoStyle", undefined);
2506
2542
  __decorate([
2507
2543
  ignoreFromSerialization
2508
- ], BaseDataCaptureView.prototype, "controller", void 0);
2544
+ ], BaseDataCaptureView.prototype, "controller", undefined);
2509
2545
  __decorate([
2510
2546
  ignoreFromSerialization
2511
- ], BaseDataCaptureView.prototype, "listeners", void 0);
2547
+ ], BaseDataCaptureView.prototype, "listeners", undefined);
2512
2548
  __decorate([
2513
2549
  ignoreFromSerialization
2514
- ], BaseDataCaptureView.prototype, "isViewCreated", void 0);
2550
+ ], BaseDataCaptureView.prototype, "isViewCreated", undefined);
2515
2551
 
2516
2552
  class ZoomSwitchControl extends DefaultSerializeable {
2517
2553
  constructor() {
@@ -2527,76 +2563,76 @@ class ZoomSwitchControl extends DefaultSerializeable {
2527
2563
  }
2528
2564
  get zoomedOutImage() {
2529
2565
  var _a, _b;
2530
- if (((_a = this.icon.zoomedOut.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2531
- return (_b = this.icon.zoomedOut.default) === null || _b === void 0 ? void 0 : _b.data;
2566
+ if (((_a = this.icon.zoomedOut.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2567
+ return (_b = this.icon.zoomedOut.default) === null || _b === undefined ? undefined : _b.data;
2532
2568
  }
2533
2569
  return null;
2534
2570
  }
2535
2571
  set zoomedOutImage(zoomedOutImage) {
2536
2572
  var _a;
2537
2573
  this.icon.zoomedOut.default = ControlImage.fromBase64EncodedImage(zoomedOutImage);
2538
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2574
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2539
2575
  }
2540
2576
  get zoomedInImage() {
2541
2577
  var _a, _b;
2542
- if (((_a = this.icon.zoomedIn.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2543
- return (_b = this.icon.zoomedIn.default) === null || _b === void 0 ? void 0 : _b.data;
2578
+ if (((_a = this.icon.zoomedIn.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2579
+ return (_b = this.icon.zoomedIn.default) === null || _b === undefined ? undefined : _b.data;
2544
2580
  }
2545
2581
  return null;
2546
2582
  }
2547
2583
  set zoomedInImage(zoomedInImage) {
2548
2584
  var _a;
2549
2585
  this.icon.zoomedIn.default = ControlImage.fromBase64EncodedImage(zoomedInImage);
2550
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2586
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2551
2587
  }
2552
2588
  get zoomedInPressedImage() {
2553
2589
  var _a, _b;
2554
- if (((_a = this.icon.zoomedIn.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2555
- return (_b = this.icon.zoomedIn.pressed) === null || _b === void 0 ? void 0 : _b.data;
2590
+ if (((_a = this.icon.zoomedIn.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2591
+ return (_b = this.icon.zoomedIn.pressed) === null || _b === undefined ? undefined : _b.data;
2556
2592
  }
2557
2593
  return null;
2558
2594
  }
2559
2595
  set zoomedInPressedImage(zoomedInPressedImage) {
2560
2596
  var _a;
2561
2597
  this.icon.zoomedIn.pressed = ControlImage.fromBase64EncodedImage(zoomedInPressedImage);
2562
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2598
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2563
2599
  }
2564
2600
  get zoomedOutPressedImage() {
2565
2601
  var _a, _b;
2566
- if (((_a = this.icon.zoomedOut.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2567
- return (_b = this.icon.zoomedOut.pressed) === null || _b === void 0 ? void 0 : _b.data;
2602
+ if (((_a = this.icon.zoomedOut.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2603
+ return (_b = this.icon.zoomedOut.pressed) === null || _b === undefined ? undefined : _b.data;
2568
2604
  }
2569
2605
  return null;
2570
2606
  }
2571
2607
  set zoomedOutPressedImage(zoomedOutPressedImage) {
2572
2608
  var _a;
2573
2609
  this.icon.zoomedOut.pressed = ControlImage.fromBase64EncodedImage(zoomedOutPressedImage);
2574
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2610
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2575
2611
  }
2576
2612
  setZoomedInImage(resource) {
2577
2613
  var _a;
2578
2614
  this.icon.zoomedIn.default = ControlImage.fromResourceName(resource);
2579
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2615
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2580
2616
  }
2581
2617
  setZoomedInPressedImage(resource) {
2582
2618
  var _a;
2583
2619
  this.icon.zoomedIn.pressed = ControlImage.fromResourceName(resource);
2584
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2620
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2585
2621
  }
2586
2622
  setZoomedOutImage(resource) {
2587
2623
  var _a;
2588
2624
  this.icon.zoomedOut.default = ControlImage.fromResourceName(resource);
2589
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2625
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2590
2626
  }
2591
2627
  setZoomedOutPressedImage(resource) {
2592
2628
  var _a;
2593
2629
  this.icon.zoomedOut.pressed = ControlImage.fromResourceName(resource);
2594
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2630
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2595
2631
  }
2596
2632
  }
2597
2633
  __decorate([
2598
2634
  ignoreFromSerialization
2599
- ], ZoomSwitchControl.prototype, "view", void 0);
2635
+ ], ZoomSwitchControl.prototype, "view", undefined);
2600
2636
 
2601
2637
  class TorchSwitchControl extends DefaultSerializeable {
2602
2638
  constructor() {
@@ -2612,66 +2648,66 @@ class TorchSwitchControl extends DefaultSerializeable {
2612
2648
  }
2613
2649
  get torchOffImage() {
2614
2650
  var _a, _b;
2615
- if (((_a = this.icon.off.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2616
- return (_b = this.icon.off.default) === null || _b === void 0 ? void 0 : _b.data;
2651
+ if (((_a = this.icon.off.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2652
+ return (_b = this.icon.off.default) === null || _b === undefined ? undefined : _b.data;
2617
2653
  }
2618
2654
  return null;
2619
2655
  }
2620
2656
  set torchOffImage(torchOffImage) {
2621
2657
  var _a;
2622
2658
  this.icon.off.default = ControlImage.fromBase64EncodedImage(torchOffImage);
2623
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2659
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2624
2660
  }
2625
2661
  get torchOffPressedImage() {
2626
2662
  var _a, _b;
2627
- if (((_a = this.icon.off.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2628
- return (_b = this.icon.off.pressed) === null || _b === void 0 ? void 0 : _b.data;
2663
+ if (((_a = this.icon.off.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2664
+ return (_b = this.icon.off.pressed) === null || _b === undefined ? undefined : _b.data;
2629
2665
  }
2630
2666
  return null;
2631
2667
  }
2632
2668
  set torchOffPressedImage(torchOffPressedImage) {
2633
2669
  var _a;
2634
2670
  this.icon.off.pressed = ControlImage.fromBase64EncodedImage(torchOffPressedImage);
2635
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2671
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2636
2672
  }
2637
2673
  get torchOnImage() {
2638
2674
  var _a, _b;
2639
- if (((_a = this.icon.on.default) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2640
- return (_b = this.icon.on.default) === null || _b === void 0 ? void 0 : _b.data;
2675
+ if (((_a = this.icon.on.default) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2676
+ return (_b = this.icon.on.default) === null || _b === undefined ? undefined : _b.data;
2641
2677
  }
2642
2678
  return null;
2643
2679
  }
2644
2680
  set torchOnImage(torchOnImage) {
2645
2681
  var _a;
2646
2682
  this.icon.on.default = ControlImage.fromBase64EncodedImage(torchOnImage);
2647
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2683
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2648
2684
  }
2649
2685
  get torchOnPressedImage() {
2650
2686
  var _a, _b;
2651
- if (((_a = this.icon.on.pressed) === null || _a === void 0 ? void 0 : _a.isBase64EncodedImage()) == true) {
2652
- return (_b = this.icon.on.pressed) === null || _b === void 0 ? void 0 : _b.data;
2687
+ if (((_a = this.icon.on.pressed) === null || _a === undefined ? undefined : _a.isBase64EncodedImage()) == true) {
2688
+ return (_b = this.icon.on.pressed) === null || _b === undefined ? undefined : _b.data;
2653
2689
  }
2654
2690
  return null;
2655
2691
  }
2656
2692
  setTorchOffImage(resource) {
2657
2693
  var _a;
2658
2694
  this.icon.off.default = ControlImage.fromResourceName(resource);
2659
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2695
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2660
2696
  }
2661
2697
  setTorchOffPressedImage(resource) {
2662
2698
  var _a;
2663
2699
  this.icon.off.pressed = ControlImage.fromResourceName(resource);
2664
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2700
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2665
2701
  }
2666
2702
  setTorchOnImage(resource) {
2667
2703
  var _a;
2668
2704
  this.icon.on.default = ControlImage.fromResourceName(resource);
2669
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2705
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2670
2706
  }
2671
2707
  setTorchOnPressedImage(resource) {
2672
2708
  var _a;
2673
2709
  this.icon.on.pressed = ControlImage.fromResourceName(resource);
2674
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2710
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2675
2711
  }
2676
2712
  setImageResource(resource) {
2677
2713
  var _a;
@@ -2679,17 +2715,17 @@ class TorchSwitchControl extends DefaultSerializeable {
2679
2715
  this.icon.off.pressed = ControlImage.fromResourceName(resource);
2680
2716
  this.icon.on.default = ControlImage.fromResourceName(resource);
2681
2717
  this.icon.on.pressed = ControlImage.fromResourceName(resource);
2682
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2718
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2683
2719
  }
2684
2720
  set torchOnPressedImage(torchOnPressedImage) {
2685
2721
  var _a;
2686
2722
  this.icon.on.pressed = ControlImage.fromBase64EncodedImage(torchOnPressedImage);
2687
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.controlUpdated();
2723
+ (_a = this.view) === null || _a === undefined ? undefined : _a.controlUpdated();
2688
2724
  }
2689
2725
  }
2690
2726
  __decorate([
2691
2727
  ignoreFromSerialization
2692
- ], TorchSwitchControl.prototype, "view", void 0);
2728
+ ], TorchSwitchControl.prototype, "view", undefined);
2693
2729
 
2694
2730
  var VideoResolution;
2695
2731
  (function (VideoResolution) {
@@ -2804,7 +2840,7 @@ class CameraSettings extends DefaultSerializeable {
2804
2840
  }
2805
2841
  __decorate([
2806
2842
  ignoreFromSerialization
2807
- ], CameraSettings.prototype, "focusHiddenProperties", void 0);
2843
+ ], CameraSettings.prototype, "focusHiddenProperties", undefined);
2808
2844
 
2809
2845
  const NoViewfinder = { type: 'none' };
2810
2846
 
@@ -2826,7 +2862,7 @@ class RectangularViewfinderAnimation extends DefaultSerializeable {
2826
2862
  }
2827
2863
  __decorate([
2828
2864
  nameForSerialization('isLooping')
2829
- ], RectangularViewfinderAnimation.prototype, "_isLooping", void 0);
2865
+ ], RectangularViewfinderAnimation.prototype, "_isLooping", undefined);
2830
2866
 
2831
2867
  class RectangularViewfinder extends DefaultSerializeable {
2832
2868
  get sizeWithUnitAndAspect() {
@@ -2909,29 +2945,29 @@ class RectangularViewfinder extends DefaultSerializeable {
2909
2945
  }
2910
2946
  __decorate([
2911
2947
  nameForSerialization('style')
2912
- ], RectangularViewfinder.prototype, "_style", void 0);
2948
+ ], RectangularViewfinder.prototype, "_style", undefined);
2913
2949
  __decorate([
2914
2950
  nameForSerialization('lineStyle')
2915
- ], RectangularViewfinder.prototype, "_lineStyle", void 0);
2951
+ ], RectangularViewfinder.prototype, "_lineStyle", undefined);
2916
2952
  __decorate([
2917
2953
  nameForSerialization('dimming')
2918
- ], RectangularViewfinder.prototype, "_dimming", void 0);
2954
+ ], RectangularViewfinder.prototype, "_dimming", undefined);
2919
2955
  __decorate([
2920
2956
  nameForSerialization('disabledDimming')
2921
- ], RectangularViewfinder.prototype, "_disabledDimming", void 0);
2957
+ ], RectangularViewfinder.prototype, "_disabledDimming", undefined);
2922
2958
  __decorate([
2923
2959
  nameForSerialization('animation'),
2924
2960
  ignoreFromSerialization
2925
- ], RectangularViewfinder.prototype, "_animation", void 0);
2961
+ ], RectangularViewfinder.prototype, "_animation", undefined);
2926
2962
  __decorate([
2927
2963
  nameForSerialization('size')
2928
- ], RectangularViewfinder.prototype, "_sizeWithUnitAndAspect", void 0);
2964
+ ], RectangularViewfinder.prototype, "_sizeWithUnitAndAspect", undefined);
2929
2965
  __decorate([
2930
2966
  nameForSerialization('disabledColor')
2931
- ], RectangularViewfinder.prototype, "_disabledColor", void 0);
2967
+ ], RectangularViewfinder.prototype, "_disabledColor", undefined);
2932
2968
  __decorate([
2933
2969
  ignoreFromSerialization
2934
- ], RectangularViewfinder.prototype, "eventEmitter", void 0);
2970
+ ], RectangularViewfinder.prototype, "eventEmitter", undefined);
2935
2971
 
2936
2972
  var RectangularViewfinderStyle;
2937
2973
  (function (RectangularViewfinderStyle) {
@@ -3071,11 +3107,11 @@ class WaveFormVibration extends Vibration {
3071
3107
  }
3072
3108
  __decorate([
3073
3109
  nameForSerialization('timings')
3074
- ], WaveFormVibration.prototype, "_timings", void 0);
3110
+ ], WaveFormVibration.prototype, "_timings", undefined);
3075
3111
  __decorate([
3076
3112
  ignoreFromSerializationIfNull,
3077
3113
  nameForSerialization('amplitudes')
3078
- ], WaveFormVibration.prototype, "_amplitudes", void 0);
3114
+ ], WaveFormVibration.prototype, "_amplitudes", undefined);
3079
3115
 
3080
3116
  class Sound extends DefaultSerializeable {
3081
3117
  static get defaultSound() {
@@ -3092,7 +3128,7 @@ class Sound extends DefaultSerializeable {
3092
3128
  }
3093
3129
  __decorate([
3094
3130
  ignoreFromSerializationIfNull
3095
- ], Sound.prototype, "resource", void 0);
3131
+ ], Sound.prototype, "resource", undefined);
3096
3132
 
3097
3133
  class FeedbackController {
3098
3134
  constructor(feedback) {
@@ -3119,7 +3155,7 @@ class Feedback extends DefaultSerializeable {
3119
3155
  return this._sound;
3120
3156
  }
3121
3157
  static fromJSON(json) {
3122
- return new Feedback((json === null || json === void 0 ? void 0 : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === void 0 ? void 0 : json.sound) ? Sound.fromJSON(json.sound) : null);
3158
+ return new Feedback((json === null || json === undefined ? undefined : json.vibration) ? Vibration.fromJSON(json.vibration) : null, (json === null || json === undefined ? undefined : json.sound) ? Sound.fromJSON(json.sound) : null);
3123
3159
  }
3124
3160
  constructor(vibration, sound) {
3125
3161
  super();
@@ -3139,14 +3175,14 @@ class Feedback extends DefaultSerializeable {
3139
3175
  __decorate([
3140
3176
  ignoreFromSerializationIfNull,
3141
3177
  nameForSerialization('vibration')
3142
- ], Feedback.prototype, "_vibration", void 0);
3178
+ ], Feedback.prototype, "_vibration", undefined);
3143
3179
  __decorate([
3144
3180
  ignoreFromSerializationIfNull,
3145
3181
  nameForSerialization('sound')
3146
- ], Feedback.prototype, "_sound", void 0);
3182
+ ], Feedback.prototype, "_sound", undefined);
3147
3183
  __decorate([
3148
3184
  ignoreFromSerialization
3149
- ], Feedback.prototype, "controller", void 0);
3185
+ ], Feedback.prototype, "controller", undefined);
3150
3186
 
3151
3187
  const NoneLocationSelection = { type: 'none' };
3152
3188
 
@@ -3166,7 +3202,7 @@ class RadiusLocationSelection extends DefaultSerializeable {
3166
3202
  }
3167
3203
  __decorate([
3168
3204
  nameForSerialization('radius')
3169
- ], RadiusLocationSelection.prototype, "_radius", void 0);
3205
+ ], RadiusLocationSelection.prototype, "_radius", undefined);
3170
3206
 
3171
3207
  class RectangularLocationSelection extends DefaultSerializeable {
3172
3208
  constructor() {
@@ -3228,7 +3264,7 @@ class RectangularLocationSelection extends DefaultSerializeable {
3228
3264
  }
3229
3265
  __decorate([
3230
3266
  nameForSerialization('size')
3231
- ], RectangularLocationSelection.prototype, "_sizeWithUnitAndAspect", void 0);
3267
+ ], RectangularLocationSelection.prototype, "_sizeWithUnitAndAspect", undefined);
3232
3268
 
3233
3269
  class LicenseInfo extends DefaultSerializeable {
3234
3270
  get expiration() {
@@ -3238,7 +3274,7 @@ class LicenseInfo extends DefaultSerializeable {
3238
3274
  __decorate([
3239
3275
  nameForSerialization('expiration')
3240
3276
  // @ts-ignore
3241
- ], LicenseInfo.prototype, "_expiration", void 0);
3277
+ ], LicenseInfo.prototype, "_expiration", undefined);
3242
3278
 
3243
3279
  var Expiration;
3244
3280
  (function (Expiration) {
@@ -3249,5 +3285,5 @@ var Expiration;
3249
3285
 
3250
3286
  createEventEmitter();
3251
3287
 
3252
- export { AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextFeatures, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, 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, createAdvancedNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
3288
+ export { AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, 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, createAdvancedNativeFromCtorProxy, createAdvancedNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
3253
3289
  //# sourceMappingURL=index.js.map