@mjhls/mjh-framework 1.0.1050-pdfGating-v3 → 1.0.1050-pdfGating-v4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/PublicationLanding.js +75 -26
- package/dist/esm/PublicationLanding.js +75 -26
- package/package.json +1 -1
|
@@ -495,22 +495,27 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
495
495
|
|
|
496
496
|
var _useState15 = React.useState(false),
|
|
497
497
|
_useState16 = slicedToArray._slicedToArray(_useState15, 2),
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
checkBox = _useState16[0],
|
|
499
|
+
setCheckBox = _useState16[1];
|
|
500
|
+
|
|
501
|
+
var _useState17 = React.useState(false),
|
|
502
|
+
_useState18 = slicedToArray._slicedToArray(_useState17, 2),
|
|
503
|
+
isValidated = _useState18[0],
|
|
504
|
+
SetIsValidated = _useState18[1];
|
|
500
505
|
|
|
501
506
|
var DL_PDF = React.useRef();
|
|
502
507
|
var overLayRef = React.useRef([]);
|
|
503
508
|
var pdfFormRef = React.useRef();
|
|
504
509
|
|
|
505
|
-
var
|
|
506
|
-
_useState18 = slicedToArray._slicedToArray(_useState17, 2),
|
|
507
|
-
sendingData = _useState18[0],
|
|
508
|
-
setSendingData = _useState18[1];
|
|
509
|
-
|
|
510
|
-
var _useState19 = React.useState(''),
|
|
510
|
+
var _useState19 = React.useState(true),
|
|
511
511
|
_useState20 = slicedToArray._slicedToArray(_useState19, 2),
|
|
512
|
-
|
|
513
|
-
|
|
512
|
+
sendingData = _useState20[0],
|
|
513
|
+
setSendingData = _useState20[1];
|
|
514
|
+
|
|
515
|
+
var _useState21 = React.useState(''),
|
|
516
|
+
_useState22 = slicedToArray._slicedToArray(_useState21, 2),
|
|
517
|
+
errorMsg = _useState22[0],
|
|
518
|
+
setErrorMsg = _useState22[1];
|
|
514
519
|
|
|
515
520
|
var triggerAction = 'click';
|
|
516
521
|
var placementLocation = main.main_42 ? 'top' : 'top';
|
|
@@ -646,6 +651,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
646
651
|
}, [activeYear, activeContentPlacement, issueData]);
|
|
647
652
|
|
|
648
653
|
var handleFormInput = function handleFormInput(e) {
|
|
654
|
+
console.dir(e.currentTarget);
|
|
649
655
|
switch (e.currentTarget.name) {
|
|
650
656
|
case 'firstName':
|
|
651
657
|
setFirstName(e.currentTarget.value);
|
|
@@ -656,9 +662,18 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
656
662
|
case 'email':
|
|
657
663
|
setEmail(e.currentTarget.value);
|
|
658
664
|
break;
|
|
665
|
+
case 'checkbox':
|
|
666
|
+
setCheckBox(e.currentTarget.checked);
|
|
667
|
+
break;
|
|
659
668
|
}
|
|
660
669
|
};
|
|
661
670
|
|
|
671
|
+
React.useEffect(function () {
|
|
672
|
+
if (firstName.length > 3 && lastName.length > 3 && email.includes('@') && checkBox) {
|
|
673
|
+
setSendingData(false);
|
|
674
|
+
}
|
|
675
|
+
}, [firstName, lastName, email, checkBox]);
|
|
676
|
+
|
|
662
677
|
var isGatedFormHandler = function () {
|
|
663
678
|
var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(e) {
|
|
664
679
|
var form, body, res;
|
|
@@ -702,43 +717,44 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
702
717
|
res = _context.sent;
|
|
703
718
|
|
|
704
719
|
if (!(res.status === 202)) {
|
|
705
|
-
_context.next =
|
|
720
|
+
_context.next = 24;
|
|
706
721
|
break;
|
|
707
722
|
}
|
|
708
723
|
|
|
709
724
|
window.open(DL_PDF.current.dataset.pdf, '_blank');
|
|
710
|
-
|
|
725
|
+
closeAllOverlays();
|
|
726
|
+
_context.next = 29;
|
|
711
727
|
break;
|
|
712
728
|
|
|
713
|
-
case
|
|
729
|
+
case 24:
|
|
714
730
|
_context.t0 = Error;
|
|
715
|
-
_context.next =
|
|
731
|
+
_context.next = 27;
|
|
716
732
|
return res.text();
|
|
717
733
|
|
|
718
|
-
case
|
|
734
|
+
case 27:
|
|
719
735
|
_context.t1 = _context.sent;
|
|
720
736
|
throw new _context.t0(_context.t1);
|
|
721
737
|
|
|
722
|
-
case
|
|
723
|
-
_context.next =
|
|
738
|
+
case 29:
|
|
739
|
+
_context.next = 34;
|
|
724
740
|
break;
|
|
725
741
|
|
|
726
|
-
case
|
|
727
|
-
_context.prev =
|
|
742
|
+
case 31:
|
|
743
|
+
_context.prev = 31;
|
|
728
744
|
_context.t2 = _context['catch'](15);
|
|
729
745
|
|
|
730
746
|
setErrorMsg(_context.t2.message);
|
|
731
747
|
|
|
732
|
-
case
|
|
748
|
+
case 34:
|
|
733
749
|
setSendingData(false);
|
|
734
750
|
SetIsValidated(false);
|
|
735
751
|
|
|
736
|
-
case
|
|
752
|
+
case 36:
|
|
737
753
|
case 'end':
|
|
738
754
|
return _context.stop();
|
|
739
755
|
}
|
|
740
756
|
}
|
|
741
|
-
}, _callee, _this, [[15,
|
|
757
|
+
}, _callee, _this, [[15, 31]]);
|
|
742
758
|
}));
|
|
743
759
|
|
|
744
760
|
return function isGatedFormHandler(_x) {
|
|
@@ -746,10 +762,21 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
746
762
|
};
|
|
747
763
|
}();
|
|
748
764
|
|
|
765
|
+
var closeAllOverlays = function closeAllOverlays() {
|
|
766
|
+
overLayRef.current.forEach(function (element) {
|
|
767
|
+
try {
|
|
768
|
+
console.dir(element);
|
|
769
|
+
element.handleHide();
|
|
770
|
+
} catch (e) {
|
|
771
|
+
console.error(e.message);
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
};
|
|
775
|
+
|
|
749
776
|
var isGatedPDFPopOver = function isGatedPDFPopOver(key) {
|
|
750
777
|
return React__default["default"].createElement(
|
|
751
778
|
Popover__default["default"],
|
|
752
|
-
{ id: 'popover-basic-' },
|
|
779
|
+
{ id: 'popover-basic-' + key },
|
|
753
780
|
React__default["default"].createElement(
|
|
754
781
|
Popover__default["default"].Content,
|
|
755
782
|
null,
|
|
@@ -825,6 +852,27 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
825
852
|
'Please provide your email.'
|
|
826
853
|
)
|
|
827
854
|
),
|
|
855
|
+
React__default["default"].createElement(
|
|
856
|
+
Form__default["default"].Group,
|
|
857
|
+
{ className: 'mb-3', controlId: 'pdfPrivacyCheck' },
|
|
858
|
+
React__default["default"].createElement(
|
|
859
|
+
Form__default["default"].Check,
|
|
860
|
+
null,
|
|
861
|
+
React__default["default"].createElement(Form__default["default"].Check.Input, { required: true, onChange: function onChange(e) {
|
|
862
|
+
return handleFormInput(e);
|
|
863
|
+
}, type: 'checkbox', name: 'checkbox' }),
|
|
864
|
+
React__default["default"].createElement(
|
|
865
|
+
Form__default["default"].Check.Label,
|
|
866
|
+
null,
|
|
867
|
+
'By clicking on \'Submit\', you accept our ',
|
|
868
|
+
React__default["default"].createElement(
|
|
869
|
+
'a',
|
|
870
|
+
{ href: 'https://www.dentalproductsreport.com/privacy', target: '_blank' },
|
|
871
|
+
'Privacy Policy'
|
|
872
|
+
)
|
|
873
|
+
)
|
|
874
|
+
)
|
|
875
|
+
),
|
|
828
876
|
React__default["default"].createElement(
|
|
829
877
|
Button__default["default"],
|
|
830
878
|
{ disabled: sendingData, className: 'btn btn-primary mb-3', type: 'submit' },
|
|
@@ -975,12 +1023,13 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
975
1023
|
rootCloseEvent: 'click',
|
|
976
1024
|
key: key,
|
|
977
1025
|
ref: function ref(el) {
|
|
978
|
-
|
|
1026
|
+
console.dir(el);
|
|
1027
|
+
overLayRef.current[key] = el;
|
|
979
1028
|
},
|
|
980
1029
|
trigger: triggerAction,
|
|
981
1030
|
placement: placementLocation,
|
|
982
1031
|
delay: { show: 250, hide: 400 },
|
|
983
|
-
overlay: isGatedPDFPopOver() },
|
|
1032
|
+
overlay: isGatedPDFPopOver(key) },
|
|
984
1033
|
React__default["default"].createElement(
|
|
985
1034
|
'button',
|
|
986
1035
|
{ rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile.urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
|
|
@@ -1061,7 +1110,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1061
1110
|
trigger: triggerAction,
|
|
1062
1111
|
placement: placementLocation,
|
|
1063
1112
|
delay: { show: 250, hide: 400 },
|
|
1064
|
-
overlay: isGatedPDFPopOver() },
|
|
1113
|
+
overlay: isGatedPDFPopOver(key) },
|
|
1065
1114
|
React__default["default"].createElement(
|
|
1066
1115
|
'button',
|
|
1067
1116
|
{ rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile.urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
|
|
@@ -481,22 +481,27 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
481
481
|
|
|
482
482
|
var _useState15 = useState(false),
|
|
483
483
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
checkBox = _useState16[0],
|
|
485
|
+
setCheckBox = _useState16[1];
|
|
486
|
+
|
|
487
|
+
var _useState17 = useState(false),
|
|
488
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
489
|
+
isValidated = _useState18[0],
|
|
490
|
+
SetIsValidated = _useState18[1];
|
|
486
491
|
|
|
487
492
|
var DL_PDF = useRef();
|
|
488
493
|
var overLayRef = useRef([]);
|
|
489
494
|
var pdfFormRef = useRef();
|
|
490
495
|
|
|
491
|
-
var
|
|
492
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
|
493
|
-
sendingData = _useState18[0],
|
|
494
|
-
setSendingData = _useState18[1];
|
|
495
|
-
|
|
496
|
-
var _useState19 = useState(''),
|
|
496
|
+
var _useState19 = useState(true),
|
|
497
497
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
sendingData = _useState20[0],
|
|
499
|
+
setSendingData = _useState20[1];
|
|
500
|
+
|
|
501
|
+
var _useState21 = useState(''),
|
|
502
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
503
|
+
errorMsg = _useState22[0],
|
|
504
|
+
setErrorMsg = _useState22[1];
|
|
500
505
|
|
|
501
506
|
var triggerAction = 'click';
|
|
502
507
|
var placementLocation = main_42 ? 'top' : 'top';
|
|
@@ -632,6 +637,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
632
637
|
}, [activeYear, activeContentPlacement, issueData]);
|
|
633
638
|
|
|
634
639
|
var handleFormInput = function handleFormInput(e) {
|
|
640
|
+
console.dir(e.currentTarget);
|
|
635
641
|
switch (e.currentTarget.name) {
|
|
636
642
|
case 'firstName':
|
|
637
643
|
setFirstName(e.currentTarget.value);
|
|
@@ -642,9 +648,18 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
642
648
|
case 'email':
|
|
643
649
|
setEmail(e.currentTarget.value);
|
|
644
650
|
break;
|
|
651
|
+
case 'checkbox':
|
|
652
|
+
setCheckBox(e.currentTarget.checked);
|
|
653
|
+
break;
|
|
645
654
|
}
|
|
646
655
|
};
|
|
647
656
|
|
|
657
|
+
useEffect(function () {
|
|
658
|
+
if (firstName.length > 3 && lastName.length > 3 && email.includes('@') && checkBox) {
|
|
659
|
+
setSendingData(false);
|
|
660
|
+
}
|
|
661
|
+
}, [firstName, lastName, email, checkBox]);
|
|
662
|
+
|
|
648
663
|
var isGatedFormHandler = function () {
|
|
649
664
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(e) {
|
|
650
665
|
var form, body, res;
|
|
@@ -688,43 +703,44 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
688
703
|
res = _context.sent;
|
|
689
704
|
|
|
690
705
|
if (!(res.status === 202)) {
|
|
691
|
-
_context.next =
|
|
706
|
+
_context.next = 24;
|
|
692
707
|
break;
|
|
693
708
|
}
|
|
694
709
|
|
|
695
710
|
window.open(DL_PDF.current.dataset.pdf, '_blank');
|
|
696
|
-
|
|
711
|
+
closeAllOverlays();
|
|
712
|
+
_context.next = 29;
|
|
697
713
|
break;
|
|
698
714
|
|
|
699
|
-
case
|
|
715
|
+
case 24:
|
|
700
716
|
_context.t0 = Error;
|
|
701
|
-
_context.next =
|
|
717
|
+
_context.next = 27;
|
|
702
718
|
return res.text();
|
|
703
719
|
|
|
704
|
-
case
|
|
720
|
+
case 27:
|
|
705
721
|
_context.t1 = _context.sent;
|
|
706
722
|
throw new _context.t0(_context.t1);
|
|
707
723
|
|
|
708
|
-
case
|
|
709
|
-
_context.next =
|
|
724
|
+
case 29:
|
|
725
|
+
_context.next = 34;
|
|
710
726
|
break;
|
|
711
727
|
|
|
712
|
-
case
|
|
713
|
-
_context.prev =
|
|
728
|
+
case 31:
|
|
729
|
+
_context.prev = 31;
|
|
714
730
|
_context.t2 = _context['catch'](15);
|
|
715
731
|
|
|
716
732
|
setErrorMsg(_context.t2.message);
|
|
717
733
|
|
|
718
|
-
case
|
|
734
|
+
case 34:
|
|
719
735
|
setSendingData(false);
|
|
720
736
|
SetIsValidated(false);
|
|
721
737
|
|
|
722
|
-
case
|
|
738
|
+
case 36:
|
|
723
739
|
case 'end':
|
|
724
740
|
return _context.stop();
|
|
725
741
|
}
|
|
726
742
|
}
|
|
727
|
-
}, _callee, _this, [[15,
|
|
743
|
+
}, _callee, _this, [[15, 31]]);
|
|
728
744
|
}));
|
|
729
745
|
|
|
730
746
|
return function isGatedFormHandler(_x) {
|
|
@@ -732,10 +748,21 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
732
748
|
};
|
|
733
749
|
}();
|
|
734
750
|
|
|
751
|
+
var closeAllOverlays = function closeAllOverlays() {
|
|
752
|
+
overLayRef.current.forEach(function (element) {
|
|
753
|
+
try {
|
|
754
|
+
console.dir(element);
|
|
755
|
+
element.handleHide();
|
|
756
|
+
} catch (e) {
|
|
757
|
+
console.error(e.message);
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
};
|
|
761
|
+
|
|
735
762
|
var isGatedPDFPopOver = function isGatedPDFPopOver(key) {
|
|
736
763
|
return React__default.createElement(
|
|
737
764
|
Popover,
|
|
738
|
-
{ id: 'popover-basic-' },
|
|
765
|
+
{ id: 'popover-basic-' + key },
|
|
739
766
|
React__default.createElement(
|
|
740
767
|
Popover.Content,
|
|
741
768
|
null,
|
|
@@ -811,6 +838,27 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
811
838
|
'Please provide your email.'
|
|
812
839
|
)
|
|
813
840
|
),
|
|
841
|
+
React__default.createElement(
|
|
842
|
+
Form.Group,
|
|
843
|
+
{ className: 'mb-3', controlId: 'pdfPrivacyCheck' },
|
|
844
|
+
React__default.createElement(
|
|
845
|
+
Form.Check,
|
|
846
|
+
null,
|
|
847
|
+
React__default.createElement(Form.Check.Input, { required: true, onChange: function onChange(e) {
|
|
848
|
+
return handleFormInput(e);
|
|
849
|
+
}, type: 'checkbox', name: 'checkbox' }),
|
|
850
|
+
React__default.createElement(
|
|
851
|
+
Form.Check.Label,
|
|
852
|
+
null,
|
|
853
|
+
'By clicking on \'Submit\', you accept our ',
|
|
854
|
+
React__default.createElement(
|
|
855
|
+
'a',
|
|
856
|
+
{ href: 'https://www.dentalproductsreport.com/privacy', target: '_blank' },
|
|
857
|
+
'Privacy Policy'
|
|
858
|
+
)
|
|
859
|
+
)
|
|
860
|
+
)
|
|
861
|
+
),
|
|
814
862
|
React__default.createElement(
|
|
815
863
|
Button,
|
|
816
864
|
{ disabled: sendingData, className: 'btn btn-primary mb-3', type: 'submit' },
|
|
@@ -961,12 +1009,13 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
961
1009
|
rootCloseEvent: 'click',
|
|
962
1010
|
key: key,
|
|
963
1011
|
ref: function ref(el) {
|
|
964
|
-
|
|
1012
|
+
console.dir(el);
|
|
1013
|
+
overLayRef.current[key] = el;
|
|
965
1014
|
},
|
|
966
1015
|
trigger: triggerAction,
|
|
967
1016
|
placement: placementLocation,
|
|
968
1017
|
delay: { show: 250, hide: 400 },
|
|
969
|
-
overlay: isGatedPDFPopOver() },
|
|
1018
|
+
overlay: isGatedPDFPopOver(key) },
|
|
970
1019
|
React__default.createElement(
|
|
971
1020
|
'button',
|
|
972
1021
|
{ rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
|
|
@@ -1047,7 +1096,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1047
1096
|
trigger: triggerAction,
|
|
1048
1097
|
placement: placementLocation,
|
|
1049
1098
|
delay: { show: 250, hide: 400 },
|
|
1050
|
-
overlay: isGatedPDFPopOver() },
|
|
1099
|
+
overlay: isGatedPDFPopOver(key) },
|
|
1051
1100
|
React__default.createElement(
|
|
1052
1101
|
'button',
|
|
1053
1102
|
{ rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
|