@@ -221,7 +221,13 @@ export class TsEmbed {
221221 * Throws error encountered during initialization.
222222 */
223223 private throwInitError ( ) {
224- this . handleError ( ERROR_MESSAGE . INIT_SDK_REQUIRED , { errorType : ErrorDetailsTypes . VALIDATION_ERROR , message : ERROR_MESSAGE . INIT_SDK_REQUIRED , code : ERROR_CODE . INIT_ERROR , source : ErrorDetailsSources . SDK , details : { } , } as EmbedErrorDetailsEvent ) ;
224+ this . handleError ( ERROR_MESSAGE . INIT_SDK_REQUIRED , {
225+ errorType : ErrorDetailsTypes . VALIDATION_ERROR ,
226+ message : ERROR_MESSAGE . INIT_SDK_REQUIRED ,
227+ code : ERROR_CODE . INIT_ERROR ,
228+ source : ErrorDetailsSources . SDK ,
229+ details : { } ,
230+ } as EmbedErrorDetailsEvent ) ;
225231 }
226232
227233 /**
@@ -334,7 +340,13 @@ export class TsEmbed {
334340 this . executeCallbacks ( EmbedEvent . Error , {
335341 offlineWarning,
336342 } ) ;
337- const errorDetails = { errorType : ErrorDetailsTypes . NETWORK , message : ERROR_MESSAGE . OFFLINE_WARNING , code : ERROR_CODE . NETWORK_ERROR , source : ErrorDetailsSources . NETWORK , details : { event : e , } } as EmbedErrorDetailsEvent ;
343+ const errorDetails = {
344+ errorType : ErrorDetailsTypes . NETWORK ,
345+ message : ERROR_MESSAGE . OFFLINE_WARNING ,
346+ code : ERROR_CODE . NETWORK_ERROR ,
347+ source : ErrorDetailsSources . NETWORK ,
348+ details : { event : e } ,
349+ } as EmbedErrorDetailsEvent ;
338350 this . executeCallbacks ( EmbedEvent . ErrorDetails , errorDetails ) ;
339351 logger . warn ( errorDetails ) ;
340352 } ;
@@ -450,7 +462,16 @@ export class TsEmbed {
450462 ...( this . embedConfig . customActions || [ ] )
451463 ] ) ;
452464 if ( customActionsResult . errors . length > 0 ) {
453- this . handleError ( { type : ERROR_CODE . CUSTOM_ACTION_VALIDATION , message : customActionsResult . errors } , { errorType : ErrorDetailsTypes . VALIDATION_ERROR , message : customActionsResult . errors , code : ERROR_CODE . CUSTOM_ACTION_VALIDATION , source : ErrorDetailsSources . SDK , details : { } } as EmbedErrorDetailsEvent ) ;
465+ this . handleError (
466+ { type : ERROR_CODE . CUSTOM_ACTION_VALIDATION , message : customActionsResult . errors } ,
467+ {
468+ errorType : ErrorDetailsTypes . VALIDATION_ERROR ,
469+ message : customActionsResult . errors ,
470+ code : ERROR_CODE . CUSTOM_ACTION_VALIDATION ,
471+ source : ErrorDetailsSources . SDK ,
472+ details : { } ,
473+ } as EmbedErrorDetailsEvent ,
474+ ) ;
454475 }
455476 const baseInitData = {
456477 customisations : getCustomisations ( this . embedConfig , this . viewConfig ) ,
@@ -662,12 +683,24 @@ export class TsEmbed {
662683 } ;
663684
664685 if ( Array . isArray ( visibleActions ) && Array . isArray ( hiddenActions ) ) {
665- this . handleError ( ERROR_MESSAGE . CONFLICTING_ACTIONS_CONFIG , { errorType : ErrorDetailsTypes . VALIDATION_ERROR , message : ERROR_MESSAGE . CONFLICTING_ACTIONS_CONFIG , code : ERROR_CODE . CONFLICTING_ACTIONS_CONFIG , source : ErrorDetailsSources . SDK , details : { } } as EmbedErrorDetailsEvent ) ;
686+ this . handleError ( ERROR_MESSAGE . CONFLICTING_ACTIONS_CONFIG , {
687+ errorType : ErrorDetailsTypes . VALIDATION_ERROR ,
688+ message : ERROR_MESSAGE . CONFLICTING_ACTIONS_CONFIG ,
689+ code : ERROR_CODE . CONFLICTING_ACTIONS_CONFIG ,
690+ source : ErrorDetailsSources . SDK ,
691+ details : { } ,
692+ } as EmbedErrorDetailsEvent ) ;
666693 return queryParams ;
667694 }
668695
669696 if ( Array . isArray ( visibleTabs ) && Array . isArray ( hiddenTabs ) ) {
670- this . handleError ( ERROR_MESSAGE . CONFLICTING_TABS_CONFIG , { errorType : ErrorDetailsTypes . VALIDATION_ERROR , message : ERROR_MESSAGE . CONFLICTING_TABS_CONFIG , code : ERROR_CODE . CONFLICTING_TABS_CONFIG , source : ErrorDetailsSources . SDK , details : { } } as EmbedErrorDetailsEvent ) ;
697+ this . handleError ( ERROR_MESSAGE . CONFLICTING_TABS_CONFIG , {
698+ errorType : ErrorDetailsTypes . VALIDATION_ERROR ,
699+ message : ERROR_MESSAGE . CONFLICTING_TABS_CONFIG ,
700+ code : ERROR_CODE . CONFLICTING_TABS_CONFIG ,
701+ source : ErrorDetailsSources . SDK ,
702+ details : { } ,
703+ } as EmbedErrorDetailsEvent ) ;
671704 return queryParams ;
672705 }
673706 if ( primaryAction ) {
@@ -920,7 +953,13 @@ export class TsEmbed {
920953 error : JSON . stringify ( error ) ,
921954 } ) ;
922955 this . handleInsertionIntoDOM ( this . embedConfig . loginFailedMessage ) ;
923- this . handleError ( ERROR_MESSAGE . LOGIN_FAILED , { errorType : ErrorDetailsTypes . API , message : error . message || ERROR_MESSAGE . LOGIN_FAILED , code : ERROR_CODE . LOGIN_FAILED , source : ErrorDetailsSources . SDK , details : { } } as EmbedErrorDetailsEvent ) ;
956+ this . handleError ( ERROR_MESSAGE . LOGIN_FAILED , {
957+ errorType : ErrorDetailsTypes . API ,
958+ message : error . message || ERROR_MESSAGE . LOGIN_FAILED ,
959+ code : ERROR_CODE . LOGIN_FAILED ,
960+ source : ErrorDetailsSources . SDK ,
961+ details : { } ,
962+ } as EmbedErrorDetailsEvent ) ;
924963 } ) ;
925964 } ) ;
926965 }
@@ -1327,12 +1366,24 @@ export class TsEmbed {
13271366 uploadMixpanelEvent ( `${ MIXPANEL_EVENT . VISUAL_SDK_TRIGGER } -${ messageType } ` ) ;
13281367
13291368 if ( ! this . isRendered ) {
1330- this . handleError ( ERROR_MESSAGE . RENDER_BEFORE_EVENTS_REQUIRED , { errorType : ErrorDetailsTypes . VALIDATION_ERROR , message : ERROR_MESSAGE . RENDER_BEFORE_EVENTS_REQUIRED , code : ERROR_CODE . RENDER_NOT_CALLED , source : ErrorDetailsSources . SDK , details : { } } as EmbedErrorDetailsEvent ) ;
1369+ this . handleError ( ERROR_MESSAGE . RENDER_BEFORE_EVENTS_REQUIRED , {
1370+ errorType : ErrorDetailsTypes . VALIDATION_ERROR ,
1371+ message : ERROR_MESSAGE . RENDER_BEFORE_EVENTS_REQUIRED ,
1372+ code : ERROR_CODE . RENDER_NOT_CALLED ,
1373+ source : ErrorDetailsSources . SDK ,
1374+ details : { } ,
1375+ } as EmbedErrorDetailsEvent ) ;
13311376 return null ;
13321377 }
13331378
13341379 if ( ! messageType ) {
1335- this . handleError ( ERROR_MESSAGE . HOST_EVENT_TYPE_UNDEFINED , { errorType : ErrorDetailsTypes . VALIDATION_ERROR , message : ERROR_MESSAGE . HOST_EVENT_TYPE_UNDEFINED , code : ERROR_CODE . HOST_EVENT_TYPE_UNDEFINED , source : ErrorDetailsSources . SDK , details : { } } as EmbedErrorDetailsEvent ) ;
1380+ this . handleError ( ERROR_MESSAGE . HOST_EVENT_TYPE_UNDEFINED , {
1381+ errorType : ErrorDetailsTypes . VALIDATION_ERROR ,
1382+ message : ERROR_MESSAGE . HOST_EVENT_TYPE_UNDEFINED ,
1383+ code : ERROR_CODE . HOST_EVENT_TYPE_UNDEFINED ,
1384+ source : ErrorDetailsSources . SDK ,
1385+ details : { } ,
1386+ } as EmbedErrorDetailsEvent ) ;
13361387 return null ;
13371388 }
13381389
0 commit comments