@@ -113196,7 +113196,7 @@ define("nls/root/strings", {
113196113196 "PROMO_PRO_UNLOCK_MESSAGE": "Subscribe now to unlock these advanced features:",
113197113197 "PROMO_PRO_TRIAL_DAYS_LEFT": "Phoenix Pro Trial ({0} days left)",
113198113198 "GET_PHOENIX_PRO": "Get Phoenix Pro",
113199- "USER_FREE_PLAN_NAME ": "Free Plan "
113199+ "USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE ": "Community Edition "
113200113200});
113201113201
113202113202/*
@@ -167207,7 +167207,7 @@ define("services/entitlements", function (require, exports, module) {
167207167207 const currentDate = Date.now();
167208167208 return {
167209167209 paidSubscriber: false,
167210- name: Strings.USER_FREE_PLAN_NAME ,
167210+ name: Strings.USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE ,
167211167211 validTill: currentDate + (FREE_PLAN_VALIDITY_DAYS * MS_IN_DAY)
167212167212 };
167213167213 }
@@ -168502,7 +168502,8 @@ define("services/login-service", function (require, exports, module) {
168502168502 const accountBaseURL = LoginService.getAccountBaseURL();
168503168503 const language = brackets.getLocale();
168504168504 const currentVersion = window.AppConfig.apiVersion || "1.0.0";
168505- let url = `${accountBaseURL}/getAppEntitlements?lang=${language}&version=${currentVersion}`;
168505+ let url = `${accountBaseURL}/getAppEntitlements?lang=${language}&version=${currentVersion}`+
168506+ `&platform=${Phoenix.platform}&appType=${Phoenix.isNativeApp ? "desktop" : "browser"}}`;
168506168507 let fetchOptions = {
168507168508 method: 'GET',
168508168509 headers: {
@@ -168601,29 +168602,50 @@ define("services/login-service", function (require, exports, module) {
168601168602 /**
168602168603 * Start the 10-minute interval timer for monitoring entitlements
168603168604 */
168604- function startEntitlementsMonitor() {
168605+ function startEffectiveEntitlementsMonitor() {
168606+ // Reconcile effective entitlements from server. So the effective entitlements api injects trial
168607+ // entitlements data. but only the server fetch will trigger the entitlements change event.
168608+ // so in here, we observe the effective entitlements, and if the effective entitlements are changed,
168609+ // since the last triggered state, we trigger a change event. This only concerens with the effective
168610+ // entitlement changes. This will not logout the user if user logged out from the server admin panel,
168611+ // but his entitlements will be cleared by this call anyways.
168612+
168613+ // At app start we refresh entitlements, then only one each user action like user clicks on profile icon,
168614+ // or if some user hits some backend api, we will refresh entitlements. But here, we periodically refresh
168615+ // entitlements from the server every 10 minutes, but only trigger entitlement change events only if some
168616+ // effective entitlement(Eg. trial) data changed or any validity expired.
168617+ if(Phoenix.isTestWindow){
168618+ return;
168619+ }
168620+ setTimeout( async function() {
168621+ // prime the entitlement monitor with the current effective entitlements, after app start, the system would
168622+ // have resolved any existing login info by now and effective entitlements would be available if any.
168623+ lastRecordedState = await getEffectiveEntitlements(false);
168624+ }, 30000);
168605168625 setInterval(async () => {
168606168626 try {
168607- const current = await getEffectiveEntitlements(false); // Get effective entitlements
168627+ // Get fresh effective entitlements
168628+ const freshEntitlements = await getEffectiveEntitlements(true);
168608168629
168609168630 // Check if we need to refresh
168610- const expiredPlanName = KernalModeTrust.LoginUtils.validTillExpired(current, lastRecordedState);
168611- const hasChanged = KernalModeTrust.LoginUtils.haveEntitlementsChanged(current, lastRecordedState);
168631+ const expiredPlanName = KernalModeTrust.LoginUtils
168632+ .validTillExpired(freshEntitlements, lastRecordedState);
168633+ const hasChanged = KernalModeTrust.LoginUtils
168634+ .haveEntitlementsChanged(freshEntitlements, lastRecordedState);
168612168635
168613168636 if (expiredPlanName || hasChanged) {
168614168637 console.log(`Entitlements monitor detected changes, Expired: ${expiredPlanName},` +
168615168638 `changed: ${hasChanged} refreshing...`);
168616168639 Metrics.countEvent(Metrics.EVENT_TYPE.PRO, "entRefresh",
168617168640 expiredPlanName ? "exp_"+expiredPlanName : "changed");
168618- await getEffectiveEntitlements(true); // Force refresh
168619168641 // if not logged in, the getEffectiveEntitlements will not trigger change even if some trial
168620168642 // entitlements changed. so we trigger a change anyway here. The debounce will take care of
168621168643 // multi fire and we are ok with multi fire 1 second apart.
168622168644 _debounceEntitlementsChanged();
168623168645 }
168624168646
168625168647 // Update last recorded state
168626- lastRecordedState = current ;
168648+ lastRecordedState = freshEntitlements ;
168627168649 } catch (error) {
168628168650 console.error('Entitlements monitor error:', error);
168629168651 }
@@ -168643,7 +168665,8 @@ define("services/login-service", function (require, exports, module) {
168643168665 entitlements.plan = {
168644168666 ...entitlements.plan,
168645168667 paidSubscriber: false,
168646- name: Strings.USER_FREE_PLAN_NAME,
168668+ name: Strings.USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE,
168669+ fullName: Strings.USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE,
168647168670 validTill: currentDate + (FREE_PLAN_VALIDITY_DAYS * MS_IN_DAY)
168648168671 };
168649168672 }
@@ -168680,6 +168703,8 @@ define("services/login-service", function (require, exports, module) {
168680168703 * plan: {
168681168704 * paidSubscriber: true, // Always true for trial users
168682168705 * name: "Phoenix Pro"
168706+ * fullName: "Phoenix Pro" // this can be deceptive name like "Phoenix Pro For Education" to use in
168707+ * // profile popup, not main branding
168683168708 * },
168684168709 * isInProTrial: true, // Indicates this is a trial user
168685168710 * trialDaysRemaining: number, // Days left in trial
@@ -168705,6 +168730,8 @@ define("services/login-service", function (require, exports, module) {
168705168730 * lang: string,
168706168731 * plan: {
168707168732 * name: "Phoenix Pro",
168733+ * fullName: "Phoenix Pro" // this can be deceptive name like "Phoenix Pro For Education" to use in
168734+ * // profile popup, not main branding
168708168735 * paidSubscriber: boolean,
168709168736 * validTill: number // Timestamp
168710168737 * },
@@ -168780,6 +168807,7 @@ define("services/login-service", function (require, exports, module) {
168780168807 ...serverEntitlements.plan,
168781168808 paidSubscriber: true,
168782168809 name: brackets.config.main_pro_plan,
168810+ fullName: brackets.config.main_pro_plan,
168783168811 validTill: dateNowFn() + trialDaysRemaining * MS_IN_DAY
168784168812 },
168785168813 isInProTrial: true,
@@ -168801,6 +168829,7 @@ define("services/login-service", function (require, exports, module) {
168801168829 plan: {
168802168830 paidSubscriber: true,
168803168831 name: brackets.config.main_pro_plan,
168832+ fullName: brackets.config.main_pro_plan,
168804168833 validTill: dateNowFn() + trialDaysRemaining * MS_IN_DAY
168805168834 },
168806168835 isInProTrial: true,
@@ -168846,7 +168875,7 @@ define("services/login-service", function (require, exports, module) {
168846168875 }
168847168876
168848168877 // Start the entitlements monitor timer
168849- startEntitlementsMonitor ();
168878+ startEffectiveEntitlementsMonitor ();
168850168879
168851168880 exports.init = init;
168852168881 // no public exports to prevent extension tampering
@@ -169557,19 +169586,21 @@ define("services/profile-menu", function (require, exports, module) {
169557169586 // Use kernal mode apis for trusted check of pro features.
169558169587 Phoenix.pro.plan = {
169559169588 paidSubscriber: false,
169560- name: "Community Edition"
169589+ name: Strings.USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE,
169590+ fullName: Strings.USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE
169561169591 };
169562169592 }
169563169593
169564169594 if (entitlements && entitlements.plan){
169565169595 Phoenix.pro.plan = {
169566169596 paidSubscriber: entitlements.plan.paidSubscriber,
169567169597 name: entitlements.plan.name,
169598+ fullName: entitlements.plan.fullName,
169568169599 validTill: entitlements.plan.validTill
169569169600 };
169570169601 }
169571169602 if (entitlements && entitlements.plan && entitlements.plan.paidSubscriber) {
169572- // Pro user (paid subscriber or trial): show plan name with feather icon
169603+ // Pro user (paid subscriber or trial): show short name branding with `name feather icon`(not full name)
169573169604 let displayName = entitlements.plan.name || brackets.config.main_pro_plan;
169574169605 if (entitlements.isInProTrial) {
169575169606 displayName = brackets.config.main_pro_plan; // Just "Phoenix Pro" for branding, not "Phoenix Pro Trial"
@@ -169719,15 +169750,15 @@ define("services/profile-menu", function (require, exports, module) {
169719169750 } else {
169720169751 // For paid users: regular plan name with icon
169721169752 const proTitle = `<span class="phoenix-pro-title">
169722- <span class="pro-plan-name user-plan-name">${entitlements.plan.name }</span>
169753+ <span class="pro-plan-name user-plan-name">${entitlements.plan.fullName }</span>
169723169754 <i class="fa-solid fa-feather" style="margin-left: 3px;"></i>
169724169755 </span>`;
169725169756 $planName.addClass('user-plan-paid').html(proTitle);
169726169757 $getProLink.addClass('forced-hidden');
169727169758 }
169728169759 } else {
169729169760 // Use simple text for free users
169730- $planName.addClass('user-plan-free').text(entitlements.plan.name );
169761+ $planName.addClass('user-plan-free').text(entitlements.plan.fullName );
169731169762 }
169732169763 } else {
169733169764 $getProLink.removeClass('forced-hidden');
@@ -169776,7 +169807,7 @@ define("services/profile-menu", function (require, exports, module) {
169776169807 initials: profileData.profileIcon.initials,
169777169808 avatarColor: profileData.profileIcon.color,
169778169809 planClass: "user-plan-free",
169779- planName: Strings.USER_FREE_PLAN_NAME ,
169810+ planName: Strings.USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE ,
169780169811 titleText: "Ai Quota Used",
169781169812 usageText: "100 / 200 credits",
169782169813 usedPercent: 0,
0 commit comments