{"version":3,"sources":["webpack:///webpack/bootstrap e2f07d8e3ae6498ec04b","webpack:///./client/src/bundles/UserForms.js","webpack:///./client/src/bundles/bundle.js","webpack:///external \"i18n\""],"names":["document","addEventListener","forms","querySelectorAll","form","userForm","UserForm","init","ProgressBar","dom","progressTitle","querySelector","buttons","currentStepNumber","style","display","button","e","preventDefault","stepNumber","parseInt","getAttribute","jumpToStep","update","detail","stepId","element","visibility","classList","contains","getCurrentStepID","newStep","getStep","newStepElement","step","barWidth","length","innerText","setAttribute","parent","parentNode","isVisible","add","disabled","remove","width","FormStep","viewed","buttonHolder","id","getHTMLId","forEach","action","trigger","FormActions","prevButton","nextButton","window","triggerDispatchEvent","numberOfSteps","getNumberOfSteps","stepID","i","lastStep","conditionallyHidden","CONSTANTS","steps","progressBar","actions","currentStep","ENABLE_LIVE_VALIDATION","undefined","DISPLAY_ERROR_MESSAGES_AT_TOP","initialiseFormSteps","stepDom","hide","addStep","setCurrentStep","progressBarDom","stepNavigation","formActions","setUpPing","nextStep","prevStep","show","setId","push","index","indexOf","direction","targetStep","isValid","forward","setInterval","fetch"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA,2CAA2C,cAAc;;QAEzD;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;AC5DA;;;;;;;;AAEAA,SAASC,gBAAT,CAA0B,kBAA1B,EAA8C,YAAM;;AAElD,MAAMC,QAAQF,SAASG,gBAAT,CAA0B,eAA1B,CAAd;AAFkD;AAAA;AAAA;;AAAA;AAGlD,yBAAmBD,KAAnB,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+BAEUlD,U,EAAYsE,S,EACvB;AACE,UAAMC,aAAa,KAAKxB,KAAL,CAAW/C,UAAX,CAAnB;AACA,UAAIwE,UAAU,KAAd;AACA,UAAMC,UAAUH,cAAclB,SAAd,GAA0B,IAA1B,GAAiCkB,SAAjD;;AAEA,UAAIC,eAAenB,SAAnB,EAA8B;AAC5B;AACD;;AAED,UAAImB,WAAW1B,mBAAX,EAAJ,EAAsC;AACpC,YAAI4B,OAAJ,EAAa;AACX,eAAKtE,UAAL,CAAgBH,aAAa,CAA7B,EAAgCsE,SAAhC;AACD,SAFD,MAEO;AACL,eAAKnE,UAAL,CAAgBH,aAAa,CAA7B,EAAgCsE,SAAhC;AACD;AACD;AACD;;AAED,UAAI,KAAKpB,WAAT,EAAsB;AACpB,aAAKA,WAAL,CAAiBM,IAAjB;AACD;;AAED,WAAKE,cAAL,CAAoBa,UAApB;;AAEAjC,aAAOC,oBAAP,CAA4B,KAAKjD,GAAjC,EAAsC,0BAAtC,EAAkE;AAChEgB,gBAAQiE,WAAWzC;AAD6C,OAAlE;AAGD;;;gCAEW;AAEVQ,aAAOoC,WAAP,CAAmB,YAAM;AACvBC,cAAM,gCAAN;AACD,OAFD,EAEG,MAAM,IAFT;AAGD;;;;;;;;;;;;;;ACrUH,yD;;;;;;;ACDA,sB","file":"js/userforms.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\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// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\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, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\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 \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./client/src/bundles/bundle.js\");\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e2f07d8e3ae6498ec04b","/**\n * @file Manages the multi-step navigation.\n */\n\nimport i18n from 'i18n';\n\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n\n const forms = document.querySelectorAll('form.userform');\n for (const form of forms) {\n const userForm = new UserForm(form);\n userForm.init();\n }\n\n});\n\n\nclass ProgressBar {\n\n constructor(dom, userForm) {\n this.dom = dom;\n this.userForm = userForm;\n this.progressTitle = this.userForm.dom.querySelector('.progress-title');\n this.buttons = this.dom.querySelectorAll('.step-button-jump');\n this.currentStepNumber = this.dom.querySelector('.current-step-number');\n this.init();\n }\n\n init() {\n this.dom.style.display = 'initial';\n const buttons = this.buttons;\n for (const button of buttons) {\n button.addEventListener('click', (e) => {\n e.preventDefault();\n const stepNumber = parseInt(button.getAttribute('data-step'), 10);\n this.userForm.jumpToStep(stepNumber);\n return false;\n });\n }\n\n this.userForm.dom.addEventListener('userform.form.changestep', (e) => {\n this.update(e.detail.stepId);\n });\n\n this.update(0)\n\n }\n\n isVisible(element) {\n return !(element.style.display !== 'none' && element.style.visibility !== 'hidden' && element.classList.contains('hide'))\n }\n\n update(stepId) {\n let stepNumber = this.userForm.getCurrentStepID() + 1;\n let newStep = this.userForm.getStep(stepId);\n let newStepElement = newStep.step;\n let barWidth = (stepId / (this.buttons.length - 1)) * 100;\n\n this.currentStepNumber.innerText = stepNumber;\n\n for (const e of this.dom.querySelectorAll('[aria-valuenow]')) {\n e.setAttribute('aria-valuenow', stepNumber);\n }\n\n for (const button of this.buttons) {\n const parent = button.parentNode;\n if (parseInt(button.getAttribute('data-step'), 10) === stepNumber\n && this.isVisible(button)) {\n parent.classList.add('current');\n parent.classList.add('viewed');\n\n button.disabled = false; // .removeAttribute('disabled');\n break;\n }\n parent.classList.remove('current');\n\n }\n\n\n this.progressTitle.innerText = newStepElement.getAttribute('data-title');\n\n // Update the width of the progress bar.\n barWidth = barWidth ? `${barWidth}%` : '';\n this.dom.querySelector('.progress-bar').style.width = barWidth;\n }\n\n}\n\nclass FormStep {\n\n constructor(step, userForm) {\n this.step = step;\n this.userForm = userForm;\n this.viewed = false;\n this.buttonHolder = null;\n this.id = 0;\n\n this.init();\n }\n\n init() {\n const id = this.getHTMLId();\n this.buttonHolder = document.querySelector(`.step-button-wrapper[data-for='${id}']`);\n ['userform.field.hide', 'userform.field.show'].forEach((action) => {\n this.buttonHolder.addEventListener(action, () => {\n this.userForm.dom.trigger('userform.form.conditionalstep')\n });\n })\n }\n\n setId(id) {\n this.id = id;\n }\n\n getHTMLId() {\n return this.step.getAttribute('id');\n }\n\n show() {\n this.step.setAttribute('aria-hidden', false);\n this.step.classList.remove('hide');\n this.step.classList.add('viewed');\n this.viewed = true;\n }\n\n hide() {\n this.step.setAttribute('aria-hidden', true);\n this.step.classList.add('hide');\n }\n\n conditionallyHidden() {\n const button = this.buttonHolder.querySelector('button');\n return !(button.style.display !== 'none' && button.visibility !== 'hidden' && button.classList.contains('hide'))\n }\n\n}\n\nclass FormActions {\n\n constructor(dom, userForm) {\n this.dom = dom;\n this.userForm = userForm;\n this.prevButton = dom.querySelector('.step-button-prev');\n this.nextButton = dom.querySelector('.step-button-next');\n\n this.init();\n }\n\n init() {\n this.prevButton.addEventListener('click', (e) => {\n e.preventDefault();\n // scrollUpFx();\n window.triggerDispatchEvent(this.userForm.dom, 'userform.action.prev');\n });\n this.nextButton.addEventListener('click', (e) => {\n e.preventDefault();\n // scrollUpFx();\n window.triggerDispatchEvent(this.userForm.dom, 'userform.action.next');\n });\n\n this.update();\n\n this.userForm.dom.addEventListener('userform.form.changestep', () => {\n this.update();\n });\n\n this.userForm.dom.addEventListener('userform.form.conditionalstep', () => {\n this.update();\n });\n\n }\n\n update() {\n const numberOfSteps = this.userForm.getNumberOfSteps();\n const stepID = this.userForm.getCurrentStepID();\n let i = null;\n let lastStep = null;\n for (i = numberOfSteps - 1; i >= 0; i--) {\n lastStep = this.userForm.getStep(i);\n if (!lastStep.conditionallyHidden()) {\n if (stepID >= i) {\n this.nextButton.parentNode.classList.add('hide');\n this.prevButton.parentNode.classList.remove('hide');\n } else {\n this.nextButton.parentNode.classList.remove('hide');\n this.prevButton.parentNode.classList.add('hide');\n }\n\n if (stepID >= i) {\n this.dom.querySelector('.btn-toolbar').classList.remove('hide');\n } else {\n this.dom.querySelector('.btn-toolbar').classList.add('hide');\n }\n\n // this.userForm.dom.querySelector('.btn-toolbar');\n break;\n }\n }\n }\n\n}\n\n\nclass UserForm {\n\n constructor(form) {\n this.dom = form;\n this.CONSTANTS = {}; // Settings that come from the CMS.\n this.steps = [];\n this.progressBar = null;\n this.actions = null;\n this.currentStep = null;\n\n this.CONSTANTS.ENABLE_LIVE_VALIDATION = this.dom.getAttribute('livevalidation') !== undefined;\n this.CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP = this.dom.getAttribute('toperrors') !== undefined;\n }\n\n init() {\n this.initialiseFormSteps();\n }\n\n initialiseFormSteps() {\n const steps = this.dom.querySelectorAll('.form-step');\n for (const stepDom of steps) {\n const step = new FormStep(stepDom, this);\n step.hide();\n this.addStep(step);\n }\n\n this.setCurrentStep(this.steps[0]);\n\n const progressBarDom = this.dom.querySelector('.userform-progress');\n if (progressBarDom) {\n this.progressBar = new ProgressBar(progressBarDom, this);\n }\n\n const stepNavigation = this.dom.querySelector('.step-navigation');\n if (stepNavigation) {\n this.formActions = new FormActions(stepNavigation, this);\n this.formActions.update();\n }\n\n this.setUpPing();\n\n this.dom.addEventListener('userform.action.next', () => {\n this.nextStep();\n })\n\n this.dom.addEventListener('userform.action.prev', () => {\n this.prevStep();\n })\n\n }\n\n setCurrentStep(step) {\n // Make sure we're dealing with a form step.\n if (!(step instanceof FormStep)) {\n return;\n }\n this.currentStep = step;\n this.currentStep.show();\n }\n\n addStep(step) {\n if (!(step instanceof FormStep)) {\n return;\n }\n step.setId(this.steps.length);\n this.steps.push(step);\n }\n\n getNumberOfSteps() {\n return this.steps.length;\n }\n\n getCurrentStepID() {\n return this.currentStep.id ? this.currentStep.id : 0;\n }\n\n getStep(index) {\n return this.steps[index];\n }\n\n nextStep() {\n this.jumpToStep(this.steps.indexOf(this.currentStep) + 1, true);\n }\n\n prevStep() {\n this.jumpToStep(this.steps.indexOf(this.currentStep) - 1, true);\n }\n\n jumpToStep(stepNumber, direction)\n {\n const targetStep = this.steps[stepNumber];\n let isValid = false;\n const forward = direction === undefined ? true : direction;\n\n if (targetStep === undefined) {\n return;\n }\n\n if (targetStep.conditionallyHidden()) {\n if (forward) {\n this.jumpToStep(stepNumber + 1, direction);\n } else {\n this.jumpToStep(stepNumber - 1, direction);\n }\n return;\n }\n\n if (this.currentStep) {\n this.currentStep.hide();\n }\n\n this.setCurrentStep(targetStep);\n\n window.triggerDispatchEvent(this.dom, 'userform.form.changestep', {\n stepId: targetStep.id\n });\n }\n\n setUpPing() {\n // Make sure the form doesn't expire on the user. Pings every 3 mins.\n window.setInterval(() => {\n fetch('UserDefinedFormController/ping');\n }, 180 * 1000);\n }\n\n}\n\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/UserForms.js","// Used for frontend userforms\nimport 'bundles/UserForms';\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/bundle.js","module.exports = i18n;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"i18n\"\n// module id = 0\n// module chunks = 0"],"sourceRoot":""}