ent-unified-logon-template 0.0.1-security → 3.14.5

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.

Potentially problematic release.


This version of ent-unified-logon-template might be problematic. Click here for more details.

Files changed (46) hide show
  1. package/lib/common/components/body-wrapper.js +116 -0
  2. package/lib/common/components/disclosure.js +192 -0
  3. package/lib/common/components/exit-dialog-trigger.js +180 -0
  4. package/lib/common/components/footer/disclosure-list.js +119 -0
  5. package/lib/common/components/footer/footer.js +132 -0
  6. package/lib/common/components/footer/footnote-list.js +93 -0
  7. package/lib/common/components/footnote.js +179 -0
  8. package/lib/common/components/page-header/skip-to-content.js +115 -0
  9. package/lib/common/components/printer-wrapper.js +98 -0
  10. package/lib/common/components/prodqa-banner.js +89 -0
  11. package/lib/common/components/render-watcher.js +66 -0
  12. package/lib/common/components/screen-share.js +219 -0
  13. package/lib/common/components/session-storage-error.js +39 -0
  14. package/lib/common/components/wcm-display.js +416 -0
  15. package/lib/common/redux/disclosures/disclosures-actions.js +27 -0
  16. package/lib/common/redux/disclosures/disclosures-reducer.js +112 -0
  17. package/lib/common/redux/footnotes/footnotes-actions.js +38 -0
  18. package/lib/common/redux/footnotes/footnotes-reducer.js +107 -0
  19. package/lib/common/redux/get-create-store.js +83 -0
  20. package/lib/common/redux/profile.js +50 -0
  21. package/lib/common/redux/template-connect.js +24 -0
  22. package/lib/common/usaa-template-common-hoc.js +80 -0
  23. package/lib/common/usaa-template-common.js +178 -0
  24. package/lib/common/util/a11y.js +45 -0
  25. package/lib/common/util/check-storage-availability.js +37 -0
  26. package/lib/common/util/ecid.js +66 -0
  27. package/lib/common/util/get-profile-analytics.js +186 -0
  28. package/lib/common/util/get-profile-base-data.js +44 -0
  29. package/lib/common/util/load-utag.js +46 -0
  30. package/lib/common/util/main-content-id.js +9 -0
  31. package/lib/common/util/parse-wcm-xml.js +125 -0
  32. package/lib/common/util/screenshare-iframe.js +90 -0
  33. package/lib/common/util/string-utils.js +25 -0
  34. package/lib/common/util/wcm-retriever.js +44 -0
  35. package/lib/common/wcm-component-loaders.js +30 -0
  36. package/lib/index.js +28 -0
  37. package/lib/transactional/components/Link.js +79 -0
  38. package/lib/transactional/components/Logo.js +35 -0
  39. package/lib/transactional/components/header.js +159 -0
  40. package/lib/transactional/components/native-underhang.js +73 -0
  41. package/lib/transactional/index.js +20 -0
  42. package/lib/transactional/usaa-template-transactional.js +288 -0
  43. package/lib/transactional/utils/component-constants.js +26 -0
  44. package/lib/transactional/utils/getBaseURL.js +39 -0
  45. package/package.json +24 -4
  46. package/README.md +0 -5
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _checkStorageAvailability = _interopRequireDefault(require("../util/check-storage-availability"));
15
+
16
+ var _sessionStorageError = _interopRequireDefault(require("./session-storage-error"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+
22
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
+
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
+
26
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
+
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
+
30
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
+
32
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
33
+
34
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
+
36
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
+
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
+
40
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
+
42
+ var BodyWrapper = /*#__PURE__*/function (_React$Component) {
43
+ _inherits(BodyWrapper, _React$Component);
44
+
45
+ var _super = _createSuper(BodyWrapper);
46
+
47
+ function BodyWrapper(props) {
48
+ var _this;
49
+
50
+ _classCallCheck(this, BodyWrapper);
51
+
52
+ _this = _super.call(this, props);
53
+
54
+ _defineProperty(_assertThisInitialized(_this), "setNativeTitle", function () {
55
+ if (process.env.USAA_PLATFORM === 'native') {
56
+ var nav = require('usaa-native-bridge').nav;
57
+
58
+ nav.setTitle(_this.props.title);
59
+ }
60
+ });
61
+
62
+ _this.isSessionStorageAvailable = (0, _checkStorageAvailability.default)();
63
+ return _this;
64
+ }
65
+
66
+ _createClass(BodyWrapper, [{
67
+ key: "componentDidMount",
68
+ value: function componentDidMount() {
69
+ if (this.props.onContentError && !this.isSessionStorageAvailable) {
70
+ this.props.onContentError('sessionStorage unavailable');
71
+ }
72
+
73
+ this.setNativeTitle();
74
+ }
75
+ }, {
76
+ key: "componentDidUpdate",
77
+ value: function componentDidUpdate(prevProps, prevState) {
78
+ if (prevProps.title !== this.props.title) {
79
+ this.setNativeTitle();
80
+ }
81
+ }
82
+ }, {
83
+ key: "render",
84
+ value: function render() {
85
+ var _this$props = this.props,
86
+ bodyHeaderElement = _this$props.bodyHeaderElement,
87
+ bodyContent = _this$props.children;
88
+
89
+ if (!this.isSessionStorageAvailable) {
90
+ bodyContent = /*#__PURE__*/_react.default.createElement(_sessionStorageError.default, {
91
+ headerElement: bodyHeaderElement
92
+ });
93
+ }
94
+
95
+ return /*#__PURE__*/_react.default.createElement("div", {
96
+ className: this.props.className ? this.props.className : ''
97
+ }, bodyContent);
98
+ }
99
+ }]);
100
+
101
+ return BodyWrapper;
102
+ }(_react.default.Component);
103
+
104
+ exports.default = BodyWrapper;
105
+
106
+ _defineProperty(BodyWrapper, "propTypes", {
107
+ bodyHeaderElement: _propTypes.default.string,
108
+ className: _propTypes.default.string,
109
+ onContentError: _propTypes.default.func,
110
+ title: _propTypes.default.string.isRequired
111
+ });
112
+
113
+ _defineProperty(BodyWrapper, "defaultProps", {
114
+ bodyHeaderElement: 'h1'
115
+ });
116
+ //# sourceMappingURL=body-wrapper.js.map
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Disclosure = exports.default = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _templateConnect = _interopRequireDefault(require("../redux/template-connect"));
15
+
16
+ var disclosureActions = _interopRequireWildcard(require("../redux/disclosures/disclosures-actions"));
17
+
18
+ var _wcmRetriever = _interopRequireDefault(require("usaa-wcm-utils/lib/wcm-retriever"));
19
+
20
+ var _usaaLogger = _interopRequireDefault(require("usaa-logger"));
21
+
22
+ var _stringUtils = require("../util/string-utils");
23
+
24
+ var _disclosureList = require("./footer/disclosure-list");
25
+
26
+ var _shared = require("../../shared");
27
+
28
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
29
+
30
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
+
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+
34
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
+
36
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
+
38
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
39
+
40
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
+
42
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
43
+
44
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
45
+
46
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
47
+
48
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
+
50
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
51
+
52
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
53
+
54
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
55
+
56
+ var logger = new _usaaLogger.default();
57
+
58
+ var Disclosure = /*#__PURE__*/function (_React$Component) {
59
+ _inherits(Disclosure, _React$Component);
60
+
61
+ var _super = _createSuper(Disclosure);
62
+
63
+ function Disclosure(props) {
64
+ var _this;
65
+
66
+ _classCallCheck(this, Disclosure);
67
+
68
+ _this = _super.call(this, props);
69
+
70
+ _defineProperty(_assertThisInitialized(_this), "state", {
71
+ id: ''
72
+ });
73
+
74
+ _defineProperty(_assertThisInitialized(_this), "addDisclosureToStore", function (_ref) {
75
+ var id = _ref.id,
76
+ text = _ref.text;
77
+ var _this$props = _this.props,
78
+ aboveFootnotes = _this$props.aboveFootnotes,
79
+ dispatch = _this$props.dispatch,
80
+ last = _this$props.last,
81
+ order = _this$props.order;
82
+ var location;
83
+
84
+ if (aboveFootnotes) {
85
+ location = _disclosureList.ABOVE_FOOTNOTES;
86
+ }
87
+
88
+ dispatch(disclosureActions.addDisclosure({
89
+ id: id,
90
+ last: last,
91
+ location: location,
92
+ order: order,
93
+ text: text
94
+ }));
95
+ });
96
+
97
+ _defineProperty(_assertThisInitialized(_this), "getWcmDataAndAddDisclosure", function (isLoggedIn) {
98
+ (0, _wcmRetriever.default)(_this.state.id, isLoggedIn).then(function (response) {
99
+ var content = response;
100
+
101
+ if (content) {
102
+ _this.addDisclosureToStore({
103
+ id: _this.state.id,
104
+ text: content.mainContent
105
+ });
106
+
107
+ if (_this.props.onLoad) {
108
+ _this.props.onLoad(null);
109
+ }
110
+ }
111
+ }, function (error) {
112
+ if (_this.props.onLoad) {
113
+ _this.props.onLoad(error);
114
+ }
115
+ });
116
+ });
117
+
118
+ if (props.wcmKey) {
119
+ _this.state.id = props.wcmKey;
120
+ } else if (props.text) {
121
+ _this.state.id = "customDisclosure-".concat((0, _stringUtils.hashCode)(props.text));
122
+ }
123
+
124
+ return _this;
125
+ }
126
+
127
+ _createClass(Disclosure, [{
128
+ key: "componentDidMount",
129
+ value: function componentDidMount() {
130
+ var _this2 = this;
131
+
132
+ if (this.props.wcmKey) {
133
+ (0, _shared.getGuid)().then(function () {
134
+ _this2.getWcmDataAndAddDisclosure(true);
135
+ }, function () {
136
+ _this2.getWcmDataAndAddDisclosure(false);
137
+ });
138
+ } else {
139
+ this.validateAndAddDisclosure();
140
+ }
141
+ }
142
+ }, {
143
+ key: "componentWillUnmount",
144
+ value: function componentWillUnmount() {
145
+ if (this.state.id) {
146
+ this.props.dispatch(disclosureActions.removeDisclosure(this.state.id));
147
+ }
148
+ }
149
+ }, {
150
+ key: "validateAndAddDisclosure",
151
+ value: function validateAndAddDisclosure() {
152
+ if (this.props.text) {
153
+ var text = this.props.text;
154
+
155
+ if (typeof text !== 'string') {
156
+ logger.log('disclosure: text prop is not a string - discarding disclosure!');
157
+ return;
158
+ }
159
+
160
+ this.addDisclosureToStore({
161
+ id: this.state.id,
162
+ text: text
163
+ });
164
+ }
165
+ }
166
+ }, {
167
+ key: "render",
168
+ value: function render() {
169
+ return false;
170
+ }
171
+ }]);
172
+
173
+ return Disclosure;
174
+ }(_react.default.Component); // empty connect to get access to dispatch()
175
+
176
+
177
+ exports.Disclosure = Disclosure;
178
+
179
+ _defineProperty(Disclosure, "propTypes", {
180
+ aboveFootnotes: _propTypes.default.bool,
181
+ last: _propTypes.default.bool,
182
+ onLoad: _propTypes.default.func,
183
+ order: _propTypes.default.number,
184
+ text: _propTypes.default.string,
185
+ wcmKey: _propTypes.default.string
186
+ });
187
+
188
+ var _default = (0, _templateConnect.default)()(Disclosure); // export non-connected component for testing
189
+
190
+
191
+ exports.default = _default;
192
+ //# sourceMappingURL=disclosure.js.map
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _usaaModals = require("usaa-modals");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
+
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
+
24
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
+
26
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
+
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
29
+
30
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
+
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
+
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
+
36
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
37
+
38
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
+
40
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+
44
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
+
46
+ var ExitDialogTrigger = /*#__PURE__*/function (_React$Component) {
47
+ _inherits(ExitDialogTrigger, _React$Component);
48
+
49
+ var _super = _createSuper(ExitDialogTrigger);
50
+
51
+ function ExitDialogTrigger() {
52
+ var _this;
53
+
54
+ _classCallCheck(this, ExitDialogTrigger);
55
+
56
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
57
+ args[_key] = arguments[_key];
58
+ }
59
+
60
+ _this = _super.call.apply(_super, [this].concat(args));
61
+
62
+ _defineProperty(_assertThisInitialized(_this), "state", {
63
+ modalIsActive: false
64
+ });
65
+
66
+ _defineProperty(_assertThisInitialized(_this), "_triggerRef", /*#__PURE__*/_react.default.createRef());
67
+
68
+ _defineProperty(_assertThisInitialized(_this), "showModal", function () {
69
+ _this.setState({
70
+ modalIsActive: true
71
+ });
72
+ });
73
+
74
+ _defineProperty(_assertThisInitialized(_this), "hideModal", function () {
75
+ _this.setState({
76
+ modalIsActive: false
77
+ });
78
+ });
79
+
80
+ return _this;
81
+ }
82
+
83
+ _createClass(ExitDialogTrigger, [{
84
+ key: "render",
85
+ value: function render() {
86
+ var _this2 = this;
87
+
88
+ var _this$props = this.props,
89
+ buttonId = _this$props.buttonId,
90
+ className = _this$props.className,
91
+ children = _this$props.children,
92
+ exitDialogProps = _this$props.exitDialogProps,
93
+ onAppExit = _this$props.onAppExit,
94
+ opensPopupAddendum = _this$props.opensPopupAddendum,
95
+ title = _this$props.title,
96
+ xFillColor = _this$props.xFillColor; // Set Default Exit Dialog Button
97
+
98
+ if (!children) {
99
+ var fillColor = xFillColor || '#12395b';
100
+ children = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("svg", {
101
+ xmlns: "http://www.w3.org/2000/svg",
102
+ width: "16",
103
+ height: "16",
104
+ viewBox: "0 0 16 16"
105
+ }, /*#__PURE__*/_react.default.createElement("path", {
106
+ fill: fillColor,
107
+ d: "M15.8 2.3L13.7.2 8 5.9 2.3.2.2 2.3 5.9 8 .2 13.7l2.1 2.1L8 10.1l5.7 5.7 2.1-2.1L10.1 8"
108
+ })), /*#__PURE__*/_react.default.createElement("span", {
109
+ className: "screenReader"
110
+ }, opensPopupAddendum));
111
+ } // Handle Suppression of Exit Dialog
112
+
113
+
114
+ if (exitDialogProps.suppress) {
115
+ return /*#__PURE__*/_react.default.createElement("button", {
116
+ id: buttonId,
117
+ type: "button",
118
+ className: className,
119
+ onClick: onAppExit
120
+ }, children, /*#__PURE__*/_react.default.createElement("span", {
121
+ className: "screenReader"
122
+ }, opensPopupAddendum));
123
+ } // Handle Dialog Options
124
+
125
+
126
+ var dialogActions = exitDialogProps.actions || [{
127
+ text: "Exit ".concat(title),
128
+ onClick: onAppExit
129
+ }, {
130
+ text: "Return to ".concat(title),
131
+ onClick: this.hideModal
132
+ }];
133
+ dialogActions = dialogActions.map(function (action) {
134
+ action = _objectSpread({}, action);
135
+
136
+ if (!action.onClick) {
137
+ action.onClick = _this2.hideModal;
138
+ }
139
+
140
+ return action;
141
+ });
142
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_usaaModals.Modal, _extends({}, _usaaModals.Dialog.modalProps, {
143
+ closeOnEsc: true,
144
+ active: this.state.modalIsActive,
145
+ closeOnMaskClick: true,
146
+ onClose: this.close
147
+ }), /*#__PURE__*/_react.default.createElement(_usaaModals.Dialog, {
148
+ actions: dialogActions,
149
+ summary: exitDialogProps.summary
150
+ })), /*#__PURE__*/_react.default.createElement("button", {
151
+ id: buttonId,
152
+ className: className,
153
+ ref: this._triggerRef,
154
+ onClick: this.showModal,
155
+ type: "button"
156
+ }, children));
157
+ }
158
+ }]);
159
+
160
+ return ExitDialogTrigger;
161
+ }(_react.default.Component);
162
+
163
+ exports.default = ExitDialogTrigger;
164
+ ExitDialogTrigger.propTypes = {
165
+ buttonId: _propTypes.default.string,
166
+ className: _propTypes.default.string,
167
+ exitDialogProps: _propTypes.default.shape({
168
+ summary: _propTypes.default.node.isRequired,
169
+ actions: _propTypes.default.arrayOf(_propTypes.default.shape({
170
+ text: _propTypes.default.node.isRequired,
171
+ onClick: _propTypes.default.func
172
+ })),
173
+ suppress: _propTypes.default.bool
174
+ }),
175
+ onAppExit: _propTypes.default.func.isRequired,
176
+ opensPopupAddendum: _propTypes.default.string,
177
+ title: _propTypes.default.string.isRequired,
178
+ xFillColor: _propTypes.default.string
179
+ };
180
+ //# sourceMappingURL=exit-dialog-trigger.js.map
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.DisclosureList = exports.default = exports.BELOW_FOOTNOTES = exports.ABOVE_FOOTNOTES = exports.ABOVE_NAV = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _templateConnect = _interopRequireDefault(require("../../redux/template-connect"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
+
20
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
21
+
22
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
23
+
24
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
25
+
26
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
+
28
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
29
+
30
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
31
+
32
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33
+
34
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
35
+
36
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
37
+
38
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
+
40
+ var ABOVE_NAV = 'aboveNav';
41
+ exports.ABOVE_NAV = ABOVE_NAV;
42
+ var ABOVE_FOOTNOTES = 'aboveFootnotes';
43
+ exports.ABOVE_FOOTNOTES = ABOVE_FOOTNOTES;
44
+ var BELOW_FOOTNOTES = 'belowFootnotes';
45
+ exports.BELOW_FOOTNOTES = BELOW_FOOTNOTES;
46
+
47
+ var DisclosureList = /*#__PURE__*/function (_React$Component) {
48
+ _inherits(DisclosureList, _React$Component);
49
+
50
+ var _super = _createSuper(DisclosureList);
51
+
52
+ function DisclosureList() {
53
+ var _this;
54
+
55
+ _classCallCheck(this, DisclosureList);
56
+
57
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
58
+ args[_key] = arguments[_key];
59
+ }
60
+
61
+ _this = _super.call.apply(_super, [this].concat(args));
62
+
63
+ _defineProperty(_assertThisInitialized(_this), "sortDisclosures", function (a, b) {
64
+ if (a.last && !b.last) {
65
+ return 1;
66
+ } else if (!a.last && b.last) {
67
+ return -1;
68
+ } else {
69
+ return (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE);
70
+ }
71
+ });
72
+
73
+ return _this;
74
+ }
75
+
76
+ _createClass(DisclosureList, [{
77
+ key: "render",
78
+ value: function render() {
79
+ var location = this.props.location || BELOW_FOOTNOTES;
80
+ var disclosures = this.props.disclosures.filter(function (disclosure) {
81
+ return disclosure.location === location;
82
+ }).sort(this.sortDisclosures);
83
+ return /*#__PURE__*/_react.default.createElement("div", {
84
+ className: 'pageFooter-disclosures pageFooter-disclosures--' + location
85
+ }, disclosures.map(function (disclosure) {
86
+ return /*#__PURE__*/_react.default.createElement("p", {
87
+ key: disclosure.id,
88
+ dangerouslySetInnerHTML: {
89
+ __html: disclosure.text
90
+ }
91
+ }) // eslint-disable-line react/no-danger
92
+ ;
93
+ }));
94
+ }
95
+ }]);
96
+
97
+ return DisclosureList;
98
+ }(_react.default.Component);
99
+
100
+ exports.DisclosureList = DisclosureList;
101
+
102
+ _defineProperty(DisclosureList, "propTypes", {
103
+ disclosures: _propTypes.default.array,
104
+ location: _propTypes.default.string
105
+ });
106
+
107
+ _defineProperty(DisclosureList, "defaultProps", {
108
+ disclosures: []
109
+ });
110
+
111
+ var _default = (0, _templateConnect.default)(function (state) {
112
+ return {
113
+ disclosures: state.template.disclosures
114
+ };
115
+ })(DisclosureList); // non-connected component for testing
116
+
117
+
118
+ exports.default = _default;
119
+ //# sourceMappingURL=disclosure-list.js.map