From 96a55d9894d62b91f3a43134052ae234b9e153b4 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sun, 6 Dec 2020 12:25:39 -0600 Subject: [PATCH] 15 minutels and only if > 1 person --- .../AccountPaymentHistoryScreen.js.jsx.coffee | 16 +++++++++++ .../SubscriptionConcern.js.jsx.coffee | 27 ++++++++++--------- .../TopMessageHolder.js.jsx.coffee | 4 +-- .../stores/BroadcastStore.js.coffee | 5 ++-- .../stores/SessionStore.js.coffee | 4 +-- web/app/assets/javascripts/utils.js | 1 - web/config/application.rb | 5 ++++ 7 files changed, 42 insertions(+), 20 deletions(-) diff --git a/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee index 975baa7ec..93926f26d 100644 --- a/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/AccountPaymentHistoryScreen.js.jsx.coffee @@ -510,6 +510,21 @@ profileUtils = context.JK.ProfileUtils defaultText: () -> 'Select Country' + onStartPaypal: (e) -> + e.preventDefault() + @paypal = window.recurly.PayPal({ display: { displayName: 'JamKazam Subscriptions' }}) + @paypal.on('error', this.onPayPalError) + @paypal.on('token', this.onPayPalToken) + @paypal.start(); + + onPayPalToken:(token) -> + console.log("OnPayPalToken", token) + + onPayPalError: (err) -> + console.error("OnPayPalError", err) + + + openBrowserToPayment: () -> context.JK.popExternalLink("/client#/account/paymentHistory", true) @@ -608,6 +623,7 @@ profileUtils = context.JK.ProfileUtils
{uncollectableMessage}
{header}
+ Pay with Paypal
{firstNameField} {lastNameField} diff --git a/web/app/assets/javascripts/react-components/SubscriptionConcern.js.jsx.coffee b/web/app/assets/javascripts/react-components/SubscriptionConcern.js.jsx.coffee index 23fdd01e0..162a16ea9 100644 --- a/web/app/assets/javascripts/react-components/SubscriptionConcern.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/SubscriptionConcern.js.jsx.coffee @@ -54,24 +54,25 @@ context = window render: () -> content = null - if @props.subscription.until.total < 60000 - content = `
-

You have run out of time.

-

Compare plans and consider upgrading your plan for more play time and premium features.

-
` - else - if @props.subscription.main_concern_type == 'remaining_session_play_time' + if @props.subscription.participants > 1 + if @props.subscription.until.total < 60000 content = `
-

You will run out play time for this session in:

-

{this.displayTime()}

+

You have run out of time.

Compare plans and consider upgrading your plan for more play time and premium features.

` else - content = `
-

You will run out of monthly play time in:

+ if @props.subscription.main_concern_type == 'remaining_session_play_time' + content = `
+

You will run out play time for this session in:

{this.displayTime()}

-

Compare plans and consider upgrading your plan for more play time and premium features.

-
` +

Compare plans and consider upgrading your plan for more play time and premium features.

+
` + else + content = `
+

You will run out of monthly play time in:

+

{this.displayTime()}

+

Compare plans and consider upgrading your plan for more play time and premium features.

+
` if content? `
diff --git a/web/app/assets/javascripts/react-components/TopMessageHolder.js.jsx.coffee b/web/app/assets/javascripts/react-components/TopMessageHolder.js.jsx.coffee index 88af1176b..8f96207a1 100644 --- a/web/app/assets/javascripts/react-components/TopMessageHolder.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/TopMessageHolder.js.jsx.coffee @@ -6,7 +6,7 @@ ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; @TopMessageHolder = React.createClass( { displayName: 'Top Message Holder', - minimum_time_until_sub_prompt: 1000 * 60 * 30 # 30 minutes + minimum_time_until_sub_prompt: 1000 * 60 * 15 # 30 minutes mixins: [Reflux.listenTo(ConfigStore, "onConfig"), Reflux.connect(context.JK.Stores.Broadcast, 'notification')] getInitialState: () -> @@ -25,7 +25,7 @@ ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; # only show the subscription concern message if there is a concerpn and due time is less thant 30 minutes away if @state.notification && @state.notification.subscriptionConcern? && @state.notification.subscriptionConcern.until.total < @minimum_time_until_sub_prompt `
- +
` else if @state.top_message `
diff --git a/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee b/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee index a13e95b72..359797d72 100644 --- a/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/BroadcastStore.js.coffee @@ -47,7 +47,7 @@ BroadcastStore = Reflux.createStore( subscriptionManagement: () -> @subscriptionConcern.until = @lessonUtils.getTimeRemaining(@subscriptionConcern.main_concern_time) - if @subscriptionConcern.until.total < -30000 + if @session?.participants.length > 1 && @subscriptionConcern.until.total < -30000 leaveBehavior = location: "/client#/findSession" buttons = [] @@ -158,6 +158,7 @@ BroadcastStore = Reflux.createStore( @subscriptionConcern = null else @subscriptionConcern = {} + @subscriptionConcern.participants = @session?.participants().length if !@subscriptionRules.remaining_month_until? @subscriptionConcern.main_concern_time = @sessionRules.remaining_session_until @subscriptionConcern.main_concern_type = "remaining_session_play_time" @@ -175,7 +176,7 @@ BroadcastStore = Reflux.createStore( @subscriptionManagement() #logger.debug("BroadcastStore: session can play until: ", @subscriptionConcern.until, @subscriptionConcern.main_concert_time) if !@currentSubscriptionTimer? - @currentSubscriptionTimer= setInterval((() => @subscriptionTick()), 1000) + @currentSubscriptionTimer = setInterval((() => @subscriptionTick()), 1000) @changed() if currentSession.lesson_session? diff --git a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee index e5fee293e..9ea273f55 100644 --- a/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/SessionStore.js.coffee @@ -1094,7 +1094,7 @@ ConfigureTracksActions = @ConfigureTracksActions if sessionData.session_rules @sessionRules = sessionData.session_rules # TESTING: - #@sessionRules.remaining_session_play_time = 60 * 30 + 15 # 30 minutes and 15 seconds + #@sessionRules.remaining_session_play_time = 60 * 15 + 15 # 15 minutes and 15 seconds # compute timestamp due time if @sessionRules.remaining_session_play_time? @@ -1111,7 +1111,7 @@ ConfigureTracksActions = @ConfigureTracksActions #context.jamClient.applySubscriptionPolicy() @subscriptionRules = sessionData.subscription # TESTING: - #@subscriptionRules.remaining_month_play_time = 60 * 30 + 15 # 30 minutes and 15 seconds + #@subscriptionRules.remaining_month_play_time = 60 * 15 + 15 # 15 minutes and 15 seconds if @subscriptionRules.remaining_month_play_time? until_time = new Date() diff --git a/web/app/assets/javascripts/utils.js b/web/app/assets/javascripts/utils.js index 2663a6752..60e083dfb 100644 --- a/web/app/assets/javascripts/utils.js +++ b/web/app/assets/javascripts/utils.js @@ -1161,7 +1161,6 @@ context.JK.clientType = function () { if (client_type) { - console.log("SHORT CUT", client_type); return client_type; } else { diff --git a/web/config/application.rb b/web/config/application.rb index aeac7ff2e..78125fc78 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -490,5 +490,10 @@ if defined?(Bundler) {id: 'jamsubsilveryearly', name: 'Silver', price: 49.99, cycle: 'year'}, {id: 'jamsubgoldyearly', name: 'Gold', price:99.99, cycle: 'year'}, {id: 'jamsubplatinumyearly', name: 'Platinum', price:199.99, cycle: 'year'}] + + # sandbox + # braintree: merchant id: 5v5rwm94m2vrfbms + # braintree: public key: 367d6dtdswvdr87s + # braintree: private key: 8309b8f9c669cfa940f617eb9cac56ea end end