mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
refactor(editor-ui): Create first PH experiment (#3969)
This commit is contained in:
parent
10cdf60202
commit
ee519b0c08
|
@ -9,40 +9,13 @@ declare module 'vue/types/vue' {
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
rudderanalytics: RudderStack;
|
rudderanalytics: RudderStack;
|
||||||
featureFlag: FeatureFlag;
|
posthog: {
|
||||||
posthog: posthog;
|
isFeatureEnabled(flagName: string): boolean;
|
||||||
|
getFeatureFlag(flagName: string): boolean | string;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Simplified version of:
|
|
||||||
* https://github.com/PostHog/posthog-js/blob/master/src/module.d.ts
|
|
||||||
*/
|
|
||||||
/* tslint:disable-next-line */
|
|
||||||
interface posthog {
|
|
||||||
identify(
|
|
||||||
uniqueId?: string,
|
|
||||||
userPropertiesToSet?: object,
|
|
||||||
userPropertiesToSetOnce?: object,
|
|
||||||
): void;
|
|
||||||
reset(resetDeviceId?: boolean): void;
|
|
||||||
capture(
|
|
||||||
eventName: string,
|
|
||||||
properties?: object,
|
|
||||||
options?: object,
|
|
||||||
): unknown;
|
|
||||||
isFeatureEnabled(key: string, options?: object): boolean;
|
|
||||||
register(properties: object, days?: number): void;
|
|
||||||
people: {
|
|
||||||
set(
|
|
||||||
prop: object | string,
|
|
||||||
to?: object,
|
|
||||||
callback?: Function,
|
|
||||||
): unknown;
|
|
||||||
};
|
|
||||||
getFeatureFlag?: (flagName: string) => boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IUserNodesPanelSession {
|
export interface IUserNodesPanelSession {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
data: IUserNodesPanelSessionData;
|
data: IUserNodesPanelSessionData;
|
||||||
|
@ -54,13 +27,6 @@ interface IUserNodesPanelSessionData {
|
||||||
filterMode: string;
|
filterMode: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FeatureFlag {
|
|
||||||
getAll(): string[];
|
|
||||||
get(flagName: string): boolean | undefined;
|
|
||||||
isEnabled(flagName: string): boolean | undefined;
|
|
||||||
reload(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplified version of:
|
* Simplified version of:
|
||||||
* https://github.com/rudderlabs/rudder-sdk-js/blob/master/dist/rudder-sdk-js/index.d.ts
|
* https://github.com/rudderlabs/rudder-sdk-js/blob/master/dist/rudder-sdk-js/index.d.ts
|
||||||
|
|
|
@ -2051,35 +2051,32 @@ export default mixins(
|
||||||
|
|
||||||
this.setZoomLevel(1);
|
this.setZoomLevel(1);
|
||||||
|
|
||||||
if (
|
const flagAvailable = window.posthog !== undefined && window.posthog.getFeatureFlag !== undefined;
|
||||||
window.posthog && window.featureFlag && window.posthog.getFeatureFlag &&
|
|
||||||
!window.featureFlag.isEnabled('show-welcome-note')
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => {
|
if (flagAvailable && window.posthog.getFeatureFlag('welcome-note') === 'test') {
|
||||||
this.$store.commit('setNodeViewOffsetPosition', {newOffset: [0, 0]});
|
setTimeout(() => {
|
||||||
// For novice users (onboardingFlowEnabled == true)
|
this.$store.commit('setNodeViewOffsetPosition', {newOffset: [0, 0]});
|
||||||
// Inject welcome sticky note and zoom to fit
|
// For novice users (onboardingFlowEnabled == true)
|
||||||
if (newWorkflow.onboardingFlowEnabled && !this.isReadOnly) {
|
// Inject welcome sticky note and zoom to fit
|
||||||
this.$nextTick(async () => {
|
if (newWorkflow.onboardingFlowEnabled && !this.isReadOnly) {
|
||||||
await this.addNodes([
|
this.$nextTick(async () => {
|
||||||
{
|
await this.addNodes([
|
||||||
id: uuid(),
|
{
|
||||||
...CanvasHelpers.WELCOME_STICKY_NODE,
|
id: uuid(),
|
||||||
parameters: {
|
...CanvasHelpers.WELCOME_STICKY_NODE,
|
||||||
// Use parameters from the template but add translated content
|
parameters: {
|
||||||
...CanvasHelpers.WELCOME_STICKY_NODE.parameters,
|
// Use parameters from the template but add translated content
|
||||||
content: this.$locale.baseText('onboardingWorkflow.stickyContent'),
|
...CanvasHelpers.WELCOME_STICKY_NODE.parameters,
|
||||||
|
content: this.$locale.baseText('onboardingWorkflow.stickyContent'),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
]);
|
||||||
]);
|
this.zoomToFit();
|
||||||
this.zoomToFit();
|
this.$telemetry.track('welcome note inserted');
|
||||||
this.$telemetry.track('welcome note inserted');
|
});
|
||||||
});
|
}
|
||||||
}
|
}, 0);
|
||||||
}, 0);
|
}
|
||||||
},
|
},
|
||||||
async initView (): Promise<void> {
|
async initView (): Promise<void> {
|
||||||
if (this.$route.params.action === 'workflowSave') {
|
if (this.$route.params.action === 'workflowSave') {
|
||||||
|
|
Loading…
Reference in a new issue