scandit-datacapture-frameworks-label 8.4.1 → 8.5.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/__mocks__/ScanditDataCaptureCore.ts +14 -6
- package/dist/dts/defaults/index.d.ts +1 -1
- package/dist/dts/labelcapture/AdaptiveRecognitionResult.d.ts +1 -1
- package/dist/dts/labelcapture/CapturedLabel.d.ts +2 -2
- package/dist/dts/labelcapture/LabelCaptureFeedback.d.ts +2 -2
- package/dist/dts/labelcapture/LabelField.d.ts +6 -6
- package/dist/dts/labelcapture/ReceiptScanningResult.d.ts +3 -3
- package/dist/dts/labelcapture/controller/LabelCaptureAdaptiveRecognitionOverlayController.d.ts +6 -4
- package/dist/dts/labelcapture/controller/LabelCaptureAdvancedOverlayController.d.ts +2 -0
- package/dist/dts/labelcapture/controller/LabelCaptureBasicOverlayController.d.ts +2 -0
- package/dist/dts/labelcapture/controller/LabelCaptureValidationFlowOverlayController.d.ts +2 -0
- package/dist/dts/labelcapture/private/PrivateLabelField.d.ts +4 -4
- package/dist/dts/labelcapture/view/LabelCaptureAdaptiveRecognitionListener.d.ts +1 -1
- package/dist/dts/labelcapture/view/LabelCaptureAdaptiveRecognitionOverlay.d.ts +4 -4
- package/dist/dts/labelcapture/view/LabelCaptureAdvancedOverlay.d.ts +1 -1
- package/dist/dts/labelcapture/view/LabelCaptureAdvancedOverlayListener.d.ts +5 -5
- package/dist/dts/labelcapture/view/LabelCaptureAdvancedOverlayView.d.ts +1 -1
- package/dist/dts/proxy-types.d.ts +1 -1
- package/dist/index.js +205 -99
- package/dist/index.js.map +1 -1
- package/jest.config.js +4 -11
- package/package.json +3 -3
- package/test/AdaptiveRecognitionResultType.test.ts +0 -1
- package/test/BarcodeFieldSymbologies.test.ts +29 -0
- package/test/LabelCaptureAdaptiveRecognitionSettings.test.ts +0 -1
- package/test/LabelCaptureValidationFlowOverlayController.test.ts +9 -2
- package/test/ReceiptScanningLineItem.test.ts +15 -16
- package/test/ReceiptScanningResult.test.ts +22 -59
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FactoryMaker, Feedback, Brush, CameraSettings, nameForSerialization, DefaultSerializeable, ignoreFromSerialization,
|
|
1
|
+
import { FactoryMaker, Feedback, Brush, CameraSettings, nameForSerialization, ignoreFromSerializationIfNull, DefaultSerializeable, ignoreFromSerialization, Quadrilateral, BaseController, FrameDataController, EventDataParser, SKIP, Anchor, PointWithUnit, Rect, Point, Size, serializationDefault, NoViewfinder, registerProxies } from 'scandit-datacapture-frameworks-core';
|
|
2
2
|
import { Barcode, getBarcodeDefaults } from 'scandit-datacapture-frameworks-barcode';
|
|
3
3
|
|
|
4
4
|
let labelDefaultsLoader;
|
|
@@ -28,12 +28,11 @@ function getLabelCaptureDefaults() {
|
|
|
28
28
|
function parseLabelCaptureDefaults(jsonDefaults) {
|
|
29
29
|
return {
|
|
30
30
|
LabelCapture: {
|
|
31
|
-
RecommendedCameraSettings: CameraSettings
|
|
32
|
-
.fromJSON(jsonDefaults.LabelCapture.RecommendedCameraSettings),
|
|
31
|
+
RecommendedCameraSettings: CameraSettings.fromJSON(jsonDefaults.LabelCapture.RecommendedCameraSettings),
|
|
33
32
|
LabelCaptureBasicOverlay: {
|
|
34
33
|
DefaultPredictedFieldBrush: Brush.fromJSON(jsonDefaults.LabelCapture.LabelCaptureBasicOverlay.DefaultPredictedFieldBrush),
|
|
35
34
|
DefaultCapturedFieldBrush: Brush.fromJSON(jsonDefaults.LabelCapture.LabelCaptureBasicOverlay.DefaultCapturedFieldBrush),
|
|
36
|
-
DefaultLabelBrush: Brush.fromJSON(jsonDefaults.LabelCapture.LabelCaptureBasicOverlay.DefaultLabelBrush)
|
|
35
|
+
DefaultLabelBrush: Brush.fromJSON(jsonDefaults.LabelCapture.LabelCaptureBasicOverlay.DefaultLabelBrush),
|
|
37
36
|
},
|
|
38
37
|
LabelCaptureValidationFlowOverlay: {
|
|
39
38
|
Settings: {
|
|
@@ -48,7 +47,7 @@ function parseLabelCaptureDefaults(jsonDefaults) {
|
|
|
48
47
|
validationPauseButtonText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationPauseButtonText,
|
|
49
48
|
validationAdaptiveScanningText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationAdaptiveScanningText,
|
|
50
49
|
validationScanningText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationScanningText,
|
|
51
|
-
}
|
|
50
|
+
},
|
|
52
51
|
},
|
|
53
52
|
Feedback: {
|
|
54
53
|
success: Feedback.fromJSON(JSON.parse(jsonDefaults.LabelCapture.feedback).success),
|
|
@@ -119,13 +118,15 @@ class LabelFieldDefinition extends DefaultSerializeable {
|
|
|
119
118
|
return this._name;
|
|
120
119
|
}
|
|
121
120
|
get valueRegexes() {
|
|
122
|
-
|
|
121
|
+
var _a;
|
|
122
|
+
return (_a = this._valueRegexes) !== null && _a !== void 0 ? _a : [];
|
|
123
123
|
}
|
|
124
124
|
set valueRegexes(value) {
|
|
125
125
|
this._valueRegexes = value;
|
|
126
126
|
}
|
|
127
127
|
setValueRegex(valueRegex) {
|
|
128
|
-
|
|
128
|
+
var _a;
|
|
129
|
+
this._valueRegexes = [...((_a = this._valueRegexes) !== null && _a !== void 0 ? _a : []), valueRegex];
|
|
129
130
|
}
|
|
130
131
|
get optional() {
|
|
131
132
|
return this._optional;
|
|
@@ -158,7 +159,7 @@ class LabelFieldDefinition extends DefaultSerializeable {
|
|
|
158
159
|
}
|
|
159
160
|
constructor(name) {
|
|
160
161
|
super();
|
|
161
|
-
this._valueRegexes =
|
|
162
|
+
this._valueRegexes = null;
|
|
162
163
|
this._optional = false;
|
|
163
164
|
this._numberOfMandatoryInstances = null;
|
|
164
165
|
this._hiddenProperties = {};
|
|
@@ -169,7 +170,8 @@ __decorate([
|
|
|
169
170
|
nameForSerialization('name')
|
|
170
171
|
], LabelFieldDefinition.prototype, "_name", void 0);
|
|
171
172
|
__decorate([
|
|
172
|
-
nameForSerialization('patterns')
|
|
173
|
+
nameForSerialization('patterns'),
|
|
174
|
+
ignoreFromSerializationIfNull
|
|
173
175
|
], LabelFieldDefinition.prototype, "_valueRegexes", void 0);
|
|
174
176
|
__decorate([
|
|
175
177
|
nameForSerialization('optional')
|
|
@@ -187,6 +189,9 @@ class BarcodeField extends LabelFieldDefinition {
|
|
|
187
189
|
}
|
|
188
190
|
constructor(name, symbologies) {
|
|
189
191
|
super(name);
|
|
192
|
+
if (symbologies.length === 0) {
|
|
193
|
+
throw new Error(`A barcode label field ("${name}") requires at least one symbology.`);
|
|
194
|
+
}
|
|
190
195
|
this._symbologySettings = symbologies;
|
|
191
196
|
this._symbologies = symbologies.reduce((acc, item) => {
|
|
192
197
|
acc[item.symbology.toString()] = item;
|
|
@@ -266,7 +271,9 @@ class LabelField {
|
|
|
266
271
|
field._isRequired = json.isRequired;
|
|
267
272
|
field._barcode = json.barcode ? Barcode['fromJSON'](json.barcode) : null;
|
|
268
273
|
field._text = json.text;
|
|
269
|
-
field._dateResult = json.date
|
|
274
|
+
field._dateResult = json.date
|
|
275
|
+
? LabelDateResult.fromJSON(json.date)
|
|
276
|
+
: null;
|
|
270
277
|
field._valueType = json.valueType;
|
|
271
278
|
return field;
|
|
272
279
|
}
|
|
@@ -387,7 +394,8 @@ __decorate([
|
|
|
387
394
|
nameForSerialization('location')
|
|
388
395
|
], CustomBarcode.prototype, "location", void 0);
|
|
389
396
|
__decorate([
|
|
390
|
-
nameForSerialization('dataTypePatterns')
|
|
397
|
+
nameForSerialization('dataTypePatterns'),
|
|
398
|
+
ignoreFromSerializationIfNull
|
|
391
399
|
], CustomBarcode.prototype, "_anchorRegexes", void 0);
|
|
392
400
|
__decorate([
|
|
393
401
|
nameForSerialization('fieldType')
|
|
@@ -433,7 +441,8 @@ __decorate([
|
|
|
433
441
|
nameForSerialization('location')
|
|
434
442
|
], CustomText.prototype, "location", void 0);
|
|
435
443
|
__decorate([
|
|
436
|
-
nameForSerialization('dataTypePatterns')
|
|
444
|
+
nameForSerialization('dataTypePatterns'),
|
|
445
|
+
ignoreFromSerializationIfNull
|
|
437
446
|
], CustomText.prototype, "_anchorRegexes", void 0);
|
|
438
447
|
__decorate([
|
|
439
448
|
nameForSerialization('fieldType')
|
|
@@ -479,7 +488,8 @@ __decorate([
|
|
|
479
488
|
nameForSerialization('fieldType')
|
|
480
489
|
], DateText.prototype, "_fieldType", void 0);
|
|
481
490
|
__decorate([
|
|
482
|
-
nameForSerialization('dataTypePatterns')
|
|
491
|
+
nameForSerialization('dataTypePatterns'),
|
|
492
|
+
ignoreFromSerializationIfNull
|
|
483
493
|
], DateText.prototype, "_anchorRegexes", void 0);
|
|
484
494
|
__decorate([
|
|
485
495
|
nameForSerialization('labelDateFormat')
|
|
@@ -528,7 +538,8 @@ __decorate([
|
|
|
528
538
|
nameForSerialization('fieldType')
|
|
529
539
|
], ExpiryDateText.prototype, "_fieldType", void 0);
|
|
530
540
|
__decorate([
|
|
531
|
-
nameForSerialization('dataTypePatterns')
|
|
541
|
+
nameForSerialization('dataTypePatterns'),
|
|
542
|
+
ignoreFromSerializationIfNull
|
|
532
543
|
], ExpiryDateText.prototype, "_anchorRegexes", void 0);
|
|
533
544
|
__decorate([
|
|
534
545
|
nameForSerialization('labelDateFormat')
|
|
@@ -647,10 +658,8 @@ class LabelCaptureSession {
|
|
|
647
658
|
session._frameSequenceID = sessionJson.frameSequenceId;
|
|
648
659
|
session._lastProcessedFrameId = sessionJson.lastFrameId;
|
|
649
660
|
session.frameId = (_a = payload.frameId) !== null && _a !== void 0 ? _a : '';
|
|
650
|
-
session._capturedLabels = sessionJson.labels
|
|
651
|
-
|
|
652
|
-
session._capturedLabels
|
|
653
|
-
.forEach(label => label.frameSequenceID = session._frameSequenceID);
|
|
661
|
+
session._capturedLabels = sessionJson.labels.map(CapturedLabel.fromJSON);
|
|
662
|
+
session._capturedLabels.forEach(label => (label.frameSequenceID = session._frameSequenceID));
|
|
654
663
|
return session;
|
|
655
664
|
}
|
|
656
665
|
}
|
|
@@ -1396,6 +1405,8 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1396
1405
|
super('LabelCaptureAdvancedOverlayProxy');
|
|
1397
1406
|
this.hasListeners = false;
|
|
1398
1407
|
this.hasPendingListenerRegistration = false;
|
|
1408
|
+
// viewId the native listener is registered against (-1 = none); re-register on view change. [SDC-30872]
|
|
1409
|
+
this.registeredViewId = -1;
|
|
1399
1410
|
// Arrow function wrappers to avoid .bind(this) and always use current class state
|
|
1400
1411
|
this.handleViewForLabelWrapper = (ev) => __awaiter(this, void 0, void 0, function* () {
|
|
1401
1412
|
return this.handleViewForLabel(ev);
|
|
@@ -1425,7 +1436,7 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1425
1436
|
return this.adapter.setViewForCapturedLabel({
|
|
1426
1437
|
viewJson: awitedView ? JSON.stringify(awitedView.toJSON()) : null,
|
|
1427
1438
|
trackingId: label.trackingID,
|
|
1428
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
1439
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1429
1440
|
});
|
|
1430
1441
|
});
|
|
1431
1442
|
}
|
|
@@ -1433,14 +1444,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1433
1444
|
return this.adapter.setAnchorForCapturedLabel({
|
|
1434
1445
|
anchorJson: anchor,
|
|
1435
1446
|
trackingId: label.trackingID,
|
|
1436
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
1447
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1437
1448
|
});
|
|
1438
1449
|
}
|
|
1439
1450
|
setOffsetForCapturedLabel(label, offset) {
|
|
1440
1451
|
return this.adapter.setOffsetForCapturedLabel({
|
|
1441
1452
|
offsetJson: JSON.stringify(offset.toJSON()),
|
|
1442
1453
|
trackingId: label.trackingID,
|
|
1443
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
1454
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1444
1455
|
});
|
|
1445
1456
|
}
|
|
1446
1457
|
setViewForCapturedLabelField(label, field, view) {
|
|
@@ -1471,19 +1482,31 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1471
1482
|
this._proxy.eventEmitter.on(LabelCaptureAdvancedOverlayListenerEvents.anchorForCapturedLabelField, this.handleAnchorForCapturedLabelFieldWrapper);
|
|
1472
1483
|
this._proxy.eventEmitter.on(LabelCaptureAdvancedOverlayListenerEvents.offsetForCapturedLabelField, this.handleOffsetForCapturedLabelFieldWrapper);
|
|
1473
1484
|
this.hasListeners = true;
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1485
|
+
yield this.registerListenerForCurrentView();
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
// (Re)register the native listener whenever the viewId changes; the view can be recreated
|
|
1489
|
+
// after the listener is set, and on iOS registering against a stale/-1 viewId silently
|
|
1490
|
+
// no-ops, leaving the overlay delegate unwired. [SDC-30872]
|
|
1491
|
+
registerListenerForCurrentView() {
|
|
1492
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1493
|
+
const viewId = this.dataCaptureViewId;
|
|
1494
|
+
if (viewId === -1) {
|
|
1478
1495
|
this.hasPendingListenerRegistration = true;
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
if (this.registeredViewId === viewId) {
|
|
1499
|
+
return;
|
|
1479
1500
|
}
|
|
1501
|
+
this.hasPendingListenerRegistration = false;
|
|
1502
|
+
this.registeredViewId = viewId;
|
|
1503
|
+
yield this.adapter.addLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: viewId });
|
|
1480
1504
|
});
|
|
1481
1505
|
}
|
|
1482
1506
|
onViewChanged() {
|
|
1483
1507
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1484
|
-
if (this.
|
|
1485
|
-
this.
|
|
1486
|
-
yield this.adapter.addLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
|
|
1508
|
+
if (this.hasListeners) {
|
|
1509
|
+
yield this.registerListenerForCurrentView();
|
|
1487
1510
|
}
|
|
1488
1511
|
});
|
|
1489
1512
|
}
|
|
@@ -1492,8 +1515,9 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1492
1515
|
if (!this.hasListeners) {
|
|
1493
1516
|
return;
|
|
1494
1517
|
}
|
|
1495
|
-
if (this.
|
|
1496
|
-
yield this.adapter.removeLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: this.
|
|
1518
|
+
if (this.registeredViewId !== -1) {
|
|
1519
|
+
yield this.adapter.removeLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: this.registeredViewId });
|
|
1520
|
+
this.registeredViewId = -1;
|
|
1497
1521
|
}
|
|
1498
1522
|
this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureAdvancedOverlayListenerEvents));
|
|
1499
1523
|
this._proxy.eventEmitter.off(LabelCaptureAdvancedOverlayListenerEvents.viewForLabel, this.handleViewForLabelWrapper);
|
|
@@ -1510,7 +1534,10 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1510
1534
|
void this.unsubscribeListener();
|
|
1511
1535
|
}
|
|
1512
1536
|
updateAdvancedOverlay(advancedOverlayJson) {
|
|
1513
|
-
return this.adapter.updateLabelCaptureAdvancedOverlay({
|
|
1537
|
+
return this.adapter.updateLabelCaptureAdvancedOverlay({
|
|
1538
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1539
|
+
advancedOverlayJson,
|
|
1540
|
+
});
|
|
1514
1541
|
}
|
|
1515
1542
|
initialize() {
|
|
1516
1543
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1525,7 +1552,7 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1525
1552
|
return this.adapter.setViewForCapturedLabelField({
|
|
1526
1553
|
viewJson: awitedView ? JSON.stringify(awitedView.toJSON()) : null,
|
|
1527
1554
|
identifier: identifier,
|
|
1528
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
1555
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1529
1556
|
});
|
|
1530
1557
|
});
|
|
1531
1558
|
}
|
|
@@ -1533,19 +1560,21 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1533
1560
|
return this.adapter.setAnchorForCapturedLabelField({
|
|
1534
1561
|
anchorJson: anchor,
|
|
1535
1562
|
identifier: identifier,
|
|
1536
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
1563
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1537
1564
|
});
|
|
1538
1565
|
}
|
|
1539
1566
|
setOffsetForCapturedLabelFieldPrivate(identifier, offset) {
|
|
1540
1567
|
return this.adapter.setOffsetForCapturedLabelField({
|
|
1541
1568
|
offsetJson: JSON.stringify(offset.toJSON()),
|
|
1542
1569
|
identifier: identifier,
|
|
1543
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
1570
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
1544
1571
|
});
|
|
1545
1572
|
}
|
|
1546
1573
|
handleViewForLabel(ev) {
|
|
1547
1574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1548
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1575
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1576
|
+
viewId: this.dataCaptureViewId,
|
|
1577
|
+
});
|
|
1549
1578
|
if (payload === SKIP) {
|
|
1550
1579
|
return;
|
|
1551
1580
|
}
|
|
@@ -1563,7 +1592,9 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1563
1592
|
}
|
|
1564
1593
|
handleAnchorForLabel(ev) {
|
|
1565
1594
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1566
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1595
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1596
|
+
viewId: this.dataCaptureViewId,
|
|
1597
|
+
});
|
|
1567
1598
|
if (payload === SKIP) {
|
|
1568
1599
|
return;
|
|
1569
1600
|
}
|
|
@@ -1581,7 +1612,9 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1581
1612
|
}
|
|
1582
1613
|
handleViewForCapturedLabelField(ev) {
|
|
1583
1614
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1584
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1615
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1616
|
+
viewId: this.dataCaptureViewId,
|
|
1617
|
+
});
|
|
1585
1618
|
if (payload === SKIP) {
|
|
1586
1619
|
return;
|
|
1587
1620
|
}
|
|
@@ -1599,7 +1632,9 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1599
1632
|
}
|
|
1600
1633
|
handleOffsetForLabel(ev) {
|
|
1601
1634
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1602
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1635
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1636
|
+
viewId: this.dataCaptureViewId,
|
|
1637
|
+
});
|
|
1603
1638
|
if (payload === SKIP) {
|
|
1604
1639
|
return;
|
|
1605
1640
|
}
|
|
@@ -1617,7 +1652,9 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1617
1652
|
}
|
|
1618
1653
|
handleAnchorForCapturedLabelField(ev) {
|
|
1619
1654
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1620
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1655
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1656
|
+
viewId: this.dataCaptureViewId,
|
|
1657
|
+
});
|
|
1621
1658
|
if (payload === SKIP) {
|
|
1622
1659
|
return;
|
|
1623
1660
|
}
|
|
@@ -1635,7 +1672,9 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
|
|
|
1635
1672
|
}
|
|
1636
1673
|
handleOffsetForCapturedLabelField(ev) {
|
|
1637
1674
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1638
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1675
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
1676
|
+
viewId: this.dataCaptureViewId,
|
|
1677
|
+
});
|
|
1639
1678
|
if (payload === SKIP) {
|
|
1640
1679
|
return;
|
|
1641
1680
|
}
|
|
@@ -2069,7 +2108,8 @@ __decorate([
|
|
|
2069
2108
|
nameForSerialization('fieldType')
|
|
2070
2109
|
], PackingDateText.prototype, "_fieldType", void 0);
|
|
2071
2110
|
__decorate([
|
|
2072
|
-
nameForSerialization('dataTypePatterns')
|
|
2111
|
+
nameForSerialization('dataTypePatterns'),
|
|
2112
|
+
ignoreFromSerializationIfNull
|
|
2073
2113
|
], PackingDateText.prototype, "_anchorRegexes", void 0);
|
|
2074
2114
|
__decorate([
|
|
2075
2115
|
nameForSerialization('labelDateFormat')
|
|
@@ -2148,19 +2188,19 @@ class ReceiptScanningLineItem {
|
|
|
2148
2188
|
}
|
|
2149
2189
|
}
|
|
2150
2190
|
__decorate([
|
|
2151
|
-
nameForSerialization(
|
|
2191
|
+
nameForSerialization('name')
|
|
2152
2192
|
], ReceiptScanningLineItem.prototype, "_name", void 0);
|
|
2153
2193
|
__decorate([
|
|
2154
|
-
nameForSerialization(
|
|
2194
|
+
nameForSerialization('unitPrice')
|
|
2155
2195
|
], ReceiptScanningLineItem.prototype, "_unitPrice", void 0);
|
|
2156
2196
|
__decorate([
|
|
2157
|
-
nameForSerialization(
|
|
2197
|
+
nameForSerialization('discount')
|
|
2158
2198
|
], ReceiptScanningLineItem.prototype, "_discount", void 0);
|
|
2159
2199
|
__decorate([
|
|
2160
|
-
nameForSerialization(
|
|
2200
|
+
nameForSerialization('quantity')
|
|
2161
2201
|
], ReceiptScanningLineItem.prototype, "_quantity", void 0);
|
|
2162
2202
|
__decorate([
|
|
2163
|
-
nameForSerialization(
|
|
2203
|
+
nameForSerialization('totalPrice')
|
|
2164
2204
|
], ReceiptScanningLineItem.prototype, "_totalPrice", void 0);
|
|
2165
2205
|
|
|
2166
2206
|
class ReceiptScanningResult {
|
|
@@ -2211,34 +2251,34 @@ class ReceiptScanningResult {
|
|
|
2211
2251
|
}
|
|
2212
2252
|
}
|
|
2213
2253
|
__decorate([
|
|
2214
|
-
nameForSerialization(
|
|
2254
|
+
nameForSerialization('date')
|
|
2215
2255
|
], ReceiptScanningResult.prototype, "_date", void 0);
|
|
2216
2256
|
__decorate([
|
|
2217
|
-
nameForSerialization(
|
|
2257
|
+
nameForSerialization('lineItems')
|
|
2218
2258
|
], ReceiptScanningResult.prototype, "_lineItems", void 0);
|
|
2219
2259
|
__decorate([
|
|
2220
|
-
nameForSerialization(
|
|
2260
|
+
nameForSerialization('loyaltyNumber')
|
|
2221
2261
|
], ReceiptScanningResult.prototype, "_loyaltyNumber", void 0);
|
|
2222
2262
|
__decorate([
|
|
2223
|
-
nameForSerialization(
|
|
2263
|
+
nameForSerialization('paymentPreTaxTotal')
|
|
2224
2264
|
], ReceiptScanningResult.prototype, "_paymentPreTaxTotal", void 0);
|
|
2225
2265
|
__decorate([
|
|
2226
|
-
nameForSerialization(
|
|
2266
|
+
nameForSerialization('paymentTax')
|
|
2227
2267
|
], ReceiptScanningResult.prototype, "_paymentTax", void 0);
|
|
2228
2268
|
__decorate([
|
|
2229
|
-
nameForSerialization(
|
|
2269
|
+
nameForSerialization('paymentTotal')
|
|
2230
2270
|
], ReceiptScanningResult.prototype, "_paymentTotal", void 0);
|
|
2231
2271
|
__decorate([
|
|
2232
|
-
nameForSerialization(
|
|
2272
|
+
nameForSerialization('storeAddress')
|
|
2233
2273
|
], ReceiptScanningResult.prototype, "_storeAddress", void 0);
|
|
2234
2274
|
__decorate([
|
|
2235
|
-
nameForSerialization(
|
|
2275
|
+
nameForSerialization('storeCity')
|
|
2236
2276
|
], ReceiptScanningResult.prototype, "_storeCity", void 0);
|
|
2237
2277
|
__decorate([
|
|
2238
|
-
nameForSerialization(
|
|
2278
|
+
nameForSerialization('storeName')
|
|
2239
2279
|
], ReceiptScanningResult.prototype, "_storeName", void 0);
|
|
2240
2280
|
__decorate([
|
|
2241
|
-
nameForSerialization(
|
|
2281
|
+
nameForSerialization('time')
|
|
2242
2282
|
], ReceiptScanningResult.prototype, "_time", void 0);
|
|
2243
2283
|
|
|
2244
2284
|
class SerialNumberBarcode extends BarcodeField {
|
|
@@ -2325,7 +2365,8 @@ __decorate([
|
|
|
2325
2365
|
nameForSerialization('fieldType')
|
|
2326
2366
|
], TotalPriceText.prototype, "_fieldType", void 0);
|
|
2327
2367
|
__decorate([
|
|
2328
|
-
nameForSerialization('dataTypePatterns')
|
|
2368
|
+
nameForSerialization('dataTypePatterns'),
|
|
2369
|
+
ignoreFromSerializationIfNull
|
|
2329
2370
|
], TotalPriceText.prototype, "_anchorRegexes", void 0);
|
|
2330
2371
|
|
|
2331
2372
|
class UnitPriceText extends TextField {
|
|
@@ -2364,7 +2405,8 @@ __decorate([
|
|
|
2364
2405
|
nameForSerialization('fieldType')
|
|
2365
2406
|
], UnitPriceText.prototype, "_fieldType", void 0);
|
|
2366
2407
|
__decorate([
|
|
2367
|
-
nameForSerialization('dataTypePatterns')
|
|
2408
|
+
nameForSerialization('dataTypePatterns'),
|
|
2409
|
+
ignoreFromSerializationIfNull
|
|
2368
2410
|
], UnitPriceText.prototype, "_anchorRegexes", void 0);
|
|
2369
2411
|
|
|
2370
2412
|
class WeightText extends TextField {
|
|
@@ -2403,7 +2445,8 @@ __decorate([
|
|
|
2403
2445
|
nameForSerialization('fieldType')
|
|
2404
2446
|
], WeightText.prototype, "_fieldType", void 0);
|
|
2405
2447
|
__decorate([
|
|
2406
|
-
nameForSerialization('dataTypePatterns')
|
|
2448
|
+
nameForSerialization('dataTypePatterns'),
|
|
2449
|
+
ignoreFromSerializationIfNull
|
|
2407
2450
|
], WeightText.prototype, "_anchorRegexes", void 0);
|
|
2408
2451
|
|
|
2409
2452
|
var LabelCaptureBasicOverlayListenerEvents;
|
|
@@ -2417,6 +2460,8 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2417
2460
|
super('LabelCaptureBasicOverlayProxy');
|
|
2418
2461
|
this.hasListeners = false;
|
|
2419
2462
|
this.hasPendingListenerRegistration = false;
|
|
2463
|
+
// viewId the native listener is registered against (-1 = none); re-register on view change. [SDC-30872]
|
|
2464
|
+
this.registeredViewId = -1;
|
|
2420
2465
|
// Arrow function wrappers to avoid .bind(this) and always use current class state
|
|
2421
2466
|
this.handleBrushForFieldOfLabelWrapper = (ev) => __awaiter(this, void 0, void 0, function* () {
|
|
2422
2467
|
return this.handleBrushForFieldOfLabel(ev);
|
|
@@ -2436,14 +2481,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2436
2481
|
brushJson: brush ? JSON.stringify(brush.toJSON()) : '',
|
|
2437
2482
|
fieldName: field.name,
|
|
2438
2483
|
trackingId: label.trackingID,
|
|
2439
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
2484
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
2440
2485
|
});
|
|
2441
2486
|
}
|
|
2442
2487
|
setBrushForLabel(brush, label) {
|
|
2443
2488
|
return this.adapter.setLabelCaptureBasicOverlayBrushForLabel({
|
|
2444
2489
|
brushJson: brush ? JSON.stringify(brush.toJSON()) : '',
|
|
2445
2490
|
trackingId: label.trackingID,
|
|
2446
|
-
dataCaptureViewId: this.dataCaptureViewId
|
|
2491
|
+
dataCaptureViewId: this.dataCaptureViewId,
|
|
2447
2492
|
});
|
|
2448
2493
|
}
|
|
2449
2494
|
subscribeListener() {
|
|
@@ -2456,19 +2501,31 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2456
2501
|
this._proxy.eventEmitter.on(LabelCaptureBasicOverlayListenerEvents.brushForLabel, this.handleBrushForLabelWrapper);
|
|
2457
2502
|
this._proxy.eventEmitter.on(LabelCaptureBasicOverlayListenerEvents.didTapLabel, this.handleDidTapLabelWrapper);
|
|
2458
2503
|
this.hasListeners = true;
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2504
|
+
yield this.registerListenerForCurrentView();
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
// (Re)register the native listener whenever the viewId changes; the view can be recreated
|
|
2508
|
+
// after the listener is set, and on iOS registering against a stale/-1 viewId silently
|
|
2509
|
+
// no-ops, leaving the overlay delegate unwired. [SDC-30872]
|
|
2510
|
+
registerListenerForCurrentView() {
|
|
2511
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2512
|
+
const viewId = this.dataCaptureViewId;
|
|
2513
|
+
if (viewId === -1) {
|
|
2463
2514
|
this.hasPendingListenerRegistration = true;
|
|
2515
|
+
return;
|
|
2464
2516
|
}
|
|
2517
|
+
if (this.registeredViewId === viewId) {
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
this.hasPendingListenerRegistration = false;
|
|
2521
|
+
this.registeredViewId = viewId;
|
|
2522
|
+
yield this.adapter.addLabelCaptureBasicOverlayListener({ dataCaptureViewId: viewId });
|
|
2465
2523
|
});
|
|
2466
2524
|
}
|
|
2467
2525
|
onViewChanged() {
|
|
2468
2526
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2469
|
-
if (this.
|
|
2470
|
-
this.
|
|
2471
|
-
yield this.adapter.addLabelCaptureBasicOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
|
|
2527
|
+
if (this.hasListeners) {
|
|
2528
|
+
yield this.registerListenerForCurrentView();
|
|
2472
2529
|
}
|
|
2473
2530
|
});
|
|
2474
2531
|
}
|
|
@@ -2477,8 +2534,9 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2477
2534
|
if (!this.hasListeners) {
|
|
2478
2535
|
return;
|
|
2479
2536
|
}
|
|
2480
|
-
if (this.
|
|
2481
|
-
yield this.adapter.removeLabelCaptureBasicOverlayListener({ dataCaptureViewId: this.
|
|
2537
|
+
if (this.registeredViewId !== -1) {
|
|
2538
|
+
yield this.adapter.removeLabelCaptureBasicOverlayListener({ dataCaptureViewId: this.registeredViewId });
|
|
2539
|
+
this.registeredViewId = -1;
|
|
2482
2540
|
}
|
|
2483
2541
|
this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureBasicOverlayListenerEvents));
|
|
2484
2542
|
this._proxy.eventEmitter.off(LabelCaptureBasicOverlayListenerEvents.brushForFieldOfLabel, this.handleBrushForFieldOfLabelWrapper);
|
|
@@ -2503,7 +2561,9 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2503
2561
|
}
|
|
2504
2562
|
handleBrushForFieldOfLabel(ev) {
|
|
2505
2563
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2506
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
2564
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
2565
|
+
viewId: this.dataCaptureViewId,
|
|
2566
|
+
});
|
|
2507
2567
|
if (payload === SKIP) {
|
|
2508
2568
|
return;
|
|
2509
2569
|
}
|
|
@@ -2522,7 +2582,9 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2522
2582
|
}
|
|
2523
2583
|
handleBrushForLabel(ev) {
|
|
2524
2584
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2525
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
2585
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
2586
|
+
viewId: this.dataCaptureViewId,
|
|
2587
|
+
});
|
|
2526
2588
|
if (payload === SKIP) {
|
|
2527
2589
|
return;
|
|
2528
2590
|
}
|
|
@@ -2539,7 +2601,9 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2539
2601
|
});
|
|
2540
2602
|
}
|
|
2541
2603
|
handleDidTapLabel(ev) {
|
|
2542
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
2604
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
2605
|
+
viewId: this.dataCaptureViewId,
|
|
2606
|
+
});
|
|
2543
2607
|
if (payload === SKIP) {
|
|
2544
2608
|
return;
|
|
2545
2609
|
}
|
|
@@ -2560,10 +2624,12 @@ class LabelCaptureBasicOverlayController extends BaseController {
|
|
|
2560
2624
|
|
|
2561
2625
|
class LabelCaptureBasicOverlay extends DefaultSerializeable {
|
|
2562
2626
|
static get defaultPredictedFieldBrush() {
|
|
2563
|
-
return LabelCaptureBasicOverlay.labelCaptureDefaults.LabelCapture.LabelCaptureBasicOverlay
|
|
2627
|
+
return LabelCaptureBasicOverlay.labelCaptureDefaults.LabelCapture.LabelCaptureBasicOverlay
|
|
2628
|
+
.DefaultPredictedFieldBrush;
|
|
2564
2629
|
}
|
|
2565
2630
|
static get defaultCapturedFieldBrush() {
|
|
2566
|
-
return LabelCaptureBasicOverlay.labelCaptureDefaults.LabelCapture.LabelCaptureBasicOverlay
|
|
2631
|
+
return LabelCaptureBasicOverlay.labelCaptureDefaults.LabelCapture.LabelCaptureBasicOverlay
|
|
2632
|
+
.DefaultCapturedFieldBrush;
|
|
2567
2633
|
}
|
|
2568
2634
|
static get defaultLabelBrush() {
|
|
2569
2635
|
return LabelCaptureBasicOverlay.labelCaptureDefaults.LabelCapture.LabelCaptureBasicOverlay.DefaultLabelBrush;
|
|
@@ -2707,6 +2773,9 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
|
|
|
2707
2773
|
super('LabelCaptureValidationFlowOverlayProxy');
|
|
2708
2774
|
this.isSubscribed = false;
|
|
2709
2775
|
this.hasPendingListenerRegistration = false;
|
|
2776
|
+
// viewId the native listener is currently registered against (-1 = none). Tracked so we
|
|
2777
|
+
// can re-register when the view is (re)created with a new id. [SDC-30872]
|
|
2778
|
+
this.registeredViewId = -1;
|
|
2710
2779
|
// Arrow function wrapper to avoid .bind(this) and always use current class state
|
|
2711
2780
|
this.handleDidCaptureLabelWithFieldsEventWrapper = (ev) => {
|
|
2712
2781
|
this.handleDidCaptureLabelWithFieldsEvent(ev);
|
|
@@ -2740,19 +2809,33 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
|
|
|
2740
2809
|
this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didSubmitManualInputForField, this.handleDidSubmitManualInputForFieldEventWrapper);
|
|
2741
2810
|
this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didUpdateValidationFlowResult, this.handleDidUpdateValidationFlowResultEventWrapper);
|
|
2742
2811
|
this.isSubscribed = true;
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2812
|
+
yield this.registerListenerForCurrentView();
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
// Registers the native validation-flow listener for the current view, (re)wiring it whenever
|
|
2816
|
+
// the viewId changes. The view can be (re)created after the listener is set — and on iOS the
|
|
2817
|
+
// native register call silently no-ops when it can't resolve the view (e.g. viewId === -1),
|
|
2818
|
+
// leaving the overlay delegate unset so didCaptureLabelWithFields never fires. Re-registering
|
|
2819
|
+
// on every valid viewId change keeps the delegate wired across view recreation. [SDC-30872]
|
|
2820
|
+
registerListenerForCurrentView() {
|
|
2821
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2822
|
+
const viewId = this.dataCaptureViewId;
|
|
2823
|
+
if (viewId === -1) {
|
|
2747
2824
|
this.hasPendingListenerRegistration = true;
|
|
2825
|
+
return;
|
|
2748
2826
|
}
|
|
2827
|
+
if (this.registeredViewId === viewId) {
|
|
2828
|
+
return;
|
|
2829
|
+
}
|
|
2830
|
+
this.hasPendingListenerRegistration = false;
|
|
2831
|
+
this.registeredViewId = viewId;
|
|
2832
|
+
yield this.adapter.registerListenerForValidationFlowEvents({ dataCaptureViewId: viewId });
|
|
2749
2833
|
});
|
|
2750
2834
|
}
|
|
2751
2835
|
onViewChanged() {
|
|
2752
2836
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2753
|
-
if (this.
|
|
2754
|
-
this.
|
|
2755
|
-
yield this.adapter.registerListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
|
|
2837
|
+
if (this.isSubscribed) {
|
|
2838
|
+
yield this.registerListenerForCurrentView();
|
|
2756
2839
|
}
|
|
2757
2840
|
});
|
|
2758
2841
|
}
|
|
@@ -2761,8 +2844,9 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
|
|
|
2761
2844
|
if (!this.isSubscribed) {
|
|
2762
2845
|
return;
|
|
2763
2846
|
}
|
|
2764
|
-
if (this.
|
|
2765
|
-
yield this.adapter.unregisterListenerForValidationFlowEvents({ dataCaptureViewId: this.
|
|
2847
|
+
if (this.registeredViewId !== -1) {
|
|
2848
|
+
yield this.adapter.unregisterListenerForValidationFlowEvents({ dataCaptureViewId: this.registeredViewId });
|
|
2849
|
+
this.registeredViewId = -1;
|
|
2766
2850
|
}
|
|
2767
2851
|
this._proxy.eventEmitter.off(LabelCaptureValidationFlowListenerEvents.didCaptureLabelWithFields, this.handleDidCaptureLabelWithFieldsEventWrapper);
|
|
2768
2852
|
this._proxy.eventEmitter.off(LabelCaptureValidationFlowListenerEvents.didSubmitManualInputForField, this.handleDidSubmitManualInputForFieldEventWrapper);
|
|
@@ -2889,11 +2973,14 @@ class LabelCaptureValidationFlowOverlay extends DefaultSerializeable {
|
|
|
2889
2973
|
var _a, _b;
|
|
2890
2974
|
this.hasListener = listener != null;
|
|
2891
2975
|
this._listener = listener;
|
|
2892
|
-
|
|
2893
|
-
|
|
2976
|
+
// Note: subscribe when a listener is set, unsubscribe when cleared. The previous
|
|
2977
|
+
// `else if (this.listener == null)` guard was dead code (this._listener was already
|
|
2978
|
+
// assigned above), so setting a listener never subscribed here. [SDC-30872]
|
|
2979
|
+
if (listener != null) {
|
|
2980
|
+
void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.subscribeLabelCaptureValidationFlowListener());
|
|
2894
2981
|
}
|
|
2895
|
-
else
|
|
2896
|
-
void ((_b = this.controller) === null || _b === void 0 ? void 0 : _b.
|
|
2982
|
+
else {
|
|
2983
|
+
void ((_b = this.controller) === null || _b === void 0 ? void 0 : _b.unsubscribeLabelCaptureValidationFlowListener());
|
|
2897
2984
|
}
|
|
2898
2985
|
}
|
|
2899
2986
|
applySettings(settings) {
|
|
@@ -3107,6 +3194,8 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
|
|
|
3107
3194
|
super('LabelCaptureAdaptiveRecognitionOverlayProxy');
|
|
3108
3195
|
this.hasListeners = false;
|
|
3109
3196
|
this.hasPendingListenerRegistration = false;
|
|
3197
|
+
// viewId the native listener is registered against (-1 = none); re-register on view change. [SDC-30872]
|
|
3198
|
+
this.registeredViewId = -1;
|
|
3110
3199
|
this.handleRecognizedWrapper = (ev) => {
|
|
3111
3200
|
this.handleRecognized(ev);
|
|
3112
3201
|
};
|
|
@@ -3126,19 +3215,31 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
|
|
|
3126
3215
|
this._proxy.eventEmitter.on(LabelCaptureAdaptiveRecognitionListenerEvents.recognized, this.handleRecognizedWrapper);
|
|
3127
3216
|
this._proxy.eventEmitter.on(LabelCaptureAdaptiveRecognitionListenerEvents.failure, this.handleFailureWrapper);
|
|
3128
3217
|
this.hasListeners = true;
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3218
|
+
yield this.registerListenerForCurrentView();
|
|
3219
|
+
});
|
|
3220
|
+
}
|
|
3221
|
+
// (Re)register the native listener whenever the viewId changes; the view can be recreated
|
|
3222
|
+
// after the listener is set, and on iOS registering against a stale/-1 viewId silently
|
|
3223
|
+
// no-ops, leaving the overlay delegate unwired. [SDC-30872]
|
|
3224
|
+
registerListenerForCurrentView() {
|
|
3225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3226
|
+
const viewId = this.dataCaptureViewId;
|
|
3227
|
+
if (viewId === -1) {
|
|
3133
3228
|
this.hasPendingListenerRegistration = true;
|
|
3229
|
+
return;
|
|
3134
3230
|
}
|
|
3231
|
+
if (this.registeredViewId === viewId) {
|
|
3232
|
+
return;
|
|
3233
|
+
}
|
|
3234
|
+
this.hasPendingListenerRegistration = false;
|
|
3235
|
+
this.registeredViewId = viewId;
|
|
3236
|
+
yield this.adapter.registerListenerForAdaptiveRecognitionOverlayEvents({ dataCaptureViewId: viewId });
|
|
3135
3237
|
});
|
|
3136
3238
|
}
|
|
3137
3239
|
onViewChanged() {
|
|
3138
3240
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3139
|
-
if (this.
|
|
3140
|
-
this.
|
|
3141
|
-
yield this.adapter.registerListenerForAdaptiveRecognitionOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
|
|
3241
|
+
if (this.hasListeners) {
|
|
3242
|
+
yield this.registerListenerForCurrentView();
|
|
3142
3243
|
}
|
|
3143
3244
|
});
|
|
3144
3245
|
}
|
|
@@ -3147,8 +3248,11 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
|
|
|
3147
3248
|
if (!this.hasListeners) {
|
|
3148
3249
|
return;
|
|
3149
3250
|
}
|
|
3150
|
-
if (this.
|
|
3151
|
-
yield this.adapter.unregisterListenerForAdaptiveRecognitionOverlayEvents({
|
|
3251
|
+
if (this.registeredViewId !== -1) {
|
|
3252
|
+
yield this.adapter.unregisterListenerForAdaptiveRecognitionOverlayEvents({
|
|
3253
|
+
dataCaptureViewId: this.registeredViewId,
|
|
3254
|
+
});
|
|
3255
|
+
this.registeredViewId = -1;
|
|
3152
3256
|
}
|
|
3153
3257
|
this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureAdaptiveRecognitionListenerEvents));
|
|
3154
3258
|
this._proxy.eventEmitter.off(LabelCaptureAdaptiveRecognitionListenerEvents.recognized, this.handleRecognizedWrapper);
|
|
@@ -3161,7 +3265,7 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
|
|
|
3161
3265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3162
3266
|
return this.adapter.applyLabelCaptureAdaptiveRecognitionSettings({
|
|
3163
3267
|
dataCaptureViewId: this.dataCaptureViewId,
|
|
3164
|
-
overlayJson: JSON.stringify(this.overlay.toJSON())
|
|
3268
|
+
overlayJson: JSON.stringify(this.overlay.toJSON()),
|
|
3165
3269
|
});
|
|
3166
3270
|
});
|
|
3167
3271
|
}
|
|
@@ -3178,7 +3282,9 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
|
|
|
3178
3282
|
}
|
|
3179
3283
|
handleRecognized(ev) {
|
|
3180
3284
|
var _a;
|
|
3181
|
-
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
3285
|
+
const payload = EventDataParser.parseIfShouldHandle(ev, {
|
|
3286
|
+
viewId: this.dataCaptureViewId,
|
|
3287
|
+
});
|
|
3182
3288
|
if (payload === SKIP) {
|
|
3183
3289
|
return;
|
|
3184
3290
|
}
|