@spotify-confidence/session-recording 0.18.6 → 0.18.8

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.
@@ -0,0 +1,3 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_uploader = require("./uploader-CcDy4aME.cjs");
3
+ exports.workerScript = require_uploader.workerScript;
@@ -0,0 +1,4 @@
1
+ //#region ../csr-common/src/uploader/worker/worker-script.d.ts
2
+ declare const workerScript: string;
3
+ //#endregion
4
+ export { workerScript };
@@ -0,0 +1,4 @@
1
+ //#region ../csr-common/src/uploader/worker/worker-script.d.ts
2
+ declare const workerScript: string;
3
+ //#endregion
4
+ export { workerScript };
package/dist/worker.js ADDED
@@ -0,0 +1,2 @@
1
+ import { n as workerScript } from "./uploader-CkAqZXJP.js";
2
+ export { workerScript };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotify-confidence/session-recording",
3
3
  "license": "Apache-2.0",
4
- "version": "0.18.6",
4
+ "version": "0.18.8",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/spotify/confidence-sdk-js.git",
@@ -12,7 +12,7 @@
12
12
  "types": "./dist/index.d.ts",
13
13
  "scripts": {
14
14
  "prebuild": "node sync-version.mjs",
15
- "build": "yarn run -T tsdown",
15
+ "build": "yarn run -T tsdown && node scripts/emit-worker-file.mjs",
16
16
  "typecheck": "tsc --noEmit"
17
17
  },
18
18
  "files": [
@@ -31,12 +31,18 @@
31
31
  "types": "./dist/index.d.ts",
32
32
  "import": "./dist/index.js",
33
33
  "require": "./dist/index.cjs"
34
- }
34
+ },
35
+ "./worker": {
36
+ "types": "./dist/worker.d.ts",
37
+ "import": "./dist/worker.js",
38
+ "require": "./dist/worker.cjs"
39
+ },
40
+ "./confidence-worker.js": "./dist/confidence-worker.js"
35
41
  }
36
42
  },
37
43
  "dependencies": {
38
- "@spotify-confidence/csr-common": "0.18.5",
39
- "@spotify-confidence/csr-recorder": "0.17.11"
44
+ "@spotify-confidence/csr-common": "0.18.7",
45
+ "@spotify-confidence/csr-recorder": "0.17.13"
40
46
  },
41
47
  "module": "./dist/index.js",
42
48
  "exports": {
@@ -44,6 +50,12 @@
44
50
  "types": "./dist/index.d.ts",
45
51
  "import": "./dist/index.js",
46
52
  "require": "./dist/index.cjs"
47
- }
53
+ },
54
+ "./worker": {
55
+ "types": "./dist/worker.d.ts",
56
+ "import": "./dist/worker.js",
57
+ "require": "./dist/worker.cjs"
58
+ },
59
+ "./confidence-worker.js": "./dist/confidence-worker.js"
48
60
  }
49
61
  }
package/src/index.test.ts CHANGED
@@ -103,6 +103,21 @@ describe('initSessionRecorder', () => {
103
103
  expect(logger).toHaveBeenCalledWith(expect.stringContaining('worker-load-failed'));
104
104
  });
105
105
 
106
+ it('forwards workerUrl to createUploader', async () => {
107
+ createUploader.mockResolvedValueOnce(mockUploader());
108
+ record.mockReturnValueOnce(() => {});
109
+
110
+ initSessionRecorder({
111
+ clientSecret: 'secret',
112
+ workerUrl: '/assets/confidence-worker.js',
113
+ });
114
+ await flushPromises();
115
+
116
+ expect(createUploader.mock.calls[0][0]).toMatchObject({
117
+ workerUrl: '/assets/confidence-worker.js',
118
+ });
119
+ });
120
+
106
121
  it('manual mode does not init until start is called', async () => {
107
122
  createUploader.mockResolvedValueOnce(mockUploader());
108
123
  record.mockReturnValueOnce(() => {});
package/src/index.ts CHANGED
@@ -59,6 +59,15 @@ export interface InitSessionRecorderOptions {
59
59
  * `'manual'` — does nothing until `start()` is called, bypassing sampling and targeting rules.
60
60
  */
61
61
  mode?: 'automatic' | 'manual';
62
+ /**
63
+ * URL of a self-hosted worker script. Required when your Content Security Policy
64
+ * blocks `data:` and `blob:` in `worker-src`. Serve the file exported from
65
+ * `@spotify-confidence/session-recording/worker` at a same-origin route and pass
66
+ * its URL here.
67
+ *
68
+ * The worker version must match the SDK version — a mismatch may cause silent failures.
69
+ */
70
+ workerUrl?: string;
62
71
  /** Verbose tracer for debugging — called with one-line lifecycle/transport messages. */
63
72
  debugLogger?: (msg: string) => void;
64
73
  }
@@ -129,6 +138,7 @@ export function initSessionRecorder(options: InitSessionRecorderOptions): Sessio
129
138
  _csr_sdk_version: SDK_VERSION,
130
139
  ...(options.appVersion ? { _app_version: options.appVersion } : {}),
131
140
  },
141
+ workerUrl: options.workerUrl,
132
142
  forceRecord,
133
143
  debugLogger,
134
144
  onTerminate: ({ reason }) => {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const SDK_VERSION = '0.18.6';
1
+ export const SDK_VERSION = '0.18.8';
package/src/worker.ts ADDED
@@ -0,0 +1 @@
1
+ export { workerScript } from '@spotify-confidence/csr-common/uploader';