TP-22476 | Clickstream events fix | Aman C (#179)

This commit is contained in:
Aman Chaturvedi
2023-03-24 10:51:33 +05:30
committed by GitHub Enterprise
parent 08831f75ad
commit b9ae0c53a2
5 changed files with 20 additions and 7 deletions

View File

@@ -36,7 +36,17 @@ export const ClickstreamAPIToMonitor = {
[API_URLS[ApiKeys.GENERATE_OTP]]: 'AV_LOGIN_SCREEN_SEND_OTP_API',
[API_URLS[ApiKeys.VERIFY_OTP]]: 'AV_OTP_SCREEN_VERIFY_OTP_API',
[API_URLS[ApiKeys.LOGOUT]]: 'AV_PROFILE_PAGE_LOGOUT_API',
[API_URLS[ApiKeys.FEEDBACK]]: 'AV_FORM_SUBMIT_API'
[API_URLS[ApiKeys.FEEDBACK]]: 'AV_FORM_SUBMIT_API',
[API_URLS[ApiKeys.PINNED_CASES]]: 'AV_PINNED_CASES_API',
[API_URLS[ApiKeys.FILTERS]]: 'AV_FILTERS_API',
[API_URLS[ApiKeys.JANUS]]: 'AV_JANUS_API',
[API_URLS[ApiKeys.GENERATE_PAYMENT_LINK]]: 'AV_GENERATE_PAYMENT_LINK_API',
[API_URLS[ApiKeys.ADDRESSES_GEOLOCATION]]: 'AV_ADDRESSES_GEOLOCATION_API',
[API_URLS[ApiKeys.NEW_ADDRESS]]: 'AV_NEW_ADDRESS_API',
[API_URLS[ApiKeys.GET_SIGNED_URL]]: 'AV_GET_SIGNED_URL_API',
[API_URLS[ApiKeys.CASE_UNIFIED_DETAILS]]: 'AV_CASE_UNIFIED_DETAILS_API',
[API_URLS[ApiKeys.EMI_SCHEDULES]]: 'AV_EMI_SCHEDULES_API',
[API_URLS[ApiKeys.PAST_FEEDBACK]]: 'AV_PAST_FEEDBACK_API',
};
export const CLICKSTREAM_EVENT_NAMES = {

View File

@@ -58,7 +58,7 @@ export const addClickstreamEvent = async (
deviceId,
agentId,
attributes: eventAttributes,
timestamp: new Date().toUTCString(),
timestamp: new Date().getTime(),
networkStatus,
});
addEvent(networkStatus);
@@ -74,7 +74,10 @@ const getPayload = (events: IClickstreamEvent[]) => {
deviceId,
},
client_ts: new Date().getTime(),
source: APP_NAME
source: APP_NAME,
user: {
customer_id: agentId
}
};
};

View File

@@ -8,7 +8,7 @@ const clickStreamEvents = database.get(TableName.CLICKSTREAM_EVENTS);
export interface IClickstreamEvent {
event_name: string;
description: string;
timestamp: string;
timestamp: number;
agentId: string;
deviceId: string;
attributes?: unknown;
@@ -19,7 +19,7 @@ export default {
observeOfflineImage: () => clickStreamEvents.query().observe(),
addEvent: async (
event_name: string,
timestamp: string,
timestamp: number,
description: string,
agentId: string,
deviceId: string,

View File

@@ -12,6 +12,6 @@ export default class ClickstreamEvents extends Model {
@field('agent_id') agentId!: string;
@field('device_id') deviceId!: string;
@field('network_status') networkStatus!: string;
@field('timestamp') timestamp!: string;
@field('timestamp') timestamp!: number;
@json('attributes', sanitizeAttributes) attributes: any;
}

View File

@@ -28,7 +28,7 @@ export default appSchema({
{ name: 'device_id', type: 'string' },
{ name: 'attributes', type: 'string' },
{ name: 'network_status', type: 'string' },
{ name: 'timestamp', type: 'string' },
{ name: 'timestamp', type: 'number' },
],
}),
],