client-ui
Version:
Testing implementation of nodeJs Backend, angular frontend, and hopefully in a way that this can be deployed to s3/cloudfront
291 lines (286 loc) • 8.88 kB
JavaScript
var hostnameParts = window.location.hostname.split('.'),
envName = (hostnameParts.length > 2) ? hostnameParts[hostnameParts.length - 3] : '',
domainRoot = hostnameParts[hostnameParts.length - 2] + '.' + hostnameParts[hostnameParts.length - 1];
var config = {
loanMin: 2000
,loanMax: 35000
,loanMinIR: 5.04
,loanMaxIR: 24.99
,states: ['AL','AK','AZ','AR','CA','CO','CT','DC','DE','FL','GA','HI','ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT','NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VT','VA','WA','WV','WI','WY']
,months: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
,days: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
,invalidStates: ["CO", "IA", "NV"]
,homes: {
rent: 'Rent',
mortgage: 'Mortgage',
own: 'Own'
}
,stateMinimums: {
"NM": 2501,
"MA": 6001,
"OH": 5001
}
,interestMaximums: {
"CT": 9.00,
"NY": 13.00,
"VT": 15.00,
"WV": 15.00
}
,ageMinimumDefault: 18
,stateAgeMinimums: {
"AL": 19,
"NE": 19
}
,stateLicensing: {
0: {
state: "Arizona",
license : "Collection Agency",
licenseNumber: "CA - 0932172"
},
1: {
state: "Arkansas",
license : "Collection Agency",
licenseNumber: "5147"
},
2: {
state: "Kansas",
license: "Supervised Loan",
licenseNumber: "SL.0026580"
},
3: {
state: "Kansas",
license: "Consumer Credit Code Notification",
licenseNumber: "NOT.0026242"
},
4: {
state: "Louisiana",
license: "Collection Agency Registration",
licenseNumber: "420140761"
},
5: {
state: "Maryland",
license: "Collection Agency",
licenseNumber: "7254"
},
6: {
state: "Montana",
license: "Consumer Loan",
licenseNumber: "1399530"
},
7:{
state: "New Jersey",
license: "Consumer Lender",
licenseNumber: "1501958"
},
8:{
state: "North Dakota",
license: "Money Broker License",
licenseNumber: "MB102916"
},
9: {
state: "North Dakota",
license: "Collection Agency License",
licenseNumber: "CA102915"
},
10: {
state: "Oklahoma",
license: "Supervised Lender",
licenseNumber: "SL008278"
},
11: {
state: "Oregon",
license: "Consumer Finance Lender",
licenseNumber: "0418-001-C"
},
12: {
state: "Oregon",
license: "Collection Agency",
licenseNumber: "50123"
},
13: {
state: "Pennsylvania",
license: "Credit Services Loan Broker",
licenseNumber: "54473"
},
14: {
state: "Rhode Island",
license: "Loan Broker License",
licenseNumber: "20163190LB"
},
15: {
state: "South Dakota",
license: "Money Lender License",
licenseNumber: "MYL 3164"
},
16: {
state: "Texas",
license: "Regulated Loan License",
licenseNumber: "1500053580-153935"
},
17: {
state: "Utah",
license: "Consumer Credit Code Notification",
licenseNumber: false
},
18: {
state: "Utah",
license: "Collection Agency Registration",
licenseNumber: "9499336-0131"
},
19: {
state: "West Virginia",
license: "Collection Agency Registration",
licenseNumber: "2320-6722"
},
20: {
state: "NMLS#: 1399530",
license: false,
licenseNumber: false
}
}
,getAgeMinimumByState: function(state){
return this.stateAgeMinimums[state] || this.ageMinimumDefault;
}
,stateNames: {
"AL": "Alabama",
"AK": "Alaska",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
"DC": "District Of Columbia",
"FL": "Florida",
"GA": "Georgia",
"HI": "Hawaii",
"ID": "Idaho",
"IL": "Illinois",
"IN": "Indiana",
"IA": "Iowa",
"KS": "Kansas",
"KY": "Kentucky",
"LA": "Louisiana",
"ME": "Maine",
"MD": "Maryland",
"MA": "Massachusetts",
"MI": "Michigan",
"MN": "Minnesota",
"MS": "Mississippi",
"MO": "Missouri",
"MT": "Montana",
"NE": "Nebraska",
"NV": "Nevada",
"NH": "New Hampshire",
"NJ": "New Jersey",
"NM": "New Mexico",
"NY": "New York",
"NC": "North Carolina",
"ND": "North Dakota",
"OH": "Ohio",
"OK": "Oklahoma",
"OR": "Oregon",
"PA": "Pennsylvania",
"RI": "Rhode Island",
"SC": "South Carolina",
"SD": "South Dakota",
"TN": "Tennessee",
"TX": "Texas",
"UT": "Utah",
"VT": "Vermont",
"VA": "Virginia",
"WA": "Washington",
"WV": "West Virginia",
"WI": "Wisconsin",
"WY": "Wyoming"
}
,empStatus: {
'1': {
display: 'Employed',
len: "Employed"
},
'2': {
display: 'Self-Employed',
len: "Self-Employed"
},
'3': {
display: 'Retired',
len: "Retired"
},
'4': {
display: 'Other',
len: "Other"
}
}
,areYouHuman: '<script type=\"text\/javascript\" src=\"https:\/\/n-cdn.areyouahuman.com/play\/fbcf36fec2552130809c6457e7a36aaeba6f3307\"><\/script><noscript><img src=\"https:\/\/n-cdn.areyouahuman.com\/noscript\/fbcf36fec2552130809c6457e7a36aaeba6f3307\"><\/noscript>'
,cardExpirationYears: function() {
var years = [];
var startYear = new Date().getFullYear();
for (var currYear = startYear; currYear <= startYear + 10; currYear++) {
years.push(currYear);
}
return years;
}()
,googleSiteKey: '6Lemcw0TAAAAAOaXXIi2pxFXfhCrbB33SjAVSqNy'
,loanTypes: {
debtConsolidation: 'Debt Consolidation',
homeImprovement: 'Home Improvement',
medicalExpenses: 'Medical Expenses',
business: 'Business',
auto: 'Auto',
other: 'Other'
}
,coreApiUrl: '//api.' + window.location.host.replace(/^www\./, '') + '/v1/'
,staticContentDomainRoot: 'static.' + domainRoot
,s3DomainRoot: 's3-us-west-2.amazonaws.com/'
,domainRoot: domainRoot
,envName: envName
,fastFundMaxAmount: 9999
,isProduction: function() {
return config.envName === 'www';
}
,initializeGoogleAnalytics: function (page) {
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-70094578-1', 'auto');
if(page){
ga('send', 'pageview', page);
}
}
,enableBootstrapJsElements: function () {
$(function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="checkbox"]').radiocheck();
});
}
,scrollToTop: function (offset) {
var ot = 0;
if (offset) {
if (typeof offset === 'number') {
ot = offset;
}
if (typeof offset === 'string') {
var offsetEl = $(offset);
if (offsetEl && offsetEl.offset()) {
ot = offsetEl.offset().top;
}
}
}
$("html, body").animate({scrollTop: ot}, 200);
}
};
//collapses mobile menu when user makes selection
$(document).on('click.nav', '.navbar-collapse.in', function(e) {
if ($(e.target).is('a')) {
$(this).removeClass('in').addClass('collapse');
}
});