@ogcio/o11y-sdk-react 0.11.2 → 0.12.0

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.
Files changed (53) hide show
  1. package/dist/sdk-core/lib/redaction/email-redactor.js.map +1 -1
  2. package/dist/sdk-core/lib/redaction/ppsn-redactor.js.map +1 -1
  3. package/dist/sdk-core/lib/utils/geo-context.d.ts +30 -0
  4. package/dist/sdk-core/lib/utils/geo-context.d.ts.map +1 -0
  5. package/dist/sdk-core/lib/utils/geo-context.js +54 -0
  6. package/dist/sdk-core/lib/utils/geo-context.js.map +1 -0
  7. package/dist/sdk-core/lib/utils/geohash.d.ts +12 -0
  8. package/dist/sdk-core/lib/utils/geohash.d.ts.map +1 -0
  9. package/dist/sdk-core/lib/utils/geohash.js +53 -0
  10. package/dist/sdk-core/lib/utils/geohash.js.map +1 -0
  11. package/dist/sdk-core/lib/utils/index.d.ts +3 -0
  12. package/dist/sdk-core/lib/utils/index.d.ts.map +1 -1
  13. package/dist/sdk-core/lib/utils/index.js +2 -0
  14. package/dist/sdk-core/lib/utils/index.js.map +1 -1
  15. package/dist/sdk-react/index.d.ts +2 -1
  16. package/dist/sdk-react/index.d.ts.map +1 -1
  17. package/dist/sdk-react/index.js +2 -1
  18. package/dist/sdk-react/index.js.map +1 -1
  19. package/dist/sdk-react/lib/index.d.ts +52 -1
  20. package/dist/sdk-react/lib/index.d.ts.map +1 -1
  21. package/dist/sdk-react/lib/index.js +0 -1
  22. package/dist/sdk-react/lib/index.js.map +1 -1
  23. package/dist/sdk-react/lib/instrumentation.faro.d.ts.map +1 -1
  24. package/dist/sdk-react/lib/instrumentation.faro.js +20 -11
  25. package/dist/sdk-react/lib/instrumentation.faro.js.map +1 -1
  26. package/dist/sdk-react/lib/internals/config.d.ts +4 -0
  27. package/dist/sdk-react/lib/internals/config.d.ts.map +1 -0
  28. package/dist/sdk-react/lib/internals/config.js +12 -0
  29. package/dist/sdk-react/lib/internals/config.js.map +1 -0
  30. package/dist/sdk-react/lib/internals/redaction/redactors/index.d.ts.map +1 -1
  31. package/dist/sdk-react/lib/internals/redaction/redactors/index.js +4 -7
  32. package/dist/sdk-react/lib/internals/redaction/redactors/index.js.map +1 -1
  33. package/dist/sdk-react/lib/internals/url.d.ts +6 -0
  34. package/dist/sdk-react/lib/internals/url.d.ts.map +1 -0
  35. package/dist/sdk-react/lib/internals/url.js +8 -0
  36. package/dist/sdk-react/lib/internals/url.js.map +1 -0
  37. package/dist/sdk-react/replay.d.ts +7 -0
  38. package/dist/sdk-react/replay.d.ts.map +1 -0
  39. package/dist/sdk-react/replay.js +55 -0
  40. package/dist/sdk-react/replay.js.map +1 -0
  41. package/package.json +32 -18
  42. package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts +0 -6
  43. package/dist/sdk-react/lib/internals/redaction/redactors/email.d.ts.map +0 -1
  44. package/dist/sdk-react/lib/internals/redaction/redactors/email.js +0 -22
  45. package/dist/sdk-react/lib/internals/redaction/redactors/email.js.map +0 -1
  46. package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts +0 -6
  47. package/dist/sdk-react/lib/internals/redaction/redactors/ip.d.ts.map +0 -1
  48. package/dist/sdk-react/lib/internals/redaction/redactors/ip.js +0 -23
  49. package/dist/sdk-react/lib/internals/redaction/redactors/ip.js.map +0 -1
  50. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts +0 -8
  51. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.d.ts.map +0 -1
  52. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js +0 -21
  53. package/dist/sdk-react/lib/internals/redaction/redactors/ppsn.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"email-redactor.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/redaction/email-redactor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9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MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;gBAClC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;gBAC9B,CAAC,CAAC,EAAE,CAAC;YAET,qDAAqD;YACrD,MAAM,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpD,MAAM,YAAY,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEjD,IAAI,aAAa,IAAI,YAAY,EAAE,CAAC;gBAClC,eAAe,EAAE,CAAC;gBAClB,OAAO,iBAAiB,CAAC;YAC3B,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CACF,CAAC;QAEF,OAAO;YACL,aAAa,EAAE,aAAa;YAC5B,OAAO,EAAE;gBACP,eAAe;aAChB;SACF,CAAC;IACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { Context } from "@opentelemetry/api";
2
+ export declare const geoBaggageKeys: readonly ["geo.country", "geo.city", "geo.hash"];
3
+ type GeoKey = (typeof geoBaggageKeys)[number];
4
+ export type GeoAttributes = Partial<Record<GeoKey, string>>;
5
+ export type GeoInput = {
6
+ lat?: number;
7
+ lon?: number;
8
+ country?: string;
9
+ city?: string;
10
+ precision?: number;
11
+ };
12
+ /**
13
+ * Returns geo attributes from the given OTel context's baggage.
14
+ * Use this in span and log processors where the context is passed explicitly.
15
+ */
16
+ export declare function getGeoAttributesFromContext(ctx: Context): GeoAttributes;
17
+ /**
18
+ * Returns geo attributes for the current request context.
19
+ * Reads from OTel Baggage on the active context, set by GeoBaggagePropagator.
20
+ * Use this to manually enrich custom spans, logs, or metrics when geo-enrichment is enabled.
21
+ */
22
+ export declare function getGeoAttributes(): GeoAttributes;
23
+ /**
24
+ * Builds geo attributes from any combination of geo inputs.
25
+ * A geohash is computed automatically when both `lat` and `lon` are provided.
26
+ * Use this to create geo attributes to attach to signals when auto-enrichment is not enabled.
27
+ */
28
+ export declare function createGeoAttributesFrom(input: GeoInput): GeoAttributes;
29
+ export {};
30
+ //# sourceMappingURL=geo-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-context.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/geo-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,cAAc,kDAAmD,CAAC;AAE/E,KAAK,MAAM,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9C,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5D,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAcF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,aAAa,CAiBtE"}
@@ -0,0 +1,54 @@
1
+ import { context, propagation } from "@opentelemetry/api";
2
+ import { encodeGeohash } from "./geohash.js";
3
+ export const geoBaggageKeys = ["geo.country", "geo.city", "geo.hash"];
4
+ function fromBaggage(baggage) {
5
+ if (!baggage)
6
+ return {};
7
+ const attrs = {};
8
+ for (const key of geoBaggageKeys) {
9
+ const value = baggage.getEntry(key)?.value;
10
+ if (value)
11
+ attrs[key] = value;
12
+ }
13
+ return attrs;
14
+ }
15
+ /**
16
+ * Returns geo attributes from the given OTel context's baggage.
17
+ * Use this in span and log processors where the context is passed explicitly.
18
+ */
19
+ export function getGeoAttributesFromContext(ctx) {
20
+ return fromBaggage(propagation.getBaggage(ctx));
21
+ }
22
+ /**
23
+ * Returns geo attributes for the current request context.
24
+ * Reads from OTel Baggage on the active context, set by GeoBaggagePropagator.
25
+ * Use this to manually enrich custom spans, logs, or metrics when geo-enrichment is enabled.
26
+ */
27
+ export function getGeoAttributes() {
28
+ return fromBaggage(propagation.getBaggage(context.active()));
29
+ }
30
+ /**
31
+ * Builds geo attributes from any combination of geo inputs.
32
+ * A geohash is computed automatically when both `lat` and `lon` are provided.
33
+ * Use this to create geo attributes to attach to signals when auto-enrichment is not enabled.
34
+ */
35
+ export function createGeoAttributesFrom(input) {
36
+ const attrs = {};
37
+ if (input.country)
38
+ attrs["geo.country"] = input.country;
39
+ if (input.city)
40
+ attrs["geo.city"] = input.city;
41
+ if (input.lat !== undefined &&
42
+ input.lon !== undefined &&
43
+ input.lat >= -90 &&
44
+ input.lat <= 90 &&
45
+ input.lon >= -180 &&
46
+ input.lon <= 180) {
47
+ const precision = input.precision ?? 4;
48
+ const hash = encodeGeohash(input.lat, input.lon, precision);
49
+ if (hash)
50
+ attrs["geo.hash"] = hash;
51
+ }
52
+ return attrs;
53
+ }
54
+ //# sourceMappingURL=geo-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-context.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/geo-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAa/E,SAAS,WAAW,CAClB,OAAkD;IAElD,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM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AI,IAAI;YAAE,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACrC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Encode latitude and longitude into a geohash string.
3
+ * Alternates between longitude and latitude bits, bisects the coordinate range, accumulates 5 bits into an index into the BASE32 lookup table, and repeats until the desired precision is reached.
4
+ * See https://en.wikipedia.org/wiki/Geohash for algorithm details.
5
+ *
6
+ * @param lat Latitude (-90 to 90)
7
+ * @param lon Longitude (-180 to 180)
8
+ * @param precision Number of characters in the geohash (default: 4)
9
+ * @returns Geohash string of the given precision, or undefined if inputs are invalid
10
+ */
11
+ export declare function encodeGeohash(lat: number, lon: number, precision?: number): string | undefined;
12
+ //# sourceMappingURL=geohash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geohash.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/geohash.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,MAAU,GACpB,MAAM,GAAG,SAAS,CA0CpB"}
@@ -0,0 +1,53 @@
1
+ const BASE32 = "0123456789bcdefghjkmnpqrstuvwxyz";
2
+ /**
3
+ * Encode latitude and longitude into a geohash string.
4
+ * Alternates between longitude and latitude bits, bisects the coordinate range, accumulates 5 bits into an index into the BASE32 lookup table, and repeats until the desired precision is reached.
5
+ * See https://en.wikipedia.org/wiki/Geohash for algorithm details.
6
+ *
7
+ * @param lat Latitude (-90 to 90)
8
+ * @param lon Longitude (-180 to 180)
9
+ * @param precision Number of characters in the geohash (default: 4)
10
+ * @returns Geohash string of the given precision, or undefined if inputs are invalid
11
+ */
12
+ export function encodeGeohash(lat, lon, precision = 4) {
13
+ if (!Number.isFinite(lat) || !Number.isFinite(lon))
14
+ return undefined;
15
+ if (!Number.isInteger(precision) || precision < 1 || precision > 8)
16
+ return undefined;
17
+ if (lat < -90 || lat > 90 || lon < -180 || lon > 180)
18
+ return undefined;
19
+ let latMin = -90;
20
+ let latMax = 90;
21
+ let lonMin = -180;
22
+ let lonMax = 180;
23
+ let hash = "";
24
+ let bit = 0;
25
+ let ch = 0;
26
+ let isLon = true;
27
+ while (hash.length < precision) {
28
+ const mid = isLon ? (lonMin + lonMax) / 2 : (latMin + latMax) / 2;
29
+ const value = isLon ? lon : lat;
30
+ if (value >= mid) {
31
+ ch |= 1 << (4 - bit);
32
+ if (isLon)
33
+ lonMin = mid;
34
+ else
35
+ latMin = mid;
36
+ }
37
+ else {
38
+ if (isLon)
39
+ lonMax = mid;
40
+ else
41
+ latMax = mid;
42
+ }
43
+ isLon = !isLon;
44
+ bit++;
45
+ if (bit === 5) {
46
+ hash += BASE32[ch];
47
+ bit = 0;
48
+ ch = 0;
49
+ }
50
+ }
51
+ return hash;
52
+ }
53
+ //# sourceMappingURL=geohash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geohash.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/geohash.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,kCAAkC,CAAC;AAElD;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAW,EACX,GAAW,EACX,YAAoB,CAAC;IAErB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAErE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC;QAChE,OAAO,SAAS,CAAC;IAEnB,IAAI,GAAG,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,EAAE,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,GAAG,GAAG;QAAE,OAAO,SAAS,CAAC;IAEvE,IAAI,MA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ohash } from "./geohash.js";
3
+ export { getGeoAttributes, getGeoAttributesFromContext, createGeoAttributesFrom, } from "./geo-context.js";
4
+ export type { GeoAttributes, GeoInput, geoBaggageKeys } from "./geo-context.js";
2
5
  export { _containsEncodedComponents } from "./string-decoding.js";
3
6
  export { selfContainedSpanHandlerGenerator } from "./traces.js";
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export { _cleanStringPII, _recursiveObjectClean } from "./data-structures.js";
2
+ export { encodeGeohash } from "./geohash.js";
3
+ export { getGeoAttributes, getGeoAttributesFromContext, createGeoAttributesFrom, } from "./geo-context.js";
2
4
  export { _containsEncodedComponents } from "./string-decoding.js";
3
5
  export { selfContainedSpanHandlerGenerator } from "./traces.js";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../sdk-core/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC"}
@@ -2,9 +2,10 @@ import buildFaroInstrumentation from "./lib/instrumentation.faro.js";
2
2
  export * from "./lib/index.js";
3
3
  export * from "./lib/utils.js";
4
4
  export * from "./lib/traces.js";
5
+ export * from "../sdk-core/index.js";
5
6
  export { buildFaroInstrumentation as instrumentFaro };
6
7
  export type { Span, SpanStatus } from "@opentelemetry/api";
7
8
  export type { Exception } from "@opentelemetry/api";
8
9
  export { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
9
- export { withFaroErrorBoundary, withFaroProfiler, type Faro, } from "@grafana/faro-react";
10
+ export { withFaroErrorBoundary, withFaroProfiler, ReactIntegration, FaroRoutes, createReactRouterV6Options, createReactRouterV6DataOptions, createReactRouterV7Options, createReactRouterV7DataOptions, type Faro, } from "@grafana/faro-react";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,wBAAwB,IAAI,cAAc,EAAE,CAAC;AAEtD,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,IAAI,GACV,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,wBAAwB,IAAI,cAAc,EAAE,CAAC;AAEtD,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,0BAA0B,EAC1B,8BAA8B,EAC9B,0BAA0B,EAC1B,8BAA8B,EAC9B,KAAK,IAAI,GACV,MAAM,qBAAqB,CAAC"}
@@ -2,7 +2,8 @@ import buildFaroInstrumentation from "./lib/instrumentation.faro.js";
2
2
  export * from "./lib/index.js";
3
3
  export * from "./lib/utils.js";
4
4
  export * from "./lib/traces.js";
5
+ export * from "../sdk-core/index.js";
5
6
  export { buildFaroInstrumentation as instrumentFaro };
6
7
  export { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
7
- export { withFaroErrorBoundary, withFaroProfiler, } from "@grafana/faro-react";
8
+ export { withFaroErrorBoundary, withFaroProfiler, ReactIntegration, FaroRoutes, createReactRouterV6Options, createReactRouterV6DataOptions, createReactRouterV7Options, createReactRouterV7DataOptions, } from "@grafana/faro-react";
8
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,wBAAwB,IAAI,cAAc,EAAE,CAAC;AAKtD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GAEjB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAErE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAErC,OAAO,EAAE,wBAAwB,IAAI,cAAc,EAAE,CAAC;AAKtD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,0BAA0B,EAC1B,8BAA8B,EAC9B,0BAA0B,EAC1B,8BAA8B,GAE/B,MAAM,qBAAqB,CAAC"}
@@ -1,5 +1,6 @@
1
- import { BasicRedactor } from "../../sdk-core/lib/redaction/basic-redactor.js";
1
+ import type { BasicRedactor } from "../../sdk-core/lib/redaction/basic-redactor.js";
2
2
  import type { MetaApp } from "@grafana/faro-core/dist/types/metas/index.js";
3
+ import type { Instrumentation, ReactIntegration } from "@grafana/faro-react";
3
4
  interface SDKConfig {
4
5
  /**
5
6
  * The opentelemetry collector entrypoint GRPC url.
@@ -68,6 +69,56 @@ export interface FaroSDKConfig extends SDKConfig {
68
69
  */
69
70
  custom?: BasicRedactor[];
70
71
  };
72
+ /**
73
+ * Optional ReactIntegration instrumentation instance.
74
+ */
75
+ reactIntegration?: InstanceType<typeof ReactIntegration>;
76
+ /**
77
+ * Additional custom Faro instrumentations to register alongside the
78
+ * built-in ones (mirrors `additionalInstrumentations` in the Node SDK).
79
+ * @default []
80
+ */
81
+ additionalInstrumentations?: Instrumentation[];
82
+ /**
83
+ * Optional function to process the page URL before it is sent as metadata.
84
+ * Receives the raw URL with stripped fragment and returns the final URL string.
85
+ * When omitted, the configured PII redactors are applied to the URL as a failsafe.
86
+ */
87
+ pageUrlProcessor?: (url: string) => string;
88
+ }
89
+ export interface ReplayConfig {
90
+ /**
91
+ * Enable Session Replay recording.
92
+ * @default false
93
+ */
94
+ enabled?: boolean;
95
+ /**
96
+ * Fraction (0..1) of globally sampled sessions that are also recorded.
97
+ * Applied on top of Faro's own session sampling.
98
+ * @default 1
99
+ */
100
+ samplingRate?: number;
101
+ /**
102
+ * CSS selector for extra regions to block from recording. Matched elements
103
+ * are replaced with a placeholder in the replay, so their contents —
104
+ * including images, SVG, background media, and canvas — are never captured.
105
+ * Use this to hide sensitive areas (uploaded documents, ID photos, signatures).
106
+ *
107
+ * Added on top of the always-on defaults `.rr-block` and `.o11y-replay-block`:
108
+ * any element carrying either class is blocked even without this option.
109
+ * Additive only — it can hide more, never weaken the always-on masking.
110
+ * @default undefined
111
+ */
112
+ blockSelector?: string;
113
+ /**
114
+ * CSS selector for elements whose mutations and interactions are ignored.
115
+ * Unlike `blockSelector`, this does NOT hide content — the element's initial
116
+ * DOM is still recorded in the snapshot; only its later changes and input
117
+ * events are dropped. Use it to cut recording noise from busy widgets, not
118
+ * to mask sensitive data.
119
+ * @default undefined
120
+ */
121
+ ignoreSelector?: string;
71
122
  }
72
123
  export type SDKCollectorMode = "single" | "batch";
73
124
  export type SDKLogLevel = "NONE" | "ERROR" | "WARN" | "INFO" | "DEBUG" | "VERBOSE" | "ALL";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAC;AAE5E,UAAU,SAAS;IACjB;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB;;;WAGG;QACH,EAAE,CAAC,EAAE,OAAO,CAAC;QACb;;;WAGG;QACH,IAAI,CAAC,EAAE,OAAO,CAAC;QACf;;;WAGG;QACH,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,KAAK,CAAC;AAEV,cAAc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AAM,CAAC;IACtB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,MAAM,WAAW,GACrB,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;AAEnE,cAAc,kBAAkB,CAAC"}
@@ -1,3 +1,2 @@
1
- import { BasicRedactor } from "../../sdk-core/lib/redaction/basic-redactor.js";
2
1
  export * from "./hooks/index.js";
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAqF/E,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAmIA,cAAc,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.faro.d.ts","sourceRoot":"","sources":["../../../lib/instrumentation.faro.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,qBAAqB,CAAC;AAO7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQhD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,GAAG,SAAS,CA+ElB"}
1
+ {"version":3,"file":"instrumentation.faro.d.ts","sourceRoot":"","sources":["../../../lib/instrumentation.faro.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,qBAAqB,CAAC;AAO7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAKhD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,GAAG,SAAS,CAoFlB"}
@@ -6,8 +6,8 @@ import { DocumentLoadInstrumentation } from "@opentelemetry/instrumentation-docu
6
6
  import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
7
7
  import { UserInteractionInstrumentation } from "@opentelemetry/instrumentation-user-interaction";
8
8
  import { _beforeSend } from "./internals/hooks.js";
9
- import { redactors, } from "./internals/redaction/redactors/index.js";
10
- import { BasicRedactor } from "../../sdk-core/lib/index.js";
9
+ import { buildRedactorsChain } from "./internals/config.js";
10
+ import { processPageUrl } from "./internals/url.js";
11
11
  export default function buildFaroInstrumentation(config) {
12
12
  if (!config) {
13
13
  console.warn("observability config not set. Skipping Faro OpenTelemetry instrumentation.");
@@ -21,15 +21,7 @@ export default function buildFaroInstrumentation(config) {
21
21
  console.error("collectorUrl does not use a valid format. Skipping Faro OpenTelemetry instrumentation.");
22
22
  return;
23
23
  }
24
- const defaultRedactors = Object.entries(redactors)
25
- .filter(([key]) => {
26
- return config.detection?.[key] !== false;
27
- })
28
- .map(([_, value]) => value);
29
- const customRedactors = config.detection?.custom?.length
30
- ? config.detection?.custom.filter((redactor) => redactor instanceof BasicRedactor)
31
- : [];
32
- const redactorsChain = [...defaultRedactors, ...customRedactors];
24
+ const redactorsChain = buildRedactorsChain(config);
33
25
  try {
34
26
  diag.setLogger(new DiagConsoleLogger(), config.diagLogLevel
35
27
  ? DiagLogLevel[config.diagLogLevel]
@@ -43,6 +35,21 @@ export default function buildFaroInstrumentation(config) {
43
35
  batching: {
44
36
  enabled: config.collectorMode !== "single",
45
37
  },
38
+ metas: [
39
+ () => {
40
+ return {
41
+ page: {
42
+ // Failsafe: when no custom pageUrlProcessor is supplied, still run
43
+ // the configured PII redactors over the URL so identifiers are not
44
+ // leaked through page metadata (or Session Replay URL captures).
45
+ url: processPageUrl(location.href, {
46
+ pageUrlProcessor: config.pageUrlProcessor,
47
+ redactorsChain,
48
+ }),
49
+ },
50
+ };
51
+ },
52
+ ],
46
53
  beforeSend: _beforeSend(redactorsChain),
47
54
  instrumentations: [
48
55
  ...getWebInstrumentations({
@@ -63,6 +70,8 @@ export default function buildFaroInstrumentation(config) {
63
70
  new UserInteractionInstrumentation(),
64
71
  ],
65
72
  }),
73
+ ...(config.reactIntegration ? [config.reactIntegration] : []),
74
+ ...(config.additionalInstrumentations ?? []),
66
75
  ],
67
76
  });
68
77
  console.log("Faro OpenTelemetry instrumentation started successfully.");
@@ -1 +1 @@
1
- {"version":3,"file":"instrumentation.faro.js","sourceRoot":"","sources":["../../../lib/instrumentation.faro.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,GAEzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AAEjG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAEL,SAAS,GACV,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAsB;IAEtB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CACV,4EAA4E,CAC7E,CAAC;QACF,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,C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AAE,WAAW,CAAC,cAAc,CAAC;YACvC,gBAAgB,EAAE;gBAChB,GAAG,sBAAsB,CAAC;oBACxB,cAAc,EAAE,IAAI;iBACrB,CAAC;gBACF,IAAI,qBAAqB,EAAE;gBAC3B,IAAI,wBAAwB,EAAE;gBAC9B,IAAI,sBAAsB,CAAC;oBACzB,UAAU,EAAE,IAAI,yBAAyB,EAAE;oBAC3C,gBAAgB,EAAE;wBAChB,IAAI,2BAA2B,EAAE;wBACjC,IAAI,oBAAoB,CAAC;4BACvB,UAAU,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,uCAAuC;4BAC1E,4BAA4B,EAAE,MAAM,CAAC,gBAAgB;gCACnD,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;gCAC9D,CAAC,CAAC,SAAS;yBACd,CAAC;wBACF,IAAI,8BAA8B,EAAE;qBACrC;iBACF,CAAC;aACH;SACF,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oDAAoD,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"instrumentation.faro.js","sourceRoot":"","sources":["../../../lib/instrumentation.faro.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EAC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AAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,GAAG,CAAC,MAAM,CAAC,0BAA0B,IAAI,EAAE,CAAC;aAC7C;SACF,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oDAAoD,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BasicRedactor } from "../../../sdk-core/lib/index.js";
2
+ import type { FaroSDKConfig } from "../index.js";
3
+ export declare function buildRedactorsChain(config: Pick<FaroSDKConfig, "detection">): BasicRedactor[];
4
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../lib/internals/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,GACvC,aAAa,EAAE,CAYjB"}
@@ -0,0 +1,12 @@
1
+ import { BasicRedactor } from "../../../sdk-core/lib/index.js";
2
+ import { redactors } from "./redaction/redactors/index.js";
3
+ export function buildRedactorsChain(config) {
4
+ const defaultRedactors = Object.entries(redactors)
5
+ .filter(([key]) => config.detection?.[key] !== false)
6
+ .map(([, value]) => value);
7
+ const customRedactors = config.detection?.custom?.length
8
+ ? config.detection.custom.filter((redactor) => redactor instanceof BasicRedactor)
9
+ : [];
10
+ return [...defaultRedactors, ...customRedactors];
11
+ }
12
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../lib/internals/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAqB,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE9E,MAAM,UAAU,mBAAmB,CACjC,MAAwC;IAExC,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;SAC/C,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,GAAmB,CAAC,KAAK,KAAK,CAAC;SACpE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IAE7B,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM;QACtD,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAC5B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,YAAY,aAAa,CAChD;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,eAAe,CAAC,CAAC;AACnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGjE,MAAM,MAAM,YAAY,GAAG,MAAM,IAAI,CACnC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACvC,QAAQ,CACT,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,aAAa,CAIzD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,aAAa,EAId,MAAM,kCAAkC,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG,MAAM,IAAI,CACnC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EACvC,QAAQ,CACT,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,aAAa,CAIzD,CAAC"}
@@ -1,11 +1,8 @@
1
1
  import {} from "../../../index.js";
2
- import { EmailRedactorWithMetrics } from "./email.js";
3
- import { IpRedactorWithMetrics } from "./ip.js";
4
- import { BasicRedactor } from "../../../../../sdk-core/index.js";
5
- import { PpsnRedactorWithMetrics } from "./ppsn.js";
2
+ import { BasicRedactor, EmailRedactor, IpRedactor, PpsnRedactor, } from "../../../../../sdk-core/index.js";
6
3
  export const redactors = {
7
- email: new EmailRedactorWithMetrics(),
8
- ip: new IpRedactorWithMetrics(),
9
- ppsn: new PpsnRedactorWithMetrics(),
4
+ email: new EmailRedactor(),
5
+ ip: new IpRedactor(),
6
+ ppsn: new PpsnRedactor(),
10
7
  };
11
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAOpD,MAAM,CAAC,MAAM,SAAS,GAAwC;IAC5D,KAAK,EAAE,IAAI,wBAAwB,EAAE;IACrC,EAAE,EAAE,IAAI,qBAAqB,EAAE;IAC/B,IAAI,EAAE,IAAI,uBAAuB,EAAE;CACpC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,GACb,MAAM,kCAAkC,CAAC;AAO1C,MAAM,CAAC,MAAM,SAAS,GAAwC;IAC5D,KAAK,EAAE,IAAI,aAAa,EAAE;IAC1B,EAAE,EAAE,IAAI,UAAU,EAAE;IACpB,IAAI,EAAE,IAAI,YAAY,EAAE;CACzB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type BasicRedactor } from "../../../sdk-core/lib/index.js";
2
+ export declare function processPageUrl(rawUrl: string, { pageUrlProcessor, redactorsChain, }: {
3
+ pageUrlProcessor?: (url: string) => string;
4
+ redactorsChain: BasicRedactor[];
5
+ }): string;
6
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../../lib/internals/url.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AAExC,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,EACE,gBAAgB,EAChB,cAAc,GACf,EAAE;IACD,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC,GACA,MAAM,CAKR"}
@@ -0,0 +1,8 @@
1
+ import { _cleanStringPII, } from "../../../sdk-core/lib/index.js";
2
+ export function processPageUrl(rawUrl, { pageUrlProcessor, redactorsChain, }) {
3
+ const url = rawUrl.split("#")[0];
4
+ return pageUrlProcessor
5
+ ? pageUrlProcessor(url)
6
+ : _cleanStringPII(url, "page_url", redactorsChain);
7
+ }
8
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../../lib/internals/url.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,gCAAgC,CAAC;AAExC,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,EACE,gBAAgB,EAChB,cAAc,GAIf;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,gBAAgB;QACrB,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC;QACvB,CAAC,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { FaroSDKConfig, ReplayConfig } from "./lib/index.js";
2
+ export interface ReplayFaroSDKConfig extends FaroSDKConfig {
3
+ replay?: ReplayConfig;
4
+ }
5
+ export declare function withReplay(config: ReplayFaroSDKConfig): FaroSDKConfig;
6
+ export type { ReplayConfig };
7
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../replay.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIlE,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,mBAAmB,GAAG,aAAa,CAkBrE;AAED,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { ReplayInstrumentation, } from "@grafana/faro-instrumentation-replay";
2
+ import { buildRedactorsChain } from "./lib/internals/config.js";
3
+ import { processPageUrl } from "./lib/internals/url.js";
4
+ export function withReplay(config) {
5
+ const { replay, ...faroConfig } = config;
6
+ if (!replay?.enabled)
7
+ return faroConfig;
8
+ const redactorsChain = buildRedactorsChain(faroConfig);
9
+ const processUrl = (url) => processPageUrl(url, {
10
+ pageUrlProcessor: faroConfig.pageUrlProcessor,
11
+ redactorsChain,
12
+ });
13
+ return {
14
+ ...faroConfig,
15
+ additionalInstrumentations: [
16
+ new ReplayInstrumentation(buildReplayOptions(replay, processUrl)),
17
+ ...(faroConfig.additionalInstrumentations ?? []),
18
+ ],
19
+ };
20
+ }
21
+ // Always-on block convention: elements carrying either class are never
22
+ // recorded, even when the consumer sets no `blockSelector`. `.rr-block` is
23
+ // rrweb's native default; `.o11y-replay-block` is the SDK's self-documenting
24
+ // alias. A consumer `blockSelector` is added on top — it can only block more.
25
+ const DEFAULT_BLOCK_SELECTOR = ".rr-block, .o11y-replay-block";
26
+ function clampSamplingRate(rate = 1) {
27
+ return Number.isFinite(rate) ? Math.min(1, Math.max(0, rate)) : 1;
28
+ }
29
+ function buildReplayOptions(replay, processUrl) {
30
+ return {
31
+ samplingRate: clampSamplingRate(replay.samplingRate),
32
+ maskAllInputs: true,
33
+ maskTextSelector: "*",
34
+ blockSelector: [DEFAULT_BLOCK_SELECTOR, replay.blockSelector]
35
+ .filter(Boolean)
36
+ .join(", "),
37
+ ignoreSelector: replay.ignoreSelector,
38
+ beforeSend: (event) => processReplayMetaUrl(event, processUrl),
39
+ };
40
+ }
41
+ function processReplayMetaUrl(event, processUrl) {
42
+ const data = event.data;
43
+ // rrweb EventType.Meta (4) is the only event carrying a page URL, in `href`.
44
+ const type = event.type;
45
+ if (type !== 4 || typeof data?.href !== "string")
46
+ return event;
47
+ return {
48
+ ...event,
49
+ data: {
50
+ ...data,
51
+ href: processUrl(data.href),
52
+ },
53
+ };
54
+ }
55
+ //# sourceMappingURL=replay.js.map
@@ -0,0 +1 @@
1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,MAAM,CAAC,YAAY,CAAC;QACpD,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,GAAG;QACrB,aAAa,EAAE,CAAC,sBAAsB,EAAE,MAAM,CAAC,aAAa,CAAC;aAC1D,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC;QACb,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAkB,EAClB,UAAmC;IAEnC,MAAM,IAAI,GAAI,KAAuC,CAAC,IAAI,CAAC;IAC3D,6EAA6E;IAC7E,MAAM,IAAI,GAAW,KAAK,CAAC,IAAI,CAAC;IAChC,IAAI,IAAI,KAAK,CAAC,IAAI,OAAO,IAAI,EAAE,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE/D,OAAO;QACL,GAAG,KAAK;QACR,IAAI,EAAE;YACJ,GAAG,IAAI;YACP,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;SAC5B;KACa,CAAC;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "@ogcio/o11y-sdk-react",
3
- "version": "0.11.2",
3
+ "version": "0.12.0",
4
4
  "description": "Opentelemetry standard instrumentation SDK for React based project",
5
5
  "main": "dist/sdk-react/index.js",
6
6
  "types": "dist/sdk-react/index.d.ts",
7
7
  "type": "module",
8
8
  "exports": {
9
- ".": "./dist/sdk-react/index.js",
9
+ ".": {
10
+ "types": "./dist/sdk-react/index.d.ts",
11
+ "default": "./dist/sdk-react/index.js"
12
+ },
13
+ "./replay": {
14
+ "types": "./dist/sdk-react/replay.d.ts",
15
+ "default": "./dist/sdk-react/replay.js"
16
+ },
10
17
  "./*": "./dist/*.js"
11
18
  },
12
19
  "files": [
@@ -23,32 +30,39 @@
23
30
  "author": "team:ogcio/observability",
24
31
  "license": "ISC",
25
32
  "dependencies": {
26
- "@grafana/faro-react": "2.6.3",
27
- "@grafana/faro-web-sdk": "2.6.3",
28
- "@grafana/faro-web-tracing": "2.6.3",
33
+ "@grafana/faro-react": "2.8.2",
34
+ "@grafana/faro-web-sdk": "2.8.2",
35
+ "@grafana/faro-web-tracing": "2.8.2",
29
36
  "@opentelemetry/api": "1.9.1",
30
- "@opentelemetry/core": "2.7.1",
31
- "@opentelemetry/instrumentation-document-load": "0.62.0",
32
- "@opentelemetry/instrumentation-fetch": "0.217.0",
33
- "@opentelemetry/instrumentation-user-interaction": "0.61.0"
37
+ "@opentelemetry/core": "2.9.0",
38
+ "@opentelemetry/instrumentation-document-load": "0.65.0",
39
+ "@opentelemetry/instrumentation-fetch": "0.220.0",
40
+ "@opentelemetry/instrumentation-user-interaction": "0.64.0"
34
41
  },
35
42
  "devDependencies": {
36
- "@grafana/faro-core": "2.6.3",
37
- "@opentelemetry/sdk-trace-base": "2.7.1",
43
+ "@grafana/faro-core": "2.8.2",
44
+ "@grafana/faro-instrumentation-replay": "2.8.2",
45
+ "@opentelemetry/sdk-trace-base": "2.9.0",
38
46
  "@testing-library/react": "16.3.2",
39
- "@types/node": "25.7.0",
40
- "@types/react": "19.2.14",
41
- "@vitest/coverage-v8": "4.1.6",
42
- "happy-dom": "20.9.0",
43
- "react": "19.2.6",
44
- "react-dom": "19.2.6",
47
+ "@types/node": "26.1.1",
48
+ "@types/react": "19.2.17",
49
+ "@vitest/coverage-v8": "4.1.10",
50
+ "happy-dom": "20.10.6",
51
+ "react": "^19.2.7",
52
+ "react-dom": "^19.2.7",
45
53
  "typescript": "6.0.3",
46
- "vitest": "4.1.6"
54
+ "vitest": "4.1.10"
47
55
  },
48
56
  "peerDependencies": {
57
+ "@grafana/faro-instrumentation-replay": "2.8.2",
49
58
  "react": "^18.0.0 || ^19.0.0",
50
59
  "react-dom": "^18.0.0 || ^19.0.0"
51
60
  },
61
+ "peerDependenciesMeta": {
62
+ "@grafana/faro-instrumentation-replay": {
63
+ "optional": true
64
+ }
65
+ },
52
66
  "scripts": {
53
67
  "build": "rm -rf dist && tsc -p tsconfig.json",
54
68
  "test": "vitest"
@@ -1,6 +0,0 @@
1
- import { EmailRedactor, type StringKind } from "../../../../../sdk-core/index.js";
2
- import type { TransportItemType } from "@grafana/faro-core";
3
- export declare class EmailRedactorWithMetrics extends EmailRedactor {
4
- protected exportMetrics(context: ReturnType<typeof this.redact>["context"], source: TransportItemType, kind: StringKind): void;
5
- }
6
- //# sourceMappingURL=email.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/email.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,KAAK,UAAU,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,qBAAa,wBAAyB,SAAQ,aAAa;IACzD,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAClD,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,GACf,IAAI;CAoBR"}
@@ -1,22 +0,0 @@
1
- import { faro } from "@grafana/faro-web-sdk";
2
- import { EmailRedactor, } from "../../../../../sdk-core/index.js";
3
- export class EmailRedactorWithMetrics extends EmailRedactor {
4
- exportMetrics(context, source, kind) {
5
- for (const [domain, domainCount] of Object.entries(context.domains)) {
6
- faro.api.pushMeasurement({
7
- type: "faro_o11y_pii_redaction",
8
- values: {
9
- redacted: domainCount,
10
- },
11
- }, {
12
- context: {
13
- pii_type: "email",
14
- redaction_source: source,
15
- pii_email_domain: domain,
16
- pii_format: kind,
17
- },
18
- });
19
- }
20
- }
21
- }
22
- //# sourceMappingURL=email.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACL,aAAa,GAEd,MAAM,kCAAkC,CAAC;AAG1C,MAAM,OAAO,wBAAyB,SAAQ,aAAa;IAC/C,aAAa,CACrB,OAAkD,EAClD,MAAyB,EACzB,IAAgB;QAEhB,KAAK,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACpE,IAAI,CAAC,GAAG,CAAC,eAAe,CACtB;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE;oBACN,QAAQ,EAAE,WAAW;iBACtB;aACF,EACD;gBACE,OAAO,EAAE;oBACP,QAAQ,EAAE,OAAO;oBACjB,gBAAgB,EAAE,MAAM;oBACxB,gBAAgB,EAAE,MAAM;oBACxB,UAAU,EAAE,IAAI;iBACjB;aACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1,6 +0,0 @@
1
- import { IpRedactor, type StringKind } from "../../../../../sdk-core/index.js";
2
- import type { TransportItemType } from "@grafana/faro-core";
3
- export declare class IpRedactorWithMetrics extends IpRedactor {
4
- protected exportMetrics(context: ReturnType<typeof this.redact>["context"], source: TransportItemType, kind: StringKind): void;
5
- }
6
- //# sourceMappingURL=ip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ip.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,qBAAa,qBAAsB,SAAQ,UAAU;IACnD,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAClD,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,GACf,IAAI;CAqBR"}
@@ -1,23 +0,0 @@
1
- import { faro } from "@grafana/faro-web-sdk";
2
- import { IpRedactor } from "../../../../../sdk-core/index.js";
3
- export class IpRedactorWithMetrics extends IpRedactor {
4
- exportMetrics(context, source, kind) {
5
- Object.entries(context.counters).forEach(([type, counter]) => {
6
- if (counter > 0) {
7
- faro.api.pushMeasurement({
8
- type: "faro_o11y_pii_redaction",
9
- values: {
10
- redacted: counter,
11
- },
12
- }, {
13
- context: {
14
- pii_type: type,
15
- redaction_source: source,
16
- pii_format: kind,
17
- },
18
- });
19
- }
20
- });
21
- }
22
- }
23
- //# sourceMappingURL=ip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ip.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAmB,MAAM,kCAAkC,CAAC;AAG/E,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IACzC,aAAa,CACrB,OAAkD,EAClD,MAAyB,EACzB,IAAgB;QAEhB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAC3D,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBAChB,IAAI,CAAC,GAAG,CAAC,eAAe,CACtB;oBACE,IAAI,EAAE,yBAAyB;oBAC/B,MAAM,EAAE;wBACN,QAAQ,EAAE,OAAO;qBAClB;iBACF,EACD;oBACE,OAAO,EAAE;wBACP,QAAQ,EAAE,IAAI;wBACd,gBAAgB,EAAE,MAAM;wBACxB,UAAU,EAAE,IAAI;qBACjB;iBACF,CACF,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,8 +0,0 @@
1
- import { PpsnRedactor, type StringKind } from "../../../../../sdk-core/index.js";
2
- import type { TransportItemType } from "@grafana/faro-core";
3
- export declare class PpsnRedactorWithMetrics extends PpsnRedactor {
4
- protected exportMetrics(context: {
5
- redactedCounter: number;
6
- }, source: TransportItemType, kind: StringKind): void;
7
- }
8
- //# sourceMappingURL=ppsn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ppsn.d.ts","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ppsn.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,KAAK,UAAU,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,qBAAa,uBAAwB,SAAQ,YAAY;IACvD,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,EACpC,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,UAAU,GACf,IAAI;CAmBR"}
@@ -1,21 +0,0 @@
1
- import { faro } from "@grafana/faro-web-sdk";
2
- import { PpsnRedactor, } from "../../../../../sdk-core/index.js";
3
- export class PpsnRedactorWithMetrics extends PpsnRedactor {
4
- exportMetrics(context, source, kind) {
5
- if (context.redactedCounter > 0) {
6
- faro.api.pushMeasurement({
7
- type: "faro_o11y_pii_redaction",
8
- values: {
9
- redacted: context.redactedCounter,
10
- },
11
- }, {
12
- context: {
13
- pii_type: "ppsn",
14
- redaction_source: source,
15
- pii_format: kind,
16
- },
17
- });
18
- }
19
- }
20
- }
21
- //# sourceMappingURL=ppsn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ppsn.js","sourceRoot":"","sources":["../../../../../../lib/internals/redaction/redactors/ppsn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACL,YAAY,GAEb,MAAM,kCAAkC,CAAC;AAG1C,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IAC7C,aAAa,CACrB,OAAoC,EACpC,MAAyB,EACzB,IAAgB;QAEhB,IAAI,OAAO,CAAC,eAAe,GAAG,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,eAAe,CACtB;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,MAAM,EAAE;oBACN,QAAQ,EAAE,OAAO,CAAC,eAAe;iBAClC;aACF,EACD;gBACE,OAAO,EAAE;oBACP,QAAQ,EAAE,MAAM;oBAChB,gBAAgB,EAAE,MAAM;oBACxB,UAAU,EAAE,IAAI;iBACjB;aACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}