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,CAACC,cAAc,CAAC,CAAC;MACtBD,KAAK,CAACS,eAAe,CAAC,CAAC;IAC3B,CAAC,MAAK;MACF,MAAMC,MAAM,GAAGb,EAAE,CAACC,aAAa,CAAC,mCAAmC,CAAC;MACpEY,MAAM,CAACP,SAAS,CAACC,GAAG,CAAC,QAAQ,CAAC;MAC9BM,MAAM,CAACX,gBAAgB,CAAC,OAAO,EAAE,YAAU;QAACW,MAAM,CAACP,SAAS,CAACI,MAAM,CAAC,QAAQ,CAAC;MAAA,CAAC,CAAC;MAC/EC,UAAU,CAAE,YAAU;QACpBE,MAAM,CAACP,SAAS,CAACI,MAAM,CAAC,QAAQ,CAAC;MACnC,CAAC,EAAE,IAAI,CAAC;MAER,MAAMI,IAAI,GAAG,IAAIC,QAAQ,CAACf,EAAE,CAAC;MAC7B,MAAMgB,cAAc,GAAGF,IAAI,CAACG,GAAG,CAAC,iBAAiB,CAAC,IAAI,KAAK;MAC3D,MAAMC,eAAe,GAAGJ,IAAI,CAACG,GAAG,CAAC,kBAAkB,CAAC;MAEpDxB,2DAAQ,CAAE;QACR0B,IAAI,EAAE,kCAAkC;QACxCC,MAAM,EAAE,MAAM;QACdN,IAAI,EAAE;UACJO,IAAI,EAAEL,cAAc,GAAGA,cAAc,GAAG,EAAE;UAC1CM,KAAK,EAAEJ;QACT;MACF,CAAE,CAAC,CAACK,IAAI,CAAIC,GAAG,IAAM;QAClB;MAAA,CACD,CAAC;MAEHxB,EAAE,CAACyB,KAAK,CAAC,CAAC;IACd;IACAzB,EAAE,CAACM,SAAS,CAACC,GAAG,CAAC,eAAe,CAAC;IACjC,OAAO,KAAK;EAChB,CAAC,CAAC;AAEJ,CAAC,CAAC,C","sources":["webpack://gold-eyes-core/external window [\"wp\",\"apiFetch\"]","webpack://gold-eyes-core/webpack/bootstrap","webpack://gold-eyes-core/webpack/runtime/compat get default export","webpack://gold-eyes-core/webpack/runtime/define property getters","webpack://gold-eyes-core/webpack/runtime/hasOwnProperty shorthand","webpack://gold-eyes-core/webpack/runtime/make namespace object","webpack://gold-eyes-core/./src/newsletter/view.js"],"sourcesContent":["module.exports = window[\"wp\"][\"apiFetch\"];","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\nimport apiFetch from '@wordpress/api-fetch';\n\nconst form = document.querySelectorAll(\".goldeyes-newsletter\");\n\nArray.from(form).forEach(function(el){\n\n el.querySelector('[type=\"submit\"]').addEventListener(\"click\", function(event){\n event.preventDefault();\n if (!el.checkValidity()) {\n el.classList.add(\"no-valid\");\n el.querySelector(\"[required]:invalid\").focus();\n const errMsg = el.querySelector(\".goldeyes-newsletter__error-msg\");\n errMsg.addEventListener(\"click\", function(){errMsg.classList.remove(\"active\")})\n errMsg.classList.add(\"active\")\n setTimeout( function(){\n errMsg.classList.remove(\"active\")\n }, 4000)\n event.preventDefault()\n event.stopPropagation()\n } else{\n const sccMsg = el.querySelector(\".goldeyes-newsletter__success-msg\");\n sccMsg.classList.add(\"active\")\n sccMsg.addEventListener(\"click\", function(){sccMsg.classList.remove(\"active\")})\n setTimeout( function(){\n sccMsg.classList.remove(\"active\")\n }, 4000)\n\n const data = new FormData(el);\n const subscriberName = data.get(\"subscriber-name\") || false;\n const subscriberEmail = data.get(\"subscriber-email\");\n\n apiFetch( {\n path: '/subscribers/v1/form-submissions',\n method: 'POST',\n data: {\n name: subscriberName ? subscriberName : '',\n email: subscriberEmail\n },\n } ).then( ( res ) => {\n // console.log( res );\n } );\n \n el.reset();\n }\n el.classList.add(\"was-validated\");\n return false;\n })\n\n})\n\n\n\n\n\n\n\n\n"],"names":["apiFetch","form","document","querySelectorAll","Array","from","forEach","el","querySelector","addEventListener","event","preventDefault","checkValidity","classList","add","focus","errMsg","remove","setTimeout","stopPropagation","sccMsg","data","FormData","subscriberName","get","subscriberEmail","path","method","name","email","then","res","reset"],"sourceRoot":""}