Now showing SubscribeModal before AuthModal for players who need to sign up before subscribing.
This commit is contained in:
parent
e9ab0c1f4d
commit
175cdb5151
4 changed files with 11 additions and 14 deletions
app
models
views/play
|
@ -45,7 +45,7 @@ class CocoModel extends Backbone.Model
|
||||||
@loading = false
|
@loading = false
|
||||||
@jqxhr = null
|
@jqxhr = null
|
||||||
if jqxhr.status is 402
|
if jqxhr.status is 402
|
||||||
Backbone.Mediator.publish 'level:subscription-required'
|
Backbone.Mediator.publish 'level:subscription-required', {}
|
||||||
|
|
||||||
onLoaded: ->
|
onLoaded: ->
|
||||||
@loaded = true
|
@loaded = true
|
||||||
|
|
|
@ -208,11 +208,9 @@ module.exports = class WorldMapView extends RootView
|
||||||
@endHighlight()
|
@endHighlight()
|
||||||
else
|
else
|
||||||
if level.requiresSubscription and @requiresSubscription and not @levelStatusMap[level.id] and not level.adventurer
|
if level.requiresSubscription and @requiresSubscription and not @levelStatusMap[level.id] and not level.adventurer
|
||||||
modal = if me.get('anonymous') then AuthModal else SubscribeModal
|
@openModalView new SubscribeModal()
|
||||||
@openModalView new modal()
|
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'map level clicked'
|
||||||
if modal is SubscribeModal
|
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'map level clicked'
|
|
||||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
|
||||||
else if $(e.target).attr('disabled')
|
else if $(e.target).attr('disabled')
|
||||||
Backbone.Mediator.publish 'router:navigate', route: '/contribute/adventurer'
|
Backbone.Mediator.publish 'router:navigate', route: '/contribute/adventurer'
|
||||||
return
|
return
|
||||||
|
|
|
@ -2,7 +2,6 @@ CocoView = require 'views/core/CocoView'
|
||||||
template = require 'templates/play/level/level_loading'
|
template = require 'templates/play/level/level_loading'
|
||||||
utils = require 'core/utils'
|
utils = require 'core/utils'
|
||||||
SubscribeModal = require 'views/play/modal/SubscribeModal'
|
SubscribeModal = require 'views/play/modal/SubscribeModal'
|
||||||
AuthModal = require 'views/core/AuthModal'
|
|
||||||
|
|
||||||
module.exports = class LevelLoadingView extends CocoView
|
module.exports = class LevelLoadingView extends CocoView
|
||||||
id: 'level-loading-view'
|
id: 'level-loading-view'
|
||||||
|
@ -110,11 +109,9 @@ module.exports = class LevelLoadingView extends CocoView
|
||||||
@$el.find('.subscription-required').show()
|
@$el.find('.subscription-required').show()
|
||||||
|
|
||||||
onClickStartSubscription: (e) ->
|
onClickStartSubscription: (e) ->
|
||||||
modal = if me.get('anonymous') then AuthModal else SubscribeModal
|
@openModalView new SubscribeModal()
|
||||||
@openModalView new modal()
|
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'level loading'
|
||||||
if modal is SubscribeModal
|
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'level loading'
|
|
||||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
|
||||||
|
|
||||||
onSubscribed: ->
|
onSubscribed: ->
|
||||||
document.location.reload()
|
document.location.reload()
|
||||||
|
|
|
@ -2,6 +2,7 @@ ModalView = require 'views/core/ModalView'
|
||||||
template = require 'templates/play/modal/subscribe-modal'
|
template = require 'templates/play/modal/subscribe-modal'
|
||||||
stripeHandler = require 'core/services/stripe'
|
stripeHandler = require 'core/services/stripe'
|
||||||
utils = require 'core/utils'
|
utils = require 'core/utils'
|
||||||
|
AuthModal = require 'views/core/AuthModal'
|
||||||
|
|
||||||
module.exports = class SubscribeModal extends ModalView
|
module.exports = class SubscribeModal extends ModalView
|
||||||
id: 'subscribe-modal'
|
id: 'subscribe-modal'
|
||||||
|
@ -49,6 +50,7 @@ module.exports = class SubscribeModal extends ModalView
|
||||||
|
|
||||||
onClickPurchaseButton: (e) ->
|
onClickPurchaseButton: (e) ->
|
||||||
@playSound 'menu-button-click'
|
@playSound 'menu-button-click'
|
||||||
|
return @openModalView new AuthModal() if me.get('anonymous')
|
||||||
application.tracker?.trackEvent 'Started subscription purchase', {}
|
application.tracker?.trackEvent 'Started subscription purchase', {}
|
||||||
application.tracker?.trackPageView "subscription/start-purchase", ['Google Analytics']
|
application.tracker?.trackPageView "subscription/start-purchase", ['Google Analytics']
|
||||||
stripeHandler.open({
|
stripeHandler.open({
|
||||||
|
|
Reference in a new issue