-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
2 lines (2 loc) · 18.1 KB
/
server.js
1
2
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=15)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("react-localize-redux")},function(e,t){e.exports=require("react-redux")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("react-router")},function(e,t){e.exports=require("redux")},function(e,t){e.exports=require("react-router-dom")},function(e,t){e.exports=require("express")},function(e,t){e.exports=require("react-leaflet-universal")},function(e,t){e.exports=require("react-dom/server")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("cookie-parser")},function(e,t){e.exports=require("compression")},function(e,t){e.exports=require("helmet")},function(e,t){e.exports=require("redux-thunk")},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(t);var o=r(10),i=r.n(o),a=r(7),s=r.n(a),l=r(11),u=r.n(l),c=r(12),m=r.n(c),d=r(13),f=r.n(d),_=r(0),p=r.n(_),b=r(9),h=r.n(b),g=r(5),y=r(2),N=r(1),O=r(6),v=r(4);function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var j=r(3),w=r.n(j),P=r(8),S="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\components\\maps\\BackgroundMap.js",k=function(e){var t=e.position,r=e.currentPosition,n=e.zoom,o=e.viewportChanged,i=e.history,a=t.latitude,s=t.longitude,l=r.latitude,u=r.longitude;return p.a.createElement("div",{id:"maps",__source:{fileName:S,lineNumber:28},__self:this},p.a.createElement(P.Map,{center:[a,s],zoom:n,maxZoom:10,attributionControl:!0,doubleClickZoom:!0,scrollWheelZoom:!0,zoomControl:!1,dragging:!0,animate:!0,easeLinearity:.35,style:{width:"100%",height:"100%"},onViewportChanged:function(e){var t=E(e.center,2),n=t[0],a=t[1];(r.latitude&&r.latitude!==n||r.longitude&&r.longitude!==a)&&i.push("/".concat(n,"/").concat(a)),o(e)},__source:{fileName:S,lineNumber:29},__self:this},p.a.createElement(P.TileLayer,{url:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',__source:{fileName:S,lineNumber:43},__self:this}),null!==l&&null!==u&&p.a.createElement(P.Marker,{position:[l,u],__source:{fileName:S,lineNumber:48},__self:this},p.a.createElement(P.Popup,{__source:{fileName:S,lineNumber:49},__self:this},p.a.createElement(N.Translate,{id:"maps.markerPosition",__source:{fileName:S,lineNumber:49},__self:this})))))};k.propTypes={position:w.a.objectOf.isRequired,currentPosition:w.a.objectOf.isRequired,zoom:w.a.objectOf.isRequired,viewportChanged:w.a.func.isRequired,history:w.a.objectOf.isRequired};var R=Object(N.withLocalize)(Object(v.withRouter)(k)),D="HOME_USERNAME_CHANGED",M="HOME_PASSWORD_CHANGED",x="HOME_SIGN_IN",C="HOME_SIGN_OUT",T="HOME_REMEMBER_ME_CHANGED",A="HOME_PASSWORD_RECOVERY_NEEDED",q="HOME_PASSWORD_RECOVERY_SENT",I="MAP_USER_POSITION_CHANGE_STARTED",z="MAP_USER_POSITION_CHANGE_FINISHED",H="MAP_USER_POSITION_CHANGE_ERROR",L="MAP_VIEWPORT_CHANGED";function G(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e&&t?7:-1,n=new Date;n.setDate(n.getDate()+r),document.cookie="username=".concat(e,"; expires=").concat(n.toUTCString())}function W(){return{en:{latitude:40.73061,longitude:-73.935242},de:{latitude:52.520008,longitude:13.404954},ru:{latitude:55.751244,longitude:37.618423}}[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"en"]}var B=Object(v.withRouter)((function(){var e=Object(_.useRef)(),t=Object(y.useSelector)((function(e){return e.maps}),y.shallowEqual),r=Object(y.useDispatch)(),n=Object(_.useCallback)((function(e){var t=E(e.center,2),n=t[0],o=t[1],i=e.zoom;r({type:L,payload:{position:{latitude:n,longitude:o},zoom:i}})}),[r]),o=t.position,i=t.currentPosition,a=t.zoom;return Object(_.useEffect)((function(){process.env.BROWSER&&(r({type:I,payload:!0}),setTimeout((function(){var e;(e={enableHighAccuracy:!1,timeout:5e3,maximumAge:0},process.env.BROWSER?new Promise((function(t,r){return window.navigator.geolocation.getCurrentPosition(t,r,e)})):{coords:{latitude:null,longitude:null}}).then((function(e){var t=e.coords,n=t.latitude,o=t.longitude;r({type:z,payload:{isSet:!0,latitude:n,longitude:o}})})).catch((function(e){r({type:H,payload:e})}))}),1500))}),[e,r]),p.a.createElement(R,{position:o,currentPosition:i,zoom:a,viewportChanged:n,__source:{fileName:"D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\containers\\maps\\MapContainer.js",lineNumber:64},__self:this})})),U="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\components\\home\\LabeledInput.js";function F(e){var t=e.id,r=e.value,n=e.handler,o=e.pass,i=void 0!==o&&o?"password":"text";return p.a.createElement("div",{className:"labeled-input",__source:{fileName:U,lineNumber:10},__self:this},"password"===i?p.a.createElement(N.Translate,{id:"login.password",__source:{fileName:U,lineNumber:11},__self:this}):p.a.createElement(N.Translate,{id:"login.email",__source:{fileName:U,lineNumber:11},__self:this}),p.a.createElement("input",{id:t,type:i,value:r,onChange:n,__source:{fileName:U,lineNumber:12},__self:this}))}F.propTypes={id:w.a.string.isRequired,value:w.a.string.isRequired,handler:w.a.func.isRequired,pass:w.a.bool},F.defaultProps={pass:!1};var V=Object(N.withLocalize)(F),Y="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\components\\home\\HomeRecovery.js",Z=Object(N.withLocalize)((function(){var e=Object(y.useSelector)((function(e){return e.home.username})),t=Object(y.useDispatch)(),r=Object(_.useCallback)((function(e){var r=e.target.value;t({type:D,payload:r})}),[t]),n=Object(_.useCallback)((function(){t({type:q,payload:!1})}),[t]);return p.a.createElement("div",{id:"home-component-recovery",__source:{fileName:Y,lineNumber:21},__self:this},p.a.createElement("h1",{__source:{fileName:Y,lineNumber:22},__self:this},p.a.createElement(N.Translate,{id:"recovery.header",__source:{fileName:Y,lineNumber:22},__self:this})),p.a.createElement(V,{handler:r,id:"username",value:e,__source:{fileName:Y,lineNumber:23},__self:this}),p.a.createElement("p",{__source:{fileName:Y,lineNumber:24},__self:this},p.a.createElement(N.Translate,{id:"recovery.help",__source:{fileName:Y,lineNumber:24},__self:this})),p.a.createElement("div",{className:"login-buttons",__source:{fileName:Y,lineNumber:25},__self:this},p.a.createElement("button",{id:"send-request",className:"sign-in-button",type:"button",onClick:n,__source:{fileName:Y,lineNumber:26},__self:this},p.a.createElement(N.Translate,{id:"recovery.sendRequest",__source:{fileName:Y,lineNumber:32},__self:this}))))})),J="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\components\\home\\HomeLoginRememberControl.js",K=Object(N.withLocalize)((function(){var e=Object(y.useSelector)((function(e){return e.home.rememberMe})),t=Object(y.useDispatch)();return p.a.createElement("div",{__source:{fileName:J,lineNumber:15},__self:this},p.a.createElement("label",{id:"remember-me-label",htmlFor:"remember-me",__source:{fileName:J,lineNumber:16},__self:this},p.a.createElement("input",{id:"remember-me",type:"checkbox",checked:e,onClick:function(e){t({type:T,payload:e.target.checked})},__source:{fileName:J,lineNumber:17},__self:this}),p.a.createElement(N.Translate,{id:"login.rememberMe",__source:{fileName:J,lineNumber:18},__self:this})))})),Q="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\components\\home\\HomeLoginButtons.js",X=Object(N.withLocalize)((function(){var e=Object(y.useSelector)((function(e){return e.home.loggedIn})),t=Object(y.useDispatch)(),r=Object(_.useCallback)((function(){t({type:A,payload:!0})}),[t]);return p.a.createElement("div",{className:"login-buttons",__source:{fileName:Q,lineNumber:23},__self:this},p.a.createElement("button",{id:"sign-in",className:"sign-in-button",type:"button",onClick:e?function(){t({type:C,payload:!1})}:function(){t({type:x,payload:!0})},__source:{fileName:Q,lineNumber:24},__self:this},e?p.a.createElement(N.Translate,{id:"login.signOut",__source:{fileName:Q,lineNumber:30},__self:this}):p.a.createElement(N.Translate,{id:"login.signIn",__source:{fileName:Q,lineNumber:30},__self:this})),p.a.createElement("button",{id:"recovery",className:"link-button",type:"button",onClick:r,__source:{fileName:Q,lineNumber:32},__self:this},p.a.createElement(N.Translate,{id:"login.forgotPass",__source:{fileName:Q,lineNumber:38},__self:this})))})),$="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\components\\home\\HomeLogin.js",ee=Object(N.withLocalize)((function(){var e=Object(y.useSelector)((function(e){return e.home.username})),t=Object(y.useSelector)((function(e){return e.home.password})),r=Object(y.useDispatch)(),n=Object(_.useCallback)((function(e){var t=e.target.value;r({type:D,payload:t})}),[r]),o=Object(_.useCallback)((function(e){var t=e.target.value;r({type:M,payload:t})}),[r]);return p.a.createElement("div",{id:"home-component-login",__source:{fileName:$,lineNumber:26},__self:this},p.a.createElement("h1",{__source:{fileName:$,lineNumber:27},__self:this},p.a.createElement(N.Translate,{id:"login.header",__source:{fileName:$,lineNumber:27},__self:this})),p.a.createElement(V,{handler:n,id:"username",value:e,__source:{fileName:$,lineNumber:28},__self:this}),p.a.createElement(V,{handler:o,id:"password",value:t,pass:!0,__source:{fileName:$,lineNumber:29},__self:this}),p.a.createElement(K,{__source:{fileName:$,lineNumber:30},__self:this}),p.a.createElement(X,{__source:{fileName:$,lineNumber:31},__self:this}))})),te="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\containers\\home\\HomeContainer.js",re=Object(v.withRouter)((function(){var e=Object(y.useSelector)((function(e){return e.home.recovery}));return p.a.createElement("div",{id:"home-container",__source:{fileName:te,lineNumber:17},__self:this},p.a.createElement(B,{__source:{fileName:te,lineNumber:18},__self:this}),p.a.createElement("section",{id:"home-component",__source:{fileName:te,lineNumber:19},__self:this},function(){return e?p.a.createElement(Z,{__source:{fileName:te,lineNumber:12},__self:this}):p.a.createElement(ee,{__source:{fileName:te,lineNumber:13},__self:this})}()))})),ne="D:\\frontend-tasks\\fd-test-job-hooks\\src\\shared\\Application.js";function oe(){return p.a.createElement("article",{id:"main",__source:{fileName:ne,lineNumber:7},__self:this},p.a.createElement(O.Switch,{__source:{fileName:ne,lineNumber:8},__self:this},p.a.createElement(O.Route,{path:"/",component:re,__source:{fileName:ne,lineNumber:9},__self:this}),p.a.createElement(O.Route,{path:"/:latitude/:longitude",component:re,__source:{fileName:ne,lineNumber:10},__self:this})))}var ie=r(14),ae=r.n(ie);function se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?se(r,!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):se(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ue={username:"",password:"",rememberMe:!1,recovery:!1,locale:"en",loggedIn:!1};function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ce(r,!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var de={position:W("en"),currentPosition:{isSet:!1,latitude:null,longitude:null},storedPosition:{stored:!1,latitude:null,longitude:null},zoom:9};Object(g.applyMiddleware)(ae.a)(g.createStore);var fe=Object(g.combineReducers)({home:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ue,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case D:return le({},e,{username:t.payload});case M:return le({},e,{password:t.payload});case x:return G(e.username,e.rememberMe),le({},e,{loggedIn:t.payload});case C:return G(e.username,!1),le({},e,{loggedIn:t.payload});case T:return le({},e,{rememberMe:t.payload});case A:case q:return le({},e,{recovery:t.payload});default:return e}},maps:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:de,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case I:return e;case z:var r=e.storedPosition;return me({},e,{position:r.stored?{latitude:r.latitude,longitude:r.longitude}:t.payload,currentPosition:me({},t.payload),zoom:10});case H:var n=e.storedPosition,o=W(e.locale);return me({},e,{position:n.stored?{latitude:n.latitude,longitude:n.longitude}:o,currentPosition:me({},o,{isSet:!0}),zoom:10});case L:return me({},e,{},t.payload);default:return e}}}),_e={languages:[{name:"English",code:"en"},{name:"German",code:"de"},{name:"Russian",code:"ru"}],translation:{maps:{markerPosition:["You are here.","Du bist hier.","Вы здесь."],markerNearPosition:["You are here... Maybe...","Du bist hier... Vielleicht...","Вы здесь... Возможно..."]},login:{header:["Please, log in","Anmeldung","Авторизация"],email:["E-mail","E-mail","E-mail"],password:["Password","Passwort","Пароль"],rememberMe:["Remember Me","Erinnere dich an mich","Запомнить меня"],signIn:["Sign In","Einloggen","Вход"],signOut:["Sign Out","Ausloggen","Выйти"],forgotPass:["Forgot Password?","Passwort vergessen?","Забыли пароль?"]},recovery:{header:["Password Recovery","Passwort-Wiederherstellung","Восстановление пароля"],sendRequest:["Send Request","Anfrage senden","Отправить запрос"],help:['Enter your email and click "Send Request" button. You will be sent a letter with detailed instructions.','Geben Sie Ihre E-Mail-Adresse ein und klicken Sie auf "Anfrage senden". Sie erhalten einen Brief mit detaillierten Anweisungen.',"Введите адрес электронной почты и нажмите кнопку «Отправить запрос». Вам будет отправлено письмо с подробными инструкциями."]}},options:{}},pe="D:\\frontend-tasks\\fd-test-job-hooks\\src\\server\\server.js";function be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(r,!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ge=s()();ge.use(f()());function ye(e,t){var r=e.get("Accept-Language"),n=r?function(e){if(e){var t=e.split(",")[0];if(/^(ru|en|de)/gi.test(t))return t.split("-")[0].toLowerCase()}else if(window)return/^(ru|de|en)/gi.test(window.navigator.language)?window.navigator.language.split("-")[0].toLowerCase():"en";return"en"}(r.split(",")[0]):"en",o=W(n),i=e.params,a=i.latitude,s=i.longitude,l={latitude:parseFloat(a),longitude:parseFloat(s),stored:!!a&&!!s},u=e.cookies.username,c=void 0===u?"":u,m=!!c,d=he({},_e,{options:{defaultLanguage:n,renderToStaticMarkup:h.a.renderToStaticMarkup}}),f=Object(g.createStore)(fe),_=h.a.renderToString(p.a.createElement(y.Provider,{store:f,__source:{fileName:pe,lineNumber:90},__self:this},p.a.createElement(N.LocalizeProvider,{initialize:d,store:f,__source:{fileName:pe,lineNumber:91},__self:this},p.a.createElement(O.StaticRouter,{location:e.url,context:{},__source:{fileName:pe,lineNumber:92},__self:this},p.a.createElement(oe,{__source:{fileName:pe,lineNumber:93},__self:this}))))),b=f.getState(),v=b.home,E=b.maps,j=he({},b,{home:he({},v,{locale:n,username:c,rememberMe:m}),maps:he({},E,{position:o,storedPosition:l})});t.send(function(e,t){var r=t.home.locale;return'\n <!doctype html>\n <html lang="'.concat(r,'">\n <head>\n <title>TheBoats.com test job</title>\n <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i&subset=cyrillic" rel="stylesheet">\n <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.css">\n <link href="/css/style.css" rel="stylesheet">\n </head>\n <body>\n <div id="app">').concat(e,"</div>\n <script>\n window.__PRELOADED_STATE__ = ").concat(JSON.stringify(t).replace(/</g,"\\u003c"),'\n <\/script>\n <script src="/js/bundle.js"><\/script>\n </body>\n </html>\n ')}(_,j))}ge.use(s.a.json()),ge.use(s.a.urlencoded({extended:!1})),ge.use(u()()),ge.use(m()()),ge.use(s.a.static(i.a.join("./","public"))),process.env.BROWSER=!1,ge.use("/:latitude/:longitude",ye),ge.use("/",ye),ge.listen(3e3)}]);
//# sourceMappingURL=server.js.map