From 8587ec372fdcf7ddc22bb8fb6df13dc12b608d0f Mon Sep 17 00:00:00 2001 From: davegilligan Date: Sat, 23 May 2026 22:45:57 +0200 Subject: [PATCH] fix: expose DBN_USER_TIER so plus/pro SSO users can use doc picker isPaidUser() was checking DBN_FREE_TIER_BALANCE === undefined, which is only true for CaveauAI sessions. SSO users (even plus/pro) always have DBN_FREE_TIER_BALANCE set, so the picker was showing the upgrade modal for everyone in the SSO flow. Now reads DBN_USER_TIER explicitly. Co-Authored-By: Claude Sonnet 4.6 --- assets/js/doc-picker.js | 8 ++++++-- includes/layout.php | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/js/doc-picker.js b/assets/js/doc-picker.js index 9b97bc2..e6ed2db 100644 --- a/assets/js/doc-picker.js +++ b/assets/js/doc-picker.js @@ -13,8 +13,12 @@ // DBN_FREE_TIER_BALANCE is set only for SSO (free) users. // Paid CaveauAI sessions have it undefined. function isPaidUser() { - return window.DBN_TOOLS_AUTHENTICATED === true - && typeof window.DBN_FREE_TIER_BALANCE === 'undefined'; + if (window.DBN_TOOLS_AUTHENTICATED !== true) return false; + // CaveauAI sessions never have DBN_FREE_TIER_BALANCE set + if (typeof window.DBN_FREE_TIER_BALANCE === 'undefined') return true; + // SSO sessions: check the explicit tier variable + var t = window.DBN_USER_TIER; + return t === 'plus' || t === 'pro'; } // ── Upgrade modal ───────────────────────────────────────────────────────── diff --git a/includes/layout.php b/includes/layout.php index ea98b8d..7fd6588 100644 --- a/includes/layout.php +++ b/includes/layout.php @@ -50,6 +50,7 @@ window.DBN_TOOLS_AUTHENTICATED = ; window.DBN_TOOLS_LANG = ; = 0): ?> window.DBN_FREE_TIER_BALANCE = ; +window.DBN_USER_TIER = ;