{"version":3,"sources":["webpack:///webpack/bootstrap 7f7717b373f515738f49","webpack:///./client/src/bundles/UserForms.js","webpack:///external \"i18n\"","webpack:///external \"jQuery\""],"names":["jQuery","document","ready","$","userform","CONSTANTS","commonMixin","show","$el","attr","hide","ErrorContainer","element","find","text","i18n","_t","prototype","hasErrors","children","length","removeErrorMessage","fieldId","remove","addStepLink","step","itemID","$itemElement","stepID","stepTitle","data","on","e","preventDefault","jumpToStep","id","append","removeStepLink","closest","is","updateErrorMessage","$input","message","inputID","anchor","elementID","messageElement","describedBy","addClass","removeClass","html","each","location","pathname","search","match","RegExp","FormStep","self","$elButton","prop","viewed","valid","DISPLAY_ERROR_MESSAGES_AT_TOP","errorContainer","validator","errorList","i","error","trigger","conditionallyHidden","ProgressBar","$buttons","$jsAlign","stepButton","parseInt","update","$visibleButtons","filter","button","index","$button","leftPercent","buttonOffset","innerWidth","css","left","marginLeft","$newStepElement","stepNumber","barWidth","$element","$item","parent","removeAttr","siblings","width","FormActions","$prevButton","$nextButton","numberOfSteps","steps","currentStep","lastStep","UserForm","prevStep","nextStep","validate","validationOptions","rules","required","ignore","errorClass","errorElement","errorPlacement","parents","appendTo","insertAfter","invalidHandler","event","setTimeout","currentElements","first","focus","submitHandler","form","isValid","submit","success","errorId","substr","indexOf","replace","addStep","push","setCurrentStep","direction","targetStep","forward","main","$userform","ENABLE_LIVE_VALIDATION","extend","onfocusout","HIDE_FIELD_LABELS","$label","ssDatepicker","datepicker","setInterval","ajax","url","areYouSure"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;A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AASiI,OAAT,CAAiB5G,IAAjB;AACD,KAJD;;AAMArB,aAASmI,cAAT,CAAwBnI,SAASiG,KAAT,CAAe,CAAf,CAAxB;;AASAlG,MAAEF,QAAF,EAAY8B,EAAZ,CAAe,OAAf,EAAwB,+BAAxB,EAAyD,YAAM;AAC7D,UAAM4D,WAAWxF,SAAjB;;AAEAwF,eAASuD,YAAT;;AAEA,UAAIvD,SAAS7D,IAAT,CAAc,YAAd,CAAJ,EAAiC;AAC/B6D,iBAASwD,UAAT,CAAoB,MAApB;AACD;AACF,KARD;;AAWAC,gBAAY,YAAM;AAChBjJ,QAAEkJ,IAAF,CAAO,EAAEC,KAAK,gCAAP,EAAP;AACD,KAFD,EAEG,MAAM,IAFT;;AAKA,QAAMzB,OAAO1H,EAAE,eAAF,CAAb;AACA,QAAI,OAAO0H,KAAK0B,UAAZ,KAA2B,WAA/B,EAA4C;AAC1C1B,WAAK0B,UAAL,CAAgB;AACd7G,iBAAS,4CAAA3B,CAAKC,EAAL,CAAQ,8BAAR,EAAwC,2BAAxC;AADK,OAAhB;AAGD;AACF;;AAED2H;AACD,CA7tBD,E;;;;;;;;;;;;;;;;ACPA,sB;;;;;;ACAA,wB","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 = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 7f7717b373f515738f49","/**\n * @file Manages the multi-step navigation.\n */\n\nimport jQuery from 'jquery';\nimport i18n from 'i18n';\n\njQuery(document).ready(($) => {\n // A reference to the UserForm instance.\n let userform = null;\n\n // Settings that come from the CMS.\n const CONSTANTS = {};\n\n // Common functions that extend multiple classes.\n const commonMixin = {\n /**\n * @func show\n * @desc Show the form step. Looks after aria attributes too.\n */\n show() {\n this.$el.attr('aria-hidden', false).show();\n },\n /**\n * @func hide\n * @desc Hide the form step. Looks after aria attributes too.\n */\n hide() {\n this.$el.attr('aria-hidden', true).hide();\n },\n };\n\n /**\n * @func ErrorContainer\n * @constructor\n * @param {object} element - The error container element.\n * @return {object} - The ErrorContainer instance.\n * @desc Creates an error container. Used to display step error messages at the top.\n */\n function ErrorContainer(element) {\n this.$el = element instanceof $ ? element : $(element);\n\n // Set the error container's heading.\n this.$el.find('h4').text(i18n._t('UserForms.ERROR_CONTAINER_HEADER',\n 'Please correct the following errors and try again:'));\n\n return this;\n }\n\n /**\n * @func hasErrors\n * @return boolean\n * @desc Checks if the error container has any error messages.\n */\n ErrorContainer.prototype.hasErrors = function () {\n return this.$el.find('.error-list').children().length > 0\n };\n\n /**\n * @func removeErrorMessage\n * @desc Removes an error message from the error container.\n */\n ErrorContainer.prototype.removeErrorMessage = function (fieldId) {\n this.$el.find(`#${fieldId}-top-error`).remove();\n\n // If there are no more error then hide the container.\n if (!this.hasErrors()) {\n this.hide();\n }\n };\n\n /**\n * @func addStepLink\n * @param {object} step - FormStep instance.\n * @desc Adds a link to a form step as an error message.\n */\n ErrorContainer.prototype.addStepLink = function (step) {\n const itemID = `${step.$el.attr('id')}-error-link`;\n let $itemElement = this.$el.find(`#${itemID}`);\n const stepID = step.$el.attr('id');\n const stepTitle = step.$el.data('title');\n\n // If the item already exists we don't need to do anything.\n if ($itemElement.length) {\n return;\n }\n\n $itemElement = $(`
  • ${stepTitle}
  • `);\n\n $itemElement.on('click', (e) => {\n e.preventDefault();\n userform.jumpToStep(step.id);\n });\n\n this.$el.find('.error-list').append($itemElement);\n };\n\n /**\n * @func removeStepLink\n * @param {object} step - FormStep instance.\n * @desc Removes a step link from the error container.\n */\n ErrorContainer.prototype.removeStepLink = function (fieldId) {\n const stepID = $(`#${fieldId}`).closest('.form-step').attr('id');\n\n this.$el.find(`#${stepID}-error-link`).remove();\n\n // Hide the error container if we've just removed the last error.\n if (this.$el.find('.error-list').is(':empty')) {\n this.hide();\n }\n };\n\n /**\n * @func ErrorContainer.updateErrorMessage\n * @param {object} $input - The jQuery input object which contains the field to validate.\n * @param {object} message - The error message to display (html escaped).\n * @desc Update an error message (displayed at the top of the form).\n */\n ErrorContainer.prototype.updateErrorMessage = function ($input, message) {\n const inputID = $input.attr('id');\n let anchor = `#${inputID}`;\n const elementID = `${inputID}-top-error`;\n let messageElement = $(`#${elementID}`);\n let describedBy = $input.attr('aria-describedby');\n\n // The 'message' param will be an empty string if the field is valid.\n if (!message) {\n // Style issues as fixed if they already exist\n messageElement.addClass('fixed');\n return;\n }\n\n messageElement.removeClass('fixed');\n\n this.show();\n\n if (messageElement.length === 1) {\n // Update the existing error message.\n messageElement.show().find('a').html(message);\n } else {\n // Generate better link to field\n $input.closest('.field[id]').each(() => {\n anchor = `#${$(this).attr('id')}`;\n });\n\n // Add a new error message\n messageElement = $('
  • ');\n messageElement\n .attr('id', elementID)\n .find('a')\n .attr('href', location.pathname + location.search + anchor)\n .html(message);\n\n this.$el.find('ul').append(messageElement);\n\n // Link back to original input via aria\n // Respect existing non-error aria-describedby\n if (!describedBy) {\n describedBy = elementID;\n } else if (!describedBy.match(new RegExp(`\\\\b${elementID}\\\\b`))) {\n // Add to end of list if not already present\n describedBy += ` ${elementID}`;\n }\n\n $input.attr('aria-describedby', describedBy);\n }\n };\n\n /**\n * @func FormStep\n * @constructor\n * @param {object} element\n * @return {object} - The FormStep instance.\n * @desc Creates a form step.\n */\n function FormStep(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n\n // Find button for this step\n this.$elButton = $(`.step-button-wrapper[data-for='${this.$el.prop('id')}]`);\n\n // Has the step been viewed by the user?\n this.viewed = false;\n\n // Is the form step valid?\n // This value is used on form submission, which fails, if any of the steps are invalid.\n this.valid = false;\n\n // The internal id of the step. Used for getting the step from the UserForm.steps array.\n this.id = null;\n\n this.hide();\n\n if (CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP) {\n this.errorContainer = new ErrorContainer(this.$el.find('.error-container'));\n\n // Listen for errors on the UserForm.\n userform.$el.on('userform.form.error', (e, validator) => {\n // The step only cares about errors if it's currently visible.\n if (!self.$el.is(':visible')) {\n return;\n }\n\n // Add or update each error in the list.\n $.each(validator.errorList, (i, error) => {\n self.errorContainer.updateErrorMessage($(error.element), error.message);\n });\n });\n\n // Listen for fields becoming valid\n userform.$el.on('userform.form.valid', (e, fieldId) => {\n self.errorContainer.removeErrorMessage(fieldId);\n });\n }\n\n // Ensure that page visibilty updates the step navigation\n this\n .$elButton\n .on('userform.field.hide userform.field.show', () => {\n userform.$el.trigger('userform.form.conditionalstep');\n });\n\n return this;\n }\n\n /**\n * Determine if this step is conditionally disabled\n *\n * @returns {Boolean}\n */\n // Because the element itself could be visible but 0 height, so check visibility of button\n FormStep.prototype.conditionallyHidden = function () {\n return !this.$elButton.find('button').is(':visible')\n };\n\n /**\n * @func ProgressBar\n * @constructor\n * @param {object} element\n * @return {object} - The Progress bar instance.\n * @desc Creates a progress bar.\n */\n function ProgressBar(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n this.$buttons = this.$el.find('.step-button-jump');\n this.$jsAlign = this.$el.find('.js-align');\n\n // Update the progress bar when 'step' buttons are clicked.\n this.$buttons.each((i, stepButton) => {\n $(stepButton).on('click', (e) => {\n e.preventDefault();\n self.$el.trigger('userform.progress.changestep', [parseInt($(this).data('step'), 10)]);\n });\n });\n\n // Update the progress bar when 'prev' and 'next' buttons are clicked.\n userform.$el.on('userform.form.changestep', (e, stepID) => {\n self.update(stepID);\n });\n\n // Listen for steps being conditionally shown / hidden by display rules.\n // We need to update step related UI like the number of step buttons\n // and any text that shows the total number of steps.\n userform.$el.on('userform.form.conditionalstep', () => {\n // Update the step numbers on the buttons.\n const $visibleButtons = self.$buttons.filter(':visible');\n\n $visibleButtons.each((i, button) => {\n $(button).text(i + 1);\n });\n\n // Update the actual progress bar.\n self.$el.find('.progress-bar').attr('aria-valuemax', $visibleButtons.length);\n\n // Update any text that uses the total number of steps.\n self.$el.find('.total-step-number').text($visibleButtons.length);\n });\n\n // Spaces out the steps below progress bar evenly\n this.$jsAlign.each((index, button) => {\n const $button = $(button);\n const leftPercent = (100 / (self.$jsAlign.length - 1) * `${index}%`);\n const buttonOffset = -1 * ($button.innerWidth() / 2);\n\n $button.css({ left: leftPercent, marginLeft: buttonOffset });\n\n // First and last buttons are kept within userform-progress container\n if (index === self.$jsAlign.length - 1) {\n $button.css({ marginLeft: buttonOffset * 2 });\n } else if (index === 0) {\n $button.css({ marginLeft: 0 });\n }\n });\n\n this.update(0);\n\n return this;\n }\n\n /**\n * @func ProgressBar.update\n * @param {number} stepID - Zero based index of the new step.\n * @desc Update the progress element to show a new step.\n */\n ProgressBar.prototype.update = function (stepID) {\n const $newStepElement = $($('.form-step')[stepID]);\n let stepNumber = 0;\n let barWidth = stepID / (this.$buttons.length - 1) * 100;\n\n // Set the current step number.\n this.$buttons.each((i, button) => {\n if (i > stepID) {\n // Break the loop\n return false;\n }\n\n if ($(button).is(':visible')) {\n stepNumber += 1;\n }\n return true;\n });\n\n // Update elements that contain the current step number.\n this.$el.find('.current-step-number').each((i, element) => {\n $(element).text(stepNumber);\n });\n\n // Update aria attributes.\n this.$el.find('[aria-valuenow]').each((i, element) => {\n $(element).attr('aria-valuenow', stepNumber);\n });\n\n // Update the CSS classes on step buttons.\n this.$buttons.each((i, element) => {\n const $element = $(element);\n const $item = $element.parent();\n\n if (parseInt($element.data('step'), 10) === stepNumber && $element.is(':visible')) {\n $item.addClass('current viewed');\n $element.removeAttr('disabled');\n\n return;\n }\n\n $item.removeClass('current');\n });\n\n // Update the progress bar's title with the new step's title.\n this.$el.siblings('.progress-title').text($newStepElement.data('title'));\n\n // Update the width of the progress bar.\n barWidth = barWidth ? `${barWidth}%` : '';\n this.$el.find('.progress-bar').width(barWidth);\n };\n\n /**\n * @func FormActions\n * @constructor\n * @param {object} element\n * @desc Creates the navigation and actions (Prev, Next, Submit buttons).\n */\n function FormActions(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n\n this.$prevButton = this.$el.find('.step-button-prev');\n this.$nextButton = this.$el.find('.step-button-next');\n\n // Show the buttons.\n this.$prevButton.parent().attr('aria-hidden', false).show();\n this.$nextButton.parent().attr('aria-hidden', false).show();\n\n // Bind the step navigation event listeners.\n this.$prevButton.on('click', (e) => {\n e.preventDefault();\n self.$el.trigger('userform.action.prev');\n });\n this.$nextButton.on('click', (e) => {\n e.preventDefault();\n self.$el.trigger('userform.action.next');\n });\n\n // Listen for changes to the current form step, or conditional pages,\n // so we can show hide buttons appropriately.\n userform.$el.on('userform.form.changestep userform.form.conditionalstep', () => {\n self.update();\n });\n\n this.update();\n\n return this;\n }\n\n /**\n * @func FormActions.update\n * @param {number} stepID - Zero based ID of the current step.\n * @desc Updates the form actions element to reflect the current state of the page.\n */\n FormActions.prototype.update = function () {\n const numberOfSteps = userform.steps.length;\n const stepID = userform.currentStep ? userform.currentStep.id : 0;\n let i = null;\n let lastStep = null;\n\n // Update the \"Prev\" button.\n this.$el.find('.step-button-prev')[stepID === 0 ? 'hide' : 'show']();\n\n // Find last step, skipping hidden ones\n for (i = numberOfSteps - 1; i >= 0; i--) {\n lastStep = userform.steps[i];\n\n // Skip if step is hidden\n if (lastStep.conditionallyHidden()) {\n continue;\n }\n\n // Update the \"Next\" button.\n this.$el.find('.step-button-next')[stepID >= i ? 'hide' : 'show']();\n\n // Update the \"Actions\".\n this.$el.find('.Actions')[stepID >= i ? 'show' : 'hide']();\n\n // Stop processing last step\n break;\n }\n };\n\n /**\n * @func UserForm\n * @constructor\n * @param {object} element\n * @return {object} - The UserForm instance.\n * @desc The form\n */\n function UserForm(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n this.steps = [];\n\n // Add an error container which displays a list of invalid steps on form submission.\n this.errorContainer = new ErrorContainer(this.$el.children('.error-container'));\n\n // Listen for events triggered by form steps.\n this.$el.on('userform.action.prev', () => {\n self.prevStep();\n });\n this.$el.on('userform.action.next', () => {\n self.nextStep();\n });\n\n // Listen for events triggered by the progress bar.\n $('#userform-progress').on('userform.progress.changestep', (e, stepNumber) => {\n self.jumpToStep(stepNumber - 1);\n });\n\n // When a field becomes valid, remove errors from the error container.\n this.$el.on('userform.form.valid', (e, fieldId) => {\n self.errorContainer.removeStepLink(fieldId);\n });\n\n this.$el.validate(this.validationOptions);\n\n // Ensure checkbox groups are validated correctly\n $('.optionset.requiredField input').each(() => {\n $(this).rules('add', {\n required: true,\n });\n });\n\n return this;\n }\n\n /*\n * Default options for step validation. These get extended in main().\n */\n UserForm.prototype.validationOptions = {\n ignore: ':hidden,ul',\n errorClass: 'error',\n errorElement: 'span',\n errorPlacement: (error, element) => {\n error.addClass('message');\n\n if (element.is(':radio') || element.parents('.checkboxset').length > 0) {\n error.appendTo(element.closest('.middleColumn'));\n } else if (element.parents('.checkbox').length > 0) {\n error.appendTo(element.closest('.field'));\n } else {\n error.insertAfter(element);\n }\n },\n invalidHandler: (event, validator) => {\n // setTimeout 0 so it runs after errorPlacement\n setTimeout(() => {\n validator.currentElements.filter('.error').first().focus();\n }, 0);\n },\n // Callback for handling the actual submit when the form is valid.\n // Submission in the jQuery.validate sence is handled at step level.\n // So when the final step is submitted we have to also check all previous steps are valid.\n submitHandler: (form) => {\n let isValid = true;\n\n // Validate the current step\n if (userform.currentStep) {\n userform.currentStep.valid = $(form).valid();\n }\n\n // Check for invalid previous steps.\n $.each(userform.steps, (i, step) => {\n if (!step.valid && !step.conditionallyHidden()) {\n isValid = false;\n userform.errorContainer.addStepLink(step);\n }\n });\n\n if (isValid) {\n // When using the \"are you sure?\" plugin, ensure the form immediately submits.\n $(form).removeClass('dirty');\n\n form.submit();\n } else {\n userform.errorContainer.show();\n }\n },\n // When a field becomes valid.\n success: (error) => {\n const errorId = $(error).attr('id');\n const fieldId = errorId.substr(0, errorId.indexOf('-error')).replace(/[\\\\[\\\\]]/, '');\n\n // Remove square brackets since jQuery.validate.js uses idOrName,\n // which breaks further on when using a selector that end with\n // square brackets.\n\n error.remove();\n\n // Pass the field's ID with the event.\n userform.$el.trigger('userform.form.valid', [fieldId]);\n },\n };\n\n /**\n * @func UserForm.addStep\n * @param {object} step - An instance of FormStep.\n * @desc Adds a step to the UserForm.\n */\n UserForm.prototype.addStep = function (step) {\n // Make sure we're dealing with a form step.\n if (!step instanceof FormStep) {\n return;\n }\n\n // eslint-disable-next-line no-param-reassign\n step.id = this.steps.length;\n\n this.steps.push(step);\n };\n\n /**\n * @func UserForm.setCurrentStep\n * @param {object} step - An instance of FormStep.\n * @desc Sets the step the user is currently on.\n */\n UserForm.prototype.setCurrentStep = function (step) {\n // Make sure we're dealing with a form step.\n if (!(step instanceof FormStep)) {\n return;\n }\n\n this.currentStep = step;\n this.currentStep.show();\n\n // Record the user has viewed the step.\n this.currentStep.viewed = true;\n this.currentStep.$el.addClass('viewed');\n };\n\n /**\n * @func UserForm.jumpToStep\n * @param {number} stepNumber\n * @param {boolean} [direction] - Defaults to forward (true).\n * @desc Jumps to a specific form step.\n */\n UserForm.prototype.jumpToStep = function (stepNumber, direction) {\n const targetStep = this.steps[stepNumber];\n let isValid = false;\n const forward = direction === void 0 ? true : direction;\n\n // Make sure the target step exists.\n if (targetStep === void 0) {\n return;\n }\n\n // Make sure the step we're trying to set as current is not\n // hidden by custom display rules. If it is then jump to the next step.\n if (targetStep.conditionallyHidden()) {\n if (forward) {\n this.jumpToStep(stepNumber + 1);\n } else {\n this.jumpToStep(stepNumber - 1);\n }\n\n return;\n }\n\n // Validate the form.\n // This well effectivly validate the current step and not the entire form.\n // This is because hidden fields are excluded from validation, and all fields\n // on all other steps, are currently hidden.\n isValid = this.$el.valid();\n\n // Set the 'valid' property on the current step.\n this.currentStep.valid = isValid;\n\n // Users can navigate to step's they've already viewed even if the current step is invalid.\n if (isValid === false && targetStep.viewed === false) {\n return;\n }\n\n this.currentStep.hide();\n this.setCurrentStep(targetStep);\n\n this.$el.trigger('userform.form.changestep', [targetStep.id]);\n };\n\n /**\n * @func UserForm.nextStep\n * @desc Advances the form to the next step.\n */\n UserForm.prototype.nextStep = function () {\n this.jumpToStep(this.steps.indexOf(this.currentStep) + 1, true);\n };\n\n /**\n * @func UserForm.prevStep\n * @desc Goes back one step (not bound to browser history).\n */\n UserForm.prototype.prevStep = function () {\n this.jumpToStep(this.steps.indexOf(this.currentStep) - 1, false);\n };\n\n /**\n * @func main\n * @desc Bootstraps the front-end.\n */\n function main() {\n const $userform = $('.userform');\n\n // If there's no userform, do nothing.\n if ($userform.length === 0) {\n return;\n }\n\n CONSTANTS.ENABLE_LIVE_VALIDATION = $userform.data('livevalidation') !== void 0;\n CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP = $userform.data('toperrors') !== void 0;\n\n // Extend the default validation options with conditional options\n // that are set by the user in the CMS.\n if (CONSTANTS.ENABLE_LIVE_VALIDATION === false) {\n $.extend(UserForm.prototype.validationOptions, {\n onfocusout: false,\n });\n }\n\n if (CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP) {\n $.extend(UserForm.prototype.validationOptions, {\n // Callback for custom code when an invalid form / step is submitted.\n invalidHandler: (event, validator) => {\n $userform.trigger('userform.form.error', [validator]);\n },\n onfocusout: false,\n });\n }\n\n // Display all the things that are hidden when JavaScript is disabled.\n $('.userform-progress, .step-navigation').attr('aria-hidden', false).show();\n\n // Extend classes with common functionality.\n $.extend(FormStep.prototype, commonMixin);\n $.extend(ErrorContainer.prototype, commonMixin);\n\n userform = new UserForm($userform);\n\n // Conditionally hide field labels and use HTML5 placeholder instead.\n if (CONSTANTS.HIDE_FIELD_LABELS) {\n $userform.find('label.left').each(() => {\n const $label = $(this);\n\n $(`[name=\"${$label.attr('for')}\"]`).attr('placeholder', $label.text());\n $label.remove();\n });\n }\n\n // Initialise the form steps.\n userform.$el.find('.form-step').each((i, element) => {\n const step = new FormStep(element);\n\n userform.addStep(step);\n });\n\n userform.setCurrentStep(userform.steps[0]);\n\n // Initialise actions and progressbar\n // @todo Commented out because they appear unused - are they expected to be exported to the\n // global scope? Check this works on the frontend\n // const progressBar = new ProgressBar($('#userform-progress'));\n // const formActions = new FormActions($('#step-navigation'));\n\n // Enable jQuery UI datepickers\n $(document).on('click', 'input.text[data-showcalendar]', () => {\n const $element = $(this);\n\n $element.ssDatepicker();\n\n if ($element.data('datepicker')) {\n $element.datepicker('show');\n }\n });\n\n // Make sure the form doesn't expire on the user. Pings every 3 mins.\n setInterval(() => {\n $.ajax({ url: 'UserDefinedFormController/ping' });\n }, 180 * 1000);\n\n // Bind a confirmation message when navigating away from a partially completed form.\n const form = $('form.userform');\n if (typeof form.areYouSure !== 'undefined') {\n form.areYouSure({\n message: i18n._t('UserForms.LEAVE_CONFIRMATION', 'You have unsaved changes!'),\n });\n }\n }\n\n main();\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/UserForms.js","module.exports = i18n;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"i18n\"\n// module id = 2\n// module chunks = 0","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 3\n// module chunks = 0"],"sourceRoot":""}