{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/scripts/header.js","webpack:///./src/scripts/responding-promotion.js","webpack:///./src/scripts/alerts-banner.js","webpack:///./src/scripts/scroll-to-container.js","webpack:///./src/scripts/anchor-link-cta.js","webpack:///./src/scripts/form-add-placeholders.js","webpack:///./src/scripts/form-modal.js","webpack:///./src/scripts/global-popup-overlay.js","webpack:///./src/scripts/leave-site-notice.js","webpack:///./src/scripts/popover.js","webpack:///./src/scripts/quiz.js"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","0","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","body","document","querySelector","addEventListener","e","togglerExpanded","currentTarget","getAttribute","console","log","classList","remove","add","promoContainer","referenceCodeField","showHidePromoBtn","invalidPromoCode","contains","focus","dismissedAlerts","sessionStorage","getItem","split","$","each","alertName","this","indexOf","removeClass","alert","on","setItem","join","addClass","scrollToContainer","hash","anchorLinkCta","yOffset","offsetTop","anchorLinkCtaHeight","clientHeight","setTimeout","scrollTo","top","left","behavior","anchorLinkCtaLinks","querySelectorAll","handleStickyAnchorLinksCTA","headerHeight","containerRect","getBoundingClientRect","style","removeAttribute","anchorCtaLinks","preventDefault","linkHref","hrefIndexOfHash","location","numberOfAnchorLinks","anchorCTA","checkNumAnchorLinks","forEach","link","hideLabelsContainer","formGroup","labelTitle","firstElementChild","groupInput","setAttribute","$formModalLabel","modalId","closest","attr","trigger","modalDialog","triggerDelay","modal","backdrop","setSessionStorage","targetBlank","hrefVal","open","href","$anchor","domain","url","replace","charAt","hostname","match","getDomain","LinkTarget","isWhitelisted","whiteList","some","res","includes","target","text","showLeaveSiteNotice","popover","html","content","phonePopoverContentHTML","phonePopoverContent","innerHTML","calculator","debug","debug_log","dq","$container","$containerCopy","clone","resultStr","_resultStr","_attrGroup","_attrCollection","arr","Array","isArray","sort","a","b","filter","v","pop","validKey","st","toLowerCase","init","retry","prependTo","find","prop","savedAnswers","localStorage","removeItem","hide","bindings","keypress","event","which","answer_handler","hasClass","toggleClass","reset","valid","saveAnswers","index","answer","question","next","val","show","element","JSON","stringify","formResponse","setInterval","strRP","clearInterval","$answer","attr_group","attr_value","attr_weight","attr_dq","parent","submit_handler","ready"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOpB,IAAK,GAC5Be,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EA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rC1C,EAAWrH,GAAKtC,KAAKoN,OAXa,CAEtCzD,EAAWrH,GAAO,GAGlB,IAAK,IAAI+J,EAAQ,EAAGA,EAAQgB,EAAahB,IACrC1C,EAAWrH,GAAKtC,KAAKoN,GAUzBzD,EAAWC,QACXD,EAAWE,UAAU7J,KAAK2J,EAAWS,YACrC5G,QAAQC,IAAIkG,EAAWE,UAAW,iCAK1C2D,eAAgB,WACR7D,EAAWC,QACXD,EAAWE,UAAU7J,KAAK2J,EAAWO,WACrC1G,QAAQC,IAAIkG,EAAWE,UAAW,iBAG1CqC,MAAO,WACCvC,EAAWC,QACXD,EAAWE,UAAU7J,KAAK,sBAC1BwD,QAAQC,IAAIkG,EAAWE,UAAW,sBAClCrG,QAAQC,IAAIkG,EAAY,0BAK5BpF,IAAE,4CAA4CmH,OAC9CnH,IAAE,eAAemH,OACjBnH,IAAE,yBAAyB+G,KAAK,WAAW,GAC3C3B,EAAWS,WAAa,GACxBT,EAAWU,gBAAkB,GAC7BV,EAAWO,UAAYP,EAAWQ,WAClCR,EAAWG,IAAK,EAChB,IAAIkD,EAAQrD,EAAWI,WAAWsB,KAAK,UAAUlC,OACjD6D,EAAQA,EAAMzE,QAAQ,QAAS,aAC/BoB,EAAWI,WAAWsB,KAAK,UAAUlC,KAAK6D,GAIhDnK,OAAO6D,SAASyB,KAAOtF,OAAO6D,SAASyB,KAAO,oBAO9C5D,IAAEtB,UAAUwK,OAAM,WAEZlJ,IAAE,mBAAmB7E,QACvBiK,EAAWuB,UAotBX3G,IAAE,mBAAmB7E,O","file":"main.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t0: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([99,1]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","const body = document.querySelector('body');\r\nconst navbarToggler = document.querySelector('.navbar-toggler');\r\n\r\nfunction handleNavbarToggler(e) {\r\n const toggler = e.currentTarget;\r\n const togglerExpanded = toggler.getAttribute('aria-expanded');\r\n\r\n console.log(togglerExpanded);\r\n togglerExpanded === 'true'\r\n ? body.classList.remove('overflow-hidden')\r\n : body.classList.add('overflow-hidden');\r\n}\r\n\r\nnavbarToggler.addEventListener('click', handleNavbarToggler);\r\n","const promoContainer = document.querySelector('.responding-promotion');\r\nconst referenceCodeField = document.querySelector('.reference-code-field');\r\nconst showHidePromoBtn = document.querySelector('#showHidePromoBtn');\r\nconst invalidPromoCode = document.querySelector('#invalidPromoCode');\r\n\r\nfunction handlePromoVisibility(e) {\r\n if (promoContainer.classList.contains('active')) {\r\n promoContainer.classList.remove('active');\r\n } else {\r\n promoContainer.classList.add('active');\r\n referenceCodeField.focus();\r\n }\r\n}\r\n\r\nif (showHidePromoBtn) {\r\n showHidePromoBtn.addEventListener('click', handlePromoVisibility);\r\n}\r\n\r\nif (invalidPromoCode) {\r\n promoContainer.classList.add('active');\r\n referenceCodeField.focus();\r\n}\r\n","import $ from 'jquery';\r\n\r\nconst dismissedAlertsStorageKey = 'dismissed-alerts';\r\nconst dismissedAlerts = sessionStorage.getItem(dismissedAlertsStorageKey) === null\r\n ? []\r\n : sessionStorage.getItem(dismissedAlertsStorageKey).split(';');\r\n\r\n// When an alert has been dismissed, then dismiss it for the rest of the session\r\n$('.alert-banner .alert').each(function() {\r\n const alertName = $(this).data('alert-name');\r\n if (dismissedAlerts.indexOf(alertName) !== -1) {\r\n $(this).removeClass(['fade', 'show']); // Hide the banner immediately!\r\n $(this).alert('close');\r\n } else {\r\n $(this).on('closed.bs.alert', function() {\r\n dismissedAlerts.push(alertName);\r\n sessionStorage.setItem(dismissedAlertsStorageKey, dismissedAlerts.join(';'));\r\n });\r\n }\r\n});\r\n\r\n// Show the alert banner after its alerts have been processed\r\n$('.alert-banner').addClass('show');\r\n","function scrollToContainer(hash) {\r\n const anchorLinkCta = document.querySelector('.anchor-link-cta');\r\n const yOffset = document.querySelector(hash).offsetTop;\r\n\r\n if (anchorLinkCta) {\r\n const anchorLinkCtaHeight = anchorLinkCta.clientHeight;\r\n setTimeout(() => {\r\n window.scrollTo({\r\n top: (yOffset - anchorLinkCtaHeight),\r\n left: 0,\r\n behavior: 'smooth' });\r\n }, 50);\r\n } else {\r\n setTimeout(() => {\r\n window.scrollTo({\r\n top: yOffset,\r\n left: 0,\r\n behavior: 'smooth' });\r\n }, 50);\r\n }\r\n}\r\n\r\nexport { scrollToContainer };\r\n","import { scrollToContainer } from './scroll-to-container.js';\r\n\r\nconst anchorLinkCta = document.querySelector('.anchor-link-cta');\r\nconst anchorLinkCtaLinks = anchorLinkCta ? anchorLinkCta.querySelectorAll('a') : '';\r\n\r\nfunction checkNumAnchorLinks() {\r\n if (anchorLinkCta) {\r\n const numberOfAnchorLinks = document.querySelectorAll('.anchor-link-cta li').length;\r\n const anchorCTA = document.querySelector('.anchor-link-cta .cta');\r\n\r\n if (numberOfAnchorLinks === 0 && anchorCTA === null) {\r\n anchorLinkCta.classList.add('editmode-only');\r\n }\r\n }\r\n}\r\n\r\nfunction handleStickyAnchorLinksCTA() {\r\n const headerHeight = document.querySelector('header').clientHeight;\r\n let containerRect = '';\r\n\r\n if (anchorLinkCta) {\r\n containerRect = anchorLinkCta.getBoundingClientRect();\r\n\r\n if (containerRect.top < headerHeight) {\r\n anchorLinkCta.style.top = headerHeight + 'px';\r\n } else if (containerRect.top === headerHeight) {\r\n anchorLinkCta.classList.add('active');\r\n } else {\r\n anchorLinkCta.classList.remove('active');\r\n anchorLinkCta.removeAttribute('style');\r\n }\r\n }\r\n}\r\n\r\nfunction anchorCtaLinks(e) {\r\n e.preventDefault();\r\n const linkHref = e.currentTarget.getAttribute('href');\r\n const hrefIndexOfHash = linkHref.indexOf('#');\r\n\r\n if(hrefIndexOfHash === -1) {\r\n window.location = linkHref;\r\n } else if(hrefIndexOfHash > 0) {\r\n const hash = '#' + linkHref.split('#')[1];\r\n\r\n scrollToContainer(hash);\r\n }\r\n}\r\n\r\nwindow.addEventListener('load', function () {\r\n checkNumAnchorLinks();\r\n handleStickyAnchorLinksCTA();\r\n\r\n // if url hash, scroll to container\r\n window.location.hash ? scrollToContainer(window.location.hash) : '';\r\n\r\n window.addEventListener('scroll', handleStickyAnchorLinksCTA);\r\n\r\n if (anchorLinkCtaLinks) {\r\n anchorLinkCtaLinks.forEach(function (link) {\r\n link.addEventListener('click', anchorCtaLinks);\r\n });\r\n }\r\n});\r\n","// add placeholder text if hide labels class is added to form\r\nconst hideLabelsContainer = document.querySelector('.visually-hide-labels');\r\n\r\nif (hideLabelsContainer) {\r\n const formGroups = hideLabelsContainer.querySelectorAll('.form-group');\r\n\r\n formGroups.forEach(function (formGroup) {\r\n const labelTitle = formGroup.firstElementChild.getAttribute('title');\r\n const groupInput = formGroup.querySelector('.form-control');\r\n\r\n if (labelTitle !== null) {\r\n groupInput.setAttribute('placeholder', labelTitle);\r\n }\r\n });\r\n}\r\n","import $ from 'jquery';\r\n\r\n// expose modal if form has errors or submission info\r\nlet $formModalLabel = $('.modal .ErrorLabel, .modal .InfoLabel');\r\nif ($formModalLabel) {\r\n let modalId = $formModalLabel.closest('.modal').attr('id')\r\n $('button[data-target$=\"' + modalId + '\"]').trigger('click');\r\n}\r\n","import $ from 'jquery';\r\n\r\n/* functions */\r\nfunction triggerModal() {\r\n let triggerDelay = $('#globalPopupOverlayModal').data('timing');\r\n setTimeout(function () {\r\n $('#globalPopupOverlayModal').modal({\r\n backdrop: 'static'\r\n });\r\n }, triggerDelay);\r\n}\r\n\r\nfunction modalDialog() {\r\n var sessionVal = sessionStorage.getItem('globalPopupOverlaySession');\r\n\r\n if (sessionVal !== 'dismissed')\r\n triggerModal();\r\n}\r\n\r\nfunction setSessionStorage() {\r\n sessionStorage.setItem('globalPopupOverlaySession', 'dismissed');\r\n}\r\n\r\nfunction modalClose() {\r\n $('#globalPopupOverlayModal').modal('hide');\r\n}\r\n\r\nfunction load() {\r\n modalDialog();\r\n}\r\n\r\n/* events */\r\n$('#globalPopupOverlayModal').on('hidden.bs.modal', function () {\r\n setSessionStorage();\r\n});\r\n\r\n$('.modal-footer a').on('click', function (e) {\r\n e.preventDefault();\r\n\r\n var targetBlank = $(this).attr('target'),\r\n hrefVal = $(this).attr('href');\r\n\r\n setSessionStorage();\r\n modalClose();\r\n\r\n if (targetBlank === '_blank') {\r\n window.open(hrefVal, '_blank');\r\n } else {\r\n window.location.href = hrefVal;\r\n }\r\n})\r\n\r\nload();\r\n","import $ from 'jquery';\r\n// Leave site notice modal on links using non-whitelisted external domains\r\n\r\n// Gets the domain from the provided URL\r\nfunction getDomain(url) {\r\n const prefix = /^https?:\\/\\//i;\r\n const domain = /^[^\\/:]+/;\r\n\r\n url = url.replace(prefix, '');\r\n\r\n if (url.charAt(0) === '/') {\r\n url = window.location.hostname + url;\r\n }\r\n\r\n const match = url.match(domain);\r\n if (match) {\r\n return match[0];\r\n }\r\n\r\n return null;\r\n}\r\n\r\n// Shows the leave site notice, using the provided anchor\r\nfunction showLeaveSiteNotice($anchor) {\r\n const url = $anchor.attr('href');\r\n const text = $anchor.text();\r\n const target = $anchor.attr('target');\r\n\r\n $('.modal').modal('hide'); // Hide all other modals before showing the leave site modal\r\n $('#leaveSiteModal').modal();\r\n\r\n $('#continueToSite').attr('href', url);\r\n $('#continueToSite').attr('target', target);\r\n}\r\n\r\n// Click event for page anchors\r\n$('body').on('click', 'a[href^=http]', function (e) {\r\n e.preventDefault();\r\n const $anchor = $(this);\r\n const domain = getDomain($anchor.attr('href'));\r\n const linkHref = $anchor.attr('href');\r\n const LinkTarget = $anchor.attr('target');\r\n const isWhitelisted = whiteList.some(res => res.includes(domain));\r\n\r\n if (domain.indexOf(location.hostname) === -1) {\r\n if (!isWhitelisted) {\r\n showLeaveSiteNotice($anchor);\r\n } else {\r\n LinkTarget\r\n ? window.open(linkHref, LinkTarget)\r\n : window.location = linkHref;\r\n }\r\n }\r\n});\r\n","import $ from 'jquery';\r\n\r\n$(function () {\r\n $('#phonePopover').popover({\r\n html: true,\r\n content: phonePopoverContentHTML,\r\n trigger: 'click',\r\n })\r\n});\r\n\r\nconst phonePopoverContent = document.querySelector('#phonePopoverContent');\r\nconst phonePopoverContentHTML = phonePopoverContent ? phonePopoverContent.innerHTML : '';\r\n","import $ from 'jquery';\r\n\r\nconst calculator = {\r\n debug: true,\r\n debug_log: ['offline'],\r\n dq: false,\r\n $container: $('#help-me-choose'),\r\n $containerCopy: $('#help-me-choose').clone(),\r\n resultStr: $('.custom-calculator-results strong strong').html(),\r\n _resultStr: $('.custom-calculator-results strong strong').html(),\r\n _attrGroup:[],\r\n _attrCollection:{},\r\n mode: (arr)=>{\r\n if (Array.isArray(arr)) {\r\n return arr.sort((a,b) =>\r\n arr.filter(v => v===a).length\r\n - arr.filter(v => v===b).length\r\n ).pop();\r\n } else { // assume we're given a string\r\n return arr;\r\n }\r\n },\r\n validKey: (st)=>{\r\n return (st.replace(/\\W/g,'').toLowerCase());\r\n },\r\n init: (retry)=>{\r\n if (calculator.debug) {\r\n calculator.debug_log.push('calculator.init()');\r\n calculator.debug_log.push('calculator online');\r\n console.log(calculator.debug_log);\r\n }\r\n // position form\r\n setTimeout(()=>{\r\n\r\n $('#product-selector-form').prependTo('.custom-calculator-controls');\r\n },900);\r\n\r\n //browsers remember selections\r\n //clear inputs to be sure\r\n let $inputsClear = calculator.$container.find('input');\r\n $inputsClear.prop('checked', false);\r\n\r\n let savedAnswers = localStorage.getItem('submittedProductSelector');\r\n if (savedAnswers) {\r\n console.log(savedAnswers);\r\n\r\n // $('#help-me-choose').replaceWith(savedAnswers);\r\n\r\n localStorage.removeItem('submittedProductSelector');\r\n\r\n }\r\n\r\n if (retry) {\r\n calculator['dq'] = false,\r\n calculator['resultStr'] = calculator._resultStr, //copy for later\r\n calculator['_attrGroup'] = [],\r\n calculator['_attrCollection'] = {},\r\n calculator['$container'] = $('#help-me-choose'),\r\n $('.custom-calculator-results strong strong').hide();\r\n $('.disqualify').hide();\r\n $('#help-me-choose input').prop('checked', false);\r\n calculator.bindings(retry);\r\n }else{\r\n\r\n //remove result\r\n $('.custom-calculator-results strong strong').hide();\r\n $('.disqualify').hide();\r\n //establish bindings\r\n calculator.bindings();\r\n //example string template\r\n //Based on your answers, we recommend our {attributes} with a {attributes-cont}\r\n }\r\n\r\n },\r\n bindings: (retry)=>{\r\n if (calculator.debug) {\r\n calculator.debug_log.push('calculator.bindings()');\r\n console.log(calculator.debug_log, 'bindings');\r\n }\r\n\r\n $(document).keypress(\r\n function(event){\r\n if (event.which == '13') {\r\n event.preventDefault();\r\n }\r\n });\r\n\r\n calculator.$container.find('.custom-calculator-form').find('input').on('click', (e)=>{\r\n if (calculator.debug) {\r\n calculator.debug_log.push($(e.target));\r\n console.log(calculator.debug_log, 'answer added');\r\n }\r\n\r\n calculator.answer_handler($(e.target));\r\n });\r\n\r\n calculator.$container.find('button.btn-secondary').on('click', (e)=>{\r\n e.preventDefault();\r\n if (calculator.debug) {\r\n console.log(calculator.debug_log, 'Submit Calc');\r\n }\r\n\r\n if (calculator.$container.find('button').hasClass('reset')) {\r\n $('.opt-cta').hide();\r\n calculator.$container.find('button').toggleClass('reset');\r\n calculator.reset();\r\n return false;\r\n }\r\n\r\n calculator.valid = true;\r\n let saveAnswers = [];// for performance, use the same loop\r\n\r\n $.each($('.custom-calculator-form-wrapper .form-group'),(index, value)=>{\r\n console.log(value, index, 'index');\r\n let answer = {};\r\n answer.question = $(value).find('legend').text();\r\n answer.answer = $(value).find('input:checked').next().text();\r\n\r\n saveAnswers.push(answer);\r\n\r\n if (!$(value).hasClass('answered')) {\r\n calculator.valid = false;\r\n alert('Please fill in your answers to receive our recommendation.');\r\n return false;\r\n }\r\n });\r\n\r\n saveAnswers.push($('.custom-calculator-results').text());\r\n\r\n //if email not there:product-selector-form\r\n\r\n if($('#product-selector-form .email-input').val() === ''){\r\n calculator.valid = false;\r\n alert('Please fill in your answers to receive our recommendation.');\r\n return false;\r\n }\r\n\r\n if (calculator.dq && calculator.valid) {\r\n $('.custom-calculator-results small').show();\r\n }else if(calculator.valid){\r\n\r\n\r\n\r\n //calculator.mode(calculator._attrGroup);\r\n // if CTA has value\r\n if ($('.opt-cta').attr('href') != '') {\r\n $('.opt-cta').show();\r\n }\r\n //hide submit button\r\n calculator.$container.find('button.btn-secondary').hide();\r\n //remove any success or error indicators\r\n $('#product-selector-form .InfoLabel').remove();\r\n $('#product-selector-form .ErrorLabel').remove();\r\n\r\n calculator._attrGroup.forEach(element => {\r\n let replace = calculator.validKey(element);\r\n let key = calculator.validKey(element);\r\n if (calculator.debug) {\r\n console.log(calculator[key], replace, 'rplstr', calculator);\r\n }\r\n calculator[key] = calculator.mode(calculator[key]);\r\n calculator.resultStr = calculator.resultStr.replace('{'+replace+'}', calculator[key]);\r\n });\r\n\r\n // console.log('mode test', calculator.mode(calculator._attrGroup))\r\n $('.custom-calculator-results strong strong').html(calculator.resultStr);\r\n\r\n\r\n saveAnswers.push(calculator.resultStr);\r\n $('#product-selector-form .textarea-control').text(JSON.stringify(saveAnswers));\r\n\r\n // calculator.$container.find('button').on('click', ()=>{\r\n // $('.opt-cta').hide();\r\n // calculator.reset();\r\n // });\r\n // localStorage.setItem('submittedProductSelector', $('#help-me-choose')[0].outerHTML);\r\n $('#product-selector-form .FormButton').trigger('click');\r\n\r\n let formResponse = setInterval(function(){\r\n if ($('#product-selector-form .InfoLabel').length) {\r\n $('#product-selector-form .InfoLabel').hide();\r\n $('.custom-calculator-results strong strong').show();\r\n //change the \"Calculate\" button to a \"Restart\"\r\n let strRP = calculator.$container.find('button').text();\r\n strRP = strRP.replace('Calculate', 'Reset');\r\n calculator.$container.find('button').text(strRP);\r\n calculator.$container.find('button').toggleClass('reset');\r\n clearInterval(formResponse);\r\n console.log('InfoLabel found')\r\n }\r\n if($('#product-selector-form .ErrorLabel').length){\r\n clearInterval(formResponse);\r\n //show submit button\r\n calculator.$container.find('button.btn-secondary').show();\r\n console.log('Err found')\r\n }\r\n }, 100);\r\n\r\n }\r\n });\r\n },\r\n answer_handler: ($answer)=>{\r\n let attr_group = $answer.data('attribute-group');\r\n let attr_value = $answer.data('attribute-value');\r\n let attr_weight = $answer.data('attribute-weight');\r\n let attr_product = $answer.data('recommended-product');\r\n let attr_product_weight = $answer.data('recommended-product-weight');\r\n let attr_dq = $answer.data('disqualify');\r\n let key = calculator.validKey(attr_group);\r\n\r\n //validation\r\n $answer.parent().parent().parent().addClass('answered');\r\nconsole.log($answer, 'answer check retry');\r\n if (attr_dq == 'Yes') {\r\n calculator.dq = true;\r\n }\r\n\r\n if (!calculator._attrGroup.includes(attr_group) && attr_group != '') {\r\n calculator._attrGroup.push(attr_group);\r\n }\r\n\r\n //is the key old and not an arr?\r\n if (!calculator[key] && attr_group != '' && !Array.isArray(calculator[key])) {\r\n //not an array which means we got an answer\r\n calculator[key] = [];// make index arrayer again\r\n }\r\n\r\n if (!calculator[key] && attr_group != '') {\r\n\r\n calculator[key] = [];\r\n\r\n //physically factor weight\r\n for (let index = 0; index < attr_weight; index++) {\r\n calculator[key].push(attr_value);\r\n }\r\n }else if(attr_group != ''){\r\n //physically factor weight\r\n for (let index = 0; index < attr_weight; index++) {\r\n calculator[key].push(attr_value);\r\n }\r\n }\r\n\r\n\r\n if (calculator.debug) {\r\n calculator.debug_log.push(calculator._attrGroup);\r\n console.log(calculator.debug_log, 'built attributes collection');\r\n }\r\n\r\n\r\n },\r\n submit_handler: ()=>{\r\n if (calculator.debug) {\r\n calculator.debug_log.push(calculator.resultStr);\r\n console.log(calculator.debug_log, 'Submit Calc');\r\n }\r\n },\r\n reset: ()=>{\r\n if (calculator.debug) {\r\n calculator.debug_log.push('calculator.reset()');\r\n console.log(calculator.debug_log, 'restart/reset quiz');\r\n console.log(calculator, 'what happens to this?');\r\n }\r\n\r\n //wholesale replace with copy made earlier;\r\n //calculator.$container.replaceWith(calculator.$containerCopy);\r\n $('.custom-calculator-results strong strong').hide();\r\n $('.disqualify').hide();\r\n $('#help-me-choose input').prop('checked', false);\r\n calculator._attrGroup = [];\r\n calculator._attrCollection = [];\r\n calculator.resultStr = calculator._resultStr;\r\n calculator.dq = false;\r\n let strRP = calculator.$container.find('button').text();\r\n strRP = strRP.replace('Reset', 'Calculate');\r\n calculator.$container.find('button').text(strRP);\r\n //odd behavior\r\n\r\n\r\nwindow.location.href = window.location.href + '#help-me-choose';//killing too much time\r\n\r\n\r\n }\r\n\r\n}\r\n\r\n$(document).ready(()=>{\r\n\r\n if ($('#help-me-choose').length) {\r\n calculator.init();\r\n }\r\n});\r\n\r\nconst cdLadder = {\r\n debug: true,\r\n debug_log: ['offline'],\r\n _APY:[],\r\n _Months:[],\r\n runningTotal:0,\r\n runningTotal2:0, // calc 2\r\n runningTotal3:0,\r\n runningTotal4:0, // calc 2\r\n init: ()=>{\r\n if (cdLadder.debug) {\r\n cdLadder.debug_log.push('cdLadder.init()');\r\n cdLadder.debug_log.push('cdLadder online');\r\n // console.log(cdLadder.debug_log);\r\n }\r\n\r\n\r\n //JSON table dependency on the page as a local\r\n try {\r\n JSON.stringify(customCDTable);// an error here would mean it's invalid or not available\r\n customCDTable = Object.values(customCDTable);\r\n } catch (error) {\r\n console.log('Missing JS Dependency[\"customCDTable\"]');\r\n $('.cd-ladder-calc').empty();\r\n $('.cd-ladder-calc').html('

Error


Please try refreshing the page.

');\r\n }\r\n\r\n //establish bindings\r\n cdLadder.bindings();\r\n //example string template\r\n\r\n },\r\n queryHandler: (cdType, initRenew, _months, rangeMin, rangeMax, customCDTable, q)=>{\r\n if (cdLadder.debug) {\r\n cdLadder.debug_log.push('cdLadder.queryHandler()');\r\n // console.log('queryHandler');\r\n }\r\n\r\n //clear each time\r\n cdLadder._APY = [];\r\n cdLadder._Months = [];\r\n\r\n //if initial query\r\n if (initRenew == 'initial') {\r\n // Look up the 4 unique APY and Months values for\r\n\r\n // CD Type = CD Ladder,\r\n // Initial/Renewal = Initial,\r\n // Months = [6, 12, 18, 24],\r\n // where input value Deposit Amount is in the Min 5000/250000 Maximum Deposit range\r\n for (let i = 0; i < customCDTable.length; i++) {\r\n let element = customCDTable[i];\r\n let minimum = (element['Minimum Deposit (Inclusive)'] == '') ? rangeMin : element['Minimum Deposit (Inclusive)'];\r\n let maximum = (element['Maximum Deposit (Exclusive)'] == '') ? rangeMax : element['Maximum Deposit (Exclusive)'];\r\n if (\r\n element['CD Type'] == cdType &&\r\n element['Initial Renewal'] == initRenew &&\r\n _months.includes(element['Months']) && //needs to be within\r\n minimum >= rangeMin &&//needs to be within\r\n maximum <= rangeMax//needs to be within\r\n ) {\r\n\r\n //check for dupes\r\n if (q == '_APY') {\r\n if (!cdLadder._APY.includes(element['APY'])) {\r\n cdLadder._APY.push(element['APY']);\r\n }\r\n }\r\n if (q == '_Months') {\r\n if (!cdLadder._Months.includes(element['Months'])) {\r\n cdLadder._Months.push(element['Months']);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (q == '_APY') {\r\n return cdLadder._APY;\r\n }\r\n if (q == '_Months') {\r\n return cdLadder._Months;\r\n }\r\n\r\n\r\n },\r\n ladder:(CDLadderCalculation, customCDTable)=>{\r\n if (cdLadder.debug) {\r\n // console.log('laddering', CDLadderCalculation);\r\n }\r\n var result = Object.keys(CDLadderCalculation).map(function(key) {\r\n return [CDLadderCalculation[key]];\r\n });\r\n // console.log(result, 'obj->arr');\r\n\r\n let years = parseInt($('.input-group select').val());\r\n let depositAmount = parseInt($('#depositAmount').val());\r\n let PrincipleCalculated = (depositAmount / 4);\r\n let CDLadderCalculation2 = {};\r\n\r\n for (let index = 0; index < result.length; index++) {\r\n const element = result[index][0];\r\n\r\n //for each ladder, perform the initial calc 2:\r\n // For each ladder,\r\n // while its Duration + 24 is less than or equal to input value Ladder Years * 12,\r\n // perform a renewal iteration calculation:\r\n let durationCondition = (parseInt(element.Duration) + 24 <= years * 12);\r\n\r\n if (durationCondition) {\r\n // Look up the 1 unique APY and Month values for\r\n // CD Type = CD Ladder,\r\n // Initial/Renewal = Renewal,\r\n // Months = 24,\r\n let apy = [];//cdLadder.queryHandler('cd-ladder', 'renewal', [\"24\"], 5000, 250000, customCDTable, '_APY');\r\n // Look up the 1 unique APY and Months values for\r\n for (let x = 0; x < customCDTable.length; x++) {\r\n const row = customCDTable[x];\r\n //MIN AND MAX are from previous calculated totals\r\n let _months = ['24'];\r\n // where Previous Calculation's Total is in the Minimum/Maximum Deposit range:\r\n let prevCalcTotal = parseFloat(cdLadder.runningTotal);\r\n // console.log('prev total', cdLadder.runningTotal);\r\n if (\r\n row['CD Type'] == 'cd-ladder' &&\r\n row['Initial Renewal'] == 'renewal' &&\r\n _months.includes(row['Months']) && //needs to be within\r\n prevCalcTotal >= 5000 &&//needs to be within\r\n prevCalcTotal <= 250000//needs to be within\r\n ) {\r\n //check for dupes\r\n if (!apy.includes(row['APY'])) {\r\n apy.push(row['APY']);\r\n }\r\n\r\n // console.log('apy check', apy, prevCalcTotal); // this pulls back the expected one apy\r\n }\r\n }\r\n // //add calc obj\r\n let monthCalculated = 24;\r\n let IntersetCalculated = (CDLadderCalculation[index].Total * apy[0] * (monthCalculated/12));\r\n // console.log('the new interest calculated', CDLadderCalculation[index].Total, apy[0] , (monthCalculated/12));\r\n\r\n //log a running total as last property for access later\r\n cdLadder.runningTotal2 = cdLadder.runningTotal2 + (IntersetCalculated + PrincipleCalculated);\r\n CDLadderCalculation2[index] = {\r\n 'APY': apy[0], //there should only be one returned per spec! \"Look up the 1 unique APY and Month values\"\r\n 'Principle': cdLadder.runningTotal, //[Previous Calculation's Total]\r\n 'Interest': IntersetCalculated, //Principle * APY * (Months / 12)\r\n 'Total': (IntersetCalculated + cdLadder.runningTotal),//Principle + Interest\r\n 'Duration': 24,//sumOfMonths(monthCalculated), // [Previous Calculation's Months] + Months\r\n 'GrandTotal' : cdLadder.runningTotal2 //for later use; calculate the some of totals\r\n }\r\n }\r\n }\r\n\r\n return CDLadderCalculation2;\r\n },\r\n bindings:()=>{\r\n if (cdLadder.debug) {\r\n cdLadder.debug_log.push('cdLadder.bindings()');\r\n console.log(cdLadder.debug_log, 'bindings');\r\n }\r\n\r\n $('#Submit').on('click', ()=>{\r\n //simple validation\r\n let depositAmount = parseInt($('#depositAmount').val());\r\n let years = parseInt($('.input-group select').val());\r\n\r\n //calculations based on spec\r\n //https://docs.google.com/document/d/1hymRu7PTdcfjfFeBVL-BcqOJMJczQ58WZkRavN6XXYI/edit\r\n let CDLadderCalculation = {};\r\n let CDLadderCalculation2;\r\n\r\n let NOLadders = 4 //believe this to remain fixed\r\n let _months = ['6', '12', '18', '24']; //values to check\r\n\r\n //first calc query\r\n let _APY = cdLadder.queryHandler('cd-ladder', 'initial', _months, 5000, 250000, customCDTable, '_APY');\r\n let _Months = cdLadder.queryHandler('cd-ladder', 'initial', _months, 5000, 250000, customCDTable, '_Months');\r\n let months = _Months;\r\n\r\n // console.log(_APY, 'return 4 apy', 'passes assuming first 4');\r\n //for each ladder, perform the initial calc 1:\r\n for (let index = 0; index < NOLadders; index++) {\r\n\r\n if (cdLadder.debug) {\r\n cdLadder.debug_log.push('cdLadder APY + Month');\r\n cdLadder.debug_log.push(_APY);\r\n cdLadder.debug_log.push(months);\r\n // console.log(cdLadder.debug_log, 'CALC 1:1');\r\n }\r\n\r\n let PrincipleCalculated = (depositAmount / 4);\r\n let monthCalculated = parseFloat(months[index]);\r\n let apyCalculated = parseFloat(_APY[index]);\r\n let IntersetCalculated = (PrincipleCalculated * apyCalculated * (monthCalculated/12));\r\n\r\n cdLadder.runningTotal = cdLadder.runningTotal + (IntersetCalculated + PrincipleCalculated);\r\n CDLadderCalculation[index] = {\r\n 'APY': _APY[index],\r\n 'Principle': PrincipleCalculated,\r\n 'Interest': IntersetCalculated,\r\n 'Total': (IntersetCalculated + PrincipleCalculated),\r\n 'Duration': months[index],\r\n 'GrandTotal' : cdLadder.runningTotal + (IntersetCalculated + PrincipleCalculated)//for later use; calculate the some of totals\r\n };\r\n //log a running total as last property for access later\r\n\r\n\r\n\r\n //[Previous Calculation's Months] + Months\r\n //attach to obj for ref\r\n CDLadderCalculation['months'] = months;\r\n }\r\n\r\n CDLadderCalculation2 = cdLadder.ladder(CDLadderCalculation, customCDTable);\r\n\r\n\r\n //at this point we have our calc 1 + 2 complete\r\n if (cdLadder.debug) {\r\n // cdLadder.debug_log.push('CALC 1:* Complete!');\r\n // cdLadder.debug_log.push(CDLadderCalculation);\r\n console.log(CDLadderCalculation, 'CALC 1 DONE');\r\n }\r\n\r\n if (cdLadder.debug) {\r\n // cdLadder.debug_log.push('CALC 2:* Complete!');\r\n // cdLadder.debug_log.push(CDLadderCalculation2);\r\n console.log(CDLadderCalculation2, 'CALC 2 DONE');\r\n }\r\n\r\n //Once all ladders' renewal iteration calculations are done,\r\n // then this calculation is complete. The CD Ladder total balance\r\n //is the sum of each ladder's final iteration Total.\r\n if (cdLadder.debug) {\r\n // cdLadder.debug_log.push('CALC 1:* Total');\r\n // cdLadder.debug_log.push(cdLadder.runningTotal);\r\n // cdLadder.debug_log.push('CALC 2:* Total');\r\n // cdLadder.debug_log.push(cdLadder.runningTotal2);\r\n // console.log(cdLadder.debug_log, 'CALC 1 + 2 Total');\r\n }\r\n\r\n //6 Month CD Calculation for comparison\r\n\r\n const formatter = new Intl.NumberFormat('en-US', {\r\n style: 'currency',\r\n currency: 'USD',\r\n minimumFractionDigits: 2\r\n })\r\n\r\n if (depositAmount == '' || isNaN(depositAmount)) {\r\n alert('Please make sure to include a deposit amount');\r\n return false;\r\n }else{\r\n //success means we can remove the button\r\n $('#Submit').remove();\r\n }\r\n $('.chart-container').css('visibility','visible');\r\n $('.chart-container').show('fast');\r\n\r\n //string replace result text first\r\n $('.result-title')\r\n .text(\r\n $('.result-title')\r\n .text()\r\n .replace('{duration}', parseInt($('.input-group select').val()))\r\n );\r\n $('.results').show('fast').focus();\r\n //build dataset with total\r\n let CDLadderCalculationArr = Object.values(CDLadderCalculation);\r\n CDLadderCalculationArr.pop();// remove\r\n let CDLadderCalculation2Arr = Object.values(CDLadderCalculation2);\r\n let calc1Results = CDLadderCalculationArr.map(a => a.Duration); //make an array of calculated totals\r\n let calc2Results = CDLadderCalculation2Arr.map(a => a.Duration); //make an array of calculated totals\r\n let durationResultsLabels = CDLadderCalculationArr.map(a => a.Duration); //make an array of calculated totals\r\n\r\n //set your total vs example\r\n if(cdLadder.runningTotal2 == 0){\r\n $('.examp-total').text('The provided values could not be used in an auto renewing CD');\r\n }else{\r\n\r\n $('.examp-total').text( formatter.format(cdLadder.runningTotal2));\r\n }\r\n\r\n $('.cd-ladder-calc .input-group').last().append('Retry');\r\n\r\n\r\n var ctx = document.getElementById('myChart').getContext('2d');\r\n Chart.pluginService.register({\r\n beforeRender: function (chart) {\r\n if (chart.config.options.showAllTooltips) {\r\n // create an array of tooltips\r\n // we can't use the chart tooltip because there is only one tooltip per chart\r\n chart.pluginTooltips = [];\r\n chart.config.data.datasets.forEach(function (dataset, i) {\r\n chart.getDatasetMeta(i).data.forEach(function (sector, j) {\r\n chart.pluginTooltips.push(new Chart.Tooltip({\r\n _chart: chart.chart,\r\n _chartInstance: chart,\r\n _data: chart.data,\r\n _options: chart.options,\r\n _active: [sector]\r\n }, chart));\r\n });\r\n });\r\n\r\n // turn off normal tooltips\r\n chart.options.tooltips.enabled = false;\r\n }\r\n },\r\n afterDraw: function (chart, easing) {\r\n if (chart.config.options.showAllTooltips) {\r\n // we don't want the permanent tooltips to animate, so don't do anything till the animation runs atleast once\r\n if (!chart.allTooltipsOnce) {\r\n if (easing !== 1)\r\n // return;\r\n chart.allTooltipsOnce = true;\r\n }\r\n\r\n // console.log('action after draw');\r\n // turn on tooltips\r\n chart.options.tooltips.enabled = true;\r\n Chart.helpers.each(chart.pluginTooltips, function (tooltip) {\r\n tooltip.initialize();\r\n tooltip.update();\r\n // we don't actually need this since we are not animating tooltips\r\n tooltip.pivot();\r\n tooltip.transition(easing).draw();\r\n });\r\n chart.options.tooltips.enabled = false;\r\n }\r\n }\r\n });\r\n\r\n let labels = calc1Results.map((x,i)=>{\r\n return x + ' Months';\r\n });\r\n\r\n setTimeout(()=>{\r\n var myChart = new Chart(ctx, {\r\n type: 'bar',\r\n data: {\r\n labels: labels,\r\n legend:false,\r\n datasets: [{\r\n label: 'Example CD',\r\n results: CDLadderCalculation,\r\n data: calc1Results,\r\n backgroundColor: [\r\n 'rgba(0, 124, 189, 1)',\r\n 'rgba(0, 124, 189, 1)',\r\n 'rgba(0, 124, 189, 1)',\r\n 'rgba(0, 124, 189, 1)',\r\n ],\r\n borderColor: [\r\n 'rgba(0, 0, 0, 1)',\r\n 'rgba(0, 0, 0, 1)',\r\n 'rgba(0, 0, 0, 1)',\r\n 'rgba(0, 0, 0, 1)',\r\n ],\r\n borderWidth: 1\r\n },{\r\n label: 'Ladder Result',\r\n results: CDLadderCalculation2,\r\n data: calc2Results,\r\n backgroundColor: [\r\n 'rgba(0, 124, 189, 0.6)',\r\n 'rgba(0, 124, 189, 0.6)',\r\n 'rgba(0, 124, 189, 0.6)',\r\n 'rgba(0, 124, 189, 0.6)',\r\n ],\r\n borderColor: [\r\n 'rgba(0, 0, 0, 1)',\r\n 'rgba(0, 0, 0, 1)',\r\n 'rgba(0, 0, 0, 1)',\r\n 'rgba(0, 0, 0, 1)',\r\n ],\r\n borderWidth: 1\r\n }\r\n ]\r\n },\r\n options: {\r\n showAllTooltips: true,\r\n legend:false,\r\n tooltips: {\r\n mode: 'index',\r\n intersect: false\r\n },\r\n responsive: false,\r\n maintainAspectRatio: true,\r\n scales: {\r\n xAxes: [{\r\n stacked: true,\r\n }],\r\n yAxes: [{\r\n ticks: {\r\n beginAtZero: true\r\n },\r\n stacked: true,\r\n scaleLabel:{\r\n display: true,\r\n labelString: 'Months'\r\n }\r\n }]\r\n },\r\n plugins: {\r\n p1: true // disable plugin 'p1' for this instance\r\n },\r\n tooltips: {\r\n // Disable the on-canvas tooltip\r\n enabled: false,\r\n callbacks: {\r\n label: function(tooltipItem, data) {\r\n var label = formatter.format(data.datasets[tooltipItem.datasetIndex].results[tooltipItem.index].Total) || '';\r\n // console.log(tooltipItem,'label callback', data.datasets[tooltipItem.datasetIndex].results[tooltipItem.index]);\r\n if (label) {\r\n label += '
Months: ';\r\n }\r\n label += Math.round(tooltipItem.yLabel * 100) / 100;\r\n label += '
APY: '+ (data.datasets[tooltipItem.datasetIndex].results[tooltipItem.index].APY * 100)+'%' ;\r\n return label;\r\n }\r\n },\r\n custom: function(tooltipModel) {\r\n // Tooltip Element\r\n var tooltipEl = document.getElementById('chartjs-tooltip');\r\n\r\n // Create element on first render\r\n if (!tooltipEl) {\r\n tooltipEl = document.createElement('div');\r\n tooltipEl.id = 'chartjs-tooltip';\r\n tooltipEl.innerHTML = '
';\r\n document.body.appendChild(tooltipEl);\r\n }\r\n\r\n // Hide if no tooltip\r\n if (tooltipModel.opacity === 0) {\r\n tooltipEl.style.opacity = 0;\r\n return;\r\n }\r\n\r\n // Set caret Position\r\n tooltipEl.classList.remove('above', 'below', 'no-transform');\r\n if (tooltipModel.yAlign) {\r\n tooltipEl.classList.add(tooltipModel.yAlign);\r\n } else {\r\n tooltipEl.classList.add('no-transform');\r\n }\r\n\r\n function getBody(bodyItem) {\r\n return bodyItem.lines;\r\n }\r\n\r\n // Set Text\r\n if (tooltipModel.body) {\r\n var titleLines = tooltipModel.title || [];\r\n var bodyLines = tooltipModel.body.map(getBody);\r\n // console.log(tooltipModel, 'tooltip avail');\r\n var innerHtml = '';\r\n\r\n titleLines.forEach(function(title) {\r\n innerHtml += '' + title + '';\r\n });\r\n innerHtml += '';\r\n\r\n bodyLines.forEach(function(body, i) {\r\n var colors = tooltipModel.labelColors[i];\r\n var style = 'color:#fff; background:rgba( \t0, 134, 60, 1)';\r\n style += '; border-color:' + colors.borderColor;\r\n style += '; border-width: 2px';\r\n var span = '';\r\n innerHtml += '' + span + body + '';\r\n });\r\n innerHtml += '';\r\n\r\n var tableRoot = tooltipEl.querySelector('table');\r\n tableRoot.innerHTML = innerHtml;\r\n }\r\n\r\n // `this` will be the overall tooltip\r\n var position = this._chart.canvas.getBoundingClientRect();\r\n\r\n // Display, position, and set styles for font\r\n tooltipEl.style.opacity = 1;\r\n tooltipEl.style.display = 'block';\r\n tooltipEl.style.background = 'rgba( \t0, 134, 60, 1)';\r\n tooltipEl.style.position = 'absolute';\r\n tooltipEl.style.left = position.left - 25 + tooltipModel.caretX + 'px';\r\n tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + 'px';\r\n tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily;\r\n tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px';\r\n tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle;\r\n\r\n tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + '12px';\r\n tooltipEl.style.pointerEvents = 'none';\r\n }\r\n }\r\n }\r\n });\r\n\r\n },1000);\r\n\r\n //run example at this point\r\n cdLadder.example();\r\n\r\n setInterval(()=>{\r\n Chart.instances[0].resize();\r\n },500)\r\n // Chart.instances[0].resize();\r\n //may need this for print stylesheet per\r\n //https://www.chartjs.org/docs/latest/general/responsive.html?h=print\r\n // function beforePrintHandler () {\r\n // for (var id in Chart.instances) {\r\n // Chart.instances[id].resize();\r\n // }\r\n // }\r\n });\r\n },\r\n renew:(calculatedObj, prevTotal, prevMonths)=>{\r\n let months = 0;\r\n let depositAmount = parseFloat($('#depositAmount').val());\r\n let years = parseInt($('.input-group select').val());\r\n let result= [];\r\n\r\n let CDLadderCalculation2;\r\n\r\n if (prevTotal) {\r\n console.log(prevTotal, prevMonths, calculatedObj, 'prev');\r\n result = [calculatedObj];\r\n }else{\r\n\r\n result = calculatedObj;\r\n }\r\n\r\n let element = result[0];\r\n console.log(result, 'result', element.Duration);\r\n let durationCondition = (element.Duration + 6 <= years * 12);\r\n if (durationCondition) {\r\n // Look up the 1 unique APY and Month values for\r\n // CD Type = CD Ladder,\r\n // Initial/Renewal = Renewal,\r\n // Months = 24,\r\n let apy = [];\r\n\r\n // Look up the 1 unique APY and Months values for\r\n for (let x = 0; x < customCDTable.length; x++) {\r\n const row = customCDTable[x];\r\n //MIN AND MAX are from previous calculated totals\r\n let _months = ['6'];\r\n // where Previous Calculation's Total is in the Minimum/Maximum Deposit range:\r\n\r\n // console.log('prev total', cdLadder.runningTotal);\r\n if (\r\n row['CD Type'] == 'cd-6-month' &&\r\n row['Initial Renewal'] == 'renewal' &&\r\n _months.includes(row['Months']) && //needs to be within\r\n cdLadder.runningTotal3 >= 5000 &&//needs to be within\r\n cdLadder.runningTotal3 <= 250000//needs to be within\r\n ) {\r\n //check for dupes\r\n if (!apy.includes(row['APY'])) {\r\n apy.push(row['APY']);\r\n }\r\n\r\n }\r\n }\r\n\r\n //add calc obj\r\n let monthCalculated = parseInt(6);\r\n let IntersetCalculated = (cdLadder.runningTotal3 * apy[0] * (monthCalculated/12));\r\n if (months === 0) {\r\n months = 6;\r\n }\r\n if (prevMonths) {\r\n months = prevMonths;\r\n }\r\n months = months + 6;// this is static and happens each time\r\n cdLadder.runningTotal4 = (IntersetCalculated + cdLadder.runningTotal3);\r\n CDLadderCalculation2 = {\r\n 'APY': apy[0], //there should only be one returned per spec! \"Look up the 1 unique APY and Month values\"\r\n 'Principle': cdLadder.runningTotal3, //[Previous Calculation's Total]\r\n 'Interest': IntersetCalculated, //Principle * APY * (Months / 12)\r\n 'Total': (IntersetCalculated + cdLadder.runningTotal3),//Principle + Interest\r\n 'Duration': months, // [Previous Calculation's Months] + Months\r\n 'GrandTotal' : cdLadder.runningTotal4 //for later use; calculate the some of totals\r\n };\r\n\r\n\r\n cdLadder.renew(CDLadderCalculation2, cdLadder.runningTotal4, months);\r\n\r\n }else{\r\n return cdLadder.runningTotal4;\r\n }\r\n\r\n\r\n },\r\n example:()=>{\r\n const formatter = new Intl.NumberFormat('en-US', {\r\n style: 'currency',\r\n currency: 'USD',\r\n minimumFractionDigits: 2\r\n })\r\n if (cdLadder.debug) {\r\n cdLadder.debug_log.push('Example calculator cdLadder.example()');\r\n // console.log(cdLadder.debug_log, 'begining example');\r\n }\r\n //query\r\n let _APY = cdLadder.queryHandler('cd-6-month', 'initial', ['6'], 5000, 250000, customCDTable, '_APY');\r\n let _Months = cdLadder.queryHandler('cd-6-month', 'initial', ['6'], 5000, 250000, customCDTable, '_Months');\r\n let months = 6;\r\n let depositAmount = parseFloat($('#depositAmount').val());\r\n let years = parseInt($('.input-group select').val());\r\n\r\n // console.log('example', _APY, _Months);\r\n // console.log('results', _APY, _Months, depositAmount, years)\r\n //calculations based on spec\r\n //https://docs.google.com/document/d/1hymRu7PTdcfjfFeBVL-BcqOJMJczQ58WZkRavN6XXYI/edit\r\n let CDLadderCalculation = {};\r\n let CDLadderCalculation2 = {};\r\n\r\n let PrincipleCalculated = (depositAmount);\r\n let monthCalculated = parseInt(6);\r\n let apyCalculated = parseFloat(_APY[0]);\r\n let IntersetCalculated = (PrincipleCalculated * apyCalculated * (monthCalculated/12));\r\n\r\n // console.log((PrincipleCalculated * apyCalculated * (monthCalculated/12)), 'check math *example calc*', monthCalculated, apyCalculated)\r\n\r\n //log a running total as last property for access later\r\n\r\n cdLadder.runningTotal3 = cdLadder.runningTotal3 + (IntersetCalculated + PrincipleCalculated);\r\n\r\n CDLadderCalculation[0] = {\r\n 'APY': _APY[0],\r\n 'Principle': PrincipleCalculated,\r\n 'Interest': IntersetCalculated,\r\n 'Total': (IntersetCalculated + PrincipleCalculated),\r\n 'Duration': 6,\r\n 'GrandTotal' : cdLadder.runningTotal3 //for later use; calculate the some of totals\r\n };\r\n //[Previous Calculation's Months] + Months\r\n //attach to obj for ref\r\n CDLadderCalculation['months'] = months;\r\n\r\n //for each ladder, perform the initial calc 2:\r\n // For each ladder,\r\n // while its Duration + 24 is less than or equal to input value Ladder Years * 12,\r\n // perform a renewal iteration calculation:\r\n\r\n console.log('next query', monthCalculated + 6, years * 12);\r\n\r\n cdLadder.renew(CDLadderCalculation, false, false);\r\n\r\n\r\n // console.log('1st calc', CDLadderCalculation)\r\n //example CD built\r\n //build dataset with total\r\n let CDLadderCalculationArr = Object.values(CDLadderCalculation);\r\n CDLadderCalculationArr.pop();// remove\r\n let CDLadderCalculation2Arr = Object.values(CDLadderCalculation2);\r\n let calc1Results = CDLadderCalculationArr.map(a => a.Total); //make an array of calculated totals\r\n let calc2Results = CDLadderCalculation2Arr.map(a => a.Total); //make an array of calculated totals\r\n let durationResultsLabels = CDLadderCalculationArr.map(a => a.Duration); //make an array of calculated totals\r\n $('.total').text( formatter.format(cdLadder.runningTotal4) );\r\n // var ctx = document.getElementById('exampleSixMonthCD').getContext('2d');\r\n // var myChart = new Chart(ctx, {\r\n // type: 'bar',\r\n // data: {\r\n // labels: durationResultsLabels,\r\n // datasets: [{\r\n // label: 'Potential balance after '+years+' years',\r\n // data: calc1Results,\r\n // backgroundColor: [\r\n // 'rgba(255, 99, 132, 0.2)',\r\n // 'rgba(54, 162, 235, 0.2)',\r\n // 'rgba(255, 206, 86, 0.2)',\r\n // 'rgba(75, 192, 192, 0.2)',\r\n // 'rgba(153, 102, 255, 0.2)',\r\n // 'rgba(255, 159, 64, 0.2)'\r\n // ],\r\n // borderColor: [\r\n // 'rgba(255, 99, 132, 1)',\r\n // 'rgba(54, 162, 235, 1)',\r\n // 'rgba(255, 206, 86, 1)',\r\n // 'rgba(75, 192, 192, 1)'\r\n // ],\r\n // borderWidth: 1\r\n // },{\r\n // data: calc2Results,\r\n // backgroundColor: [\r\n // 'rgba(255, 99, 132, 0.4)',\r\n // 'rgba(54, 162, 235, 0.4)',\r\n // 'rgba(255, 206, 86, 0.4)',\r\n // 'rgba(75, 192, 192, 0.4)'\r\n // ],\r\n // borderColor: [\r\n // 'rgba(255, 99, 132, 1)',\r\n // 'rgba(54, 162, 235, 1)',\r\n // 'rgba(255, 206, 86, 1)',\r\n // 'rgba(75, 192, 192, 1)',\r\n // 'rgba(153, 102, 255, 1)',\r\n // 'rgba(255, 159, 64, 1)'\r\n // ],\r\n // borderWidth: 1\r\n // }\r\n // ]\r\n // },\r\n // options: {\r\n // scales: {\r\n // yAxes: [{\r\n // ticks: {\r\n // beginAtZero: false\r\n // }\r\n // }]\r\n // }\r\n // }\r\n // });\r\n }\r\n}\r\n\r\nif ($('.cd-ladder-calc').length) {\r\n // Important : Disable old CD ladder initialization\r\n // Remove this old CD Ladder code once rewrite in `cd-ladder.js` is complete - SK 20200619\r\n // cdLadder.init();\r\n}\r\n\r\n"],"sourceRoot":""}