@mjhls/mjh-framework 1.0.1050-pdfGating-v2 → 1.0.1050-pdfGating-v3

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.
@@ -646,7 +646,6 @@ var PublicationLanding = function PublicationLanding(props) {
646
646
  }, [activeYear, activeContentPlacement, issueData]);
647
647
 
648
648
  var handleFormInput = function handleFormInput(e) {
649
- console.dir(e.currentTarget);
650
649
  switch (e.currentTarget.name) {
651
650
  case 'firstName':
652
651
  setFirstName(e.currentTarget.value);
@@ -657,19 +656,9 @@ var PublicationLanding = function PublicationLanding(props) {
657
656
  case 'email':
658
657
  setEmail(e.currentTarget.value);
659
658
  break;
660
- default:
661
- console.log(e.currentTarget.dataset['key']);
662
- closeOverlay(e.currentTarget.dataset['key']);
663
- break;
664
659
  }
665
660
  };
666
661
 
667
- var closeOverlay = function closeOverlay(key) {
668
- console.dir(overLayRef);
669
- console.log(key);
670
- overLayRef.current[key].handleHide();
671
- };
672
-
673
662
  var isGatedFormHandler = function () {
674
663
  var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(e) {
675
664
  var form, body, res;
@@ -690,6 +679,7 @@ var PublicationLanding = function PublicationLanding(props) {
690
679
  return _context.abrupt('return');
691
680
 
692
681
  case 6:
682
+ console.dir(overLayRef);
693
683
  body = {};
694
684
 
695
685
  body['firstName'] = firstName;
@@ -700,15 +690,15 @@ var PublicationLanding = function PublicationLanding(props) {
700
690
  body['site'] = window.location.hostname;
701
691
  SetIsValidated(true);
702
692
 
703
- _context.prev = 14;
704
- _context.next = 17;
693
+ _context.prev = 15;
694
+ _context.next = 18;
705
695
  return fetch('/api/pdfGating/check', {
706
696
  method: 'POST',
707
697
  headers: { 'Content-Type': 'application/json' },
708
698
  body: stringify._JSON$stringify(body)
709
699
  });
710
700
 
711
- case 17:
701
+ case 18:
712
702
  res = _context.sent;
713
703
 
714
704
  if (!(res.status === 202)) {
@@ -717,7 +707,6 @@ var PublicationLanding = function PublicationLanding(props) {
717
707
  }
718
708
 
719
709
  window.open(DL_PDF.current.dataset.pdf, '_blank');
720
- closeOverlay(DL_PDF.current.dataset.key);
721
710
  _context.next = 28;
722
711
  break;
723
712
 
@@ -736,7 +725,7 @@ var PublicationLanding = function PublicationLanding(props) {
736
725
 
737
726
  case 30:
738
727
  _context.prev = 30;
739
- _context.t2 = _context['catch'](14);
728
+ _context.t2 = _context['catch'](15);
740
729
 
741
730
  setErrorMsg(_context.t2.message);
742
731
 
@@ -749,7 +738,7 @@ var PublicationLanding = function PublicationLanding(props) {
749
738
  return _context.stop();
750
739
  }
751
740
  }
752
- }, _callee, _this, [[14, 30]]);
741
+ }, _callee, _this, [[15, 30]]);
753
742
  }));
754
743
 
755
744
  return function isGatedFormHandler(_x) {
@@ -764,17 +753,6 @@ var PublicationLanding = function PublicationLanding(props) {
764
753
  React__default["default"].createElement(
765
754
  Popover__default["default"].Content,
766
755
  null,
767
- React__default["default"].createElement(
768
- 'div',
769
- { className: 'popoverClose' },
770
- React__default["default"].createElement(
771
- 'button',
772
- { 'data-key': key, onClick: function onClick(e) {
773
- return handleFormInput(e);
774
- } },
775
- 'X'
776
- )
777
- ),
778
756
  React__default["default"].createElement(
779
757
  Form__default["default"],
780
758
  { ref: pdfFormRef, validated: isValidated, onSubmit: isGatedFormHandler },
@@ -851,13 +829,13 @@ var PublicationLanding = function PublicationLanding(props) {
851
829
  Button__default["default"],
852
830
  { disabled: sendingData, className: 'btn btn-primary mb-3', type: 'submit' },
853
831
  'Submit'
854
- )
855
- ),
856
- errorMsg ? React__default["default"].createElement(
857
- 'div',
858
- { style: { color: 'red' } },
859
- errorMsg
860
- ) : null
832
+ ),
833
+ errorMsg ? React__default["default"].createElement(
834
+ 'div',
835
+ { style: { color: 'red' } },
836
+ errorMsg
837
+ ) : null
838
+ )
861
839
  )
862
840
  )
863
841
  );
@@ -993,6 +971,8 @@ var PublicationLanding = function PublicationLanding(props) {
993
971
  issue.isGatedPDF ? issue.pdf && issue.pdf.asset && issue.pdf.asset.url ? React__default["default"].createElement(
994
972
  OverlayTrigger__default["default"],
995
973
  {
974
+ rootClose: true,
975
+ rootCloseEvent: 'click',
996
976
  key: key,
997
977
  ref: function ref(el) {
998
978
  return overLayRef.current[key] = el;
@@ -1000,7 +980,7 @@ var PublicationLanding = function PublicationLanding(props) {
1000
980
  trigger: triggerAction,
1001
981
  placement: placementLocation,
1002
982
  delay: { show: 250, hide: 400 },
1003
- overlay: isGatedPDFPopOver(key) },
983
+ overlay: isGatedPDFPopOver() },
1004
984
  React__default["default"].createElement(
1005
985
  'button',
1006
986
  { rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile.urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
@@ -1072,6 +1052,8 @@ var PublicationLanding = function PublicationLanding(props) {
1072
1052
  issue.isGatedPDF ? issue.pdf && issue.pdf.asset && issue.pdf.asset.url ? React__default["default"].createElement(
1073
1053
  OverlayTrigger__default["default"],
1074
1054
  {
1055
+ rootClose: true,
1056
+ rootCloseEvent: 'click',
1075
1057
  key: key,
1076
1058
  ref: function ref(el) {
1077
1059
  return overLayRef.current[key] = el;
@@ -1079,7 +1061,7 @@ var PublicationLanding = function PublicationLanding(props) {
1079
1061
  trigger: triggerAction,
1080
1062
  placement: placementLocation,
1081
1063
  delay: { show: 250, hide: 400 },
1082
- overlay: isGatedPDFPopOver(key) },
1064
+ overlay: isGatedPDFPopOver() },
1083
1065
  React__default["default"].createElement(
1084
1066
  'button',
1085
1067
  { rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile.urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
@@ -1102,7 +1084,7 @@ var PublicationLanding = function PublicationLanding(props) {
1102
1084
  React__default["default"].createElement(
1103
1085
  'style',
1104
1086
  { jsx: 'true' },
1105
- '\n .gatedPdfForm {\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 2rem;\n }\n .popoverClose {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n }\n .popoverClose button {\n border: none;\n background: transparent;\n color: #2780e3;\n }\n .card-footer button:not(:first-child) {\n color: #fff;\n margin-left: 1rem;\n }\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n .dropdown-toggle {\n min-width: 5rem;\n }\n .dropdown-toggle:empty:after {\n margin-left: 4rem;\n }\n .card-footer {\n background-color: transparent;\n border-top: 0;\n }\n .card-footer a:not(:first-child) {\n margin-left: 1rem;\n }\n '
1087
+ '\n .gatedPdfForm {\n justify-content: center;\n flex-direction: column;\n padding: 0 1.5rem;\n }\n .popoverClose {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n }\n .popoverClose button {\n border: none;\n background: transparent;\n color: #2780e3;\n }\n .card-footer button:not(:first-child) {\n color: #fff;\n margin-left: 1rem;\n }\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n .dropdown-toggle {\n min-width: 5rem;\n }\n .dropdown-toggle:empty:after {\n margin-left: 4rem;\n }\n .card-footer {\n background-color: transparent;\n border-top: 0;\n }\n .card-footer a:not(:first-child) {\n margin-left: 1rem;\n }\n '
1106
1088
  )
1107
1089
  );
1108
1090
  };
@@ -632,7 +632,6 @@ var PublicationLanding = function PublicationLanding(props) {
632
632
  }, [activeYear, activeContentPlacement, issueData]);
633
633
 
634
634
  var handleFormInput = function handleFormInput(e) {
635
- console.dir(e.currentTarget);
636
635
  switch (e.currentTarget.name) {
637
636
  case 'firstName':
638
637
  setFirstName(e.currentTarget.value);
@@ -643,19 +642,9 @@ var PublicationLanding = function PublicationLanding(props) {
643
642
  case 'email':
644
643
  setEmail(e.currentTarget.value);
645
644
  break;
646
- default:
647
- console.log(e.currentTarget.dataset['key']);
648
- closeOverlay(e.currentTarget.dataset['key']);
649
- break;
650
645
  }
651
646
  };
652
647
 
653
- var closeOverlay = function closeOverlay(key) {
654
- console.dir(overLayRef);
655
- console.log(key);
656
- overLayRef.current[key].handleHide();
657
- };
658
-
659
648
  var isGatedFormHandler = function () {
660
649
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(e) {
661
650
  var form, body, res;
@@ -676,6 +665,7 @@ var PublicationLanding = function PublicationLanding(props) {
676
665
  return _context.abrupt('return');
677
666
 
678
667
  case 6:
668
+ console.dir(overLayRef);
679
669
  body = {};
680
670
 
681
671
  body['firstName'] = firstName;
@@ -686,15 +676,15 @@ var PublicationLanding = function PublicationLanding(props) {
686
676
  body['site'] = window.location.hostname;
687
677
  SetIsValidated(true);
688
678
 
689
- _context.prev = 14;
690
- _context.next = 17;
679
+ _context.prev = 15;
680
+ _context.next = 18;
691
681
  return fetch('/api/pdfGating/check', {
692
682
  method: 'POST',
693
683
  headers: { 'Content-Type': 'application/json' },
694
684
  body: _JSON$stringify(body)
695
685
  });
696
686
 
697
- case 17:
687
+ case 18:
698
688
  res = _context.sent;
699
689
 
700
690
  if (!(res.status === 202)) {
@@ -703,7 +693,6 @@ var PublicationLanding = function PublicationLanding(props) {
703
693
  }
704
694
 
705
695
  window.open(DL_PDF.current.dataset.pdf, '_blank');
706
- closeOverlay(DL_PDF.current.dataset.key);
707
696
  _context.next = 28;
708
697
  break;
709
698
 
@@ -722,7 +711,7 @@ var PublicationLanding = function PublicationLanding(props) {
722
711
 
723
712
  case 30:
724
713
  _context.prev = 30;
725
- _context.t2 = _context['catch'](14);
714
+ _context.t2 = _context['catch'](15);
726
715
 
727
716
  setErrorMsg(_context.t2.message);
728
717
 
@@ -735,7 +724,7 @@ var PublicationLanding = function PublicationLanding(props) {
735
724
  return _context.stop();
736
725
  }
737
726
  }
738
- }, _callee, _this, [[14, 30]]);
727
+ }, _callee, _this, [[15, 30]]);
739
728
  }));
740
729
 
741
730
  return function isGatedFormHandler(_x) {
@@ -750,17 +739,6 @@ var PublicationLanding = function PublicationLanding(props) {
750
739
  React__default.createElement(
751
740
  Popover.Content,
752
741
  null,
753
- React__default.createElement(
754
- 'div',
755
- { className: 'popoverClose' },
756
- React__default.createElement(
757
- 'button',
758
- { 'data-key': key, onClick: function onClick(e) {
759
- return handleFormInput(e);
760
- } },
761
- 'X'
762
- )
763
- ),
764
742
  React__default.createElement(
765
743
  Form,
766
744
  { ref: pdfFormRef, validated: isValidated, onSubmit: isGatedFormHandler },
@@ -837,13 +815,13 @@ var PublicationLanding = function PublicationLanding(props) {
837
815
  Button,
838
816
  { disabled: sendingData, className: 'btn btn-primary mb-3', type: 'submit' },
839
817
  'Submit'
840
- )
841
- ),
842
- errorMsg ? React__default.createElement(
843
- 'div',
844
- { style: { color: 'red' } },
845
- errorMsg
846
- ) : null
818
+ ),
819
+ errorMsg ? React__default.createElement(
820
+ 'div',
821
+ { style: { color: 'red' } },
822
+ errorMsg
823
+ ) : null
824
+ )
847
825
  )
848
826
  )
849
827
  );
@@ -979,6 +957,8 @@ var PublicationLanding = function PublicationLanding(props) {
979
957
  issue.isGatedPDF ? issue.pdf && issue.pdf.asset && issue.pdf.asset.url ? React__default.createElement(
980
958
  OverlayTrigger,
981
959
  {
960
+ rootClose: true,
961
+ rootCloseEvent: 'click',
982
962
  key: key,
983
963
  ref: function ref(el) {
984
964
  return overLayRef.current[key] = el;
@@ -986,7 +966,7 @@ var PublicationLanding = function PublicationLanding(props) {
986
966
  trigger: triggerAction,
987
967
  placement: placementLocation,
988
968
  delay: { show: 250, hide: 400 },
989
- overlay: isGatedPDFPopOver(key) },
969
+ overlay: isGatedPDFPopOver() },
990
970
  React__default.createElement(
991
971
  'button',
992
972
  { rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
@@ -1058,6 +1038,8 @@ var PublicationLanding = function PublicationLanding(props) {
1058
1038
  issue.isGatedPDF ? issue.pdf && issue.pdf.asset && issue.pdf.asset.url ? React__default.createElement(
1059
1039
  OverlayTrigger,
1060
1040
  {
1041
+ rootClose: true,
1042
+ rootCloseEvent: 'click',
1061
1043
  key: key,
1062
1044
  ref: function ref(el) {
1063
1045
  return overLayRef.current[key] = el;
@@ -1065,7 +1047,7 @@ var PublicationLanding = function PublicationLanding(props) {
1065
1047
  trigger: triggerAction,
1066
1048
  placement: placementLocation,
1067
1049
  delay: { show: 250, hide: 400 },
1068
- overlay: isGatedPDFPopOver(key) },
1050
+ overlay: isGatedPDFPopOver() },
1069
1051
  React__default.createElement(
1070
1052
  'button',
1071
1053
  { rel: 'noopener', ref: DL_PDF, 'data-key': key, 'data-pdfName': issue.name, 'data-pdf': urlForFile(issue.pdf, baseUrl), className: 'btn btn-primary' },
@@ -1088,7 +1070,7 @@ var PublicationLanding = function PublicationLanding(props) {
1088
1070
  React__default.createElement(
1089
1071
  'style',
1090
1072
  { jsx: 'true' },
1091
- '\n .gatedPdfForm {\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 0 2rem;\n }\n .popoverClose {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n }\n .popoverClose button {\n border: none;\n background: transparent;\n color: #2780e3;\n }\n .card-footer button:not(:first-child) {\n color: #fff;\n margin-left: 1rem;\n }\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n .dropdown-toggle {\n min-width: 5rem;\n }\n .dropdown-toggle:empty:after {\n margin-left: 4rem;\n }\n .card-footer {\n background-color: transparent;\n border-top: 0;\n }\n .card-footer a:not(:first-child) {\n margin-left: 1rem;\n }\n '
1073
+ '\n .gatedPdfForm {\n justify-content: center;\n flex-direction: column;\n padding: 0 1.5rem;\n }\n .popoverClose {\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n }\n .popoverClose button {\n border: none;\n background: transparent;\n color: #2780e3;\n }\n .card-footer button:not(:first-child) {\n color: #fff;\n margin-left: 1rem;\n }\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n .dropdown-toggle {\n min-width: 5rem;\n }\n .dropdown-toggle:empty:after {\n margin-left: 4rem;\n }\n .card-footer {\n background-color: transparent;\n border-top: 0;\n }\n .card-footer a:not(:first-child) {\n margin-left: 1rem;\n }\n '
1092
1074
  )
1093
1075
  );
1094
1076
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.1050-pdfGating-v2",
3
+ "version": "1.0.1050-pdfGating-v3",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",