mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix: Send user id when setting up an account (#8639)
This commit is contained in:
parent
c0be43bdbe
commit
27f3166272
|
@ -12,7 +12,7 @@ export async function fetchNextOnboardingPrompt(
|
|||
return await get(N8N_API_BASE_URL, ONBOARDING_PROMPTS_ENDPOINT, {
|
||||
instance_id: instanceId,
|
||||
user_id: `${instanceId}#${currentUser.id}`,
|
||||
is_owner: currentUser.isOwner,
|
||||
is_owner: currentUser.isOwner ?? false,
|
||||
survey_results: currentUser.personalizationAnswers,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -757,29 +757,32 @@ export default defineComponent({
|
|||
getAccountAge(this.usersStore.currentUser || ({} as IUser)) <= ONBOARDING_PROMPT_TIMEBOX
|
||||
) {
|
||||
const onboardingResponse = await this.uiStore.getNextOnboardingPrompt();
|
||||
|
||||
if (!onboardingResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
const promptTimeout =
|
||||
onboardingResponse.toast_sequence_number === 1 ? FIRST_ONBOARDING_PROMPT_TIMEOUT : 1000;
|
||||
|
||||
if (onboardingResponse.title && onboardingResponse.description) {
|
||||
setTimeout(async () => {
|
||||
this.showToast({
|
||||
type: 'info',
|
||||
title: onboardingResponse.title,
|
||||
message: onboardingResponse.description,
|
||||
duration: 0,
|
||||
customClass: 'clickable',
|
||||
closeOnClick: true,
|
||||
onClick: () => {
|
||||
this.$telemetry.track('user clicked onboarding toast', {
|
||||
seq_num: onboardingResponse.toast_sequence_number,
|
||||
title: onboardingResponse.title,
|
||||
description: onboardingResponse.description,
|
||||
});
|
||||
this.uiStore.openModal(ONBOARDING_CALL_SIGNUP_MODAL_KEY);
|
||||
},
|
||||
});
|
||||
}, promptTimeout);
|
||||
}
|
||||
setTimeout(async () => {
|
||||
this.showToast({
|
||||
type: 'info',
|
||||
title: onboardingResponse.title,
|
||||
message: onboardingResponse.description,
|
||||
duration: 0,
|
||||
customClass: 'clickable',
|
||||
closeOnClick: true,
|
||||
onClick: () => {
|
||||
this.$telemetry.track('user clicked onboarding toast', {
|
||||
seq_num: onboardingResponse.toast_sequence_number,
|
||||
title: onboardingResponse.title,
|
||||
description: onboardingResponse.description,
|
||||
});
|
||||
this.uiStore.openModal(ONBOARDING_CALL_SIGNUP_MODAL_KEY);
|
||||
},
|
||||
});
|
||||
}, promptTimeout);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -46,7 +46,6 @@ import type {
|
|||
IFakeDoorLocation,
|
||||
INodeUi,
|
||||
IOnboardingCallPrompt,
|
||||
IUser,
|
||||
UIState,
|
||||
UTMCampaign,
|
||||
XYPosition,
|
||||
|
@ -66,6 +65,7 @@ import { useWorkflowsStore } from '@/stores/workflows.store';
|
|||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { hasPermission } from '@/rbac/permissions';
|
||||
import { useTelemetryStore } from '@/stores/telemetry.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { dismissBannerPermanently } from '@/api/ui';
|
||||
import type { BannerName } from 'n8n-workflow';
|
||||
import {
|
||||
|
@ -75,7 +75,6 @@ import {
|
|||
isValidTheme,
|
||||
updateTheme,
|
||||
} from './ui.utils';
|
||||
import { useUsersStore } from './users.store';
|
||||
|
||||
let savedTheme: ThemeOption = 'system';
|
||||
try {
|
||||
|
@ -468,26 +467,37 @@ export const useUIStore = defineStore(STORES.UI, {
|
|||
this.setMode(CREDENTIAL_EDIT_MODAL_KEY, 'new');
|
||||
this.openModal(CREDENTIAL_EDIT_MODAL_KEY);
|
||||
},
|
||||
async getNextOnboardingPrompt(): Promise<IOnboardingCallPrompt> {
|
||||
async getNextOnboardingPrompt(): Promise<IOnboardingCallPrompt | null> {
|
||||
const rootStore = useRootStore();
|
||||
const instanceId = rootStore.instanceId;
|
||||
// TODO: current USER
|
||||
const currentUser = {} as IUser;
|
||||
return await fetchNextOnboardingPrompt(instanceId, currentUser);
|
||||
const { currentUser } = useUsersStore();
|
||||
if (currentUser) {
|
||||
return await fetchNextOnboardingPrompt(instanceId, currentUser);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async applyForOnboardingCall(email: string): Promise<string> {
|
||||
async applyForOnboardingCall(email: string): Promise<string | null> {
|
||||
const rootStore = useRootStore();
|
||||
const instanceId = rootStore.instanceId;
|
||||
// TODO: current USER
|
||||
const currentUser = {} as IUser;
|
||||
return await applyForOnboardingCall(instanceId, currentUser, email);
|
||||
const { currentUser } = useUsersStore();
|
||||
if (currentUser) {
|
||||
return await applyForOnboardingCall(instanceId, currentUser, email);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
async submitContactEmail(email: string, agree: boolean): Promise<string> {
|
||||
async submitContactEmail(email: string, agree: boolean): Promise<string | null> {
|
||||
const rootStore = useRootStore();
|
||||
const instanceId = rootStore.instanceId;
|
||||
// TODO: current USER
|
||||
const currentUser = {} as IUser;
|
||||
return await submitEmailOnSignup(instanceId, currentUser, email || currentUser.email, agree);
|
||||
const { currentUser } = useUsersStore();
|
||||
if (currentUser) {
|
||||
return await submitEmailOnSignup(
|
||||
instanceId,
|
||||
currentUser,
|
||||
email ?? currentUser?.email,
|
||||
agree,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
openCommunityPackageUninstallConfirmModal(packageName: string) {
|
||||
this.setActiveId(COMMUNITY_PACKAGE_CONFIRM_MODAL_KEY, packageName);
|
||||
|
|
|
@ -869,9 +869,9 @@ export default defineComponent({
|
|||
) {
|
||||
const onboardingResponse = await this.uiStore.getNextOnboardingPrompt();
|
||||
const promptTimeout =
|
||||
onboardingResponse.toast_sequence_number === 1 ? FIRST_ONBOARDING_PROMPT_TIMEOUT : 1000;
|
||||
onboardingResponse?.toast_sequence_number === 1 ? FIRST_ONBOARDING_PROMPT_TIMEOUT : 1000;
|
||||
|
||||
if (onboardingResponse.title && onboardingResponse.description) {
|
||||
if (onboardingResponse?.title && onboardingResponse?.description) {
|
||||
setTimeout(async () => {
|
||||
this.showToast({
|
||||
type: 'info',
|
||||
|
|
Loading…
Reference in a new issue