scandit-datacapture-frameworks-core 8.1.1 → 8.2.0

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
@@ -391,17 +391,11 @@ class FactoryMaker {
391
391
  }
392
392
  FactoryMaker.instances = new Map();
393
393
 
394
- function getCoreDefaults() {
395
- return FactoryMaker.getInstance('CoreDefaults');
396
- }
397
-
398
- /* eslint-disable @typescript-eslint/no-explicit-any */
399
394
  function ignoreFromSerialization(target, propertyName) {
400
395
  target.ignoredProperties = target.ignoredProperties || [];
401
396
  target.ignoredProperties.push(propertyName);
402
397
  }
403
398
 
404
- /* eslint-disable @typescript-eslint/no-explicit-any */
405
399
  function nameForSerialization(customName) {
406
400
  return (target, propertyName) => {
407
401
  target.customPropertyNames = target.customPropertyNames || {};
@@ -409,13 +403,11 @@ function nameForSerialization(customName) {
409
403
  };
410
404
  }
411
405
 
412
- /* eslint-disable @typescript-eslint/no-explicit-any */
413
406
  function ignoreFromSerializationIfNull(target, propertyName) {
414
407
  target.ignoredIfNullProperties = target.ignoredIfNullProperties || [];
415
408
  target.ignoredIfNullProperties.push(propertyName);
416
409
  }
417
410
 
418
- /* eslint-disable @typescript-eslint/no-explicit-any */
419
411
  function serializationDefault(defaultValue) {
420
412
  return (target, propertyName) => {
421
413
  target.customPropertyDefaults = target.customPropertyDefaults || {};
@@ -541,6 +533,18 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
541
533
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
542
534
  };
543
535
 
536
+ var CameraPosition;
537
+ (function (CameraPosition) {
538
+ CameraPosition["WorldFacing"] = "worldFacing";
539
+ CameraPosition["UserFacing"] = "userFacing";
540
+ CameraPosition["Unspecified"] = "unspecified";
541
+ })(CameraPosition || (CameraPosition = {}));
542
+
543
+ var FrameSourceListenerEvents;
544
+ (function (FrameSourceListenerEvents) {
545
+ FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
546
+ })(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
547
+
544
548
  var FrameSourceState;
545
549
  (function (FrameSourceState) {
546
550
  FrameSourceState["On"] = "on";
@@ -626,11 +630,6 @@ class FrameDataSettingsBuilder {
626
630
  }
627
631
  }
628
632
 
629
- var FrameSourceListenerEvents;
630
- (function (FrameSourceListenerEvents) {
631
- FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
632
- })(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
633
-
634
633
  var FontFamily;
635
634
  (function (FontFamily) {
636
635
  FontFamily["SystemDefault"] = "systemDefault";
@@ -1313,7 +1312,9 @@ class Observable extends DefaultSerializeable {
1313
1312
  this.listeners = [];
1314
1313
  }
1315
1314
  addListener(listener) {
1316
- this.listeners.push(listener);
1315
+ if (!this.listeners.includes(listener)) {
1316
+ this.listeners.push(listener);
1317
+ }
1317
1318
  }
1318
1319
  removeListener(listener) {
1319
1320
  this.listeners = this.listeners.filter(l => l !== listener);
@@ -1382,13 +1383,352 @@ class BaseController {
1382
1383
  }
1383
1384
  }
1384
1385
 
1386
+ /*
1387
+ * This file is part of the Scandit Data Capture SDK
1388
+ *
1389
+ * Copyright (C) 2025- Scandit AG. All rights reserved.
1390
+ */
1391
+ /**
1392
+ * Adapter class for Core operations.
1393
+ * Provides typed methods that internally call $executeCore.
1394
+ * Generated from schema definition to ensure parameter and method name consistency.
1395
+ */
1396
+ class CoreProxyAdapter {
1397
+ constructor(proxy) {
1398
+ this.proxy = proxy;
1399
+ }
1400
+ /**
1401
+ * Gets the camera state for a given position
1402
+ * @param cameraPosition Camera position as JSON string
1403
+ */
1404
+ getCameraState(_a) {
1405
+ return __awaiter(this, arguments, void 0, function* ({ cameraPosition }) {
1406
+ const result = yield this.proxy.$executeCore({
1407
+ moduleName: 'CoreModule',
1408
+ methodName: 'getCameraState',
1409
+ isEventRegistration: false,
1410
+ cameraPosition,
1411
+ });
1412
+ return JSON.parse(result.data);
1413
+ });
1414
+ }
1415
+ /**
1416
+ * Switches the camera to the desired state
1417
+ * @param stateJson Desired camera state as JSON string
1418
+ */
1419
+ switchCameraToDesiredState(_a) {
1420
+ return __awaiter(this, arguments, void 0, function* ({ stateJson }) {
1421
+ const result = yield this.proxy.$executeCore({
1422
+ moduleName: 'CoreModule',
1423
+ methodName: 'switchCameraToDesiredState',
1424
+ isEventRegistration: false,
1425
+ stateJson,
1426
+ });
1427
+ return result;
1428
+ });
1429
+ }
1430
+ /**
1431
+ * Checks if torch is available for the given camera position
1432
+ * @param cameraPosition Camera position as JSON string
1433
+ */
1434
+ isTorchAvailable(_a) {
1435
+ return __awaiter(this, arguments, void 0, function* ({ cameraPosition }) {
1436
+ const result = yield this.proxy.$executeCore({
1437
+ moduleName: 'CoreModule',
1438
+ methodName: 'isTorchAvailable',
1439
+ isEventRegistration: false,
1440
+ cameraPosition,
1441
+ });
1442
+ return result.data === 'true';
1443
+ });
1444
+ }
1445
+ /**
1446
+ * Registers a persistent listener for frame source state change events
1447
+ */
1448
+ registerFrameSourceListener() {
1449
+ return __awaiter(this, void 0, void 0, function* () {
1450
+ const result = yield this.proxy.$executeCore({
1451
+ moduleName: 'CoreModule',
1452
+ methodName: 'registerFrameSourceListener',
1453
+ isEventRegistration: true,
1454
+ });
1455
+ return result;
1456
+ });
1457
+ }
1458
+ /**
1459
+ * Unregisters the frame source event listener
1460
+ */
1461
+ unregisterFrameSourceListener() {
1462
+ return __awaiter(this, void 0, void 0, function* () {
1463
+ const result = yield this.proxy.$executeCore({
1464
+ moduleName: 'CoreModule',
1465
+ methodName: 'unregisterFrameSourceListener',
1466
+ isEventRegistration: false,
1467
+ });
1468
+ return result;
1469
+ });
1470
+ }
1471
+ /**
1472
+ * Gets the last frame data by frame ID as JSON
1473
+ * @param frameId Unique frame identifier
1474
+ */
1475
+ getLastFrameAsJson(_a) {
1476
+ return __awaiter(this, arguments, void 0, function* ({ frameId }) {
1477
+ const result = yield this.proxy.$executeCore({
1478
+ moduleName: 'CoreModule',
1479
+ methodName: 'getLastFrameAsJson',
1480
+ isEventRegistration: false,
1481
+ frameId,
1482
+ });
1483
+ return result.data;
1484
+ });
1485
+ }
1486
+ /**
1487
+ * Gets the last frame data by frame ID as JSON, or null if not found
1488
+ * @param frameId Unique frame identifier
1489
+ */
1490
+ getLastFrameOrNullAsJson(_a) {
1491
+ return __awaiter(this, arguments, void 0, function* ({ frameId }) {
1492
+ const result = yield this.proxy.$executeCore({
1493
+ moduleName: 'CoreModule',
1494
+ methodName: 'getLastFrameOrNullAsJson',
1495
+ isEventRegistration: false,
1496
+ frameId,
1497
+ });
1498
+ if (result === null)
1499
+ return null;
1500
+ return result.data;
1501
+ });
1502
+ }
1503
+ /**
1504
+ * Creates a DataCaptureContext from JSON
1505
+ * @param contextJson DataCaptureContext configuration as JSON string
1506
+ */
1507
+ createContextFromJson(_a) {
1508
+ return __awaiter(this, arguments, void 0, function* ({ contextJson }) {
1509
+ const result = yield this.proxy.$executeCore({
1510
+ moduleName: 'CoreModule',
1511
+ methodName: 'createContextFromJson',
1512
+ isEventRegistration: false,
1513
+ contextJson,
1514
+ });
1515
+ return result;
1516
+ });
1517
+ }
1518
+ /**
1519
+ * Updates a DataCaptureContext from JSON
1520
+ * @param contextJson Updated DataCaptureContext configuration as JSON string
1521
+ */
1522
+ updateContextFromJson(_a) {
1523
+ return __awaiter(this, arguments, void 0, function* ({ contextJson }) {
1524
+ const result = yield this.proxy.$executeCore({
1525
+ moduleName: 'CoreModule',
1526
+ methodName: 'updateContextFromJson',
1527
+ isEventRegistration: false,
1528
+ contextJson,
1529
+ });
1530
+ return result;
1531
+ });
1532
+ }
1533
+ /**
1534
+ * Subscribes to context events with persistent listener
1535
+ */
1536
+ subscribeContextListener() {
1537
+ return __awaiter(this, void 0, void 0, function* () {
1538
+ const result = yield this.proxy.$executeCore({
1539
+ moduleName: 'CoreModule',
1540
+ methodName: 'subscribeContextListener',
1541
+ isEventRegistration: true,
1542
+ });
1543
+ return result;
1544
+ });
1545
+ }
1546
+ /**
1547
+ * Unsubscribes from context events
1548
+ */
1549
+ unsubscribeContextListener() {
1550
+ return __awaiter(this, void 0, void 0, function* () {
1551
+ const result = yield this.proxy.$executeCore({
1552
+ moduleName: 'CoreModule',
1553
+ methodName: 'unsubscribeContextListener',
1554
+ isEventRegistration: false,
1555
+ });
1556
+ return result;
1557
+ });
1558
+ }
1559
+ /**
1560
+ * Adds a mode to the DataCaptureContext
1561
+ * @param modeJson Mode configuration as JSON string
1562
+ */
1563
+ addModeToContext(_a) {
1564
+ return __awaiter(this, arguments, void 0, function* ({ modeJson }) {
1565
+ const result = yield this.proxy.$executeCore({
1566
+ moduleName: 'CoreModule',
1567
+ methodName: 'addModeToContext',
1568
+ isEventRegistration: false,
1569
+ modeJson,
1570
+ });
1571
+ return result;
1572
+ });
1573
+ }
1574
+ /**
1575
+ * Removes a mode from the DataCaptureContext
1576
+ * @param modeJson Mode configuration as JSON string
1577
+ */
1578
+ removeModeFromContext(_a) {
1579
+ return __awaiter(this, arguments, void 0, function* ({ modeJson }) {
1580
+ const result = yield this.proxy.$executeCore({
1581
+ moduleName: 'CoreModule',
1582
+ methodName: 'removeModeFromContext',
1583
+ isEventRegistration: false,
1584
+ modeJson,
1585
+ });
1586
+ return result;
1587
+ });
1588
+ }
1589
+ /**
1590
+ * Removes all modes from the DataCaptureContext
1591
+ */
1592
+ removeAllModes() {
1593
+ return __awaiter(this, void 0, void 0, function* () {
1594
+ const result = yield this.proxy.$executeCore({
1595
+ moduleName: 'CoreModule',
1596
+ methodName: 'removeAllModes',
1597
+ isEventRegistration: false,
1598
+ });
1599
+ return result;
1600
+ });
1601
+ }
1602
+ /**
1603
+ * Gets open source software license information
1604
+ */
1605
+ getOpenSourceSoftwareLicenseInfo() {
1606
+ return __awaiter(this, void 0, void 0, function* () {
1607
+ const result = yield this.proxy.$executeCore({
1608
+ moduleName: 'CoreModule',
1609
+ methodName: 'getOpenSourceSoftwareLicenseInfo',
1610
+ isEventRegistration: false,
1611
+ });
1612
+ return result.data;
1613
+ });
1614
+ }
1615
+ /**
1616
+ * Disposes the DataCaptureContext and releases resources
1617
+ */
1618
+ disposeContext() {
1619
+ return __awaiter(this, void 0, void 0, function* () {
1620
+ const result = yield this.proxy.$executeCore({
1621
+ moduleName: 'CoreModule',
1622
+ methodName: 'disposeContext',
1623
+ isEventRegistration: false,
1624
+ });
1625
+ return result;
1626
+ });
1627
+ }
1628
+ /**
1629
+ * Converts a point from frame coordinates to view coordinates
1630
+ * @param viewId View identifier
1631
+ * @param pointJson Point in frame coordinates as JSON string
1632
+ */
1633
+ viewPointForFramePoint(_a) {
1634
+ return __awaiter(this, arguments, void 0, function* ({ viewId, pointJson }) {
1635
+ const result = yield this.proxy.$executeCore({
1636
+ moduleName: 'CoreModule',
1637
+ methodName: 'viewPointForFramePoint',
1638
+ isEventRegistration: false,
1639
+ viewId,
1640
+ pointJson,
1641
+ });
1642
+ return result.data;
1643
+ });
1644
+ }
1645
+ /**
1646
+ * Converts a quadrilateral from frame coordinates to view coordinates
1647
+ * @param viewId View identifier
1648
+ * @param quadrilateralJson Quadrilateral in frame coordinates as JSON string
1649
+ */
1650
+ viewQuadrilateralForFrameQuadrilateral(_a) {
1651
+ return __awaiter(this, arguments, void 0, function* ({ viewId, quadrilateralJson, }) {
1652
+ const result = yield this.proxy.$executeCore({
1653
+ moduleName: 'CoreModule',
1654
+ methodName: 'viewQuadrilateralForFrameQuadrilateral',
1655
+ isEventRegistration: false,
1656
+ viewId,
1657
+ quadrilateralJson,
1658
+ });
1659
+ return result.data;
1660
+ });
1661
+ }
1662
+ /**
1663
+ * Registers persistent event listener for view events
1664
+ * @param viewId View identifier
1665
+ */
1666
+ registerListenerForViewEvents(_a) {
1667
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1668
+ const result = yield this.proxy.$executeCore({
1669
+ moduleName: 'CoreModule',
1670
+ methodName: 'registerListenerForViewEvents',
1671
+ isEventRegistration: true,
1672
+ viewId,
1673
+ });
1674
+ return result;
1675
+ });
1676
+ }
1677
+ /**
1678
+ * Unregisters the view event listener
1679
+ * @param viewId View identifier
1680
+ */
1681
+ unregisterListenerForViewEvents(_a) {
1682
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1683
+ const result = yield this.proxy.$executeCore({
1684
+ moduleName: 'CoreModule',
1685
+ methodName: 'unregisterListenerForViewEvents',
1686
+ isEventRegistration: false,
1687
+ viewId,
1688
+ });
1689
+ return result;
1690
+ });
1691
+ }
1692
+ /**
1693
+ * Updates the DataCaptureView configuration
1694
+ * @param viewJson Updated view configuration as JSON string
1695
+ */
1696
+ updateDataCaptureView(_a) {
1697
+ return __awaiter(this, arguments, void 0, function* ({ viewJson }) {
1698
+ const result = yield this.proxy.$executeCore({
1699
+ moduleName: 'CoreModule',
1700
+ methodName: 'updateDataCaptureView',
1701
+ isEventRegistration: false,
1702
+ viewJson,
1703
+ });
1704
+ return result;
1705
+ });
1706
+ }
1707
+ /**
1708
+ * Emits haptic/audio feedback
1709
+ * @param feedbackJson Feedback configuration as JSON string
1710
+ */
1711
+ emitFeedback(_a) {
1712
+ return __awaiter(this, arguments, void 0, function* ({ feedbackJson }) {
1713
+ const result = yield this.proxy.$executeCore({
1714
+ moduleName: 'CoreModule',
1715
+ methodName: 'emitFeedback',
1716
+ isEventRegistration: false,
1717
+ feedbackJson,
1718
+ });
1719
+ return result;
1720
+ });
1721
+ }
1722
+ }
1723
+
1385
1724
  class ImageFrameSourceController extends BaseController {
1386
1725
  constructor(imageFrameSource) {
1387
- super('ImageFrameSourceProxy');
1726
+ super('CoreProxy');
1388
1727
  this.handleDidChangeStateEventWrapper = (ev) => {
1389
1728
  return this.handleDidChangeStateEvent(ev);
1390
1729
  };
1391
1730
  this.imageFrameSource = imageFrameSource;
1731
+ this.adapter = new CoreProxyAdapter(this._proxy);
1392
1732
  void this.subscribeListener();
1393
1733
  }
1394
1734
  get privateImageFrameSource() {
@@ -1396,26 +1736,28 @@ class ImageFrameSourceController extends BaseController {
1396
1736
  }
1397
1737
  getCurrentState() {
1398
1738
  return __awaiter(this, void 0, void 0, function* () {
1399
- const result = yield this._proxy.$getCurrentCameraState({ position: this.privateImageFrameSource.position });
1400
- if (result == null) {
1401
- return FrameSourceState.Off;
1402
- }
1403
- return result.data;
1739
+ return yield this.adapter.getCameraState({
1740
+ cameraPosition: JSON.stringify(this.privateImageFrameSource.position),
1741
+ });
1404
1742
  });
1405
1743
  }
1406
1744
  switchCameraToDesiredState(desiredStateJson) {
1407
- return this._proxy.$switchCameraToDesiredState({ desiredStateJson });
1745
+ return __awaiter(this, void 0, void 0, function* () {
1746
+ yield this.adapter.switchCameraToDesiredState({
1747
+ stateJson: desiredStateJson,
1748
+ });
1749
+ });
1408
1750
  }
1409
1751
  subscribeListener() {
1410
1752
  return __awaiter(this, void 0, void 0, function* () {
1411
- yield this._proxy.$$registerListenerForCameraEvents();
1753
+ yield this.adapter.registerFrameSourceListener();
1412
1754
  this._proxy.subscribeForEvents([FrameSourceListenerEvents.didChangeState]);
1413
1755
  this._proxy.eventEmitter.on(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
1414
1756
  });
1415
1757
  }
1416
1758
  unsubscribeListener() {
1417
1759
  return __awaiter(this, void 0, void 0, function* () {
1418
- yield this._proxy.$unregisterListenerForCameraEvents();
1760
+ yield this.adapter.unregisterFrameSourceListener();
1419
1761
  this._proxy.unsubscribeFromEvents([FrameSourceListenerEvents.didChangeState]);
1420
1762
  this._proxy.eventEmitter.off(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
1421
1763
  });
@@ -1550,13 +1892,6 @@ class PrivateFrameData {
1550
1892
  }
1551
1893
  }
1552
1894
 
1553
- var CameraPosition;
1554
- (function (CameraPosition) {
1555
- CameraPosition["WorldFacing"] = "worldFacing";
1556
- CameraPosition["UserFacing"] = "userFacing";
1557
- CameraPosition["Unspecified"] = "unspecified";
1558
- })(CameraPosition || (CameraPosition = {}));
1559
-
1560
1895
  var TorchState;
1561
1896
  (function (TorchState) {
1562
1897
  TorchState["On"] = "on";
@@ -1998,7 +2333,6 @@ class CameraOwnershipManager {
1998
2333
  });
1999
2334
  }
2000
2335
  // Store originals for restoration
2001
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2002
2336
  camera.__originalMethods = {
2003
2337
  switchToDesiredState: originalSwitchToDesiredState,
2004
2338
  applySettings: originalApplySettings,
@@ -2007,7 +2341,6 @@ class CameraOwnershipManager {
2007
2341
  }
2008
2342
  unprotectCamera(camera) {
2009
2343
  var _a, _b;
2010
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2011
2344
  const originals = camera.__originalMethods;
2012
2345
  if (!originals)
2013
2346
  return;
@@ -2021,7 +2354,6 @@ class CameraOwnershipManager {
2021
2354
  configurable: true
2022
2355
  });
2023
2356
  }
2024
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2025
2357
  delete camera.__originalMethods;
2026
2358
  }
2027
2359
  }
@@ -2128,36 +2460,14 @@ class CameraOwnershipHelper {
2128
2460
  CameraOwnershipHelper.ownershipManager = CameraOwnershipManager.getInstance();
2129
2461
 
2130
2462
  class CameraController extends BaseController {
2131
- static get _proxy() {
2132
- return FactoryMaker.getInstance('CameraProxy');
2133
- }
2134
- static getFrame(frameId) {
2135
- return __awaiter(this, void 0, void 0, function* () {
2136
- const result = yield CameraController._proxy.$getFrame({ frameId });
2137
- if (result == null) {
2138
- return PrivateFrameData.empty();
2139
- }
2140
- const frameDataJSON = JSON.parse(result.data);
2141
- return PrivateFrameData.fromJSON(frameDataJSON);
2142
- });
2143
- }
2144
- static getFrameOrNull(frameId) {
2145
- return __awaiter(this, void 0, void 0, function* () {
2146
- const result = yield CameraController._proxy.$getFrame({ frameId });
2147
- if (result == null) {
2148
- return null;
2149
- }
2150
- const frameDataJSON = JSON.parse(result.data);
2151
- return PrivateFrameData.fromJSON(frameDataJSON);
2152
- });
2153
- }
2154
2463
  constructor(camera) {
2155
- super('CameraProxy');
2464
+ super('CoreProxy');
2156
2465
  // Arrow function wrapper to avoid .bind(this) and always use current class state
2157
2466
  this.handleDidChangeStateEventWrapper = (ev) => {
2158
2467
  return this.handleDidChangeStateEvent(ev);
2159
2468
  };
2160
2469
  this.camera = camera;
2470
+ this.adapter = new CoreProxyAdapter(this._proxy);
2161
2471
  void this.subscribeListener();
2162
2472
  }
2163
2473
  get privateCamera() {
@@ -2165,35 +2475,35 @@ class CameraController extends BaseController {
2165
2475
  }
2166
2476
  getCurrentState() {
2167
2477
  return __awaiter(this, void 0, void 0, function* () {
2168
- const result = yield this._proxy.$getCurrentCameraState({ position: this.privateCamera.position });
2169
- if (result == null) {
2170
- return FrameSourceState.Off;
2171
- }
2172
- return result.data;
2478
+ return yield this.adapter.getCameraState({
2479
+ cameraPosition: JSON.stringify(this.privateCamera.position)
2480
+ });
2173
2481
  });
2174
2482
  }
2175
2483
  getIsTorchAvailable() {
2176
2484
  return __awaiter(this, void 0, void 0, function* () {
2177
- const result = yield this._proxy.$isTorchAvailable({ position: this.privateCamera.position });
2178
- if (result == null) {
2179
- return false;
2180
- }
2181
- return result.data === 'true';
2485
+ return yield this.adapter.isTorchAvailable({
2486
+ cameraPosition: JSON.stringify(this.privateCamera.position)
2487
+ });
2182
2488
  });
2183
2489
  }
2184
2490
  switchCameraToDesiredState(desiredState) {
2185
- return this._proxy.$switchCameraToDesiredState({ desiredStateJson: desiredState.toString() });
2491
+ return __awaiter(this, void 0, void 0, function* () {
2492
+ yield this.adapter.switchCameraToDesiredState({
2493
+ stateJson: desiredState.toString()
2494
+ });
2495
+ });
2186
2496
  }
2187
2497
  subscribeListener() {
2188
2498
  return __awaiter(this, void 0, void 0, function* () {
2189
- yield this._proxy.$$registerListenerForCameraEvents();
2499
+ yield this.adapter.registerFrameSourceListener();
2190
2500
  this._proxy.subscribeForEvents([FrameSourceListenerEvents.didChangeState]);
2191
2501
  this._proxy.eventEmitter.on(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
2192
2502
  });
2193
2503
  }
2194
2504
  unsubscribeListener() {
2195
2505
  return __awaiter(this, void 0, void 0, function* () {
2196
- yield this._proxy.$unregisterListenerForCameraEvents();
2506
+ yield this.adapter.unregisterFrameSourceListener();
2197
2507
  this._proxy.unsubscribeFromEvents([FrameSourceListenerEvents.didChangeState]);
2198
2508
  this._proxy.eventEmitter.off(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
2199
2509
  });
@@ -2217,6 +2527,33 @@ class CameraController extends BaseController {
2217
2527
  }
2218
2528
  }
2219
2529
 
2530
+ class FrameDataController extends BaseController {
2531
+ constructor() {
2532
+ super('CoreProxy');
2533
+ this.adapter = new CoreProxyAdapter(this._proxy);
2534
+ }
2535
+ getFrame(frameId) {
2536
+ return __awaiter(this, void 0, void 0, function* () {
2537
+ const result = yield this.adapter.getLastFrameAsJson({ frameId });
2538
+ if (result == null) {
2539
+ return PrivateFrameData.empty();
2540
+ }
2541
+ const frameDataJSON = JSON.parse(result);
2542
+ return PrivateFrameData.fromJSON(frameDataJSON);
2543
+ });
2544
+ }
2545
+ getFrameOrNull(frameId) {
2546
+ return __awaiter(this, void 0, void 0, function* () {
2547
+ const result = yield this.adapter.getLastFrameAsJson({ frameId });
2548
+ if (result == null) {
2549
+ return null;
2550
+ }
2551
+ const frameDataJSON = JSON.parse(result);
2552
+ return PrivateFrameData.fromJSON(frameDataJSON);
2553
+ });
2554
+ }
2555
+ }
2556
+
2220
2557
  class ControlImage extends DefaultSerializeable {
2221
2558
  static fromBase64EncodedImage(data) {
2222
2559
  if (data === null)
@@ -2317,27 +2654,31 @@ class DataCaptureContextController extends BaseController {
2317
2654
  return this.context;
2318
2655
  }
2319
2656
  static forDataCaptureContext(context) {
2320
- const controller = new DataCaptureContextController();
2321
- controller.context = context;
2322
- return controller;
2657
+ return new DataCaptureContextController(context);
2323
2658
  }
2324
2659
  static getOpenSourceSoftwareLicenseInfo() {
2325
2660
  return __awaiter(this, void 0, void 0, function* () {
2326
- const proxy = FactoryMaker.getInstance('DataCaptureContextProxy');
2327
- const result = yield proxy.$getOpenSourceSoftwareLicenseInfo();
2328
- return new OpenSourceSoftwareLicenseInfo(result.data);
2661
+ const proxy = FactoryMaker.getInstance('CoreProxy');
2662
+ if (!proxy) {
2663
+ return new OpenSourceSoftwareLicenseInfo('Unable to load the open source software license info.');
2664
+ }
2665
+ const adapter = new CoreProxyAdapter(proxy);
2666
+ const result = yield adapter.getOpenSourceSoftwareLicenseInfo();
2667
+ return new OpenSourceSoftwareLicenseInfo(result);
2329
2668
  });
2330
2669
  }
2331
- constructor() {
2670
+ constructor(context) {
2332
2671
  super('DataCaptureContextProxy');
2333
2672
  this._listenerRegistered = false;
2673
+ this.adapter = new CoreProxyAdapter(this._proxy);
2674
+ this.context = context;
2334
2675
  }
2335
2676
  subscribeListener() {
2336
2677
  return __awaiter(this, void 0, void 0, function* () {
2337
2678
  if (this._listenerRegistered) {
2338
2679
  return;
2339
2680
  }
2340
- yield this._proxy.$$subscribeContextListener();
2681
+ yield this.adapter.subscribeContextListener();
2341
2682
  this._proxy.subscribeForEvents(Object.values(DataCaptureContextEvents));
2342
2683
  this._proxy.eventEmitter.on(DataCaptureContextEvents.didChangeStatus, this.handleDidChangeStatusEvent.bind(this));
2343
2684
  this._proxy.eventEmitter.on(DataCaptureContextEvents.didStartObservingContext, this.handleDidStartObservingContextEvent.bind(this));
@@ -2347,7 +2688,7 @@ class DataCaptureContextController extends BaseController {
2347
2688
  updateContextFromJSON() {
2348
2689
  return __awaiter(this, void 0, void 0, function* () {
2349
2690
  try {
2350
- yield this._proxy.$updateContextFromJSON({ contextJson: JSON.stringify(this.context.toJSON()) });
2691
+ yield this.adapter.updateContextFromJson({ contextJson: JSON.stringify(this.context.toJSON()) });
2351
2692
  }
2352
2693
  catch (error) {
2353
2694
  this.notifyListenersOfDeserializationError(error);
@@ -2356,17 +2697,17 @@ class DataCaptureContextController extends BaseController {
2356
2697
  });
2357
2698
  }
2358
2699
  addModeToContext(mode) {
2359
- return this._proxy.$addModeToContext({ modeJson: JSON.stringify(mode.toJSON()) });
2700
+ return this.adapter.addModeToContext({ modeJson: JSON.stringify(mode.toJSON()) });
2360
2701
  }
2361
2702
  removeModeFromContext(mode) {
2362
- return this._proxy.$removeModeFromContext({ modeJson: JSON.stringify(mode.toJSON()) });
2703
+ return this.adapter.removeModeFromContext({ modeJson: JSON.stringify(mode.toJSON()) });
2363
2704
  }
2364
2705
  removeAllModesFromContext() {
2365
- return this._proxy.$removeAllModes();
2706
+ return this.adapter.removeAllModes();
2366
2707
  }
2367
2708
  dispose() {
2368
2709
  void this.unsubscribeListener();
2369
- void this._proxy.$disposeContext();
2710
+ void this.adapter.disposeContext();
2370
2711
  this._proxy.dispose();
2371
2712
  }
2372
2713
  unsubscribeListener() {
@@ -2374,7 +2715,7 @@ class DataCaptureContextController extends BaseController {
2374
2715
  if (!this._listenerRegistered) {
2375
2716
  return;
2376
2717
  }
2377
- yield this._proxy.$unsubscribeContextListener();
2718
+ yield this.adapter.unsubscribeContextListener();
2378
2719
  this._proxy.unsubscribeFromEvents(Object.values(DataCaptureContextEvents));
2379
2720
  this._proxy.eventEmitter.off(DataCaptureContextEvents.didChangeStatus, this.handleDidChangeStatusEvent.bind(this));
2380
2721
  this._proxy.eventEmitter.off(DataCaptureContextEvents.didStartObservingContext, this.handleDidStartObservingContextEvent.bind(this));
@@ -2387,7 +2728,7 @@ class DataCaptureContextController extends BaseController {
2387
2728
  initializeContextFromJSON() {
2388
2729
  return __awaiter(this, void 0, void 0, function* () {
2389
2730
  try {
2390
- yield this._proxy.$contextFromJSON({ contextJson: JSON.stringify(this.context.toJSON()) });
2731
+ yield this.adapter.createContextFromJson({ contextJson: JSON.stringify(this.context.toJSON()) });
2391
2732
  }
2392
2733
  catch (error) {
2393
2734
  this.notifyListenersOfDeserializationError(error);
@@ -2663,17 +3004,18 @@ class DataCaptureViewController extends BaseController {
2663
3004
  return this.handleDidChangeSizeEvent(eventPayload);
2664
3005
  };
2665
3006
  this.view = view;
3007
+ this.adapter = new CoreProxyAdapter(this._proxy);
2666
3008
  }
2667
3009
  viewPointForFramePoint(point) {
2668
3010
  return __awaiter(this, void 0, void 0, function* () {
2669
- const result = yield this._proxy.$viewPointForFramePoint({ viewId: this.view.viewId, pointJson: JSON.stringify(point.toJSON()) });
2670
- return Point['fromJSON'](JSON.parse(result.data));
3011
+ const result = yield this.adapter.viewPointForFramePoint({ viewId: this.view.viewId, pointJson: JSON.stringify(point.toJSON()) });
3012
+ return Point['fromJSON'](JSON.parse(result));
2671
3013
  });
2672
3014
  }
2673
3015
  viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
2674
3016
  return __awaiter(this, void 0, void 0, function* () {
2675
- const result = yield this._proxy.$viewQuadrilateralForFrameQuadrilateral({ viewId: this.view.viewId, quadrilateralJson: JSON.stringify(quadrilateral.toJSON()) });
2676
- return Quadrilateral['fromJSON'](JSON.parse(result.data));
3017
+ const result = yield this.adapter.viewQuadrilateralForFrameQuadrilateral({ viewId: this.view.viewId, quadrilateralJson: JSON.stringify(quadrilateral.toJSON()) });
3018
+ return Quadrilateral['fromJSON'](JSON.parse(result));
2677
3019
  });
2678
3020
  }
2679
3021
  setPositionAndSize(top, left, width, height, shouldBeUnderWebView) {
@@ -2701,7 +3043,7 @@ class DataCaptureViewController extends BaseController {
2701
3043
  updateView() {
2702
3044
  if (!this.isViewCreated())
2703
3045
  return Promise.resolve();
2704
- return this._proxy.$updateDataCaptureView({ viewJson: JSON.stringify(this.view.toJSON()) });
3046
+ return this.adapter.updateDataCaptureView({ viewJson: JSON.stringify(this.view.toJSON()) });
2705
3047
  }
2706
3048
  dispose() {
2707
3049
  void this.unsubscribeListener();
@@ -2712,7 +3054,7 @@ class DataCaptureViewController extends BaseController {
2712
3054
  if (this._listenerRegistered) {
2713
3055
  return;
2714
3056
  }
2715
- yield this._proxy.$$registerListenerForViewEvents({ viewId: this.view.viewId });
3057
+ yield this.adapter.registerListenerForViewEvents({ viewId: this.view.viewId });
2716
3058
  this._proxy.subscribeForEvents(Object.values(DataCaptureViewEvents));
2717
3059
  this._proxy.eventEmitter.on(DataCaptureViewEvents.didChangeSize, this.handleDidChangeSizeEventWrapper);
2718
3060
  this._listenerRegistered = true;
@@ -2723,7 +3065,7 @@ class DataCaptureViewController extends BaseController {
2723
3065
  if (!this._listenerRegistered) {
2724
3066
  return;
2725
3067
  }
2726
- yield this._proxy.$unregisterListenerForViewEvents({ viewId: this.view.viewId });
3068
+ yield this.adapter.unregisterListenerForViewEvents({ viewId: this.view.viewId });
2727
3069
  this._proxy.unsubscribeFromEvents(Object.values(DataCaptureViewEvents));
2728
3070
  this._proxy.eventEmitter.off(DataCaptureViewEvents.didChangeSize, this.handleDidChangeSizeEventWrapper);
2729
3071
  this._listenerRegistered = false;
@@ -2939,6 +3281,14 @@ class BaseDataCaptureView extends DefaultSerializeable {
2939
3281
  this.viewId = viewId;
2940
3282
  yield this.controller.createNativeView();
2941
3283
  this.isViewCreated = true;
3284
+ this.notifyOverlaysOfViewIdChange();
3285
+ });
3286
+ }
3287
+ notifyOverlaysOfViewIdChange() {
3288
+ this.overlays.forEach(overlay => {
3289
+ if (typeof overlay.onViewIdChanged === 'function') {
3290
+ overlay.onViewIdChanged();
3291
+ }
2942
3292
  });
2943
3293
  }
2944
3294
  removeNativeView() {
@@ -3482,7 +3832,6 @@ class LaserlineViewfinder extends DefaultSerializeable {
3482
3832
  }
3483
3833
  }
3484
3834
 
3485
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3486
3835
  function parseDefaults(jsonDefaults) {
3487
3836
  const coreDefaults = {
3488
3837
  Camera: {
@@ -3509,7 +3858,6 @@ function parseDefaults(jsonDefaults) {
3509
3858
  },
3510
3859
  RectangularViewfinder: Object
3511
3860
  .keys(jsonDefaults.RectangularViewfinder.styles)
3512
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3513
3861
  .reduce((acc, key) => {
3514
3862
  const viewfinder = jsonDefaults.RectangularViewfinder.styles[key];
3515
3863
  acc.styles[key] = {
@@ -3522,7 +3870,6 @@ function parseDefaults(jsonDefaults) {
3522
3870
  disabledDimming: viewfinder.disabledDimming,
3523
3871
  animation: RectangularViewfinderAnimation['fromJSON'](JSON.parse(viewfinder.animation)),
3524
3872
  };
3525
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
3526
3873
  return acc;
3527
3874
  }, { defaultStyle: jsonDefaults.RectangularViewfinder.defaultStyle, styles: {} }),
3528
3875
  AimerViewfinder: {
@@ -3542,11 +3889,32 @@ function parseDefaults(jsonDefaults) {
3542
3889
  return coreDefaults;
3543
3890
  }
3544
3891
 
3892
+ let coreDefaultsLoader;
3893
+ function setCoreDefaultsLoader(loader) {
3894
+ coreDefaultsLoader = loader;
3895
+ }
3896
+ function ensureCoreDefaults() {
3897
+ var _a, _b;
3898
+ const existing = (_a = FactoryMaker.instances.get('CoreDefaults')) === null || _a === void 0 ? void 0 : _a.instance;
3899
+ if (existing) {
3900
+ return existing;
3901
+ }
3902
+ coreDefaultsLoader === null || coreDefaultsLoader === void 0 ? void 0 : coreDefaultsLoader();
3903
+ const reloaded = (_b = FactoryMaker.instances.get('CoreDefaults')) === null || _b === void 0 ? void 0 : _b.instance;
3904
+ if (reloaded) {
3905
+ return reloaded;
3906
+ }
3907
+ throw new Error('CoreDefaults missing and re-init failed');
3908
+ }
3545
3909
  function loadCoreDefaults(jsonDefaults) {
3546
3910
  const coreDefaults = parseDefaults(jsonDefaults);
3547
3911
  FactoryMaker.bindInstanceIfNotExists('CoreDefaults', coreDefaults);
3548
3912
  }
3549
3913
 
3914
+ function getCoreDefaults() {
3915
+ return ensureCoreDefaults();
3916
+ }
3917
+
3550
3918
  var VibrationType;
3551
3919
  (function (VibrationType) {
3552
3920
  VibrationType["default"] = "default";
@@ -3624,11 +3992,12 @@ class FeedbackController extends BaseController {
3624
3992
  return controller;
3625
3993
  }
3626
3994
  constructor(feedback) {
3627
- super('FeedbackProxy');
3995
+ super('CoreProxy');
3628
3996
  this.feedback = feedback;
3997
+ this.adapter = new CoreProxyAdapter(this._proxy);
3629
3998
  }
3630
3999
  emit() {
3631
- void this._proxy.$emitFeedback({ feedbackJson: JSON.stringify(this.feedback.toJSON()) });
4000
+ void this.adapter.emitFeedback({ feedbackJson: JSON.stringify(this.feedback.toJSON()) });
3632
4001
  }
3633
4002
  dispose() {
3634
4003
  this._proxy.dispose();
@@ -3889,6 +4258,10 @@ class NativeProxy {
3889
4258
  _unregisterEvent(event) {
3890
4259
  return __awaiter(this, void 0, void 0, function* () {
3891
4260
  const subscription = this.eventSubscriptions.get(event);
4261
+ if (!subscription) {
4262
+ // Event was never registered or already unregistered, skip
4263
+ return;
4264
+ }
3892
4265
  yield this.nativeCaller.unregisterEvent(event, subscription);
3893
4266
  this.eventSubscriptions.delete(event);
3894
4267
  });
@@ -3908,11 +4281,9 @@ function registerProxies(proxyTypeNames, provider) {
3908
4281
  }
3909
4282
 
3910
4283
  const CORE_PROXY_TYPE_NAMES = [
4284
+ 'CoreProxy',
3911
4285
  'DataCaptureViewProxy',
3912
- 'DataCaptureContextProxy',
3913
- 'CameraProxy',
3914
- 'ImageFrameSourceProxy',
3915
- 'FeedbackProxy',
4286
+ 'DataCaptureContextProxy'
3916
4287
  ];
3917
4288
 
3918
4289
  function registerCoreProxies(provider) {
@@ -3927,5 +4298,5 @@ function generateIdentifier() {
3927
4298
  });
3928
4299
  }
3929
4300
 
3930
- export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, Brush, CORE_PROXY_TYPE_NAMES, Camera, CameraController, CameraOwnershipHelper, CameraOwnershipManager, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, 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, generateIdentifier, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, registerCoreProxies, registerProxies, serializationDefault };
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 };
3931
4302
  //# sourceMappingURL=index.js.map