@corbado/observe 1.12.0 → 1.13.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.
- package/CHANGELOG.md +12 -0
- package/dist/analysis/index.mjs +1 -0
- package/dist/analysis/plugins/fixed-source-path.mjs +47 -0
- package/dist/analysis/readers/page.mjs +4 -0
- package/dist/analysis/storage/index.mjs +21 -33
- package/dist/analysis/tracker-core.mjs +11 -0
- package/dist/analysis/version.mjs +1 -1
- package/dist/cdn/script.global.js +1 -1
- package/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @corbado/observe
|
|
2
2
|
|
|
3
|
+
## 1.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e0c70aa: New tracker plugin `fixedSourcePath(policy)` for `initCore`: the batch source path (`meta.trackingSourcePath`) comes from the integration's policy (e.g. `pageSourcePath(PAGES)` of `@corbado/autocapture`) instead of the server-driven `sourcePathQuery` config, so it can be declared in the integration's collection manifest. A failing policy sends the fully masked path. `init()` / `CorbadoTracker` are unchanged.
|
|
8
|
+
|
|
9
|
+
## 1.12.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a5b4069: Reader metadata: optional `storage` (`ReaderStorage`: area, keys, lifetime, retention) for readers of Observe's own storage. The SDK's local, session and cookie storage readers declare it and no longer list fields, so the manifest extractor lists them in the new `storage` section instead of `sources`. Reader metadata is stripped from builds; no runtime change.
|
|
14
|
+
|
|
3
15
|
## 1.12.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/analysis/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./plugins/cookie-storage.mjs";
|
|
|
11
11
|
export * from "./plugins/cross-origin-session.mjs";
|
|
12
12
|
export * from "./plugins/raw-errors.mjs";
|
|
13
13
|
export * from "./plugins/probes.mjs";
|
|
14
|
+
export * from "./plugins/fixed-source-path.mjs";
|
|
14
15
|
export * from "./probe-lane.mjs";
|
|
15
16
|
export * from "./transport.mjs";
|
|
16
17
|
export * from "./queue.mjs";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/plugins/fixed-source-path.ts
|
|
2
|
+
import { readLocationPath } from "../readers/page.mjs";
|
|
3
|
+
var MAX_SOURCE_PATH = 2048;
|
|
4
|
+
function maskedSourcePath(path) {
|
|
5
|
+
const segments = String(path ?? "").split("/").filter((segment) => segment !== "");
|
|
6
|
+
return segments.length === 0 ? "/" : "/" + segments.map(() => "*").join("/");
|
|
7
|
+
}
|
|
8
|
+
function fixedSourcePath(policy) {
|
|
9
|
+
if (typeof policy !== "function") return {};
|
|
10
|
+
return {
|
|
11
|
+
sourcePath: () => {
|
|
12
|
+
const { path, search } = readLocationPath({
|
|
13
|
+
key: "page:location.fixed-source-path",
|
|
14
|
+
title: "Page path and declared parameters",
|
|
15
|
+
accessNote: "location.pathname and location.search, reduced by the integration's declared page templates and parameters (trackingSourcePath); everything else is masked",
|
|
16
|
+
group: "Page",
|
|
17
|
+
origin: "observe-external",
|
|
18
|
+
fields: [
|
|
19
|
+
{
|
|
20
|
+
path: "url.path",
|
|
21
|
+
label: "Page path (declared parts only)",
|
|
22
|
+
category: "technical",
|
|
23
|
+
exposure: "partial",
|
|
24
|
+
transform: { note: "declared page templates and path parameters; other segments become '*'" }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
path: "url.query",
|
|
28
|
+
label: "Page address parameters (declared ones only)",
|
|
29
|
+
category: "technical",
|
|
30
|
+
exposure: "redacted",
|
|
31
|
+
transform: { note: "declared parameters as their declared reduction; other values become '*'" }
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
try {
|
|
36
|
+
const out = policy(path, search);
|
|
37
|
+
return typeof out === "string" ? out.slice(0, MAX_SOURCE_PATH) : maskedSourcePath(path);
|
|
38
|
+
} catch {
|
|
39
|
+
return maskedSourcePath(path);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
fixedSourcePath,
|
|
46
|
+
maskedSourcePath
|
|
47
|
+
};
|
|
@@ -21,6 +21,9 @@ function readSourcePath(_meta, mode, allow) {
|
|
|
21
21
|
const search = applySourcePathQuery(window.location.search, mode, allow);
|
|
22
22
|
return `${window.location.pathname}${search}`;
|
|
23
23
|
}
|
|
24
|
+
function readLocationPath(_meta) {
|
|
25
|
+
return { path: window.location.pathname, search: window.location.search };
|
|
26
|
+
}
|
|
24
27
|
function readCookieScope(_meta) {
|
|
25
28
|
return { hostname: window.location.hostname, https: window.location.protocol === "https:" };
|
|
26
29
|
}
|
|
@@ -29,6 +32,7 @@ export {
|
|
|
29
32
|
readCookieScope,
|
|
30
33
|
readDocumentComplete,
|
|
31
34
|
readDocumentHidden,
|
|
35
|
+
readLocationPath,
|
|
32
36
|
readPageUrl,
|
|
33
37
|
readSourcePath
|
|
34
38
|
};
|
|
@@ -28,17 +28,13 @@ var LocalStorage = class {
|
|
|
28
28
|
accessNote: "localStorage, Observe's own cbo_ keys",
|
|
29
29
|
group: "Observe SDK state",
|
|
30
30
|
origin: "observe-internal",
|
|
31
|
-
fields: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
note: "own cbo_* keys only (session, sequence, outbox, config cache, experiments, client env, debug); written and read back by the SDK"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
]
|
|
31
|
+
fields: [],
|
|
32
|
+
storage: {
|
|
33
|
+
area: "local",
|
|
34
|
+
keys: ["cbo_*"],
|
|
35
|
+
lifetime: "persistent",
|
|
36
|
+
retention: "Kept on the device; Observe replaces or removes its entries as they change"
|
|
37
|
+
}
|
|
42
38
|
});
|
|
43
39
|
/**
|
|
44
40
|
* Error situations:
|
|
@@ -99,17 +95,13 @@ var CookieStorage = class {
|
|
|
99
95
|
accessNote: "document.cookie, Observe's own cbo_ cookies",
|
|
100
96
|
group: "Observe SDK state",
|
|
101
97
|
origin: "observe-internal",
|
|
102
|
-
fields: [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
note: "own cbo_* cookies only (cookie storage mode); the cookie string is scanned for the requested key"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
]
|
|
98
|
+
fields: [],
|
|
99
|
+
storage: {
|
|
100
|
+
area: "cookie",
|
|
101
|
+
keys: ["cbo_*"],
|
|
102
|
+
lifetime: "browser",
|
|
103
|
+
retention: "Removed when the browser closes"
|
|
104
|
+
}
|
|
113
105
|
});
|
|
114
106
|
/**
|
|
115
107
|
* Error situations:
|
|
@@ -183,17 +175,13 @@ var SessionStorage = class {
|
|
|
183
175
|
accessNote: "sessionStorage, Observe's own cbo_ keys",
|
|
184
176
|
group: "Observe SDK state",
|
|
185
177
|
origin: "observe-internal",
|
|
186
|
-
fields: [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
note: "own cbo_* keys only (per-tab session, sequence and tab id); written and read back by the SDK"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
]
|
|
178
|
+
fields: [],
|
|
179
|
+
storage: {
|
|
180
|
+
area: "session",
|
|
181
|
+
keys: ["cbo_*"],
|
|
182
|
+
lifetime: "tab",
|
|
183
|
+
retention: "Removed when the tab closes"
|
|
184
|
+
}
|
|
197
185
|
});
|
|
198
186
|
/**
|
|
199
187
|
* Error situations:
|
|
@@ -132,6 +132,7 @@ var CorbadoTrackerCore = class _CorbadoTrackerCore {
|
|
|
132
132
|
this.eachPlugin(installed, (plugin) => {
|
|
133
133
|
if (plugin.session) this.bridge = plugin.session(this) || this.bridge;
|
|
134
134
|
if (plugin.rawErrors) this.rawErrors = plugin.rawErrors;
|
|
135
|
+
if (typeof plugin.sourcePath === "function") this.fixedSourcePath = plugin.sourcePath;
|
|
135
136
|
});
|
|
136
137
|
if (options.fixedDataConfig?.crossOriginSession && !this.bridge) {
|
|
137
138
|
this.logger.warn("fixedDataConfig.crossOriginSession is ignored without the crossOriginSession() plugin");
|
|
@@ -270,6 +271,8 @@ var CorbadoTrackerCore = class _CorbadoTrackerCore {
|
|
|
270
271
|
bridge;
|
|
271
272
|
/** Raw-error serializer of a plugin; undefined = operation step errors drop `rawError`. */
|
|
272
273
|
rawErrors;
|
|
274
|
+
/** Fixed source path of a plugin; undefined = the server-driven `sourcePathQuery` policy. */
|
|
275
|
+
fixedSourcePath;
|
|
273
276
|
/** @internal Shared passive page observation and per-operation context registration. */
|
|
274
277
|
getWindowObserver() {
|
|
275
278
|
return this.windowObserver ??= new SharedWindowObserver(
|
|
@@ -719,6 +722,14 @@ var CorbadoTrackerCore = class _CorbadoTrackerCore {
|
|
|
719
722
|
if (typeof window === "undefined") {
|
|
720
723
|
return void 0;
|
|
721
724
|
}
|
|
725
|
+
if (this.fixedSourcePath) {
|
|
726
|
+
try {
|
|
727
|
+
const path = this.fixedSourcePath();
|
|
728
|
+
return typeof path === "string" ? path : void 0;
|
|
729
|
+
} catch {
|
|
730
|
+
return void 0;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
722
733
|
return readSourcePath(
|
|
723
734
|
{
|
|
724
735
|
key: "page:location.source-path",
|