scandit-datacapture-frameworks-label 8.1.1 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/__mocks__/ScanditDataCaptureCore.ts +94 -0
  2. package/dist/dts/defaults/LabelCaptureDefaults.d.ts +2 -0
  3. package/dist/dts/defaults/index.d.ts +1 -1
  4. package/dist/dts/generated/LabelProxy.d.ts +30 -0
  5. package/dist/dts/generated/LabelProxyAdapter.d.ts +256 -0
  6. package/dist/dts/generated/index.d.ts +6 -0
  7. package/dist/dts/labelcapture/AdaptiveRecognitionResult.d.ts +4 -0
  8. package/dist/dts/labelcapture/AdaptiveRecognitionResultType.d.ts +3 -0
  9. package/dist/dts/labelcapture/CustomBarcode.d.ts +5 -0
  10. package/dist/dts/labelcapture/CustomText.d.ts +4 -0
  11. package/dist/dts/labelcapture/ExpiryDateText.d.ts +4 -0
  12. package/dist/dts/labelcapture/ImeiOneBarcode.d.ts +5 -0
  13. package/dist/dts/labelcapture/ImeiTwoBarcode.d.ts +5 -0
  14. package/dist/dts/labelcapture/LabelCaptureAdaptiveRecognitionSettings.d.ts +11 -0
  15. package/dist/dts/labelcapture/LabelCaptureListener.d.ts +1 -2
  16. package/dist/dts/labelcapture/LabelCaptureSession.d.ts +0 -1
  17. package/dist/dts/labelcapture/LabelCaptureValidationFlowListener.d.ts +1 -0
  18. package/dist/dts/labelcapture/LabelCaptureValidationFlowSettings.d.ts +22 -0
  19. package/dist/dts/labelcapture/PackingDateText.d.ts +4 -0
  20. package/dist/dts/labelcapture/PartNumberBarcode.d.ts +5 -0
  21. package/dist/dts/labelcapture/ReceiptScanningLineItem.d.ts +13 -0
  22. package/dist/dts/labelcapture/ReceiptScanningResult.d.ts +27 -0
  23. package/dist/dts/labelcapture/SerialNumberBarcode.d.ts +5 -0
  24. package/dist/dts/labelcapture/TotalPriceText.d.ts +4 -0
  25. package/dist/dts/labelcapture/UnitPriceText.d.ts +4 -0
  26. package/dist/dts/labelcapture/WeightText.d.ts +4 -0
  27. package/dist/dts/labelcapture/controller/LabelCaptureAdaptiveRecognitionOverlayController.d.ts +29 -0
  28. package/dist/dts/labelcapture/controller/LabelCaptureAdvancedOverlayController.d.ts +7 -47
  29. package/dist/dts/labelcapture/controller/LabelCaptureBasicOverlayController.d.ts +7 -25
  30. package/dist/dts/labelcapture/controller/LabelCaptureController.d.ts +7 -25
  31. package/dist/dts/labelcapture/controller/LabelCaptureValidationFlowOverlayController.d.ts +13 -15
  32. package/dist/dts/labelcapture/index.d.ts +8 -0
  33. package/dist/dts/labelcapture/private/PrivateLabelCaptureSession.d.ts +1 -6
  34. package/dist/dts/labelcapture/view/LabelCaptureAdaptiveRecognitionListener.d.ts +5 -0
  35. package/dist/dts/labelcapture/view/LabelCaptureAdaptiveRecognitionOverlay.d.ts +20 -0
  36. package/dist/dts/labelcapture/view/LabelCaptureAdvancedOverlay.d.ts +1 -0
  37. package/dist/dts/labelcapture/view/LabelCaptureBasicOverlay.d.ts +2 -1
  38. package/dist/dts/labelcapture/view/LabelCaptureValidationFlowOverlay.d.ts +1 -0
  39. package/dist/dts/proxy-types.d.ts +1 -1
  40. package/dist/index.js +1152 -54
  41. package/dist/index.js.map +1 -1
  42. package/jest.config.js +38 -0
  43. package/package.json +3 -3
  44. package/test/AdaptiveRecognitionResultType.test.ts +19 -0
  45. package/test/LabelCaptureAdaptiveRecognitionSettings.test.ts +115 -0
  46. package/test/LabelCaptureValidationFlowOverlayController.test.ts +427 -0
  47. package/test/LabelCaptureValidationFlowSettings.test.ts +120 -0
  48. package/test/ReceiptScanningLineItem.test.ts +99 -0
  49. package/test/ReceiptScanningResult.test.ts +247 -0
package/dist/index.js CHANGED
@@ -1,12 +1,29 @@
1
- import { FactoryMaker, Feedback, Brush, CameraSettings, nameForSerialization, DefaultSerializeable, ignoreFromSerialization, ignoreFromSerializationIfNull, Quadrilateral, BaseController, CameraController, 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, 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
+ let labelDefaultsLoader;
5
+ function setLabelCaptureDefaultsLoader(loader) {
6
+ labelDefaultsLoader = loader;
7
+ }
8
+ function ensureLabelCaptureDefaults() {
9
+ var _a, _b;
10
+ const existing = (_a = FactoryMaker.instances.get('LabelCaptureDefaults')) === null || _a === void 0 ? void 0 : _a.instance;
11
+ if (existing) {
12
+ return existing;
13
+ }
14
+ labelDefaultsLoader === null || labelDefaultsLoader === void 0 ? void 0 : labelDefaultsLoader();
15
+ const reloaded = (_b = FactoryMaker.instances.get('LabelCaptureDefaults')) === null || _b === void 0 ? void 0 : _b.instance;
16
+ if (reloaded) {
17
+ return reloaded;
18
+ }
19
+ throw new Error('LabelCaptureDefaults missing and re-init failed');
20
+ }
4
21
  function loadLabelCaptureDefaults(jsonDefaults) {
5
22
  const defaults = parseLabelCaptureDefaults(jsonDefaults);
6
23
  FactoryMaker.bindInstanceIfNotExists('LabelCaptureDefaults', defaults);
7
24
  }
8
25
  function getLabelCaptureDefaults() {
9
- return FactoryMaker.getInstance('LabelCaptureDefaults');
26
+ return ensureLabelCaptureDefaults();
10
27
  }
11
28
  function parseLabelCaptureDefaults(jsonDefaults) {
12
29
  return {
@@ -35,6 +52,17 @@ function parseLabelCaptureDefaults(jsonDefaults) {
35
52
  };
36
53
  }
37
54
 
55
+ var AdaptiveRecognitionResultType;
56
+ (function (AdaptiveRecognitionResultType) {
57
+ AdaptiveRecognitionResultType["Receipt"] = "receipt";
58
+ })(AdaptiveRecognitionResultType || (AdaptiveRecognitionResultType = {}));
59
+
60
+ class AdaptiveRecognitionResult {
61
+ get resultType() {
62
+ return AdaptiveRecognitionResultType.Receipt;
63
+ }
64
+ }
65
+
38
66
  /******************************************************************************
39
67
  Copyright (c) Microsoft Corporation.
40
68
 
@@ -304,6 +332,21 @@ class CustomBarcode extends BarcodeField {
304
332
  static get barcodeDefaults() {
305
333
  return getBarcodeDefaults();
306
334
  }
335
+ get name() {
336
+ return super.name;
337
+ }
338
+ get valueRegexes() {
339
+ return super.valueRegexes;
340
+ }
341
+ set valueRegexes(value) {
342
+ super.valueRegexes = value;
343
+ }
344
+ get isOptional() {
345
+ return super.optional;
346
+ }
347
+ get symbologies() {
348
+ return super.symbologySettings;
349
+ }
307
350
  }
308
351
  __decorate([
309
352
  nameForSerialization('location')
@@ -332,6 +375,18 @@ class CustomText extends TextField {
332
375
  set anchorRegexes(value) {
333
376
  this._anchorRegexes = value;
334
377
  }
378
+ get name() {
379
+ return super.name;
380
+ }
381
+ get valueRegexes() {
382
+ return super.valueRegexes;
383
+ }
384
+ set valueRegexes(value) {
385
+ super.valueRegexes = value;
386
+ }
387
+ get isOptional() {
388
+ return super.optional;
389
+ }
335
390
  }
336
391
  __decorate([
337
392
  nameForSerialization('location')
@@ -363,6 +418,18 @@ class ExpiryDateText extends TextField {
363
418
  set anchorRegexes(value) {
364
419
  this._anchorRegexes = value;
365
420
  }
421
+ get name() {
422
+ return super.name;
423
+ }
424
+ get valueRegexes() {
425
+ return super.valueRegexes;
426
+ }
427
+ set valueRegexes(value) {
428
+ super.valueRegexes = value;
429
+ }
430
+ get isOptional() {
431
+ return super.optional;
432
+ }
366
433
  }
367
434
  __decorate([
368
435
  nameForSerialization('fieldType')
@@ -392,6 +459,21 @@ class ImeiOneBarcode extends BarcodeField {
392
459
  static get barcodeDefaults() {
393
460
  return getBarcodeDefaults();
394
461
  }
462
+ get name() {
463
+ return super.name;
464
+ }
465
+ get valueRegexes() {
466
+ return super.valueRegexes;
467
+ }
468
+ set valueRegexes(value) {
469
+ super.valueRegexes = value;
470
+ }
471
+ get isOptional() {
472
+ return super.optional;
473
+ }
474
+ get symbologies() {
475
+ return super.symbologySettings;
476
+ }
395
477
  constructor(name, symbologies) {
396
478
  super(name, symbologies);
397
479
  this._fieldType = 'imeiOneBarcode';
@@ -419,6 +501,21 @@ class ImeiTwoBarcode extends BarcodeField {
419
501
  static get barcodeDefaults() {
420
502
  return getBarcodeDefaults();
421
503
  }
504
+ get name() {
505
+ return super.name;
506
+ }
507
+ get valueRegexes() {
508
+ return super.valueRegexes;
509
+ }
510
+ set valueRegexes(value) {
511
+ super.valueRegexes = value;
512
+ }
513
+ get isOptional() {
514
+ return super.optional;
515
+ }
516
+ get symbologies() {
517
+ return super.symbologySettings;
518
+ }
422
519
  constructor(name, symbologies) {
423
520
  super(name, symbologies);
424
521
  this._fieldType = 'imeiTwoBarcode';
@@ -435,13 +532,10 @@ class LabelCaptureSession {
435
532
  get frameSequenceID() {
436
533
  return this._frameSequenceID;
437
534
  }
438
- static fromJSON(payload) {
439
- var _a;
440
- const sessionJson = JSON.parse(payload.session);
535
+ static fromJSON(json) {
441
536
  const session = new LabelCaptureSession();
442
- session._frameSequenceID = sessionJson.frameSequenceId;
443
- session.frameId = (_a = payload.frameId) !== null && _a !== void 0 ? _a : '';
444
- session._capturedLabels = sessionJson.labels
537
+ session._frameSequenceID = json.frameSequenceId;
538
+ session._capturedLabels = json.labels
445
539
  .map(CapturedLabel.fromJSON);
446
540
  session._capturedLabels
447
541
  .forEach(label => label.frameSequenceID = session._frameSequenceID);
@@ -449,6 +543,492 @@ class LabelCaptureSession {
449
543
  }
450
544
  }
451
545
 
546
+ /*
547
+ * This file is part of the Scandit Data Capture SDK
548
+ *
549
+ * Copyright (C) 2026- Scandit AG. All rights reserved.
550
+ */
551
+ /**
552
+ * Adapter class for Label operations.
553
+ * Provides typed methods that internally call $executeLabel.
554
+ * Generated from schema definition to ensure parameter and method name consistency.
555
+ */
556
+ class LabelProxyAdapter {
557
+ constructor(proxy) {
558
+ this.proxy = proxy;
559
+ }
560
+ /**
561
+ * Finish callback for label capture did update session event
562
+ * @param modeId Unique identifier of the label capture mode
563
+ * @param isEnabled Whether the mode is enabled
564
+ */
565
+ finishLabelCaptureListenerDidUpdateSession(_a) {
566
+ return __awaiter(this, arguments, void 0, function* ({ modeId, isEnabled, }) {
567
+ const result = yield this.proxy.$executeLabel({
568
+ moduleName: 'LabelCaptureModule',
569
+ methodName: 'finishLabelCaptureListenerDidUpdateSession',
570
+ isEventRegistration: false,
571
+ modeId,
572
+ isEnabled,
573
+ });
574
+ return result;
575
+ });
576
+ }
577
+ /**
578
+ * Register persistent event listener for label capture events
579
+ * @param modeId Unique identifier of the label capture mode
580
+ */
581
+ addLabelCaptureListener(_a) {
582
+ return __awaiter(this, arguments, void 0, function* ({ modeId }) {
583
+ const result = yield this.proxy.$executeLabel({
584
+ moduleName: 'LabelCaptureModule',
585
+ methodName: 'addLabelCaptureListener',
586
+ isEventRegistration: true,
587
+ modeId,
588
+ });
589
+ return result;
590
+ });
591
+ }
592
+ /**
593
+ * Unregister event listener for label capture events
594
+ * @param modeId Unique identifier of the label capture mode
595
+ */
596
+ removeLabelCaptureListener(_a) {
597
+ return __awaiter(this, arguments, void 0, function* ({ modeId }) {
598
+ const result = yield this.proxy.$executeLabel({
599
+ moduleName: 'LabelCaptureModule',
600
+ methodName: 'removeLabelCaptureListener',
601
+ isEventRegistration: false,
602
+ modeId,
603
+ });
604
+ return result;
605
+ });
606
+ }
607
+ /**
608
+ * Sets the enabled state of the label capture mode
609
+ * @param modeId Unique identifier of the label capture mode
610
+ * @param isEnabled Whether the mode is enabled
611
+ */
612
+ setLabelCaptureModeEnabledState(_a) {
613
+ return __awaiter(this, arguments, void 0, function* ({ modeId, isEnabled, }) {
614
+ const result = yield this.proxy.$executeLabel({
615
+ moduleName: 'LabelCaptureModule',
616
+ methodName: 'setLabelCaptureModeEnabledState',
617
+ isEventRegistration: false,
618
+ modeId,
619
+ isEnabled,
620
+ });
621
+ return result;
622
+ });
623
+ }
624
+ /**
625
+ * Updates the label capture mode configuration
626
+ * @param modeJson Label capture mode configuration as JSON string
627
+ */
628
+ updateLabelCaptureMode(_a) {
629
+ return __awaiter(this, arguments, void 0, function* ({ modeJson }) {
630
+ const result = yield this.proxy.$executeLabel({
631
+ moduleName: 'LabelCaptureModule',
632
+ methodName: 'updateLabelCaptureMode',
633
+ isEventRegistration: false,
634
+ modeJson,
635
+ });
636
+ return result;
637
+ });
638
+ }
639
+ /**
640
+ * Updates the label capture mode settings
641
+ * @param modeId Unique identifier of the label capture mode
642
+ * @param settingsJson Label capture mode settings as JSON string
643
+ */
644
+ updateLabelCaptureSettings(_a) {
645
+ return __awaiter(this, arguments, void 0, function* ({ modeId, settingsJson, }) {
646
+ const result = yield this.proxy.$executeLabel({
647
+ moduleName: 'LabelCaptureModule',
648
+ methodName: 'updateLabelCaptureSettings',
649
+ isEventRegistration: false,
650
+ modeId,
651
+ settingsJson,
652
+ });
653
+ return result;
654
+ });
655
+ }
656
+ /**
657
+ * Updates the label capture feedback configuration
658
+ * @param modeId Unique identifier of the label capture mode
659
+ * @param feedbackJson Label capture feedback configuration as JSON string
660
+ */
661
+ updateLabelCaptureFeedback(_a) {
662
+ return __awaiter(this, arguments, void 0, function* ({ modeId, feedbackJson, }) {
663
+ const result = yield this.proxy.$executeLabel({
664
+ moduleName: 'LabelCaptureModule',
665
+ methodName: 'updateLabelCaptureFeedback',
666
+ isEventRegistration: false,
667
+ modeId,
668
+ feedbackJson,
669
+ });
670
+ return result;
671
+ });
672
+ }
673
+ /**
674
+ * Sets the view for a captured label in advanced overlay
675
+ * @param dataCaptureViewId Unique identifier of the data capture view
676
+ * @param viewJson View configuration as JSON string, or null
677
+ * @param trackingId Tracking identifier of the captured label
678
+ */
679
+ setViewForCapturedLabel(_a) {
680
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, viewJson, trackingId, }) {
681
+ const result = yield this.proxy.$executeLabel({
682
+ moduleName: 'LabelCaptureModule',
683
+ methodName: 'setViewForCapturedLabel',
684
+ isEventRegistration: false,
685
+ dataCaptureViewId,
686
+ viewJson,
687
+ trackingId,
688
+ });
689
+ return result;
690
+ });
691
+ }
692
+ /**
693
+ * Sets the view for a captured label field in advanced overlay
694
+ * @param dataCaptureViewId Unique identifier of the data capture view
695
+ * @param identifier Unique identifier of the captured label field
696
+ * @param viewJson View configuration as JSON string, or null
697
+ */
698
+ setViewForCapturedLabelField(_a) {
699
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, identifier, viewJson, }) {
700
+ const result = yield this.proxy.$executeLabel({
701
+ moduleName: 'LabelCaptureModule',
702
+ methodName: 'setViewForCapturedLabelField',
703
+ isEventRegistration: false,
704
+ dataCaptureViewId,
705
+ identifier,
706
+ viewJson,
707
+ });
708
+ return result;
709
+ });
710
+ }
711
+ /**
712
+ * Sets the anchor for a captured label in advanced overlay
713
+ * @param dataCaptureViewId Unique identifier of the data capture view
714
+ * @param anchorJson Anchor configuration as JSON string
715
+ * @param trackingId Tracking identifier of the captured label
716
+ */
717
+ setAnchorForCapturedLabel(_a) {
718
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, anchorJson, trackingId, }) {
719
+ const result = yield this.proxy.$executeLabel({
720
+ moduleName: 'LabelCaptureModule',
721
+ methodName: 'setAnchorForCapturedLabel',
722
+ isEventRegistration: false,
723
+ dataCaptureViewId,
724
+ anchorJson,
725
+ trackingId,
726
+ });
727
+ return result;
728
+ });
729
+ }
730
+ /**
731
+ * Sets the anchor for a captured label field in advanced overlay
732
+ * @param dataCaptureViewId Unique identifier of the data capture view
733
+ * @param anchorJson Anchor configuration as JSON string
734
+ * @param identifier Unique identifier of the captured label field
735
+ */
736
+ setAnchorForCapturedLabelField(_a) {
737
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, anchorJson, identifier, }) {
738
+ const result = yield this.proxy.$executeLabel({
739
+ moduleName: 'LabelCaptureModule',
740
+ methodName: 'setAnchorForCapturedLabelField',
741
+ isEventRegistration: false,
742
+ dataCaptureViewId,
743
+ anchorJson,
744
+ identifier,
745
+ });
746
+ return result;
747
+ });
748
+ }
749
+ /**
750
+ * Sets the offset for a captured label in advanced overlay
751
+ * @param dataCaptureViewId Unique identifier of the data capture view
752
+ * @param offsetJson Offset configuration as JSON string
753
+ * @param trackingId Tracking identifier of the captured label
754
+ */
755
+ setOffsetForCapturedLabel(_a) {
756
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, offsetJson, trackingId, }) {
757
+ const result = yield this.proxy.$executeLabel({
758
+ moduleName: 'LabelCaptureModule',
759
+ methodName: 'setOffsetForCapturedLabel',
760
+ isEventRegistration: false,
761
+ dataCaptureViewId,
762
+ offsetJson,
763
+ trackingId,
764
+ });
765
+ return result;
766
+ });
767
+ }
768
+ /**
769
+ * Sets the offset for a captured label field in advanced overlay
770
+ * @param dataCaptureViewId Unique identifier of the data capture view
771
+ * @param offsetJson Offset configuration as JSON string
772
+ * @param identifier Unique identifier of the captured label field
773
+ */
774
+ setOffsetForCapturedLabelField(_a) {
775
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, offsetJson, identifier, }) {
776
+ const result = yield this.proxy.$executeLabel({
777
+ moduleName: 'LabelCaptureModule',
778
+ methodName: 'setOffsetForCapturedLabelField',
779
+ isEventRegistration: false,
780
+ dataCaptureViewId,
781
+ offsetJson,
782
+ identifier,
783
+ });
784
+ return result;
785
+ });
786
+ }
787
+ /**
788
+ * Clears all views for captured labels in advanced overlay
789
+ * @param dataCaptureViewId Unique identifier of the data capture view
790
+ */
791
+ clearCapturedLabelViews(_a) {
792
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId }) {
793
+ const result = yield this.proxy.$executeLabel({
794
+ moduleName: 'LabelCaptureModule',
795
+ methodName: 'clearCapturedLabelViews',
796
+ isEventRegistration: false,
797
+ dataCaptureViewId,
798
+ });
799
+ return result;
800
+ });
801
+ }
802
+ /**
803
+ * Register persistent event listener for label capture basic overlay events
804
+ * @param dataCaptureViewId Unique identifier of the data capture view
805
+ */
806
+ addLabelCaptureBasicOverlayListener(_a) {
807
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
808
+ const result = yield this.proxy.$executeLabel({
809
+ moduleName: 'LabelCaptureModule',
810
+ methodName: 'addLabelCaptureBasicOverlayListener',
811
+ isEventRegistration: true,
812
+ dataCaptureViewId,
813
+ });
814
+ return result;
815
+ });
816
+ }
817
+ /**
818
+ * Unregister event listener for label capture basic overlay events
819
+ * @param dataCaptureViewId Unique identifier of the data capture view
820
+ */
821
+ removeLabelCaptureBasicOverlayListener(_a) {
822
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
823
+ const result = yield this.proxy.$executeLabel({
824
+ moduleName: 'LabelCaptureModule',
825
+ methodName: 'removeLabelCaptureBasicOverlayListener',
826
+ isEventRegistration: false,
827
+ dataCaptureViewId,
828
+ });
829
+ return result;
830
+ });
831
+ }
832
+ /**
833
+ * Updates the label capture basic overlay configuration
834
+ * @param dataCaptureViewId Unique identifier of the data capture view
835
+ * @param basicOverlayJson Label capture basic overlay configuration as JSON string
836
+ */
837
+ updateLabelCaptureBasicOverlay(_a) {
838
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, basicOverlayJson, }) {
839
+ const result = yield this.proxy.$executeLabel({
840
+ moduleName: 'LabelCaptureModule',
841
+ methodName: 'updateLabelCaptureBasicOverlay',
842
+ isEventRegistration: false,
843
+ dataCaptureViewId,
844
+ basicOverlayJson,
845
+ });
846
+ return result;
847
+ });
848
+ }
849
+ /**
850
+ * Sets the brush for a captured label in basic overlay
851
+ * @param dataCaptureViewId Unique identifier of the data capture view
852
+ * @param brushJson Brush configuration as JSON string, or null
853
+ * @param trackingId Tracking identifier of the captured label
854
+ */
855
+ setLabelCaptureBasicOverlayBrushForLabel(_a) {
856
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, brushJson, trackingId, }) {
857
+ const result = yield this.proxy.$executeLabel({
858
+ moduleName: 'LabelCaptureModule',
859
+ methodName: 'setLabelCaptureBasicOverlayBrushForLabel',
860
+ isEventRegistration: false,
861
+ dataCaptureViewId,
862
+ brushJson,
863
+ trackingId,
864
+ });
865
+ return result;
866
+ });
867
+ }
868
+ /**
869
+ * Sets the brush for a captured label field in basic overlay
870
+ * @param dataCaptureViewId Unique identifier of the data capture view
871
+ * @param brushJson Brush configuration as JSON string, or null
872
+ * @param fieldName Name of the label field
873
+ * @param trackingId Tracking identifier of the captured label
874
+ */
875
+ setLabelCaptureBasicOverlayBrushForFieldOfLabel(_a) {
876
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, brushJson, fieldName, trackingId, }) {
877
+ const result = yield this.proxy.$executeLabel({
878
+ moduleName: 'LabelCaptureModule',
879
+ methodName: 'setLabelCaptureBasicOverlayBrushForFieldOfLabel',
880
+ isEventRegistration: false,
881
+ dataCaptureViewId,
882
+ brushJson,
883
+ fieldName,
884
+ trackingId,
885
+ });
886
+ return result;
887
+ });
888
+ }
889
+ /**
890
+ * Register persistent event listener for label capture advanced overlay events
891
+ * @param dataCaptureViewId Unique identifier of the data capture view
892
+ */
893
+ addLabelCaptureAdvancedOverlayListener(_a) {
894
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
895
+ const result = yield this.proxy.$executeLabel({
896
+ moduleName: 'LabelCaptureModule',
897
+ methodName: 'addLabelCaptureAdvancedOverlayListener',
898
+ isEventRegistration: true,
899
+ dataCaptureViewId,
900
+ });
901
+ return result;
902
+ });
903
+ }
904
+ /**
905
+ * Unregister event listener for label capture advanced overlay events
906
+ * @param dataCaptureViewId Unique identifier of the data capture view
907
+ */
908
+ removeLabelCaptureAdvancedOverlayListener(_a) {
909
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
910
+ const result = yield this.proxy.$executeLabel({
911
+ moduleName: 'LabelCaptureModule',
912
+ methodName: 'removeLabelCaptureAdvancedOverlayListener',
913
+ isEventRegistration: false,
914
+ dataCaptureViewId,
915
+ });
916
+ return result;
917
+ });
918
+ }
919
+ /**
920
+ * Updates the label capture advanced overlay configuration
921
+ * @param dataCaptureViewId Unique identifier of the data capture view
922
+ * @param advancedOverlayJson Label capture advanced overlay configuration as JSON string
923
+ */
924
+ updateLabelCaptureAdvancedOverlay(_a) {
925
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, advancedOverlayJson, }) {
926
+ const result = yield this.proxy.$executeLabel({
927
+ moduleName: 'LabelCaptureModule',
928
+ methodName: 'updateLabelCaptureAdvancedOverlay',
929
+ isEventRegistration: false,
930
+ dataCaptureViewId,
931
+ advancedOverlayJson,
932
+ });
933
+ return result;
934
+ });
935
+ }
936
+ /**
937
+ * Register persistent event listener for label capture validation flow overlay events
938
+ * @param dataCaptureViewId Unique identifier of the data capture view
939
+ */
940
+ registerListenerForValidationFlowEvents(_a) {
941
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
942
+ const result = yield this.proxy.$executeLabel({
943
+ moduleName: 'LabelCaptureModule',
944
+ methodName: 'registerListenerForValidationFlowEvents',
945
+ isEventRegistration: true,
946
+ dataCaptureViewId,
947
+ });
948
+ return result;
949
+ });
950
+ }
951
+ /**
952
+ * Unregister event listener for label capture validation flow overlay events
953
+ * @param dataCaptureViewId Unique identifier of the data capture view
954
+ */
955
+ unregisterListenerForValidationFlowEvents(_a) {
956
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
957
+ const result = yield this.proxy.$executeLabel({
958
+ moduleName: 'LabelCaptureModule',
959
+ methodName: 'unregisterListenerForValidationFlowEvents',
960
+ isEventRegistration: false,
961
+ dataCaptureViewId,
962
+ });
963
+ return result;
964
+ });
965
+ }
966
+ /**
967
+ * Updates the label capture validation flow overlay configuration
968
+ * @param dataCaptureViewId Unique identifier of the data capture view
969
+ * @param overlayJson Label capture validation flow overlay configuration as JSON string
970
+ */
971
+ updateLabelCaptureValidationFlowOverlay(_a) {
972
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, overlayJson, }) {
973
+ const result = yield this.proxy.$executeLabel({
974
+ moduleName: 'LabelCaptureModule',
975
+ methodName: 'updateLabelCaptureValidationFlowOverlay',
976
+ isEventRegistration: false,
977
+ dataCaptureViewId,
978
+ overlayJson,
979
+ });
980
+ return result;
981
+ });
982
+ }
983
+ /**
984
+ * Register persistent event listener for label capture adaptive recognition overlay events
985
+ * @param dataCaptureViewId Unique identifier of the data capture view
986
+ */
987
+ registerListenerForAdaptiveRecognitionOverlayEvents(_a) {
988
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
989
+ const result = yield this.proxy.$executeLabel({
990
+ moduleName: 'LabelCaptureModule',
991
+ methodName: 'registerListenerForAdaptiveRecognitionOverlayEvents',
992
+ isEventRegistration: true,
993
+ dataCaptureViewId,
994
+ });
995
+ return result;
996
+ });
997
+ }
998
+ /**
999
+ * Unregister event listener for label capture adaptive recognition overlay events
1000
+ * @param dataCaptureViewId Unique identifier of the data capture view
1001
+ */
1002
+ unregisterListenerForAdaptiveRecognitionOverlayEvents(_a) {
1003
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, }) {
1004
+ const result = yield this.proxy.$executeLabel({
1005
+ moduleName: 'LabelCaptureModule',
1006
+ methodName: 'unregisterListenerForAdaptiveRecognitionOverlayEvents',
1007
+ isEventRegistration: false,
1008
+ dataCaptureViewId,
1009
+ });
1010
+ return result;
1011
+ });
1012
+ }
1013
+ /**
1014
+ * Applies adaptive recognition settings to the label capture overlay
1015
+ * @param dataCaptureViewId Unique identifier of the data capture view
1016
+ * @param overlayJson Label capture adaptive recognition overlay configuration as JSON string
1017
+ */
1018
+ applyLabelCaptureAdaptiveRecognitionSettings(_a) {
1019
+ return __awaiter(this, arguments, void 0, function* ({ dataCaptureViewId, overlayJson, }) {
1020
+ const result = yield this.proxy.$executeLabel({
1021
+ moduleName: 'LabelCaptureModule',
1022
+ methodName: 'applyLabelCaptureAdaptiveRecognitionSettings',
1023
+ isEventRegistration: false,
1024
+ dataCaptureViewId,
1025
+ overlayJson,
1026
+ });
1027
+ return result;
1028
+ });
1029
+ }
1030
+ }
1031
+
452
1032
  var LabelCaptureListenerEvents;
453
1033
  (function (LabelCaptureListenerEvents) {
454
1034
  LabelCaptureListenerEvents["didUpdateSession"] = "LabelCaptureListener.didUpdateSession";
@@ -457,20 +1037,21 @@ class LabelCaptureController extends BaseController {
457
1037
  constructor(mode) {
458
1038
  super('LabelCaptureProxy');
459
1039
  this.mode = mode;
1040
+ this.adapter = new LabelProxyAdapter(this._proxy);
460
1041
  this.initialize().catch(error => console.error('Failed to initialize LabelCaptureController:', error));
461
1042
  }
462
1043
  setModeEnabledState(isEnabled) {
463
- return this._proxy.$setModeEnabledState({ modeId: this.modeId, isEnabled });
1044
+ return this.adapter.setLabelCaptureModeEnabledState({ modeId: this.modeId, isEnabled });
464
1045
  }
465
1046
  updateLabelCaptureSettings(settingsJson) {
466
- return this._proxy.$updateLabelCaptureSettings({ modeId: this.modeId, settingsJson });
1047
+ return this.adapter.updateLabelCaptureSettings({ modeId: this.modeId, settingsJson });
467
1048
  }
468
1049
  subscribeLabelCaptureListener() {
469
1050
  return __awaiter(this, void 0, void 0, function* () {
470
1051
  if (this._boundHandleDidUpdateSession) {
471
1052
  return;
472
1053
  }
473
- yield this._proxy.$registerListenerForEvents({ modeId: this.modeId });
1054
+ yield this.adapter.addLabelCaptureListener({ modeId: this.modeId });
474
1055
  this._boundHandleDidUpdateSession = this.handleDidUpdateSessionEvent.bind(this);
475
1056
  this._proxy.subscribeForEvents(Object.values(LabelCaptureListenerEvents));
476
1057
  this._proxy.eventEmitter.on(LabelCaptureListenerEvents.didUpdateSession, this._boundHandleDidUpdateSession);
@@ -478,7 +1059,7 @@ class LabelCaptureController extends BaseController {
478
1059
  }
479
1060
  unsubscribeLabelCaptureListener() {
480
1061
  return __awaiter(this, void 0, void 0, function* () {
481
- yield this._proxy.$unregisterListenerForEvents({ modeId: this.modeId });
1062
+ yield this.adapter.removeLabelCaptureListener({ modeId: this.modeId });
482
1063
  this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureListenerEvents));
483
1064
  if (this._boundHandleDidUpdateSession) {
484
1065
  this._proxy.eventEmitter.off(LabelCaptureListenerEvents.didUpdateSession, this._boundHandleDidUpdateSession);
@@ -487,7 +1068,7 @@ class LabelCaptureController extends BaseController {
487
1068
  });
488
1069
  }
489
1070
  updateFeedback(feedback) {
490
- return this._proxy.$updateLabelCaptureFeedback({ modeId: this.modeId, feedbackJson: JSON.stringify(feedback.toJSON()) });
1071
+ return this.adapter.updateLabelCaptureFeedback({ modeId: this.modeId, feedbackJson: JSON.stringify(feedback.toJSON()) });
491
1072
  }
492
1073
  dispose() {
493
1074
  void this.unsubscribeLabelCaptureListener();
@@ -503,21 +1084,19 @@ class LabelCaptureController extends BaseController {
503
1084
  handleDidUpdateSessionEvent(ev) {
504
1085
  return __awaiter(this, void 0, void 0, function* () {
505
1086
  const payload = JSON.parse(ev.data);
506
- const session = LabelCaptureSession.fromJSON(payload);
507
- yield this.notifyListenersOfDidUpdateSession(session);
508
- yield this._proxy.$finishDidUpdateSessionCallback({ modeId: this.modeId, isEnabled: this.mode.isEnabled });
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 });
509
1090
  });
510
1091
  }
511
1092
  get modeId() {
512
1093
  return this.mode.modeId;
513
1094
  }
514
1095
  notifyListenersOfDidUpdateSession(session) {
515
- return __awaiter(this, void 0, void 0, function* () {
516
- const mode = this.mode;
517
- for (const listener of mode.listeners) {
518
- if (listener.didUpdateSession) {
519
- yield listener.didUpdateSession(this.mode, session, () => CameraController.getFrameOrNull(session['frameId']));
520
- }
1096
+ const mode = this.mode;
1097
+ mode.listeners.forEach(listener => {
1098
+ if (listener.didUpdateSession) {
1099
+ listener.didUpdateSession(this.mode, session);
521
1100
  }
522
1101
  });
523
1102
  }
@@ -674,6 +1253,8 @@ var LabelCaptureAdvancedOverlayListenerEvents;
674
1253
  class LabelCaptureAdvancedOverlayController extends BaseController {
675
1254
  constructor(overlay) {
676
1255
  super('LabelCaptureAdvancedOverlayProxy');
1256
+ this.hasListeners = false;
1257
+ this.hasPendingListenerRegistration = false;
677
1258
  // Arrow function wrappers to avoid .bind(this) and always use current class state
678
1259
  this.handleViewForLabelWrapper = (ev) => __awaiter(this, void 0, void 0, function* () {
679
1260
  return this.handleViewForLabel(ev);
@@ -694,27 +1275,28 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
694
1275
  return this.handleOffsetForCapturedLabelField(ev);
695
1276
  });
696
1277
  this.overlay = overlay;
1278
+ this.adapter = new LabelProxyAdapter(this._proxy);
697
1279
  void this.initialize();
698
1280
  }
699
1281
  setViewForCapturedLabel(label, view) {
700
1282
  return __awaiter(this, void 0, void 0, function* () {
701
1283
  const awitedView = yield view;
702
- return this._proxy.$setViewForCapturedLabel({
703
- jsonView: awitedView ? JSON.stringify(awitedView.toJSON()) : null,
1284
+ return this.adapter.setViewForCapturedLabel({
1285
+ viewJson: awitedView ? JSON.stringify(awitedView.toJSON()) : null,
704
1286
  trackingId: label.trackingID,
705
1287
  dataCaptureViewId: this.dataCaptureViewId
706
1288
  });
707
1289
  });
708
1290
  }
709
1291
  setAnchorForCapturedLabel(label, anchor) {
710
- return this._proxy.$setAnchorForCapturedLabel({
711
- anchor: anchor,
1292
+ return this.adapter.setAnchorForCapturedLabel({
1293
+ anchorJson: anchor,
712
1294
  trackingId: label.trackingID,
713
1295
  dataCaptureViewId: this.dataCaptureViewId
714
1296
  });
715
1297
  }
716
1298
  setOffsetForCapturedLabel(label, offset) {
717
- return this._proxy.$setOffsetForCapturedLabel({
1299
+ return this.adapter.setOffsetForCapturedLabel({
718
1300
  offsetJson: JSON.stringify(offset.toJSON()),
719
1301
  trackingId: label.trackingID,
720
1302
  dataCaptureViewId: this.dataCaptureViewId
@@ -733,12 +1315,12 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
733
1315
  return this.setOffsetForCapturedLabelFieldPrivate(identifier, offset);
734
1316
  }
735
1317
  clearCapturedLabelViews() {
736
- return this._proxy.$clearCapturedLabelViews({ dataCaptureViewId: this.dataCaptureViewId });
1318
+ return this.adapter.clearCapturedLabelViews({ dataCaptureViewId: this.dataCaptureViewId });
737
1319
  }
738
1320
  subscribeListener() {
739
1321
  return __awaiter(this, void 0, void 0, function* () {
740
- if (this.dataCaptureViewId !== -1) {
741
- yield this._proxy.$registerListenerForAdvancedOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
1322
+ if (this.hasListeners) {
1323
+ return;
742
1324
  }
743
1325
  this._proxy.subscribeForEvents(Object.values(LabelCaptureAdvancedOverlayListenerEvents));
744
1326
  this._proxy.eventEmitter.on(LabelCaptureAdvancedOverlayListenerEvents.viewForLabel, this.handleViewForLabelWrapper);
@@ -747,11 +1329,31 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
747
1329
  this._proxy.eventEmitter.on(LabelCaptureAdvancedOverlayListenerEvents.viewForCapturedLabelField, this.handleViewForCapturedLabelFieldWrapper);
748
1330
  this._proxy.eventEmitter.on(LabelCaptureAdvancedOverlayListenerEvents.anchorForCapturedLabelField, this.handleAnchorForCapturedLabelFieldWrapper);
749
1331
  this._proxy.eventEmitter.on(LabelCaptureAdvancedOverlayListenerEvents.offsetForCapturedLabelField, this.handleOffsetForCapturedLabelFieldWrapper);
1332
+ this.hasListeners = true;
1333
+ if (this.dataCaptureViewId !== -1) {
1334
+ yield this.adapter.addLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
1335
+ }
1336
+ else {
1337
+ this.hasPendingListenerRegistration = true;
1338
+ }
1339
+ });
1340
+ }
1341
+ onViewChanged() {
1342
+ return __awaiter(this, void 0, void 0, function* () {
1343
+ if (this.hasPendingListenerRegistration && this.dataCaptureViewId !== -1) {
1344
+ this.hasPendingListenerRegistration = false;
1345
+ yield this.adapter.addLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
1346
+ }
750
1347
  });
751
1348
  }
752
1349
  unsubscribeListener() {
753
1350
  return __awaiter(this, void 0, void 0, function* () {
754
- yield this._proxy.$unregisterListenerForAdvancedOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
1351
+ if (!this.hasListeners) {
1352
+ return;
1353
+ }
1354
+ if (this.dataCaptureViewId !== -1) {
1355
+ yield this.adapter.removeLabelCaptureAdvancedOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
1356
+ }
755
1357
  this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureAdvancedOverlayListenerEvents));
756
1358
  this._proxy.eventEmitter.off(LabelCaptureAdvancedOverlayListenerEvents.viewForLabel, this.handleViewForLabelWrapper);
757
1359
  this._proxy.eventEmitter.off(LabelCaptureAdvancedOverlayListenerEvents.anchorForLabel, this.handleAnchorForLabelWrapper);
@@ -759,14 +1361,15 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
759
1361
  this._proxy.eventEmitter.off(LabelCaptureAdvancedOverlayListenerEvents.viewForCapturedLabelField, this.handleViewForCapturedLabelFieldWrapper);
760
1362
  this._proxy.eventEmitter.off(LabelCaptureAdvancedOverlayListenerEvents.anchorForCapturedLabelField, this.handleAnchorForCapturedLabelFieldWrapper);
761
1363
  this._proxy.eventEmitter.off(LabelCaptureAdvancedOverlayListenerEvents.offsetForCapturedLabelField, this.handleOffsetForCapturedLabelFieldWrapper);
1364
+ this.hasListeners = false;
1365
+ this.hasPendingListenerRegistration = false;
762
1366
  });
763
1367
  }
764
1368
  dispose() {
765
1369
  void this.unsubscribeListener();
766
- this._proxy.dispose();
767
1370
  }
768
1371
  updateAdvancedOverlay(advancedOverlayJson) {
769
- return this._proxy.$updateLabelCaptureAdvancedOverlay({ dataCaptureViewId: this.dataCaptureViewId, advancedOverlayJson });
1372
+ return this.adapter.updateLabelCaptureAdvancedOverlay({ dataCaptureViewId: this.dataCaptureViewId, advancedOverlayJson });
770
1373
  }
771
1374
  initialize() {
772
1375
  return __awaiter(this, void 0, void 0, function* () {
@@ -778,23 +1381,23 @@ class LabelCaptureAdvancedOverlayController extends BaseController {
778
1381
  setViewForCapturedLabelFieldPrivate(identifier, view) {
779
1382
  return __awaiter(this, void 0, void 0, function* () {
780
1383
  const awitedView = yield view;
781
- return this._proxy.$setViewForCapturedLabelField({
782
- view: awitedView ? JSON.stringify(awitedView.toJSON()) : null,
1384
+ return this.adapter.setViewForCapturedLabelField({
1385
+ viewJson: awitedView ? JSON.stringify(awitedView.toJSON()) : null,
783
1386
  identifier: identifier,
784
1387
  dataCaptureViewId: this.dataCaptureViewId
785
1388
  });
786
1389
  });
787
1390
  }
788
1391
  setAnchorForCapturedLabelFieldPrivate(identifier, anchor) {
789
- return this._proxy.$setAnchorForCapturedLabelField({
790
- anchor: anchor,
1392
+ return this.adapter.setAnchorForCapturedLabelField({
1393
+ anchorJson: anchor,
791
1394
  identifier: identifier,
792
1395
  dataCaptureViewId: this.dataCaptureViewId
793
1396
  });
794
1397
  }
795
1398
  setOffsetForCapturedLabelFieldPrivate(identifier, offset) {
796
- return this._proxy.$setOffsetForCapturedLabelField({
797
- offset: JSON.stringify(offset.toJSON()),
1399
+ return this.adapter.setOffsetForCapturedLabelField({
1400
+ offsetJson: JSON.stringify(offset.toJSON()),
798
1401
  identifier: identifier,
799
1402
  dataCaptureViewId: this.dataCaptureViewId
800
1403
  });
@@ -886,6 +1489,10 @@ class LabelCaptureAdvancedOverlay extends DefaultSerializeable {
886
1489
  this._view = newView;
887
1490
  (_b = this.controller) !== null && _b !== void 0 ? _b : (this.controller = new LabelCaptureAdvancedOverlayController(this));
888
1491
  }
1492
+ onViewIdChanged() {
1493
+ var _a;
1494
+ void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.onViewChanged());
1495
+ }
889
1496
  get shouldShowScanAreaGuides() {
890
1497
  return this._shouldShowScanAreaGuides;
891
1498
  }
@@ -1231,6 +1838,18 @@ class PackingDateText extends TextField {
1231
1838
  set labelDateFormat(value) {
1232
1839
  this._labelDateFormat = value;
1233
1840
  }
1841
+ get isOptional() {
1842
+ return super.optional;
1843
+ }
1844
+ get name() {
1845
+ return super.name;
1846
+ }
1847
+ get valueRegexes() {
1848
+ return super.valueRegexes;
1849
+ }
1850
+ set valueRegexes(value) {
1851
+ super.valueRegexes = value;
1852
+ }
1234
1853
  }
1235
1854
  __decorate([
1236
1855
  nameForSerialization('fieldType')
@@ -1264,11 +1883,144 @@ class PartNumberBarcode extends BarcodeField {
1264
1883
  super(name, symbologies);
1265
1884
  this._fieldType = 'partNumberBarcode';
1266
1885
  }
1886
+ get isOptional() {
1887
+ return super.optional;
1888
+ }
1889
+ get name() {
1890
+ return super.name;
1891
+ }
1892
+ get valueRegexes() {
1893
+ return super.valueRegexes;
1894
+ }
1895
+ set valueRegexes(value) {
1896
+ super.valueRegexes = value;
1897
+ }
1898
+ get symbologies() {
1899
+ return super.symbologySettings;
1900
+ }
1267
1901
  }
1268
1902
  __decorate([
1269
1903
  nameForSerialization('fieldType')
1270
1904
  ], PartNumberBarcode.prototype, "_fieldType", void 0);
1271
1905
 
1906
+ class ReceiptScanningLineItem {
1907
+ constructor(name, unitPrice, discount, quantity, totalPrice) {
1908
+ this._name = name;
1909
+ this._unitPrice = unitPrice;
1910
+ this._discount = discount;
1911
+ this._quantity = quantity;
1912
+ this._totalPrice = totalPrice;
1913
+ }
1914
+ get name() {
1915
+ return this._name;
1916
+ }
1917
+ get unitPrice() {
1918
+ return this._unitPrice;
1919
+ }
1920
+ get discount() {
1921
+ return this._discount;
1922
+ }
1923
+ get quantity() {
1924
+ return this._quantity;
1925
+ }
1926
+ get totalPrice() {
1927
+ return this._totalPrice;
1928
+ }
1929
+ }
1930
+ __decorate([
1931
+ nameForSerialization("name")
1932
+ ], ReceiptScanningLineItem.prototype, "_name", void 0);
1933
+ __decorate([
1934
+ nameForSerialization("unitPrice")
1935
+ ], ReceiptScanningLineItem.prototype, "_unitPrice", void 0);
1936
+ __decorate([
1937
+ nameForSerialization("discount")
1938
+ ], ReceiptScanningLineItem.prototype, "_discount", void 0);
1939
+ __decorate([
1940
+ nameForSerialization("quantity")
1941
+ ], ReceiptScanningLineItem.prototype, "_quantity", void 0);
1942
+ __decorate([
1943
+ nameForSerialization("totalPrice")
1944
+ ], ReceiptScanningLineItem.prototype, "_totalPrice", void 0);
1945
+
1946
+ class ReceiptScanningResult {
1947
+ constructor(date, lineItems, loyaltyNumber, paymentPreTaxTotal, paymentTax, paymentTotal, storeAddress, storeCity, storeName, time) {
1948
+ this._date = date;
1949
+ this._lineItems = lineItems;
1950
+ this._loyaltyNumber = loyaltyNumber;
1951
+ this._paymentPreTaxTotal = paymentPreTaxTotal;
1952
+ this._paymentTax = paymentTax;
1953
+ this._paymentTotal = paymentTotal;
1954
+ this._storeAddress = storeAddress;
1955
+ this._storeCity = storeCity;
1956
+ this._storeName = storeName;
1957
+ this._time = time;
1958
+ }
1959
+ get resultType() {
1960
+ return AdaptiveRecognitionResultType.Receipt;
1961
+ }
1962
+ get date() {
1963
+ return this._date;
1964
+ }
1965
+ get lineItems() {
1966
+ return this._lineItems;
1967
+ }
1968
+ get loyaltyNumber() {
1969
+ return this._loyaltyNumber;
1970
+ }
1971
+ get paymentPreTaxTotal() {
1972
+ return this._paymentPreTaxTotal;
1973
+ }
1974
+ get paymentTax() {
1975
+ return this._paymentTax;
1976
+ }
1977
+ get paymentTotal() {
1978
+ return this._paymentTotal;
1979
+ }
1980
+ get storeAddress() {
1981
+ return this._storeAddress;
1982
+ }
1983
+ get storeCity() {
1984
+ return this._storeCity;
1985
+ }
1986
+ get storeName() {
1987
+ return this._storeName;
1988
+ }
1989
+ get time() {
1990
+ return this._time;
1991
+ }
1992
+ }
1993
+ __decorate([
1994
+ nameForSerialization("date")
1995
+ ], ReceiptScanningResult.prototype, "_date", void 0);
1996
+ __decorate([
1997
+ nameForSerialization("lineItems")
1998
+ ], ReceiptScanningResult.prototype, "_lineItems", void 0);
1999
+ __decorate([
2000
+ nameForSerialization("loyaltyNumber")
2001
+ ], ReceiptScanningResult.prototype, "_loyaltyNumber", void 0);
2002
+ __decorate([
2003
+ nameForSerialization("paymentPreTaxTotal")
2004
+ ], ReceiptScanningResult.prototype, "_paymentPreTaxTotal", void 0);
2005
+ __decorate([
2006
+ nameForSerialization("paymentTax")
2007
+ ], ReceiptScanningResult.prototype, "_paymentTax", void 0);
2008
+ __decorate([
2009
+ nameForSerialization("paymentTotal")
2010
+ ], ReceiptScanningResult.prototype, "_paymentTotal", void 0);
2011
+ __decorate([
2012
+ nameForSerialization("storeAddress")
2013
+ ], ReceiptScanningResult.prototype, "_storeAddress", void 0);
2014
+ __decorate([
2015
+ nameForSerialization("storeCity")
2016
+ ], ReceiptScanningResult.prototype, "_storeCity", void 0);
2017
+ __decorate([
2018
+ nameForSerialization("storeName")
2019
+ ], ReceiptScanningResult.prototype, "_storeName", void 0);
2020
+ __decorate([
2021
+ nameForSerialization("time")
2022
+ ], ReceiptScanningResult.prototype, "_time", void 0);
2023
+
1272
2024
  class SerialNumberBarcode extends BarcodeField {
1273
2025
  static initWithNameAndSymbologySettings(name, symbologySettings) {
1274
2026
  return new SerialNumberBarcode(name, symbologySettings);
@@ -1291,6 +2043,21 @@ class SerialNumberBarcode extends BarcodeField {
1291
2043
  super(name, symbologies);
1292
2044
  this._fieldType = 'serialNumberBarcode';
1293
2045
  }
2046
+ get isOptional() {
2047
+ return super.optional;
2048
+ }
2049
+ get name() {
2050
+ return super.name;
2051
+ }
2052
+ get valueRegexes() {
2053
+ return super.valueRegexes;
2054
+ }
2055
+ set valueRegexes(value) {
2056
+ super.valueRegexes = value;
2057
+ }
2058
+ get symbologies() {
2059
+ return super.symbologySettings;
2060
+ }
1294
2061
  }
1295
2062
  __decorate([
1296
2063
  nameForSerialization('fieldType')
@@ -1309,6 +2076,18 @@ class TotalPriceText extends TextField {
1309
2076
  set anchorRegexes(value) {
1310
2077
  this._anchorRegexes = value;
1311
2078
  }
2079
+ get isOptional() {
2080
+ return super.optional;
2081
+ }
2082
+ get name() {
2083
+ return super.name;
2084
+ }
2085
+ get valueRegexes() {
2086
+ return super.valueRegexes;
2087
+ }
2088
+ set valueRegexes(value) {
2089
+ super.valueRegexes = value;
2090
+ }
1312
2091
  }
1313
2092
  __decorate([
1314
2093
  nameForSerialization('fieldType')
@@ -1330,6 +2109,18 @@ class UnitPriceText extends TextField {
1330
2109
  set anchorRegexes(value) {
1331
2110
  this._anchorRegexes = value;
1332
2111
  }
2112
+ get isOptional() {
2113
+ return super.optional;
2114
+ }
2115
+ get name() {
2116
+ return super.name;
2117
+ }
2118
+ get valueRegexes() {
2119
+ return super.valueRegexes;
2120
+ }
2121
+ set valueRegexes(value) {
2122
+ super.valueRegexes = value;
2123
+ }
1333
2124
  }
1334
2125
  __decorate([
1335
2126
  nameForSerialization('fieldType')
@@ -1351,6 +2142,18 @@ class WeightText extends TextField {
1351
2142
  set anchorRegexes(value) {
1352
2143
  this._anchorRegexes = value;
1353
2144
  }
2145
+ get isOptional() {
2146
+ return super.optional;
2147
+ }
2148
+ get name() {
2149
+ return super.name;
2150
+ }
2151
+ get valueRegexes() {
2152
+ return super.valueRegexes;
2153
+ }
2154
+ set valueRegexes(value) {
2155
+ super.valueRegexes = value;
2156
+ }
1354
2157
  }
1355
2158
  __decorate([
1356
2159
  nameForSerialization('fieldType')
@@ -1368,6 +2171,8 @@ var LabelCaptureBasicOverlayListenerEvents;
1368
2171
  class LabelCaptureBasicOverlayController extends BaseController {
1369
2172
  constructor(overlay) {
1370
2173
  super('LabelCaptureBasicOverlayProxy');
2174
+ this.hasListeners = false;
2175
+ this.hasPendingListenerRegistration = false;
1371
2176
  // Arrow function wrappers to avoid .bind(this) and always use current class state
1372
2177
  this.handleBrushForFieldOfLabelWrapper = (ev) => __awaiter(this, void 0, void 0, function* () {
1373
2178
  return this.handleBrushForFieldOfLabel(ev);
@@ -1379,49 +2184,71 @@ class LabelCaptureBasicOverlayController extends BaseController {
1379
2184
  this.handleDidTapLabel(ev);
1380
2185
  };
1381
2186
  this.overlay = overlay;
2187
+ this.adapter = new LabelProxyAdapter(this._proxy);
1382
2188
  void this.initialize();
1383
2189
  }
1384
2190
  setBrushForFieldOfLabel(brush, field, label) {
1385
- return this._proxy.$setBrushForFieldOfLabel({
1386
- brushJson: brush ? JSON.stringify(brush.toJSON()) : null,
2191
+ return this.adapter.setLabelCaptureBasicOverlayBrushForFieldOfLabel({
2192
+ brushJson: brush ? JSON.stringify(brush.toJSON()) : '',
1387
2193
  fieldName: field.name,
1388
2194
  trackingId: label.trackingID,
1389
2195
  dataCaptureViewId: this.dataCaptureViewId
1390
2196
  });
1391
2197
  }
1392
2198
  setBrushForLabel(brush, label) {
1393
- return this._proxy.$setBrushForLabel({
1394
- brushJson: brush ? JSON.stringify(brush.toJSON()) : null,
2199
+ return this.adapter.setLabelCaptureBasicOverlayBrushForLabel({
2200
+ brushJson: brush ? JSON.stringify(brush.toJSON()) : '',
1395
2201
  trackingId: label.trackingID,
1396
2202
  dataCaptureViewId: this.dataCaptureViewId
1397
2203
  });
1398
2204
  }
1399
2205
  subscribeListener() {
1400
2206
  return __awaiter(this, void 0, void 0, function* () {
1401
- if (this.dataCaptureViewId !== -1) {
1402
- yield this._proxy.$registerListenerForBasicOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
2207
+ if (this.hasListeners) {
2208
+ return;
1403
2209
  }
1404
2210
  this._proxy.subscribeForEvents(Object.values(LabelCaptureBasicOverlayListenerEvents));
1405
2211
  this._proxy.eventEmitter.on(LabelCaptureBasicOverlayListenerEvents.brushForFieldOfLabel, this.handleBrushForFieldOfLabelWrapper);
1406
2212
  this._proxy.eventEmitter.on(LabelCaptureBasicOverlayListenerEvents.brushForLabel, this.handleBrushForLabelWrapper);
1407
2213
  this._proxy.eventEmitter.on(LabelCaptureBasicOverlayListenerEvents.didTapLabel, this.handleDidTapLabelWrapper);
2214
+ this.hasListeners = true;
2215
+ if (this.dataCaptureViewId !== -1) {
2216
+ yield this.adapter.addLabelCaptureBasicOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
2217
+ }
2218
+ else {
2219
+ this.hasPendingListenerRegistration = true;
2220
+ }
2221
+ });
2222
+ }
2223
+ onViewChanged() {
2224
+ return __awaiter(this, void 0, void 0, function* () {
2225
+ if (this.hasPendingListenerRegistration && this.dataCaptureViewId !== -1) {
2226
+ this.hasPendingListenerRegistration = false;
2227
+ yield this.adapter.addLabelCaptureBasicOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
2228
+ }
1408
2229
  });
1409
2230
  }
1410
2231
  unsubscribeListener() {
1411
2232
  return __awaiter(this, void 0, void 0, function* () {
1412
- yield this._proxy.$unregisterListenerForBasicOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
2233
+ if (!this.hasListeners) {
2234
+ return;
2235
+ }
2236
+ if (this.dataCaptureViewId !== -1) {
2237
+ yield this.adapter.removeLabelCaptureBasicOverlayListener({ dataCaptureViewId: this.dataCaptureViewId });
2238
+ }
1413
2239
  this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureBasicOverlayListenerEvents));
1414
2240
  this._proxy.eventEmitter.off(LabelCaptureBasicOverlayListenerEvents.brushForFieldOfLabel, this.handleBrushForFieldOfLabelWrapper);
1415
2241
  this._proxy.eventEmitter.off(LabelCaptureBasicOverlayListenerEvents.brushForLabel, this.handleBrushForLabelWrapper);
1416
2242
  this._proxy.eventEmitter.off(LabelCaptureBasicOverlayListenerEvents.didTapLabel, this.handleDidTapLabelWrapper);
2243
+ this.hasListeners = false;
2244
+ this.hasPendingListenerRegistration = false;
1417
2245
  });
1418
2246
  }
1419
2247
  updateBasicOverlay(basicOverlayJson) {
1420
- return this._proxy.$updateLabelCaptureBasicOverlay({ dataCaptureViewId: this.dataCaptureViewId, basicOverlayJson });
2248
+ return this.adapter.updateLabelCaptureBasicOverlay({ dataCaptureViewId: this.dataCaptureViewId, basicOverlayJson });
1421
2249
  }
1422
2250
  dispose() {
1423
2251
  void this.unsubscribeListener();
1424
- this._proxy.dispose();
1425
2252
  }
1426
2253
  initialize() {
1427
2254
  return __awaiter(this, void 0, void 0, function* () {
@@ -1493,6 +2320,10 @@ class LabelCaptureBasicOverlay extends DefaultSerializeable {
1493
2320
  this._view = newView;
1494
2321
  (_b = this.controller) !== null && _b !== void 0 ? _b : (this.controller = new LabelCaptureBasicOverlayController(this));
1495
2322
  }
2323
+ onViewIdChanged() {
2324
+ var _a;
2325
+ void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.onViewChanged());
2326
+ }
1496
2327
  get predictedFieldBrush() {
1497
2328
  return this._predictedFieldBrush;
1498
2329
  }
@@ -1547,7 +2378,7 @@ class LabelCaptureBasicOverlay extends DefaultSerializeable {
1547
2378
  this._viewfinder = newViewfinder;
1548
2379
  void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.updateBasicOverlay(JSON.stringify(this.toJSON())));
1549
2380
  }
1550
- constructor(mode) {
2381
+ constructor(labelCapture) {
1551
2382
  super();
1552
2383
  this.type = 'labelCaptureBasic';
1553
2384
  this.controller = null;
@@ -1559,7 +2390,7 @@ class LabelCaptureBasicOverlay extends DefaultSerializeable {
1559
2390
  this.hasListener = false;
1560
2391
  this._listener = null;
1561
2392
  this._viewfinder = null;
1562
- this.modeId = mode.modeId;
2393
+ this.modeId = labelCapture.modeId;
1563
2394
  }
1564
2395
  setBrushForFieldOfLabel(brush, field, label) {
1565
2396
  return __awaiter(this, void 0, void 0, function* () {
@@ -1603,21 +2434,27 @@ __decorate([
1603
2434
  var LabelCaptureValidationFlowListenerEvents;
1604
2435
  (function (LabelCaptureValidationFlowListenerEvents) {
1605
2436
  LabelCaptureValidationFlowListenerEvents["didCaptureLabelWithFields"] = "LabelCaptureValidationFlowListener.didCaptureLabelWithFields";
2437
+ LabelCaptureValidationFlowListenerEvents["didSubmitManualInputForField"] = "LabelCaptureValidationFlowListener.didSubmitManualInputForField";
1606
2438
  })(LabelCaptureValidationFlowListenerEvents || (LabelCaptureValidationFlowListenerEvents = {}));
1607
2439
  class LabelCaptureValidationFlowOverlayController extends BaseController {
1608
2440
  constructor(overlay) {
1609
2441
  super('LabelCaptureValidationFlowOverlayProxy');
1610
2442
  this.isSubscribed = false;
2443
+ this.hasPendingListenerRegistration = false;
1611
2444
  // Arrow function wrapper to avoid .bind(this) and always use current class state
1612
2445
  this.handleDidCaptureLabelWithFieldsEventWrapper = (ev) => {
1613
2446
  this.handleDidCaptureLabelWithFieldsEvent(ev);
1614
2447
  };
2448
+ this.handleDidSubmitManualInputForFieldEventWrapper = (ev) => {
2449
+ this.handleDidSubmitManualInputForFieldEvent(ev);
2450
+ };
1615
2451
  this.overlay = overlay;
2452
+ this.adapter = new LabelProxyAdapter(this._proxy);
1616
2453
  void this.initialize();
1617
2454
  }
1618
2455
  updateValidationFlowOverlay() {
1619
2456
  return __awaiter(this, void 0, void 0, function* () {
1620
- yield this._proxy.$updateLabelCaptureValidationFlowOverlay({ dataCaptureViewId: this.dataCaptureViewId, overlayJson: JSON.stringify(this.overlay.toJSON()) });
2457
+ yield this.adapter.updateLabelCaptureValidationFlowOverlay({ dataCaptureViewId: this.dataCaptureViewId, overlayJson: JSON.stringify(this.overlay.toJSON()) });
1621
2458
  });
1622
2459
  }
1623
2460
  subscribeLabelCaptureValidationFlowListener() {
@@ -1625,10 +2462,24 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
1625
2462
  if (this.isSubscribed) {
1626
2463
  return;
1627
2464
  }
1628
- yield this._proxy.$registerListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
1629
2465
  this._proxy.subscribeForEvents(Object.values(LabelCaptureValidationFlowListenerEvents));
1630
2466
  this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didCaptureLabelWithFields, this.handleDidCaptureLabelWithFieldsEventWrapper);
2467
+ this._proxy.eventEmitter.on(LabelCaptureValidationFlowListenerEvents.didSubmitManualInputForField, this.handleDidSubmitManualInputForFieldEventWrapper);
1631
2468
  this.isSubscribed = true;
2469
+ if (this.dataCaptureViewId !== -1) {
2470
+ yield this.adapter.registerListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
2471
+ }
2472
+ else {
2473
+ this.hasPendingListenerRegistration = true;
2474
+ }
2475
+ });
2476
+ }
2477
+ onViewChanged() {
2478
+ return __awaiter(this, void 0, void 0, function* () {
2479
+ if (this.hasPendingListenerRegistration && this.dataCaptureViewId !== -1) {
2480
+ this.hasPendingListenerRegistration = false;
2481
+ yield this.adapter.registerListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
2482
+ }
1632
2483
  });
1633
2484
  }
1634
2485
  unsubscribeLabelCaptureValidationFlowListener() {
@@ -1636,10 +2487,14 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
1636
2487
  if (!this.isSubscribed) {
1637
2488
  return;
1638
2489
  }
1639
- yield this._proxy.$unregisterListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
2490
+ if (this.dataCaptureViewId !== -1) {
2491
+ yield this.adapter.unregisterListenerForValidationFlowEvents({ dataCaptureViewId: this.dataCaptureViewId });
2492
+ }
1640
2493
  this._proxy.eventEmitter.off(LabelCaptureValidationFlowListenerEvents.didCaptureLabelWithFields, this.handleDidCaptureLabelWithFieldsEventWrapper);
2494
+ this._proxy.eventEmitter.off(LabelCaptureValidationFlowListenerEvents.didSubmitManualInputForField, this.handleDidSubmitManualInputForFieldEventWrapper);
1641
2495
  this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureValidationFlowListenerEvents));
1642
2496
  this.isSubscribed = false;
2497
+ this.hasPendingListenerRegistration = false;
1643
2498
  });
1644
2499
  }
1645
2500
  dispose() {
@@ -1658,10 +2513,19 @@ class LabelCaptureValidationFlowOverlayController extends BaseController {
1658
2513
  const fields = payload.fields.map((field) => LabelField.fromJSON(JSON.parse(field)));
1659
2514
  this.notifyListenersOfDidCaptureLabelWithFields(fields);
1660
2515
  }
2516
+ handleDidSubmitManualInputForFieldEvent(ev) {
2517
+ const payload = JSON.parse(ev.data);
2518
+ const field = LabelField.fromJSON(JSON.parse(payload.fields[0]));
2519
+ this.notifyListenersOfDidSubmitManualInputForField(field, payload.oldValue, payload.newValue);
2520
+ }
1661
2521
  notifyListenersOfDidCaptureLabelWithFields(fields) {
1662
2522
  var _a;
1663
2523
  (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didCaptureLabelWithFields(fields);
1664
2524
  }
2525
+ notifyListenersOfDidSubmitManualInputForField(field, oldValue, newValue) {
2526
+ var _a;
2527
+ (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didSubmitManualInputForField(field, oldValue, newValue);
2528
+ }
1665
2529
  get dataCaptureViewId() {
1666
2530
  var _a, _b;
1667
2531
  return (_b = (_a = this.overlay.view) === null || _a === void 0 ? void 0 : _a.viewId) !== null && _b !== void 0 ? _b : -1;
@@ -1683,6 +2547,10 @@ class LabelCaptureValidationFlowOverlay extends DefaultSerializeable {
1683
2547
  this._view = newView;
1684
2548
  (_b = this.controller) !== null && _b !== void 0 ? _b : (this.controller = new LabelCaptureValidationFlowOverlayController(this));
1685
2549
  }
2550
+ onViewIdChanged() {
2551
+ var _a;
2552
+ void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.onViewChanged());
2553
+ }
1686
2554
  constructor(mode) {
1687
2555
  super();
1688
2556
  this.type = 'validationFlow';
@@ -1732,6 +2600,7 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
1732
2600
  }
1733
2601
  constructor() {
1734
2602
  super();
2603
+ this._labelDefinitionsPlaceholders = new Map();
1735
2604
  const defaults = getLabelCaptureDefaults().LabelCapture.LabelCaptureValidationFlowOverlay.Settings;
1736
2605
  this._missingFieldsHintText = defaults.missingFieldsHintText;
1737
2606
  this._standbyHintText = defaults.standbyHintText;
@@ -1740,10 +2609,17 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
1740
2609
  this._requiredFieldErrorText = defaults.requiredFieldErrorText;
1741
2610
  this._manualInputButtonText = defaults.manualInputButtonText;
1742
2611
  }
2612
+ /**
2613
+ * @deprecated This property is deprecated and will be removed in a future release.
2614
+ */
1743
2615
  get missingFieldsHintText() {
1744
2616
  return this._missingFieldsHintText;
1745
2617
  }
2618
+ /**
2619
+ * @deprecated This property is deprecated and will be removed in a future release.
2620
+ */
1746
2621
  set missingFieldsHintText(text) {
2622
+ console.warn('missingFieldsHintText is deprecated and will be removed in a future release.');
1747
2623
  this._missingFieldsHintText = text;
1748
2624
  }
1749
2625
  get standbyHintText() {
@@ -1764,18 +2640,55 @@ class LabelCaptureValidationFlowSettings extends DefaultSerializeable {
1764
2640
  set validationErrorText(text) {
1765
2641
  this._validationErrorText = text;
1766
2642
  }
2643
+ /**
2644
+ * @deprecated This property is deprecated and will be removed in a future release.
2645
+ */
1767
2646
  get requiredFieldErrorText() {
1768
2647
  return this._requiredFieldErrorText;
1769
2648
  }
2649
+ /**
2650
+ * @deprecated This property is deprecated and will be removed in a future release.
2651
+ */
1770
2652
  set requiredFieldErrorText(text) {
2653
+ console.warn('requiredFieldErrorText is deprecated and will be removed in a future release.');
1771
2654
  this._requiredFieldErrorText = text;
1772
2655
  }
2656
+ /**
2657
+ * @deprecated This property is deprecated and will be removed in a future release.
2658
+ */
1773
2659
  get manualInputButtonText() {
1774
2660
  return this._manualInputButtonText;
1775
2661
  }
2662
+ /**
2663
+ * @deprecated This property is deprecated and will be removed in a future release.
2664
+ */
1776
2665
  set manualInputButtonText(text) {
2666
+ console.warn('manualInputButtonText is deprecated and will be removed in a future release.');
1777
2667
  this._manualInputButtonText = text;
1778
2668
  }
2669
+ setPlaceholderTextForLabelDefinition(fieldName, placeholder) {
2670
+ if (placeholder === null) {
2671
+ this._labelDefinitionsPlaceholders.delete(fieldName);
2672
+ }
2673
+ else {
2674
+ this._labelDefinitionsPlaceholders.set(fieldName, placeholder);
2675
+ }
2676
+ }
2677
+ getPlaceholderTextForLabelDefinition(fieldName) {
2678
+ var _a;
2679
+ return (_a = this._labelDefinitionsPlaceholders.get(fieldName)) !== null && _a !== void 0 ? _a : null;
2680
+ }
2681
+ toJSON() {
2682
+ const json = super.toJSON();
2683
+ if (this._labelDefinitionsPlaceholders.size > 0) {
2684
+ const placeholders = {};
2685
+ this._labelDefinitionsPlaceholders.forEach((value, key) => {
2686
+ placeholders[key] = value;
2687
+ });
2688
+ json['labelDefinitionsPlaceholders'] = placeholders;
2689
+ }
2690
+ return json;
2691
+ }
1779
2692
  }
1780
2693
  __decorate([
1781
2694
  nameForSerialization('missingFieldsHintText')
@@ -1795,17 +2708,202 @@ __decorate([
1795
2708
  __decorate([
1796
2709
  nameForSerialization('manualInputButtonText')
1797
2710
  ], LabelCaptureValidationFlowSettings.prototype, "_manualInputButtonText", void 0);
2711
+ __decorate([
2712
+ ignoreFromSerialization
2713
+ ], LabelCaptureValidationFlowSettings.prototype, "_labelDefinitionsPlaceholders", void 0);
2714
+
2715
+ var LabelCaptureAdaptiveRecognitionListenerEvents;
2716
+ (function (LabelCaptureAdaptiveRecognitionListenerEvents) {
2717
+ LabelCaptureAdaptiveRecognitionListenerEvents["recognized"] = "LabelCaptureAdaptiveRecognitionListener.recognized";
2718
+ LabelCaptureAdaptiveRecognitionListenerEvents["failure"] = "LabelCaptureAdaptiveRecognitionListener.failure";
2719
+ })(LabelCaptureAdaptiveRecognitionListenerEvents || (LabelCaptureAdaptiveRecognitionListenerEvents = {}));
2720
+ class LabelCaptureAdaptiveRecognitionOverlayController extends BaseController {
2721
+ get dataCaptureViewId() {
2722
+ var _a, _b;
2723
+ return (_b = (_a = this.overlay.view) === null || _a === void 0 ? void 0 : _a.viewId) !== null && _b !== void 0 ? _b : -1;
2724
+ }
2725
+ constructor(overlay) {
2726
+ super('LabelCaptureAdaptiveRecognitionOverlayProxy');
2727
+ this.hasListeners = false;
2728
+ this.hasPendingListenerRegistration = false;
2729
+ this.handleRecognizedWrapper = (ev) => {
2730
+ this.handleRecognized(ev);
2731
+ };
2732
+ this.handleFailureWrapper = () => {
2733
+ this.handleFailure();
2734
+ };
2735
+ this.overlay = overlay;
2736
+ this.adapter = new LabelProxyAdapter(this._proxy);
2737
+ void this.initialize();
2738
+ }
2739
+ subscribeListener() {
2740
+ return __awaiter(this, void 0, void 0, function* () {
2741
+ if (this.hasListeners) {
2742
+ return;
2743
+ }
2744
+ this._proxy.subscribeForEvents(Object.values(LabelCaptureAdaptiveRecognitionListenerEvents));
2745
+ this._proxy.eventEmitter.on(LabelCaptureAdaptiveRecognitionListenerEvents.recognized, this.handleRecognizedWrapper);
2746
+ this._proxy.eventEmitter.on(LabelCaptureAdaptiveRecognitionListenerEvents.failure, this.handleFailureWrapper);
2747
+ this.hasListeners = true;
2748
+ if (this.dataCaptureViewId !== -1) {
2749
+ yield this.adapter.registerListenerForAdaptiveRecognitionOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
2750
+ }
2751
+ else {
2752
+ this.hasPendingListenerRegistration = true;
2753
+ }
2754
+ });
2755
+ }
2756
+ onViewChanged() {
2757
+ return __awaiter(this, void 0, void 0, function* () {
2758
+ if (this.hasPendingListenerRegistration && this.dataCaptureViewId !== -1) {
2759
+ this.hasPendingListenerRegistration = false;
2760
+ yield this.adapter.registerListenerForAdaptiveRecognitionOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
2761
+ }
2762
+ });
2763
+ }
2764
+ unsubscribeListener() {
2765
+ return __awaiter(this, void 0, void 0, function* () {
2766
+ if (!this.hasListeners) {
2767
+ return;
2768
+ }
2769
+ if (this.dataCaptureViewId !== -1) {
2770
+ yield this.adapter.unregisterListenerForAdaptiveRecognitionOverlayEvents({ dataCaptureViewId: this.dataCaptureViewId });
2771
+ }
2772
+ this._proxy.unsubscribeFromEvents(Object.values(LabelCaptureAdaptiveRecognitionListenerEvents));
2773
+ this._proxy.eventEmitter.off(LabelCaptureAdaptiveRecognitionListenerEvents.recognized, this.handleRecognizedWrapper);
2774
+ this._proxy.eventEmitter.off(LabelCaptureAdaptiveRecognitionListenerEvents.failure, this.handleFailureWrapper);
2775
+ this.hasListeners = false;
2776
+ this.hasPendingListenerRegistration = false;
2777
+ });
2778
+ }
2779
+ applySettings() {
2780
+ return __awaiter(this, void 0, void 0, function* () {
2781
+ return this.adapter.applyLabelCaptureAdaptiveRecognitionSettings({
2782
+ dataCaptureViewId: this.dataCaptureViewId,
2783
+ overlayJson: JSON.stringify(this.overlay.toJSON())
2784
+ });
2785
+ });
2786
+ }
2787
+ dispose() {
2788
+ void this.unsubscribeListener();
2789
+ }
2790
+ initialize() {
2791
+ return __awaiter(this, void 0, void 0, function* () {
2792
+ // Controller initialization if needed
2793
+ if (this.overlay.listener) {
2794
+ return this.subscribeListener();
2795
+ }
2796
+ });
2797
+ }
2798
+ handleRecognized(ev) {
2799
+ var _a;
2800
+ const payload = JSON.parse(ev.data);
2801
+ (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didRecognize(payload.result);
2802
+ }
2803
+ handleFailure() {
2804
+ var _a;
2805
+ (_a = this.overlay.listener) === null || _a === void 0 ? void 0 : _a.didFail();
2806
+ }
2807
+ }
2808
+
2809
+ class LabelCaptureAdaptiveRecognitionOverlay extends DefaultSerializeable {
2810
+ get view() {
2811
+ return this._view;
2812
+ }
2813
+ set view(newView) {
2814
+ var _a, _b;
2815
+ if (newView === null) {
2816
+ (_a = this.controller) === null || _a === void 0 ? void 0 : _a.dispose();
2817
+ this.controller = null;
2818
+ this._view = null;
2819
+ return;
2820
+ }
2821
+ this._view = newView;
2822
+ (_b = this.controller) !== null && _b !== void 0 ? _b : (this.controller = new LabelCaptureAdaptiveRecognitionOverlayController(this));
2823
+ }
2824
+ onViewIdChanged() {
2825
+ var _a;
2826
+ void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.onViewChanged());
2827
+ }
2828
+ get listener() {
2829
+ return this._listener;
2830
+ }
2831
+ set listener(listener) {
2832
+ var _a, _b;
2833
+ this._listener = listener;
2834
+ this.hasListener = listener != null;
2835
+ if (this.hasListener) {
2836
+ void ((_a = this.controller) === null || _a === void 0 ? void 0 : _a.subscribeListener());
2837
+ }
2838
+ else {
2839
+ void ((_b = this.controller) === null || _b === void 0 ? void 0 : _b.unsubscribeListener());
2840
+ }
2841
+ }
2842
+ constructor(mode) {
2843
+ super();
2844
+ this.type = 'receiptScanning';
2845
+ this.settings = null;
2846
+ this.controller = null;
2847
+ this._view = null;
2848
+ this._listener = null;
2849
+ this.hasListener = false;
2850
+ this.modeId = mode.modeId;
2851
+ }
2852
+ applySettings(settings) {
2853
+ return __awaiter(this, void 0, void 0, function* () {
2854
+ var _a, _b;
2855
+ this.settings = settings;
2856
+ return (_b = (_a = this.controller) === null || _a === void 0 ? void 0 : _a.applySettings()) !== null && _b !== void 0 ? _b : Promise.resolve();
2857
+ });
2858
+ }
2859
+ }
2860
+ __decorate([
2861
+ ignoreFromSerialization
2862
+ ], LabelCaptureAdaptiveRecognitionOverlay.prototype, "controller", void 0);
2863
+ __decorate([
2864
+ ignoreFromSerialization
2865
+ ], LabelCaptureAdaptiveRecognitionOverlay.prototype, "_view", void 0);
2866
+ __decorate([
2867
+ ignoreFromSerialization
2868
+ ], LabelCaptureAdaptiveRecognitionOverlay.prototype, "_listener", void 0);
2869
+
2870
+ class LabelCaptureAdaptiveRecognitionSettings extends DefaultSerializeable {
2871
+ constructor(resultType) {
2872
+ super();
2873
+ this._processingHintText = '';
2874
+ this._resultType = resultType;
2875
+ }
2876
+ get processingHintText() {
2877
+ return this._processingHintText;
2878
+ }
2879
+ set processingHintText(text) {
2880
+ this._processingHintText = text;
2881
+ }
2882
+ get resultType() {
2883
+ return this._resultType;
2884
+ }
2885
+ set resultType(resultType) {
2886
+ this._resultType = resultType;
2887
+ }
2888
+ }
2889
+ __decorate([
2890
+ nameForSerialization('processingHintText')
2891
+ ], LabelCaptureAdaptiveRecognitionSettings.prototype, "_processingHintText", void 0);
2892
+ __decorate([
2893
+ nameForSerialization('resultType')
2894
+ ], LabelCaptureAdaptiveRecognitionSettings.prototype, "_resultType", void 0);
1798
2895
 
1799
2896
  const LABEL_PROXY_TYPE_NAMES = [
1800
2897
  'LabelCaptureProxy',
1801
2898
  'LabelCaptureBasicOverlayProxy',
1802
2899
  'LabelCaptureAdvancedOverlayProxy',
1803
2900
  'LabelCaptureValidationFlowOverlayProxy',
2901
+ 'LabelCaptureAdaptiveRecognitionOverlayProxy',
1804
2902
  ];
1805
2903
 
1806
2904
  function registerLabelProxies(provider) {
1807
2905
  registerProxies(LABEL_PROXY_TYPE_NAMES, provider);
1808
2906
  }
1809
2907
 
1810
- export { BarcodeField, CapturedLabel, CustomBarcode, CustomText, ExpiryDateText, ImeiOneBarcode, ImeiTwoBarcode, LABEL_PROXY_TYPE_NAMES, LabelCapture, 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, SerialNumberBarcode, TextField, TotalPriceText, UnitPriceText, WeightText, getLabelCaptureDefaults, loadLabelCaptureDefaults, registerLabelProxies };
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 };
1811
2909
  //# sourceMappingURL=index.js.map