ons.fn(this); } return null; }); // Block helper for outputing a template block if the specified setting is equal to the specified // value of if not present the default Handlebars.registerHelper('isSettingEqual', function (settingName, equals, defaultValue, options) { var value = settings.config[settingName] || defaultValue; var eqArray = equals.split(','); var arrayLength = eqArray.length; for (var i = 0; i < arrayLength; i++) { if (eqArray[i] && eqArray[i].toLowerCase() === value.toLowerCase()) { return options.fn(this); } } return null; }); // Block helper for outputing a template block if the specified setting exists Handlebars.registerHelper('doesSettingExist', function (settingName, options) { var value = settings.config[settingName]; if (value) { return options.fn(this); } else { return options.inverse(this); } }); // Block helper for outputing a template block if the specified setting contains the specified // value Handlebars.registerHelper('doesSettingContain', function (settingName, contains, defaultValue, options) { var value = settings.config[settingName] || defaultValue; var valueArray = value.split(','); var arrayLength = valueArray.length; for (var i = 0; i < arrayLength; i++) { if (valueArray[i] && valueArray[i].toLowerCase() === contains.toLowerCase()) { return options.fn(this); } } return options.inverse(this); }); // Block helper for outputing a template block if the collection only contains a single item Handlebars.registerHelper('isSingle', function (collection, options) { if (collection.length === 1) { return options.fn(this); } return null; }); // Block helper for outputing a template block if the collection only contains a single item Handlebars.registerHelper('isMultiple', function (collection, options) { if (collection.length > 1) { return options.fn(this); } return null; }); // Block helper for outputing an array Handlebars.registerHelper('getCountryDialingCodeOptionList', function () { var optionHtmlElements = document.createElement("div"); var localeCountry = settings.locale.country; var elem = document.createElement('textarea'); elem.innerHTML = $i2e.lookupLanguage("countryList"); var processingList = JSON.parse(elem.value); // Iterate through the isolocalized.countryByLang as this ensures that // countries appear in the correct alphabetical order. for (var entry in processingList) { // Get the dialing code from the data var dialingCode = $isoData.countryByIso[entry]["dc"]; var option = document.createElement("option"); option.setAttribute("value", "+" + dialingCode); if (localeCountry === entry) { option.setAttribute("selected", true); } // Set the country name as text to avoid xss unwanted executions option.innerText = processingList[entry] + (dialingCode ? " (+" + dialingCode + ")" : "") optionHtmlElements.appendChild(option); } return optionHtmlElements.innerHTML; }); }(CONTENT, SETTINGS)); /* endinject */ /* inject:ief-modal.js */ var $modal = (function () { 'use strict'; // Inject the stylesheet (function () { // Removed the base64 close image, as we don't actually use it var css = '#simplemodal-overlay{background:#000}#simplemodal-container{background:#fff;padding:30px 20px 20px;text-align:left;-webkit-box-shadow:0 0 30px 2px rgba(0,0,0,.5);-moz-box-shadow:0 0 30px 2px rgba(0,0,0,.5);box-shadow:0 0 30px 2px rgba(0,0,0,.5);overflow:hidden}#simplemodal-container h2{font-family:Arial,Helvetica,sans-serif;color:#1C5B96;font-size:20px;line-height:26px;margin-bottom:10px}#simplemodal-container .simplemodal-data{padding:8px;overflow:hidden}#simplemodal-container h1{margin-bottom:20px}'; var head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); head.appendChild(style); if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } }()); return { VERSION: "2.0.0", // Shows the modal window with default options // @name name of the modal to show showDefault: function (name) { // Check that the modal plugin is // available before using if ($.modal) { $(name).modal({ opacity: 60, minHeight: 200, minWidth: 500, maxWidth: 500 }); } }, // Shows a custom modal window // @name name of the modal to show // @options an array of string: value showCustom: function (name, options) { // Check that the modal plugin is // available before using if ($.modal) { $(name).modal(options); } }, // Hides the modal hide: function () { // Check that the modal plugin is // available before using if ($.modal) { $.modal.close(); } } } }()); /* endinject */ /* inject:predicateValidation.js */ "use strict"; var $predicateValidation = function ($diags, content, settings) { /** * UNKNOWN - the method passed was not defined in the xml * INCLUDES_CHARACTERS - validates that a character set exists in the claim value * MATCHES_REGEX - check the claim value against a regular expression * IS_LENGTH_RANGE - check if claim value has length in a specific range */ var PREDICATE_METHODS = { UNKNOWN: 0, INCLUDES_CHARACTERS: 1, MATCHES_REGEX: 2, IS_LENGTH_RANGE: 3, IS_DATE_RANGE: 4 }; /** * MINIMUM - the minimum length * MAXIMUM - the maximum length * CHARACTER_SET - the character set to validate against * REGULAR_EXPRESSION - the regular expression to check against */ var PREDICATE_PARAMETERS = { MINIMUM: 1, MAXIMUM: 2, CHARACTER_SET: 3, REGULAR_EXPRESSION: 4 }; // Returns the first object in the Attribute fields who has the same claimID, including those inside display control var _findAttributeFieldByClaimId = function(claimId) { if (!Array.isArray(SA_FIELDS.AttributeFields)) return null; for (var i = 0; i < SA_FIELDS.AttributeFields.length; i++) { if (SA_FIELDS.AttributeFields[i].ID === claimId) { return SA_FIELDS.AttributeFields[i]; } if (SA_FIELDS.AttributeFields[i].USER_INPUT_TYPE === "DisplayControl") { if (!Array.isArray(SA_FIELDS.AttributeFields[i].DISPLAY_FIELDS)) return null; for (var j = 0; j < SA_FIELDS.AttributeFields[i].DISPLAY_FIELDS.length; j++) { if (SA_FIELDS.AttributeFields[i].DISPLAY_FIELDS[j].ID === claimId) { return SA_FIELDS.AttributeFields[i].DISPLAY_FIELDS[j]; } } } } return null; } // Returns the first object in an array that has a key with a specific value // @parameter arr is an array of objects // @parameter key is the key we will be looking at // @parameter value is the value that the key must have var _findBy = function (arr, key, value) { if (!Array.isArray(arr)) return null; for (var i = 0; i < arr.length; i++) { var item = arr[i]; if (item[key] != null && item[key] == value) { return item; } } return null; } // Unescape html charaters to use in regex // Note: this is for fullproffing the client side (the server side should always send characters unescaped) var _unescapeHtml = function (unsafe) { return unsafe .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, "\"") .replace(/'/g, "'") .replace(/'/g, "'"); } // Escape characters used in regex as character set var _escapeRegExpCharaterSet = function (str) { return str.replace(/([\/^$*+?.()|[\]{}])/g, "\\$1") } // Returns a list of validation methods // The same methods are implemented on the server side for security reasons var _validationMethods = function () { var self = this; var validationMethods = []; // Do nothing in case the method is unknown validationMethods[PREDICATE_METHODS.UNKNOWN] = function (claimValue, params) { return true; }; validationMethods[PREDICATE_METHODS.INCLUDES_CHARACTERS] = function (claimValue, params) { // Escape regular expression characters, so that we only allow character sets var chars = _unescapeHtml(params[0].VALUE); var regexValid = new RegExp("[" + _escapeRegExpCharaterSet(chars) + "]+"); return regexValid.test(claimValue); }; validationMethods[PREDICATE_METHODS.IS_LENGTH_RANGE] = function (claimValue, params) { var minimum = parseInt($predicateValidation.findBy(params, "NAME", PREDICATE_PARAMETERS.MINIMUM).VALUE); var maximum = parseInt($predicateValidation.findBy(params, "NAME", PREDICATE_PARAMETERS.MAXIMUM).VALUE); return minimum <= claimValue.length && claimValue.length <= maximum; }; validationMethods[PREDICATE_METHODS.IS_DATE_RANGE] = function (claimValue, params) { var minimum = new Date($predicateValidation.findBy(params, "NAME", PREDICATE_PARAMETERS.MINIMUM).VALUE); var maximum = new Date($predicateValidation.findBy(params, "NAME", PREDICATE_PARAMETERS.MAXIMUM).VALUE); var minimumDate = new Date(minimum.getUTCFullYear(), minimum.getUTCMonth(), minimum.getUTCDate()); var maximumDate = new Date(maximum.getUTCFullYear(), maximum.getUTCMonth(), maximum.getUTCDate()); return minimumDate <= claimValue && claimValue <= maximumDate; }; validationMethods[PREDICATE_METHODS.MATCHES_REGEX] = function (claimValue, params) { var regex = _unescapeHtml($predicateValidation.findBy(params, "NAME", PREDICATE_PARAMETERS.REGULAR_EXPRESSION).VALUE); var regexValid = new RegExp(regex); return regexValid.test(claimValue); }; return validationMethods; } var _computeClaimValueError = function (mainHelpText, invalidPredicates, errorPrefix) { var hasMain = (mainHelpText != "" && mainHelpText != null); // Add a new line, spaces and dash for list of errors var dashPrefix = hasMain ? errorPrefix : ""; var errorMessage = hasMain ? mainHelpText : ""; for (var i = 0; i < invalidPredicates.length; i++) { errorMessage += dashPrefix + invalidPredicates[i].HELP_TEXT; } return errorMessage; } var _generateValidationDict = function (claimID, claimValue, errorPrefix) { var errorMsgs = []; var passwordValidationDict = { isValid: true, errorMsgs: errorMsgs }; var claimById = $predicateValidation.findAttributeFieldByClaimId(claimID); if (null == claimById) return passwordValidationDict; var claimValidation = claimById.INPUT_VALIDATION; if (null == claimValidation) return passwordValidationDict; var validationMethods = _validationMethods(); // Validate predicates var isValid = true; if (claimValidation.PREDICATES != null) { for (var i = 0; i < claimValidation.PREDICATES.length; i++) { var predicate = claimValidation.PREDICATES[i]; if (!validationMethods[predicate.METHOD](claimValue, predicate.PARAMS)) { errorMsgs.push(_computeClaimValueError("", [predicate], errorPrefix)); isValid = false; } } } // Validate predicate groups if (claimValidation.PREDICATE_GROUPS != null) { for (var i = 0; i < claimValidation.PREDICATE_GROUPS.length; i++) { var predicateGroup = claimValidation.PREDICATE_GROUPS[i]; var countValid = 0; for (var j = 0; j < predicateGroup.PREDICATES.length; j++) { var predicate = predicateGroup.PREDICATES[j]; var localValid = validationMethods[predicate.METHOD](claimValue, predicate.PARAMS); if (localValid) { countValid++; } } // If there where errors in the predicate group var matchesMinimum = (countValid >= predicateGroup.MATCH_AT_LEAST); if ((matchesMinimum && predicateGroup.REJECT === true) || (!matchesMinimum && predicateGroup.REJECT !== true)) { errorMsgs.push(_computeClaimValueError(predicateGroup.HELP_TEXT, predicateGroup.PREDICATES, errorPrefix)); isValid = false; } } } passwordValidationDict.isValid = isValid; passwordValidationDict.errorMsgs = errorMsgs; return passwordValidationDict; } // Export the public methods return { findAttributeFieldByClaimId: _findAttributeFieldByClaimId, findBy: _findBy, generateValidationDict: _generateValidationDict, validationMethods: _validationMethods, unescapeHtml: _unescapeHtml, PREDICATE_METHODS: PREDICATE_METHODS, PREDICATE_PARAMETERS: PREDICATE_PARAMETERS }; }($diags, CONTENT, SETTINGS); /* endinject */ /* inject:element */ /* * This Javascript file is used for PageModel v2.1. For PageModel v2.1 we *do not* attach css styles. * Noted by Steven - 09/26/2017 */ "use strict"; /* inject:handlebar */ this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.selfasserted=Handlebars.template({1:function(n,e,t,l,o){var a,i=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return'
\r\n

'+(null!=(a=(i(t,"getContent")||e&&i(e,"getContent")||n.hooks.helperMissing).call(null!=e?e:n.nullContext||{},"heading",{name:"getContent",hash:{},data:o,loc:{start:{line:5,column:27},end:{line:5,column:53}}}))?a:"")+"

\r\n
\r\n"},3:function(n,e,t,l,o){var a,i=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return null!=(a=(i(t,"isSettingEqual")||e&&i(e,"isSettingEqual")||n.hooks.helperMissing).call(null!=e?e:n.nullContext||{},"pageFlavor","oceanBlue,slateGray","None",{name:"isSettingEqual",hash:{},fn:n.program(4,o,0),inverse:n.noop,data:o,loc:{start:{line:10,column:8},end:{line:12,column:27}}}))?a:""},4:function(n,e,t,l,o){var a,i=null!=e?e:n.nullContext||{},r=n.hooks.helperMissing,u=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return' \r\n"},6:function(n,e,t,l,o){var a,i=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return" "+(null!=(a=(i(t,"buildAttributeField")||e&&i(e,"buildAttributeField")||n.hooks.helperMissing).call(null!=e?e:n.nullContext||{},e,o&&i(o,"index"),{name:"buildAttributeField",hash:{},fn:n.program(7,o,0),inverse:n.noop,data:o,loc:{start:{line:26,column:16},end:{line:26,column:76}}}))?a:"")+"\r\n"},7:function(n,e,t,l,o){return""},9:function(n,e,t,l,o){var a,i=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return null!=(a=(i(t,"isSettingTrue")||e&&i(e,"isSettingTrue")||n.hooks.helperMissing).call(null!=e?e:n.nullContext||{},"skipValidationProfile",{name:"isSettingTrue",hash:{},fn:n.program(10,o,0),inverse:n.noop,data:o,loc:{start:{line:31,column:12},end:{line:33,column:30}}}))?a:""},10:function(n,e,t,l,o){var a,i=null!=e?e:n.nullContext||{},r=n.hooks.helperMissing,u=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return' '+(null!=(a=(u(t,"getContent")||e&&u(e,"getContent")||r).call(i,"skipValidationProfile",{name:"getContent",hash:{},data:o,loc:{start:{line:32,column:100},end:{line:32,column:140}}}))?a:"")+"\r\n"},12:function(n,e,t,l,o){var a,i=null!=e?e:n.nullContext||{},r=n.hooks.helperMissing,u=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return'"},14:function(n,e,t,l,o){var a,i=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return null!=(a=(i(t,"isSettingEqual")||e&&i(e,"isSettingEqual")||n.hooks.helperMissing).call(null!=e?e:n.nullContext||{},"pageFlavor","classic","None",{name:"isSettingEqual",hash:{},fn:n.program(15,o,0),inverse:n.noop,data:o,loc:{start:{line:36,column:284},end:{line:36,column:474}}}))?a:""},15:function(n,e,t,l,o){var a,i=null!=e?e:n.nullContext||{},r=n.hooks.helperMissing,u=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return'"},compiler:[8,">= 4.3.0"],main:function(n,e,t,l,o){var a,i,r=null!=e?e:n.nullContext||{},u=n.hooks.helperMissing,s=n.lookupProperty||function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]};return'Loading...