{"version":3,"sources":["app.promo.js"],"names":["define","log","msg","resp","window","console","fields","datetime","Date","toString","match","toUpperCase","_","pick","DEBUG","location","search","CSRF","YA_METRIKA","$","ajaxSetup","cache","dataType","ajaxPrefilter","options","original","type","data","extend","param","ERRORS","errors","COLORS",1,2,3,4,5,6,"HTTP_UNAUTHORIZED","LEARNED_NETWORK_DELAY","DELTA_SCROLL_LOADING","settings","stat","push","goal","this","_pushToYandex","document","readyState","args","arguments","load","apply","bind","counter","reachGoal","utils","convertErrors","error","errorData","each","value","key","debounce","fn","delay","context","timer","clearTimeout","setTimeout","inflect","i","forms","index","dec","parseInt","hun","Math","floor","kilofication","num","nl2br","str","escape","replace","padNumber","User","Backbone","Model","ROLE_LOOKER","ROLE_MEMBER","url","urlRegister","urlUpdate","urlLogin","urlForgot","validation","email","required","pattern","EMAIL","password","changeMail","set","isValid","post","done","user","trigger","fail","xhr","responseJSON","forgot","preValidate","resetPassword","login","reg","parse","status","prototype","Validation","mixin","FormView","Marionette","ItemView","ui","form","inputs","events","click .js-close","submit @ui.form","initialize","bindUIElements","$el","on","removeState","close","force","hasState","closeForce","keyupCheck","off","validate","toggle","open","reset","val","UserLoginFormView","el","listenTo","model","errback","reload","showErrors","soft","self","$this","name","toggleState","filter","first","focus","submit","Syphon","serialize","UserForgotFormView","message","UserResetFormView","attr","LookerButtonView","click","urlLooker","request","iPhoneButtonView","IPhoneButtonView","AppPromo","Application","loginForm","forgotForm","resetForm","app","vent","container","regions","Notification","defaults","repeat","closeButton","count","NotificationView","ErrorNotificationView","template","tagName","className","click .js-notif-link","$template","queryInflect","split","sentInflect","onBeforeRender","queryForm","sentForm","tryRepeat","get","call","remove","NotificationLayout","LayoutView","add","view","append","render","addInitializer","errorNotif","layout","require","start","doYouSpeekEnglish"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,AANAA,OAAA,cAAA,WACA,YAcA,SAAAC,GAAAC,EAAAC,GACA,GAAAC,OAAAC,SAAAA,QAAAJ,IAAA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IAAA,SAAAC,GAGA,MAFApK,MAAAwF,IAAA6E,OAAAD,EAAAE,SAAA/D,IACA6D,EAAAjE,OACAnG,OAGA,OAAAiK,KAEA/M,OAAA,2CACA,YACA,WACA,mCACA,wCACA,qCACA,SAAAqL,EAAA3I,EAAA+I,EAAAM,EAAAgB,GACA,YACA1B,GAAAgC,eAAA,WACA,GAAAC,GAAAC,EAAA,GAAAR,EACA1B,GAAAC,KAAA/C,GAAA,cAAA,SAAA5G,GACA2L,YAAAvB,IACAuB,EAAAR,QAEA,IAAAvD,GAAA,GAAAkC,GAAA9J,EACA2L,GAAA,GAAAvB,IAAAxC,MAAAA,IACAgE,EAAAN,IAAAK,SAIAE,SACA,YACA,2CACA,SAAAnC,GACA,YACAA,GAAAoC,OAAAC,kBAAA,iBACAtN,OAAAiL,IAAAA,IAEArL,OAAA,cACA,YACA,2CACA","file":"app.promo.min.js","sourcesContent":["/**\n * Rememba web-application\n * @copyright Anton Lovchikov, http://antiflash.ru, 2013-2017\n * @author Alexander Burtsev, http://burtsev.me, 2013-2017\n * All rights reserved\n */\ndefine('settings', [], function () {\n 'use strict';\n var DEBUG = location.search && location.search.match(/debug/i) || false, CSRF = window.CSRF || null, YA_METRIKA = window.YA_METRIKA || null;\n window.DEBUG = DEBUG;\n $.ajaxSetup({\n cache: false,\n dataType: 'json'\n });\n $.ajaxPrefilter(function (options, original) {\n if (options.type !== 'GET') {\n var data = original.data || {};\n $.extend(data, CSRF);\n options.data = $.param(data);\n }\n });\n function log(msg, resp) {\n if (!window.console || !console.log) {\n return;\n }\n var fields = [\n 'nearest_time',\n 'nearest_cards_count',\n 'next_cards_count',\n 'feeder_speed_cards_count'\n ], datetime = new Date().toString().match(/\\d+\\:\\d+\\:\\d+/)[0];\n console.log('[' + datetime + ']: ' + msg.toUpperCase(), resp ? _.pick(resp, fields) : '');\n }\n return {\n CSRF: CSRF,\n ERRORS: window.errors || {},\n YA_METRIKA: YA_METRIKA,\n COLORS: {\n 1: 'yellow',\n 2: 'red',\n 3: 'blue',\n 4: 'green',\n 5: 'violet',\n 6: 'white'\n },\n HTTP_UNAUTHORIZED: 401,\n LEARNED_NETWORK_DELAY: 5 * 1000,\n DELTA_SCROLL_LOADING: 10,\n DEBUG: DEBUG,\n log: log\n };\n});\ndefine('stat', ['settings'], function (settings) {\n 'use strict';\n var stat = {\n push: function (goal) {\n this._pushToYandex(goal);\n settings.log('Goal: ' + goal);\n },\n _pushToYandex: function (goal) {\n if (!settings.YA_METRIKA) {\n return;\n }\n if (document.readyState !== 'complete') {\n var args = arguments;\n return $(window).load(function () {\n this._pushToYandex.apply(this, args);\n }.bind(this));\n }\n var counter = window[settings.YA_METRIKA];\n if (goal && counter && counter.reachGoal) {\n counter.reachGoal(goal);\n }\n }\n };\n return stat;\n});\ndefine('utils', ['settings'], function (settings) {\n 'use strict';\n var utils = {\n convertErrors: function (resp) {\n var error = resp.error || {}, errorData = error.data || {}, errors = {};\n _.each(errorData, function (value, key) {\n if (settings.ERRORS[key] && settings.ERRORS[key][value]) {\n errors[key] = settings.ERRORS[key][value];\n } else {\n errors[key] = value;\n }\n });\n return errors;\n },\n debounce: function (fn, delay, context) {\n var timer = null;\n context = context || this;\n delay = delay || 100;\n return function () {\n var args = arguments;\n clearTimeout(timer);\n timer = setTimeout(function () {\n fn.apply(context, args);\n }, delay);\n };\n },\n inflect: function (i, forms) {\n var index, dec = (i = parseInt(i, 10)) % 10, hun = i % 100;\n if (dec === 1 && hun !== 11) {\n index = 0;\n } else if (dec >= 2 && dec <= 4 && Math.floor(hun / 10) !== 1) {\n index = 1;\n } else {\n index = 2;\n }\n return forms[index];\n },\n kilofication: function (num) {\n if (!num) {\n return num;\n }\n return num >= 1000 ? Math.floor(num / 1000) + 'K' : num;\n },\n nl2br: function (str) {\n str = _.escape(str);\n return str.replace(/\\n/g, '
');\n },\n padNumber: function (num) {\n return num < 10 ? '0' + num : num;\n }\n };\n return utils;\n});\ndefine('user/user.model', [\n 'settings',\n 'utils'\n], function (settings, utils) {\n 'use strict';\n var User = Backbone.Model.extend({\n ROLE_LOOKER: 'looker',\n ROLE_MEMBER: 'member',\n url: '/api/user',\n urlRegister: '/api/user/register',\n urlUpdate: '/api/user/edit',\n urlLogin: '/api/user/login',\n urlForgot: '/api/user/forgot',\n validation: {\n email: [\n {\n required: true,\n msg: 'empty'\n },\n {\n pattern: 'email',\n msg: settings.ERRORS.email.EMAIL\n }\n ],\n password: {\n required: true,\n msg: 'empty'\n }\n },\n changeMail: function (data) {\n this.set(data);\n if (this.isValid(true)) {\n $.post(this.urlUpdate, data).done(function (resp) {\n this.set(resp.user);\n this.trigger('changemail:success');\n }.bind(this)).fail(function (xhr) {\n var errors = utils.convertErrors(xhr.responseJSON);\n this.trigger('changemail:fail', this, errors);\n }.bind(this));\n }\n },\n forgot: function (data) {\n var errors = this.preValidate(data);\n if (errors) {\n this.trigger('validated:invalid', this, errors);\n } else {\n this.trigger('validated:valid', this);\n $.post(this.urlForgot, data).done(function () {\n this.trigger('forgot:success', this);\n }.bind(this)).fail(function (xhr) {\n var errors = utils.convertErrors(xhr.responseJSON);\n this.trigger('forgot:fail', this, errors);\n }.bind(this));\n }\n },\n resetPassword: function (data, url) {\n $.post(url, data).done(function () {\n this.trigger('resetpassword:success', this);\n }.bind(this)).fail(function (xhr) {\n var errors = utils.convertErrors(xhr.responseJSON);\n this.trigger('resetpassword:fail', this, errors);\n }.bind(this));\n },\n login: function (data) {\n this.set(data);\n if (this.isValid(true)) {\n $.post(this.urlLogin, data).done(function () {\n this.trigger('login:success', this);\n }.bind(this)).fail(function (xhr) {\n var errors = utils.convertErrors(xhr.responseJSON);\n this.trigger('login:fail', this, errors);\n }.bind(this));\n }\n },\n reg: function (data) {\n this.set(data);\n if (this.isValid(true)) {\n $.post(this.urlRegister, data).done(function (resp) {\n this.set(resp.user);\n this.set({ password: data.password });\n this.trigger('reg:success', this);\n }.bind(this)).fail(function (xhr) {\n var errors = utils.convertErrors(xhr.responseJSON);\n this.trigger('reg:fail', this, errors);\n }.bind(this));\n }\n },\n parse: function (resp) {\n resp = resp || {};\n resp.user = resp.user || {};\n if (resp.status) {\n return resp.user;\n }\n }\n });\n _.extend(User.prototype, Backbone.Validation.mixin);\n return User;\n});\ndefine('layouts/form.view', [], function () {\n 'use strict';\n var FormView = Marionette.ItemView.extend({\n ui: {\n form: 'form',\n inputs: 'form :input'\n },\n events: {\n 'click .js-close': 'close',\n 'submit @ui.form': 'submit'\n },\n initialize: function () {\n this.bindUIElements();\n this.$el.on('disappear.tamia dismiss.modal.tamia', function () {\n if (this.ui.inputs) {\n this.ui.inputs.removeState('invalid');\n }\n }.bind(this));\n },\n close: function (force) {\n if (this.ui.form) {\n if (!force && this.ui.form.hasState('loading')) {\n return;\n }\n this.ui.form.trigger('loading-stop.tamia');\n }\n this.$el.trigger('disappear.tamia');\n },\n closeForce: function () {\n this.close(true);\n },\n keyupCheck: function () {\n if (this.ui.inputs) {\n this.ui.inputs.off('.keycheck').on('keyup.keycheck', function () {\n this.validate();\n }.bind(this));\n }\n },\n toggle: function () {\n if (this.$el.hasState('hidden')) {\n this.open();\n } else {\n this.close();\n }\n },\n reset: function () {\n this.form.reset();\n $('input[type=\"hidden\"]', this.form).val('');\n },\n validate: function () {\n }\n });\n return FormView;\n});\ndefine('user/user.login.form.view', ['layouts/form.view'], function (FormView) {\n 'use strict';\n var UserLoginFormView = FormView.extend({\n el: $('.js-login-form'),\n initialize: function () {\n FormView.prototype.initialize.apply(this, arguments);\n this.listenTo(this.model, 'validated:valid', function () {\n if (this.$el.hasState('hidden')) {\n return;\n }\n this.ui.form.trigger('loading-start.tamia');\n this.ui.inputs.removeState('invalid');\n }).listenTo(this.model, 'validated:invalid', this.errback).listenTo(this.model, 'login:fail', this.errback).listenTo(this.model, 'login:success', function () {\n location.reload();\n });\n },\n errback: function (model, errors) {\n if (this.$el.hasState('hidden')) {\n return;\n }\n this.ui.form.trigger('loading-stop.tamia');\n this.showErrors(errors, false);\n this.keyupCheck();\n },\n showErrors: function (errors, soft) {\n var self = this;\n this.ui.inputs.each(function () {\n var $this = $(this), error = errors[this.name];\n if (error && error !== 'empty' && !soft) {\n self.trigger('error:promo', error);\n }\n $this.toggleState('invalid', !!error);\n });\n if (!soft) {\n this.ui.inputs.filter('.is-invalid').first().focus();\n }\n },\n submit: function () {\n var data = Backbone.Syphon.serialize(this);\n this.model.login(data);\n return false;\n },\n validate: function () {\n var data = Backbone.Syphon.serialize(this), errors = this.model.preValidate(data) || {};\n this.showErrors(errors, true);\n }\n });\n return UserLoginFormView;\n});\ndefine('user/user.forgot.form.view', [\n 'layouts/form.view',\n 'user/user.login.form.view'\n], function (FormView, UserLoginFormView) {\n 'use strict';\n var UserForgotFormView = UserLoginFormView.extend({\n el: $('.js-forgot-form'),\n initialize: function () {\n FormView.prototype.initialize.apply(this, arguments);\n this.message = this.$el.data('message');\n this.listenTo(this.model, 'validated:valid', function () {\n this.ui.form.trigger('loading-start.tamia');\n this.ui.inputs.removeState('invalid');\n }).listenTo(this.model, 'validated:invalid', this.errback).listenTo(this.model, 'forgot:fail', this.errback).listenTo(this.model, 'forgot:success', function () {\n this.$el.trigger('close.modal.tamia');\n this.ui.form.trigger('loading-stop.tamia');\n this.trigger('error:promo', this.message);\n });\n },\n submit: function () {\n var data = Backbone.Syphon.serialize(this);\n this.model.forgot(data);\n return false;\n }\n });\n return UserForgotFormView;\n});\ndefine('user/user.reset.form.view', [\n 'layouts/form.view',\n 'user/user.login.form.view'\n], function (FormView, UserLoginFormView) {\n 'use strict';\n var UserResetFormView = UserLoginFormView.extend({\n el: $('.js-reset-form'),\n initialize: function () {\n FormView.prototype.initialize.apply(this, arguments);\n this.message = this.$el.data('message');\n this.listenTo(this.model, 'validated:valid', function () {\n this.ui.form.trigger('loading-start.tamia');\n this.ui.inputs.removeState('invalid');\n }).listenTo(this.model, 'validated:invalid', this.errback).listenTo(this.model, 'resetpassword:fail', this.errback).listenTo(this.model, 'resetpassword:success', function () {\n this.$el.trigger('close.modal.tamia');\n this.ui.form.trigger('loading-stop.tamia');\n this.trigger('error:promo', this.message);\n }.bind(this));\n },\n submit: function () {\n var data = Backbone.Syphon.serialize(this);\n this.model.resetPassword(data, this.ui.form.attr('action'));\n return false;\n }\n });\n return UserResetFormView;\n});\ndefine('looker/button.view', ['stat'], function (stat) {\n 'use strict';\n var LookerButtonView = Marionette.ItemView.extend({\n el: $('.js-looker-button'),\n events: { click: 'request' },\n urlLooker: '/api/user/start',\n initialize: function () {\n this.bindUIElements();\n },\n request: function () {\n this.$el.trigger('loading-start.tamia');\n $.post(this.urlLooker, {}).fail(function () {\n this.$el.trigger('loading-stop.tamia');\n throw 'Can\\'t create looker';\n }.bind(this)).done(function () {\n stat.push('create_looker');\n location.reload();\n });\n return false;\n }\n });\n return LookerButtonView;\n});\ndefine('iphone/button.view', ['stat'], function (stat) {\n 'use strict';\n var iPhoneButtonView = Marionette.ItemView.extend({\n el: $('.js-iphone-button'),\n events: { click: 'request' },\n initialize: function () {\n this.bindUIElements();\n },\n request: function () {\n stat.push('iphone_version_button');\n }\n });\n return iPhoneButtonView;\n});\ndefine('app.promo', [\n 'stat',\n 'settings',\n 'user/user.model',\n 'user/user.login.form.view',\n 'user/user.forgot.form.view',\n 'user/user.reset.form.view',\n 'looker/button.view',\n 'iphone/button.view'\n], function (stat, settings, User, UserLoginFormView, UserForgotFormView, UserResetFormView, LookerButtonView, IPhoneButtonView) {\n 'use strict';\n var AppPromo = Marionette.Application.extend({\n initialize: function () {\n if (!settings.CSRF) {\n return;\n }\n var loginForm = new UserLoginFormView({ model: new User() }), forgotForm = new UserForgotFormView({ model: new User() }), resetForm = new UserResetFormView({ model: new User() });\n new IPhoneButtonView();\n new LookerButtonView();\n stat.push('appinit_landing');\n loginForm.on('error:promo', function (message) {\n app.vent.trigger('error:promo', { message: message });\n });\n forgotForm.on('error:promo', function (message) {\n app.vent.trigger('error:promo', { message: message });\n });\n resetForm.on('error:promo', function (message) {\n app.vent.trigger('error:promo', { message: message });\n });\n }\n });\n var app = new AppPromo({\n container: 'body',\n regions: {}\n });\n return app;\n});\ndefine('notifications/notification.model', [], function () {\n 'use strict';\n var Notification = Backbone.Model.extend({\n defaults: {\n type: 'blocking',\n repeat: null,\n context: null,\n closeButton: true,\n message: '',\n count: 0\n }\n });\n return Notification;\n});\ndefine('notifications/notification.view', [], function () {\n 'use strict';\n var NotificationView = Marionette.ItemView.extend({\n close: function () {\n this.$el.trigger('disappear.tamia');\n },\n open: function () {\n this.$el.trigger('appear.tamia');\n }\n });\n return NotificationView;\n});\ndefine('notifications/error.notification.view', [\n 'utils',\n 'notifications/notification.view'\n], function (utils, NotificationView) {\n 'use strict';\n var ErrorNotificationView = NotificationView.extend({\n template: '#tpl-notif-error',\n tagName: 'div',\n className: 'notification-bar notification-bar_warning is-hidden',\n events: { 'click .js-notif-link': 'tryRepeat' },\n initialize: function () {\n var $template = $(this.template);\n this.queryInflect = $template.data('queryInflect').split(',');\n this.sentInflect = $template.data('sentInflect').split(',');\n },\n onBeforeRender: function () {\n this.model.set({\n queryForm: utils.inflect(this.count, this.queryInflect),\n sentForm: utils.inflect(this.count, this.sentInflect)\n });\n },\n tryRepeat: function () {\n var model = this.model, repeat = model.get('repeat'), context = model.get('context');\n if (repeat && context) {\n repeat.call(context);\n this.remove();\n }\n return false;\n }\n });\n return ErrorNotificationView;\n});\ndefine('notifications/notification.layout', [], function () {\n 'use strict';\n var NotificationLayout = Marionette.LayoutView.extend({\n template: false,\n el: '.js-notifications',\n add: function (view) {\n this.$el.append(view.render().el);\n view.open();\n return this;\n }\n });\n return NotificationLayout;\n});\ndefine('notifications/notification.promo.module', [\n 'app.promo',\n 'settings',\n 'notifications/notification.model',\n 'notifications/error.notification.view',\n 'notifications/notification.layout'\n], function (app, settings, Notification, ErrorNotificationView, NotificationLayout) {\n 'use strict';\n app.addInitializer(function () {\n var layout = new NotificationLayout(), errorNotif;\n app.vent.on('error:promo', function (data) {\n if (errorNotif instanceof ErrorNotificationView) {\n errorNotif.remove();\n }\n var model = new Notification(data);\n errorNotif = new ErrorNotificationView({ model: model });\n layout.add(errorNotif);\n });\n });\n});\nrequire([\n 'app.promo',\n 'notifications/notification.promo.module'\n], function (app) {\n 'use strict';\n app.start({ doYouSpeekEnglish: 'No, I don\\'t!' });\n window.app = app;\n});\ndefine('init.promo', [\n 'app.promo',\n 'notifications/notification.promo.module'\n], function () {\n return;\n});"],"sourceRoot":"/source/"}