@medipass/utils 12.0.5-feat-sentry-reform.1 → 12.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sentry.d.ts CHANGED
@@ -4,8 +4,8 @@ import * as Sentry from "@sentry/react";
4
4
  declare const HIGH_CARDINALITY_CONTEXT_KEYS: readonly ["accountId", "appId", "businessId", "claimId", "futureId", "patientId", "paymentId", "staffId", "transactionId"];
5
5
  declare const STANDARD_TAG_KEYS: readonly ["app", "environment", "error_code", "flow", "funder", "is_sdk", "is_standalone", "operation", "outcome", "status_code", "surface"];
6
6
  type SentryPrimitive = string | number | boolean | null | undefined;
7
- type HighCardinalityContextKey = (typeof HIGH_CARDINALITY_CONTEXT_KEYS)[number];
8
- type StandardTagKey = (typeof STANDARD_TAG_KEYS)[number];
7
+ type HighCardinalityContextKey = typeof HIGH_CARDINALITY_CONTEXT_KEYS[number];
8
+ type StandardTagKey = typeof STANDARD_TAG_KEYS[number];
9
9
  type SentryTags = Record<string, SentryPrimitive>;
10
10
  type FlowEventTags = Partial<Record<HighCardinalityContextKey | StandardTagKey, SentryPrimitive>>;
11
11
  type SentryContext = Record<string, unknown>;
package/dist/sentry.js CHANGED
@@ -66,6 +66,7 @@ const STANDARD_TAG_KEYS = [
66
66
  "status_code",
67
67
  "surface"
68
68
  ];
69
+ const USER_CONTEXT_KEYS = ["businessId", "staffId"];
69
70
  const idsContext = {};
70
71
  const userContext = {};
71
72
  const NORMALISED_SENSITIVE_KEYS = new Set([...EXTRA_SENSITIVE_KEYS, ...EXTRA_SENSITIVE_HEADER_KEYS].map(normaliseSensitiveKey));
@@ -83,14 +84,40 @@ function clearContext(context) {
83
84
  delete context[key];
84
85
  });
85
86
  }
87
+ function syncIdsContext() {
88
+ if (Object.keys(idsContext).length === 0) {
89
+ Sentry.setContext("ids", null);
90
+ return;
91
+ }
92
+ Sentry.setContext("ids", sanitiseValue(idsContext));
93
+ }
94
+ function setIdContextValue(key, value) {
95
+ const tagValue = normaliseTagValue(value);
96
+ if (tagValue === void 0) {
97
+ delete idsContext[key];
98
+ return;
99
+ }
100
+ idsContext[key] = tagValue;
101
+ }
86
102
  function getUserAccountId(user) {
87
103
  return user.accountId ?? user.id ?? user._id;
88
104
  }
105
+ function hasUserIdentity(user) {
106
+ return hasOwnKey(user, "id") || hasOwnKey(user, "_id") || hasOwnKey(user, "accountId");
107
+ }
89
108
  function hasOwnKey(object, key) {
90
109
  return Object.prototype.hasOwnProperty.call(object, key);
91
110
  }
111
+ function hasConfigKey(error, key) {
112
+ return Boolean(error.config && hasOwnKey(error.config, key));
113
+ }
92
114
  function normaliseTagValue(value) {
93
115
  if (value === null || value === void 0) return;
116
+ if (![
117
+ "boolean",
118
+ "number",
119
+ "string"
120
+ ].includes(typeof value)) return;
94
121
  return String(value);
95
122
  }
96
123
  function maskCaseInsensitiveSensitiveKeys(value) {
@@ -129,11 +156,13 @@ function isExpectedError(error) {
129
156
  function sanitiseError(error) {
130
157
  if (!(error instanceof Error)) return sanitiseValue(error);
131
158
  let sanitisedError = cloneError(error);
132
- const errorHeaders = sanitisedError?.config?.headers;
133
- const maskedErrorHeaders = sanitiseValue(errorHeaders);
134
- sanitisedError = _set(sanitisedError, "config.headers", maskedErrorHeaders);
135
- try {
136
- const errorData = sanitisedError?.config?.data;
159
+ const errorHeaders = sanitisedError.config?.headers;
160
+ if (hasConfigKey(sanitisedError, "headers") && errorHeaders !== void 0) {
161
+ const maskedErrorHeaders = sanitiseValue(errorHeaders);
162
+ sanitisedError = _set(sanitisedError, "config.headers", maskedErrorHeaders);
163
+ }
164
+ if (hasConfigKey(sanitisedError, "data") && sanitisedError.config?.data !== void 0) try {
165
+ const errorData = sanitisedError.config.data;
137
166
  const maskedErrorData = sanitiseValue(typeof errorData === "string" ? JSON.parse(errorData) : errorData);
138
167
  sanitisedError = _set(sanitisedError, "config.data", JSON.stringify(maskedErrorData));
139
168
  } catch (err) {
@@ -169,7 +198,10 @@ function applyScopeData(scope, options = {}) {
169
198
  const tagValue = normaliseTagValue(value);
170
199
  if (tagValue !== void 0) scope.setTag(key, tagValue);
171
200
  });
172
- if (Object.keys(highCardinalityContext).length > 0) scope.setContext("ids", sanitiseValue(highCardinalityContext));
201
+ if (Object.keys(highCardinalityContext).length > 0) scope.setContext("ids", sanitiseValue({
202
+ ...idsContext,
203
+ ...highCardinalityContext
204
+ }));
173
205
  Object.entries(contexts).forEach(([key, context]) => {
174
206
  scope.setContext(key, sanitiseValue(context));
175
207
  });
@@ -232,9 +264,9 @@ const addBreadcrumb = (breadcrumb) => Sentry.addBreadcrumb({
232
264
  });
233
265
  const setTag = (key, value) => {
234
266
  const tagValue = normaliseTagValue(value);
235
- if (tagValue !== void 0 && isHighCardinalityContextKey(key)) {
236
- idsContext[key] = tagValue;
237
- Sentry.setContext("ids", sanitiseValue(idsContext));
267
+ if (isHighCardinalityContextKey(key)) {
268
+ setIdContextValue(key, value);
269
+ syncIdsContext();
238
270
  return;
239
271
  }
240
272
  if (tagValue !== void 0) Sentry.setTag(key, tagValue);
@@ -249,12 +281,26 @@ const setUserContext = (user = {}) => {
249
281
  clearUserContext();
250
282
  return;
251
283
  }
252
- if (hasOwnKey(user, "id") || hasOwnKey(user, "_id") || hasOwnKey(user, "accountId")) userContext.accountId = getUserAccountId(user);
253
- ["businessId", "staffId"].forEach((key) => {
254
- if (hasOwnKey(user, key)) userContext[key] = user[key];
284
+ const nextAccountId = getUserAccountId(user);
285
+ const userHasIdentity = hasUserIdentity(user);
286
+ if (userHasIdentity && userContext.accountId !== void 0 && nextAccountId !== userContext.accountId) {
287
+ clearContext(userContext);
288
+ clearContext(idsContext);
289
+ syncIdsContext();
290
+ }
291
+ if (userHasIdentity) userContext.accountId = nextAccountId;
292
+ let hasIdContextUpdate = false;
293
+ USER_CONTEXT_KEYS.forEach((key) => {
294
+ if (hasOwnKey(user, key)) {
295
+ userContext[key] = user[key];
296
+ setIdContextValue(key, user[key]);
297
+ hasIdContextUpdate = true;
298
+ }
255
299
  });
300
+ if (hasIdContextUpdate) syncIdsContext();
256
301
  const id = userContext.accountId;
257
302
  if (id) Sentry.setUser({ id: String(id) });
303
+ else Sentry.setUser(null);
258
304
  Sentry.setContext("user", sanitiseValue({
259
305
  accountId: userContext.accountId || id,
260
306
  businessId: userContext.businessId,
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.js","names":["sensitiveKeys","idsContext: SentryContext","userContext: SentryContext","masked","highCardinalityContext: SentryContext","sentryError","integrations: Array<\n ReturnType<typeof Sentry.browserTracingIntegration> | ReturnType<typeof Sentry.replayIntegration>\n >"],"sources":["../src/sentry.ts"],"sourcesContent":["import * as Sentry from '@sentry/react';\nimport _get from 'lodash/get.js';\nimport _set from 'lodash/set.js';\nimport type { AnyAction } from 'redux';\nimport masked from './masked';\nimport { getProcessEnv } from './process-env';\nimport sensitiveKeys from './sensitive-keys';\n\nconst ERROR_CODES = {\n INVALID_AUTHENTICATION: 10007\n};\n\nconst ERROR_MESSAGES = {\n NETWORK_ERROR: 'Network Error'\n};\n\nconst STATUS_CODES = {\n UNAUTHORIZED: 401\n};\n\nconst MASKED_VALUE = '********';\n\nconst HIGH_CARDINALITY_CONTEXT_KEYS = [\n 'accountId',\n 'appId',\n 'businessId',\n 'claimId',\n 'futureId',\n 'patientId',\n 'paymentId',\n 'staffId',\n 'transactionId'\n] as const;\n\nconst EXTRA_SENSITIVE_KEYS = [\n ...sensitiveKeys,\n 'accountNumber',\n 'apiKey',\n 'authToken',\n 'bankAccount',\n 'bankAccountNumber',\n 'bearer',\n 'card',\n 'cardNumber',\n 'cardRank',\n 'cvv',\n 'fundAccountNumber',\n 'idToken',\n 'memberId',\n 'nonce',\n 'pan',\n 'paymentMethod',\n 'requestBody',\n 'secret',\n 'sessionToken'\n];\n\nconst EXTRA_SENSITIVE_HEADER_KEYS = [\n 'api-key',\n 'authorization',\n 'proxy-authorization',\n 'x-api-key',\n 'x-auth-token',\n 'x-authorization',\n 'x-id-token',\n 'x-session-token'\n];\n\nconst STANDARD_TAG_KEYS = [\n 'app',\n 'environment',\n 'error_code',\n 'flow',\n 'funder',\n 'is_sdk',\n 'is_standalone',\n 'operation',\n 'outcome',\n 'status_code',\n 'surface'\n] as const;\n\ntype SentryPrimitive = string | number | boolean | null | undefined;\ntype HighCardinalityContextKey = (typeof HIGH_CARDINALITY_CONTEXT_KEYS)[number];\ntype StandardTagKey = (typeof STANDARD_TAG_KEYS)[number];\ntype SentryTags = Record<string, SentryPrimitive>;\ntype FlowEventTags = Partial<Record<HighCardinalityContextKey | StandardTagKey, SentryPrimitive>>;\ntype SentryContext = Record<string, unknown>;\n\ntype ErrorWithConfig = Error & {\n config?: {\n data?: unknown;\n headers?: Record<string, unknown>;\n url?: string;\n };\n data?: {\n errorCode?: number;\n message?: string;\n statusCode?: number;\n };\n status?: number;\n};\n\nexport type SentrySetupOptions = {\n app?: string;\n beforeSend?: Sentry.BrowserOptions['beforeSend'];\n debug?: boolean;\n dsn?: string;\n enableLogs?: boolean;\n enabled?: boolean;\n environment?: string;\n release?: string;\n replayErrorSampleRate?: number;\n replaySessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n replaysSessionSampleRate?: number;\n tracePropagationTargets?: Sentry.BrowserOptions['tracePropagationTargets'];\n tracesSampleRate?: number;\n tunnel?: string;\n url?: string;\n version?: string;\n};\n\nexport type CaptureErrorOptions = {\n contexts?: Record<string, SentryContext>;\n data?: SentryContext;\n fingerprint?: string[];\n ignoreExpected?: boolean;\n level?: Sentry.SeverityLevel;\n name?: string;\n tags?: SentryTags;\n};\n\nexport type CaptureMessageOptions = Omit<CaptureErrorOptions, 'name'>;\n\nexport type CaptureFlowEventOptions = {\n context?: SentryContext;\n contexts?: Record<string, SentryContext>;\n data?: SentryContext;\n errorCode?: string | number;\n error?: unknown;\n extra?: SentryContext;\n fingerprint?: string[];\n flow: string;\n funder?: string;\n isSdk?: boolean;\n isStandalone?: boolean;\n level?: Sentry.SeverityLevel;\n message?: string;\n operation: string;\n outcome: 'cancelled' | 'failure' | 'info' | 'success' | 'validation' | 'warning';\n statusCode?: string | number;\n surface?: string;\n tags?: FlowEventTags;\n};\n\nconst idsContext: SentryContext = {};\nconst userContext: SentryContext = {};\nconst NORMALISED_SENSITIVE_KEYS = new Set(\n [...EXTRA_SENSITIVE_KEYS, ...EXTRA_SENSITIVE_HEADER_KEYS].map(normaliseSensitiveKey)\n);\n\nfunction normaliseSensitiveKey(key: string) {\n return key.replace(/[^a-z0-9]/gi, '').toLowerCase();\n}\n\nfunction isSensitiveKey(key: string) {\n return NORMALISED_SENSITIVE_KEYS.has(normaliseSensitiveKey(key));\n}\n\nfunction isHighCardinalityContextKey(key: string): key is HighCardinalityContextKey {\n return (HIGH_CARDINALITY_CONTEXT_KEYS as readonly string[]).includes(key);\n}\n\nfunction clearContext(context: SentryContext) {\n Object.keys(context).forEach(key => {\n delete context[key];\n });\n}\n\nfunction getUserAccountId(user: Record<string, unknown>) {\n return user.accountId ?? user.id ?? user._id;\n}\n\nfunction hasOwnKey(object: Record<string, unknown>, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction normaliseTagValue(value: SentryPrimitive) {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n return String(value);\n}\n\nfunction maskCaseInsensitiveSensitiveKeys<T>(value: T): T {\n if (value === null || typeof value !== 'object') {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(item => maskCaseInsensitiveSensitiveKeys(item)) as T;\n }\n\n return Object.entries(value as Record<string, unknown>).reduce<Record<string, unknown>>(\n (nextValue, [key, item]) => {\n nextValue[key] = isSensitiveKey(key) ? MASKED_VALUE : maskCaseInsensitiveSensitiveKeys(item);\n return nextValue;\n },\n {}\n ) as T;\n}\n\nfunction sanitiseValue<T>(value: T): T {\n return maskCaseInsensitiveSensitiveKeys(masked(value as Record<string, any>, EXTRA_SENSITIVE_KEYS) as T);\n}\n\nfunction stripUrlQuery(url?: string) {\n if (!url || typeof url !== 'string') {\n return url;\n }\n\n try {\n const parsedUrl = new URL(url, window.location.origin);\n parsedUrl.search = '';\n parsedUrl.hash = '';\n return parsedUrl.toString();\n } catch (err) {\n return url.split('?')[0].split('#')[0];\n }\n}\n\nfunction getStatusCode(error: unknown) {\n return (\n _get(error, 'status') ||\n _get(error, 'data.statusCode') ||\n _get(error, 'response.status') ||\n _get(error, 'config.status')\n );\n}\n\nfunction getErrorCode(error: unknown) {\n return _get(error, 'data.errorCode') || _get(error, 'response.data.errorCode');\n}\n\nfunction isExpectedError(error: unknown) {\n const statusCode = getStatusCode(error);\n const errorCode = getErrorCode(error);\n\n return (\n getProcessEnv().NODE_ENV === 'test' ||\n _get(error, 'message') === ERROR_MESSAGES.NETWORK_ERROR ||\n statusCode === STATUS_CODES.UNAUTHORIZED ||\n errorCode === ERROR_CODES.INVALID_AUTHENTICATION\n );\n}\n\nfunction sanitiseError<T extends unknown>(error: T): T {\n if (!(error instanceof Error)) {\n return sanitiseValue(error);\n }\n\n let sanitisedError = cloneError(error as ErrorWithConfig);\n const errorHeaders = sanitisedError?.config?.headers;\n const maskedErrorHeaders = sanitiseValue(errorHeaders);\n sanitisedError = _set(sanitisedError, 'config.headers', maskedErrorHeaders);\n\n try {\n const errorData = sanitisedError?.config?.data;\n const maskedErrorData = sanitiseValue(\n typeof errorData === 'string' ? JSON.parse(errorData) : (errorData as Record<string, unknown>)\n );\n sanitisedError = _set(sanitisedError, 'config.data', JSON.stringify(maskedErrorData));\n } catch (err) {\n sanitisedError = _set(sanitisedError, 'config.data', undefined);\n }\n\n if (sanitisedError?.config?.url) {\n sanitisedError = _set(sanitisedError, 'config.url', stripUrlQuery(sanitisedError.config.url));\n }\n\n return sanitisedError as T;\n}\n\nfunction cloneError(error: ErrorWithConfig): ErrorWithConfig {\n const clonedError = new Error(error.message) as ErrorWithConfig & { cause?: unknown };\n const config = error.config\n ? {\n ...error.config,\n headers: error.config.headers ? { ...error.config.headers } : error.config.headers\n }\n : error.config;\n\n Object.assign(clonedError, error, {\n config,\n data: error.data ? { ...error.data } : error.data\n });\n clonedError.name = error.name;\n clonedError.message = error.message;\n clonedError.stack = error.stack;\n\n if ('cause' in error) {\n clonedError.cause = (error as Error & { cause?: unknown }).cause;\n }\n\n return clonedError;\n}\n\nfunction applyScopeData(scope: Sentry.Scope, options: CaptureErrorOptions = {}) {\n const { contexts = {}, data, fingerprint, level, tags = {} } = options;\n const highCardinalityContext: SentryContext = {};\n\n Object.entries(tags).forEach(([key, value]) => {\n if (isHighCardinalityContextKey(key)) {\n highCardinalityContext[key] = value;\n return;\n }\n\n const tagValue = normaliseTagValue(value);\n\n if (tagValue !== undefined) {\n scope.setTag(key, tagValue);\n }\n });\n\n if (Object.keys(highCardinalityContext).length > 0) {\n scope.setContext('ids', sanitiseValue(highCardinalityContext));\n }\n\n Object.entries(contexts).forEach(([key, context]) => {\n scope.setContext(key, sanitiseValue(context));\n });\n\n if (data) {\n scope.setExtra('data', sanitiseValue(data));\n }\n\n if (level) {\n scope.setLevel(level);\n }\n\n if (fingerprint) {\n scope.setFingerprint(fingerprint);\n }\n}\n\nfunction createErrorFromUnknown(error: unknown, name?: string) {\n if (error instanceof Error) {\n const sentryError = cloneError(error as ErrorWithConfig);\n\n if (name) {\n sentryError.name = name;\n }\n\n return sentryError;\n }\n\n const message = _get(error, 'data.message') || _get(error, 'message') || 'Unknown error';\n const sentryError = new Error(String(message));\n\n if (name) {\n sentryError.name = name;\n }\n\n return sentryError;\n}\n\nfunction sanitiseEvent<T extends Sentry.Event>(event: T): T {\n const sanitisedEvent = sanitiseValue({ ...event }) as T;\n\n if (sanitisedEvent.request?.url) {\n sanitisedEvent.request.url = stripUrlQuery(sanitisedEvent.request.url);\n }\n\n if (sanitisedEvent.breadcrumbs) {\n sanitisedEvent.breadcrumbs = sanitisedEvent.breadcrumbs.map(breadcrumb => ({\n ...breadcrumb,\n data: sanitiseValue(breadcrumb.data || {})\n }));\n }\n\n return sanitisedEvent;\n}\n\nfunction createIntegrations(options: SentrySetupOptions) {\n const integrations: Array<\n ReturnType<typeof Sentry.browserTracingIntegration> | ReturnType<typeof Sentry.replayIntegration>\n > = [];\n\n if ((options.tracesSampleRate || 0) > 0) {\n integrations.push(Sentry.browserTracingIntegration());\n }\n\n if ((options.replaysOnErrorSampleRate || 0) > 0 || (options.replaysSessionSampleRate || 0) > 0) {\n integrations.push(\n Sentry.replayIntegration({\n blockAllMedia: true,\n maskAllInputs: true,\n maskAllText: true\n })\n );\n }\n\n return integrations;\n}\n\nexport const clearUserContext = () => {\n clearContext(idsContext);\n clearContext(userContext);\n Sentry.setUser(null);\n Sentry.setContext('user', null);\n Sentry.setContext('ids', null);\n};\n\nexport const createReduxEnhancer = () =>\n Sentry.createReduxEnhancer({\n actionTransformer: (action: AnyAction) => sanitiseValue(action) as AnyAction,\n stateTransformer: (state: unknown) => sanitiseValue(state as Record<string, any>)\n });\n\nexport const createReduxMiddleware = () => () => (next: (action: unknown) => unknown) => (action: unknown) => {\n Sentry.addBreadcrumb({\n category: 'redux.action',\n data: sanitiseValue({ action }),\n level: 'info'\n });\n\n return next(action);\n};\n\nexport const addBreadcrumb = (breadcrumb: Sentry.Breadcrumb) =>\n Sentry.addBreadcrumb({\n ...breadcrumb,\n data: sanitiseValue(breadcrumb.data || {})\n });\n\nexport const setTag = (key: string, value: SentryPrimitive) => {\n const tagValue = normaliseTagValue(value);\n\n if (tagValue !== undefined && isHighCardinalityContextKey(key)) {\n idsContext[key] = tagValue;\n Sentry.setContext('ids', sanitiseValue(idsContext));\n return;\n }\n\n if (tagValue !== undefined) {\n Sentry.setTag(key, tagValue);\n }\n};\n\nexport const setTags = (tags: SentryTags = {}) => {\n Object.entries(tags).forEach(([key, value]) => {\n setTag(key, value);\n });\n};\n\nexport const setUserContext = (user: Record<string, unknown> = {}) => {\n if (Object.keys(user).length === 0) {\n clearUserContext();\n return;\n }\n\n if (hasOwnKey(user, 'id') || hasOwnKey(user, '_id') || hasOwnKey(user, 'accountId')) {\n userContext.accountId = getUserAccountId(user);\n }\n\n ['businessId', 'staffId'].forEach(key => {\n if (hasOwnKey(user, key)) {\n userContext[key] = user[key];\n }\n });\n\n const id = userContext.accountId;\n\n if (id) {\n Sentry.setUser({ id: String(id) });\n }\n\n Sentry.setContext(\n 'user',\n sanitiseValue({\n accountId: userContext.accountId || id,\n businessId: userContext.businessId,\n staffId: userContext.staffId\n })\n );\n};\n\nexport const captureError = (error: unknown, options: CaptureErrorOptions = {}) => {\n if (options.ignoreExpected !== false && isExpectedError(error)) {\n return null;\n }\n\n const sanitisedError = sanitiseError(error);\n const statusCode = getStatusCode(error);\n const errorCode = getErrorCode(error);\n\n Sentry.withScope(scope => {\n scope.setExtra('error', sanitiseValue(sanitisedError));\n applyScopeData(scope, {\n ...options,\n tags: {\n ...options.tags,\n ...(statusCode ? { status_code: statusCode } : {}),\n ...(errorCode ? { error_code: errorCode } : {})\n }\n });\n\n Sentry.captureException(createErrorFromUnknown(sanitisedError, options.name));\n });\n\n console.error(sanitisedError);\n};\n\nexport const logError = (\n error: unknown,\n {\n data,\n name\n }: {\n data?: SentryContext;\n name?: string;\n } = {}\n) => captureError(error, { data, name });\n\nexport const captureMessage = (message: string, options: CaptureMessageOptions = {}) => {\n Sentry.withScope(scope => {\n applyScopeData(scope, options);\n Sentry.captureMessage(message, options.level);\n });\n};\n\nexport const captureFlowEvent = ({\n context,\n contexts,\n data,\n errorCode,\n error,\n extra,\n fingerprint,\n flow,\n funder,\n isSdk,\n isStandalone,\n level,\n message,\n operation,\n outcome,\n statusCode,\n surface,\n tags = {}\n}: CaptureFlowEventOptions) => {\n const { customTags, standardTags } = splitFlowEventTags(tags);\n\n const nextTags = {\n ...standardTags,\n flow,\n ...(funder && { funder }),\n ...(isSdk !== undefined && { is_sdk: isSdk }),\n ...(isStandalone !== undefined && { is_standalone: isStandalone }),\n operation,\n outcome,\n ...(statusCode && { status_code: statusCode }),\n ...(errorCode && { error_code: errorCode }),\n ...(surface && { surface })\n };\n const nextFingerprint = fingerprint || ['flow-event', flow, operation, outcome];\n const eventMessage = message || `${flow}.${operation}.${outcome}`;\n const nextContexts = {\n ...contexts,\n ...(Object.keys(customTags).length > 0 && { custom_tags: customTags }),\n ...(context && { context })\n };\n const nextData = mergeSentryData(data, extra);\n\n addBreadcrumb({\n category: 'flow',\n data: {\n errorCode: errorCode || (error ? getErrorCode(error) : undefined),\n flow,\n operation,\n outcome,\n statusCode: statusCode || (error ? getStatusCode(error) : undefined)\n },\n level: outcome === 'failure' ? 'error' : outcome === 'warning' || outcome === 'validation' ? 'warning' : 'info',\n message: eventMessage\n });\n\n if (error) {\n return captureError(error, {\n contexts: nextContexts,\n data: nextData,\n fingerprint: nextFingerprint,\n ignoreExpected: outcome !== 'validation' && outcome !== 'warning',\n level: level || (outcome === 'validation' || outcome === 'warning' ? 'warning' : 'error'),\n name: eventMessage,\n tags: nextTags\n });\n }\n\n return captureMessage(eventMessage, {\n contexts: nextContexts,\n data: nextData,\n fingerprint: nextFingerprint,\n level:\n level ||\n (outcome === 'failure' ? 'error' : outcome === 'warning' || outcome === 'validation' ? 'warning' : 'info'),\n tags: nextTags\n });\n};\n\nfunction splitFlowEventTags(tags: FlowEventTags | SentryTags) {\n return Object.entries(tags).reduce<{ customTags: SentryContext; standardTags: SentryTags }>(\n (nextTags, [key, value]) => {\n if (isFlowEventTagKey(key)) {\n nextTags.standardTags[key] = value;\n } else {\n nextTags.customTags[key] = value;\n }\n\n return nextTags;\n },\n { customTags: {}, standardTags: {} }\n );\n}\n\nfunction isFlowEventTagKey(key: string) {\n return (STANDARD_TAG_KEYS as readonly string[]).includes(key) || isHighCardinalityContextKey(key);\n}\n\nfunction mergeSentryData(data?: SentryContext, extra?: SentryContext) {\n if (data && extra) {\n return {\n ...data,\n ...extra\n };\n }\n\n return extra || data;\n}\n\nexport const setup = ({\n app,\n beforeSend,\n debug,\n dsn,\n enableLogs,\n enabled,\n environment,\n release,\n replayErrorSampleRate,\n replaySessionSampleRate,\n replaysOnErrorSampleRate = 0,\n replaysSessionSampleRate = 0,\n tracePropagationTargets,\n tracesSampleRate = 0,\n tunnel,\n url,\n version\n}: SentrySetupOptions = {}) => {\n const replayOnErrorSampleRate = replayErrorSampleRate ?? replaysOnErrorSampleRate;\n const replaySampleRate = replaySessionSampleRate ?? replaysSessionSampleRate;\n const processEnv = getProcessEnv();\n const isLocalHost =\n typeof window !== 'undefined' && ['localhost', '127.0.0.1'].includes(window.location.hostname || '');\n const isEnabled = enabled ?? (!isLocalHost && processEnv.NODE_ENV !== 'test' && processEnv.DISABLE_SENTRY !== 'true');\n\n Sentry.init({\n beforeSend: (event, hint) => {\n const sanitisedEvent = sanitiseEvent(event);\n\n if (beforeSend) {\n return beforeSend(sanitisedEvent, hint);\n }\n\n return sanitisedEvent;\n },\n debug,\n dsn: dsn || url,\n enableLogs,\n enabled: Boolean(isEnabled && (dsn || url)),\n environment,\n integrations: createIntegrations({\n replaysOnErrorSampleRate: replayOnErrorSampleRate,\n replaysSessionSampleRate: replaySampleRate,\n tracesSampleRate\n }),\n release: release || version,\n replaysOnErrorSampleRate: replayOnErrorSampleRate,\n replaysSessionSampleRate: replaySampleRate,\n sendDefaultPii: false,\n tracesSampleRate,\n tracePropagationTargets,\n tunnel\n });\n\n if (app) {\n setTag('app', app);\n }\n};\n\nconst sentry = {};\n\nexport default sentry;\n"],"mappings":";;;;;;;;AAQA,MAAM,cAAc,EAClB,wBAAwB,OACzB;AAED,MAAM,iBAAiB,EACrB,eAAe,iBAChB;AAED,MAAM,eAAe,EACnB,cAAc,KACf;AAED,MAAM,eAAe;AAErB,MAAM,gCAAgC;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,uBAAuB;CAC3B,GAAGA;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,8BAA8B;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,oBAAoB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a,YAAY,CAAC,SAAS,OAAO,SAAS,YAAY,GAAG;CACtG,MAAM,YAAY,YAAY,CAAC,eAAe,WAAW,aAAa,UAAU,WAAW,mBAAmB;AAE9G,QAAO,KAAK;EACV,aAAa,OAAO,SAAS;GAC3B,MAAM,iBAAiB,cAAc,MAAM;AAE3C,OAAI,WACF,QAAO,WAAW,gBAAgB,KAAK;AAGzC,UAAO;;EAET;EACA,KAAK,OAAO;EACZ;EACA,SAAS,QAAQ,cAAc,OAAO,KAAK;EAC3C;EACA,cAAc,mBAAmB;GAC/B,0BAA0B;GAC1B,0BAA0B;GAC1B;GACD,CAAC;EACF,SAAS,WAAW;EACpB,0BAA0B;EAC1B,0BAA0B;EAC1B,gBAAgB;EAChB;EACA;EACA;EACD,CAAC;AAEF,KAAI,IACF,QAAO,OAAO,IAAI;;AAItB,MAAM,SAAS,EAAE;AAEjB,qBAAe"}
1
+ {"version":3,"file":"sentry.js","names":["sensitiveKeys","idsContext: SentryContext","userContext: SentryContext","masked","highCardinalityContext: SentryContext","sentryError","integrations: Array<\n ReturnType<typeof Sentry.browserTracingIntegration> | ReturnType<typeof Sentry.replayIntegration>\n >"],"sources":["../src/sentry.ts"],"sourcesContent":["import * as Sentry from '@sentry/react';\nimport _get from 'lodash/get.js';\nimport _set from 'lodash/set.js';\nimport type { AnyAction } from 'redux';\nimport masked from './masked';\nimport { getProcessEnv } from './process-env';\nimport sensitiveKeys from './sensitive-keys';\n\nconst ERROR_CODES = {\n INVALID_AUTHENTICATION: 10007\n};\n\nconst ERROR_MESSAGES = {\n NETWORK_ERROR: 'Network Error'\n};\n\nconst STATUS_CODES = {\n UNAUTHORIZED: 401\n};\n\nconst MASKED_VALUE = '********';\n\nconst HIGH_CARDINALITY_CONTEXT_KEYS = [\n 'accountId',\n 'appId',\n 'businessId',\n 'claimId',\n 'futureId',\n 'patientId',\n 'paymentId',\n 'staffId',\n 'transactionId'\n] as const;\n\nconst EXTRA_SENSITIVE_KEYS = [\n ...sensitiveKeys,\n 'accountNumber',\n 'apiKey',\n 'authToken',\n 'bankAccount',\n 'bankAccountNumber',\n 'bearer',\n 'card',\n 'cardNumber',\n 'cardRank',\n 'cvv',\n 'fundAccountNumber',\n 'idToken',\n 'memberId',\n 'nonce',\n 'pan',\n 'paymentMethod',\n 'requestBody',\n 'secret',\n 'sessionToken'\n];\n\nconst EXTRA_SENSITIVE_HEADER_KEYS = [\n 'api-key',\n 'authorization',\n 'proxy-authorization',\n 'x-api-key',\n 'x-auth-token',\n 'x-authorization',\n 'x-id-token',\n 'x-session-token'\n];\n\nconst STANDARD_TAG_KEYS = [\n 'app',\n 'environment',\n 'error_code',\n 'flow',\n 'funder',\n 'is_sdk',\n 'is_standalone',\n 'operation',\n 'outcome',\n 'status_code',\n 'surface'\n] as const;\n\nconst USER_CONTEXT_KEYS = ['businessId', 'staffId'] as const;\n\ntype SentryPrimitive = string | number | boolean | null | undefined;\ntype HighCardinalityContextKey = typeof HIGH_CARDINALITY_CONTEXT_KEYS[number];\ntype StandardTagKey = typeof STANDARD_TAG_KEYS[number];\ntype SentryTags = Record<string, SentryPrimitive>;\ntype FlowEventTags = Partial<Record<HighCardinalityContextKey | StandardTagKey, SentryPrimitive>>;\ntype SentryContext = Record<string, unknown>;\n\ntype ErrorWithConfig = Error & {\n config?: {\n data?: unknown;\n headers?: Record<string, unknown>;\n url?: string;\n };\n data?: {\n errorCode?: number;\n message?: string;\n statusCode?: number;\n };\n status?: number;\n};\n\nexport type SentrySetupOptions = {\n app?: string;\n beforeSend?: Sentry.BrowserOptions['beforeSend'];\n debug?: boolean;\n dsn?: string;\n enableLogs?: boolean;\n enabled?: boolean;\n environment?: string;\n release?: string;\n replayErrorSampleRate?: number;\n replaySessionSampleRate?: number;\n replaysOnErrorSampleRate?: number;\n replaysSessionSampleRate?: number;\n tracePropagationTargets?: Sentry.BrowserOptions['tracePropagationTargets'];\n tracesSampleRate?: number;\n tunnel?: string;\n url?: string;\n version?: string;\n};\n\nexport type CaptureErrorOptions = {\n contexts?: Record<string, SentryContext>;\n data?: SentryContext;\n fingerprint?: string[];\n ignoreExpected?: boolean;\n level?: Sentry.SeverityLevel;\n name?: string;\n tags?: SentryTags;\n};\n\nexport type CaptureMessageOptions = Omit<CaptureErrorOptions, 'name'>;\n\nexport type CaptureFlowEventOptions = {\n context?: SentryContext;\n contexts?: Record<string, SentryContext>;\n data?: SentryContext;\n errorCode?: string | number;\n error?: unknown;\n extra?: SentryContext;\n fingerprint?: string[];\n flow: string;\n funder?: string;\n isSdk?: boolean;\n isStandalone?: boolean;\n level?: Sentry.SeverityLevel;\n message?: string;\n operation: string;\n outcome: 'cancelled' | 'failure' | 'info' | 'success' | 'validation' | 'warning';\n statusCode?: string | number;\n surface?: string;\n tags?: FlowEventTags;\n};\n\nconst idsContext: SentryContext = {};\nconst userContext: SentryContext = {};\nconst NORMALISED_SENSITIVE_KEYS = new Set(\n [...EXTRA_SENSITIVE_KEYS, ...EXTRA_SENSITIVE_HEADER_KEYS].map(normaliseSensitiveKey)\n);\n\nfunction normaliseSensitiveKey(key: string) {\n return key.replace(/[^a-z0-9]/gi, '').toLowerCase();\n}\n\nfunction isSensitiveKey(key: string) {\n return NORMALISED_SENSITIVE_KEYS.has(normaliseSensitiveKey(key));\n}\n\nfunction isHighCardinalityContextKey(key: string): key is HighCardinalityContextKey {\n return (HIGH_CARDINALITY_CONTEXT_KEYS as readonly string[]).includes(key);\n}\n\nfunction clearContext(context: SentryContext) {\n Object.keys(context).forEach(key => {\n delete context[key];\n });\n}\n\nfunction syncIdsContext() {\n if (Object.keys(idsContext).length === 0) {\n Sentry.setContext('ids', null);\n return;\n }\n\n Sentry.setContext('ids', sanitiseValue(idsContext));\n}\n\nfunction setIdContextValue(key: HighCardinalityContextKey, value: unknown) {\n const tagValue = normaliseTagValue(value);\n\n if (tagValue === undefined) {\n delete idsContext[key];\n return;\n }\n\n idsContext[key] = tagValue;\n}\n\nfunction getUserAccountId(user: Record<string, unknown>) {\n return user.accountId ?? user.id ?? user._id;\n}\n\nfunction hasUserIdentity(user: Record<string, unknown>) {\n return hasOwnKey(user, 'id') || hasOwnKey(user, '_id') || hasOwnKey(user, 'accountId');\n}\n\nfunction hasOwnKey(object: Record<string, unknown>, key: string) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\nfunction hasConfigKey(error: ErrorWithConfig, key: keyof NonNullable<ErrorWithConfig['config']>) {\n return Boolean(error.config && hasOwnKey(error.config as Record<string, unknown>, key));\n}\n\nfunction normaliseTagValue(value: unknown) {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (!['boolean', 'number', 'string'].includes(typeof value)) {\n return undefined;\n }\n\n return String(value);\n}\n\nfunction maskCaseInsensitiveSensitiveKeys<T>(value: T): T {\n if (value === null || typeof value !== 'object') {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(item => maskCaseInsensitiveSensitiveKeys(item)) as T;\n }\n\n return Object.entries(value as Record<string, unknown>).reduce<Record<string, unknown>>((nextValue, [key, item]) => {\n nextValue[key] = isSensitiveKey(key) ? MASKED_VALUE : maskCaseInsensitiveSensitiveKeys(item);\n return nextValue;\n }, {}) as T;\n}\n\nfunction sanitiseValue<T>(value: T): T {\n return maskCaseInsensitiveSensitiveKeys(masked(value as Record<string, any>, EXTRA_SENSITIVE_KEYS) as T);\n}\n\nfunction stripUrlQuery(url?: string) {\n if (!url || typeof url !== 'string') {\n return url;\n }\n\n try {\n const parsedUrl = new URL(url, window.location.origin);\n parsedUrl.search = '';\n parsedUrl.hash = '';\n return parsedUrl.toString();\n } catch (err) {\n return url.split('?')[0].split('#')[0];\n }\n}\n\nfunction getStatusCode(error: unknown) {\n return (\n _get(error, 'status') ||\n _get(error, 'data.statusCode') ||\n _get(error, 'response.status') ||\n _get(error, 'config.status')\n );\n}\n\nfunction getErrorCode(error: unknown) {\n return _get(error, 'data.errorCode') || _get(error, 'response.data.errorCode');\n}\n\nfunction isExpectedError(error: unknown) {\n const statusCode = getStatusCode(error);\n const errorCode = getErrorCode(error);\n\n return (\n getProcessEnv().NODE_ENV === 'test' ||\n _get(error, 'message') === ERROR_MESSAGES.NETWORK_ERROR ||\n statusCode === STATUS_CODES.UNAUTHORIZED ||\n errorCode === ERROR_CODES.INVALID_AUTHENTICATION\n );\n}\n\nfunction sanitiseError<T extends unknown>(error: T): T {\n if (!(error instanceof Error)) {\n return sanitiseValue(error);\n }\n\n let sanitisedError = cloneError(error as ErrorWithConfig);\n const errorHeaders = sanitisedError.config?.headers;\n\n if (hasConfigKey(sanitisedError, 'headers') && errorHeaders !== undefined) {\n const maskedErrorHeaders = sanitiseValue(errorHeaders);\n sanitisedError = _set(sanitisedError, 'config.headers', maskedErrorHeaders);\n }\n\n if (hasConfigKey(sanitisedError, 'data') && sanitisedError.config?.data !== undefined) {\n try {\n const errorData = sanitisedError.config.data;\n const maskedErrorData = sanitiseValue(\n typeof errorData === 'string' ? JSON.parse(errorData) : (errorData as Record<string, unknown>)\n );\n sanitisedError = _set(sanitisedError, 'config.data', JSON.stringify(maskedErrorData));\n } catch (err) {\n sanitisedError = _set(sanitisedError, 'config.data', undefined);\n }\n }\n\n if (sanitisedError?.config?.url) {\n sanitisedError = _set(sanitisedError, 'config.url', stripUrlQuery(sanitisedError.config.url));\n }\n\n return sanitisedError as T;\n}\n\nfunction cloneError(error: ErrorWithConfig): ErrorWithConfig {\n const clonedError = new Error(error.message) as ErrorWithConfig & { cause?: unknown };\n const config = error.config\n ? {\n ...error.config,\n headers: error.config.headers ? { ...error.config.headers } : error.config.headers\n }\n : error.config;\n\n Object.assign(clonedError, error, {\n config,\n data: error.data ? { ...error.data } : error.data\n });\n clonedError.name = error.name;\n clonedError.message = error.message;\n clonedError.stack = error.stack;\n\n if ('cause' in error) {\n clonedError.cause = (error as Error & { cause?: unknown }).cause;\n }\n\n return clonedError;\n}\n\nfunction applyScopeData(scope: Sentry.Scope, options: CaptureErrorOptions = {}) {\n const { contexts = {}, data, fingerprint, level, tags = {} } = options;\n const highCardinalityContext: SentryContext = {};\n\n Object.entries(tags).forEach(([key, value]) => {\n if (isHighCardinalityContextKey(key)) {\n highCardinalityContext[key] = value;\n return;\n }\n\n const tagValue = normaliseTagValue(value);\n\n if (tagValue !== undefined) {\n scope.setTag(key, tagValue);\n }\n });\n\n if (Object.keys(highCardinalityContext).length > 0) {\n scope.setContext(\n 'ids',\n sanitiseValue({\n ...idsContext,\n ...highCardinalityContext\n })\n );\n }\n\n Object.entries(contexts).forEach(([key, context]) => {\n scope.setContext(key, sanitiseValue(context));\n });\n\n if (data) {\n scope.setExtra('data', sanitiseValue(data));\n }\n\n if (level) {\n scope.setLevel(level);\n }\n\n if (fingerprint) {\n scope.setFingerprint(fingerprint);\n }\n}\n\nfunction createErrorFromUnknown(error: unknown, name?: string) {\n if (error instanceof Error) {\n const sentryError = cloneError(error as ErrorWithConfig);\n\n if (name) {\n sentryError.name = name;\n }\n\n return sentryError;\n }\n\n const message = _get(error, 'data.message') || _get(error, 'message') || 'Unknown error';\n const sentryError = new Error(String(message));\n\n if (name) {\n sentryError.name = name;\n }\n\n return sentryError;\n}\n\nfunction sanitiseEvent<T extends Sentry.Event>(event: T): T {\n const sanitisedEvent = sanitiseValue({ ...event }) as T;\n\n if (sanitisedEvent.request?.url) {\n sanitisedEvent.request.url = stripUrlQuery(sanitisedEvent.request.url);\n }\n\n if (sanitisedEvent.breadcrumbs) {\n sanitisedEvent.breadcrumbs = sanitisedEvent.breadcrumbs.map(breadcrumb => ({\n ...breadcrumb,\n data: sanitiseValue(breadcrumb.data || {})\n }));\n }\n\n return sanitisedEvent;\n}\n\nfunction createIntegrations(options: SentrySetupOptions) {\n const integrations: Array<\n ReturnType<typeof Sentry.browserTracingIntegration> | ReturnType<typeof Sentry.replayIntegration>\n > = [];\n\n if ((options.tracesSampleRate || 0) > 0) {\n integrations.push(Sentry.browserTracingIntegration());\n }\n\n if ((options.replaysOnErrorSampleRate || 0) > 0 || (options.replaysSessionSampleRate || 0) > 0) {\n integrations.push(\n Sentry.replayIntegration({\n blockAllMedia: true,\n maskAllInputs: true,\n maskAllText: true\n })\n );\n }\n\n return integrations;\n}\n\nexport const clearUserContext = () => {\n clearContext(idsContext);\n clearContext(userContext);\n Sentry.setUser(null);\n Sentry.setContext('user', null);\n Sentry.setContext('ids', null);\n};\n\nexport const createReduxEnhancer = () =>\n Sentry.createReduxEnhancer({\n actionTransformer: (action: AnyAction) => sanitiseValue(action) as AnyAction,\n stateTransformer: (state: unknown) => sanitiseValue(state as Record<string, any>)\n });\n\nexport const createReduxMiddleware = () => () => (next: (action: unknown) => unknown) => (action: unknown) => {\n Sentry.addBreadcrumb({\n category: 'redux.action',\n data: sanitiseValue({ action }),\n level: 'info'\n });\n\n return next(action);\n};\n\nexport const addBreadcrumb = (breadcrumb: Sentry.Breadcrumb) =>\n Sentry.addBreadcrumb({\n ...breadcrumb,\n data: sanitiseValue(breadcrumb.data || {})\n });\n\nexport const setTag = (key: string, value: SentryPrimitive) => {\n const tagValue = normaliseTagValue(value);\n\n if (isHighCardinalityContextKey(key)) {\n setIdContextValue(key, value);\n syncIdsContext();\n return;\n }\n\n if (tagValue !== undefined) {\n Sentry.setTag(key, tagValue);\n }\n};\n\nexport const setTags = (tags: SentryTags = {}) => {\n Object.entries(tags).forEach(([key, value]) => {\n setTag(key, value);\n });\n};\n\nexport const setUserContext = (user: Record<string, unknown> = {}) => {\n if (Object.keys(user).length === 0) {\n clearUserContext();\n return;\n }\n\n const nextAccountId = getUserAccountId(user);\n const userHasIdentity = hasUserIdentity(user);\n const hasAccountChanged =\n userHasIdentity && userContext.accountId !== undefined && nextAccountId !== userContext.accountId;\n\n if (hasAccountChanged) {\n clearContext(userContext);\n clearContext(idsContext);\n syncIdsContext();\n }\n\n if (userHasIdentity) {\n userContext.accountId = nextAccountId;\n }\n\n let hasIdContextUpdate = false;\n\n USER_CONTEXT_KEYS.forEach(key => {\n if (hasOwnKey(user, key)) {\n userContext[key] = user[key];\n setIdContextValue(key, user[key]);\n hasIdContextUpdate = true;\n }\n });\n\n if (hasIdContextUpdate) {\n syncIdsContext();\n }\n\n const id = userContext.accountId;\n\n if (id) {\n Sentry.setUser({ id: String(id) });\n } else {\n Sentry.setUser(null);\n }\n\n Sentry.setContext(\n 'user',\n sanitiseValue({\n accountId: userContext.accountId || id,\n businessId: userContext.businessId,\n staffId: userContext.staffId\n })\n );\n};\n\nexport const captureError = (error: unknown, options: CaptureErrorOptions = {}) => {\n if (options.ignoreExpected !== false && isExpectedError(error)) {\n return null;\n }\n\n const sanitisedError = sanitiseError(error);\n const statusCode = getStatusCode(error);\n const errorCode = getErrorCode(error);\n\n Sentry.withScope(scope => {\n scope.setExtra('error', sanitiseValue(sanitisedError));\n applyScopeData(scope, {\n ...options,\n tags: {\n ...options.tags,\n ...(statusCode ? { status_code: statusCode } : {}),\n ...(errorCode ? { error_code: errorCode } : {})\n }\n });\n\n Sentry.captureException(createErrorFromUnknown(sanitisedError, options.name));\n });\n\n console.error(sanitisedError);\n};\n\nexport const logError = (\n error: unknown,\n {\n data,\n name\n }: {\n data?: SentryContext;\n name?: string;\n } = {}\n) => captureError(error, { data, name });\n\nexport const captureMessage = (message: string, options: CaptureMessageOptions = {}) => {\n Sentry.withScope(scope => {\n applyScopeData(scope, options);\n Sentry.captureMessage(message, options.level);\n });\n};\n\nexport const captureFlowEvent = ({\n context,\n contexts,\n data,\n errorCode,\n error,\n extra,\n fingerprint,\n flow,\n funder,\n isSdk,\n isStandalone,\n level,\n message,\n operation,\n outcome,\n statusCode,\n surface,\n tags = {}\n}: CaptureFlowEventOptions) => {\n const { customTags, standardTags } = splitFlowEventTags(tags);\n\n const nextTags = {\n ...standardTags,\n flow,\n ...(funder && { funder }),\n ...(isSdk !== undefined && { is_sdk: isSdk }),\n ...(isStandalone !== undefined && { is_standalone: isStandalone }),\n operation,\n outcome,\n ...(statusCode && { status_code: statusCode }),\n ...(errorCode && { error_code: errorCode }),\n ...(surface && { surface })\n };\n const nextFingerprint = fingerprint || ['flow-event', flow, operation, outcome];\n const eventMessage = message || `${flow}.${operation}.${outcome}`;\n const nextContexts = {\n ...contexts,\n ...(Object.keys(customTags).length > 0 && { custom_tags: customTags }),\n ...(context && { context })\n };\n const nextData = mergeSentryData(data, extra);\n\n addBreadcrumb({\n category: 'flow',\n data: {\n errorCode: errorCode || (error ? getErrorCode(error) : undefined),\n flow,\n operation,\n outcome,\n statusCode: statusCode || (error ? getStatusCode(error) : undefined)\n },\n level: outcome === 'failure' ? 'error' : outcome === 'warning' || outcome === 'validation' ? 'warning' : 'info',\n message: eventMessage\n });\n\n if (error) {\n return captureError(error, {\n contexts: nextContexts,\n data: nextData,\n fingerprint: nextFingerprint,\n ignoreExpected: outcome !== 'validation' && outcome !== 'warning',\n level: level || (outcome === 'validation' || outcome === 'warning' ? 'warning' : 'error'),\n name: eventMessage,\n tags: nextTags\n });\n }\n\n return captureMessage(eventMessage, {\n contexts: nextContexts,\n data: nextData,\n fingerprint: nextFingerprint,\n level:\n level ||\n (outcome === 'failure' ? 'error' : outcome === 'warning' || outcome === 'validation' ? 'warning' : 'info'),\n tags: nextTags\n });\n};\n\nfunction splitFlowEventTags(tags: FlowEventTags | SentryTags) {\n return Object.entries(tags).reduce<{ customTags: SentryContext; standardTags: SentryTags }>(\n (nextTags, [key, value]) => {\n if (isFlowEventTagKey(key)) {\n nextTags.standardTags[key] = value;\n } else {\n nextTags.customTags[key] = value;\n }\n\n return nextTags;\n },\n { customTags: {}, standardTags: {} }\n );\n}\n\nfunction isFlowEventTagKey(key: string) {\n return (STANDARD_TAG_KEYS as readonly string[]).includes(key) || isHighCardinalityContextKey(key);\n}\n\nfunction mergeSentryData(data?: SentryContext, extra?: SentryContext) {\n if (data && extra) {\n return {\n ...data,\n ...extra\n };\n }\n\n return extra || data;\n}\n\nexport const setup = ({\n app,\n beforeSend,\n debug,\n dsn,\n enableLogs,\n enabled,\n environment,\n release,\n replayErrorSampleRate,\n replaySessionSampleRate,\n replaysOnErrorSampleRate = 0,\n replaysSessionSampleRate = 0,\n tracePropagationTargets,\n tracesSampleRate = 0,\n tunnel,\n url,\n version\n}: SentrySetupOptions = {}) => {\n const replayOnErrorSampleRate = replayErrorSampleRate ?? replaysOnErrorSampleRate;\n const replaySampleRate = replaySessionSampleRate ?? replaysSessionSampleRate;\n const processEnv = getProcessEnv();\n const isLocalHost =\n typeof window !== 'undefined' && ['localhost', '127.0.0.1'].includes(window.location.hostname || '');\n const isEnabled = enabled ?? (!isLocalHost && processEnv.NODE_ENV !== 'test' && processEnv.DISABLE_SENTRY !== 'true');\n\n Sentry.init({\n beforeSend: (event, hint) => {\n const sanitisedEvent = sanitiseEvent(event);\n\n if (beforeSend) {\n return beforeSend(sanitisedEvent, hint);\n }\n\n return sanitisedEvent;\n },\n debug,\n dsn: dsn || url,\n enableLogs,\n enabled: Boolean(isEnabled && (dsn || url)),\n environment,\n integrations: createIntegrations({\n replaysOnErrorSampleRate: replayOnErrorSampleRate,\n replaysSessionSampleRate: replaySampleRate,\n tracesSampleRate\n }),\n release: release || version,\n replaysOnErrorSampleRate: replayOnErrorSampleRate,\n replaysSessionSampleRate: replaySampleRate,\n sendDefaultPii: false,\n tracesSampleRate,\n tracePropagationTargets,\n tunnel\n });\n\n if (app) {\n setTag('app', app);\n }\n};\n\nconst sentry = {};\n\nexport default sentry;\n"],"mappings":";;;;;;;;AAQA,MAAM,cAAc,EAClB,wBAAwB,OACzB;AAED,MAAM,iBAAiB,EACrB,eAAe,iBAChB;AAED,MAAM,eAAe,EACnB,cAAc,KACf;AAED,MAAM,eAAe;AAErB,MAAM,gCAAgC;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,uBAAuB;CAC3B,GAAGA;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,8BAA8B;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,oBAAoB;CACxB;CACA;CACA;CACA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c,mBAAmB;GAC/B,0BAA0B;GAC1B,0BAA0B;GAC1B;GACD,CAAC;EACF,SAAS,WAAW;EACpB,0BAA0B;EAC1B,0BAA0B;EAC1B,gBAAgB;EAChB;EACA;EACA;EACD,CAAC;AAEF,KAAI,IACF,QAAO,OAAO,IAAI;;AAItB,MAAM,SAAS,EAAE;AAEjB,qBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/utils",
3
- "version": "12.0.5-feat-sentry-reform.1",
3
+ "version": "12.0.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -138,5 +138,5 @@
138
138
  "vite-tsconfig-paths": "6.1.1",
139
139
  "vitest": "4.1.5"
140
140
  },
141
- "gitHead": "a0fe1b34fb558645c072a07849aafea4d3c736b8"
141
+ "gitHead": "2e6ecef648e262356adddae30bedc9fd64b5fb39"
142
142
  }