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,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+
8
+ var _axios = _interopRequireDefault(require("axios"));
9
+
10
+ var _cookie = _interopRequireDefault(require("cookie"));
11
+
12
+ var _usaaLogger = _interopRequireDefault(require("usaa-logger"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ var COOKIE_NAME = 'ECID';
17
+ var ecidServiceUrl = "https://api.usaa.com/enterprise/ecid-generator/v1/ecid"; // TODO: DEPRECATE
18
+ // channel is no longer a requirement
19
+ // keep to support older component versions
20
+
21
+ var STANDARD_COOKIE = 'MemberECID'; // member channel
22
+
23
+ var MOBILE_COOKIE = 'MobileMemberECID'; //mobile
24
+
25
+ /**
26
+ * Calls the ECID generator service then sets ECID if needed
27
+ *
28
+ * @param axios: axios instance (optional)
29
+ * @returns nothing
30
+ */
31
+
32
+ function _default() {
33
+ if (typeof document == 'undefined') {
34
+ return;
35
+ }
36
+
37
+ var logger = new _usaaLogger.default();
38
+
39
+ var cookies = _cookie.default.parse(document.cookie);
40
+
41
+ var currentCookie = cookies[COOKIE_NAME];
42
+
43
+ if (!currentCookie) {
44
+ _axios.default.get(ecidServiceUrl).then(function (response) {
45
+ // set ecid cookie
46
+ document.cookie = setCookie(COOKIE_NAME, response.data.ecid);
47
+ document.cookie = setCookie(getOldEcidCookieName(), response.data.ecid); // DEPRECATE
48
+ }, function (error) {
49
+ var message = 'ecid: Error when requesting ECID generator service.';
50
+ logger.error(error, message);
51
+ });
52
+ }
53
+ } // set cookie value
54
+
55
+
56
+ function setCookie(cookieName, ecid) {
57
+ return cookieName + '=' + ecid + '; path=/; domain=.usaa.com';
58
+ } // TODO: DEPRECATE
59
+ // keep this here until components (mainly usaa-analytics & usaa-logger) only check for ECID cookie
60
+
61
+
62
+ function getOldEcidCookieName() {
63
+ var isMobile = process.env.USAA_PLATFORM === 'native' || process.env.USAA_PLATFORM === 'mobileLegacy';
64
+ return isMobile ? MOBILE_COOKIE : STANDARD_COOKIE;
65
+ }
66
+ //# sourceMappingURL=ecid.js.map
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+ exports.ProfileAnalytics = void 0;
8
+
9
+ var _axios = _interopRequireDefault(require("axios"));
10
+
11
+ var _usaaPerformance = _interopRequireWildcard(require("usaa-performance"));
12
+
13
+ var _usaaAnalytics = require("usaa-analytics");
14
+
15
+ var _usaaLogger = _interopRequireDefault(require("usaa-logger"));
16
+
17
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
18
+
19
+ 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; }
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+
23
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
+
25
+ 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); } }
26
+
27
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
28
+
29
+ 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); }
30
+
31
+ var PerfTool = _usaaPerformance.default.getInstance();
32
+ /**
33
+ * Helper function to flatten the JSON response object.
34
+ *
35
+ * @param obj - some nested object
36
+ * @returns {{}} - flattened object
37
+ */
38
+
39
+
40
+ var flatten = function flatten(obj) {
41
+ var flat = {};
42
+
43
+ for (var x in obj) {
44
+ if (_typeof(obj[x]) === 'object') {
45
+ Object.assign(flat, flatten(obj[x]));
46
+ } else {
47
+ flat[x] = obj[x];
48
+ }
49
+ }
50
+
51
+ return flat;
52
+ };
53
+ /**
54
+ * Helper function to stringify booleans in an object.
55
+ * (the utag load/view functions won't save false boolean props)
56
+ *
57
+ * @param obj
58
+ * @returns {{}} - new object with stringified booleans
59
+ */
60
+
61
+
62
+ var stringifyBooleans = function stringifyBooleans(obj) {
63
+ var newObj = {};
64
+
65
+ for (var x in obj) {
66
+ if (typeof obj[x] === 'boolean') {
67
+ newObj[x] = obj[x].toString();
68
+ } else {
69
+ newObj[x] = obj[x];
70
+ }
71
+ }
72
+
73
+ return newObj;
74
+ };
75
+
76
+ var ProfileAnalytics = /*#__PURE__*/function () {
77
+ /**
78
+ * Our constructor.
79
+ *
80
+ * @param axios: axios instance (optional)
81
+ */
82
+ function ProfileAnalytics() {
83
+ _classCallCheck(this, ProfileAnalytics);
84
+
85
+ this.getDigitalProfile = this.getDigitalProfile.bind(this);
86
+ this.saveProfileToDataLayer = this.saveProfileToDataLayer.bind(this); // this.cleanupDataLayer = this.cleanupDataLayer.bind(this);
87
+
88
+ this.err = this.err.bind(this);
89
+ }
90
+ /**
91
+ * Fires a GET for the Member Digital Profile
92
+ *
93
+ * @param guid: member guid
94
+ * @returns {Promise}
95
+ */
96
+
97
+
98
+ _createClass(ProfileAnalytics, [{
99
+ key: "getDigitalProfile",
100
+ value: function getDigitalProfile(guid) {
101
+ var serviceUrl = 'https://api.usaa.com/enterprise/marketing-analytics/v1/individuals/' + guid + '/digital-profile';
102
+ PerfTool.start('usaa-template-common/memberDigitalProfile-axios', _usaaPerformance.PERF_CONTENT_TYPE.secondary);
103
+ return this.axios.get(serviceUrl).then(function (response) {
104
+ PerfTool.stop('usaa-template-common/memberDigitalProfile-axios');
105
+ return response.data;
106
+ });
107
+ }
108
+ /**
109
+ * Save the response to USAA.ent.digitalData.user.attributes
110
+ *
111
+ * @param data: response.data
112
+ * @returns {Promise}
113
+ */
114
+
115
+ }, {
116
+ key: "saveProfileToDataLayer",
117
+ value: function saveProfileToDataLayer(data) {
118
+ return new Promise(function (resolve, reject) {
119
+ var profile = {
120
+ user: {
121
+ attributes: stringifyBooleans(flatten(data))
122
+ }
123
+ };
124
+
125
+ if ((0, _usaaAnalytics.addToDigitalData)(profile)) {
126
+ resolve();
127
+ } else {
128
+ reject(new Error('addToDigitalData failed'));
129
+ }
130
+ });
131
+ }
132
+ /**
133
+ * The error catcher.
134
+ *
135
+ * @param e
136
+ */
137
+
138
+ }, {
139
+ key: "err",
140
+ value: function err(e) {
141
+ if (!this.logger) {
142
+ this.logger = new _usaaLogger.default();
143
+ }
144
+
145
+ this.logger.warn('get-profile-analytics:', e ? e.message || e : 'undefined error');
146
+ }
147
+ /**
148
+ * Call all the things!
149
+ *
150
+ * @param guid: member guid
151
+ * @returns {*|Promise|Promise.<T>}
152
+ */
153
+
154
+ }, {
155
+ key: "get",
156
+ value: function get(guid) {
157
+ var _this = this;
158
+
159
+ return this.getDigitalProfile(guid).then(function (data) {
160
+ return _this.saveProfileToDataLayer(data);
161
+ }).catch(this.err);
162
+ }
163
+ }]);
164
+
165
+ return ProfileAnalytics;
166
+ }();
167
+ /**
168
+ * Instantiate ProfileAnalytics and fire the logging method.
169
+ *
170
+ * @param guid: member guid
171
+ * @param axios: axios instance (optional)
172
+ * @returns {*|Promise|Promise.<T>}
173
+ */
174
+
175
+
176
+ exports.ProfileAnalytics = ProfileAnalytics;
177
+
178
+ function _default(guid) {
179
+ if (process.env.USAA_PLATFORM === 'shadow') {
180
+ // service does not support shadow scope and analytics are disabled for shadow domain
181
+ return Promise.resolve();
182
+ } else {
183
+ return new ProfileAnalytics(_axios.default).get(guid);
184
+ }
185
+ }
186
+ //# sourceMappingURL=get-profile-analytics.js.map
@@ -0,0 +1,44 @@
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 _axios = _interopRequireDefault(require("axios"));
11
+
12
+ var _usaaPerformance = _interopRequireWildcard(require("usaa-performance"));
13
+
14
+ var _memoize = _interopRequireDefault(require("lodash/memoize"));
15
+
16
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
17
+
18
+ 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; }
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ var PerfTool = _usaaPerformance.default.getInstance();
23
+ /**
24
+ * Hit the profile service then fire setProfileBaseData().
25
+ *
26
+ * @param guid: member guid
27
+ * @param axios: axios instance (optional)
28
+ * @returns {*|Promise|Promise.<T>}
29
+ */
30
+
31
+
32
+ function getProfileBaseData(guid) {
33
+ var profileServiceUrl = 'https://api.usaa.com/enterprise/core-customer/v1/individuals/' + guid + '/name';
34
+ PerfTool.start('usaa-template-common/profileBaseData-axios', _usaaPerformance.PERF_CONTENT_TYPE.secondary);
35
+ return _axios.default.get(profileServiceUrl).then(function (response) {
36
+ PerfTool.stop('usaa-template-common/profileBaseData-axios');
37
+ return response.data;
38
+ });
39
+ }
40
+
41
+ var _default = (0, _memoize.default)(getProfileBaseData);
42
+
43
+ exports.default = _default;
44
+ //# sourceMappingURL=get-profile-base-data.js.map
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = loadUtag;
7
+
8
+ var _usaaAnalytics = require("usaa-analytics");
9
+
10
+ /* global utag */
11
+
12
+ /**
13
+ * Load utag.js script. That script will execute a Tealium pageView immediately.
14
+ * @returns {undefined}
15
+ */
16
+ function loadUtag() {
17
+ if (typeof utag === 'undefined') {
18
+ (0, _usaaAnalytics.addECID)();
19
+ var utagEnv;
20
+
21
+ switch (process.env.USAA_ENV) {
22
+ case 'development':
23
+ utagEnv = 'dev';
24
+ break;
25
+
26
+ case 'test':
27
+ utagEnv = 'qa';
28
+ break;
29
+
30
+ case 'production':
31
+ default:
32
+ utagEnv = 'prod';
33
+ break;
34
+ }
35
+
36
+ var scriptElement = document.createElement('script');
37
+ scriptElement.src = "https://tms.usaa.com/nw/".concat(utagEnv, "/utag.js");
38
+ scriptElement.async = true; // the script will be executed asynchronously as soon as it is available
39
+
40
+ var headElement = document.getElementsByTagName('head')[0];
41
+ setTimeout(function () {
42
+ headElement.appendChild(scriptElement);
43
+ }, 500);
44
+ }
45
+ }
46
+ //# sourceMappingURL=load-utag.js.map
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = 'usaa-templateContent';
8
+ exports.default = _default;
9
+ //# sourceMappingURL=main-content-id.js.map
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _wcmDisplay = require("../components/wcm-display");
9
+
10
+ var _usaaLogger = _interopRequireDefault(require("usaa-logger"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
+
16
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
+
18
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
+
20
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
+
22
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
23
+
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+
26
+ var logger = new _usaaLogger.default();
27
+ var DEBUG_MSG = '(usaa-templates) common/util/parse-wcm-xml:';
28
+
29
+ var parseWcmXml = function parseWcmXml(xml) {
30
+ var idPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
31
+
32
+ if (typeof xml !== 'string') {
33
+ logger.error(DEBUG_MSG, "Param 'xml' is not a valid string.");
34
+ return;
35
+ }
36
+
37
+ var ret = {
38
+ markup: '',
39
+ components: []
40
+ };
41
+
42
+ if (!xml) {
43
+ return ret;
44
+ }
45
+
46
+ xml = xml.replace(/\n/g, ''); // remove newlines
47
+
48
+ var tag = '<' + _wcmDisplay.COMPONENT_XML_ELEMENT;
49
+ var closeTag = '</' + _wcmDisplay.COMPONENT_XML_ELEMENT + '>';
50
+ var attrExp = /[^\s]*="(?:[^"\\]|\\.)*"/g; // find xml attribute name/value pairs, accounting for escaped quotes
51
+
52
+ var gtExp = />(?=((?:[^"\\]|\\.)*"([^"\\]|\\.)*")*([^"\\]|\\.)*$)/g; // find '>' chars not in double-quotes
53
+ // iterate over the components in the xml by index
54
+
55
+ var xmlIndex;
56
+
57
+ while ((xmlIndex = xml.indexOf(tag)) !== -1) {
58
+ // concat the xml content before the component onto the html string
59
+ ret.markup += xml.slice(0, xmlIndex).trim(); // parse our component
60
+
61
+ gtExp.lastIndex = xmlIndex;
62
+ var gtExec = gtExp.exec(xml);
63
+ var attrEndIndex = gtExec ? gtExec.index : -1; // the end of this component's attributes
64
+
65
+ var nextComponentIndex = xml.indexOf(tag, attrEndIndex);
66
+ var closeTagIndex = xml.indexOf(closeTag, attrEndIndex);
67
+
68
+ while (nextComponentIndex !== -1 && nextComponentIndex < closeTagIndex) {
69
+ // skip past nested components
70
+ nextComponentIndex = xml.indexOf(tag, nextComponentIndex + tag.length);
71
+ closeTagIndex = xml.indexOf(closeTag, closeTagIndex + closeTag.length);
72
+ }
73
+
74
+ if (attrEndIndex === -1 || closeTagIndex === -1) {
75
+ logger.error(DEBUG_MSG, 'Syntax error parsing component tags');
76
+ return ret;
77
+ }
78
+
79
+ var attr = xml.slice(xmlIndex + tag.length, attrEndIndex).match(attrExp) || [];
80
+ var innerHTML = xml.slice(attrEndIndex + 1, closeTagIndex).trim(); // convert xml attributes to component props
81
+
82
+ var props = {};
83
+
84
+ for (var i = 0; i < attr.length; i++) {
85
+ var _attr$i$split = attr[i].split(/=(.+)/),
86
+ _attr$i$split2 = _slicedToArray(_attr$i$split, 2),
87
+ name = _attr$i$split2[0],
88
+ value = _attr$i$split2[1]; // only split on the first '='
89
+
90
+
91
+ try {
92
+ props[name] = JSON.parse(value);
93
+ } catch (e) {
94
+ logger.error(e, DEBUG_MSG, 'Error parsing attribute.', attr[i]);
95
+ }
96
+ } // if we don't have a target ID to mount to, generate a div with a unique ID
97
+
98
+
99
+ var id = ".".concat(ret.components.length);
100
+
101
+ if (props && !props[_wcmDisplay.COMPONENT_ATTR.TARGET_ID]) {
102
+ var targetId = _wcmDisplay.COMPONENT_XML_ELEMENT + idPrefix + id;
103
+ props[_wcmDisplay.COMPONENT_ATTR.TARGET_ID] = targetId;
104
+ ret.markup += "<div id=\"".concat(targetId, "\"></div>");
105
+ } // consume the parsed XML
106
+
107
+
108
+ xml = xml.slice(closeTagIndex + closeTag.length + 1); // push our component on ret.components and recurse any subcomponents
109
+
110
+ var recurse = parseWcmXml(innerHTML, idPrefix + id);
111
+ ret.components.push({
112
+ innerHTML: recurse.markup,
113
+ props: props
114
+ });
115
+ ret.components = ret.components.concat(recurse.components);
116
+ } // concat any remaining xml onto the html string
117
+
118
+
119
+ ret.markup += xml.trim();
120
+ return ret;
121
+ };
122
+
123
+ var _default = parseWcmXml;
124
+ exports.default = _default;
125
+ //# sourceMappingURL=parse-wcm-xml.js.map
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.checkIFrameLoaded = void 0;
7
+
8
+ var _usaaLogger = _interopRequireDefault(require("usaa-logger"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var usaaLogger = new _usaaLogger.default();
13
+
14
+ var getLocalStorageValue = function getLocalStorageValue(key) {
15
+ var value;
16
+
17
+ if (localStorage) {
18
+ value = localStorage.getItem(key);
19
+ return value;
20
+ } else {
21
+ usaaLogger.error('No support for localstorage');
22
+ }
23
+ };
24
+
25
+ var getScreenShareURLs = function getScreenShareURLs() {
26
+ var cafexClusterDomain = getLocalStorageValue('clusterDomain');
27
+ var url = {
28
+ urlLiveAssistIFrameResource: "https://".concat(cafexClusterDomain, ":443/assistserver/sdk/web/consumer/js/assist-iframe.js"),
29
+ urlLiveAssistIFrameSDKPath: "https://".concat(cafexClusterDomain, ":443/assistserver/sdk/web/consumer/js")
30
+ };
31
+ return url;
32
+ };
33
+
34
+ var initAssistIFrame = function initAssistIFrame() {
35
+ var sdkPath = getScreenShareURLs().urlLiveAssistIFrameSDKPath;
36
+
37
+ if (window.AssistIFrameSDK) {
38
+ window.AssistIFrameSDK.init({
39
+ sdkUrl: sdkPath,
40
+ allowedOrigins: '*'
41
+ });
42
+ } else {
43
+ usaaLogger.error('initAssistIFrame::Unable to load AssistIFrameSDK');
44
+ }
45
+ };
46
+ /**
47
+ * Loads iframe resource (JS file) and call the function to add the script needed
48
+ */
49
+
50
+
51
+ var loadIFrameResource = function loadIFrameResource() {
52
+ var script;
53
+ script = document.createElement('script');
54
+ script.src = getScreenShareURLs().urlLiveAssistIFrameResource;
55
+ script.onload = initAssistIFrame;
56
+ document.body.appendChild(script);
57
+ };
58
+ /**
59
+ * Function called from the storage listener (added in previous function).
60
+ * Validates if the screenShareActive entry is present in localStorage.
61
+ */
62
+
63
+
64
+ var validateStorageEntry = function validateStorageEntry(storageEvent) {
65
+ if (storageEvent.key === "screenShareActive" && storageEvent.newValue !== "") {
66
+ loadIFrameResource();
67
+ window.removeEventListener('storage', validateStorageEntry);
68
+ }
69
+ };
70
+ /**
71
+ * Checks if the current page is an iframe, if it is and there is a screen share
72
+ * in progress then it adds the resources to enable the iframe, if it is an iframe but there
73
+ * is no session in progress then it adds a listener to add the resources later if needed.
74
+ */
75
+
76
+
77
+ var checkIFrameLoaded = function checkIFrameLoaded() {
78
+ try {
79
+ if (getLocalStorageValue('screenShareActive') === 'true') {
80
+ loadIFrameResource();
81
+ } else {
82
+ window.addEventListener('storage', validateStorageEntry, false);
83
+ }
84
+ } catch (e) {
85
+ usaaLogger.error('Exception occurred while checking iFrame load');
86
+ }
87
+ };
88
+
89
+ exports.checkIFrameLoaded = checkIFrameLoaded;
90
+ //# sourceMappingURL=screenshare-iframe.js.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hashCode = hashCode;
7
+
8
+ function hashCode(str) {
9
+ /* eslint no-bitwise:0 */
10
+ var hash = 0;
11
+ var i, chr, len;
12
+
13
+ if (str.length === 0) {
14
+ return hash;
15
+ }
16
+
17
+ for (i = 0, len = str.length; i < len; i++) {
18
+ chr = str.charCodeAt(i);
19
+ hash = (hash << 5) - hash + chr;
20
+ hash |= 0; // Convert to 32bit integer
21
+ }
22
+
23
+ return hash;
24
+ }
25
+ //# sourceMappingURL=string-utils.js.map
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = _default;
7
+ exports.WCM_SERVICE_SECURED_URL = exports.WCM_SERVICE_UNSECURED_URL = void 0;
8
+
9
+ var _axios = _interopRequireDefault(require("axios"));
10
+
11
+ var _usaaLogger = _interopRequireDefault(require("usaa-logger"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ var WCM_SERVICE_UNSECURED_URL = 'https://api.usaa.com/enterprise/wcm/v2/public/objects';
16
+ exports.WCM_SERVICE_UNSECURED_URL = WCM_SERVICE_UNSECURED_URL;
17
+ var WCM_SERVICE_SECURED_URL = 'https://api.usaa.com/enterprise/wcm/v2/objects';
18
+ exports.WCM_SERVICE_SECURED_URL = WCM_SERVICE_SECURED_URL;
19
+ var logger = new _usaaLogger.default();
20
+
21
+ function _default(wcmKey) {
22
+ var authenticated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
23
+ var replacementMap = arguments.length > 2 ? arguments[2] : undefined;
24
+ var serviceUrl = (authenticated ? WCM_SERVICE_SECURED_URL : WCM_SERVICE_UNSECURED_URL) + '/' + wcmKey;
25
+ var config = {
26
+ headers: {
27
+ Accept: 'application/json'
28
+ }
29
+ }; //If a replacement map is passed in, we will POST to the endpoint in order to send the replacement map to the service, otherwise we will make a GET call
30
+
31
+ var call = replacementMap ? _axios.default.post(serviceUrl, {
32
+ replacementMap: replacementMap
33
+ }, config) : _axios.default.get(serviceUrl, config);
34
+ return call.then(function (response) {
35
+ return response.data;
36
+ }).catch(function (error) {
37
+ var errorDetails = error.response && error.response.status || error.message;
38
+ var authStatus = "".concat(authenticated ? '' : 'non-', "authenticated");
39
+ var message = "wcm-retriever: Error requesting ".concat(authStatus, " WCM object for key: ").concat(wcmKey, " - ").concat(errorDetails, " ").concat(replacementMap && "with replacement map: ".concat(JSON.stringify(replacementMap)));
40
+ logger.error(error, message);
41
+ throw error;
42
+ });
43
+ }
44
+ //# sourceMappingURL=wcm-retriever.js.map
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var COMPONENTS = {
8
+ 'usaa-glossary': {
9
+ '1': {
10
+ LOADER: function LOADER(callback) {
11
+ require.ensure([], function (require) {
12
+ callback(require('usaa-modals/lib/glossary/glossary-wcm-wrapper-v1'));
13
+ });
14
+ }
15
+ } // // example v2 wrapper:
16
+ // ,
17
+ // '2': {
18
+ // LOADER: (callback) => {
19
+ // require.ensure([], (require) => {
20
+ // callback(require('usaa-glossary/lib/glossary-wcm-wrapper-v2'));
21
+ // });
22
+ // },
23
+ // EXPORT: 'default'
24
+ // }
25
+
26
+ }
27
+ };
28
+ var _default = COMPONENTS;
29
+ exports.default = _default;
30
+ //# sourceMappingURL=wcm-component-loaders.js.map