// These are real error messages that are used to verify service and version attribution. import { RumEvent, RumEventDomainContext } from '@datadog/browser-rum'; const hostErrorAxiosError400 = { error: { message: 'Request failed with status code 400', stack: ` AxiosError: Request failed with status code 400 at settle @ https://go.servicetitan.com/scripts/build/desktop/log.55e5bb93faab978eaf35.bundle.js?3d68802447462b52b684:2:102209 at XMLHttpRequest.onloadend @ https://go.servicetitan.com/scripts/build/desktop/log.55e5bb93faab978eaf35.bundle.js?3d68802447462b52b684:2:71196 `, }, context: {}, }; const hostErrorFailedToFetchMetadata = { error: { message: 'Failed to fetch: "https://unpkg.servicetitan.com/@servicetitan/global-search-bar/dist/metadata.json".', }, context: { handlingStack: ` Error: at Li @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17756142 at Qi.ye.componentDidCatch.de.callback @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17756694 at sh @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17742258 at kk @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17791244 at ik @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17790779 at hk @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17790255 at Wk @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17801154 at Pk @ https://go.servicetitan.com/scripts/build/desktop/main.f692da9da087afdc5a8e.bundle.js?5813f5881d1fcbafd9db:2:17800452 `, }, }; const mfeErrorComponentDidCatch = { error: { message: ` Request failed with status code 502 URL: https://coolairmechanicalllc-71757.eh.go.servicetitan.com/api/global-search/search `, }, context: { handlingStack: ` Error: at console.e [as error] @ https://edge.fullstory.com/s/fs.js:4:32090 at Li @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:259070 at Qi.f.componentDidCatch.c.callback @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:259583 at sh @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:246367 at kk @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:291027 at ik @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:290595 at ik @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:290492 at ik @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.5f317fc/dist/bundle/light/common.4930800d528fa1ae167c.bundle.js:2:290492 `, }, }; const hostResourceXhrRequest = { resource: { url: 'https://go.servicetitan.com/CoreSettings/GetPermissions?_=1757708219745', }, context: { handlingStack: ` Error: at Object.send @ https://go.servicetitan.com/scripts/build/desktop-legacy/core.a7e0b207b2ca2251a254.bundle.js:2:214394 at ajax @ https://go.servicetitan.com/scripts/build/desktop-legacy/core.a7e0b207b2ca2251a254.bundle.js:2:206941 at jQuery.aroundAjax [as ajax] @ https://go.servicetitan.com/scripts/build/desktop-legacy/app.730fca0be346d7ecd92e.bundle.js:2:4543920 at jQuery.each.jQuery. [as get] @ https://go.servicetitan.com/scripts/build/desktop-legacy/core.a7e0b207b2ca2251a254.bundle.js:2:208902 at activateSettingsBoard @ https://go.servicetitan.com/scripts/build/desktop-legacy/app.730fca0be346d7ecd92e.bundle.js:2:8233677 at context_prototype. @ https://go.servicetitan.com/scripts/build/desktop-legacy/app.730fca0be346d7ecd92e.bundle.js:2:8242958 at nextRoute @ https://go.servicetitan.com/scripts/build/desktop-legacy/core.a7e0b207b2ca2251a254.bundle.js:2:587350 at wrapped_route @ https://go.servicetitan.com/scripts/build/desktop-legacy/core.a7e0b207b2ca2251a254.bundle.js:2:587499 `, }, }; const hostResourceUnpkgRequest = { resource: { url: 'https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/main.a7d8d964f5d244d802a4.bundle.js', }, context: {}, }; const mfeResourceXhrRequest = { resource: { url: 'https://go.servicetitan.com/app/api/data/user' }, context: { handlingStack: ` Error: at dispatchXhrRequest @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/common.5bf0a9999ba3a2165cca.bundle.js:2:157541 at new Promise @ at xhr @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/common.5bf0a9999ba3a2165cca.bundle.js:2:153971 at Axios.dispatchRequest @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/common.5bf0a9999ba3a2165cca.bundle.js:2:166313 at Axios._request @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/common.5bf0a9999ba3a2165cca.bundle.js:2:171799 at Axios.request @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/common.5bf0a9999ba3a2165cca.bundle.js:2:168810 at wrap [as request] @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/common.5bf0a9999ba3a2165cca.bundle.js:2:118354 at UserApi.get @ https://unpkg.servicetitan.com/@servicetitan/global-search-bar@0.0.0-HEAD.c8fa2a6/dist/bundle/light/main.a7d8d964f5d244d802a4.bundle.js:2:582407 `, }, }; type DeepPartial = T extends object ? { [P in keyof T]?: DeepPartial; } : T; export type RumEventType = DeepPartial; export const rumEvents: { event: RumEventType; context?: RumEventDomainContext; title: string; service?: string; version?: string; }[] = [ { event: { type: 'error', error: hostErrorAxiosError400.error, }, context: hostErrorAxiosError400.context, title: 'host request failed with status code 400', service: undefined, version: undefined, }, { event: { type: 'error', error: hostErrorFailedToFetchMetadata.error, }, context: hostErrorFailedToFetchMetadata.context, title: 'host failed to fetch metadata.json', service: 'global-search-bar', version: 'unknown', }, { event: { type: 'error', error: mfeErrorComponentDidCatch.error, }, context: mfeErrorComponentDidCatch.context, title: 'MFE request failed with status code 502', service: 'global-search-bar', version: '0.0.0-HEAD.5f317fc', }, { event: { type: 'resource', resource: hostResourceXhrRequest.resource, }, context: hostResourceXhrRequest.context, title: 'host sends XHR request', service: undefined, version: undefined, }, { event: { type: 'resource', resource: hostResourceUnpkgRequest.resource, }, context: hostResourceUnpkgRequest.context, title: 'host sends request to unpkg', service: 'global-search-bar', version: '0.0.0-HEAD.c8fa2a6', }, { event: { type: 'resource', resource: mfeResourceXhrRequest.resource, }, context: mfeResourceXhrRequest.context, title: 'mfe sends XHR request', service: 'global-search-bar', version: '0.0.0-HEAD.c8fa2a6', }, ];