mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-09 03:47:29 -08:00
22 lines
530 B
TypeScript
22 lines
530 B
TypeScript
|
import type { Telemetry } from '@/plugins/telemetry';
|
||
|
import { ITelemetryTrackProperties } from 'n8n-workflow';
|
||
|
import { defineStore } from 'pinia';
|
||
|
import { ref, Ref } from 'vue';
|
||
|
|
||
|
export const useTelemetryStore = defineStore('telemetry', () => {
|
||
|
const telemetry: Ref<Telemetry | undefined> = ref();
|
||
|
|
||
|
const init = (tel: Telemetry) => {
|
||
|
telemetry.value = tel;
|
||
|
};
|
||
|
|
||
|
const track = (event: string, properties?: ITelemetryTrackProperties) => {
|
||
|
telemetry.value?.track(event, properties);
|
||
|
};
|
||
|
|
||
|
return {
|
||
|
init,
|
||
|
track,
|
||
|
};
|
||
|
});
|