Skip to content

Commit

Permalink
Putting paid purchase and trial enforcement back in place for 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tconfrey committed Jun 5, 2024
1 parent 3c79528 commit 7b0fec2
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
14 changes: 9 additions & 5 deletions app/configManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ const configManager = (() => {
// open/close settings panel

const iconColor = (getProp('BTTheme') == 'LIGHT') ? 'LIGHT' : 'DARK';
const installDate = new Date(getProp('BTInstallDate'));
const today = new Date();
const daysSinceInstall = Math.floor((today - installDate) / (24 * 60 * 60 * 1000));

if ($('#actions').is(':visible'))
toggleActionsDisplay(); // can't have both open
Expand All @@ -331,15 +334,16 @@ const configManager = (() => {
$('#topBar img').removeClass(['DARK', 'LIGHT']).addClass('DARK');
$("#content").fadeOut(250);
$("body").css("overflow", "hidden"); // don't allow table to be scrolled
/* !!!!!!! Temp remove supporter overlay !!!!!!!! */

// fade in and maybe out the overlay to shut off non-supporter features if not supporter
if (BTId) return;
// No BTId but might be still in trial period. Fade in overlay
setTimeout(() => {
$("#youShallNotPass").fadeIn();
}, 1000);
setTimeout(() => {
$("#youShallNotPass").fadeOut();
}, 20000);
/* !!!!!!! Temp remove supporter overlay !!!!!!!! */
// fade out overlay if trial still on ie < 30 days since install
if (daysSinceInstall <= 30)
setTimeout(() => {$("#youShallNotPass").fadeOut();}, 10000);
}
}

Expand Down
11 changes: 4 additions & 7 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,8 @@
<span>+ ADD A NEW TOP LEVEL TOPIC</span>
</div>
</div>
<div class="settingsActions" id="settings" style="margin-bottom: 5px" onclick="$('#youShallNotPass').hide()">
<div class="settingsActions" id="settings" style="margin-bottom: 5px">
<div id="youShallNotPass">
<img class="panelClose" type="image" alt="Reveal" title="Reveal Supporter Zone"
src="resources/close.png" height="17" width="20"
onclick="$('#youShallNotPass').hide()">
<p id="warningBanner">Supporter<br/>Zone</p>
</div>
<img class="panelClose" type="image" alt="Close" title="Close"
Expand Down Expand Up @@ -266,9 +263,9 @@
<div id="settingsSubscriptionAdd">
<div class="settingsSubText">You are using BrainTool for free.<br/>Please consider supporting BrainTool with a purchase. Thank you!</div>
<div id="settingsSubscriptionButtons" class="settingsInput">
<button onClick="handlePurchase(Monthly)" class="subButton">$1.33/ Month</button>
<button onclick="handlePurchase(Annual)" class="subButton">$10.66/ Year</button>
<button onclick="handlePurchase(OTP)" class="subButton">Lifetime $21<br/><i><small>(now free)</small></i></button>
<button onClick="handlePurchase(Monthly)" class="subButton">Month $1.33</button>
<button onclick="handlePurchase(Annual)" class="subButton">Year $10.66</button>
<button onclick="handlePurchase(OTP)" class="subButton">Lifetime $20.99</button>
</div>
<i>Coupons applied at checkout</i>
<div class="settingsFootnote">
Expand Down
6 changes: 3 additions & 3 deletions app/subscriptionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,12 @@ async function subscribe(productPrice) {
}
}

const ReleaseCandidate = true;
async function purchase(productPrice) {
// similar to above but One-Time-purchase
const baseURL = window.location.href.split('?')[0]; // drop any preexisting '?purchase=xyz' arg
const checkoutSession = {
mode: "payment",
price: OTP, // One-time price created in Stripe
price: OTP, // One-time price created in Stripe
allow_promotion_codes: true,
success_url: baseURL+ '?purchase=' + encodeURIComponent('product'),
cancel_url: baseURL + '?purchase=' + encodeURIComponent('cancelled'),
Expand All @@ -344,7 +343,6 @@ async function purchase(productPrice) {
if (sessionId) {
// We have a session, let's redirect to Checkout
// Init Stripe
if (ReleaseCandidate) {RCPurchase(sessionId); return;} // !!! REMOVE FROM PROD and update FB Rules!!!
const stripeKey = configManager.getProp('STRIPE_KEY');
const stripe = Stripe(stripeKey);
stripe.redirectToCheckout({ sessionId });
Expand All @@ -357,6 +355,7 @@ async function purchase(productPrice) {
}
}

/*
async function RCPurchase(sessionId) {
// Skip Stripe processing to allow free license for RC. Stripe won't charge 0 for a product or give 100% discount
Expand All @@ -382,6 +381,7 @@ async function RCPurchase(sessionId) {
updateLicenseSettings();
});
}
*/

async function getStripePortalURL() {
// Billing portal handler
Expand Down
Binary file removed extension/images/Overview.png
Binary file not shown.
Binary file removed extension/resources/gridBackground.png
Binary file not shown.
2 changes: 1 addition & 1 deletion pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ Nag-free
<br/><br/>
<p>
<b>
$1.33/M, $10.66/Y, $21 One-time
$1.33/M, $10.66/Y, $20.99 One-time
</b>
</p>

0 comments on commit 7b0fec2

Please sign in to comment.