From 40a4c63dd7e1dfc4ed20b117e3a85aef313d0917 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Wed, 9 Oct 2024 12:54:18 +0530 Subject: [PATCH] NTP-7181 | SWW logging added --- App.tsx | 4 ++++ src/common/Constants.ts | 9 +++++++++ src/components/utlis/apiHelper.ts | 12 ++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/App.tsx b/App.tsx index 40db284c..5f1ec834 100644 --- a/App.tsx +++ b/App.tsx @@ -124,6 +124,10 @@ function App() { case codePush.SyncStatus.UP_TO_DATE: modalRef.current?.hide(); break; + case codePush.SyncStatus.UNKNOWN_ERROR: + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_CODEPUSH_UNKNOWN_ERROR, {}); + modalRef.current?.hide(); + break; default: addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_CODEPUSH_DEFAULT_STATUS, {}); modalRef.current?.hide(); diff --git a/src/common/Constants.ts b/src/common/Constants.ts index 7df85363..33a28f7e 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -1301,6 +1301,10 @@ export const CLICKSTREAM_EVENT_NAMES = { name : 'FA_CODEPUSH_DEFAULT_STATUS', description: 'Codepush default fallback case' }, + FA_CODEPUSH_UNKNOWN_ERROR: { + name : 'FA_CODEPUSH_UNKNOWN_ERROR', + description: 'Codepush unknown error' + }, FA_FEEDBACK_IMAGE_NOT_FOUND: { name: 'FA_FEEDBACK_IMAGE_NOT_FOUND', description: 'Feedback image not found' @@ -1309,6 +1313,11 @@ export const CLICKSTREAM_EVENT_NAMES = { name: 'FA_UNSYNC_FEEDBACK_CAPTURED', description: 'Unsync feedback captured' }, + + FA_API_FAILED: { + name: 'FA_API_FAILED', + description: 'API failed' + }, } as const; export enum MimeType { diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index b2d3d5ad..728770f5 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -6,10 +6,14 @@ import { GLOBAL } from '../../constants/Global'; import { _map, compareUrl } from '../../../RN-UI-LIB/src/utlis/common'; import { BASE_AV_APP_URL } from '../../constants/config'; import { logError } from './errorUtils'; -import { sendApiToClickstreamEvent } from '../../services/clickstreamEventService'; +import { + addClickstreamEvent, + sendApiToClickstreamEvent, +} from '../../services/clickstreamEventService'; import { handleLogout } from '../../action/authActions'; import { API_ERROR_MESSAGE, + CLICKSTREAM_EVENT_NAMES, REQUEST_TO_UNBLOCK_FOR_IMPERSONATION, REQUEST_TYPE_TO_BLOCK_FOR_IMPERSONATION, } from '../../common/Constants'; @@ -97,7 +101,7 @@ export enum ApiKeys { GENERATE_DYNAMIC_DOCUMENT = 'GENERATE_DYNAMIC_DOCUMENT', DOWNLOAD_LATEST_APP = 'DOWNLOAD_LATEST_APP', GET_SIGNED_URL_V2 = 'GET_SIGNED_URL_V2', - GET_SIGNED_URL_FOR_REPORTEE_V2 = 'GET_SIGNED_URL_FOR_REPORTEE_V2' + GET_SIGNED_URL_FOR_REPORTEE_V2 = 'GET_SIGNED_URL_FOR_REPORTEE_V2', } export const API_URLS: Record = {} as Record; @@ -317,6 +321,10 @@ axiosInstance.interceptors.response.use( const end = Date.now(); const milliseconds = end - Number(start); sendApiToClickstreamEvent(response, milliseconds, false); + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_API_FAILED, { + statusCode: response?.status, + url: response?.config?.url, + }); const donotHandleErrorOnStatusCode = (config.headers.donotHandleErrorOnStatusCode || []).map( Number );