feat(editor): Clean up lead enrichment experiment (no-changelog) (#9572)

This commit is contained in:
Tomi Turtiainen
2024-06-03 10:35:55 +03:00
committed by GitHub
parent 99c15a0fd8
commit 09472fb9ee
17 changed files with 46 additions and 1263 deletions

View File

@@ -5,14 +5,9 @@ import { useRootStore } from '@/stores/n8nRoot.store';
import { useSettingsStore } from '@/stores/settings.store';
import { useUIStore } from '@/stores/ui.store';
import { useUsersStore } from '@/stores/users.store';
import {
getAdminPanelLoginCode,
getCurrentPlan,
getCurrentUsage,
fetchSuggestedTemplates,
} from '@/api/cloudPlans';
import { getAdminPanelLoginCode, getCurrentPlan, getCurrentUsage } from '@/api/cloudPlans';
import { DateTime } from 'luxon';
import { CLOUD_TRIAL_CHECK_INTERVAL, SUGGESTED_TEMPLATES_FLAG, STORES } from '@/constants';
import { CLOUD_TRIAL_CHECK_INTERVAL, STORES } from '@/constants';
import { hasPermission } from '@/rbac/permissions';
const DEFAULT_STATE: CloudPlanState = {
@@ -166,17 +161,6 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
window.location.href = `https://${adminPanelHost}/login?code=${code}`;
};
const loadSuggestedTemplates = async () => {
try {
const additionalTemplates = await fetchSuggestedTemplates(rootStore.getRestApiContext);
if (additionalTemplates.sections && additionalTemplates.sections.length > 0) {
useUIStore().setSuggestedTemplates(additionalTemplates);
}
} catch (error) {
console.warn('Error checking for lead enrichment templates:', error);
}
};
const initialize = async () => {
if (state.initialized) {
return;
@@ -194,12 +178,6 @@ export const useCloudPlanStore = defineStore(STORES.CLOUD_PLAN, () => {
console.warn('Error fetching user cloud account:', error);
}
const localStorageFlag = localStorage.getItem(SUGGESTED_TEMPLATES_FLAG);
// Don't show if users already opted in
if (localStorageFlag !== 'false' && hasPermission(['instanceOwner'])) {
await loadSuggestedTemplates();
}
state.initialized = true;
};

View File

@@ -37,7 +37,6 @@ import {
DEBUG_PAYWALL_MODAL_KEY,
N8N_PRICING_PAGE_URL,
WORKFLOW_HISTORY_VERSION_RESTORE,
SUGGESTED_TEMPLATES_PREVIEW_MODAL_KEY,
SETUP_CREDENTIALS_MODAL_KEY,
GENERATE_CURL_MODAL_KEY,
} from '@/constants';
@@ -54,7 +53,6 @@ import type {
NewCredentialsModal,
ThemeOption,
AppliedThemeOption,
SuggestedTemplates,
NotificationOptions,
ModalState,
} from '@/Interface';
@@ -119,7 +117,6 @@ export const useUIStore = defineStore(STORES.UI, {
EXTERNAL_SECRETS_PROVIDER_MODAL_KEY,
DEBUG_PAYWALL_MODAL_KEY,
WORKFLOW_HISTORY_VERSION_RESTORE,
SUGGESTED_TEMPLATES_PREVIEW_MODAL_KEY,
SETUP_CREDENTIALS_MODAL_KEY,
].map((modalKey) => [modalKey, { open: false }]),
),
@@ -190,7 +187,6 @@ export const useUIStore = defineStore(STORES.UI, {
addFirstStepOnLoad: false,
bannersHeight: 0,
bannerStack: [],
suggestedTemplates: undefined,
// Notifications that should show when a view is initialized
// This enables us to set a queue of notifications form outside (another component)
// and then show them when the view is initialized
@@ -615,12 +611,6 @@ export const useUIStore = defineStore(STORES.UI, {
clearBannerStack() {
this.bannerStack = [];
},
setSuggestedTemplates(templates: SuggestedTemplates) {
this.suggestedTemplates = templates;
},
deleteSuggestedTemplates() {
this.suggestedTemplates = undefined;
},
getNotificationsForView(view: VIEWS): NotificationOptions[] {
return this.pendingNotificationsForViews[view] ?? [];
},