fix(editor): Trial banner does not disappear after sign out (no-changelog) (#6930)

to test in staging use version
`PR-6930-ado-990-trial-banner-does-not-disappear-after-sign-out`

<img width="875" alt="image"
src="https://github.com/n8n-io/n8n/assets/16496553/dfffe60f-bec3-4c48-bd9c-5990c68afa52">
This commit is contained in:
Ricardo Espinoza
2023-08-17 07:57:40 -04:00
committed by GitHub
parent ad15d3eae9
commit d3f01270c7
10 changed files with 181 additions and 37 deletions

View File

@@ -49,8 +49,8 @@ import { defineStore } from 'pinia';
import { useRootStore } from './n8nRoot.store';
import { getCurlToJson } from '@/api/curlHelper';
import { useWorkflowsStore } from './workflows.store';
import { useSettingsStore } from './settings.store';
import { useCloudPlanStore } from './cloudPlan.store';
import { useSettingsStore } from '@/stores/settings.store';
import { useCloudPlanStore } from '@/stores/cloudPlan.store';
import type { BaseTextKey } from '@/plugins/i18n';
import { i18n as locale } from '@/plugins/i18n';
import { useTelemetryStore } from '@/stores/telemetry.store';
@@ -562,5 +562,23 @@ export const useUIStore = defineStore(STORES.UI, {
updateBannersHeight(newHeight: number): void {
this.bannersHeight = newHeight;
},
async initBanners(): Promise<void> {
const cloudPlanStore = useCloudPlanStore();
if (cloudPlanStore.userIsTrialing) {
await this.dismissBanner('V1', 'temporary');
if (cloudPlanStore.trialExpired) {
this.showBanner('TRIAL_OVER');
} else {
this.showBanner('TRIAL');
}
}
},
async dismissAllBanners() {
return Promise.all([
this.dismissBanner('TRIAL', 'temporary'),
this.dismissBanner('TRIAL_OVER', 'temporary'),
this.dismissBanner('V1', 'temporary'),
]);
},
},
});