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A0EA;AACD,CArFD;;AAuFA,iEAAenD,qBAAf;;;;;;UCvFA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;ACNA;AAEAE,QAAQ,CAACY,gBAAT,CAA2B,kBAA3B,EAAiD4C,KAAF,IAAa;EAC3D1D,kFAAqB;AACrB,CAFD,E","sources":["webpack://realpress/./assets/src/js/frontend/shortcode/schedule-tour/schedule-tour.js","webpack://realpress/webpack/bootstrap","webpack://realpress/webpack/runtime/define property getters","webpack://realpress/webpack/runtime/hasOwnProperty shorthand","webpack://realpress/webpack/runtime/make namespace object","webpack://realpress/./assets/src/js/frontend/realpress-schedule-tour-sc.tsx"],"sourcesContent":["const realpressScheduleTour = () => {\r\n\tconst formNodes = document.querySelectorAll( 'form.realpress-schedule-tour' );\r\n\tif ( ! formNodes ) {\r\n\t\treturn;\r\n\t}\r\n\tfor ( let i = 0; i < formNodes.length; i++ ) {\r\n\t\tconst formNode = formNodes[ i ];\r\n\t\tconst sendMessageNode = formNode.querySelector( 'button.realpress-send-message' );\r\n\t\tconst restUrl = REALPRESS_GLOBAL_OBJECT.rest_url || '';\r\n\t\tconst restNamespace = REALPRESS_GLOBAL_OBJECT.rest_namespace || '';\r\n\t\tsendMessageNode.addEventListener( 'click', function() {\r\n\t\t\tsendMessageNode.disabled = true;\r\n\t\t\tsendMessageNode.insertAdjacentHTML( 'afterbegin', '' );\r\n\t\t\tconst id = formNode.querySelector( 'input[name=\"id\"]' ).value || '';\r\n\t\t\tconst userId = formNode.querySelector( 'input[name=\"agent-id\"]' ).value || '';\r\n\t\t\tconst emailTarget = formNode.querySelector( 'input[name=\"email-target\"]' ).value || '';\r\n\t\t\tconst ccAdminEmail = formNode.querySelector( 'input[name=\"cc-admin\"]' ).value || '';\r\n\t\t\tlet date = '';\r\n\t\t\tif ( formNode.querySelector( 'input[name=\"date\"]:checked' ) ) {\r\n\t\t\t\tdate = formNode.querySelector( 'input[name=\"date\"]:checked' ).value || '';\r\n\t\t\t}\r\n\t\t\tconst time = formNode.querySelector( 'select[name=\"time\"]' ).value || '';\r\n\t\t\tlet tourType = '';\r\n\t\t\tif ( formNode.querySelector( 'input[name=\"tour-type\"]:checked' ) ) {\r\n\t\t\t\ttourType = formNode.querySelector( 'input[name=\"tour-type\"]:checked' ).value || '';\r\n\t\t\t}\r\n\r\n\t\t\tconst name = formNode.querySelector( 'input[name=\"name\"]' ).value || '';\r\n\t\t\tconst phone = formNode.querySelector( 'input[name=\"phone\"]' ).value || '';\r\n\t\t\tconst email = formNode.querySelector( 'input[name=\"email\"]' ).value || '';\r\n\t\t\tconst message = formNode.querySelector( 'textarea[name=\"message\"]' ).value || '';\r\n\t\t\tlet termsAndConditions;\r\n\t\t\tconst termsAndConditionsNode = formNode.querySelector( 'input[name=\"terms_and_conditions\"]' );\r\n\t\t\tif ( termsAndConditionsNode ) {\r\n\t\t\t\ttermsAndConditions = termsAndConditionsNode.checked || false;\r\n\t\t\t} else {\r\n\t\t\t\ttermsAndConditions = true;\r\n\t\t\t}\r\n\r\n\t\t\tconst data = {\r\n\t\t\t\tid,\r\n\t\t\t\temail_target: emailTarget,\r\n\t\t\t\tcc_admin: ccAdminEmail,\r\n\t\t\t\tuser_id: userId,\r\n\t\t\t\tdate,\r\n\t\t\t\ttime,\r\n\t\t\t\ttour_type: tourType,\r\n\t\t\t\tname,\r\n\t\t\t\tphone,\r\n\t\t\t\temail,\r\n\t\t\t\tmessage,\r\n\t\t\t\tterms_and_conditions: termsAndConditions,\r\n\t\t\t};\r\n\r\n\t\t\tconst messageResultNode = formNode.querySelector( '.realpress-message-result' );\r\n\t\t\tfetch( restUrl + restNamespace + '/schedule-tour', {\r\n\t\t\t\tmethod: 'POST', headers: {\r\n\t\t\t\t\t'Content-Type': 'application/json',\r\n\t\t\t\t}, body: JSON.stringify( data ),\r\n\t\t\t} )\r\n\t\t\t\t.then( ( res ) => res.json() )\r\n\t\t\t\t.then( ( res ) => {\r\n\t\t\t\t\tif ( res.status === 'error' ) {\r\n\t\t\t\t\t\tif ( res.msg ) {\r\n\t\t\t\t\t\t\tmessageResultNode.classList.remove( 'success' );\r\n\t\t\t\t\t\t\tmessageResultNode.classList.add( 'failed' );\r\n\t\t\t\t\t\t\tmessageResultNode.innerHTML = `${ res.msg }`;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if ( res.msg ) {\r\n\t\t\t\t\t\tmessageResultNode.classList.remove( 'failed' );\r\n\t\t\t\t\t\tmessageResultNode.classList.add( 'success' );\r\n\t\t\t\t\t\tmessageResultNode.innerHTML = `${ res.msg }`;\r\n\t\t\t\t\t}\r\n\t\t\t\t} ).catch( ( err ) => {\r\n\t\t\t\t\tif ( err.msg ) {\r\n\t\t\t\t\t\tmessageNode.classList.add( 'failed' );\r\n\t\t\t\t\t\tmessageNode.classList.add( 'success' );\r\n\t\t\t\t\t\tmessageNode.innerHTML = `${ err.msg }`;\r\n\t\t\t\t\t}\r\n\t\t\t\t} ).finally( () => {\r\n\t\t\t\t\tsendMessageNode.disabled = false;\r\n\t\t\t\t\tsendMessageNode.querySelector( 'i.rp-spinner' ).remove();\r\n\t\t\t\t} );\r\n\t\t} );\r\n\t}\r\n};\r\n\r\nexport default realpressScheduleTour;\r\n","// 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","// 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};","import realpressScheduleTour from './shortcode/schedule-tour/schedule-tour';\n\ndocument.addEventListener( 'DOMContentLoaded', ( event ) => {\n\trealpressScheduleTour();\n} );\n"],"names":["realpressScheduleTour","formNodes","document","querySelectorAll","i","length","formNode","sendMessageNode","querySelector","restUrl","REALPRESS_GLOBAL_OBJECT","rest_url","restNamespace","rest_namespace","addEventListener","disabled","insertAdjacentHTML","id","value","userId","emailTarget","ccAdminEmail","date","time","tourType","name","phone","email","message","termsAndConditions","termsAndConditionsNode","checked","data","email_target","cc_admin","user_id","tour_type","terms_and_conditions","messageResultNode","fetch","method","headers","body","JSON","stringify","then","res","json","status","msg","classList","remove","add","innerHTML","catch","err","messageNode","finally","event"],"sourceRoot":""}