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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/dts/defaults/LabelCaptureDefaults.d.ts +5 -0
  2. package/dist/dts/generated/LabelProxyAdapter.d.ts +4 -0
  3. package/dist/dts/labelcapture/AdaptiveRecognitionMode.d.ts +4 -0
  4. package/dist/dts/labelcapture/CustomBarcode.d.ts +2 -0
  5. package/dist/dts/labelcapture/CustomText.d.ts +2 -0
  6. package/dist/dts/labelcapture/DateText.d.ts +17 -0
  7. package/dist/dts/labelcapture/ExpiryDateText.d.ts +2 -0
  8. package/dist/dts/labelcapture/ImeiOneBarcode.d.ts +2 -0
  9. package/dist/dts/labelcapture/ImeiTwoBarcode.d.ts +2 -0
  10. package/dist/dts/labelcapture/LabelCaptureListener.d.ts +2 -1
  11. package/dist/dts/labelcapture/LabelCaptureSession.d.ts +3 -0
  12. package/dist/dts/labelcapture/LabelCaptureValidationFlowListener.d.ts +4 -1
  13. package/dist/dts/labelcapture/LabelCaptureValidationFlowSettings.d.ts +16 -1
  14. package/dist/dts/labelcapture/LabelDefinition.d.ts +6 -0
  15. package/dist/dts/labelcapture/LabelField.d.ts +3 -0
  16. package/dist/dts/labelcapture/LabelFieldDefinition.d.ts +4 -0
  17. package/dist/dts/labelcapture/LabelFieldValueType.d.ts +7 -0
  18. package/dist/dts/labelcapture/LabelResultUpdateType.d.ts +5 -0
  19. package/dist/dts/labelcapture/PackingDateText.d.ts +2 -0
  20. package/dist/dts/labelcapture/PartNumberBarcode.d.ts +2 -0
  21. package/dist/dts/labelcapture/SerialNumberBarcode.d.ts +2 -0
  22. package/dist/dts/labelcapture/TotalPriceText.d.ts +2 -0
  23. package/dist/dts/labelcapture/UnitPriceText.d.ts +2 -0
  24. package/dist/dts/labelcapture/WeightText.d.ts +2 -0
  25. package/dist/dts/labelcapture/controller/LabelCaptureController.d.ts +5 -8
  26. package/dist/dts/labelcapture/controller/LabelCaptureValidationFlowOverlayController.d.ts +9 -1
  27. package/dist/dts/labelcapture/index.d.ts +4 -0
  28. package/dist/dts/labelcapture/private/PrivateLabelCaptureSession.d.ts +6 -1
  29. package/dist/dts/labelcapture/private/PrivateLabelField.d.ts +1 -0
  30. package/dist/index.js +403 -28
  31. package/dist/index.js.map +1 -1
  32. package/package.json +5 -5
  33. package/test/LabelCaptureValidationFlowOverlayController.test.ts +40 -26
  34. package/test/LabelCaptureValidationFlowSettings.test.ts +5 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { FactoryMaker, Feedback, Brush, CameraSettings, nameForSerialization, DefaultSerializeable, ignoreFromSerialization, ignoreFromSerializationIfNull, Quadrilateral, BaseController, Anchor, PointWithUnit, Rect, Point, Size, serializationDefault, NoViewfinder, registerProxies } from 'scandit-datacapture-frameworks-core';
1
+ import { FactoryMaker, Feedback, Brush, CameraSettings, nameForSerialization, DefaultSerializeable, ignoreFromSerialization, ignoreFromSerializationIfNull, 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;
@@ -43,6 +43,11 @@ function parseLabelCaptureDefaults(jsonDefaults) {
43
43
  validationErrorText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationErrorText,
44
44
  requiredFieldErrorText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.requiredFieldErrorText,
45
45
  manualInputButtonText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.manualInputButtonText,
46
+ validationFinishButtonText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationFinishButtonText,
47
+ validationRestartButtonText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationRestartButtonText,
48
+ validationPauseButtonText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationPauseButtonText,
49
+ validationAdaptiveScanningText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationAdaptiveScanningText,
50
+ validationScanningText: jsonDefaults.LabelCapture.LabelCaptureValidationFlowOverlay.Settings.validationScanningText,
46
51
  }
47
52
  },
48
53
  Feedback: {
@@ -52,6 +57,12 @@ function parseLabelCaptureDefaults(jsonDefaults) {
52
57
  };
53
58
  }
54
59
 
60
+ var AdaptiveRecognitionMode;
61
+ (function (AdaptiveRecognitionMode) {
62
+ AdaptiveRecognitionMode["Off"] = "off";
63
+ AdaptiveRecognitionMode["Auto"] = "auto";
64
+ })(AdaptiveRecognitionMode || (AdaptiveRecognitionMode = {}));
65
+
55
66
  var AdaptiveRecognitionResultType;
56
67
  (function (AdaptiveRecognitionResultType) {
57
68
  AdaptiveRecognitionResultType["Receipt"] = "receipt";
@@ -112,12 +123,21 @@ class LabelFieldDefinition extends DefaultSerializeable {
112
123
  set valueRegexes(value) {
113
124
  this._valueRegexes = value;
114
125
  }
126
+ setValueRegex(valueRegex) {
127
+ this._valueRegexes = [...this._valueRegexes, valueRegex];
128
+ }
115
129
  get optional() {
116
130
  return this._optional;
117
131
  }
118
132
  set optional(value) {
119
133
  this._optional = value;
120
134
  }
135
+ get numberOfMandatoryInstances() {
136
+ return this._numberOfMandatoryInstances;
137
+ }
138
+ set numberOfMandatoryInstances(value) {
139
+ this._numberOfMandatoryInstances = value;
140
+ }
121
141
  get hiddenProperties() {
122
142
  return this._hiddenProperties;
123
143
  }
@@ -139,6 +159,7 @@ class LabelFieldDefinition extends DefaultSerializeable {
139
159
  super();
140
160
  this._valueRegexes = [];
141
161
  this._optional = false;
162
+ this._numberOfMandatoryInstances = null;
142
163
  this._hiddenProperties = {};
143
164
  this._name = name;
144
165
  }
@@ -152,6 +173,9 @@ __decorate([
152
173
  __decorate([
153
174
  nameForSerialization('optional')
154
175
  ], LabelFieldDefinition.prototype, "_optional", void 0);
176
+ __decorate([
177
+ nameForSerialization('number_of_mandatory_instances')
178
+ ], LabelFieldDefinition.prototype, "_numberOfMandatoryInstances", void 0);
155
179
  __decorate([
156
180
  ignoreFromSerialization
157
181
  ], LabelFieldDefinition.prototype, "_hiddenProperties", void 0);
@@ -242,6 +266,7 @@ class LabelField {
242
266
  field._barcode = json.barcode ? Barcode['fromJSON'](json.barcode) : null;
243
267
  field._text = json.text;
244
268
  field._dateResult = json.date ? LabelDateResult.fromJSON(json.date) : null;
269
+ field._valueType = json.valueType;
245
270
  return field;
246
271
  }
247
272
  get name() {
@@ -265,6 +290,9 @@ class LabelField {
265
290
  get text() {
266
291
  return this._text;
267
292
  }
293
+ get valueType() {
294
+ return this._valueType;
295
+ }
268
296
  asDate() {
269
297
  return this._dateResult;
270
298
  }
@@ -347,6 +375,12 @@ class CustomBarcode extends BarcodeField {
347
375
  get symbologies() {
348
376
  return super.symbologySettings;
349
377
  }
378
+ get numberOfMandatoryInstances() {
379
+ return super.numberOfMandatoryInstances;
380
+ }
381
+ set numberOfMandatoryInstances(value) {
382
+ super.numberOfMandatoryInstances = value;
383
+ }
350
384
  }
351
385
  __decorate([
352
386
  nameForSerialization('location')
@@ -387,6 +421,12 @@ class CustomText extends TextField {
387
421
  get isOptional() {
388
422
  return super.optional;
389
423
  }
424
+ get numberOfMandatoryInstances() {
425
+ return super.numberOfMandatoryInstances;
426
+ }
427
+ set numberOfMandatoryInstances(value) {
428
+ super.numberOfMandatoryInstances = value;
429
+ }
390
430
  }
391
431
  __decorate([
392
432
  nameForSerialization('location')
@@ -398,6 +438,52 @@ __decorate([
398
438
  nameForSerialization('fieldType')
399
439
  ], CustomText.prototype, "_fieldType", void 0);
400
440
 
441
+ class DateText extends TextField {
442
+ constructor(name, labelDateFormat) {
443
+ super(name);
444
+ this._fieldType = 'dateText';
445
+ this._anchorRegexes = null;
446
+ this._labelDateFormat = labelDateFormat;
447
+ }
448
+ get labelDateFormat() {
449
+ return this._labelDateFormat;
450
+ }
451
+ get anchorRegexes() {
452
+ var _a;
453
+ return (_a = this._anchorRegexes) !== null && _a !== void 0 ? _a : [];
454
+ }
455
+ set anchorRegexes(value) {
456
+ this._anchorRegexes = value;
457
+ }
458
+ get name() {
459
+ return super.name;
460
+ }
461
+ get valueRegexes() {
462
+ return super.valueRegexes;
463
+ }
464
+ set valueRegexes(value) {
465
+ super.valueRegexes = value;
466
+ }
467
+ get isOptional() {
468
+ return super.optional;
469
+ }
470
+ get numberOfMandatoryInstances() {
471
+ return super.numberOfMandatoryInstances;
472
+ }
473
+ set numberOfMandatoryInstances(value) {
474
+ super.numberOfMandatoryInstances = value;
475
+ }
476
+ }
477
+ __decorate([
478
+ nameForSerialization('fieldType')
479
+ ], DateText.prototype, "_fieldType", void 0);
480
+ __decorate([
481
+ nameForSerialization('dataTypePatterns')
482
+ ], DateText.prototype, "_anchorRegexes", void 0);
483
+ __decorate([
484
+ nameForSerialization('labelDateFormat')
485
+ ], DateText.prototype, "_labelDateFormat", void 0);
486
+
401
487
  class ExpiryDateText extends TextField {
402
488
  constructor(name) {
403
489
  super(name);
@@ -430,6 +516,12 @@ class ExpiryDateText extends TextField {
430
516
  get isOptional() {
431
517
  return super.optional;
432
518
  }
519
+ get numberOfMandatoryInstances() {
520
+ return super.numberOfMandatoryInstances;
521
+ }
522
+ set numberOfMandatoryInstances(value) {
523
+ super.numberOfMandatoryInstances = value;
524
+ }
433
525
  }
434
526
  __decorate([
435
527
  nameForSerialization('fieldType')
@@ -474,6 +566,12 @@ class ImeiOneBarcode extends BarcodeField {
474
566
  get symbologies() {
475
567
  return super.symbologySettings;
476
568
  }
569
+ get numberOfMandatoryInstances() {
570
+ return super.numberOfMandatoryInstances;
571
+ }
572
+ set numberOfMandatoryInstances(value) {
573
+ super.numberOfMandatoryInstances = value;
574
+ }
477
575
  constructor(name, symbologies) {
478
576
  super(name, symbologies);
479
577
  this._fieldType = 'imeiOneBarcode';
@@ -516,6 +614,12 @@ class ImeiTwoBarcode extends BarcodeField {
516
614
  get symbologies() {
517
615
  return super.symbologySettings;
518
616
  }
617
+ get numberOfMandatoryInstances() {
618
+ return super.numberOfMandatoryInstances;
619
+ }
620
+ set numberOfMandatoryInstances(value) {
621
+ super.numberOfMandatoryInstances = value;
622
+ }
519
623
  constructor(name, symbologies) {
520
624
  super(name, symbologies);
521
625
  this._fieldType = 'imeiTwoBarcode';
@@ -532,10 +636,17 @@ class LabelCaptureSession {
532
636
  get frameSequenceID() {
533
637
  return this._frameSequenceID;
534
638
  }
535
- static fromJSON(json) {
639
+ get lastProcessedFrameId() {
640
+ return this._lastProcessedFrameId;
641
+ }
642
+ static fromJSON(payload) {
643
+ var _a;
644
+ const sessionJson = JSON.parse(payload.session);
536
645
  const session = new LabelCaptureSession();
537
- session._frameSequenceID = json.frameSequenceId;
538
- session._capturedLabels = json.labels
646
+ session._frameSequenceID = sessionJson.frameSequenceId;
647
+ session._lastProcessedFrameId = sessionJson.lastFrameId;
648
+ session.frameId = (_a = payload.frameId) !== null && _a !== void 0 ? _a : '';
649
+ session._capturedLabels = sessionJson.labels
539
650
  .map(CapturedLabel.fromJSON);
540
651
  session._capturedLabels
541
652
  .forEach(label => label.frameSequenceID = session._frameSequenceID);
@@ -1027,6 +1138,19 @@ class LabelProxyAdapter {
1027
1138
  return result;
1028
1139
  });
1029
1140
  }
1141
+ /**
1142
+ * Finish callback for label capture did update session event
1143
+ */
1144
+ finishValidationFlowResultUpdateEvent() {
1145
+ return __awaiter(this, void 0, void 0, function* () {
1146
+ const result = yield this.proxy.$executeLabel({
1147
+ moduleName: 'LabelCaptureModule',
1148
+ methodName: 'finishValidationFlowResultUpdateEvent',
1149
+ isEventRegistration: false,
1150
+ });
1151
+ return result;
1152
+ });
1153
+ }
1030
1154
  }
1031
1155
 
1032
1156
  var LabelCaptureListenerEvents;
@@ -1037,6 +1161,7 @@ class LabelCaptureController extends BaseController {
1037
1161
  constructor(mode) {
1038
1162
  super('LabelCaptureProxy');
1039
1163
  this.mode = mode;
1164
+ this.frameDataController = new FrameDataController();
1040
1165
  this.adapter = new LabelProxyAdapter(this._proxy);
1041
1166
  this.initialize().catch(error => console.error('Failed to initialize LabelCaptureController:', error));
1042
1167
  }
@@ -1068,7 +1193,10 @@ class LabelCaptureController extends BaseController {
1068
1193
  });
1069
1194
  }
1070
1195
  updateFeedback(feedback) {
1071
- return this.adapter.updateLabelCaptureFeedback({ modeId: this.modeId, feedbackJson: JSON.stringify(feedback.toJSON()) });
1196
+ return this.adapter.updateLabelCaptureFeedback({
1197
+ modeId: this.modeId,
1198
+ feedbackJson: JSON.stringify(feedback.toJSON()),
1199
+ });
1072
1200
  }
1073
1201
  dispose() {
1074
1202
  void this.unsubscribeLabelCaptureListener();
@@ -1083,20 +1211,32 @@ class LabelCaptureController extends BaseController {
1083
1211
  }
1084
1212
  handleDidUpdateSessionEvent(ev) {
1085
1213
  return __awaiter(this, void 0, void 0, function* () {
1086
- const payload = JSON.parse(ev.data);
1087
- const session = LabelCaptureSession.fromJSON(JSON.parse(payload.session));
1088
- this.notifyListenersOfDidUpdateSession(session);
1089
- yield this.adapter.finishLabelCaptureListenerDidUpdateSession({ modeId: this.modeId, isEnabled: this.mode.isEnabled });
1214
+ const payload = EventDataParser.parseIfShouldHandle(ev, { modeId: this.modeId });
1215
+ if (payload === SKIP) {
1216
+ return;
1217
+ }
1218
+ if (payload === null) {
1219
+ console.error('LabelCaptureController didUpdateSession payload is null');
1220
+ return;
1221
+ }
1222
+ const session = LabelCaptureSession.fromJSON(payload);
1223
+ yield this.notifyListenersOfDidUpdateSession(session);
1224
+ yield this.adapter.finishLabelCaptureListenerDidUpdateSession({
1225
+ modeId: this.modeId,
1226
+ isEnabled: this.mode.isEnabled,
1227
+ });
1090
1228
  });
1091
1229
  }
1092
1230
  get modeId() {
1093
1231
  return this.mode.modeId;
1094
1232
  }
1095
1233
  notifyListenersOfDidUpdateSession(session) {
1096
- const mode = this.mode;
1097
- mode.listeners.forEach(listener => {
1098
- if (listener.didUpdateSession) {
1099
- listener.didUpdateSession(this.mode, session);
1234
+ return __awaiter(this, void 0, void 0, function* () {
1235
+ const mode = this.mode;
1236
+ for (const listener of mode.listeners) {
1237
+ if (listener.didUpdateSession) {
1238
+ yield listener.didUpdateSession(this.mode, session, () => this.frameDataController.getFrame(session['frameId']));
1239
+ }
1100
1240
  }
1101
1241
  });
1102
1242
  }
@@ -1404,7 +1544,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1404
1544
  }
1405
1545
  handleViewForLabel(ev) {
1406
1546
  return __awaiter(this, void 0, void 0, function* () {
1407
- const payload = JSON.parse(ev.data);
1547
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
1548
+ if (payload === SKIP) {
1549
+ return;
1550
+ }
1551
+ if (payload === null) {
1552
+ console.error('LabelCaptureAdvancedOverlayController viewForLabel payload is null');
1553
+ return;
1554
+ }
1408
1555
  let view = null;
1409
1556
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
1410
1557
  if (this.overlay.listener && this.overlay.listener.viewForCapturedLabel) {
@@ -1415,7 +1562,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1415
1562
  }
1416
1563
  handleAnchorForLabel(ev) {
1417
1564
  return __awaiter(this, void 0, void 0, function* () {
1418
- const payload = JSON.parse(ev.data);
1565
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
1566
+ if (payload === SKIP) {
1567
+ return;
1568
+ }
1569
+ if (payload === null) {
1570
+ console.error('LabelCaptureAdvancedOverlayController anchorForLabel payload is null');
1571
+ return;
1572
+ }
1419
1573
  let anchor = Anchor.Center;
1420
1574
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
1421
1575
  if (this.overlay.listener && this.overlay.listener.anchorForCapturedLabel) {
@@ -1426,7 +1580,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1426
1580
  }
1427
1581
  handleViewForCapturedLabelField(ev) {
1428
1582
  return __awaiter(this, void 0, void 0, function* () {
1429
- const payload = JSON.parse(ev.data);
1583
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
1584
+ if (payload === SKIP) {
1585
+ return;
1586
+ }
1587
+ if (payload === null) {
1588
+ console.error('LabelCaptureAdvancedOverlayController viewForCapturedLabelField payload is null');
1589
+ return;
1590
+ }
1430
1591
  let view = null;
1431
1592
  const field = LabelField.fromJSON(JSON.parse(payload.field));
1432
1593
  if (this.overlay.listener && this.overlay.listener.viewForCapturedLabelField) {
@@ -1437,7 +1598,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1437
1598
  }
1438
1599
  handleOffsetForLabel(ev) {
1439
1600
  return __awaiter(this, void 0, void 0, function* () {
1440
- const payload = JSON.parse(ev.data);
1601
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
1602
+ if (payload === SKIP) {
1603
+ return;
1604
+ }
1605
+ if (payload === null) {
1606
+ console.error('LabelCaptureAdvancedOverlayController offsetForLabel payload is null');
1607
+ return;
1608
+ }
1441
1609
  let offset = PointWithUnit.zero;
1442
1610
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
1443
1611
  if (this.overlay.listener && this.overlay.listener.offsetForCapturedLabel) {
@@ -1448,7 +1616,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1448
1616
  }
1449
1617
  handleAnchorForCapturedLabelField(ev) {
1450
1618
  return __awaiter(this, void 0, void 0, function* () {
1451
- const payload = JSON.parse(ev.data);
1619
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
1620
+ if (payload === SKIP) {
1621
+ return;
1622
+ }
1623
+ if (payload === null) {
1624
+ console.error('LabelCaptureAdvancedOverlayController anchorForCapturedLabelField payload is null');
1625
+ return;
1626
+ }
1452
1627
  let anchor = Anchor.Center;
1453
1628
  const field = LabelField.fromJSON(JSON.parse(payload.field));
1454
1629
  if (this.overlay.listener && this.overlay.listener.anchorForCapturedLabelField) {
@@ -1459,7 +1634,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1459
1634
  }
1460
1635
  handleOffsetForCapturedLabelField(ev) {
1461
1636
  return __awaiter(this, void 0, void 0, function* () {
1462
- const payload = JSON.parse(ev.data);
1637
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
1638
+ if (payload === SKIP) {
1639
+ return;
1640
+ }
1641
+ if (payload === null) {
1642
+ console.error('LabelCaptureAdvancedOverlayController offsetForCapturedLabelField payload is null');
1643
+ return;
1644
+ }
1463
1645
  let offset = PointWithUnit.zero;
1464
1646
  const field = LabelField.fromJSON(JSON.parse(payload.field));
1465
1647
  if (this.overlay.listener && this.overlay.listener.offsetForCapturedLabelField) {
@@ -1657,6 +1839,18 @@ class LabelDefinition extends DefaultSerializeable {
1657
1839
  set fields(values) {
1658
1840
  this._fields = values;
1659
1841
  }
1842
+ addField(field) {
1843
+ this._fields.push(field);
1844
+ }
1845
+ addFields(fields) {
1846
+ this._fields.push(...fields);
1847
+ }
1848
+ get adaptiveRecognitionMode() {
1849
+ return this._adaptiveRecognitionMode;
1850
+ }
1851
+ set adaptiveRecognitionMode(value) {
1852
+ this._adaptiveRecognitionMode = value;
1853
+ }
1660
1854
  get hiddenProperties() {
1661
1855
  return this._hiddenProperties;
1662
1856
  }
@@ -1700,6 +1894,7 @@ class LabelDefinition extends DefaultSerializeable {
1700
1894
  this._name = '';
1701
1895
  this._fields = [];
1702
1896
  this._type = null;
1897
+ this._adaptiveRecognitionMode = AdaptiveRecognitionMode.Off;
1703
1898
  this._hiddenProperties = {};
1704
1899
  this._name = name;
1705
1900
  }
@@ -1714,6 +1909,9 @@ __decorate([
1714
1909
  nameForSerialization('type'),
1715
1910
  ignoreFromSerializationIfNull
1716
1911
  ], LabelDefinition.prototype, "_type", void 0);
1912
+ __decorate([
1913
+ nameForSerialization('adaptiveRecognitionMode')
1914
+ ], LabelDefinition.prototype, "_adaptiveRecognitionMode", void 0);
1717
1915
  __decorate([
1718
1916
  ignoreFromSerialization
1719
1917
  ], LabelDefinition.prototype, "_hiddenProperties", void 0);
@@ -1821,6 +2019,15 @@ var LabelFieldType;
1821
2019
  LabelFieldType["Unknown"] = "unknown";
1822
2020
  })(LabelFieldType || (LabelFieldType = {}));
1823
2021
 
2022
+ var LabelFieldValueType;
2023
+ (function (LabelFieldValueType) {
2024
+ LabelFieldValueType["Date"] = "date";
2025
+ LabelFieldValueType["Price"] = "price";
2026
+ LabelFieldValueType["Weight"] = "weight";
2027
+ LabelFieldValueType["Text"] = "text";
2028
+ LabelFieldValueType["Numeric"] = "numeric";
2029
+ })(LabelFieldValueType || (LabelFieldValueType = {}));
2030
+
1824
2031
  class PackingDateText extends TextField {
1825
2032
  constructor(name) {
1826
2033
  super(name);
@@ -1850,6 +2057,12 @@ class PackingDateText extends TextField {
1850
2057
  set valueRegexes(value) {
1851
2058
  super.valueRegexes = value;
1852
2059
  }
2060
+ get numberOfMandatoryInstances() {
2061
+ return super.numberOfMandatoryInstances;
2062
+ }
2063
+ set numberOfMandatoryInstances(value) {
2064
+ super.numberOfMandatoryInstances = value;
2065
+ }
1853
2066
  }
1854
2067
  __decorate([
1855
2068
  nameForSerialization('fieldType')
@@ -1898,6 +2111,12 @@ class PartNumberBarcode extends BarcodeField {
1898
2111
  get symbologies() {
1899
2112
  return super.symbologySettings;
1900
2113
  }
2114
+ get numberOfMandatoryInstances() {
2115
+ return super.numberOfMandatoryInstances;
2116
+ }
2117
+ set numberOfMandatoryInstances(value) {
2118
+ super.numberOfMandatoryInstances = value;
2119
+ }
1901
2120
  }
1902
2121
  __decorate([
1903
2122
  nameForSerialization('fieldType')
@@ -2058,6 +2277,12 @@ class SerialNumberBarcode extends BarcodeField {
2058
2277
  get symbologies() {
2059
2278
  return super.symbologySettings;
2060
2279
  }
2280
+ get numberOfMandatoryInstances() {
2281
+ return super.numberOfMandatoryInstances;
2282
+ }
2283
+ set numberOfMandatoryInstances(value) {
2284
+ super.numberOfMandatoryInstances = value;
2285
+ }
2061
2286
  }
2062
2287
  __decorate([
2063
2288
  nameForSerialization('fieldType')
@@ -2088,6 +2313,12 @@ class TotalPriceText extends TextField {
2088
2313
  set valueRegexes(value) {
2089
2314
  super.valueRegexes = value;
2090
2315
  }
2316
+ get numberOfMandatoryInstances() {
2317
+ return super.numberOfMandatoryInstances;
2318
+ }
2319
+ set numberOfMandatoryInstances(value) {
2320
+ super.numberOfMandatoryInstances = value;
2321
+ }
2091
2322
  }
2092
2323
  __decorate([
2093
2324
  nameForSerialization('fieldType')
@@ -2121,6 +2352,12 @@ class UnitPriceText extends TextField {
2121
2352
  set valueRegexes(value) {
2122
2353
  super.valueRegexes = value;
2123
2354
  }
2355
+ get numberOfMandatoryInstances() {
2356
+ return super.numberOfMandatoryInstances;
2357
+ }
2358
+ set numberOfMandatoryInstances(value) {
2359
+ super.numberOfMandatoryInstances = value;
2360
+ }
2124
2361
  }
2125
2362
  __decorate([
2126
2363
  nameForSerialization('fieldType')
@@ -2154,6 +2391,12 @@ class WeightText extends TextField {
2154
2391
  set valueRegexes(value) {
2155
2392
  super.valueRegexes = value;
2156
2393
  }
2394
+ get numberOfMandatoryInstances() {
2395
+ return super.numberOfMandatoryInstances;
2396
+ }
2397
+ set numberOfMandatoryInstances(value) {
2398
+ super.numberOfMandatoryInstances = value;
2399
+ }
2157
2400
  }
2158
2401
  __decorate([
2159
2402
  nameForSerialization('fieldType')
@@ -2259,7 +2502,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
2259
2502
  }
2260
2503
  handleBrushForFieldOfLabel(ev) {
2261
2504
  return __awaiter(this, void 0, void 0, function* () {
2262
- const payload = JSON.parse(ev.data);
2505
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
2506
+ if (payload === SKIP) {
2507
+ return;
2508
+ }
2509
+ if (payload === null) {
2510
+ console.error('LabelCaptureBasicOverlayController brushForFieldOfLabel payload is null');
2511
+ return;
2512
+ }
2263
2513
  let brush = this.overlay.capturedFieldBrush;
2264
2514
  const field = LabelField.fromJSON(JSON.parse(payload.field));
2265
2515
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
@@ -2271,7 +2521,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
2271
2521
  }
2272
2522
  handleBrushForLabel(ev) {
2273
2523
  return __awaiter(this, void 0, void 0, function* () {
2274
- const payload = JSON.parse(ev.data);
2524
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
2525
+ if (payload === SKIP) {
2526
+ return;
2527
+ }
2528
+ if (payload === null) {
2529
+ console.error('LabelCaptureBasicOverlayController brushForLabel payload is null');
2530
+ return;
2531
+ }
2275
2532
  let brush = this.overlay.labelBrush;
2276
2533
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
2277
2534
  if (this.overlay.listener && this.overlay.listener.brushForLabel) {
@@ -2281,7 +2538,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
2281
2538
  });
2282
2539
  }
2283
2540
  handleDidTapLabel(ev) {
2284
- const payload = JSON.parse(ev.data);
2541
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
2542
+ if (payload === SKIP) {
2543
+ return;
2544
+ }
2545
+ if (payload === null) {
2546
+ console.error('LabelCaptureBasicOverlayController didTapLabel payload is null');
2547
+ return;
2548
+ }
2285
2549
  if (this.overlay.listener && this.overlay.listener.didTapLabel) {
2286
2550
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
2287
2551
  this.overlay.listener.didTapLabel(this.overlay, label);
@@ -2435,6 +2699,7 @@ var LabelCaptureValidationFlowListenerEvents;
2435
2699
  (function (LabelCaptureValidationFlowListenerEvents) {
2436
2700
  LabelCaptureValidationFlowListenerEvents["didCaptureLabelWithFields"] = "LabelCaptureValidationFlowListener.didCaptureLabelWithFields";
2437
2701
  LabelCaptureValidationFlowListenerEvents["didSubmitManualInputForField"] = "LabelCaptureValidationFlowListener.didSubmitManualInputForField";
2702
+ LabelCaptureValidationFlowListenerEvents["didUpdateValidationFlowResult"] = "LabelCaptureValidationFlowListener.didUpdateValidationFlowResult";
2438
2703
  })(LabelCaptureValidationFlowListenerEvents || (LabelCaptureValidationFlowListenerEvents = {}));
2439
2704
  class LabelCaptureValidationFlowOverlayController extends BaseController {
2440
2705
  constructor(overlay) {
@@ -2448,13 +2713,20 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2448
2713
  this.handleDidSubmitManualInputForFieldEventWrapper = (ev) => {
2449
2714
  this.handleDidSubmitManualInputForFieldEvent(ev);
2450
2715
  };
2716
+ this.handleDidUpdateValidationFlowResultEventWrapper = (ev) => __awaiter(this, void 0, void 0, function* () {
2717
+ yield this.handleDidUpdateValidationFlowResult(ev);
2718
+ });
2451
2719
  this.overlay = overlay;
2452
2720
  this.adapter = new LabelProxyAdapter(this._proxy);
2721
+ this.frameDataController = new FrameDataController();
2453
2722
  void this.initialize();
2454
2723
  }
2455
2724
  updateValidationFlowOverlay() {
2456
2725
  return __awaiter(this, void 0, void 0, function* () {
2457
- yield this.adapter.updateLabelCaptureValidationFlowOverlay({ dataCaptureViewId: this.dataCaptureViewId, overlayJson: JSON.stringify(this.overlay.toJSON()) });
2726
+ yield this.adapter.updateLabelCaptureValidationFlowOverlay({
2727
+ dataCaptureViewId: this.dataCaptureViewId,
2728
+ overlayJson: JSON.stringify(this.overlay.toJSON()),
2729
+ });
2458
2730
  });
2459
2731
  }
2460
2732
  subscribeLabelCaptureValidationFlowListener() {
@@ -2465,6 +2737,7 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2465
2737
  this._proxy.subscribeForEvents(Object.values(LabelCaptureValidationFlowListenerEvents));
2466
2738
  this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didCaptureLabelWithFields, this.handleDidCaptureLabelWithFieldsEventWrapper);
2467
2739
  this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didSubmitManualInputForField, this.handleDidSubmitManualInputForFieldEventWrapper);
2740
+ this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didUpdateValidationFlowResult, this.handleDidUpdateValidationFlowResultEventWrapper);
2468
2741
  this.isSubscribed = true;
2469
2742
  if (this.dataCaptureViewId !== -1) {
2470
2743
  yield this.adapter.registerListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
@@ -2509,15 +2782,53 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2509
2782
  });
2510
2783
  }
2511
2784
  handleDidCaptureLabelWithFieldsEvent(ev) {
2512
- const payload = JSON.parse(ev.data);
2513
- const fields = payload.fields.map((field) => LabelField.fromJSON(JSON.parse(field)));
2785
+ const payload = EventDataParser.parseIfShouldHandle(ev, {
2786
+ viewId: this.dataCaptureViewId,
2787
+ });
2788
+ if (payload === SKIP) {
2789
+ return;
2790
+ }
2791
+ if (payload === null) {
2792
+ console.error('LabelCaptureValidationFlowOverlayController didCaptureLabelWithFields payload is null');
2793
+ return;
2794
+ }
2795
+ const fields = payload.fields.map(field => LabelField.fromJSON(JSON.parse(field)));
2514
2796
  this.notifyListenersOfDidCaptureLabelWithFields(fields);
2515
2797
  }
2516
2798
  handleDidSubmitManualInputForFieldEvent(ev) {
2517
- const payload = JSON.parse(ev.data);
2799
+ const payload = EventDataParser.parseIfShouldHandle(ev, {
2800
+ viewId: this.dataCaptureViewId,
2801
+ });
2802
+ if (payload === SKIP) {
2803
+ return;
2804
+ }
2805
+ if (payload === null) {
2806
+ console.error('LabelCaptureValidationFlowOverlayController didSubmitManualInputForField payload is null');
2807
+ return;
2808
+ }
2518
2809
  const field = LabelField.fromJSON(JSON.parse(payload.fields[0]));
2519
2810
  this.notifyListenersOfDidSubmitManualInputForField(field, payload.oldValue, payload.newValue);
2520
2811
  }
2812
+ handleDidUpdateValidationFlowResult(ev) {
2813
+ return __awaiter(this, void 0, void 0, function* () {
2814
+ var _a;
2815
+ const payload = EventDataParser.parseIfShouldHandle(ev, {
2816
+ viewId: this.dataCaptureViewId,
2817
+ });
2818
+ if (payload === SKIP) {
2819
+ return;
2820
+ }
2821
+ if (payload === null) {
2822
+ console.error('LabelCaptureValidationFlowOverlayController didUpdateValidationFlowResult payload is null');
2823
+ return;
2824
+ }
2825
+ const fields = payload.fields.map(field => LabelField.fromJSON(JSON.parse(field)));
2826
+ const frameId = payload.frameId;
2827
+ const asyncId = payload.asyncId;
2828
+ yield ((_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didUpdateValidationFlowResult(payload.type, asyncId, fields, () => frameId ? this.frameDataController.getFrame(frameId) : Promise.resolve(null)));
2829
+ yield this.adapter.finishValidationFlowResultUpdateEvent();
2830
+ });
2831
+ }
2521
2832
  notifyListenersOfDidCaptureLabelWithFields(fields) {
2522
2833
  var _a;
2523
2834
  (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didCaptureLabelWithFields(fields);
@@ -2608,6 +2919,11 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
2608
2919
  this._validationErrorText = defaults.validationErrorText;
2609
2920
  this._requiredFieldErrorText = defaults.requiredFieldErrorText;
2610
2921
  this._manualInputButtonText = defaults.manualInputButtonText;
2922
+ this._finishButtonText = defaults.validationFinishButtonText;
2923
+ this._restartButtonText = defaults.validationRestartButtonText;
2924
+ this._pauseButtonText = defaults.validationPauseButtonText;
2925
+ this._adaptiveScanningText = defaults.validationAdaptiveScanningText;
2926
+ this._scanningText = defaults.validationScanningText;
2611
2927
  }
2612
2928
  /**
2613
2929
  * @deprecated This property is deprecated and will be removed in a future release.
@@ -2666,6 +2982,36 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
2666
2982
  console.warn('manualInputButtonText is deprecated and will be removed in a future release.');
2667
2983
  this._manualInputButtonText = text;
2668
2984
  }
2985
+ get finishButtonText() {
2986
+ return this._finishButtonText;
2987
+ }
2988
+ set finishButtonText(text) {
2989
+ this._finishButtonText = text;
2990
+ }
2991
+ get restartButtonText() {
2992
+ return this._restartButtonText;
2993
+ }
2994
+ set restartButtonText(text) {
2995
+ this._restartButtonText = text;
2996
+ }
2997
+ get pauseButtonText() {
2998
+ return this._pauseButtonText;
2999
+ }
3000
+ set pauseButtonText(text) {
3001
+ this._pauseButtonText = text;
3002
+ }
3003
+ get adaptiveScanningText() {
3004
+ return this._adaptiveScanningText;
3005
+ }
3006
+ set adaptiveScanningText(text) {
3007
+ this._adaptiveScanningText = text;
3008
+ }
3009
+ get scanningText() {
3010
+ return this._scanningText;
3011
+ }
3012
+ set scanningText(text) {
3013
+ this._scanningText = text;
3014
+ }
2669
3015
  setPlaceholderTextForLabelDefinition(fieldName, placeholder) {
2670
3016
  if (placeholder === null) {
2671
3017
  this._labelDefinitionsPlaceholders.delete(fieldName);
@@ -2708,10 +3054,32 @@ __decorate([
2708
3054
  __decorate([
2709
3055
  nameForSerialization('manualInputButtonText')
2710
3056
  ], LabelCaptureValidationFlowSettings.prototype, "_manualInputButtonText", void 0);
3057
+ __decorate([
3058
+ nameForSerialization('validationFinishButtonText')
3059
+ ], LabelCaptureValidationFlowSettings.prototype, "_finishButtonText", void 0);
3060
+ __decorate([
3061
+ nameForSerialization('validationRestartButtonText')
3062
+ ], LabelCaptureValidationFlowSettings.prototype, "_restartButtonText", void 0);
3063
+ __decorate([
3064
+ nameForSerialization('validationPauseButtonText')
3065
+ ], LabelCaptureValidationFlowSettings.prototype, "_pauseButtonText", void 0);
3066
+ __decorate([
3067
+ nameForSerialization('validationAdaptiveScanningText')
3068
+ ], LabelCaptureValidationFlowSettings.prototype, "_adaptiveScanningText", void 0);
3069
+ __decorate([
3070
+ nameForSerialization('validationScanningText')
3071
+ ], LabelCaptureValidationFlowSettings.prototype, "_scanningText", void 0);
2711
3072
  __decorate([
2712
3073
  ignoreFromSerialization
2713
3074
  ], LabelCaptureValidationFlowSettings.prototype, "_labelDefinitionsPlaceholders", void 0);
2714
3075
 
3076
+ var LabelResultUpdateType;
3077
+ (function (LabelResultUpdateType) {
3078
+ LabelResultUpdateType["AsyncFinished"] = "AsyncFinished";
3079
+ LabelResultUpdateType["AsyncStarted"] = "AsyncStarted";
3080
+ LabelResultUpdateType["Sync"] = "Sync";
3081
+ })(LabelResultUpdateType || (LabelResultUpdateType = {}));
3082
+
2715
3083
  var LabelCaptureAdaptiveRecognitionListenerEvents;
2716
3084
  (function (LabelCaptureAdaptiveRecognitionListenerEvents) {
2717
3085
  LabelCaptureAdaptiveRecognitionListenerEvents["recognized"] = "LabelCaptureAdaptiveRecognitionListener.recognized";
@@ -2797,7 +3165,14 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
2797
3165
  }
2798
3166
  handleRecognized(ev) {
2799
3167
  var _a;
2800
- const payload = JSON.parse(ev.data);
3168
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
3169
+ if (payload === SKIP) {
3170
+ return;
3171
+ }
3172
+ if (payload === null) {
3173
+ console.error('LabelCaptureAdaptiveRecognitionOverlayController recognized payload is null');
3174
+ return;
3175
+ }
2801
3176
  (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didRecognize(payload.result);
2802
3177
  }
2803
3178
  handleFailure() {
@@ -2905,5 +3280,5 @@ function registerLabelProxies(provider) {
2905
3280
  registerProxies(LABEL_PROXY_TYPE_NAMES, provider);
2906
3281
  }
2907
3282
 
2908
- export { AdaptiveRecognitionResult, AdaptiveRecognitionResultType, BarcodeField, CapturedLabel, CustomBarcode, CustomText, ExpiryDateText, ImeiOneBarcode, ImeiTwoBarcode, LABEL_PROXY_TYPE_NAMES, LabelCapture, LabelCaptureAdaptiveRecognitionListenerEvents, LabelCaptureAdaptiveRecognitionOverlay, LabelCaptureAdaptiveRecognitionOverlayController, LabelCaptureAdaptiveRecognitionSettings, LabelCaptureAdvancedOverlay, LabelCaptureAdvancedOverlayController, LabelCaptureAdvancedOverlayListenerEvents, LabelCaptureBasicOverlay, LabelCaptureBasicOverlayController, LabelCaptureBasicOverlayListenerEvents, LabelCaptureController, LabelCaptureFeedback, LabelCaptureListenerEvents, LabelCaptureSession, LabelCaptureSettings, LabelCaptureValidationFlowListenerEvents, LabelCaptureValidationFlowOverlay, LabelCaptureValidationFlowOverlayController, LabelCaptureValidationFlowSettings, LabelDateComponentFormat, LabelDateFormat, LabelDateResult, LabelDefinition, LabelField, LabelFieldDefinition, LabelFieldLocation, LabelFieldLocationType, LabelFieldState, LabelFieldType, PackingDateText, PartNumberBarcode, ReceiptScanningLineItem, ReceiptScanningResult, SerialNumberBarcode, TextField, TotalPriceText, UnitPriceText, WeightText, ensureLabelCaptureDefaults, getLabelCaptureDefaults, loadLabelCaptureDefaults, registerLabelProxies, setLabelCaptureDefaultsLoader };
3283
+ export { AdaptiveRecognitionMode, AdaptiveRecognitionResult, AdaptiveRecognitionResultType, BarcodeField, CapturedLabel, CustomBarcode, CustomText, DateText, ExpiryDateText, ImeiOneBarcode, ImeiTwoBarcode, LABEL_PROXY_TYPE_NAMES, LabelCapture, LabelCaptureAdaptiveRecognitionListenerEvents, LabelCaptureAdaptiveRecognitionOverlay, LabelCaptureAdaptiveRecognitionOverlayController, LabelCaptureAdaptiveRecognitionSettings, LabelCaptureAdvancedOverlay, LabelCaptureAdvancedOverlayController, LabelCaptureAdvancedOverlayListenerEvents, LabelCaptureBasicOverlay, LabelCaptureBasicOverlayController, LabelCaptureBasicOverlayListenerEvents, LabelCaptureController, LabelCaptureFeedback, LabelCaptureListenerEvents, LabelCaptureSession, LabelCaptureSettings, LabelCaptureValidationFlowListenerEvents, LabelCaptureValidationFlowOverlay, LabelCaptureValidationFlowOverlayController, LabelCaptureValidationFlowSettings, LabelDateComponentFormat, LabelDateFormat, LabelDateResult, LabelDefinition, LabelField, LabelFieldDefinition, LabelFieldLocation, LabelFieldLocationType, LabelFieldState, LabelFieldType, LabelFieldValueType, LabelResultUpdateType, PackingDateText, PartNumberBarcode, ReceiptScanningLineItem, ReceiptScanningResult, SerialNumberBarcode, TextField, TotalPriceText, UnitPriceText, WeightText, ensureLabelCaptureDefaults, getLabelCaptureDefaults, loadLabelCaptureDefaults, registerLabelProxies, setLabelCaptureDefaultsLoader };
2909
3284
  //# sourceMappingURL=index.js.map