{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./codebase/orange/cartridges/app_osp_contactme_orange/cartridge/client/default/js/contactMe.js","webpack:///./codebase/orange/cartridges/app_osp_contactme_orange/cartridge/client/default/js/contactme/contactMe.js","webpack:///./codebase/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js"],"names":[],"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;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb,qBAAqB,mBAAO,CAAC,kIAAW;;AAExC;AACA,mBAAmB,mBAAO,CAAC,uIAAuB;AAClD,CAAC;;;;;;;;;;;;;ACNY;;AAEb;AACA,2BAA2B,GAAG,+CAA+C,EAAE,qDAAqD,GAAG;;AAEvI;AACA;AACA;AACA,WAAW,SAAS;AACpB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;ACpHa;;AAEb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA","file":"default\\js\\contactMe.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 = \"./codebase/orange/cartridges/app_osp_contactme_orange/cartridge/client/default/js/contactMe.js\");\n","'use strict';\r\n\r\nvar processInclude = require('base/util');\r\n\r\n$(document).ready(function () {\r\n processInclude(require('./contactme/contactMe'));\r\n});\r\n","'use strict';\r\n\r\nconst functions = {};\r\nconst emailRegexp = /^(?=.{6,})(?!\\.|@)(?!.*\\.\\.)[a-zA-Z0-9!#$%\\x26'*+/=?^_`{|}~.-]+@((?!-)([a-zA-Z0-9-]?)+[a-zA-Z0-9]+\\.)+[a-zA-Z]{2,}$/;\r\n\r\n/**\r\n * Function that validates the contact me form, to check if all the required fields are filled.\r\n *\r\n * @param {FormData} form - Contact me form\r\n * @returns {boolean} - True if the form is valid, false otherwise\r\n */\r\nfunctions.validateForm = (form) => {\r\n var isValid = true;\r\n var formElements = form.find('input, select, textarea');\r\n\r\n formElements.each(function () {\r\n if ($(this).prop('required') && $(this).val() === '') {\r\n isValid = false;\r\n $(this).addClass('is-invalid');\r\n } else if ($(this).attr('type') === 'email' && !emailRegexp.test($(this).val())) {\r\n isValid = false;\r\n $(this).addClass('is-invalid');\r\n } else {\r\n $(this).removeClass('is-invalid');\r\n }\r\n });\r\n\r\n // Checkboxes required control\r\n var requiredCheckboxes = form.find('input[type=\"checkbox\"][required]');\r\n requiredCheckboxes.each(function () {\r\n if (!$(this).is(':checked')) {\r\n isValid = false;\r\n $(this).addClass('is-invalid');\r\n } else {\r\n $(this).removeClass('is-invalid');\r\n }\r\n });\r\n\r\n return isValid;\r\n};\r\n\r\n/**\r\n * Function that validates an email input.\r\n *\r\n * @param {jQuery} input - Email input element\r\n */\r\nfunctions.validateEmail = (input) => {\r\n if (!emailRegexp.test(input.val())) {\r\n input.addClass('is-invalid');\r\n } else {\r\n input.removeClass('is-invalid');\r\n }\r\n};\r\n\r\n/**\r\n * Function that returns the productID of the selected product.\r\n *\r\n * @returns {string|null} - The productID of the selected product, or null if not found\r\n */\r\nfunctions.selectProductID = () => {\r\n return $('.product-id').text();\r\n};\r\n\r\n/**\r\n * Adds event handlers for product contact me button.\r\n */\r\nfunctions.init = () => {\r\n $(document).on('click', '.js-product-contact-me', function () {\r\n let $alertModal = $('#js-contact-me-modal-alert');\r\n $alertModal.find('.js-contactme-generic-error').addClass('d-none'); // Clear any previous error messages\r\n $('.js-contact-me-modal-alert-success').addClass('d-none');\r\n $('#contactme-form').removeClass('d-none');\r\n $('#privacyPolicyCheck').prop('checked', false);\r\n $('.js-contactme-email').val('');\r\n // eliminar la clase is-invalid del input del email y el checkbox\r\n $('.js-contactme-email').removeClass('is-invalid');\r\n $('.js-privacy-policy').removeClass('is-invalid');\r\n $alertModal.modal('show');\r\n });\r\n\r\n $(document).on('click', '.js-contactme-form', function (e) {\r\n e.preventDefault();\r\n var $form = $('#contactme-form');\r\n var isValid = functions.validateForm($form);\r\n var productID = functions.selectProductID();\r\n if (isValid) {\r\n $.ajax({\r\n url: $form.attr('data-action'),\r\n type: 'post',\r\n data: $form.serialize() + '&productID=' + productID,\r\n success: function (data) {\r\n if (data.success) {\r\n $('#privacyPolicyCheck').prop('checked', false);\r\n $('#contactme-form').addClass('d-none');\r\n $('.js-contact-me-modal-alert-success').removeClass('d-none');\r\n } else {\r\n $('#js-contact-me-modal-alert-error').modal('show');\r\n }\r\n },\r\n error: function (err) {\r\n let $alertModal = $('#js-contact-me-modal-alert');\r\n $alertModal.find('.js-contactme-generic-error').removeClass('d-none');\r\n $('#contactme-form').addClass('d-none');\r\n }\r\n });\r\n }\r\n });\r\n\r\n $(document).on('blur', '.js-custom-validation', function () {\r\n functions.validateEmail($(this));\r\n });\r\n};\r\n\r\nmodule.exports = {\r\n functions: functions,\r\n init: functions.init()\r\n};\r\n","'use strict';\r\n\r\nmodule.exports = function (include) {\r\n if (typeof include === 'function') {\r\n include();\r\n } else if (typeof include === 'object') {\r\n Object.keys(include).forEach(function (key) {\r\n if (typeof include[key] === 'function') {\r\n include[key]();\r\n }\r\n });\r\n }\r\n};\r\n"],"sourceRoot":""}