{"version":3,"file":"default/js/contactPage.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_ua_core/cartridge/client/default/js/components/scrollAnimate.js","webpack:///./cartridges/app_ua_emea/cartridge/client/default/js/contactPage.js","webpack:///./cartridges/app_ua_emea/cartridge/client/default/js/contactUs/contactUsFAQ.js","webpack:///./cartridges/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.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// 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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_ua_emea/cartridge/client/default/js/contactPage.js\");\n","'use strict';\n\nmodule.exports = function (element) {\n    var position = element && element.length ? (element.offset().top - $('.l-header-section_bottom').outerHeight()) : 0;\n    if ($(window).width() < 1024) {\n        position = element && element.length ? (element.offset().top - $('.l-header-section_bottom').outerHeight() - ($('.b-checkout_sticky-applypromo').length > 0 ? $('.b-checkout_sticky-applypromo').outerHeight() : 0)) : 0;\n    }\n    $('html, body').animate({\n        scrollTop: position - 30\n    }, 500);\n    if (!element) {\n        $('.logo-home').focus();\n    }\n};\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n    processInclude(require('./contactUs/contactUsFAQ'));\n});\n","/* eslint-disable no-useless-return */\n/* eslint-disable no-undef */\nvar scrollAnimate = require('org/components/scrollAnimate');\n\nmodule.exports = function () {\n    var validateFields = function () {\n        var error = false;\n        $('#sendNoteForm [required]').each((index, elem) => {\n            if ($(elem).val().length < 1) {\n                elem.setCustomValidity(window.faqResources.invalidField);\n                if (elem.id === 'g-recaptcha') {\n                    try {\n                        if (grecaptcha.getResponse() === 0) {\n                            error = true;\n                        }\n                    } catch (e) {\n                        error = false;\n                    }\n                } else {\n                    error = true;\n                }\n            } else {\n                elem.setCustomValidity('');\n            }\n        });\n        return error;\n    };\n\n    var check = function () {\n        var error = false;\n        var emailField = document.getElementById('email');\n        var emailConfirmField = document.getElementById('emailConfirm');\n        var nameField = document.getElementById('name');\n        var orderNumberField = document.getElementsByClassName('orderNumber-field')[0];\n        var descriptionField = document.getElementById('description');\n        var emailInput = emailField.value;\n        var emailConfirm = emailConfirmField.value;\n        var nameFieldInput = nameField.value;\n        var orderNumberFieldInput = orderNumberField.value;\n        var descriptionFieldInput = descriptionField.value;\n\n        var customRegex = $('[name$=\"xssRegex\"]').val();\n        var customRegexExp = new RegExp(customRegex, '');\n\n        emailField.setCustomValidity('');\n        emailConfirmField.setCustomValidity('');\n        nameField.setCustomValidity('');\n        orderNumberField.setCustomValidity('');\n\n        descriptionField.setCustomValidity('');\n\n        if (emailConfirm !== emailInput || !emailConfirm || !emailInput) {\n            if (!emailInput) {\n                emailField.setCustomValidity(\n                    window.faqResources.faqErrorEmailMatch\n                );\n                error = true;\n            } else {\n                emailConfirmField.setCustomValidity(\n                    window.faqResources.faqErrorEmailMatch\n                );\n                error = true;\n            }\n        }\n        if (!/^[\\w.%+-]+@[\\w.-]+\\.[\\w]{2,6}$/.test(emailInput)) {\n            emailField.setCustomValidity(window.faqResources.faqInvalidEmail);\n            error = true;\n        }\n        if (!/^[\\w.%+-]+@[\\w.-]+\\.[\\w]{2,6}$/.test(emailConfirm)) {\n            emailConfirmField.setCustomValidity(\n                window.faqResources.faqInvalidEmail\n            );\n            error = true;\n        }\n\n        var nameRegexExp = /^(?!-)[a-zA-Z0-9{L}{Nd}\\s.-]*$/;\n        if (!nameRegexExp.test(nameFieldInput)) {\n            nameField.setCustomValidity(window.faqResources.faqInvalidInput);\n            error = true;\n        }\n        if (!nameRegexExp.test(orderNumberFieldInput)) {\n            orderNumberField.setCustomValidity(window.faqResources.faqInvalidInput);\n            error = true;\n        }\n        if (!/\\S/.test(descriptionFieldInput)) {\n            descriptionField.setCustomValidity(window.faqResources.invalidField);\n            error = true;\n        }\n        if (customRegexExp.test(descriptionFieldInput)) {\n            descriptionField.setCustomValidity(window.faqResources.faqInvalidInput);\n            error = true;\n        }\n\n        return error;\n    };\n\n    var onInputChangeMethod = function (e) {\n        if ($(e.target).val().length < 1 && e.target.id !== '00N4V00000ECopn') {\n            e.target.setCustomValidity(window.faqResources.invalidField);\n        } else {\n            e.target.setCustomValidity('');\n            check();\n        }\n    };\n\n    check();\n    validateFields();\n    $(document).on('change keyup', onInputChangeMethod);\n    $('#emailConfirm, #email').on('change input keyup', check);\n    $('#type').on('change', function () {\n        var el = $(this);\n        var faqResources = window.faqResources;\n        var subTopic = $('#00N4V00000ECopw');\n        if (el.val() === 'Select one') {\n            subTopic.children().remove().end().append('<option value=\"\">' + faqResources.faqPleaseSelect + '</option>');\n        } else if (el.val() === 'Privacy') {\n            subTopic.children().remove().end().append('<option value=\"Unsubscribe\">' + faqResources.faqUnsubscribeEmail + '</option><option value=\"Data Deletion\">' + faqResources.faqAccountDeletion + '</option>');\n        } else if (el.val() === 'Orders & Tracking') {\n            subTopic.children().remove().end().append('<option value=\"Cancel\">' + faqResources.faqCancel + '</option><option value=\"Status\">' + faqResources.faqStatus + '</option>');\n        } else if (el.val() === 'Other') {\n            subTopic.children().remove().end().append('<option value=\"General Feedback\">' + faqResources.faqGeneralFeedback + '</option>');\n        } else if (el.val() === 'Product Inquiry') {\n            subTopic.children().remove().end().append('<option value=\"Availability / Stock Inquiry\">' + faqResources.faqAvailability + '</option><option value=\"Product DNA Sizing/Specs/Fit&Care\">' + faqResources.faqProductDna + '</option>');\n        } else if (el.val() === 'Return') {\n            subTopic.children().remove().end().append('<option value=\"Refund Status\">' + faqResources.faqRefundStatus + '</option><option value=\"UA.Com/Label\">' + faqResources.faqUaLabel + '</option>');\n        }\n        subTopic[0].setCustomValidity('');\n    });\n\n    $('#sendNoteForm').on('submit', function (e) {\n        var error1 = check();\n        var error2 = validateFields();\n        if (error1 || error2) {\n            e.preventDefault();\n        }\n\n        var response = grecaptcha.getResponse();\n        // recaptcha failed validation\n        if (response.length === 0) {\n            e.preventDefault();\n        }\n        if (e.isDefaultPrevented()) {\n            return false;\n        }\n\n        return true;\n    });\n\n    $('[type=\"submit\"]').on('click', function () {\n        // this adds 'required' class to all the required inputs under the same <form> as the submit button\n        $(this).closest('form').find('[required]').addClass('required');\n    });\n\n    $('.cu-form-field').on('focus', function () {\n        var position = $(this).offset().top - $(window).scrollTop();\n        if (position < 115) {\n            scrollAnimate($(this).prevUntil('label'));\n        }\n    });\n\n    $('#sendNoteForm').on('submit', function (e) {\n        if (typeof grecaptcha === 'undefined') return;\n\n        var response = grecaptcha.getResponse();\n        // recaptcha failed validation\n        if (response.length === 0) {\n            e.preventDefault();\n        }\n        if (e.isDefaultPrevented()) {\n            return;\n        }\n\n        return;\n    });\n\n    var timestamp = function () {\n        var response = document.getElementById('g-recaptcha-response');\n        if (response == null || response.value.trim() === '') {\n            var elems = JSON.parse(\n                document.getElementsByName('captcha_settings')[0].value\n            );\n            elems.ts = JSON.stringify(new Date().getTime());\n            document.getElementsByName(\n                'captcha_settings'\n            )[0].value = JSON.stringify(elems);\n        }\n    };\n    setInterval(timestamp, 500);\n};\n","'use strict';\n\nmodule.exports = function (include) {\n    if (typeof include === 'function') {\n        include();\n    } else if (typeof include === 'object') {\n        Object.keys(include).forEach(function (key) {\n            if (typeof include[key] === 'function') {\n                include[key]();\n            }\n        });\n    }\n};\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACbA;AACA;AACA;AAEA;AACA;AACA;;;;;;;;;;;ACNA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAGA;AACA;AAGA;AACA;AACA;AACA;;;;;;;;;;;;AC5LA;AACA;AADA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}