regjs

angular.module(‘templates.registration’, [‘templates/registration.html’]); angular.module(“templates/registration.html”, []).run([“$templateCache”, function($templateCache) { $templateCache.put(“templates/registration.html”, “\n” + “

\n” + ”
\n” + ” \n” + ” \n” + ” \n” + ” \n” + ”
\n” + ” Loading…\n” + ”
\n” + ”
0\”>\n” + ”
\n” + “\n” + ”
\n” + ” \n” + ”
\n” + ” \n” + ” \n” + “\n” + ” \n” + ”
\n” + ” \n” + ” \n” + ”
\n” + ”
\n” + “\n” + ” \n” + ”
0\”\n” + ” ng-show=\”!(field.hasOwnProperty(‘formerAddress’) && models[‘needsFormerAddress’].toLowerCase() != ‘yes’)\”>\n” + ” \n” + ” \n” + ” \n” + ”
0\”>{{errors[field.name]}}
\n” + ”
\n” + “\n” + ” \n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ” {{option.n}}\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ” {{field.specialMessage}}\n” + ”
\n” + ”
\n” + “\n” + ” \n” + ”
\n” + ” \n” + ” \n” + ”
{{errors[field.name]}}
\n” + ”
\n” + “\n” + ” \n” + ”
\n” + ” \n” + ”
\n” + ” \n” + ” 0,\n” + ” ‘error’ : hasNonEmptyValue(errors, ‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1)),\n” + ” ‘success’ : validated.hasOwnProperty(field.name) && validated.hasOwnProperty(‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1))}\”\n” + ” id=\”{{‘registrationConfirm’ + field.name[0].toUpperCase() + field.name.substring(1)}}\”\n” + ” ng-model=\”models[‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1)]\”\n” + ” ng-if=\”!field.hasOwnProperty(‘type’) || field.type == ‘text’\”\n” + ” maxlength=\”{{field.maxLength}}\”\n” + ” placeholder=\”{{field.hasOwnProperty(‘placeholder’) ? ‘Confirm ‘ + field.placeholder : ”}}\”\n” + ” type=\”text\”\n” + ” ng-blur=\”validateConfirmation(field)\” />\n” + ” \n” + ” 0,\n” + ” ‘error’ : hasNonEmptyValue(errors, ‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1)),\n” + ” ‘success’ : validated.hasOwnProperty(field.name) && validated.hasOwnProperty(‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1))}\”\n” + ” id=\”{{‘registrationConfirm’ + field.name[0].toUpperCase() + field.name.substring(1)}}\”\n” + ” ng-model=\”models[‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1)]\”\n” + ” ng-if=\”field.hasOwnProperty(‘type’) && field.type == ‘password’\”\n” + ” maxlength=\”{{field.maxLength}}\”\n” + ” placeholder=\”{{field.hasOwnProperty(‘placeholder’) ? ‘Confirm ‘ + field.placeholder : ”}}\”\n” + ” type=\”password\”\n” + ” ng-blur=\”validateConfirmation(field)\” />\n” + ”
\n” + ” {{errors[‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1)]}}\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + “\n” + ” \n” + ”
\n” + ” \n” + ”
\n” + ”
\n” + ” \n” + ” 4\”\n” + ” placeholder=\”XX\” type=\”tel\” size=\”2\” />\n” + ” \n” + ”
\n” + ”
{{errors[‘ssn’]}}
\n” + ”
\n” + ” Why Do We Need This?
\n” + ” {{affiliateDisplayName}} is committed to responsible wagering and complying with state and federal regulations.\n” + ” \n” + ”
\n” + ” 1. Identity Verification: We use your SSN to verify your age and state of residence.
\n” + ” 2. IRS Requirement: The IRS requires all online wagering sites collect your SSN in order to report your taxable winnings.
\n” + ”
\n” + ” We protect your personal information with the latest website security technologies. We safeguard your information with SSL (Secure Sockets Layer).\n” + ” SSL encrypts your personal information so that it cannot be read in transit by a third party. Your information is safe with us.\”\n” + ” tooltip-title=\”Why {{affiliateDisplayName}} Requires Your SSN\”\n” + ” tooltip-trigger=\”click\”\n” + ” tooltip-position=\”bottom left\”\n” + ” >
\n” + ”
\n” + ”
\n” + ”
\n” + “\n” + ” \n” + ”
\n” + ” \n” + ”
\n” + ”
\n” + ” \n” + “\n” + ” \n” + ” \n” + ”
\n” + ”
\n” + ” {{errors[‘dob’]}}\n” + ”
\n” + ”
\n” + ” You must be at least 18 years old to open a {{affiliateDisplayName}} account.\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ” \n” + ”
\n” + ”
Verification error: Please ensure all information is correct and try again.
\n” + ”
You may already have an account. Go here to retrieve your login information.
\n” + ”
This username is not available.
\n” + ”
Sorry! Our systems may be down. Please try again later.
\n” + ”
Temporary submission error. Please try again.
\n” + ”
\n” + ” We need to verify your identity. Please fax a copy of these to (859) 223-9141
\n” + ” 1. Driver’s License OR government issued ID
\n” + ” 2. Social Security Card OR legal tax document
\n” + ” 3. Utility Bill showing your address.

\n” + ” For more help, please call (855) 845-5035.\n” + ”
\n” + ”
\n” + “\n” + ” \n” + “\n” + ” \n” + ” \n” + “\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ”
\n” + ” \n” + ” \n” + ” \n” + ” \n” + ”
\n” + ”
\n” + “
\n” + “\n” + “
\n” + ”

There was a problem creating your account

\n” + ”

Please call Player Services to verify your identity and complete signup at {{regSupportPhone}}.

\n” + “\n” + ” Call Us\n” + “\n” + ”
    \n” + ”

    You will need the following:

    \n” + ”
  1. Driver’s License OR Government Issued ID
  2. \n” + ”
  3. Social Security Card OR Legal Tax Document
  4. \n” + ”
  5. Utility Bill, showing a valid address
  6. \n” + ”
\n” + ”

You may fax these documents to expedite the process at 1-859-223-9141.

\n” + “
\n” + “
\n” + ”

Account Help

\n” + ”
Need help signing up at {{affiliateDisplayName}}?
\n” + ”
We can help! Call us at: {{supportPhone}}
\n” + “\n” + ” Call Us
\n” + ” Cancel\n” + “
\n” + “”); }]); angular.module(‘templates.terms’, [‘templates/terms.html’]); angular.module(“templates/terms.html”, []).run([“$templateCache”, function($templateCache) { $templateCache.put(“templates/terms.html”, “
\n” + ”

By {{messageAction}} above, I agree to the Terms and Conditions

\n” + ”

By signing in, I agree to the Terms & Conditions

\n” + ”

Already registered? Login Now

\n” + “
“); }]); angular.module(‘terms’, [‘modal’, ‘templates.terms’]) .value(‘version’, ‘1.0.1’); angular.module(‘registration’, [ ‘ngCookies’, ‘ngRoute’, ‘modal’, ‘templates.registration’, ‘terms’, ‘ui.utils’, ‘profiling’, ‘bonusEngine’, ‘tooltip’ ]) .value(‘version’, ‘1.0.1’); if (typeof window.console == ‘undefined’) window.console = {}; if (typeof console.log == ‘undefined’) console.log = function() {}; angular.module(‘registration’).controller(‘registrationController’, [‘$scope’, ‘$timeout’, ‘$window’, ‘$routeParams’, ‘$http’, ‘$cookies’, ‘bonusEngineSvc’, ‘featToggle’, function($scope, $timeout, $window, $routeParams, $http, $cookies, bonusEngine, featToggle) { var TRACKING_REGISTRATION_ABANDONED_KEY = ‘tracking_registration_abandoned’; // Process PromoCode as BonusCode, if FT : “BNSVPRM” is active $scope.validatePromoAsBonus = false; // Loading FT BNSVPRM var bonusViaPromoCode = featToggle.hasFeature(‘CLASSIC’, ‘1.0’, ‘BNSVPRM’, Cdi.AppConfig.WS.CDI_SAID); bonusViaPromoCode.then( function (data) { $scope.$evalAsync(function () { if (data.hasFeature === true) { $scope.validatePromoAsBonus = true; } }); }, function (err) { } ); // Map of days in month. $scope.dobMonths = [‘MM’]; $scope.dobDays = [‘DD’]; $scope.dobYears = [‘YYYY’]; $scope.monthDayMap = { ‘1’ : 31, ‘2’ : ‘leap’, ‘3’ : 31, ‘4’ : 30, ‘5’ : 31, ‘6’ : 30, ‘7’ : 31, ‘8’ : 31, ‘9’ : 30, ’10’ : 31, ’11’ : 30, ’12’ : 31 }; $scope.content = {}; $scope.content.states = [ {“v”:””,”n”:”State”}, {“v”:”AL”,”n”:”Alabama”}, {“v”:”AK”,”n”:”Alaska”}, {“v”:”AS”,”n”:”American Samoa”}, {“v”:”AZ”,”n”:”Arizona”}, {“v”:”AR”,”n”:”Arkansas”}, {“v”:”CA”,”n”:”California”}, {“v”:”CO”,”n”:”Colorado”}, {“v”:”CT”,”n”:”Connecticut”}, {“v”:”DE”,”n”:”Delaware”}, {“v”:”DC”,”n”:”District of Columbia”}, {“v”:”FL”,”n”:”Florida”}, {“v”:”GA”,”n”:”Georgia”}, {“v”:”GU”,”n”:”Guam”}, {“v”:”HI”,”n”:”Hawaii”}, {“v”:”ID”,”n”:”Idaho”}, {“v”:”IL”,”n”:”Illinois”}, {“v”:”IN”,”n”:”Indiana”}, {“v”:”IA”,”n”:”Iowa”}, {“v”:”KS”,”n”:”Kansas”}, {“v”:”KY”,”n”:”Kentucky”}, {“v”:”LA”,”n”:”Louisiana”}, {“v”:”ME”,”n”:”Maine”}, {“v”:”MD”,”n”:”Maryland”}, {“v”:”MA”,”n”:”Massachusetts”}, {“v”:”MI”,”n”:”Michigan”}, {“v”:”MN”,”n”:”Minnesota”}, {“v”:”MS”,”n”:”Mississippi”}, {“v”:”MO”,”n”:”Missouri”}, {“v”:”MT”,”n”:”Montana”}, {“v”:”NE”,”n”:”Nebraska”}, {“v”:”NV”,”n”:”Nevada”}, {“v”:”NH”,”n”:”New Hampshire”}, {“v”:”NJ”,”n”:”New Jersey”}, {“v”:”NM”,”n”:”New Mexico”}, {“v”:”NY”,”n”:”New York”}, {“v”:”NC”,”n”:”North Carolina”}, {“v”:”ND”,”n”:”North Dakota”}, {“v”:”MP”,”n”:”Northern Mariana Islands”}, {“v”:”OH”,”n”:”Ohio”}, {“v”:”OK”,”n”:”Oklahoma”}, {“v”:”OR”,”n”:”Oregon”}, {“v”:”PA”,”n”:”Pennsylvania”}, {“v”:”PR”,”n”:”Puerto Rico”}, {“v”:”RI”,”n”:”Rhode Island”}, {“v”:”SC”,”n”:”South Carolina”}, {“v”:”SD”,”n”:”South Dakota”}, {“v”:”TN”,”n”:”Tennessee”}, {“v”:”TX”,”n”:”Texas”}, {“v”:”UM”,”n”:”U.S. Minor Outlying Islands”}, {“v”:”VI”,”n”:”U.S. Virgin Islands”}, {“v”:”UT”,”n”:”Utah”}, {“v”:”VT”,”n”:”Vermont”}, {“v”:”VA”,”n”:”Virginia”}, {“v”:”WA”,”n”:”Washington”}, {“v”:”WV”,”n”:”West Virginia”}, {“v”:”WI”,”n”:”Wisconsin”}, {“v”:”WY”,”n”:”Wyoming”} ]; //$scope.isMobile = !!TSM; // This is throws error in.. if(typeof TSM !==”undefined”) { $scope.isMobile = true; } else { $scope.isMobile = false; } $scope.knownRestrictedStates = []; $scope.knownRestrictedZips = []; // Variable to store last ZIP we geopopulated city and state with. $scope.lastZipLookup = ”; $scope.lastCity = ”; $scope.lastState = ”; // Username availability check. $scope.availCheck = { lastCheckedValue : ” }; // Models for doing data binding with form. $scope.models = { “cam_username” : “”, “cam_password” : “” }; $scope.errors = {}; // Validation errors for associated models. $scope.validated = {}; // Fields that have passed so far. // Config options $scope.doneInitializing = false; $scope.config = false; $scope.signupFields = []; // Used for quicker lookups $scope.firedVPVs = []; $scope.specialCases = [‘ssn’, ‘dob’]; // Cases with advanced handling. $scope.textualInputTypes = [‘text’, ‘number’, ‘tel’]; $scope.isFinalValidation = false; $scope.hasRetried = false; $scope.showFormError = false; $scope.submitForm = false; $scope.submitClass = “registration-button”; $scope.disableSubmit = false; $scope.outstandingRARequest = false; $scope.queueRA = false; $scope.raTimeoutPromise = null; $scope.preventMulipleSubmits = false; // Prevent multiple submits // Defaults for field config options $scope.formerAddressCheck = true; // Check for former address $scope.ssnMode = 4; // SSN Mode, 0, 4, or 9 $scope.minAge = 18; // Defaults for post-registration behaviors. $scope.register = {}; $scope.autoLogin = {}; /** * initializeForm * Load dropdown options and affiliate-specific configuration for this registration. * * NOTE: This function is run automatically once when this controller is loaded. */ $scope.initializeForm = function() { // Mark initialization flag appropriately. $scope.doneInitializing = false; $scope.fetchConfig(); // set our abandoned registration flag so we can record if a user left a registration before submitting if(window.hasOwnProperty(‘localStorage’)) { localStorage.setItem(TRACKING_REGISTRATION_ABANDONED_KEY, true); } }; /** * fetchConfig * Load the affiliate-specific configuration for this registration and initialize from it. * * NOTE: This function is run automatically once when this controller is loaded. */ $scope.fetchConfig = function() { // GET request for affiliate-specific file. $scope.isNative = false; if(typeof Cdi != “undefined” && typeof Cdi.AppConfig != “undefined” && typeof Cdi.AppConfig.isNative != “undefined” && Cdi.AppConfig.isNative) { $scope.isNative = true; configLoc = “resources/shared/extlibs/tsui/widgets/registration/” + Cdi.AppConfig.WS.CDI_SAID + “-mobile.json?v=3.18.8”; } else if ($scope.isMobile) { configLoc = “/resources/shared/extlibs/tsui/widgets/registration/” + Cdi.AppConfig.WS.CDI_SAID + “-mobile.json?v=3.18.8”; } else { configLoc = “/tsui/widgets/config/registration/1.0.1/” + Cdi.AppConfig.WS.CDI_SAID + “.json?v=3.18.8”; } $http.get(configLoc).then(function(response) { // TODO – migrate to use getMasterData // Load data for select dropdowns. if(response.hasOwnProperty(‘data’) && response.data.hasOwnProperty(‘content’)) { if(response.data.content.hasOwnProperty(‘states’)) { $scope.content.states = response.data.content.states; } } // Load field configuration data. if(response.data.hasOwnProperty(‘config’)) { // Put the config data into controller $scope. $scope.config = response.data.config; // Initialize the form elements using config. $scope.initializeFromConfig(); } else { $scope.config = false; console.log(“Reg: Config data not found in response.”); } }, function() { $scope.config = false; console.log(“Reg: Unable to request configuration data.”); }); }; /** * initializeFromConfig * Initialize the form component per the loaded configuration file. */ $scope.initializeFromConfig = function() { // Make sure config exists. if($scope.hasOwnProperty(‘config’) && $scope.config !== false) { // Promo code variable population // Check $routeParams first. $scope.models[‘promo_code’] = typeof $routeParams.promo_code != ‘undefined’ ? $routeParams.promo_code : ”; // Check regular style query params if($scope.models[‘promo_code’] == ”) { var queryParams = $scope.getUrlVars(); if(queryParams.hasOwnProperty(‘promo_code’) && queryParams[‘promo_code’].length > 0) { if($scope.isMobile) { var promoCode = queryParams[‘promo_code’]; var getPC = promoCode.split(“#”); $scope.models[‘promo_code’] = getPC[0]; } else { $scope.models[‘promo_code’] = queryParams[‘promo_code’]; } } /** * US10291 – Native app saves all URL params into sessionStorage as JSON * object. * – Added by Alpesh 07/07/2015 */ try { if(sessionStorage.getItem(‘reg_urlParams’)) { console.log(‘TSM – Registration URL params detected in sessionStorage’); var queryParams = JSON.parse(sessionStorage.getItem(‘reg_urlParams’)); // Saving here just in case needed in future $scope.models[‘urlParams’] = queryParams; if(queryParams.hasOwnProperty(‘promo_code’) && queryParams.promo_code.length > 0) { console.log(‘TSM – Promocode found and saved into angular model’); $scope.models[‘promo_code’] = queryParams.promo_code; } } } catch(e) { console.log(‘Error Occured while reading sessionStorage Data’); console.log(e) } // – End of code added for US10291 } if($scope.models[‘promo_code’].length > 0) { console.log(“Promo code detected: ” + $scope.models[‘promo_code’]); } // set the platform value $scope.models[‘platform’] = Cdi.Core.Analytics.currentPlatform; // get the origin value var origin = localStorage.getItem(‘origin’); $scope.models[‘origin’] = origin != null ? origin : ”; // set the udid value to be passed to php $scope.getBFGUDID(function(udid) { $scope.models[‘udid’] = udid; }); // set the IDFA value to be passed to php $scope.getIDFA(function(idfa) { $scope.models[‘idfa’] = idfa; }); // Loop through each set of fields in the config. // The multiple sets are used to break field inputs into different columns, allowing more versatile // responsive behaviors. var i, c; var signupFields = []; if($scope.config.hasOwnProperty(‘fields’)) { for(c = 0; c 0 ? $scope.models[‘dobMonth’] : 1; $scope.updateDobDaysFromMonth(tmp); // Populate years for the last 120 years. $scope.dobYears = [‘YYYY’]; var currentYear = new Date().getFullYear(); for(i = currentYear – 10; i >= currentYear – 120; i–) { $scope.dobYears.push(i); } // Pre-select first dropdown option to prevent Angular from creating empty dropdown option. $scope.models[‘dobYear’] = $scope.dobYears[0]; $scope.models[‘dobMonth’] = $scope.dobMonths[0]; $scope.models[‘dobDay’] = $scope.dobDays[0]; }; /** * updateDobDaysFromMonth * Update the dob select for ‘day of month’ and update it with the appropriate range of valid * numeric values for the currently selected month (as far as we can gather) * @param month {string} String representation of numeric month of year (1-12) */ $scope.updateDobDaysFromMonth = function(month) { // Constrain month to valid 1-12 value. month = parseInt(month) > 0 && parseInt(month) 0 ? $scope.models[‘dobYear’] : new Date().getFullYear(); // Cheap leap year check. if(new Date(year, 1, 29).getMonth() == 1) { limit = 29; } } // Rebuild list of days. for(var i = 1; i 0 ? $scope.models[‘dobMonth’] : 1); } // Normal value handling – all fields. if(value.length > 0) { $scope.models[field] = value; } }; /** * validateField * Validate the specified field is ready to be submitted to the backend. * @param field {string|object} Name of field to validate or field object itself from config. * @param checkForWebserviceRequest {boolean} optional Whether or not to hit Registration webservice. */ $scope.validateField = function(field, checkForWebserviceRequest) { // We accept string name or object, if string, look up object. if(typeof field == ‘string’) { field = $scope.lookupFieldByName(field); if(field === false) { return false; } } // SSN and DOB fields have separate handlers. if(field.name == ‘ssn’) { return $scope.validateSSN(field); } else if(field.name == ‘dob’) { return $scope.validateDOB(field); } // Whether or not to check if field should create/update RA record if valid? checkForWebserviceRequest = (typeof checkForWebserviceRequest == ‘undefined’) ? false : !!checkForWebserviceRequest; // List of errors. var errors = []; // Cache a few re-used basic checks. var hasMask = field.hasOwnProperty(‘mask’) && field.mask != “”; var hasInvalidMaskedValue = hasMask && (!$scope.models.hasOwnProperty(field.name) || $scope.models[field.name] == undefined); var isRequired = field.hasOwnProperty(‘required’) && field[‘required’] == true; var hasValue = hasInvalidMaskedValue || ($scope.models.hasOwnProperty(field.name) && $scope.models[field.name].toString().length > 0 && $scope.models[field.name] != field[‘placeholder’]); var isFormerAddress = field.hasOwnProperty(‘formerAddress’) && $scope.models.hasOwnProperty(‘needsFormerAddress’); var isRequiredForFormerAddress = $scope.models[‘needsFormerAddress’].toLowerCase() == ‘yes’ && field.hasOwnProperty(‘formerRequired’) && field[‘formerRequired’]; var hasRegex = field.hasOwnProperty(‘pattern’); var matchesPattern = hasValue && hasRegex && !hasInvalidMaskedValue ? $scope.models[field.name].toString().match(field[‘pattern’]) : false; var hasRAHook = field.hasOwnProperty(‘raHook’) && field[‘raHook’] == true; var hasUpdateLocation = field.hasOwnProperty(‘updateLocation’) && field[‘updateLocation’] == true; // Check if field has value provided. // This check is only on non-form submission validations and intended to clear validated styles if the box was emptied of a valid value. if(!$scope.isFinalValidation && !hasValue) { if($scope.validated.hasOwnProperty(field.name)) { delete $scope.validated[field.name]; } if($scope.errors.hasOwnProperty(field.name)) { delete $scope.errors[field.name]; } if(field.name == ‘cam_username’) { $scope.availCheck.lastCheckedValue = ”; } return true; } /** * Required field check. * Occurs when field is required, either under normal required:true or as a former address field. **/ if(isRequired || (isFormerAddress && isRequiredForFormerAddress)) { if(!hasValue) { if(field.hasOwnProperty(‘requiredMessage’)) { //noinspection JSUnresolvedVariable errors.push(field.requiredMessage); } else { errors.push(‘You must provide a value for \” + field.name + ‘\”); } } } /** * Banned state list check. */ if(errors.length 0) { // Delete validation record, add errors, return. delete $scope.validated[field.name]; $scope.errors[field.name] = errors.join(‘,’); console.log(field.name + ‘ error: ‘ + $scope.errors[field.name]); return errors; } else { // Add validation record, delete any errors. $scope.validated[field.name] = true; delete $scope.errors[field.name]; // Fire virtual page view here. if(!$scope.isFinalValidation) { $scope.fireFieldVPV(field); } } // If update location option detected, fire a request to the location endpoint if(checkForWebserviceRequest && hasUpdateLocation) { $scope.updateLocation(); } // Otherwise no errors found, field validated. // If RA Hook option detected, fire a request to the RA handler. if(checkForWebserviceRequest && hasRAHook) { $scope.reportRA(); } return true; }; $scope.validateConfirmation = function(field) { // Generate name of confirmation field. var confirmField = ‘confirm’ + field.name[0].toUpperCase() + field.name.substring(1); // Booleans for validation results. var confirmError = false; var checkedForMatch = false; var matches = false; // Cache a few re-used basic checks. var fieldType = field.hasOwnProperty(‘type’) && field[‘type’] != ‘text’ ? field[‘type’] : ‘text’; var doWePerformConfirm = field.hasOwnProperty(‘confirm’) && field[‘confirm’] == true; var hasValue = doWePerformConfirm && $scope.models.hasOwnProperty(field.name) && $scope.models[field.name].length > 0 && $scope.models[field.name] != field[‘placeholder’]; var hasConfirmValue = $scope.models.hasOwnProperty(confirmField) && $scope.models[confirmField].length > 0; // Confirmation check – requires matching value to fieldName under confirmFieldName if((fieldType == ‘password’) || (fieldType == ‘text’) && doWePerformConfirm) { // Do we have a value for the confirmation field at all? if(!hasConfirmValue) { confirmError = true; } // Does the confirmation value match the original value? if(!confirmError && hasValue && hasConfirmValue) { checkedForMatch = true; if(field.hasOwnProperty(‘confirmCaseSensitive’) && field[‘confirmCaseSensitive’]) { matches = $scope.models[field.name] == $scope.models[confirmField]; } else { matches = $scope.models[field.name].toLowerCase() == $scope.models[confirmField].toLowerCase(); } if(!matches) { confirmError = true; $scope.errors[confirmField] = field.hasOwnProperty(‘confirmErrorMessage’) ? field[‘confirmErrorMessage’] : “Field and confirmation field do not match.”; } } // Show encountered error on final validation OR // any time ‘base’ field has a value but ‘confirm’ does not. if(confirmError && (hasValue || $scope.isFinalValidation)) { if(field.hasOwnProperty(‘confirmMessage’)) { //noinspection JSUnresolvedVariable $scope.errors[confirmField] = field.confirmMessage; } else if($scope.isFinalValidation) { $scope.errors[confirmField] = field.hasOwnProperty(‘confirmErrorMessage’) ? field[‘confirmErrorMessage’] : “Field and confirmation field do not match.”; } } // Fire confirm VPV if present. if(!confirmError && field.hasOwnProperty(‘confirmSuccessVPV’)) { $scope.fireVirtualPageView(field[‘confirmSuccessVPV’]); } } // Confirmation error handling. if(confirmError) { // Remove validated record, return current confirmation error. delete $scope.validated[confirmField]; return $scope.errors[confirmField]; } else if(!checkedForMatch || matches) { // Add validated record, remove any confirmation error. $scope.validated[confirmField] = true; delete $scope.errors[confirmField]; return true; } // Do nothing. return “”; }; /** * validateSSN * Placeholder for validating social security number block of 3 text inputs. * @param field {object} SSN field object from config. */ $scope.validateSSN = function(field) { // Booleans for validation results. var ssnValue = ”; var ssnError = false; var ssnPartMissing = false; // Store a few basic checks. var hasGroup1 = $scope.models.hasOwnProperty(‘ssnGroup1’) && $scope.models[‘ssnGroup1’].toString().length > 0; var hasGroup2 = $scope.models.hasOwnProperty(‘ssnGroup2’) && $scope.models[‘ssnGroup2’].toString().length > 0; var hasGroup3 = $scope.models.hasOwnProperty(‘ssnGroup3’) && $scope.models[‘ssnGroup3’].toString().length > 0; // SSN Mode – Only 9-digit mode needs first 2 groups. if($scope.ssnMode == 9) { // First group – 3 digits if(hasGroup1) { if(/^\d{3}$/.test($scope.models[‘ssnGroup1’])) { ssnValue += $scope.models[‘ssnGroup1’]; } else { ssnError = true; } } else { ssnPartMissing = true; } // Second group – 2 digits if(hasGroup2) { if(/^\d{2}$/.test($scope.models[‘ssnGroup2’])) { ssnValue += $scope.models[‘ssnGroup2’]; } else { ssnError = true; } } else { ssnPartMissing = true; } } // SSN Mode – 4-digit and 9-digit modes need last group of 4. if($scope.ssnMode == 9 || $scope.ssnMode == 4) { // Third group – 4 digits if(hasGroup3) { if(/^\d{4}$/.test($scope.models[‘ssnGroup3’])) { ssnValue += $scope.models[‘ssnGroup3’]; } else { ssnError = true; } } else { ssnPartMissing = true; } } // No errors on model detected. if(!ssnError && !ssnPartMissing) { // Add validation records, update value, delete errors. $scope.models[‘ssn’] = ssnValue; $scope.validated[‘ssn’] = true; delete $scope.errors[‘ssn’]; // Fire virtual page view here. if(!$scope.isFinalValidation) { $scope.fireFieldVPV(field); } } // If error was encountered, or a required # group is missing on final submission, // set that up and remove any validation records. if(ssnError || ($scope.isFinalValidation && ssnPartMissing)) { if($scope.ssnMode == 9) { $scope.errors[‘ssn’] = ‘SSN must be provided in the format XXX XX XXXX, where X is a number.’; } else if($scope.ssnMode == 4) { $scope.errors[‘ssn’] = ‘SSN must be provided in the format ####, where # is a number.’; } delete $scope.validated[‘ssn’]; return false; } // Do not show error from missing numbers until final validation pass on form submission. else if(!$scope.isFinalValidation && ssnPartMissing) { if($scope.validated.hasOwnProperty(‘ssn’)) { delete $scope.validated[‘ssn’]; } if($scope.errors.hasOwnProperty(‘ssn’)) { delete $scope.errors[‘ssn’]; } return false; } // Passes validation. return true; }; /** * validateDOB * Placeholder for validating dob field as a valid date from 3 selects * @param field {string} DOB field object from config. */ $scope.validateDOB = function(field) { var dobValue = ”; var dobError = ”; var numericPattern = /^\d+$/; // DOB Mode – All 3 values should be set, check them individually and concatenate them together. // First input – Year if($scope.models.hasOwnProperty(‘dobYear’)) { if(!$scope.isFinalValidation && $scope.models[‘dobYear’].toString().toLowerCase() == “yyyy”) { if($scope.validated.hasOwnProperty(‘dob’)) { delete $scope.validated[‘dob’]; } return false; } if(numericPattern.test($scope.models[‘dobYear’]) && $scope.models[‘dobYear’].toString().length == 4) { dobValue += $scope.models[‘dobYear’]; } else { dobError = ‘Please provide your full date of birth.’; } } // Second input – Month if(dobError == ” && $scope.models.hasOwnProperty(‘dobMonth’)) { if(!$scope.isFinalValidation && $scope.models[‘dobMonth’].toString().toLowerCase() == “mm”) { if($scope.validated.hasOwnProperty(‘dob’)) { delete $scope.validated[‘dob’]; } return false; } if(numericPattern.test($scope.models[‘dobMonth’]) && $scope.models[‘dobMonth’].toString().length == 2) { dobValue += ‘-‘ + $scope.models[‘dobMonth’]; } else { dobError = ‘You must provide the month of your birth.’; } } // Third input – Day if(dobError == ” && $scope.models.hasOwnProperty(‘dobDay’)) { if(!$scope.isFinalValidation && $scope.models[‘dobDay’].toString().toLowerCase() == “dd”) { if($scope.validated.hasOwnProperty(‘dob’)) { delete $scope.validated[‘dob’]; } return false; } if(numericPattern.test($scope.models[‘dobDay’]) && $scope.models[‘dobDay’].toString().length == 2) { dobValue += ‘-‘ + $scope.models[‘dobDay’]; } else { dobError = ‘You must provide the day of your birth.’; } } // Populate DOB field with concatenated parts from dropdown. if(dobError == ”) { $scope.models[‘dob’] = dobValue; } // Check against validation pattern. if(dobError == ”) { if(field.hasOwnProperty(‘pattern’)) { if(!dobValue.match(field[‘pattern’])) { dobError = ‘Invalid date format for DOB provided.’; } } } // If no errors, and state is provided, check if minimum age req is met. if(dobError == ” && $scope.models.hasOwnProperty(‘state’) && $scope.models[‘state’].length > 0 && $scope.isUserOldEnough() == -1) { dobError = ‘You do not meet the minimum age requirement for your state of residence.’; } // Store validated value in model. if(dobError == ”) { $scope.validated[‘dob’] = true; delete $scope.errors[‘dob’]; // Fire virtual page view here. if(!$scope.isFinalValidation) { $scope.fireFieldVPV(field); } } else { // Set errors on model if detected and return. $scope.errors[‘dob’] = dobError; delete $scope.validated[‘dob’]; return dobError; } // Passes validation. return true; }; /** * isUserOldEnough * * @return number 1 if old enough, -1 if not old enough, 0 if not enough data to determine. */ $scope.isUserOldEnough = function() { var dob; if($scope.models.hasOwnProperty(‘dob’) && $scope.models[‘dob’].length > 0) { dob = $scope.models[‘dob’].split(/[- :]/); for(var i = 0; i 0) { errors = errors.concat(result); } } } } // If no errors, attempt the actual signup. if(errors.length 0) { var expires = new Date(new Date().getTime() + 86400000).toGMTString(); // Now +1d //noinspection JSValidateTypes document.cookie = “REGISTRATION_FAILURE=” + code + “; path=/”; } // Callback for failure if($scope.hasNonEmptyValue($scope.autoLogin, ‘useCallbacks’)) { if($scope.hasNonEmptyValue($scope.autoLogin, ‘failureCallback’)) { // Eval is evil, get function off window. var callback = window[$scope.autoLogin[‘failureCallback’]]; // Fire callback. if(typeof callback == ‘function’) { callback(data); } else { console.log(“Could not find a failure callback function by the name of: ” + $scope.autoLogin[‘failureCallback’]); } } } // Handled by full page POST to login script. else if($scope.hasNonEmptyValue($scope.register, ‘failureRedirect’)) { console.log(“Redirect target: ” + $scope.register[‘failureRedirect’]); window.location.href = $scope.register[‘failureRedirect’]; } } }; $scope.isSoftFailure = function(statusString) { if($scope.isMobile) { return false; } var softFailureErrors = { “ERROR_USERNAME_ALREADY_EXISTS” : “ERROR_USERNAME_ALREADY_EXISTS” }; return softFailureErrors.hasOwnProperty(statusString); }; /** * lookupFailureVPVCode * @param errorType string Registration response error code. * @returns string Failure VPV code mapping to response error code. */ $scope.lookupFailureVPVCode = function(errorType) { console.log(‘Looking up error code: ‘ + errorType); var knownErrors = { “IDCHECK_FAILED” : “IdentityCheck”, “SSN_DUPLICATE” : “DuplicateAccount”, “SSN_BLACKLISTED” : “BlacklistedAccount” }; if(knownErrors.hasOwnProperty(errorType)) { return “/Virtual/Account/Signup/” + knownErrors[errorType]; } return “/Virtual/Account/Signup/UnknownError”; }; /** * inArray * Array search helper method (sequential) * @return {boolean} Whether or not the specified key was found in the array. */ $scope.inArray = function(needle, haystack) { var length = haystack.length; for(var i = 0; i 0 */ $scope.hasNonEmptyValue = function(object, key) { var objValue = object[key]; if(typeof objValue === ‘number’) { objValue = objValue.toString(); } if(typeof objValue === ‘undefined’) { objValue = ”; } return (object.hasOwnProperty(key) && (objValue.length > 0 || objValue == true)); }; $scope.cancelSubmit = function() { if ($scope.isMobile) { TSM.Home.show(); } }; /** * Sets reg failed local storage storage var * @return none */ $scope.setFailedLocalStorageVar = function(){ localStorage.setItem(“tracking_registration_failed”,true); }; $scope.resetAbandonedRegistrationFlag = function() { if(window.hasOwnProperty(‘localStorage’)) { localStorage.setItem(TRACKING_REGISTRATION_ABANDONED_KEY, false); } }; // Initialize form using configuration currently in $scope.config. $scope.initializeForm(); }]); angular.module(‘registration’).directive(‘registration’, function() { return { restrict: ‘AE’, templateUrl: ‘templates/registration.html’, controller: ‘registrationController’, link: function(scope, element) { scope.showRegistration = true; scope.showVerficationFailed = false; scope.showRegBack = false; scope.showBackInfo = function() { scope.$evalAsync(function() { if (scope.showVerficationFailed === true) { TSM.Home.show(); return; } scope.showRegistration = false; scope.showVerficationFailed = false; scope.showRegBack = true; $(‘#registerBack’).hide(); }); }; } }; }); angular.module(‘registration’).directive(‘textualInput’, [‘$compile’, function($compile) { return { restrict: ‘E’, link: function(scope, elem, attr) { // compile the output of the template before adding to the DOM // doing this because IE won’t allow a change to the type attr // of inputs so angular won’t allow it to be dynamic var inputHtml = ““; inputHtml += ““; var compiledHtml = $compile(inputHtml)(scope); elem.replaceWith(compiledHtml); if(scope.field.hasOwnProperty(‘mask’) && scope.field.mask) { elem.blur(); } } }; }]); angular.module(‘registration’).directive(‘placeholder’, [‘$timeout’, function ($timeout) { if (!angular.mock) { var test = document.createElement(‘input’); if (test.placeholder !== void 0) return {}; } return { restrict: ‘A’, require: ‘?ngModel’, priority: 1, link: function (scope, elem, attrs, ngModel) { var orig_val = getValue(), is_pwd = attrs.type === ‘password’, text = attrs.placeholder, emptyClassName = ’empty’, domElem = elem[0], clone; if (!text) { return; } if (is_pwd) { setupPasswordPlaceholder(); } setValueWithModel(orig_val); elem.bind(‘focus’, function () { if (elem.hasClass(emptyClassName)) { elem.val(”); elem.removeClass(emptyClassName); elem.removeClass(‘error’); } }); elem.bind(‘blur’, updateValue); // because the ui-mask wants to blank the placeholder value, // we have to watch for when the value changes // and update the placeholder value accordingly var maskWatcher = scope.$watch(attrs.ngModel, function() { // $watch returns a function to disable it, // we need to disable it in order for the mask to // not mess up the placeholder functionality for IE9 // after it’s already set its initial masking value maskWatcher(); updateValue(); }); if (!ngModel) { elem.bind(‘change’, updateValue); } if (ngModel) { ngModel.$render = function () { setValue(ngModel.$viewValue); }; } function updateValue(e) { var val = elem.val(); if (elem.hasClass(emptyClassName) && val === text) { return; } if (document.documentMode ‘).attr(angular.extend(extractAttributes(domElem), { ‘type’: undefined, ‘value’: text, ‘placeholder’: ”, ‘id’: ”, ‘name’: ” })).addClass(emptyClassName).addClass(‘ng-hide’).bind(‘focus’, hidePasswordPlaceholderAndFocus); domElem.parentNode.insertBefore(clone[0], domElem); } function showPasswordPlaceholder() { clone.val(text); elem.addClass(‘ng-hide’); clone.removeClass(‘ng-hide’); } function hidePasswordPlaceholder() { clone.addClass(‘ng-hide’); elem.removeClass(‘ng-hide’); } function hidePasswordPlaceholderAndFocus() { hidePasswordPlaceholder(); domElem.focus(); } function extractAttributes(element) { var attr = element.attributes, copy = {}, skip = /^jQuery\d+/; for (var i = 0; i Modal content‘; // Modal content $scope.showTermsModal = false; // Toggle for showing/hiding modal $scope.messageAction = $scope.isMobile ? ‘submitting’ : ‘clicking’; // Resizing fixes so the terms modal places nice on tablet/mobile resize. angular.element($window).on(‘resize’, $scope.resizeTerms); angular.element($window).on(‘orientationchange’, $scope.resizeTerms); /** * readTerms * Open a modal with the terms of service for this registration event. */ $scope.readTerms = function() { // GET request to endpoint with ToS data. if (typeof Cdi != “undefined” && typeof Cdi.AppConfig != “undefined” && typeof Cdi.AppConfig.isNative != “undefined” && Cdi.AppConfig.isNative) { $scope.termsSource = “resources/shared/extlibs/tsui/widgets/registration/terms.json”; } else if(!$scope.isMobile && $scope.termsSourceStandalone) { $scope.termsSource = $scope.termsSourceStandalone; } $http.get($scope.termsSource).then(function(response) { if (response.hasOwnProperty(‘data’) && response.data.hasOwnProperty(‘content’)) { $scope.modalContent = response.data.content.replace(/(?:\r\n|\r|\n|\t)/g, “”); } else if (typeof response == ‘string’ && response.length > 0) { $scope.modalContent = response; } else { $scope.modalContent = ‘We were unable to load your terms of service.’; } // Show modal. $scope.showTermsModal = true; // Apply the terms sizing fix html loads and animates. angular.element(“.app-modal-box”) .one(‘webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend’, $scope.resizeTerms); }, function() { $scope.modalContent = ‘We were unable to load your terms of service.’; $scope.showTermsModal = true; }); }; /** * closeTerms * Close the ToS modal. */ $scope.closeTerms = function() { $scope.showTermsModal = false; $scope.$apply(); }; /** * resizeTerms * Resize Terms and conditions modal to fit within screen. */ $scope.resizeTerms = function() { var boxEl; if (angular.element(‘.app-modal-box’).length) { if ($(“#registration .app-modal-box”).is(“:visible”)) { boxEl = $(“#registration”); } else { boxEl = $(“#terms”); } var topOffset = boxEl.find(‘.app-modal-box’).get(0).getBoundingClientRect()[‘top’]; var bottomOffset = boxEl.find(‘.app-modal-box’).get(0).getBoundingClientRect()[‘bottom’]; var modalHeight = bottomOffset – topOffset; var titleHeight = boxEl.find(‘.app-modal-box .title’).outerHeight(true); var buttonHeight = boxEl.find(‘.app-modal-box .registration-button-container’).outerHeight(true); var whiteSpace = (boxEl.find(‘.app-modal .inner’).outerHeight(true) – boxEl.find(‘.app-modal .inner’).innerHeight()) + 4; console.log(‘modalHeight: ‘ + modalHeight + ‘px’); console.log(‘titleHeight: ‘ + titleHeight + ‘px’); console.log(‘buttonHeight: ‘ + buttonHeight + ‘px’); console.log(‘whiteSpace: ‘ + whiteSpace + ‘px’); var newHeight = modalHeight – titleHeight – buttonHeight – whiteSpace; if (newHeight