feat: Add TeleCart Pulse heartbeat telemetry
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user