mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -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 {
|
||||
interface Window {
|
||||
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 {
|
||||
sessionId: string;
|
||||
data: IUserNodesPanelSessionData;
|
||||
|
@ -54,13 +27,6 @@ interface IUserNodesPanelSessionData {
|
|||
filterMode: string;
|
||||
}
|
||||
|
||||
interface FeatureFlag {
|
||||
getAll(): string[];
|
||||
get(flagName: string): boolean | undefined;
|
||||
isEnabled(flagName: string): boolean | undefined;
|
||||
reload(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplified version of:
|
||||
* 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);
|
||||
|
||||
if (
|
||||
window.posthog && window.featureFlag && window.posthog.getFeatureFlag &&
|
||||
!window.featureFlag.isEnabled('show-welcome-note')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const flagAvailable = window.posthog !== undefined && window.posthog.getFeatureFlag !== undefined;
|
||||
|
||||
setTimeout(() => {
|
||||
this.$store.commit('setNodeViewOffsetPosition', {newOffset: [0, 0]});
|
||||
// For novice users (onboardingFlowEnabled == true)
|
||||
// Inject welcome sticky note and zoom to fit
|
||||
if (newWorkflow.onboardingFlowEnabled && !this.isReadOnly) {
|
||||
this.$nextTick(async () => {
|
||||
await this.addNodes([
|
||||
{
|
||||
id: uuid(),
|
||||
...CanvasHelpers.WELCOME_STICKY_NODE,
|
||||
parameters: {
|
||||
// Use parameters from the template but add translated content
|
||||
...CanvasHelpers.WELCOME_STICKY_NODE.parameters,
|
||||
content: this.$locale.baseText('onboardingWorkflow.stickyContent'),
|
||||
if (flagAvailable && window.posthog.getFeatureFlag('welcome-note') === 'test') {
|
||||
setTimeout(() => {
|
||||
this.$store.commit('setNodeViewOffsetPosition', {newOffset: [0, 0]});
|
||||
// For novice users (onboardingFlowEnabled == true)
|
||||
// Inject welcome sticky note and zoom to fit
|
||||
if (newWorkflow.onboardingFlowEnabled && !this.isReadOnly) {
|
||||
this.$nextTick(async () => {
|
||||
await this.addNodes([
|
||||
{
|
||||
id: uuid(),
|
||||
...CanvasHelpers.WELCOME_STICKY_NODE,
|
||||
parameters: {
|
||||
// Use parameters from the template but add translated content
|
||||
...CanvasHelpers.WELCOME_STICKY_NODE.parameters,
|
||||
content: this.$locale.baseText('onboardingWorkflow.stickyContent'),
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
this.zoomToFit();
|
||||
this.$telemetry.track('welcome note inserted');
|
||||
});
|
||||
}
|
||||
}, 0);
|
||||
]);
|
||||
this.zoomToFit();
|
||||
this.$telemetry.track('welcome note inserted');
|
||||
});
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
async initView (): Promise<void> {
|
||||
if (this.$route.params.action === 'workflowSave') {
|
||||
|
|
Loading…
Reference in a new issue