{"version":3,"sources":["webpack:///webpack/bootstrap 18ae76087b773c166ed0?35be************************************","webpack:///./cartridges/app_bata_sfra/cartridge/client/default/js/onWheels.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","id","loaded","modules","call","m","c","p","registration_form_zipCode_oldVal","$","on","contactPhone","this","val","replace","e","preventDefault","form","url","attr","length","spinner","start","ajax","type","dataType","data","serialize","success","text","title","msg","stop","modal","error","err","zipCode","trim","zipcode","removeClass","city","result","responseTextCity","state","responseTextState","addClass","parents","find"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAC,WACAE,GAAAH,EACAI,QAAA,GAUA,OANAC,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,QAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,GAGAV,EAAA,mBCtCA,aACA,IAAIW,EAKJC,EAAE,kBAAkBC,GAAG,OAAQ,WAC3B,IAAIC,EAAeF,EAAEG,MAAMC,MACvBF,IACAA,EAAeA,EAAaG,QAAQ,MAAO,IAC3CL,EAAEG,MAAMC,IAAIF,MAqDhBF,EAAE,iBAAiBC,GAAG,SAAU,SAAUK,GACtCA,EAAEC,iBACF,IAAIC,EAAOR,EAAEG,MACTM,EAAMD,EAAKE,KAAK,UAEc,IAA9BV,EAAE,iBAAiBW,SACnBX,EAAEY,UAAUC,QACZb,EAAEc,MACEL,IAAKA,EACLM,KAAM,OACNC,SAAU,OACVC,KAAMT,EAAKU,YACXC,QAAS,SAAUF,GACfjB,EAAE,mBAAmBoB,KAAKH,EAAKI,OAC/BrB,EAAE,eAAeoB,KAAKH,EAAKK,KAC3BtB,EAAEY,UAAUW,OACZvB,EAAE,mBAAmBwB,MAAM,SAE/BC,MAAO,SAAUC,GACb1B,EAAE,mBAAmBoB,KAAKM,EAAIL,OAC9BrB,EAAE,oBAAoBoB,KAAKM,EAAIJ,KAC/BtB,EAAEY,UAAUW,OACZvB,EAAE,mBAAmBwB,MAAM,cAnE3CxB,EAAE,oBAAoBC,GAAG,OAAQ,WAC7B,IAAIQ,EAAMT,EAAEG,MAAMc,KAAK,OACnBU,EAAU3B,EAAEG,MAAMC,MAAMwB,OACxBX,GACAY,QAASF,GAGTA,GAAWA,EAAQhB,OAAS,GAAKgB,IAAY5B,IAE7CC,EAAE,iBAAiBI,IAAI,IACvBJ,EAAE,kBAAkBI,IAAI,IACxBJ,EAAEG,MAAM2B,YAAY,2BACpB9B,EAAEY,UAAUC,QACZb,EAAEc,MACEL,IAAKA,EACLM,KAAM,OACNC,SAAU,OACVC,KAAMA,EACNE,QAAS,SAAUF,GACf,GAAIA,EAAKE,QAAS,CACd,IAAIY,EAAOd,EAAKe,OAAOC,iBACnBC,EAAQjB,EAAKe,OAAOG,kBACxBnC,EAAE,iBAAiBI,IAAI2B,GACvB/B,EAAE,kBAAkBI,IAAI8B,GACxBnC,EAAmC4B,EACnC3B,EAAEY,UAAUW,YAEZvB,EAAE,oBAAoBoC,SAAS,2BAC/BpC,EAAE,oBAAoBqC,QAAQ,kBAAkBC,KAAK,oBAAoBlB,KAAKH,EAAKQ,OACnF1B,EAAmC4B,EACnC3B,EAAEY,UAAUW,QAGpBE,MAAO,WACHzB,EAAEY,UAAUW","file":"onWheels.min.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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 18ae76087b773c166ed0","'use strict';\nvar registration_form_zipCode_oldVal;\n\n/**\n * when the user focuses out of the contact phone input label, removes all the whitespaces if present (for example from autofill)\n */\n$('#contact-phone').on('blur', function() {\n let contactPhone = $(this).val();\n if (contactPhone) {\n contactPhone = contactPhone.replace(/\\s/g, '');\n $(this).val(contactPhone);\n }\n});\n\n/**\n * Autocomplete city and state field on pincode entered\n */\nfunction cityAndStateAutocomplete () {\n $('#contact-pincode').on('blur', function() {\n var url = $(this).data('url');\n var zipCode = $(this).val().trim();\n var data = {\n zipcode: zipCode\n };\n\n if (zipCode && zipCode.length > 0 && zipCode !== registration_form_zipCode_oldVal) {\n //clear fields and errors\n $('#contact-city').val('');\n $('#contact-state').val('');\n $(this).removeClass('is-invalid custom-error');\n $.spinner().start();\n $.ajax({\n url: url,\n type: 'POST',\n dataType: 'json',\n data: data,\n success: function (data) {\n if (data.success) {\n var city = data.result.responseTextCity;\n var state = data.result.responseTextState;\n $('#contact-city').val(city);\n $('#contact-state').val(state);\n registration_form_zipCode_oldVal = zipCode;\n $.spinner().stop();\n } else {\n $('#contact-pincode').addClass('is-invalid custom-error');\n $('#contact-pincode').parents('.cc-form-group').find('.cc-text-message').text(data.error);\n registration_form_zipCode_oldVal = zipCode;\n $.spinner().stop();\n }\n },\n error: function () {\n $.spinner().stop();\n }\n });\n }\n });\n}\n\n/**\n * Ajax script that allows to submit form without refreshing the page and shows modal on submit\n */\nfunction submitForm() {\n $('form#onWheels').on('submit', function (e) {\n e.preventDefault();\n var form = $(this);\n var url = form.attr('action');\n\n if ($('.custom-error').length === 0) {\n $.spinner().start();\n $.ajax({\n url: url,\n type: 'POST',\n dataType: 'json',\n data: form.serialize(),\n success: function (data) {\n $('#ModalFormTitle').text(data.title);\n $('#modal-body').text(data.msg);\n $.spinner().stop();\n $('#onWheels-modal').modal('show');\n },\n error: function (err) {\n $('#ModalFormTitle').text(err.title);\n $('#modal-form-body').text(err.msg);\n $.spinner().stop();\n $('#onWheels-modal').modal('show');\n }\n });\n }\n });\n}\n\nsubmitForm();\ncityAndStateAutocomplete();\n\n\n\n// WEBPACK FOOTER //\n// ./cartridges/app_bata_sfra/cartridge/client/default/js/onWheels.js"],"sourceRoot":""}