feat: Add TeleCart Pulse heartbeat telemetry

This commit is contained in:
2025-12-03 23:03:16 +03:00
parent 772efce242
commit b60c77e453
11 changed files with 202 additions and 5 deletions

View File

@@ -62,6 +62,9 @@ settings.load()
.then(() => pulse.initFromStartParams())
.then(() => pulse.catchTelegramCustomerFromInitData())
.then(() => pulse.ingest(TC_PULSE_EVENTS.WEBAPP_OPEN))
.then(() => {
pulse.heartbeat();
})
.then(() => {
(async () => {
try {

View File

@@ -1,5 +1,5 @@
import {defineStore} from "pinia";
import {ingest, saveTelegramCustomer} from "@/utils/ftch.js";
import {ingest, saveTelegramCustomer, heartbeat} from "@/utils/ftch.js";
import {toRaw} from "vue";
import {deserializeStartParams} from "@/helpers.js";
@@ -46,5 +46,11 @@ export const usePulseStore = defineStore('pulse', {
.catch(() => console.warn('[Pulse] Failed to save Telegram customer data:', error));
}
},
heartbeat() {
heartbeat()
.then(() => console.debug('[Pulse] Heartbeat sent'))
.catch(err => console.warn('[Pulse] Heartbeat failed:', err));
}
},
});

View File

@@ -127,4 +127,8 @@ export async function ingest(data) {
return await ftchPost('ingest', data);
}
export async function heartbeat() {
return await ftch('heartbeat');
}
export default ftch;