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AAI,EAAE,IAAI;oBACV,MAAM,EAAE,MAAM;oBACd,MAAM,EAAE,MAAM;;;gBAGhB,QAAQ,CAAC,aAAa,EAAC,OAAS,GAAE,MAAM;;;;;;8BAEhC,OAAO,MAAK,wBAA0B;;;;6CACrC,yCAAS,EAAC,KAAO,IAAE,wBAA0B;;gBACtD,yCAAS,EAAC,KAAO,WAAM,QAAQ,CAAC,IAAI,CAAC,OAAO;;;;;;;;;;;AAEhD,CAAC;AAGH,EAAE,EAAE,qCAAe,EACjB,qCAAe,CAAC,OAAO,UAAE,GAAG,EAAK,CAAC;IAChC,GAAG,CAAC,gBAAgB,EAAC,KAAO,uFAAS,CAAC,EAAK,CAAC;YACrB,QAAgB,EAA7B,QAAQ;;;;oBAAK,QAAgB,GAAhB,CAAC,CAAC,MAAM,CAAC,OAAO,EAA7B,QAAQ,GAAK,QAAgB,CAA7B,QAAQ;oBAChB,CAAC,CAAC,MAAM,CACL,OAAO,EAAC,aAAe,GACvB,aAAa,EAAC,SAAW,GACzB,SAAS,CAAC,GAAG,EAAC,MAAQ;;2BACnB,yCAAY,CAAC,QAAQ;;oBAC3B,CAAC,CAAC,MAAM,CAAC,OAAO,EAAC,aAAe,GAAE,MAAM;;;;;;IAC1C,CAAC;AACH,CAAC","sources":["public/js/index.js","public/js/mapbox.js","public/js/auth.js","public/js/alerts.js","public/js/updateSettings.js","public/js/stripe.js","public/js/review.js","utils/catchAsync.js"],"sourcesContent":["import 'core-js/stable';\nimport 'regenerator-runtime/runtime';\nimport { displayMap } from './mapbox.js';\nimport { auth, logout } from './auth.js';\nimport { updateSettings } from './updateSettings.js';\nimport { bookTour } from './stripe.js';\nimport { starHandler, submitReview, deleteReview } from './review';\nimport { showAlert } from './alerts.js';\n\n// DOM ELEMENTS\nconst mapBox = document.getElementById('map');\nconst loginForm = document.querySelector('.form--login');\nconst signupForm = document.querySelector('.form--signup');\nconst logOutBtn = document.querySelector('.nav__el--logout');\nconst userDataForm = document.querySelector('.form-user-data');\nconst userPasswordForm = document.querySelector('.form-user-password');\nconst bookBtn = document.querySelector('#book-tour');\nconst reviewFormStars = document.querySelectorAll('.reviews__star--rating');\nconst reviewForm = document.querySelector('.form--review');\nconst deleteReviewBtn = document.querySelectorAll('.delete-icon');\n\n// DELEGATION\nif (mapBox) {\n const locations = JSON.parse(mapBox.dataset.locations);\n displayMap(locations);\n}\n\nif (loginForm) {\n loginForm.addEventListener('submit', (e) => {\n e.preventDefault();\n const email = document.getElementById('email').value;\n const password = document.getElementById('password').value;\n auth('login', {\n email: email,\n password: password,\n });\n });\n}\n\nif (signupForm) {\n signupForm.addEventListener('submit', (e) => {\n e.preventDefault();\n const name = document.querySelector('#name').value;\n const email = document.querySelector('#email').value;\n const password = document.querySelector('#password').value;\n const passwordConfirm = document.querySelector('#password-confirm').value;\n\n auth('signup', {\n name: name,\n email: email,\n password: password,\n passwordConfirm: passwordConfirm,\n });\n });\n}\n\nif (logOutBtn) logOutBtn.addEventListener('click', logout);\n\nif (userDataForm)\n userDataForm.addEventListener('submit', (e) => {\n e.preventDefault();\n const form = new FormData();\n form.append('name', document.getElementById('name').value);\n form.append('email', document.getElementById('email').value);\n form.append('photo', document.getElementById('photo').files[0]);\n updateSettings(form, 'data');\n });\n\nif (userPasswordForm)\n userPasswordForm.addEventListener('submit', async (e) => {\n e.preventDefault();\n document.querySelector('.btn--save-password').textContent = 'Updating...';\n\n const passwordCurrent = document.getElementById('password-current').value;\n const password = document.getElementById('password').value;\n const passwordConfirm = document.getElementById('password-confirm').value;\n await updateSettings(\n { passwordCurrent, password, passwordConfirm },\n 'password'\n );\n\n document.querySelector('.btn--save-password').textContent = 'Save password';\n document.getElementById('password-current').value = '';\n document.getElementById('password').value = '';\n document.getElementById('password-confirm').value = '';\n });\n\nif (bookBtn) {\n bookBtn.addEventListener('click', async (e) => {\n bookBtn.textContent = 'Processing...';\n const tourID = e.target.dataset.tourId;\n await bookTour(tourID);\n bookBtn.textContent = 'Book Now';\n });\n}\n\nif (reviewFormStars) {\n starHandler();\n}\n\nif (reviewForm) {\n reviewForm.addEventListener('submit', async (e) => {\n try {\n e.preventDefault();\n const { tour, user, rating } =\n document.querySelector('.review__ratings').dataset;\n const review = document.querySelector('#review-text').value;\n\n await submitReview({\n tour: tour,\n user: user,\n rating: rating,\n review: review,\n });\n\n document.querySelector('.review').remove();\n } catch (err) {\n if (err.message === 'Please provide a rating!')\n return showAlert('error', 'Please provide a rating!');\n showAlert('error', err.response.data.message);\n }\n });\n}\n\nif (deleteReviewBtn) {\n deleteReviewBtn.forEach((btn) => {\n btn.addEventListener('click', async (e) => {\n const { reviewId } = e.target.dataset;\n e.target\n .closest('.reviews-card')\n .querySelector('.deleting')\n .classList.add('active');\n await deleteReview(reviewId);\n e.target.closest('.reviews-card').remove();\n });\n });\n}\n","export const displayMap = locations => {\n mapboxgl.accessToken =\n 'pk.eyJ1Ijoiam9uYXNzY2htZWR0bWFubiIsImEiOiJjam54ZmM5N3gwNjAzM3dtZDNxYTVlMnd2In0.ytpI7V7w7cyT1Kq5rT9Z1A';\n\n var map = new mapboxgl.Map({\n container: 'map',\n style: 'mapbox://styles/jonasschmedtmann/cjvi9q8jd04mi1cpgmg7ev3dy',\n scrollZoom: false\n // center: [-118.113491, 34.111745],\n // zoom: 10,\n // interactive: false\n });\n\n const bounds = new mapboxgl.LngLatBounds();\n\n locations.forEach(loc => {\n // Create marker\n const el = document.createElement('div');\n el.className = 'marker';\n\n // Add marker\n new mapboxgl.Marker({\n element: el,\n anchor: 'bottom'\n })\n .setLngLat(loc.coordinates)\n .addTo(map);\n\n // Add popup\n new mapboxgl.Popup({\n offset: 30\n })\n .setLngLat(loc.coordinates)\n .setHTML(`<p>Day ${loc.day}: ${loc.description}</p>`)\n .addTo(map);\n\n // Extend map bounds to include current location\n bounds.extend(loc.coordinates);\n });\n\n map.fitBounds(bounds, {\n padding: {\n top: 200,\n bottom: 150,\n left: 100,\n right: 100\n }\n });\n};\n","import axios from 'axios';\nimport { showAlert } from './alerts';\n\nexport const auth = async (type, data) => {\n try {\n const res = await axios({\n method: 'POST',\n url: `/api/v1/users/${type === 'login' ? 'login' : 'signup'}`,\n data: data\n });\n\n if (res.data.status === 'success') {\n showAlert('success', 'Logged in successfully!');\n window.setTimeout(() => {\n location.assign('/');\n }, 1500);\n }\n } catch (err) {\n let msg = err.response.data.message;\n if (err.response.data.message.includes('User validation failed: passwordConfirm')) msg = 'Your passwords does not match!';\n showAlert('error', msg);\n }\n};\n\nexport const logout = async () => {\n try {\n const res = await axios({\n method: 'GET',\n url: '/api/v1/users/logout'\n });\n if ((res.data.status = 'success')) location.reload();\n } catch (err) {\n showAlert('error', 'Error logging out! Try again.');\n }\n};\n","export const hideAlert = () => {\n const el = document.querySelector('.alert');\n if (el) el.parentElement.removeChild(el);\n};\n\n// type is 'success' or 'error'\nexport const showAlert = (type, msg) => {\n hideAlert();\n const markup = `<div class=\"alert alert--${type}\">${msg}</div>`;\n document.querySelector('body').insertAdjacentHTML('afterbegin', markup);\n window.setTimeout(hideAlert, 5000);\n};\n","import axios from 'axios';\nimport { showAlert } from './alerts';\n\nexport const updateSettings = async (data, type) => {\n try {\n const url =\n type === 'password'\n ? '/api/v1/users/updateMyPassword'\n : '/api/v1/users/updateMe';\n\n const res = await axios({\n method: 'PATCH',\n url,\n data\n });\n\n if (res.data.status === 'success') {\n showAlert('success', `${type.toUpperCase()} updated successfully!`);\n }\n } catch (err) {\n showAlert('error', err.response.data.message);\n }\n};","import axios from 'axios';\nimport { showAlert } from './alerts';\n\nconst stripe = Stripe('pk_test_51Iw5YUSCycbhEIix2Dycsst4GDMcrfShWRYXhISxlt5Y4vpQdmmfGOJB7R1VxhlnIWXBHxNbchzw2M4rPp4CWg8X00ewLYIx44');\n\nexport const bookTour = async tourID => {\n try {\n // 1) Get the sesssion from the server\n const session = await axios({\n method: 'GET',\n url: `/api/v1/bookings/checkout-session/${tourID}`\n });\n\n // 2) Create checkout form + charge the credit card\n await stripe.redirectToCheckout({\n sessionId: session.data.session.id\n });\n\n } catch (err) {\n showAlert('error', 'Something went wrong');\n }\n};\n","import axios from 'axios';\nimport catchAsync from '../../utils/catchAsync';\nimport { showAlert } from './alerts';\n\nexport const starHandler = () => {\n const reviewFormStars = document.querySelectorAll('.reviews__star--rating');\n\n return reviewFormStars.forEach(reviewStar => {\n\n reviewStar.addEventListener('click', () => {\n const id = reviewStar.dataset.id;\n\n reviewFormStars.forEach(star => {\n star.classList.add('reviews__star--inactive');\n star.classList.remove('reviews__star--active');\n if (star.dataset.id <= id) {\n star.classList.remove('reviews__star--inactive');\n star.classList.add('reviews__star--active');\n }\n });\n\n document.querySelector('.review__ratings').dataset.rating = id;\n });\n });\n};\n\nexport const submitReview = async data => {\n try {\n if (data.rating <= 0) throw new Error('Please provide a rating!');\n\n const res = await axios({\n method: 'POST',\n url: '/api/v1/reviews',\n data: data\n });\n\n if (res.data.status === 'success') {\n showAlert('success', 'Review submitted successfully!');\n setTimeout(() => location.reload(), 1000);\n }\n\n } catch (err) {\n throw err;\n }\n};\n\nexport const deleteReview = async reviewID => {\n try {\n const res = await axios({\n method: 'DELETE',\n url: `/api/v1/reviews/${reviewID}`\n });\n\n if (res.data === '') showAlert('success', 'Review deleted successfully!');\n\n } catch (err) {\n showAlert('error', err.response.data.message);\n }\n};","module.exports = fn => {\n return (req, res, next) => {\n fn(req, res, next).catch(err => next(err));\n };\n};"],"names":[],"version":3,"file":"app.js.map"}