@@ -162,23 +162,41 @@ define(function (require, exports, module) {
162162
163163 positionPopup ( ) ;
164164
165- // Check for trial info asynchronously and update popup
165+ // Check for trial info or device license asynchronously and update popup
166166 KernalModeTrust . loginService . getEffectiveEntitlements ( ) . then ( effectiveEntitlements => {
167- if ( effectiveEntitlements && effectiveEntitlements . isInProTrial && isPopupVisible && $popup ) {
168- // Add trial info to the existing popup
169- const planName = StringUtils . format ( Strings . PROMO_PRO_TRIAL_DAYS_LEFT ,
170- effectiveEntitlements . trialDaysRemaining ) ;
171- const trialInfoHtml = `<div class="trial-plan-info">
172- <span class="phoenix-pro-title-plain">
173- <span class="pro-plan-name user-plan-name">${ planName } </span>
174- <i class="fa-solid fa-feather" style="margin-left: 3px;"></i>
175- </span>
176- </div>` ;
177- $popup . find ( '.popup-title' ) . after ( trialInfoHtml ) ;
178- positionPopup ( ) ; // Reposition after adding content
167+ // this is the login popup, so user is not logged in yet if we are here.
168+ if ( effectiveEntitlements && isPopupVisible && $popup ) {
169+ let proInfoHtml = null ;
170+
171+ if ( effectiveEntitlements . isInProTrial ) {
172+ // isInProTrial will never be set if user has a pro device license(or a pro sub,
173+ // but that isn't relevant here). Add trial info to the existing popup.
174+ const planName = StringUtils . format ( Strings . PROMO_PRO_TRIAL_DAYS_LEFT ,
175+ effectiveEntitlements . trialDaysRemaining ) ;
176+ proInfoHtml = `<div class="trial-plan-info">
177+ <span class="phoenix-pro-title-plain">
178+ <span class="pro-plan-name user-plan-name">${ planName } </span>
179+ <i class="fa-solid fa-feather" style="margin-left: 3px;"></i>
180+ </span>
181+ </div>` ;
182+ } else if ( effectiveEntitlements . plan && effectiveEntitlements . plan . paidSubscriber ) {
183+ // Device-licensed user: show Phoenix Pro branding
184+ const planName = effectiveEntitlements . plan . fullName || brackets . config . main_pro_plan ;
185+ proInfoHtml = `<div class="trial-plan-info">
186+ <span class="phoenix-pro-title-plain">
187+ <span class="pro-plan-name user-plan-name">${ planName } </span>
188+ <i class="fa-solid fa-feather" style="margin-left: 3px;"></i>
189+ </span>
190+ </div>` ;
191+ }
192+
193+ if ( proInfoHtml ) {
194+ $popup . find ( '.popup-title' ) . after ( proInfoHtml ) ;
195+ positionPopup ( ) ; // Reposition after adding content
196+ }
179197 }
180198 } ) . catch ( error => {
181- console . error ( 'Failed to check trial info for login popup:' , error ) ;
199+ console . error ( 'Failed to check entitlements for login popup:' , error ) ;
182200 } ) ;
183201
184202 PopUpManager . addPopUp ( $popup , function ( ) {
@@ -570,33 +588,38 @@ define(function (require, exports, module) {
570588 }
571589
572590 /**
573- * Check if user has an active trial (works for both logged-in and non-logged-in users)
591+ * Check if user has Pro access (active trial or device license)
592+ * Works for both logged-in and non-logged-in users
574593 */
575- async function _hasActiveTrial ( ) {
594+ async function _hasProActive ( ) {
576595 try {
577596 const effectiveEntitlements = await KernalModeTrust . loginService . getEffectiveEntitlements ( ) ;
578- return effectiveEntitlements && effectiveEntitlements . isInProTrial ;
597+ return effectiveEntitlements &&
598+ ( effectiveEntitlements . isInProTrial ||
599+ ( effectiveEntitlements . plan && effectiveEntitlements . plan . paidSubscriber ) ) ;
579600 } catch ( error ) {
580- console . error ( 'Failed to check trial status:' , error ) ;
601+ console . error ( 'Failed to check Pro access status:' , error ) ;
581602 return false ;
582603 }
583604 }
584605
585606 /**
586- * Initialize branding for non-logged-in trial users on startup
607+ * Initialize branding for non-logged-in users with Pro access ( trial or device license) on startup
587608 */
588- async function _initializeBrandingForTrialUsers ( ) {
609+ async function _setBrandingForNonLoggedInUser ( ) {
589610 try {
590611 const effectiveEntitlements = await KernalModeTrust . loginService . getEffectiveEntitlements ( ) ;
591- if ( effectiveEntitlements && effectiveEntitlements . isInProTrial ) {
592- console . log ( 'Profile Menu: Found active trial, updating branding...' ) ;
612+ if ( effectiveEntitlements &&
613+ ( effectiveEntitlements . isInProTrial ||
614+ ( effectiveEntitlements . plan && effectiveEntitlements . plan . paidSubscriber ) ) ) {
615+ console . log ( 'Profile Menu: Found Pro entitlements (trial or device license), updating branding...' ) ;
593616 _updateBranding ( effectiveEntitlements ) ;
594617 } else {
595- console . log ( 'Profile Menu: No active trial found' ) ;
618+ console . log ( 'Profile Menu: No Pro entitlements found' ) ;
596619 _updateBranding ( null ) ;
597620 }
598621 } catch ( error ) {
599- console . error ( 'Failed to initialize branding for trial users:' , error ) ;
622+ console . error ( 'Failed to initialize branding for non-logged-in Pro users:' , error ) ;
600623 }
601624 }
602625
@@ -619,14 +642,14 @@ define(function (require, exports, module) {
619642 togglePopup ( ) ;
620643 } ) ;
621644
622- // Initialize branding for non-logged-in trial users
623- _initializeBrandingForTrialUsers ( ) ;
645+ // Initialize branding for non-logged-in users with Pro access ( trial or device license)
646+ _setBrandingForNonLoggedInUser ( ) ;
624647
625- // Listen for entitlements changes to update branding for non-logged-in trial users
648+ // Listen for entitlements changes to update branding for non-logged-in Pro users
626649 KernalModeTrust . loginService . on ( KernalModeTrust . loginService . EVENT_ENTITLEMENTS_CHANGED , ( ) => {
627- // When entitlements change (including trial activation) for non-logged-in users, update branding
650+ // When entitlements change (trial activation or device license ) for non-logged-in users, update branding
628651 if ( ! KernalModeTrust . loginService . isLoggedIn ( ) ) {
629- _initializeBrandingForTrialUsers ( ) ;
652+ _setBrandingForNonLoggedInUser ( ) ;
630653 }
631654 } ) ;
632655 }
@@ -638,19 +661,19 @@ define(function (require, exports, module) {
638661 }
639662 _removeProfileIcon ( ) ;
640663
641- // Reset branding, but preserve trial branding if user has active trial
642- _hasActiveTrial ( ) . then ( hasActiveTrial => {
643- if ( ! hasActiveTrial ) {
644- // Only reset branding if no trial exists
645- console . log ( 'Profile Menu: No trial , resetting branding to free' ) ;
664+ // Reset branding, but preserve Pro branding if user has active trial or device license
665+ _hasProActive ( ) . then ( hasProActive => {
666+ if ( ! hasProActive ) {
667+ // Only reset branding if no trial or device license exists
668+ console . log ( 'Profile Menu: No Pro access , resetting branding to free' ) ;
646669 _updateBranding ( null ) ;
647670 } else {
648- // User has trial, maintain pro branding
649- console . log ( 'Profile Menu: Trial exists, maintaining pro branding' ) ;
650- _initializeBrandingForTrialUsers ( ) ;
671+ // User has trial or device license , maintain pro branding
672+ console . log ( 'Profile Menu: Pro access exists, maintaining pro branding' ) ;
673+ _setBrandingForNonLoggedInUser ( ) ;
651674 }
652675 } ) . catch ( error => {
653- console . error ( 'Failed to check trial status during logout:' , error ) ;
676+ console . error ( 'Failed to check Pro access status during logout:' , error ) ;
654677 // Fallback to resetting branding
655678 _updateBranding ( null ) ;
656679 } ) ;
0 commit comments