{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/components/ContactForm/index.js"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","ContactUsForm","this","formState","email","message","state","emailStr","test","String","toLowerCase","btnText","formData","FormData","append","location","host","document","querySelector","textContent","fetch","origin","method","body","then","res","ok","getElementById","reset","keys","map","classList","remove","add","addEventListener","event","target","update","isValidEmail","e","preventDefault","submitForm","init"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9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WAGtBgC,SAASU,eAAe,SAASI,UAAUC,OAAO,gBAClDf,SAASU,eAAe,SAASI,UAAUE,IAAI,kBAC/C,EAAKI,OAAL,OACK,EAAKlC,WADV,IAEEC,MAAO,UAKba,SAASU,eAAe,WAAWO,iBAAiB,SAAS,SAAAC,GACvDA,EAAMC,OAAOnD,OACfgC,SAASU,eAAe,WAAWI,UAAUC,OAAO,kBACpDf,SAASU,eAAe,WAAWI,UAAUE,IAAI,gBACjD,EAAKI,OAAL,OACK,EAAKlC,WADV,IAEEE,QAAS8B,EAAMC,OAAOnD,WAGxBgC,SAASU,eAAe,WAAWI,UAAUC,OAAO,gBACpDf,SAASU,eAAe,WAAWI,UAAUE,IAAI,kBACjD,EAAKI,OAAL,OACK,EAAKlC,WADV,IAEEE,QAAS,UAKfY,SAASC,cAAc,iBAAiBgB,iBAAiB,SAAS,SAAAK,GAChEA,EAAEC,iBACF,EAAKC,oB,KAKPxB,SAASU,eAAe,qBAC1B,IAAI1B,GAAgByC","file":"js/contact-us.min.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \tvar deferredModules = [];\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 \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([42,0]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","import './style.scss';\n\nclass ContactUsForm {\n constructor() {\n this.formState = {\n name: '',\n email: '',\n message: '',\n };\n }\n\n // eslint-disable-next-line consistent-return\n update(state) {\n if (!state) return this.formState;\n\n this.formState = {\n ...state,\n };\n }\n\n // eslint-disable-next-line class-methods-use-this\n isValidEmail(emailStr) {\n // eslint-disable-next-line no-useless-escape\n const emailRegex = /^(([^<>()[\\]\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i;\n return emailRegex.test(String(emailStr).toLowerCase());\n }\n\n submitForm() {\n const formData = new FormData();\n if (this.formState.name !== '' && this.formState.email !== '' && this.formState.message !== '') {\n formData.append('name', this.formState.name);\n formData.append('email', this.formState.email);\n formData.append('message', this.formState.message);\n formData.append('siteName', window.location.host);\n const submit = () => {\n const btnText = document.querySelector('.form__submit');\n btnText.textContent = 'Submitting...'\n fetch(`${window.location.origin}/wp-admin/admin-ajax.php?action=submit_contact_us_form`, {\n method: 'POST',\n body: formData,\n }).then(res => {\n if (res.ok) {\n btnText.textContent = 'Send request';\n this.formState = {\n name: '',\n email: '',\n message: '',\n };\n document.getElementById('contact-us-form').reset();\n Object.keys(this.formState).map(key => {\n document.getElementById(key).classList.remove('input--valid');\n });\n }\n });\n }\n\n submit();\n } else {\n // eslint-disable-next-line array-callback-return\n Object.keys(this.formState).map(key => {\n if (this.formState[key] === '') {\n document.getElementById(key).classList.add('input--invalid');\n document.getElementById(key).classList.remove('input--valid');\n } else if (this.formState[key] !== '') {\n document.getElementById(key).classList.remove('input--invalid');\n document.getElementById(key).classList.add('input--valid');\n }\n });\n }\n }\n\n init() {\n document.getElementById('name').addEventListener('input', event => {\n if (event.target.value) {\n document.getElementById('name').classList.remove('input--invalid');\n document.getElementById('name').classList.add('input--valid');\n this.update({\n ...this.formState,\n name: event.target.value,\n });\n } else {\n this.update({\n ...this.formState,\n name: '',\n });\n document.getElementById('name').classList.remove('input--valid');\n document.getElementById('name').classList.add('input--invalid');\n }\n });\n\n document.getElementById('email').addEventListener('input', event => {\n if (this.isValidEmail(event.target.value)) {\n document.getElementById('email').classList.remove('input--invalid');\n document.getElementById('email').classList.add('input--valid');\n this.update({\n ...this.formState,\n email: event.target.value,\n });\n } else {\n document.getElementById('email').classList.remove('input--valid');\n document.getElementById('email').classList.add('input--invalid');\n this.update({\n ...this.formState,\n email: '',\n });\n }\n });\n\n document.getElementById('message').addEventListener('input', event => {\n if (event.target.value) {\n document.getElementById('message').classList.remove('input--invalid');\n document.getElementById('message').classList.add('input--valid');\n this.update({\n ...this.formState,\n message: event.target.value,\n });\n } else {\n document.getElementById('message').classList.remove('input--valid');\n document.getElementById('message').classList.add('input--invalid');\n this.update({\n ...this.formState,\n message: '',\n });\n }\n });\n\n document.querySelector('.form__submit').addEventListener('click', e => {\n e.preventDefault();\n this.submitForm();\n });\n }\n}\n\nif (document.getElementById('contact-us-form')) {\n new ContactUsForm().init();\n}\n"],"sourceRoot":""}