scandit-datacapture-frameworks-label 8.2.1 → 8.3.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.
Files changed (33) 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/LabelCaptureSession.d.ts +2 -0
  11. package/dist/dts/labelcapture/LabelCaptureValidationFlowListener.d.ts +4 -1
  12. package/dist/dts/labelcapture/LabelCaptureValidationFlowSettings.d.ts +16 -1
  13. package/dist/dts/labelcapture/LabelDefinition.d.ts +6 -0
  14. package/dist/dts/labelcapture/LabelField.d.ts +3 -0
  15. package/dist/dts/labelcapture/LabelFieldDefinition.d.ts +4 -0
  16. package/dist/dts/labelcapture/LabelFieldValueType.d.ts +7 -0
  17. package/dist/dts/labelcapture/LabelResultUpdateType.d.ts +5 -0
  18. package/dist/dts/labelcapture/PackingDateText.d.ts +2 -0
  19. package/dist/dts/labelcapture/PartNumberBarcode.d.ts +2 -0
  20. package/dist/dts/labelcapture/SerialNumberBarcode.d.ts +2 -0
  21. package/dist/dts/labelcapture/TotalPriceText.d.ts +2 -0
  22. package/dist/dts/labelcapture/UnitPriceText.d.ts +2 -0
  23. package/dist/dts/labelcapture/WeightText.d.ts +2 -0
  24. package/dist/dts/labelcapture/controller/LabelCaptureController.d.ts +4 -4
  25. package/dist/dts/labelcapture/controller/LabelCaptureValidationFlowOverlayController.d.ts +9 -1
  26. package/dist/dts/labelcapture/index.d.ts +4 -0
  27. package/dist/dts/labelcapture/private/PrivateLabelField.d.ts +1 -0
  28. package/dist/dts/labelcapture/view/LabelCaptureValidationFlowOverlay.d.ts +3 -0
  29. package/dist/index.js +402 -21
  30. package/dist/index.js.map +1 -1
  31. package/package.json +5 -5
  32. package/test/LabelCaptureValidationFlowOverlayController.test.ts +40 -26
  33. 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, FrameDataController, 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,11 +636,15 @@ class LabelCaptureSession {
532
636
  get frameSequenceID() {
533
637
  return this._frameSequenceID;
534
638
  }
639
+ get lastProcessedFrameId() {
640
+ return this._lastProcessedFrameId;
641
+ }
535
642
  static fromJSON(payload) {
536
643
  var _a;
537
644
  const sessionJson = JSON.parse(payload.session);
538
645
  const session = new LabelCaptureSession();
539
646
  session._frameSequenceID = sessionJson.frameSequenceId;
647
+ session._lastProcessedFrameId = sessionJson.lastFrameId;
540
648
  session.frameId = (_a = payload.frameId) !== null && _a !== void 0 ? _a : '';
541
649
  session._capturedLabels = sessionJson.labels
542
650
  .map(CapturedLabel.fromJSON);
@@ -1030,6 +1138,19 @@ class LabelProxyAdapter {
1030
1138
  return result;
1031
1139
  });
1032
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
+ }
1033
1154
  }
1034
1155
 
1035
1156
  var LabelCaptureListenerEvents;
@@ -1072,7 +1193,10 @@ class LabelCaptureController extends BaseController {
1072
1193
  });
1073
1194
  }
1074
1195
  updateFeedback(feedback) {
1075
- 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
+ });
1076
1200
  }
1077
1201
  dispose() {
1078
1202
  void this.unsubscribeLabelCaptureListener();
@@ -1087,10 +1211,20 @@ class LabelCaptureController extends BaseController {
1087
1211
  }
1088
1212
  handleDidUpdateSessionEvent(ev) {
1089
1213
  return __awaiter(this, void 0, void 0, function* () {
1090
- const payload = JSON.parse(ev.data);
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
+ }
1091
1222
  const session = LabelCaptureSession.fromJSON(payload);
1092
- this.notifyListenersOfDidUpdateSession(session);
1093
- yield this.adapter.finishLabelCaptureListenerDidUpdateSession({ modeId: this.modeId, isEnabled: this.mode.isEnabled });
1223
+ yield this.notifyListenersOfDidUpdateSession(session);
1224
+ yield this.adapter.finishLabelCaptureListenerDidUpdateSession({
1225
+ modeId: this.modeId,
1226
+ isEnabled: this.mode.isEnabled,
1227
+ });
1094
1228
  });
1095
1229
  }
1096
1230
  get modeId() {
@@ -1101,7 +1235,7 @@ class LabelCaptureController extends BaseController {
1101
1235
  const mode = this.mode;
1102
1236
  for (const listener of mode.listeners) {
1103
1237
  if (listener.didUpdateSession) {
1104
- yield listener.didUpdateSession(this.mode, session, () => this.frameDataController.getFrameOrNull(session['frameId']));
1238
+ yield listener.didUpdateSession(this.mode, session, () => this.frameDataController.getFrame(session['frameId']));
1105
1239
  }
1106
1240
  }
1107
1241
  });
@@ -1410,7 +1544,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1410
1544
  }
1411
1545
  handleViewForLabel(ev) {
1412
1546
  return __awaiter(this, void 0, void 0, function* () {
1413
- 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
+ }
1414
1555
  let view = null;
1415
1556
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
1416
1557
  if (this.overlay.listener && this.overlay.listener.viewForCapturedLabel) {
@@ -1421,7 +1562,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1421
1562
  }
1422
1563
  handleAnchorForLabel(ev) {
1423
1564
  return __awaiter(this, void 0, void 0, function* () {
1424
- 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
+ }
1425
1573
  let anchor = Anchor.Center;
1426
1574
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
1427
1575
  if (this.overlay.listener && this.overlay.listener.anchorForCapturedLabel) {
@@ -1432,7 +1580,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1432
1580
  }
1433
1581
  handleViewForCapturedLabelField(ev) {
1434
1582
  return __awaiter(this, void 0, void 0, function* () {
1435
- 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
+ }
1436
1591
  let view = null;
1437
1592
  const field = LabelField.fromJSON(JSON.parse(payload.field));
1438
1593
  if (this.overlay.listener && this.overlay.listener.viewForCapturedLabelField) {
@@ -1443,7 +1598,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1443
1598
  }
1444
1599
  handleOffsetForLabel(ev) {
1445
1600
  return __awaiter(this, void 0, void 0, function* () {
1446
- 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
+ }
1447
1609
  let offset = PointWithUnit.zero;
1448
1610
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
1449
1611
  if (this.overlay.listener && this.overlay.listener.offsetForCapturedLabel) {
@@ -1454,7 +1616,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1454
1616
  }
1455
1617
  handleAnchorForCapturedLabelField(ev) {
1456
1618
  return __awaiter(this, void 0, void 0, function* () {
1457
- 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
+ }
1458
1627
  let anchor = Anchor.Center;
1459
1628
  const field = LabelField.fromJSON(JSON.parse(payload.field));
1460
1629
  if (this.overlay.listener && this.overlay.listener.anchorForCapturedLabelField) {
@@ -1465,7 +1634,14 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
1465
1634
  }
1466
1635
  handleOffsetForCapturedLabelField(ev) {
1467
1636
  return __awaiter(this, void 0, void 0, function* () {
1468
- 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
+ }
1469
1645
  let offset = PointWithUnit.zero;
1470
1646
  const field = LabelField.fromJSON(JSON.parse(payload.field));
1471
1647
  if (this.overlay.listener && this.overlay.listener.offsetForCapturedLabelField) {
@@ -1663,6 +1839,18 @@ class LabelDefinition extends DefaultSerializeable {
1663
1839
  set fields(values) {
1664
1840
  this._fields = values;
1665
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
+ }
1666
1854
  get hiddenProperties() {
1667
1855
  return this._hiddenProperties;
1668
1856
  }
@@ -1706,6 +1894,7 @@ class LabelDefinition extends DefaultSerializeable {
1706
1894
  this._name = '';
1707
1895
  this._fields = [];
1708
1896
  this._type = null;
1897
+ this._adaptiveRecognitionMode = AdaptiveRecognitionMode.Off;
1709
1898
  this._hiddenProperties = {};
1710
1899
  this._name = name;
1711
1900
  }
@@ -1720,6 +1909,9 @@ __decorate([
1720
1909
  nameForSerialization('type'),
1721
1910
  ignoreFromSerializationIfNull
1722
1911
  ], LabelDefinition.prototype, "_type", void 0);
1912
+ __decorate([
1913
+ nameForSerialization('adaptiveRecognitionMode')
1914
+ ], LabelDefinition.prototype, "_adaptiveRecognitionMode", void 0);
1723
1915
  __decorate([
1724
1916
  ignoreFromSerialization
1725
1917
  ], LabelDefinition.prototype, "_hiddenProperties", void 0);
@@ -1827,6 +2019,15 @@ var LabelFieldType;
1827
2019
  LabelFieldType["Unknown"] = "unknown";
1828
2020
  })(LabelFieldType || (LabelFieldType = {}));
1829
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
+
1830
2031
  class PackingDateText extends TextField {
1831
2032
  constructor(name) {
1832
2033
  super(name);
@@ -1856,6 +2057,12 @@ class PackingDateText extends TextField {
1856
2057
  set valueRegexes(value) {
1857
2058
  super.valueRegexes = value;
1858
2059
  }
2060
+ get numberOfMandatoryInstances() {
2061
+ return super.numberOfMandatoryInstances;
2062
+ }
2063
+ set numberOfMandatoryInstances(value) {
2064
+ super.numberOfMandatoryInstances = value;
2065
+ }
1859
2066
  }
1860
2067
  __decorate([
1861
2068
  nameForSerialization('fieldType')
@@ -1904,6 +2111,12 @@ class PartNumberBarcode extends BarcodeField {
1904
2111
  get symbologies() {
1905
2112
  return super.symbologySettings;
1906
2113
  }
2114
+ get numberOfMandatoryInstances() {
2115
+ return super.numberOfMandatoryInstances;
2116
+ }
2117
+ set numberOfMandatoryInstances(value) {
2118
+ super.numberOfMandatoryInstances = value;
2119
+ }
1907
2120
  }
1908
2121
  __decorate([
1909
2122
  nameForSerialization('fieldType')
@@ -2064,6 +2277,12 @@ class SerialNumberBarcode extends BarcodeField {
2064
2277
  get symbologies() {
2065
2278
  return super.symbologySettings;
2066
2279
  }
2280
+ get numberOfMandatoryInstances() {
2281
+ return super.numberOfMandatoryInstances;
2282
+ }
2283
+ set numberOfMandatoryInstances(value) {
2284
+ super.numberOfMandatoryInstances = value;
2285
+ }
2067
2286
  }
2068
2287
  __decorate([
2069
2288
  nameForSerialization('fieldType')
@@ -2094,6 +2313,12 @@ class TotalPriceText extends TextField {
2094
2313
  set valueRegexes(value) {
2095
2314
  super.valueRegexes = value;
2096
2315
  }
2316
+ get numberOfMandatoryInstances() {
2317
+ return super.numberOfMandatoryInstances;
2318
+ }
2319
+ set numberOfMandatoryInstances(value) {
2320
+ super.numberOfMandatoryInstances = value;
2321
+ }
2097
2322
  }
2098
2323
  __decorate([
2099
2324
  nameForSerialization('fieldType')
@@ -2127,6 +2352,12 @@ class UnitPriceText extends TextField {
2127
2352
  set valueRegexes(value) {
2128
2353
  super.valueRegexes = value;
2129
2354
  }
2355
+ get numberOfMandatoryInstances() {
2356
+ return super.numberOfMandatoryInstances;
2357
+ }
2358
+ set numberOfMandatoryInstances(value) {
2359
+ super.numberOfMandatoryInstances = value;
2360
+ }
2130
2361
  }
2131
2362
  __decorate([
2132
2363
  nameForSerialization('fieldType')
@@ -2160,6 +2391,12 @@ class WeightText extends TextField {
2160
2391
  set valueRegexes(value) {
2161
2392
  super.valueRegexes = value;
2162
2393
  }
2394
+ get numberOfMandatoryInstances() {
2395
+ return super.numberOfMandatoryInstances;
2396
+ }
2397
+ set numberOfMandatoryInstances(value) {
2398
+ super.numberOfMandatoryInstances = value;
2399
+ }
2163
2400
  }
2164
2401
  __decorate([
2165
2402
  nameForSerialization('fieldType')
@@ -2265,7 +2502,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
2265
2502
  }
2266
2503
  handleBrushForFieldOfLabel(ev) {
2267
2504
  return __awaiter(this, void 0, void 0, function* () {
2268
- 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
+ }
2269
2513
  let brush = this.overlay.capturedFieldBrush;
2270
2514
  const field = LabelField.fromJSON(JSON.parse(payload.field));
2271
2515
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
@@ -2277,7 +2521,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
2277
2521
  }
2278
2522
  handleBrushForLabel(ev) {
2279
2523
  return __awaiter(this, void 0, void 0, function* () {
2280
- 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
+ }
2281
2532
  let brush = this.overlay.labelBrush;
2282
2533
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
2283
2534
  if (this.overlay.listener && this.overlay.listener.brushForLabel) {
@@ -2287,7 +2538,14 @@ class LabelCaptureBasicOverlayController extends BaseController {
2287
2538
  });
2288
2539
  }
2289
2540
  handleDidTapLabel(ev) {
2290
- 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
+ }
2291
2549
  if (this.overlay.listener && this.overlay.listener.didTapLabel) {
2292
2550
  const label = CapturedLabel.fromJSON(JSON.parse(payload.label));
2293
2551
  this.overlay.listener.didTapLabel(this.overlay, label);
@@ -2441,6 +2699,7 @@ var LabelCaptureValidationFlowListenerEvents;
2441
2699
  (function (LabelCaptureValidationFlowListenerEvents) {
2442
2700
  LabelCaptureValidationFlowListenerEvents["didCaptureLabelWithFields"] = "LabelCaptureValidationFlowListener.didCaptureLabelWithFields";
2443
2701
  LabelCaptureValidationFlowListenerEvents["didSubmitManualInputForField"] = "LabelCaptureValidationFlowListener.didSubmitManualInputForField";
2702
+ LabelCaptureValidationFlowListenerEvents["didUpdateValidationFlowResult"] = "LabelCaptureValidationFlowListener.didUpdateValidationFlowResult";
2444
2703
  })(LabelCaptureValidationFlowListenerEvents || (LabelCaptureValidationFlowListenerEvents = {}));
2445
2704
  class LabelCaptureValidationFlowOverlayController extends BaseController {
2446
2705
  constructor(overlay) {
@@ -2454,13 +2713,20 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2454
2713
  this.handleDidSubmitManualInputForFieldEventWrapper = (ev) => {
2455
2714
  this.handleDidSubmitManualInputForFieldEvent(ev);
2456
2715
  };
2716
+ this.handleDidUpdateValidationFlowResultEventWrapper = (ev) => __awaiter(this, void 0, void 0, function* () {
2717
+ yield this.handleDidUpdateValidationFlowResult(ev);
2718
+ });
2457
2719
  this.overlay = overlay;
2458
2720
  this.adapter = new LabelProxyAdapter(this._proxy);
2721
+ this.frameDataController = new FrameDataController();
2459
2722
  void this.initialize();
2460
2723
  }
2461
2724
  updateValidationFlowOverlay() {
2462
2725
  return __awaiter(this, void 0, void 0, function* () {
2463
- 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
+ });
2464
2730
  });
2465
2731
  }
2466
2732
  subscribeLabelCaptureValidationFlowListener() {
@@ -2471,6 +2737,7 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2471
2737
  this._proxy.subscribeForEvents(Object.values(LabelCaptureValidationFlowListenerEvents));
2472
2738
  this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didCaptureLabelWithFields, this.handleDidCaptureLabelWithFieldsEventWrapper);
2473
2739
  this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didSubmitManualInputForField, this.handleDidSubmitManualInputForFieldEventWrapper);
2740
+ this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didUpdateValidationFlowResult, this.handleDidUpdateValidationFlowResultEventWrapper);
2474
2741
  this.isSubscribed = true;
2475
2742
  if (this.dataCaptureViewId !== -1) {
2476
2743
  yield this.adapter.registerListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
@@ -2515,15 +2782,53 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2515
2782
  });
2516
2783
  }
2517
2784
  handleDidCaptureLabelWithFieldsEvent(ev) {
2518
- const payload = JSON.parse(ev.data);
2519
- 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)));
2520
2796
  this.notifyListenersOfDidCaptureLabelWithFields(fields);
2521
2797
  }
2522
2798
  handleDidSubmitManualInputForFieldEvent(ev) {
2523
- 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
+ }
2524
2809
  const field = LabelField.fromJSON(JSON.parse(payload.fields[0]));
2525
2810
  this.notifyListenersOfDidSubmitManualInputForField(field, payload.oldValue, payload.newValue);
2526
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
+ }
2527
2832
  notifyListenersOfDidCaptureLabelWithFields(fields) {
2528
2833
  var _a;
2529
2834
  (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didCaptureLabelWithFields(fields);
@@ -2539,6 +2844,14 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
2539
2844
  }
2540
2845
 
2541
2846
  class LabelCaptureValidationFlowOverlay extends DefaultSerializeable {
2847
+ get shouldHandleKeyboardInsetsInternally() {
2848
+ return this._shouldHandleKeyboardInsetsInternally;
2849
+ }
2850
+ set shouldHandleKeyboardInsetsInternally(value) {
2851
+ var _a;
2852
+ this._shouldHandleKeyboardInsetsInternally = value;
2853
+ void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateValidationFlowOverlay());
2854
+ }
2542
2855
  get view() {
2543
2856
  return this._view;
2544
2857
  }
@@ -2565,6 +2878,7 @@ class LabelCaptureValidationFlowOverlay extends DefaultSerializeable {
2565
2878
  this._listener = null;
2566
2879
  this.controller = null;
2567
2880
  this._view = null;
2881
+ this._shouldHandleKeyboardInsetsInternally = true;
2568
2882
  this.modeId = mode.modeId;
2569
2883
  }
2570
2884
  get listener() {
@@ -2599,6 +2913,9 @@ __decorate([
2599
2913
  __decorate([
2600
2914
  ignoreFromSerialization
2601
2915
  ], LabelCaptureValidationFlowOverlay.prototype, "_view", void 0);
2916
+ __decorate([
2917
+ nameForSerialization('shouldHandleKeyboardInsetsInternally')
2918
+ ], LabelCaptureValidationFlowOverlay.prototype, "_shouldHandleKeyboardInsetsInternally", void 0);
2602
2919
 
2603
2920
  class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
2604
2921
  static create() {
@@ -2614,6 +2931,11 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
2614
2931
  this._validationErrorText = defaults.validationErrorText;
2615
2932
  this._requiredFieldErrorText = defaults.requiredFieldErrorText;
2616
2933
  this._manualInputButtonText = defaults.manualInputButtonText;
2934
+ this._finishButtonText = defaults.validationFinishButtonText;
2935
+ this._restartButtonText = defaults.validationRestartButtonText;
2936
+ this._pauseButtonText = defaults.validationPauseButtonText;
2937
+ this._adaptiveScanningText = defaults.validationAdaptiveScanningText;
2938
+ this._scanningText = defaults.validationScanningText;
2617
2939
  }
2618
2940
  /**
2619
2941
  * @deprecated This property is deprecated and will be removed in a future release.
@@ -2672,6 +2994,36 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
2672
2994
  console.warn('manualInputButtonText is deprecated and will be removed in a future release.');
2673
2995
  this._manualInputButtonText = text;
2674
2996
  }
2997
+ get finishButtonText() {
2998
+ return this._finishButtonText;
2999
+ }
3000
+ set finishButtonText(text) {
3001
+ this._finishButtonText = text;
3002
+ }
3003
+ get restartButtonText() {
3004
+ return this._restartButtonText;
3005
+ }
3006
+ set restartButtonText(text) {
3007
+ this._restartButtonText = text;
3008
+ }
3009
+ get pauseButtonText() {
3010
+ return this._pauseButtonText;
3011
+ }
3012
+ set pauseButtonText(text) {
3013
+ this._pauseButtonText = text;
3014
+ }
3015
+ get adaptiveScanningText() {
3016
+ return this._adaptiveScanningText;
3017
+ }
3018
+ set adaptiveScanningText(text) {
3019
+ this._adaptiveScanningText = text;
3020
+ }
3021
+ get scanningText() {
3022
+ return this._scanningText;
3023
+ }
3024
+ set scanningText(text) {
3025
+ this._scanningText = text;
3026
+ }
2675
3027
  setPlaceholderTextForLabelDefinition(fieldName, placeholder) {
2676
3028
  if (placeholder === null) {
2677
3029
  this._labelDefinitionsPlaceholders.delete(fieldName);
@@ -2714,10 +3066,32 @@ __decorate([
2714
3066
  __decorate([
2715
3067
  nameForSerialization('manualInputButtonText')
2716
3068
  ], LabelCaptureValidationFlowSettings.prototype, "_manualInputButtonText", void 0);
3069
+ __decorate([
3070
+ nameForSerialization('validationFinishButtonText')
3071
+ ], LabelCaptureValidationFlowSettings.prototype, "_finishButtonText", void 0);
3072
+ __decorate([
3073
+ nameForSerialization('validationRestartButtonText')
3074
+ ], LabelCaptureValidationFlowSettings.prototype, "_restartButtonText", void 0);
3075
+ __decorate([
3076
+ nameForSerialization('validationPauseButtonText')
3077
+ ], LabelCaptureValidationFlowSettings.prototype, "_pauseButtonText", void 0);
3078
+ __decorate([
3079
+ nameForSerialization('validationAdaptiveScanningText')
3080
+ ], LabelCaptureValidationFlowSettings.prototype, "_adaptiveScanningText", void 0);
3081
+ __decorate([
3082
+ nameForSerialization('validationScanningText')
3083
+ ], LabelCaptureValidationFlowSettings.prototype, "_scanningText", void 0);
2717
3084
  __decorate([
2718
3085
  ignoreFromSerialization
2719
3086
  ], LabelCaptureValidationFlowSettings.prototype, "_labelDefinitionsPlaceholders", void 0);
2720
3087
 
3088
+ var LabelResultUpdateType;
3089
+ (function (LabelResultUpdateType) {
3090
+ LabelResultUpdateType["AsyncFinished"] = "AsyncFinished";
3091
+ LabelResultUpdateType["AsyncStarted"] = "AsyncStarted";
3092
+ LabelResultUpdateType["Sync"] = "Sync";
3093
+ })(LabelResultUpdateType || (LabelResultUpdateType = {}));
3094
+
2721
3095
  var LabelCaptureAdaptiveRecognitionListenerEvents;
2722
3096
  (function (LabelCaptureAdaptiveRecognitionListenerEvents) {
2723
3097
  LabelCaptureAdaptiveRecognitionListenerEvents["recognized"] = "LabelCaptureAdaptiveRecognitionListener.recognized";
@@ -2803,7 +3177,14 @@ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
2803
3177
  }
2804
3178
  handleRecognized(ev) {
2805
3179
  var _a;
2806
- const payload = JSON.parse(ev.data);
3180
+ const payload = EventDataParser.parseIfShouldHandle(ev, { viewId: this.dataCaptureViewId });
3181
+ if (payload === SKIP) {
3182
+ return;
3183
+ }
3184
+ if (payload === null) {
3185
+ console.error('LabelCaptureAdaptiveRecognitionOverlayController recognized payload is null');
3186
+ return;
3187
+ }
2807
3188
  (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didRecognize(payload.result);
2808
3189
  }
2809
3190
  handleFailure() {
@@ -2911,5 +3292,5 @@ function registerLabelProxies(provider) {
2911
3292
  registerProxies(LABEL_PROXY_TYPE_NAMES, provider);
2912
3293
  }
2913
3294
 
2914
- 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 };
3295
+ 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 };
2915
3296
  //# sourceMappingURL=index.js.map