feat: Rewrite Front End cloud and posthog hooks using TypeScript (no-changelog) (#5491)

This commit is contained in:
Alex Grozav
2023-11-13 15:10:42 +02:00
committed by GitHub
parent 3dfabc37d8
commit a262c450f7
41 changed files with 1439 additions and 131 deletions

View File

@@ -16,7 +16,6 @@ import {
} from '@/constants';
import { useUsersStore } from '@/stores/users.store';
import { useWebhooksStore } from '@/stores/webhooks.store';
import { runExternalHook } from '@/utils';
import { useActions } from '../composables/useActions';
@@ -171,7 +170,7 @@ function trackActionsView() {
trigger_action_count,
};
void runExternalHook('nodeCreateList.onViewActions', useWebhooksStore(), trackingPayload);
void runExternalHook('nodeCreateList.onViewActions', trackingPayload);
telemetry?.trackNodesPanel('nodeCreateList.onViewActions', trackingPayload);
}
@@ -192,7 +191,7 @@ function addHttpNode() {
if (telemetry) setAddedNodeActionParameters(updateData);
const app_identifier = actions.value[0].key;
void runExternalHook('nodeCreateList.onActionsCustmAPIClicked', useWebhooksStore(), {
void runExternalHook('nodeCreateList.onActionsCustmAPIClicked', {
app_identifier,
});
telemetry?.trackNodesPanel('nodeCreateList.onActionsCustmAPIClicked', { app_identifier });

View File

@@ -25,8 +25,7 @@
<script setup lang="ts">
import { onMounted, reactive, toRefs, onBeforeUnmount } from 'vue';
import { useWebhooksStore } from '@/stores/webhooks.store';
import { runExternalHook } from '@/utils';
import { useExternalHooks } from '@/composables';
export interface Props {
placeholder: string;
@@ -46,6 +45,8 @@ const state = reactive({
inputRef: null as HTMLInputElement | null,
});
const externalHooks = useExternalHooks();
function focus() {
state.inputRef?.focus();
}
@@ -60,9 +61,7 @@ function clear() {
}
onMounted(() => {
void runExternalHook('nodeCreator_searchBar.mount', useWebhooksStore(), {
inputRef: state.inputRef,
});
void externalHooks.run('nodeCreatorSearchBar.mount', { inputRef: state.inputRef });
setTimeout(focus, 0);
});

View File

@@ -27,7 +27,6 @@ import { useNodeCreatorStore } from '@/stores/nodeCreator.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
import { runExternalHook } from '@/utils';
import { useWebhooksStore } from '@/stores/webhooks.store';
import { sortNodeCreateElements, transformNodeType } from '../utils';
@@ -256,7 +255,7 @@ export const useActions = () => {
source_mode: rootView.toLowerCase(),
resource: (action.value as INodeParameters).resource || '',
};
void runExternalHook('nodeCreateList.addAction', useWebhooksStore(), payload);
void runExternalHook('nodeCreateList.addAction', payload);
telemetry?.trackNodesPanel('nodeCreateList.addAction', payload);
}