From 49dc1de7697d5fe4e3e11537c097efc9b2de58f2 Mon Sep 17 00:00:00 2001 From: fightme-cmd <80396935+fightme-cmd@users.noreply.github.com> Date: Sun, 5 Jul 2026 12:48:27 +0200 Subject: [PATCH] Add payment launch mode flag --- .env.example | 1 + README.md | 20 ++++++++++++++++++++ src/App.jsx | 10 ++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index b3cb9bc..e60c903 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ +VITE_PAYMENTS_ENABLED=false VITE_STRIPE_YEARLY_URL= VITE_STRIPE_LIFETIME_URL= VITE_STRIPE_WEEKLY_URL= diff --git a/README.md b/README.md index 0e813e6..5cf5ab7 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,20 @@ To wipe progress: open browser devtools → Application → Local Storage → de Beug uses public Stripe Checkout or Payment Link URLs, supplied through environment variables. Do not put Stripe secret keys in this Vite app. +Payments are behind a launch-mode flag: + +```bash +VITE_PAYMENTS_ENABLED=false +``` + +When `VITE_PAYMENTS_ENABLED` is absent or `false`, the app runs in Reddit/free mode: all lessons are usable, paid rows are not blurred, and the paywall/pricing screen is hidden. The Stripe URLs can stay configured in the environment so billing can be switched back on later with one env change. + +To turn payments back on, set: + +```bash +VITE_PAYMENTS_ENABLED=true +``` + Create one product in Stripe, for example `Beug Premium`, with three prices: - Weekly subscription: `$2.99` every week @@ -68,3 +82,9 @@ VITE_STRIPE_WEEKLY_URL=https://buy.stripe.com/... ``` The current v1 unlock is intentionally simple: after Stripe redirects back with `?checkout=success`, Beug stores the unlock in this browser's localStorage. This avoids accounts for the tiny-app version, but it is a soft paywall. A stricter version needs a small backend, Stripe webhooks, and account or email-based entitlement lookup. + +## Future prompt to re-enable payments + +```text +Turn payments back on for Beug. Set VITE_PAYMENTS_ENABLED=true in Coolify, keep the three existing Stripe Payment Link env vars, redeploy the app, and verify that unpaid users see the soft paid lesson blur, that charts remain visible, and that tapping a paid lesson opens the pricing screen with Weekly, Yearly, and Lifetime plans. +``` diff --git a/src/App.jsx b/src/App.jsx index 6bc5a9d..57cc819 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -233,6 +233,7 @@ const TABS = [ const FREE_LEVEL_IDS = new Set([1, 2, 3, 4, 8, 9, 10, 18]); const CORE_ARTICLE_CASES = ['nominative', 'accusative', 'dative']; +const PAYMENTS_ENABLED = String(import.meta.env.VITE_PAYMENTS_ENABLED || 'false').toLowerCase() === 'true'; const STRIPE_PLANS = [ { id:'weekly', @@ -662,8 +663,9 @@ export default function App() { await Storage.set(s); },[]); - const hasAccess = !!access?.paid; - const gated = id => !hasAccess && !FREE_LEVEL_IDS.has(id); + const hasPaidAccess = !!access?.paid; + const hasAccess = !PAYMENTS_ENABLED || hasPaidAccess; + const gated = id => PAYMENTS_ENABLED && !hasPaidAccess && !FREE_LEVEL_IDS.has(id); const unlocked = (id) => { return !gated(id); @@ -769,7 +771,7 @@ export default function App() { :
Beug
}
{scr === 'practice' && } - {hasAccess && Unlocked} + {PAYMENTS_ENABLED && hasPaidAccess && Unlocked} 🔥 {st.streak||0}
@@ -831,7 +833,7 @@ export default function App() { )} {/* PAYWALL */} - {scr === 'paywall' && ( + {PAYMENTS_ENABLED && scr === 'paywall' && (