@cloudcare/cocos-sdk 0.1.0-alpha.2 → 0.1.0-alpha.4
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/README.md +1 -1
- package/bin/cli.cjs +3 -0
- package/components/creator2/ReplayPrivacy.ts +23 -0
- package/components/creator3/ReplayPrivacy.ts +25 -0
- package/dist/creator2/core/client.d.ts +1 -1
- package/dist/creator2/core/client.js +6 -6
- package/dist/creator2/core/client.js.map +1 -1
- package/dist/creator2/core/replay-async-transport.d.ts +4 -0
- package/dist/creator2/core/replay-async-transport.d.ts.map +1 -0
- package/dist/creator2/core/replay-async-transport.js +67 -0
- package/dist/creator2/core/replay-async-transport.js.map +1 -0
- package/dist/creator2/core/replay-file.d.ts +5 -0
- package/dist/creator2/core/replay-file.d.ts.map +1 -0
- package/dist/creator2/core/replay-file.js +101 -0
- package/dist/creator2/core/replay-file.js.map +1 -0
- package/dist/creator2/core/replay-privacy-nodes.d.ts +14 -0
- package/dist/creator2/core/replay-privacy-nodes.d.ts.map +1 -0
- package/dist/creator2/core/replay-privacy-nodes.js +18 -0
- package/dist/creator2/core/replay-privacy-nodes.js.map +1 -0
- package/dist/creator2/core/replay.d.ts +5 -3
- package/dist/creator2/core/replay.d.ts.map +1 -1
- package/dist/creator2/core/replay.js +77 -44
- package/dist/creator2/core/replay.js.map +1 -1
- package/dist/creator2/core/transport.d.ts +1 -0
- package/dist/creator2/core/transport.d.ts.map +1 -1
- package/dist/creator2/core/transport.js.map +1 -1
- package/dist/creator2/core/version.d.ts +1 -1
- package/dist/creator2/core/version.js +1 -1
- package/dist/creator2/creator2/capture.d.ts +1 -1
- package/dist/creator2/creator2/capture.d.ts.map +1 -1
- package/dist/creator2/creator2/capture.js +9 -16
- package/dist/creator2/creator2/capture.js.map +1 -1
- package/dist/creator2/creator2/transport.d.ts +1 -0
- package/dist/creator2/creator2/transport.d.ts.map +1 -1
- package/dist/creator2/creator2/transport.js +4 -0
- package/dist/creator2/creator2/transport.js.map +1 -1
- package/dist/creator3/core/client.d.ts +1 -1
- package/dist/creator3/core/client.js +6 -6
- package/dist/creator3/core/client.js.map +1 -1
- package/dist/creator3/core/replay-async-transport.d.ts +4 -0
- package/dist/creator3/core/replay-async-transport.d.ts.map +1 -0
- package/dist/creator3/core/replay-async-transport.js +16 -0
- package/dist/creator3/core/replay-async-transport.js.map +1 -0
- package/dist/creator3/core/replay-file.d.ts +5 -0
- package/dist/creator3/core/replay-file.d.ts.map +1 -0
- package/dist/creator3/core/replay-file.js +31 -0
- package/dist/creator3/core/replay-file.js.map +1 -0
- package/dist/creator3/core/replay-privacy-nodes.d.ts +14 -0
- package/dist/creator3/core/replay-privacy-nodes.d.ts.map +1 -0
- package/dist/creator3/core/replay-privacy-nodes.js +15 -0
- package/dist/creator3/core/replay-privacy-nodes.js.map +1 -0
- package/dist/creator3/core/replay.d.ts +5 -3
- package/dist/creator3/core/replay.d.ts.map +1 -1
- package/dist/creator3/core/replay.js +26 -12
- package/dist/creator3/core/replay.js.map +1 -1
- package/dist/creator3/core/transport.d.ts +1 -0
- package/dist/creator3/core/transport.d.ts.map +1 -1
- package/dist/creator3/core/transport.js.map +1 -1
- package/dist/creator3/core/version.d.ts +1 -1
- package/dist/creator3/core/version.js +1 -1
- package/dist/creator3/creator3/capture.d.ts +1 -1
- package/dist/creator3/creator3/capture.d.ts.map +1 -1
- package/dist/creator3/creator3/capture.js +6 -13
- package/dist/creator3/creator3/capture.js.map +1 -1
- package/dist/creator3/creator3/transport.d.ts +1 -0
- package/dist/creator3/creator3/transport.d.ts.map +1 -1
- package/dist/creator3/creator3/transport.js +4 -0
- package/dist/creator3/creator3/transport.js.map +1 -1
- package/extensions/creator2/install-native.cjs +54 -2
- package/extensions/creator3/install-native.cjs +54 -2
- package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosBridge.java +4 -0
- package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosReplayImageJobs.java +55 -0
- package/native/ios/FTCocosBridge.m +17 -0
- package/native/ios/FTCocosBridge.podspec +2 -2
- package/native/ios/FTCocosReplayImageJobs.h +11 -0
- package/native/ios/FTCocosReplayImageJobs.m +54 -0
- package/native/shared/FTReplayFileBridge.h +62 -0
- package/native/shared/FTReplayFileWorker.h +88 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Cocos Creator 3.0–3.6.2 is supported on a best-effort basis because the stable
|
|
|
24
24
|
|
|
25
25
|
## Documentation
|
|
26
26
|
|
|
27
|
-
[
|
|
27
|
+
For installation, configuration, and usage, see the [official documentation](https://docs.guance.com/real-user-monitoring/cocos/app-access/).
|
|
28
28
|
|
|
29
29
|
## License
|
|
30
30
|
|
package/bin/cli.cjs
CHANGED
|
@@ -31,9 +31,12 @@ const extensionSource = path.join(packageRoot, 'extensions', `creator${creatorMa
|
|
|
31
31
|
|
|
32
32
|
copyDirectory(extensionSource, destination);
|
|
33
33
|
copyDirectory(path.join(packageRoot, 'native'), path.join(destination, 'native'));
|
|
34
|
+
const componentDestination = path.join(projectRoot, 'assets', 'guance-cocos-sdk');
|
|
35
|
+
copyDirectory(path.join(packageRoot, 'components', `creator${creatorMajor}`), componentDestination);
|
|
34
36
|
|
|
35
37
|
process.stdout.write(
|
|
36
38
|
`Installed ${metadata.name} for Cocos Creator ${creatorMajor} at ${destination}\n`
|
|
39
|
+
+ `Installed ReplayPrivacy at ${componentDestination}. Add it through Session Replay/ReplayPrivacy in the component menu.\n`
|
|
37
40
|
+ 'Re-open Cocos Creator, enable the guance-cocos-sdk extension, and rebuild the native project.\n',
|
|
38
41
|
);
|
|
39
42
|
if (fs.existsSync(legacyDestination)) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const { ccclass, property, menu, disallowMultiple } = cc._decorator;
|
|
2
|
+
|
|
3
|
+
export enum ReplayPrivacyMode {
|
|
4
|
+
Mask = 0,
|
|
5
|
+
Hide = 1,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Attach to a node or prefab to protect its bounds in Session Replay. */
|
|
9
|
+
@ccclass('ReplayPrivacy')
|
|
10
|
+
@menu('Session Replay/ReplayPrivacy')
|
|
11
|
+
@disallowMultiple
|
|
12
|
+
export default class ReplayPrivacy extends cc.Component {
|
|
13
|
+
@property({
|
|
14
|
+
type: cc.Enum(ReplayPrivacyMode),
|
|
15
|
+
tooltip: 'Mask fills the Replay region gray; Hide fills it black. The live scene is unchanged.',
|
|
16
|
+
})
|
|
17
|
+
mode: ReplayPrivacyMode = ReplayPrivacyMode.Mask;
|
|
18
|
+
|
|
19
|
+
/** Read by the SDK during capture; independent of SDK initialization order. */
|
|
20
|
+
get replayPrivacyMode(): 'mask' | 'hide' {
|
|
21
|
+
return this.mode === ReplayPrivacyMode.Hide ? 'hide' : 'mask';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { _decorator, Component, Enum } from 'cc';
|
|
2
|
+
|
|
3
|
+
const { ccclass, property, menu, disallowMultiple } = _decorator;
|
|
4
|
+
|
|
5
|
+
export enum ReplayPrivacyMode {
|
|
6
|
+
Mask = 0,
|
|
7
|
+
Hide = 1,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Attach to a node or prefab to protect its bounds in Session Replay. */
|
|
11
|
+
@ccclass('ReplayPrivacy')
|
|
12
|
+
@menu('Session Replay/ReplayPrivacy')
|
|
13
|
+
@disallowMultiple
|
|
14
|
+
export default class ReplayPrivacy extends Component {
|
|
15
|
+
@property({
|
|
16
|
+
type: Enum(ReplayPrivacyMode),
|
|
17
|
+
tooltip: 'Mask fills the Replay region gray; Hide fills it black. The live scene is unchanged.',
|
|
18
|
+
})
|
|
19
|
+
mode: ReplayPrivacyMode = ReplayPrivacyMode.Mask;
|
|
20
|
+
|
|
21
|
+
/** Read by the SDK during capture; independent of SDK initialization order. */
|
|
22
|
+
get replayPrivacyMode(): 'mask' | 'hide' {
|
|
23
|
+
return this.mode === ReplayPrivacyMode.Hide ? 'hide' : 'mask';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -7,7 +7,7 @@ export interface FTAutoTrackingController {
|
|
|
7
7
|
stop(): void;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Cocos SDK facade exposed through the platform entry point's
|
|
10
|
+
* Cocos SDK facade exposed through the platform entry point's SDK
|
|
11
11
|
* singleton. Do not construct this class directly.
|
|
12
12
|
*/
|
|
13
13
|
export declare class FTCocosSDK {
|
|
@@ -16,7 +16,7 @@ var modules_js_1 = require("./modules.js");
|
|
|
16
16
|
var replay_js_1 = require("./replay.js");
|
|
17
17
|
var version_js_1 = require("./version.js");
|
|
18
18
|
/**
|
|
19
|
-
* Cocos SDK facade exposed through the platform entry point's
|
|
19
|
+
* Cocos SDK facade exposed through the platform entry point's SDK
|
|
20
20
|
* singleton. Do not construct this class directly.
|
|
21
21
|
*/
|
|
22
22
|
var FTCocosSDK = /** @class */ (function () {
|
|
@@ -46,7 +46,7 @@ var FTCocosSDK = /** @class */ (function () {
|
|
|
46
46
|
FTCocosSDK.prototype.start = function (config) {
|
|
47
47
|
var _a;
|
|
48
48
|
if (this.state !== 'idle') {
|
|
49
|
-
throw new Error('
|
|
49
|
+
throw new Error('start() and attach() are mutually exclusive');
|
|
50
50
|
}
|
|
51
51
|
this.mobile.start(config.sdk);
|
|
52
52
|
// Base SDK installation already belongs to this Cocos runtime after the
|
|
@@ -76,7 +76,7 @@ var FTCocosSDK = /** @class */ (function () {
|
|
|
76
76
|
FTCocosSDK.prototype.attach = function (config) {
|
|
77
77
|
if (config === void 0) { config = {}; }
|
|
78
78
|
if (this.state === 'standalone') {
|
|
79
|
-
throw new Error('
|
|
79
|
+
throw new Error('start() and attach() are mutually exclusive');
|
|
80
80
|
}
|
|
81
81
|
if (this.state === 'hybrid-attached' || this.state === 'hybrid-entered')
|
|
82
82
|
return;
|
|
@@ -107,10 +107,10 @@ var FTCocosSDK = /** @class */ (function () {
|
|
|
107
107
|
var _a, _b;
|
|
108
108
|
if (options === void 0) { options = {}; }
|
|
109
109
|
if (this.state === 'standalone') {
|
|
110
|
-
throw new Error('
|
|
110
|
+
throw new Error('enterCocos() is only available after attach()');
|
|
111
111
|
}
|
|
112
112
|
if (this.state === 'idle') {
|
|
113
|
-
throw new Error('Call
|
|
113
|
+
throw new Error('Call attach() before enterCocos()');
|
|
114
114
|
}
|
|
115
115
|
if (this.state === 'hybrid-entered')
|
|
116
116
|
return;
|
|
@@ -141,7 +141,7 @@ var FTCocosSDK = /** @class */ (function () {
|
|
|
141
141
|
FTCocosSDK.prototype.leaveCocos = function () {
|
|
142
142
|
var _a;
|
|
143
143
|
if (this.state === 'standalone') {
|
|
144
|
-
throw new Error('
|
|
144
|
+
throw new Error('leaveCocos() is only available after attach()');
|
|
145
145
|
}
|
|
146
146
|
if (this.state === 'idle' || this.state === 'hybrid-attached')
|
|
147
147
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/core/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAuF;AACvF,yCAIqB;AAQrB,2CAAoD;AASpD;;;GAGG;AACH;IAgBE,oBACmB,SAA4B,EAC7C,OAAwB,EACP,YAAuC,EACxD,aAAqC;QAHpB,cAAS,GAAT,SAAS,CAAmB;QAE5B,iBAAY,GAAZ,YAAY,CAA2B;QAPlD,UAAK,GAAoB,MAAM,CAAC;QAChC,uBAAkB,GAAyB,EAAE,CAAC;QACrC,cAAS,GAAG,IAAI,2BAAc,EAAE,CAAC;QAQhD,IAAI,CAAC,MAAM,GAAG,IAAI,0BAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,kBAAK,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAQ,CAAC,SAAS,EAAE,IAA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,gCAAU;AA4JvB,SAAS,YAAY,CAAC,KAAyB;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FTNativeTransport } from './transport.js';
|
|
2
|
+
/** Polls a single native worker without keeping a synchronous bridge call open. */
|
|
3
|
+
export declare function invokeReplayAsync<T>(transport: FTNativeTransport, method: string, payload?: unknown): Promise<T | undefined>;
|
|
4
|
+
//# sourceMappingURL=replay-async-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-async-transport.d.ts","sourceRoot":"","sources":["../../../../../src/core/replay-async-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,mFAAmF;AACnF,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CASlI"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.invokeReplayAsync = invokeReplayAsync;
|
|
40
|
+
var transport_js_1 = require("./transport.js");
|
|
41
|
+
/** Polls a single native worker without keeping a synchronous bridge call open. */
|
|
42
|
+
function invokeReplayAsync(transport, method, payload) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
44
|
+
var job, result;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
job = transport.invoke('replay.beginSaveImage', { method: method, arguments: payload });
|
|
49
|
+
if (!job)
|
|
50
|
+
throw new Error('Rebuild the native bridge to enable asynchronous Replay encoding');
|
|
51
|
+
_a.label = 1;
|
|
52
|
+
case 1: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 16); })];
|
|
53
|
+
case 2:
|
|
54
|
+
_a.sent();
|
|
55
|
+
result = transport.invoke('replay.pollSaveImage', { job: job });
|
|
56
|
+
if (!result)
|
|
57
|
+
throw new Error('Replay encoding job is unavailable');
|
|
58
|
+
if (!result.pending)
|
|
59
|
+
return [2 /*return*/, (0, transport_js_1.parseTransportResponse)(result.response)];
|
|
60
|
+
_a.label = 3;
|
|
61
|
+
case 3: return [3 /*break*/, 1];
|
|
62
|
+
case 4: return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=replay-async-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-async-transport.js","sourceRoot":"","sources":["../../../../../src/core/replay-async-transport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,8CASC;AAZD,+CAAwD;AAExD,mFAAmF;AACnF,SAAsB,iBAAiB,CAAI,SAA4B,EAAE,MAAc,EAAE,OAAiB;;;;;;oBAClG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAS,uBAAuB,EAAE,EAAE,MAAM,QAAA,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC9F,IAAI,CAAC,GAAG;wBAAE,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;;wBAE5F,qBAAM,IAAI,OAAO,CAAO,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAA;;oBAA7D,SAA6D,CAAC;oBACxD,MAAM,GAAG,SAAS,CAAC,MAAM,CAA0C,sBAAsB,EAAE,EAAE,GAAG,KAAA,EAAE,CAAC,CAAC;oBAC1G,IAAI,CAAC,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;oBACnE,IAAI,CAAC,MAAM,CAAC,OAAO;wBAAE,sBAAO,IAAA,qCAAsB,EAAI,MAAM,CAAC,QAAQ,CAAC,EAAC;;;;;;;CAE1E"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FTCapturedFrame, FTStoredFrame } from './types.js';
|
|
2
|
+
/** Copies pixels into native-owned memory; all file operations run off the game thread. */
|
|
3
|
+
export declare function persistReplayFrame(frame: FTCapturedFrame, fingerprint: string, writablePath: string): Promise<FTStoredFrame>;
|
|
4
|
+
export declare function disposeReplayFrame(frame: FTStoredFrame): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=replay-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-file.d.ts","sourceRoot":"","sources":["../../../../../src/core/replay-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAwBjE,2FAA2F;AAC3F,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,eAAe,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,CAAC,CAKxB;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5E"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.persistReplayFrame = persistReplayFrame;
|
|
40
|
+
exports.disposeReplayFrame = disposeReplayFrame;
|
|
41
|
+
var sequence = 0;
|
|
42
|
+
function bridge() {
|
|
43
|
+
var value = globalThis.__ftCocosReplayFile;
|
|
44
|
+
if (!value)
|
|
45
|
+
throw new Error('Rebuild the native project with the Cocos SDK extension to enable asynchronous Replay storage');
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function waitForFile(expected) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var status_1;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 16); })];
|
|
54
|
+
case 1:
|
|
55
|
+
_a.sent();
|
|
56
|
+
status_1 = bridge().poll();
|
|
57
|
+
if (status_1 === expected)
|
|
58
|
+
return [2 /*return*/];
|
|
59
|
+
if (status_1 !== 'pending')
|
|
60
|
+
throw new Error("Replay file operation failed: ".concat(status_1));
|
|
61
|
+
_a.label = 2;
|
|
62
|
+
case 2: return [3 /*break*/, 0];
|
|
63
|
+
case 3: return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** Copies pixels into native-owned memory; all file operations run off the game thread. */
|
|
69
|
+
function persistReplayFrame(frame, fingerprint, writablePath) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var path;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0:
|
|
75
|
+
path = "".concat(writablePath, "cocos-sdk-replay-").concat(Date.now(), "-").concat(++sequence, "-").concat(fingerprint, ".rgba");
|
|
76
|
+
if (!bridge().write(frame.rgba, path))
|
|
77
|
+
throw new Error('Replay file writer is busy');
|
|
78
|
+
return [4 /*yield*/, waitForFile('written')];
|
|
79
|
+
case 1:
|
|
80
|
+
_a.sent();
|
|
81
|
+
return [2 /*return*/, { path: path, width: frame.width, height: frame.height, timestamp: frame.timestamp, fingerprint: fingerprint }];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function disposeReplayFrame(frame) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
switch (_a.label) {
|
|
90
|
+
case 0:
|
|
91
|
+
if (!bridge().remove(frame.path))
|
|
92
|
+
throw new Error('Replay file writer is busy or the frame has expired');
|
|
93
|
+
return [4 /*yield*/, waitForFile('removed')];
|
|
94
|
+
case 1:
|
|
95
|
+
_a.sent();
|
|
96
|
+
return [2 /*return*/];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL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EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,WAAW,aAAA,EAAE,EAAC;;;;CACpG;AAED,SAAsB,kBAAkB,CAAC,KAAoB;;;;;oBAC3D,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;wBAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;oBACzG,qBAAM,WAAW,CAAC,SAAS,CAAC,EAAA;;oBAA5B,SAA4B,CAAC;;;;;CAC9B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FTReplayPrivacyMode } from './types.js';
|
|
2
|
+
/** Shape of the ReplayPrivacy editor script installed in the project's assets. */
|
|
3
|
+
interface ReplayPrivacyComponent {
|
|
4
|
+
node: unknown;
|
|
5
|
+
enabledInHierarchy: boolean;
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
readonly replayPrivacyMode: 'mask' | 'hide';
|
|
8
|
+
}
|
|
9
|
+
/** Resolve rules afresh for each capture, including newly instantiated prefabs. */
|
|
10
|
+
export declare function collectReplayPrivacyNodes(overrides: ReadonlyMap<unknown, FTReplayPrivacyMode>, components: ReplayPrivacyComponent[], editBoxes: {
|
|
11
|
+
node: unknown;
|
|
12
|
+
}[]): Map<unknown, FTReplayPrivacyMode>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=replay-privacy-nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-privacy-nodes.d.ts","sourceRoot":"","sources":["../../../../../src/core/replay-privacy-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,kFAAkF;AAClF,UAAU,sBAAsB;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,kBAAkB,EAAE,OAAO,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7C;AAED,mFAAmF;AACnF,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,WAAW,CAAC,OAAO,EAAE,mBAAmB,CAAC,EACpD,UAAU,EAAE,sBAAsB,EAAE,EACpC,SAAS,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAAE,GAC7B,GAAG,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAUnC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectReplayPrivacyNodes = collectReplayPrivacyNodes;
|
|
4
|
+
/** Resolve rules afresh for each capture, including newly instantiated prefabs. */
|
|
5
|
+
function collectReplayPrivacyNodes(overrides, components, editBoxes) {
|
|
6
|
+
var nodes = new Map(overrides);
|
|
7
|
+
components.forEach(function (component) {
|
|
8
|
+
if (!component.isValid || !component.enabledInHierarchy || nodes.has(component.node))
|
|
9
|
+
return;
|
|
10
|
+
nodes.set(component.node, component.replayPrivacyMode === 'hide' ? 'hide' : 'mask');
|
|
11
|
+
});
|
|
12
|
+
editBoxes.forEach(function (editBox) {
|
|
13
|
+
if (!nodes.has(editBox.node))
|
|
14
|
+
nodes.set(editBox.node, 'mask');
|
|
15
|
+
});
|
|
16
|
+
return nodes;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=replay-privacy-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-privacy-nodes.js","sourceRoot":"","sources":["../../../../../src/core/replay-privacy-nodes.ts"],"names":[],"mappings":";;AAWA,8DAcC;AAfD,mFAAmF;AACnF,SAAgB,yBAAyB,CACvC,SAAoD,EACpD,UAAoC,EACpC,SAA8B;IAE9B,IAAM,KAAK,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACjC,UAAU,CAAC,OAAO,CAAC,UAAC,SAAS;QAC3B,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,kBAAkB,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;YAAE,OAAO;QAC7F,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,iBAAiB,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IACH,SAAS,CAAC,OAAO,CAAC,UAAC,OAAO;QACxB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -7,7 +7,7 @@ export interface FTCanvasCapture {
|
|
|
7
7
|
} | undefined;
|
|
8
8
|
capture(maxImageDimension: number): Promise<FTCapturedFrame | undefined>;
|
|
9
9
|
persist(frame: FTCapturedFrame, fingerprint: string): Promise<FTStoredFrame>;
|
|
10
|
-
disposeStoredFrame(frame: FTStoredFrame): void
|
|
10
|
+
disposeStoredFrame(frame: FTStoredFrame): void | Promise<void>;
|
|
11
11
|
setPrivacy(node: unknown, mode: 'mask' | 'hide' | 'unmask'): void;
|
|
12
12
|
}
|
|
13
13
|
export interface FTReplayPointerEvent {
|
|
@@ -73,8 +73,9 @@ export declare class FTSessionReplay {
|
|
|
73
73
|
* Changes the Session Replay privacy treatment for a Cocos node.
|
|
74
74
|
*
|
|
75
75
|
* `mask` obscures the node, `hide` removes the region from the replay, and
|
|
76
|
-
* `unmask` clears an earlier override
|
|
77
|
-
*
|
|
76
|
+
* `unmask` clears an earlier code override, restoring any ReplayPrivacy
|
|
77
|
+
* component rule or default input masking. Code overrides take priority over
|
|
78
|
+
* a component on the same node. The node must belong to the active Cocos scene.
|
|
78
79
|
*
|
|
79
80
|
* @param node - Cocos node whose rendered bounds receive the privacy rule.
|
|
80
81
|
* @param mode - Privacy treatment to apply.
|
|
@@ -85,6 +86,7 @@ export declare class FTSessionReplay {
|
|
|
85
86
|
private schedule;
|
|
86
87
|
private readContext;
|
|
87
88
|
private saveImage;
|
|
89
|
+
private invokeSaveImage;
|
|
88
90
|
private writePendingPointers;
|
|
89
91
|
private scaledPendingPointers;
|
|
90
92
|
private updateRecordCount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../../../src/core/replay.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EACV,eAAe,EAEf,eAAe,EAEf,qBAAqB,EACrB,aAAa,EACd,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAClE,OAAO,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IACzE,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7E,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../../../src/core/replay.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EACV,eAAe,EAEf,eAAe,EAEf,qBAAqB,EACrB,aAAa,EACd,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,IAAI;QA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AoB;IAqB5B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,iBAAiB;CAK1B;AAwBD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAqBpF;AAkBD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,cAAc,SAAO,GACpB,mBAAmB,CAerB;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,EACzC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAiBT;AAQD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQ1D;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,EAAE,GACzB,IAAI,CAiBN"}
|
|
@@ -86,7 +86,7 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
86
86
|
FTSessionReplay.prototype.start = function (config) {
|
|
87
87
|
if (config === void 0) { config = {}; }
|
|
88
88
|
if (this.mode === 'hybrid') {
|
|
89
|
-
throw new Error('Hybrid Replay is managed by
|
|
89
|
+
throw new Error('Hybrid Replay is managed by enterCocos() and leaveCocos()');
|
|
90
90
|
}
|
|
91
91
|
if (this.mode === 'standalone')
|
|
92
92
|
return;
|
|
@@ -119,7 +119,7 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
119
119
|
/** @internal */
|
|
120
120
|
FTSessionReplay.prototype.enterHybrid = function () {
|
|
121
121
|
if (this.mode !== 'hybrid') {
|
|
122
|
-
throw new Error('Call
|
|
122
|
+
throw new Error('Call attach() before entering Hybrid Replay');
|
|
123
123
|
}
|
|
124
124
|
if (!this.hybridReplayEnabled || this.running)
|
|
125
125
|
return;
|
|
@@ -148,7 +148,7 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
148
148
|
/** Stops standalone Cocos canvas capture and native Session Replay. */
|
|
149
149
|
FTSessionReplay.prototype.stop = function () {
|
|
150
150
|
if (this.mode === 'hybrid') {
|
|
151
|
-
throw new Error('Hybrid Replay is managed by
|
|
151
|
+
throw new Error('Hybrid Replay is managed by enterCocos() and leaveCocos()');
|
|
152
152
|
}
|
|
153
153
|
if (this.mode === 'idle')
|
|
154
154
|
return;
|
|
@@ -160,8 +160,9 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
160
160
|
* Changes the Session Replay privacy treatment for a Cocos node.
|
|
161
161
|
*
|
|
162
162
|
* `mask` obscures the node, `hide` removes the region from the replay, and
|
|
163
|
-
* `unmask` clears an earlier override
|
|
164
|
-
*
|
|
163
|
+
* `unmask` clears an earlier code override, restoring any ReplayPrivacy
|
|
164
|
+
* component rule or default input masking. Code overrides take priority over
|
|
165
|
+
* a component on the same node. The node must belong to the active Cocos scene.
|
|
165
166
|
*
|
|
166
167
|
* @param node - Cocos node whose rendered bounds receive the privacy rule.
|
|
167
168
|
* @param mode - Privacy treatment to apply.
|
|
@@ -186,7 +187,7 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
186
187
|
pointerSize = this.lastImageSize;
|
|
187
188
|
_c.label = 1;
|
|
188
189
|
case 1:
|
|
189
|
-
_c.trys.push([1,
|
|
190
|
+
_c.trys.push([1, 5, 6, 11]);
|
|
190
191
|
context = this.readContext();
|
|
191
192
|
if (!context)
|
|
192
193
|
return [2 /*return*/, false];
|
|
@@ -250,7 +251,11 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
250
251
|
stored = _c.sent();
|
|
251
252
|
if (generation !== this.captureGeneration)
|
|
252
253
|
return [2 /*return*/, false];
|
|
253
|
-
|
|
254
|
+
return [4 /*yield*/, this.saveImage(stored, decision.compressionQuality, decision.maxFrameBytes)];
|
|
255
|
+
case 4:
|
|
256
|
+
saved = _c.sent();
|
|
257
|
+
if (generation !== this.captureGeneration)
|
|
258
|
+
return [2 /*return*/, false];
|
|
254
259
|
if (!saved) {
|
|
255
260
|
(0, replay_diagnostics_js_1.emitReplayDiagnostic)({ type: 'capture_skipped', timestamp: now, reason: 'budget' });
|
|
256
261
|
return [2 /*return*/, this.writePendingPointers(context, frame.width, frame.height)];
|
|
@@ -280,8 +285,10 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
280
285
|
this.lastImageSize = { width: saved.width, height: saved.height };
|
|
281
286
|
this.lastViewportSize = viewportSize;
|
|
282
287
|
return [2 /*return*/, true];
|
|
283
|
-
case
|
|
288
|
+
case 5:
|
|
284
289
|
error_1 = _c.sent();
|
|
290
|
+
if (generation !== this.captureGeneration)
|
|
291
|
+
return [2 /*return*/, false];
|
|
285
292
|
(0, replay_diagnostics_js_1.emitReplayDiagnostic)({ type: 'capture_skipped', timestamp: Date.now(), reason: 'error' });
|
|
286
293
|
console.error('[cocos-sdk] Session Replay frame dropped:', error_1);
|
|
287
294
|
if (context && pointerSize) {
|
|
@@ -293,12 +300,19 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
293
300
|
}
|
|
294
301
|
}
|
|
295
302
|
return [2 /*return*/, false];
|
|
296
|
-
case
|
|
297
|
-
|
|
298
|
-
|
|
303
|
+
case 6:
|
|
304
|
+
_c.trys.push([6, , 9, 10]);
|
|
305
|
+
if (!stored) return [3 /*break*/, 8];
|
|
306
|
+
return [4 /*yield*/, this.capture.disposeStoredFrame(stored)];
|
|
307
|
+
case 7:
|
|
308
|
+
_c.sent();
|
|
309
|
+
_c.label = 8;
|
|
310
|
+
case 8: return [3 /*break*/, 10];
|
|
311
|
+
case 9:
|
|
299
312
|
this.busy = false;
|
|
300
313
|
return [7 /*endfinally*/];
|
|
301
|
-
case
|
|
314
|
+
case 10: return [7 /*endfinally*/];
|
|
315
|
+
case 11: return [2 /*return*/];
|
|
302
316
|
}
|
|
303
317
|
});
|
|
304
318
|
});
|
|
@@ -382,40 +396,59 @@ var FTSessionReplay = /** @class */ (function () {
|
|
|
382
396
|
return normalizeRumContext(value);
|
|
383
397
|
};
|
|
384
398
|
FTSessionReplay.prototype.saveImage = function (stored, compressionQuality, maxFrameBytes) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
400
|
+
var value, error_3, resourceId;
|
|
401
|
+
return __generator(this, function (_a) {
|
|
402
|
+
switch (_a.label) {
|
|
403
|
+
case 0:
|
|
404
|
+
if (!(this.imagePolicyEnabled && this.supportsSaveImageV2 !== false)) return [3 /*break*/, 4];
|
|
405
|
+
_a.label = 1;
|
|
406
|
+
case 1:
|
|
407
|
+
_a.trys.push([1, 3, , 4]);
|
|
408
|
+
return [4 /*yield*/, this.invokeSaveImage('replay.saveImageV2', {
|
|
409
|
+
path: stored.path,
|
|
410
|
+
width: stored.width,
|
|
411
|
+
height: stored.height,
|
|
412
|
+
quality: compressionQuality,
|
|
413
|
+
maxFrameBytes: maxFrameBytes,
|
|
414
|
+
})];
|
|
415
|
+
case 2:
|
|
416
|
+
value = _a.sent();
|
|
417
|
+
if (value !== undefined) {
|
|
418
|
+
this.supportsSaveImageV2 = true;
|
|
419
|
+
if (isRejectedSaveImageV2(value))
|
|
420
|
+
return [2 /*return*/, undefined];
|
|
421
|
+
return [2 /*return*/, __assign(__assign({}, normalizeSaveImageV2Result(value)), { byteSizeSource: 'native' })];
|
|
422
|
+
}
|
|
423
|
+
this.supportsSaveImageV2 = false;
|
|
424
|
+
return [3 /*break*/, 4];
|
|
425
|
+
case 3:
|
|
426
|
+
error_3 = _a.sent();
|
|
427
|
+
if (!isUnknownBridgeMethod(error_3))
|
|
428
|
+
throw error_3;
|
|
429
|
+
this.supportsSaveImageV2 = false;
|
|
430
|
+
return [3 /*break*/, 4];
|
|
431
|
+
case 4: return [4 /*yield*/, this.invokeSaveImage('replay.saveImage', {
|
|
432
|
+
path: stored.path,
|
|
433
|
+
width: stored.width,
|
|
434
|
+
height: stored.height,
|
|
435
|
+
})];
|
|
436
|
+
case 5:
|
|
437
|
+
resourceId = _a.sent();
|
|
438
|
+
if (!resourceId)
|
|
439
|
+
return [2 /*return*/, undefined];
|
|
440
|
+
return [2 /*return*/, __assign({ resourceId: resourceId,
|
|
441
|
+
// V1 cannot report encoded size. A conservative frame-limit estimate
|
|
442
|
+
// still prevents configured captureFps from multiplying traffic freely.
|
|
443
|
+
byteSize: maxFrameBytes, width: stored.width, height: stored.height, byteSizeSource: 'frame_limit_estimate' }, (this.transport.platform === 'ios' ? { mimeType: 'image/png' } : {}))];
|
|
399
444
|
}
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
catch (error) {
|
|
403
|
-
if (!isUnknownBridgeMethod(error))
|
|
404
|
-
throw error;
|
|
405
|
-
this.supportsSaveImageV2 = false;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
var resourceId = this.transport.invoke('replay.saveImage', {
|
|
409
|
-
path: stored.path,
|
|
410
|
-
width: stored.width,
|
|
411
|
-
height: stored.height,
|
|
445
|
+
});
|
|
412
446
|
});
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
byteSize: maxFrameBytes, width: stored.width, height: stored.height, byteSizeSource: 'frame_limit_estimate' }, (this.transport.platform === 'ios' ? { mimeType: 'image/png' } : {}));
|
|
447
|
+
};
|
|
448
|
+
FTSessionReplay.prototype.invokeSaveImage = function (method, payload) {
|
|
449
|
+
return this.transport.invokeAsync
|
|
450
|
+
? this.transport.invokeAsync(method, payload)
|
|
451
|
+
: Promise.resolve(this.transport.invoke(method, payload));
|
|
419
452
|
};
|
|
420
453
|
FTSessionReplay.prototype.writePendingPointers = function (context, width, height) {
|
|
421
454
|
var pointerEvents = this.scaledPendingPointers(width, height);
|