@offscript/sdk 0.1.8 → 0.1.9
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/adapters/nuxt.cjs +3 -3
- package/dist/adapters/nuxt.js +2 -2
- package/dist/adapters/vanilla.cjs +5 -5
- package/dist/adapters/vanilla.js +3 -3
- package/dist/adapters/vue.cjs +3 -3
- package/dist/adapters/vue.js +2 -2
- package/dist/{chunk-W27UMAEC.js → chunk-5F637PDG.js} +34 -8
- package/dist/chunk-5F637PDG.js.map +1 -0
- package/dist/{chunk-AQG5MIW5.js → chunk-KKEYBVTX.js} +3 -3
- package/dist/{chunk-AQG5MIW5.js.map → chunk-KKEYBVTX.js.map} +1 -1
- package/dist/{chunk-ZB2LSKD2.cjs → chunk-M2E6CWGK.cjs} +3 -3
- package/dist/{chunk-ZB2LSKD2.cjs.map → chunk-M2E6CWGK.cjs.map} +1 -1
- package/dist/{chunk-IOIVKJTV.js → chunk-U232L3JD.js} +3 -3
- package/dist/{chunk-IOIVKJTV.js.map → chunk-U232L3JD.js.map} +1 -1
- package/dist/{chunk-YIKWNN5R.cjs → chunk-WK242AJ2.cjs} +4 -4
- package/dist/{chunk-YIKWNN5R.cjs.map → chunk-WK242AJ2.cjs.map} +1 -1
- package/dist/{chunk-E53R6UOC.cjs → chunk-YPGRVKY4.cjs} +39 -13
- package/dist/chunk-YPGRVKY4.cjs.map +1 -0
- package/dist/core/OffscriptSDK.d.ts +1 -1
- package/dist/index.cjs +20 -20
- package/dist/index.js +3 -3
- package/dist/playwright.cjs +13 -13
- package/dist/playwright.js +1 -1
- package/dist/types/events.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-E53R6UOC.cjs.map +0 -1
- package/dist/chunk-W27UMAEC.js.map +0 -1
package/dist/adapters/nuxt.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkYPGRVKY4_cjs = require('../chunk-YPGRVKY4.cjs');
|
|
4
|
+
require('../chunk-M2E6CWGK.cjs');
|
|
5
5
|
|
|
6
6
|
// src/adapters/nuxt.ts
|
|
7
7
|
function createNuxtOffscript(config) {
|
|
8
8
|
if (typeof window === "undefined") return null;
|
|
9
|
-
const sdk = new
|
|
9
|
+
const sdk = new chunkYPGRVKY4_cjs.Offscript(config);
|
|
10
10
|
void sdk.init().catch(() => void 0);
|
|
11
11
|
return sdk;
|
|
12
12
|
}
|
package/dist/adapters/nuxt.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkWK242AJ2_cjs = require('../chunk-WK242AJ2.cjs');
|
|
4
|
+
require('../chunk-YPGRVKY4.cjs');
|
|
5
|
+
require('../chunk-M2E6CWGK.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "createOffscript", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkWK242AJ2_cjs.createOffscript; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "startOffscript", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkWK242AJ2_cjs.startOffscript; }
|
|
16
16
|
});
|
|
17
17
|
//# sourceMappingURL=vanilla.cjs.map
|
|
18
18
|
//# sourceMappingURL=vanilla.cjs.map
|
package/dist/adapters/vanilla.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { createOffscript, startOffscript } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { createOffscript, startOffscript } from '../chunk-U232L3JD.js';
|
|
2
|
+
import '../chunk-5F637PDG.js';
|
|
3
|
+
import '../chunk-KKEYBVTX.js';
|
|
4
4
|
//# sourceMappingURL=vanilla.js.map
|
|
5
5
|
//# sourceMappingURL=vanilla.js.map
|
package/dist/adapters/vue.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkYPGRVKY4_cjs = require('../chunk-YPGRVKY4.cjs');
|
|
4
|
+
require('../chunk-M2E6CWGK.cjs');
|
|
5
5
|
|
|
6
6
|
// src/adapters/vue.ts
|
|
7
7
|
var OFFSCRIPT_KEY = "$offscript";
|
|
8
8
|
var OffscriptPlugin = {
|
|
9
9
|
install(app, config) {
|
|
10
|
-
const sdk = new
|
|
10
|
+
const sdk = new chunkYPGRVKY4_cjs.Offscript(config);
|
|
11
11
|
void sdk.init().catch(() => void 0);
|
|
12
12
|
if (app.config?.globalProperties) {
|
|
13
13
|
app.config.globalProperties[OFFSCRIPT_KEY] = sdk;
|
package/dist/adapters/vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildPlaywrightContract, SDK_VERSION, SelectorGenerator, ACTION_SCHEMA_VERSION } from './chunk-
|
|
1
|
+
import { buildPlaywrightContract, SDK_VERSION, SelectorGenerator, ACTION_SCHEMA_VERSION } from './chunk-KKEYBVTX.js';
|
|
2
2
|
|
|
3
3
|
// src/types/config.ts
|
|
4
4
|
var DEFAULT_RECORDING = {
|
|
@@ -1295,7 +1295,6 @@ var RRWebRecorder = class {
|
|
|
1295
1295
|
// erros internos do rrweb não propagam
|
|
1296
1296
|
};
|
|
1297
1297
|
this.stopFn = mod.record(options) ?? void 0;
|
|
1298
|
-
this.scheduleSnapshot();
|
|
1299
1298
|
}
|
|
1300
1299
|
/** Captura o DOM depois do ciclo de renderização atual (Vue, React, etc.). */
|
|
1301
1300
|
scheduleSnapshot() {
|
|
@@ -1363,7 +1362,9 @@ var RRWebRecorder = class {
|
|
|
1363
1362
|
const emitted = this.sink.emit("rrweb", event, { priority, at: event.timestamp });
|
|
1364
1363
|
if (event.type === 2) {
|
|
1365
1364
|
this.needsSnapshot = !emitted;
|
|
1366
|
-
if (emitted)
|
|
1365
|
+
if (emitted) {
|
|
1366
|
+
this.snapshotsTaken++;
|
|
1367
|
+
}
|
|
1367
1368
|
}
|
|
1368
1369
|
if (!emitted && event.type === 3) this.needsSnapshot = true;
|
|
1369
1370
|
});
|
|
@@ -1424,7 +1425,8 @@ var RRWebRecorder = class {
|
|
|
1424
1425
|
this.takeFullSnapshot();
|
|
1425
1426
|
}
|
|
1426
1427
|
stop() {
|
|
1427
|
-
|
|
1428
|
+
const snapshotPending = this.settling || this.scheduledSnapshotFrame !== void 0;
|
|
1429
|
+
if (!this.stopped && !this.paused && snapshotPending) this.takeFullSnapshot();
|
|
1428
1430
|
this.stopped = true;
|
|
1429
1431
|
this.cancelScheduledSnapshot();
|
|
1430
1432
|
safe(() => this.stopFn?.());
|
|
@@ -2293,6 +2295,23 @@ function tokenFingerprint(token) {
|
|
|
2293
2295
|
}
|
|
2294
2296
|
return `${first >>> 0}.${second >>> 0}`;
|
|
2295
2297
|
}
|
|
2298
|
+
async function encodeRecordingPayload(payload) {
|
|
2299
|
+
const json = JSON.stringify(payload);
|
|
2300
|
+
const CompressionStreamCtor = globalThis.CompressionStream;
|
|
2301
|
+
if (!CompressionStreamCtor) return { body: json };
|
|
2302
|
+
try {
|
|
2303
|
+
const stream = new CompressionStreamCtor("gzip");
|
|
2304
|
+
const writer = stream.writable.getWriter();
|
|
2305
|
+
await writer.write(new TextEncoder().encode(json));
|
|
2306
|
+
await writer.close();
|
|
2307
|
+
return {
|
|
2308
|
+
body: await new Response(stream.readable).blob(),
|
|
2309
|
+
contentEncoding: "gzip"
|
|
2310
|
+
};
|
|
2311
|
+
} catch {
|
|
2312
|
+
return { body: json };
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2296
2315
|
var Offscript = class {
|
|
2297
2316
|
constructor(config = {}) {
|
|
2298
2317
|
this.bus = new Emitter();
|
|
@@ -2524,10 +2543,17 @@ var Offscript = class {
|
|
|
2524
2543
|
if (!["https:", "http:"].includes(url.protocol)) throw new ConfigError("Endpoint HTTP inv\xE1lido");
|
|
2525
2544
|
const payload = await this.stopRecording();
|
|
2526
2545
|
try {
|
|
2546
|
+
const encodedPayload = await encodeRecordingPayload(payload);
|
|
2547
|
+
const headers = {
|
|
2548
|
+
"Content-Type": "application/json",
|
|
2549
|
+
Accept: "application/json",
|
|
2550
|
+
Authorization: `Bearer ${token}`
|
|
2551
|
+
};
|
|
2552
|
+
if (encodedPayload.contentEncoding) headers["Content-Encoding"] = encodedPayload.contentEncoding;
|
|
2527
2553
|
const response = await fetch(url.href, {
|
|
2528
2554
|
method: "POST",
|
|
2529
|
-
headers
|
|
2530
|
-
body:
|
|
2555
|
+
headers,
|
|
2556
|
+
body: encodedPayload.body
|
|
2531
2557
|
});
|
|
2532
2558
|
if (!response.ok) throw new OffscriptError("TRANSPORT_FAILED", `Falha ao enviar grava\xE7\xE3o: HTTP ${response.status}`, { status: response.status });
|
|
2533
2559
|
this.submitted = true;
|
|
@@ -2737,5 +2763,5 @@ var Offscript = class {
|
|
|
2737
2763
|
Offscript.version = SDK_VERSION;
|
|
2738
2764
|
|
|
2739
2765
|
export { ConfigError, DEFAULT_PRIVACY, DEFAULT_RECORDING, DataSanitizer, InvalidStateError, Offscript, OffscriptError };
|
|
2740
|
-
//# sourceMappingURL=chunk-
|
|
2741
|
-
//# sourceMappingURL=chunk-
|
|
2766
|
+
//# sourceMappingURL=chunk-5F637PDG.js.map
|
|
2767
|
+
//# sourceMappingURL=chunk-5F637PDG.js.map
|