@@ -184,6 +184,43 @@ define(function (require, exports, module) {
184184 _setupDocumentClickHandler ( ) ;
185185 }
186186
187+ /**
188+ * Update main navigation branding based on entitlements
189+ */
190+ function _updateBranding ( entitlements ) {
191+ const $brandingLink = $ ( "#phcode-io-main-nav" ) ;
192+ if ( ! entitlements ) {
193+ Phoenix . pro . plan = {
194+ paidSubscriber : false ,
195+ name : "Community Edition" ,
196+ isInTrial : false
197+ } ;
198+ return ;
199+ }
200+
201+ if ( entitlements && entitlements . plan ) {
202+ Phoenix . pro . plan = {
203+ paidSubscriber : entitlements . plan . paidSubscriber ,
204+ name : entitlements . plan . name ,
205+ isInTrial : entitlements . plan . isInTrial ,
206+ validTill : entitlements . plan . validTill
207+ } ;
208+ }
209+ if ( entitlements && entitlements . plan && entitlements . plan . paidSubscriber ) {
210+ // Paid subscriber: show plan name with feather icon
211+ const planName = entitlements . plan . name || "Phoenix Pro" ;
212+ $brandingLink
213+ . attr ( "href" , "https://account.phcode.dev" )
214+ . addClass ( "phoenix-pro" )
215+ . html ( `${ planName } <i class="fa-solid fa-feather orange-gold" style="margin-left: 3px;"></i>` ) ;
216+ } else {
217+ // Free user: show phcode.io branding
218+ $brandingLink
219+ . attr ( "href" , "https://phcode.io" )
220+ . removeClass ( "phoenix-pro" )
221+ . text ( "phcode.io" ) ;
222+ }
223+ }
187224
188225 let userEmail = "" ;
189226 class SecureEmail extends HTMLElement {
@@ -366,7 +403,7 @@ define(function (require, exports, module) {
366403 isPopupVisible = true ;
367404
368405 positionPopup ( ) ;
369-
406+
370407 // Apply cached entitlements immediately if available (including quota/messages)
371408 KernalModeTrust . loginService . getEntitlements ( false ) . then ( cachedEntitlements => {
372409 if ( cachedEntitlements && isPopupVisible ) {
@@ -504,6 +541,9 @@ define(function (require, exports, module) {
504541
505542 // Clear cached entitlements when user logs out
506543 LoginService . clearEntitlements ( ) ;
544+
545+ // Reset branding to free mode
546+ _updateBranding ( null ) ;
507547 }
508548
509549 function setLoggedIn ( initial , color ) {
@@ -514,9 +554,11 @@ define(function (require, exports, module) {
514554 _updateProfileIcon ( initial , color ) ;
515555
516556 // Preload entitlements when user logs in
517- KernalModeTrust . loginService . getEntitlements ( ) . catch ( error => {
518- console . error ( 'Failed to preload entitlements on login:' , error ) ;
519- } ) ;
557+ KernalModeTrust . loginService . getEntitlements ( )
558+ . then ( _updateBranding )
559+ . catch ( error => {
560+ console . error ( 'Failed to preload entitlements on login:' , error ) ;
561+ } ) ;
520562 }
521563
522564 exports . init = init ;
0 commit comments