@mx-cartographer/experiences 9.4.19-alpha.al3 → 9.4.19-alpha.al4

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.
@@ -1,3 +1 @@
1
- export declare const redactGuids: <T extends string | undefined>(value: T) => T;
2
- export declare const redactAmounts: <T extends string | undefined>(value: T) => T;
3
1
  export declare const redactSsoPath: <T extends string | undefined>(value: T) => T;
@@ -1,7 +1,5 @@
1
- var a = /\b([A-Za-z]{3}-)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/g, t = /[-−(]?\$\s*\d(?:[\d,]|[ \u00A0\u202F](?=\d))*(?:[.,]\d+)?(?:\s*[KMB])?\)?|[-−(]?\d(?:[\d,]|[ \u00A0\u202F](?=\d))*(?:[.,]\d+)?(?:\s*[KMB])?\s*\$\)?/gi, d = /(\/(?:md\/[^/?#]+|login)\/)[^?#]+/g, T = (r) => typeof r == "string" ? r.replace(a, (s, A) => `${A ?? ""}REDACTED`) : r, f = (r) => typeof r == "string" ? r.replace(t, "$[amount]") : r, o = (r) => typeof r == "string" ? r.replace(d, "$1REDACTED") : r;
1
+ var t = /(\/(?:md\/[^/?#]+|login)\/)[^?#]+/g, o = (r) => typeof r == "string" ? r.replace(t, "$1REDACTED") : r;
2
2
  export {
3
- f as redactAmounts,
4
- T as redactGuids,
5
3
  o as redactSsoPath
6
4
  };
7
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"RumRedaction.es.js","names":[],"sources":["../../src/rum/RumRedaction.ts"],"sourcesContent":["// String scrubbers for Datadog RUM `beforeSend` hooks. RUM records URLs,\n// error messages and clicked-element text verbatim, and in MX apps those carry\n// member-linkable identifiers, balances and — on the firefly host — live SSO\n// tokens. Consumers compose these in their own `beforeSend`. All three are\n// total on `string | undefined` and return their input unchanged when it isn't\n// a string.\n\n// MX GUIDs are a 3-letter uppercase prefix plus a UUID (ACT-…, USR-…, TRN-…).\n// API paths embed them in both the path and the query string\n// (`/accounts/ACT-<uuid>/monthly_account_balances`, `?account_guids[]=ACT-<uuid>`).\n// The prefix is kept so URLs still group by resource kind; only the identifying\n// UUID is dropped. The prefix is optional in the pattern so bare UUIDs\n// (session / correlation ids) are caught too.\nconst GUID_PATTERN =\n /\\b([A-Za-z]{3}-)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/g\n\n// Interaction names come from rendered button/link text, which is frequently a\n// balance or transaction amount. Both sign positions are matched (\"$1,234.56\"\n// and fr-CA \"123,45 $\"), the K/M/B abbreviation (\"$1.2K\"), and a leading \"-\",\n// \"−\" (U+2212) or accounting \"(\" with trailing \")\", so a negative renders as\n// \"$[amount]\" rather than \"-$[amount]\". Digit groups may be joined by \",\" or by\n// a space / no-break space / narrow no-break space, which is how\n// Intl.NumberFormat('fr-CA') groups thousands (\"1 234,56 $\"); the lookahead only\n// swallows a space when another digit follows it.\nconst AMOUNT_PATTERN =\n /[-−(]?\\$\\s*\\d(?:[\\d,]|[ \\u00A0\\u202F](?=\\d))*(?:[.,]\\d+)?(?:\\s*[KMB])?\\)?|[-−(]?\\d(?:[\\d,]|[ \\u00A0\\u202F](?=\\d))*(?:[.,]\\d+)?(?:\\s*[KMB])?\\s*\\$\\)?/gi\n\n// Firefly's widget SSO deep-links put a live single-use auth token — and an\n// optional base64 params blob that can carry account/insight GUIDs — directly\n// in the path: /md/<widget>/:single_sign_on_token(/:encoded_params) renders the\n// widget in place, so RUM's first view.url and every later view.referrer would\n// otherwise ship the token verbatim. Neither segment is UUID-shaped, so the GUID\n// pattern cannot catch them; everything after the widget segment is replaced.\n// /login/:single_sign_on_token redirects, but still surfaces as a referrer.\nconst SSO_PATH_PATTERN = /(\\/(?:md\\/[^/?#]+|login)\\/)[^?#]+/g\n\nexport const redactGuids = <T extends string | undefined>(value: T): T =>\n typeof value === 'string'\n ? (value.replace(\n GUID_PATTERN,\n (_match: string, prefix?: string) => `${prefix ?? ''}REDACTED`,\n ) as T)\n : value\n\nexport const redactAmounts = <T extends string | undefined>(value: T): T =>\n typeof value === 'string' ? (value.replace(AMOUNT_PATTERN, '$[amount]') as T) : value\n\nexport const redactSsoPath = <T extends string | undefined>(value: T): T =>\n typeof value === 'string' ? (value.replace(SSO_PATH_PATTERN, '$1REDACTED') as T) : value\n"],"mappings":"AAaA,IAAM,IACJ,mGAUI,IACJ,yJASI,IAAmB,sCAEZ,IAAA,CAA6C,MACxD,OAAO,KAAU,WACZ,EAAM,QACL,GAAA,CACC,GAAgB,MAAoB,GAAG,KAAU,EAAA,UACpD,IACA,GAEO,IAAA,CAA+C,MAC1D,OAAO,KAAU,WAAY,EAAM,QAAQ,GAAgB,WAAW,IAAU,GAErE,IAAA,CAA+C,MAC1D,OAAO,KAAU,WAAY,EAAM,QAAQ,GAAkB,YAAY,IAAU"}
1
+ {"version":3,"file":"RumRedaction.es.js","names":[],"sources":["../../src/rum/RumRedaction.ts"],"sourcesContent":["// Firefly's widget SSO deep-links put a live single-use auth token — and an\n// optional base64 params blob — directly in the path:\n// /md/<widget>/:single_sign_on_token(/:encoded_params) renders the widget in\n// place, so RUM's first view.url and every later view.referrer would otherwise\n// ship the token verbatim. Everything after the widget segment is replaced.\n// /login/:single_sign_on_token redirects, but still surfaces as a referrer.\n//\n// Nothing else is redacted. GUIDs and amounts are deliberately kept: they are\n// what support uses to find and follow a member's session.\nconst SSO_PATH_PATTERN = /(\\/(?:md\\/[^/?#]+|login)\\/)[^?#]+/g\n\nexport const redactSsoPath = <T extends string | undefined>(value: T): T =>\n typeof value === 'string' ? (value.replace(SSO_PATH_PATTERN, '$1REDACTED') as T) : value\n"],"mappings":"AASA,IAAM,IAAmB,sCAEZ,IAAA,CAA+C,MAC1D,OAAO,KAAU,WAAY,EAAM,QAAQ,GAAkB,YAAY,IAAU"}
@@ -12,28 +12,19 @@ export interface RumBeforeSendEvent {
12
12
  [key: string]: unknown;
13
13
  };
14
14
  error?: {
15
- message: string;
16
- stack?: string;
17
15
  resource?: {
18
16
  url: string;
19
17
  [key: string]: unknown;
20
18
  };
21
19
  [key: string]: unknown;
22
20
  };
23
- action?: {
24
- target?: {
25
- name: string;
26
- [key: string]: unknown;
27
- };
28
- [key: string]: unknown;
29
- };
30
21
  [key: string]: unknown;
31
22
  }
32
23
  export interface RumBeforeSendOptions {
33
24
  /**
34
- * Also scrub firefly's /md/<widget>/:single_sign_on_token deep-link paths and
25
+ * Scrub firefly's /md/<widget>/:single_sign_on_token deep-link paths and
35
26
  * /login/:token referrers. Only the firefly host has those routes; a
36
- * core-data-served build should leave this off.
27
+ * Cortex-served build should leave this off.
37
28
  */
38
29
  scrubSsoPaths?: boolean;
39
30
  }
@@ -1,16 +1,15 @@
1
- import { redactAmounts as e, redactGuids as c, redactSsoPath as a } from "./RumRedaction.es.js";
2
- function f({ scrubSsoPaths: i = !1 } = {}) {
3
- const o = (r) => i ? a(c(r)) : c(r);
1
+ import { redactSsoPath as u } from "./RumRedaction.es.js";
2
+ function c({ scrubSsoPaths: s = !1 } = {}) {
4
3
  return (r) => {
5
- if (r.view && (r.view.url = o(r.view.url), r.view.referrer = o(r.view.referrer)), r.resource && (r.resource.url = o(r.resource.url)), r.error && (r.error.message = e(o(r.error.message)), r.error.stack = e(o(r.error.stack)), r.error.resource && (r.error.resource.url = o(r.error.resource.url))), r.action?.target && (r.action.target.name = e(c(r.action.target.name))), r.type !== "resource" || !r.resource) return !0;
6
- const { resource: u } = r;
7
- if (u.type === "xhr" || u.type === "fetch") return !0;
8
- const s = u.status_code;
9
- return !(s !== void 0 && s > 0 && s < 400);
4
+ if (s && (r.view && (r.view.url = u(r.view.url), r.view.referrer = u(r.view.referrer)), r.resource && (r.resource.url = u(r.resource.url)), r.error?.resource && (r.error.resource.url = u(r.error.resource.url))), r.type !== "resource" || !r.resource) return !0;
5
+ const { resource: e } = r;
6
+ if (e.type === "xhr" || e.type === "fetch") return !0;
7
+ const o = e.status_code;
8
+ return !(o !== void 0 && o > 0 && o < 400);
10
9
  };
11
10
  }
12
11
  export {
13
- f as buildRumBeforeSend
12
+ c as buildRumBeforeSend
14
13
  };
15
14
 
16
15
  //# sourceMappingURL=beforeSend.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"beforeSend.es.js","names":[],"sources":["../../src/rum/beforeSend.ts"],"sourcesContent":["import { redactAmounts, redactGuids, redactSsoPath } from './RumRedaction'\n\n// The subset of a Datadog RUM event that beforeSend reads or writes. Structural\n// on purpose: any RumEvent from @datadog/browser-rum satisfies it, and this\n// package takes no dependency on the SDK. Every field written here is on the\n// SDK's beforeSend allowlist (MODIFIABLE_FIELD_PATHS_BY_EVENT in\n// browser-rum-core/domain/assembly) — writes to anything else are silently\n// discarded by the SDK.\n// The index signatures matter: SDK event members carry other fields, and\n// TypeScript's weak-type rule would otherwise reject e.g. RumErrorEvent.action\n// (which has an `id` but no `target`) as sharing no properties with `action`.\nexport interface RumBeforeSendEvent {\n type: string\n view?: { url: string; referrer?: string; [key: string]: unknown }\n resource?: { type?: string; url: string; status_code?: number; [key: string]: unknown }\n error?: {\n message: string\n stack?: string\n resource?: { url: string; [key: string]: unknown }\n [key: string]: unknown\n }\n action?: { target?: { name: string; [key: string]: unknown }; [key: string]: unknown }\n [key: string]: unknown\n}\n\nexport interface RumBeforeSendOptions {\n /**\n * Also scrub firefly's /md/<widget>/:single_sign_on_token deep-link paths and\n * /login/:token referrers. Only the firefly host has those routes; a\n * core-data-served build should leave this off.\n */\n scrubSsoPaths?: boolean\n}\n\n// Builds the beforeSend hook every MX RUM consumer installs: redact\n// member-linkable identifiers and amounts from everything RUM records verbatim,\n// then drop the successful static resources that make up the bulk of the volume\n// while keeping XHR/fetch so client-perceived API latency stays visible.\nexport function buildRumBeforeSend({ scrubSsoPaths = false }: RumBeforeSendOptions = {}) {\n const redactUrl = <T extends string | undefined>(value: T): T =>\n scrubSsoPaths ? redactSsoPath(redactGuids(value)) : redactGuids(value)\n\n return (event: RumBeforeSendEvent): boolean => {\n if (event.view) {\n event.view.url = redactUrl(event.view.url)\n event.view.referrer = redactUrl(event.view.referrer)\n }\n if (event.resource) {\n event.resource.url = redactUrl(event.resource.url)\n }\n if (event.error) {\n event.error.message = redactAmounts(redactUrl(event.error.message))\n event.error.stack = redactAmounts(redactUrl(event.error.stack))\n if (event.error.resource) event.error.resource.url = redactUrl(event.error.resource.url)\n }\n if (event.action?.target) {\n event.action.target.name = redactAmounts(redactGuids(event.action.target.name))\n }\n\n if (event.type !== 'resource' || !event.resource) return true\n const { resource } = event\n if (resource.type === 'xhr' || resource.type === 'fetch') return true\n const status = resource.status_code\n if (status !== undefined && status > 0 && status < 400) return false\n return true\n }\n}\n"],"mappings":";AAsCA,SAAgB,EAAmB,EAAE,eAAA,IAAgB,GAAA,IAAgC,CAAC,GAAG;AACvF,QAAM,IAAA,CAA2C,MAC/C,IAAgB,EAAc,EAAY,CAAK,CAAC,IAAI,EAAY,CAAK;AAEvE,SAAA,CAAQ,MAAuC;AAiB7C,QAhBI,EAAM,SACR,EAAM,KAAK,MAAM,EAAU,EAAM,KAAK,GAAG,GACzC,EAAM,KAAK,WAAW,EAAU,EAAM,KAAK,QAAQ,IAEjD,EAAM,aACR,EAAM,SAAS,MAAM,EAAU,EAAM,SAAS,GAAG,IAE/C,EAAM,UACR,EAAM,MAAM,UAAU,EAAc,EAAU,EAAM,MAAM,OAAO,CAAC,GAClE,EAAM,MAAM,QAAQ,EAAc,EAAU,EAAM,MAAM,KAAK,CAAC,GAC1D,EAAM,MAAM,aAAU,EAAM,MAAM,SAAS,MAAM,EAAU,EAAM,MAAM,SAAS,GAAG,KAErF,EAAM,QAAQ,WAChB,EAAM,OAAO,OAAO,OAAO,EAAc,EAAY,EAAM,OAAO,OAAO,IAAI,CAAC,IAG5E,EAAM,SAAS,cAAc,CAAC,EAAM,SAAU,QAAO;AACzD,UAAM,EAAE,UAAA,EAAA,IAAa;AACrB,QAAI,EAAS,SAAS,SAAS,EAAS,SAAS,QAAS,QAAO;AACjE,UAAM,IAAS,EAAS;AACxB,WAAI,EAAA,MAAW,UAAa,IAAS,KAAK,IAAS;AAAA,EAErD;AACF"}
1
+ {"version":3,"file":"beforeSend.es.js","names":[],"sources":["../../src/rum/beforeSend.ts"],"sourcesContent":["import { redactSsoPath } from './RumRedaction'\n\n// The subset of a Datadog RUM event that beforeSend reads or writes. Structural\n// on purpose: any RumEvent from @datadog/browser-rum satisfies it, and this\n// package takes no dependency on the SDK. Every field written here is on the\n// SDK's beforeSend allowlist (MODIFIABLE_FIELD_PATHS_BY_EVENT in\n// browser-rum-core/domain/assembly) — writes to anything else are silently\n// discarded by the SDK.\n//\n// The index signatures matter: SDK event members carry other fields, and\n// TypeScript's weak-type rule would otherwise reject members that share no\n// property names with these shapes.\nexport interface RumBeforeSendEvent {\n type: string\n view?: { url: string; referrer?: string; [key: string]: unknown }\n resource?: { type?: string; url: string; status_code?: number; [key: string]: unknown }\n error?: { resource?: { url: string; [key: string]: unknown }; [key: string]: unknown }\n [key: string]: unknown\n}\n\nexport interface RumBeforeSendOptions {\n /**\n * Scrub firefly's /md/<widget>/:single_sign_on_token deep-link paths and\n * /login/:token referrers. Only the firefly host has those routes; a\n * Cortex-served build should leave this off.\n */\n scrubSsoPaths?: boolean\n}\n\n// Builds the beforeSend hook every MX RUM consumer installs: scrub live SSO\n// tokens out of URLs (when asked), then drop the successful static resources\n// that make up the bulk of the volume while keeping XHR/fetch so\n// client-perceived API latency stays visible.\nexport function buildRumBeforeSend({ scrubSsoPaths = false }: RumBeforeSendOptions = {}) {\n return (event: RumBeforeSendEvent): boolean => {\n if (scrubSsoPaths) {\n if (event.view) {\n event.view.url = redactSsoPath(event.view.url)\n event.view.referrer = redactSsoPath(event.view.referrer)\n }\n if (event.resource) event.resource.url = redactSsoPath(event.resource.url)\n if (event.error?.resource) event.error.resource.url = redactSsoPath(event.error.resource.url)\n }\n\n if (event.type !== 'resource' || !event.resource) return true\n const { resource } = event\n if (resource.type === 'xhr' || resource.type === 'fetch') return true\n const status = resource.status_code\n if (status !== undefined && status > 0 && status < 400) return false\n return true\n }\n}\n"],"mappings":";AAiCA,SAAgB,EAAmB,EAAE,eAAA,IAAgB,GAAA,IAAgC,CAAC,GAAG;AACvF,SAAA,CAAQ,MAAuC;AAU7C,QATI,MACE,EAAM,SACR,EAAM,KAAK,MAAM,EAAc,EAAM,KAAK,GAAG,GAC7C,EAAM,KAAK,WAAW,EAAc,EAAM,KAAK,QAAQ,IAErD,EAAM,aAAU,EAAM,SAAS,MAAM,EAAc,EAAM,SAAS,GAAG,IACrE,EAAM,OAAO,aAAU,EAAM,MAAM,SAAS,MAAM,EAAc,EAAM,MAAM,SAAS,GAAG,KAG1F,EAAM,SAAS,cAAc,CAAC,EAAM,SAAU,QAAO;AACzD,UAAM,EAAE,UAAA,EAAA,IAAa;AACrB,QAAI,EAAS,SAAS,SAAS,EAAS,SAAS,QAAS,QAAO;AACjE,UAAM,IAAS,EAAS;AACxB,WAAI,EAAA,MAAW,UAAa,IAAS,KAAK,IAAS;AAAA,EAErD;AACF"}
@@ -1,3 +1,3 @@
1
- export { redactAmounts, redactGuids, redactSsoPath } from './RumRedaction';
1
+ export { redactSsoPath } from './RumRedaction';
2
2
  export { buildRumBeforeSend, type RumBeforeSendEvent, type RumBeforeSendOptions, } from './beforeSend';
3
3
  export { createRumErrorBuffer, DEFAULT_RUM_ERROR_BUFFER_SIZE, type RumErrorBuffer, } from './errorBuffer';
@@ -1,11 +1,9 @@
1
- import { redactAmounts as o, redactGuids as e, redactSsoPath as t } from "./RumRedaction.es.js";
2
- import { buildRumBeforeSend as R } from "./beforeSend.es.js";
3
- import { DEFAULT_RUM_ERROR_BUFFER_SIZE as f, createRumErrorBuffer as u } from "./errorBuffer.es.js";
1
+ import { redactSsoPath as o } from "./RumRedaction.es.js";
2
+ import { buildRumBeforeSend as m } from "./beforeSend.es.js";
3
+ import { DEFAULT_RUM_ERROR_BUFFER_SIZE as R, createRumErrorBuffer as f } from "./errorBuffer.es.js";
4
4
  export {
5
- f as DEFAULT_RUM_ERROR_BUFFER_SIZE,
6
- R as buildRumBeforeSend,
7
- u as createRumErrorBuffer,
8
- o as redactAmounts,
9
- e as redactGuids,
10
- t as redactSsoPath
5
+ R as DEFAULT_RUM_ERROR_BUFFER_SIZE,
6
+ m as buildRumBeforeSend,
7
+ f as createRumErrorBuffer,
8
+ o as redactSsoPath
11
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.4.19-alpha.al3",
3
+ "version": "9.4.19-alpha.al4",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",