@cloudcare/cocos-sdk 0.1.1-alpha.1 → 0.1.1-alpha.2
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 +35 -6
- package/bin/cli.cjs +42 -5
- package/bin/project-configuration.cjs +135 -0
- package/bin/web-assets.cjs +32 -0
- package/dist/creator2/core/auto-tracking.js.map +1 -1
- package/dist/creator2/core/client.d.ts +1 -0
- package/dist/creator2/core/client.d.ts.map +1 -1
- package/dist/creator2/core/client.js +13 -0
- package/dist/creator2/core/client.js.map +1 -1
- package/dist/creator2/core/index.js.map +1 -1
- package/dist/creator2/core/modules.js.map +1 -1
- package/dist/creator2/core/platform-client.d.ts +46 -0
- package/dist/creator2/core/platform-client.d.ts.map +1 -0
- package/dist/creator2/core/platform-client.js +195 -0
- package/dist/creator2/core/platform-client.js.map +1 -0
- package/dist/creator2/core/platform-options.d.ts +30 -0
- package/dist/creator2/core/platform-options.d.ts.map +1 -0
- package/dist/creator2/core/platform-options.js +3 -0
- package/dist/creator2/core/platform-options.js.map +1 -0
- package/dist/creator2/core/platform-runtime.d.ts +59 -0
- package/dist/creator2/core/platform-runtime.d.ts.map +1 -0
- package/dist/creator2/core/platform-runtime.js +36 -0
- package/dist/creator2/core/platform-runtime.js.map +1 -0
- package/dist/creator2/core/plugin-api.d.ts +1 -1
- package/dist/creator2/core/plugin-api.d.ts.map +1 -1
- package/dist/creator2/core/plugin-api.js.map +1 -1
- package/dist/creator2/core/transport.d.ts +1 -1
- package/dist/creator2/core/transport.d.ts.map +1 -1
- package/dist/creator2/core/transport.js.map +1 -1
- package/dist/creator2/core/types.js.map +1 -1
- package/dist/creator2/core/validation.js.map +1 -1
- package/dist/creator2/core/version.d.ts +1 -1
- package/dist/creator2/core/version.js +1 -1
- package/dist/creator2/core/version.js.map +1 -1
- package/dist/creator2/creator2/auto.js.map +1 -1
- package/dist/creator2/creator2/index.d.ts +6 -3
- package/dist/creator2/creator2/index.d.ts.map +1 -1
- package/dist/creator2/creator2/index.js +12 -8
- package/dist/creator2/creator2/index.js.map +1 -1
- package/dist/creator2/creator2/transport.js.map +1 -1
- package/dist/creator2/native/bootstrap.d.ts +2 -0
- package/dist/creator2/native/bootstrap.d.ts.map +1 -0
- package/dist/creator2/native/bootstrap.js +34 -0
- package/dist/creator2/native/bootstrap.js.map +1 -0
- package/dist/creator2/web/bootstrap.d.ts +3 -0
- package/dist/creator2/web/bootstrap.d.ts.map +1 -0
- package/dist/creator2/web/bootstrap.js +15 -0
- package/dist/creator2/web/bootstrap.js.map +1 -0
- package/dist/creator2/web/client.d.ts +60 -0
- package/dist/creator2/web/client.d.ts.map +1 -0
- package/dist/creator2/web/client.js +293 -0
- package/dist/creator2/web/client.js.map +1 -0
- package/dist/creator2/web/creator2.d.ts +5 -0
- package/dist/creator2/web/creator2.d.ts.map +1 -0
- package/dist/creator2/web/creator2.js +27 -0
- package/dist/creator2/web/creator2.js.map +1 -0
- package/dist/creator2/web/privacy.d.ts +3 -0
- package/dist/creator2/web/privacy.d.ts.map +1 -0
- package/dist/creator2/web/privacy.js +39 -0
- package/dist/creator2/web/privacy.js.map +1 -0
- package/dist/creator2/web/runtime.d.ts +23 -0
- package/dist/creator2/web/runtime.d.ts.map +1 -0
- package/dist/creator2/web/runtime.js +265 -0
- package/dist/creator2/web/runtime.js.map +1 -0
- package/dist/creator2/web/types.d.ts +91 -0
- package/dist/creator2/web/types.d.ts.map +1 -0
- package/dist/creator2/web/types.js +3 -0
- package/dist/creator2/web/types.js.map +1 -0
- package/dist/creator3/core/client.d.ts +1 -0
- package/dist/creator3/core/client.d.ts.map +1 -1
- package/dist/creator3/core/client.js +5 -0
- package/dist/creator3/core/client.js.map +1 -1
- package/dist/creator3/core/platform-client.d.ts +46 -0
- package/dist/creator3/core/platform-client.d.ts.map +1 -0
- package/dist/creator3/core/platform-client.js +135 -0
- package/dist/creator3/core/platform-client.js.map +1 -0
- package/dist/creator3/core/platform-options.d.ts +30 -0
- package/dist/creator3/core/platform-options.d.ts.map +1 -0
- package/dist/creator3/core/platform-options.js +2 -0
- package/dist/creator3/core/platform-options.js.map +1 -0
- package/dist/creator3/core/platform-runtime.d.ts +59 -0
- package/dist/creator3/core/platform-runtime.d.ts.map +1 -0
- package/dist/creator3/core/platform-runtime.js +29 -0
- package/dist/creator3/core/platform-runtime.js.map +1 -0
- package/dist/creator3/core/plugin-api.d.ts +1 -1
- package/dist/creator3/core/plugin-api.d.ts.map +1 -1
- package/dist/creator3/core/transport.d.ts +1 -1
- package/dist/creator3/core/transport.d.ts.map +1 -1
- package/dist/creator3/core/version.d.ts +1 -1
- package/dist/creator3/core/version.js +1 -1
- package/dist/creator3/creator3/index.d.ts +6 -3
- package/dist/creator3/creator3/index.d.ts.map +1 -1
- package/dist/creator3/creator3/index.js +13 -8
- package/dist/creator3/creator3/index.js.map +1 -1
- package/dist/creator3/native/bootstrap.d.ts +2 -0
- package/dist/creator3/native/bootstrap.d.ts.map +1 -0
- package/dist/creator3/native/bootstrap.js +32 -0
- package/dist/creator3/native/bootstrap.js.map +1 -0
- package/dist/creator3/web/bootstrap.d.ts +3 -0
- package/dist/creator3/web/bootstrap.d.ts.map +1 -0
- package/dist/creator3/web/bootstrap.js +11 -0
- package/dist/creator3/web/bootstrap.js.map +1 -0
- package/dist/creator3/web/client.d.ts +60 -0
- package/dist/creator3/web/client.d.ts.map +1 -0
- package/dist/creator3/web/client.js +255 -0
- package/dist/creator3/web/client.js.map +1 -0
- package/dist/creator3/web/creator3.d.ts +5 -0
- package/dist/creator3/web/creator3.d.ts.map +1 -0
- package/dist/creator3/web/creator3.js +11 -0
- package/dist/creator3/web/creator3.js.map +1 -0
- package/dist/creator3/web/privacy.d.ts +3 -0
- package/dist/creator3/web/privacy.d.ts.map +1 -0
- package/dist/creator3/web/privacy.js +26 -0
- package/dist/creator3/web/privacy.js.map +1 -0
- package/dist/creator3/web/runtime.d.ts +23 -0
- package/dist/creator3/web/runtime.d.ts.map +1 -0
- package/dist/creator3/web/runtime.js +267 -0
- package/dist/creator3/web/runtime.js.map +1 -0
- package/dist/creator3/web/types.d.ts +91 -0
- package/dist/creator3/web/types.d.ts.map +1 -0
- package/dist/creator3/web/types.js +2 -0
- package/dist/creator3/web/types.js.map +1 -0
- package/extensions/creator2/install-web.cjs +69 -0
- package/extensions/creator2/main.js +19 -2
- package/extensions/creator2/project-configuration.cjs +135 -0
- package/extensions/creator3/dist/hooks.js +13 -0
- package/extensions/creator3/install-web.cjs +69 -0
- package/extensions/creator3/project-configuration.cjs +135 -0
- package/native/ios/FTCocosBridge.podspec +1 -1
- package/package.json +19 -3
- package/runtime/native.js +1191 -0
- package/web/bootstrap/package.json +4 -0
- package/web/bootstrap.js +1042 -0
- package/web/bootstrap.js.map +7 -0
- package/web/creator2/package.json +4 -0
- package/web/creator3/package.json +4 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { FTCocosSDK, FTSDKExtension } from './client.js';
|
|
2
|
+
import type { FTCocosConfig, FTCocosEnterOptions } from './types.js';
|
|
3
|
+
import type { FTCocosWebAttachConfig, FTCocosWebConfig } from '../web/types.js';
|
|
4
|
+
import type { FTNativeReplayConfig } from './platform-options.js';
|
|
5
|
+
import { type FTPlatformContext, type FTPlatformGlobal } from './platform-runtime.js';
|
|
6
|
+
export type FTCocosPlatformConfig = (FTCocosConfig & {
|
|
7
|
+
replay?: FTNativeReplayConfig;
|
|
8
|
+
}) | FTCocosWebConfig;
|
|
9
|
+
/** Stable engine entry. Build assets select implementations and install project configuration. */
|
|
10
|
+
export declare class FTCocosPlatformSDK {
|
|
11
|
+
readonly engine: 'creator2' | 'creator3';
|
|
12
|
+
private readonly context;
|
|
13
|
+
private readonly target?;
|
|
14
|
+
readonly extensionProtocol = 1;
|
|
15
|
+
private get mode();
|
|
16
|
+
private record;
|
|
17
|
+
private get nativeReplay();
|
|
18
|
+
private set nativeReplay(value);
|
|
19
|
+
private get replayConfig();
|
|
20
|
+
private set replayConfig(value);
|
|
21
|
+
readonly replay: {
|
|
22
|
+
/** Starts recording using the settings selected at initialization. */
|
|
23
|
+
start: () => void;
|
|
24
|
+
/** Stops recording while leaving base tracking active. */
|
|
25
|
+
stop: () => void;
|
|
26
|
+
};
|
|
27
|
+
constructor(engine: 'creator2' | 'creator3', context: () => FTPlatformContext, target?: FTPlatformGlobal | undefined);
|
|
28
|
+
get platform(): FTPlatformContext['platform'];
|
|
29
|
+
get mobile(): FTCocosSDK['mobile'];
|
|
30
|
+
get rum(): FTCocosSDK['rum'];
|
|
31
|
+
get logger(): FTCocosSDK['logger'];
|
|
32
|
+
get trace(): FTCocosSDK['trace'];
|
|
33
|
+
/** Uses installed project settings when no explicit configuration is supplied. */
|
|
34
|
+
start(config?: FTCocosPlatformConfig): void;
|
|
35
|
+
attach(config?: FTCocosWebAttachConfig): void;
|
|
36
|
+
enterCocos(options?: FTCocosEnterOptions): void;
|
|
37
|
+
leaveCocos(): void;
|
|
38
|
+
detach(): void;
|
|
39
|
+
shutdown(): void;
|
|
40
|
+
/** Stops this Cocos instance. Web page collectors and native host-owned SDKs retain their lifecycle. */
|
|
41
|
+
stop(): void;
|
|
42
|
+
registerExtension<T>(id: string, version: string, engine: string, factory: () => FTSDKExtension<T>): T;
|
|
43
|
+
private composeReplay;
|
|
44
|
+
private implementation;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=platform-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-client.d.ts","sourceRoot":"","sources":["../../../../../src/core/platform-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAu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O,CAAC,EAAE,mBAAmB,GAAG,IAAI;IAC/C,UAAU,IAAI,IAAI;IAClB,MAAM,IAAI,IAAI;IACd,QAAQ,IAAI,IAAI;IAChB,wGAAwG;IACxG,IAAI,IAAI,IAAI;IAMZ,iBAAiB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC;IAKtG,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,cAAc;CACvB"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.FTCocosPlatformSDK = void 0;
|
|
26
|
+
var version_js_1 = require("./version.js");
|
|
27
|
+
var platform_runtime_js_1 = require("./platform-runtime.js");
|
|
28
|
+
/** Stable engine entry. Build assets select implementations and install project configuration. */
|
|
29
|
+
var FTCocosPlatformSDK = /** @class */ (function () {
|
|
30
|
+
function FTCocosPlatformSDK(engine, context, target) {
|
|
31
|
+
var _this = this;
|
|
32
|
+
this.engine = engine;
|
|
33
|
+
this.context = context;
|
|
34
|
+
this.target = target;
|
|
35
|
+
this.extensionProtocol = 1;
|
|
36
|
+
this.replay = {
|
|
37
|
+
/** Starts recording using the settings selected at initialization. */
|
|
38
|
+
start: function () {
|
|
39
|
+
if (_this.mode === 'idle')
|
|
40
|
+
throw new Error('Start or attach the Cocos SDK before starting Replay');
|
|
41
|
+
if (!_this.implementation().isCocosEntered)
|
|
42
|
+
throw new Error('Call enterCocos() before starting Hybrid Replay');
|
|
43
|
+
if (_this.platform === 'web') {
|
|
44
|
+
_this.implementation().replay.start();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!_this.nativeReplay || !_this.replayConfig)
|
|
48
|
+
throw new Error('Enable Replay in cocos-sdk.config.json before starting the SDK');
|
|
49
|
+
if (_this.mode === 'hybrid')
|
|
50
|
+
_this.nativeReplay.replay.enterHybrid();
|
|
51
|
+
else
|
|
52
|
+
_this.nativeReplay.replay.start(_this.replayConfig);
|
|
53
|
+
},
|
|
54
|
+
/** Stops recording while leaving base tracking active. */
|
|
55
|
+
stop: function () {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
if (_this.mode === 'idle')
|
|
58
|
+
return;
|
|
59
|
+
if (_this.platform === 'web') {
|
|
60
|
+
_this.implementation().replay.stop();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (_this.mode === 'hybrid')
|
|
64
|
+
(_a = _this.nativeReplay) === null || _a === void 0 ? void 0 : _a.replay.leaveHybrid();
|
|
65
|
+
else
|
|
66
|
+
(_b = _this.nativeReplay) === null || _b === void 0 ? void 0 : _b.replay.stop();
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "mode", {
|
|
71
|
+
get: function () { var _a; return ((_a = (0, platform_runtime_js_1.existingPlatformImplementation)(this.context(), this.target)) === null || _a === void 0 ? void 0 : _a.lifecycleMode) || 'idle'; },
|
|
72
|
+
enumerable: false,
|
|
73
|
+
configurable: true
|
|
74
|
+
});
|
|
75
|
+
FTCocosPlatformSDK.prototype.record = function () {
|
|
76
|
+
this.implementation();
|
|
77
|
+
return (this.target || (0, platform_runtime_js_1.platformGlobal)()).__FT_COCOS_INSTANCES__[this.engine + ':' + this.platform];
|
|
78
|
+
};
|
|
79
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "nativeReplay", {
|
|
80
|
+
get: function () { return this.record().replay; },
|
|
81
|
+
set: function (value) { this.record().replay = value; },
|
|
82
|
+
enumerable: false,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "replayConfig", {
|
|
86
|
+
get: function () { return this.record().replayConfig; },
|
|
87
|
+
set: function (value) { this.record().replayConfig = value; },
|
|
88
|
+
enumerable: false,
|
|
89
|
+
configurable: true
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "platform", {
|
|
92
|
+
get: function () { return this.context().platform; },
|
|
93
|
+
enumerable: false,
|
|
94
|
+
configurable: true
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "mobile", {
|
|
97
|
+
get: function () { return this.implementation().mobile; },
|
|
98
|
+
enumerable: false,
|
|
99
|
+
configurable: true
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "rum", {
|
|
102
|
+
get: function () { return this.implementation().rum; },
|
|
103
|
+
enumerable: false,
|
|
104
|
+
configurable: true
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "logger", {
|
|
107
|
+
get: function () { return this.implementation().logger; },
|
|
108
|
+
enumerable: false,
|
|
109
|
+
configurable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(FTCocosPlatformSDK.prototype, "trace", {
|
|
112
|
+
get: function () { return this.implementation().trace; },
|
|
113
|
+
enumerable: false,
|
|
114
|
+
configurable: true
|
|
115
|
+
});
|
|
116
|
+
/** Uses installed project settings when no explicit configuration is supplied. */
|
|
117
|
+
FTCocosPlatformSDK.prototype.start = function (config) {
|
|
118
|
+
if (this.mode !== 'idle')
|
|
119
|
+
throw new Error('Cocos SDK already started or attached');
|
|
120
|
+
if (this.platform === 'web') {
|
|
121
|
+
this.implementation().start(config);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
var settings = config || (this.target || (0, platform_runtime_js_1.platformGlobal)()).__FT_COCOS_CONFIGURATION__;
|
|
125
|
+
if (!(settings === null || settings === void 0 ? void 0 : settings.sdk))
|
|
126
|
+
throw new Error('Native start() requires sdk configuration; configure configuration.sdk in cocos-sdk.config.json');
|
|
127
|
+
var replay = 'replay' in settings ? settings.replay : undefined;
|
|
128
|
+
var sdk = this.implementation();
|
|
129
|
+
var facade = replay ? this.composeReplay(sdk) : undefined;
|
|
130
|
+
this.replayConfig = replay;
|
|
131
|
+
// Native initialization may partially succeed. Keep stop() available for cleanup.
|
|
132
|
+
try {
|
|
133
|
+
if (facade)
|
|
134
|
+
facade.start(settings);
|
|
135
|
+
else
|
|
136
|
+
sdk.start(settings);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
try {
|
|
140
|
+
sdk.shutdown();
|
|
141
|
+
}
|
|
142
|
+
catch ( /* Preserve startup error; stop() can retry cleanup. */_a) { /* Preserve startup error; stop() can retry cleanup. */ }
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
FTCocosPlatformSDK.prototype.attach = function (config) {
|
|
147
|
+
if (this.mode === 'standalone')
|
|
148
|
+
throw new Error('start() and attach() are mutually exclusive');
|
|
149
|
+
if (this.mode === 'hybrid')
|
|
150
|
+
return;
|
|
151
|
+
// Explicit attach settings preserve legacy withSessionReplay() ownership of its configuration.
|
|
152
|
+
var settings = config === undefined ? (this.target || (0, platform_runtime_js_1.platformGlobal)()).__FT_COCOS_CONFIGURATION__ : undefined;
|
|
153
|
+
if (this.platform !== 'web' && (settings === null || settings === void 0 ? void 0 : settings.replay)) {
|
|
154
|
+
var _a = settings.replay, _rate = _a.sessionReplaySamplingRate, _errorRate = _a.sessionReplayOnErrorSamplingRate, capture = __rest(_a, ["sessionReplaySamplingRate", "sessionReplayOnErrorSamplingRate"]);
|
|
155
|
+
this.composeReplay(this.implementation()).attach(__assign(__assign({ autoTrack: settings.autoTrack }, config), { replay: capture }));
|
|
156
|
+
this.replayConfig = settings.replay;
|
|
157
|
+
}
|
|
158
|
+
else
|
|
159
|
+
this.implementation().attach(config || (this.platform !== 'web' && settings ? { autoTrack: settings.autoTrack } : undefined));
|
|
160
|
+
};
|
|
161
|
+
FTCocosPlatformSDK.prototype.enterCocos = function (options) { this.implementation().enterCocos(options); };
|
|
162
|
+
FTCocosPlatformSDK.prototype.leaveCocos = function () { var _a; (_a = (0, platform_runtime_js_1.existingPlatformImplementation)(this.context(), this.target)) === null || _a === void 0 ? void 0 : _a.leaveCocos(); };
|
|
163
|
+
FTCocosPlatformSDK.prototype.detach = function () { var _a; (_a = (0, platform_runtime_js_1.existingPlatformImplementation)(this.context(), this.target)) === null || _a === void 0 ? void 0 : _a.detach(); };
|
|
164
|
+
FTCocosPlatformSDK.prototype.shutdown = function () { var _a; (_a = (0, platform_runtime_js_1.existingPlatformImplementation)(this.context(), this.target)) === null || _a === void 0 ? void 0 : _a.shutdown(); };
|
|
165
|
+
/** Stops this Cocos instance. Web page collectors and native host-owned SDKs retain their lifecycle. */
|
|
166
|
+
FTCocosPlatformSDK.prototype.stop = function () {
|
|
167
|
+
if (this.mode === 'idle')
|
|
168
|
+
return;
|
|
169
|
+
if (this.platform === 'web' || this.mode === 'hybrid')
|
|
170
|
+
this.detach();
|
|
171
|
+
else
|
|
172
|
+
this.shutdown();
|
|
173
|
+
this.replayConfig = undefined;
|
|
174
|
+
};
|
|
175
|
+
FTCocosPlatformSDK.prototype.registerExtension = function (id, version, engine, factory) {
|
|
176
|
+
if (engine !== this.engine)
|
|
177
|
+
throw new Error('SDK extension Creator engine does not match the base SDK');
|
|
178
|
+
if (this.platform === 'web')
|
|
179
|
+
throw new Error('Native SDK extensions are unavailable on Web; configure Web Replay at page bootstrap.');
|
|
180
|
+
return this.implementation().registerExtension(id, version, engine, factory);
|
|
181
|
+
};
|
|
182
|
+
FTCocosPlatformSDK.prototype.composeReplay = function (sdk) {
|
|
183
|
+
if (this.nativeReplay)
|
|
184
|
+
return this.nativeReplay;
|
|
185
|
+
var factory = (this.target || (0, platform_runtime_js_1.platformGlobal)()).__FT_COCOS_REPLAY_FACTORY__;
|
|
186
|
+
if (!factory || factory.protocol !== 1 || factory.version !== version_js_1.FT_COCOS_SDK_VERSION || factory.engine !== this.engine) {
|
|
187
|
+
throw new Error('Native Replay runtime is missing or incompatible. Install the matching Replay package and rerun the installer with --replay');
|
|
188
|
+
}
|
|
189
|
+
return this.nativeReplay = factory.create(sdk, this.context());
|
|
190
|
+
};
|
|
191
|
+
FTCocosPlatformSDK.prototype.implementation = function () { return (0, platform_runtime_js_1.platformImplementation)(this.context(), this.target); };
|
|
192
|
+
return FTCocosPlatformSDK;
|
|
193
|
+
}());
|
|
194
|
+
exports.FTCocosPlatformSDK = FTCocosPlatformSDK;
|
|
195
|
+
//# sourceMappingURL=platform-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-client.js","sourceRoot":"","sources":["../../../../../src/core/platform-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAKA,2CAAoD;AACpD,6DAAyL;AAIzL,kGAAkG;AAClG;IA6BE,4BACW,MAA+B,EACvB,OAAgC,EAChC,MAAyB;QAH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,GAArB,UAAsB,GAAe;QACnC,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO,IAAI,CAAC,YAAY,CAAC;QAChD,IAAM,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,IAAA,oCAAc,GAAE,CAAC,CAAC,2BAA2B,CAAC;QAC9E,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,KAAK,iCAAoB,IAAI,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;YACrH,MAAM,IAAI,KAAK,CAAC,6HAA6H,CAAC,CAAC;QACjJ,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IACO,2CAAc,GAAtB,cAA2B,OAAO,IAAA,4CAAsB,EAAC,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1F,yBAAC;AAAD,CAAC,AAlGD,IAkGC;AAlGY,gDAAkB","sourcesContent":["import type { FTCocosSDK, FTSDKExtension } from './client.js';\nimport type { FTCocosConfig, FTCocosEnterOptions } from './types.js';\nimport type { FTCocosWebAttachConfig, FTCocosWebConfig } from '../web/types.js';\nimport type { FTCocosWebSDK } from '../web/client.js';\nimport type { FTNativeReplayConfig } from './platform-options.js';\nimport { FT_COCOS_SDK_VERSION } from './version.js';\nimport { existingPlatformImplementation, platformGlobal, platformImplementation, type FTNativeReplayFacade, type FTPlatformContext, type FTPlatformGlobal } from './platform-runtime.js';\n\nexport type FTCocosPlatformConfig = (FTCocosConfig & { replay?: FTNativeReplayConfig }) | FTCocosWebConfig;\n\n/** Stable engine entry. Build assets select implementations and install project configuration. */\nexport class FTCocosPlatformSDK {\n readonly extensionProtocol = 1;\n private get mode() { return existingPlatformImplementation(this.context(), this.target)?.lifecycleMode || 'idle'; }\n private record() {\n this.implementation();\n return (this.target || platformGlobal()).__FT_COCOS_INSTANCES__![this.engine + ':' + this.platform]!;\n }\n private get nativeReplay() { return this.record().replay; }\n private set nativeReplay(value: FTNativeReplayFacade | undefined) { this.record().replay = value; }\n private get replayConfig() { return this.record().replayConfig; }\n private set replayConfig(value: FTNativeReplayConfig | undefined) { this.record().replayConfig = value; }\n readonly replay = {\n /** Starts recording using the settings selected at initialization. */\n start: (): void => {\n if (this.mode === 'idle') throw new Error('Start or attach the Cocos SDK before starting Replay');\n if (!this.implementation().isCocosEntered) throw new Error('Call enterCocos() before starting Hybrid Replay');\n if (this.platform === 'web') { (this.implementation() as FTCocosWebSDK).replay.start(); return; }\n if (!this.nativeReplay || !this.replayConfig) throw new Error('Enable Replay in cocos-sdk.config.json before starting the SDK');\n if (this.mode === 'hybrid') this.nativeReplay.replay.enterHybrid();\n else this.nativeReplay.replay.start(this.replayConfig);\n },\n /** Stops recording while leaving base tracking active. */\n stop: (): void => {\n if (this.mode === 'idle') return;\n if (this.platform === 'web') { (this.implementation() as FTCocosWebSDK).replay.stop(); return; }\n if (this.mode === 'hybrid') this.nativeReplay?.replay.leaveHybrid();\n else this.nativeReplay?.replay.stop();\n },\n };\n constructor(\n readonly engine: 'creator2' | 'creator3',\n private readonly context: () => FTPlatformContext,\n private readonly target?: FTPlatformGlobal,\n ) {}\n get platform(): FTPlatformContext['platform'] { return this.context().platform; }\n get mobile(): FTCocosSDK['mobile'] { return this.implementation().mobile; }\n get rum(): FTCocosSDK['rum'] { return this.implementation().rum; }\n get logger(): FTCocosSDK['logger'] { return this.implementation().logger; }\n get trace(): FTCocosSDK['trace'] { return this.implementation().trace; }\n\n /** Uses installed project settings when no explicit configuration is supplied. */\n start(config?: FTCocosPlatformConfig): void {\n if (this.mode !== 'idle') throw new Error('Cocos SDK already started or attached');\n if (this.platform === 'web') {\n (this.implementation() as FTCocosWebSDK).start(config);\n return;\n }\n const settings = config || (this.target || platformGlobal()).__FT_COCOS_CONFIGURATION__;\n if (!settings?.sdk) throw new Error('Native start() requires sdk configuration; configure configuration.sdk in cocos-sdk.config.json');\n const replay = 'replay' in settings ? settings.replay : undefined;\n const sdk = this.implementation() as FTCocosSDK;\n const facade = replay ? this.composeReplay(sdk) : undefined;\n this.replayConfig = replay;\n // Native initialization may partially succeed. Keep stop() available for cleanup.\n try {\n if (facade) facade.start(settings as FTCocosConfig & { replay?: FTNativeReplayConfig });\n else sdk.start(settings as FTCocosConfig);\n } catch (error) {\n try { sdk.shutdown(); } catch { /* Preserve startup error; stop() can retry cleanup. */ }\n throw error;\n }\n }\n attach(config?: FTCocosWebAttachConfig): void {\n if (this.mode === 'standalone') throw new Error('start() and attach() are mutually exclusive');\n if (this.mode === 'hybrid') return;\n // Explicit attach settings preserve legacy withSessionReplay() ownership of its configuration.\n const settings = config === undefined ? (this.target || platformGlobal()).__FT_COCOS_CONFIGURATION__ : undefined;\n if (this.platform !== 'web' && settings?.replay) {\n const { sessionReplaySamplingRate: _rate, sessionReplayOnErrorSamplingRate: _errorRate, ...capture } = settings.replay;\n this.composeReplay(this.implementation() as FTCocosSDK).attach({ autoTrack: settings.autoTrack, ...config, replay: capture });\n this.replayConfig = settings.replay;\n } else this.implementation().attach(config || (this.platform !== 'web' && settings ? { autoTrack: settings.autoTrack } : undefined));\n }\n enterCocos(options?: FTCocosEnterOptions): void { this.implementation().enterCocos(options); }\n leaveCocos(): void { existingPlatformImplementation(this.context(), this.target)?.leaveCocos(); }\n detach(): void { existingPlatformImplementation(this.context(), this.target)?.detach(); }\n shutdown(): void { existingPlatformImplementation(this.context(), this.target)?.shutdown(); }\n /** Stops this Cocos instance. Web page collectors and native host-owned SDKs retain their lifecycle. */\n stop(): void {\n if (this.mode === 'idle') return;\n if (this.platform === 'web' || this.mode === 'hybrid') this.detach();\n else this.shutdown();\n this.replayConfig = undefined;\n }\n registerExtension<T>(id: string, version: string, engine: string, factory: () => FTSDKExtension<T>): T {\n if (engine !== this.engine) throw new Error('SDK extension Creator engine does not match the base SDK');\n if (this.platform === 'web') throw new Error('Native SDK extensions are unavailable on Web; configure Web Replay at page bootstrap.');\n return (this.implementation() as FTCocosSDK).registerExtension(id, version, engine, factory);\n }\n private composeReplay(sdk: FTCocosSDK): FTNativeReplayFacade {\n if (this.nativeReplay) return this.nativeReplay;\n const factory = (this.target || platformGlobal()).__FT_COCOS_REPLAY_FACTORY__;\n if (!factory || factory.protocol !== 1 || factory.version !== FT_COCOS_SDK_VERSION || factory.engine !== this.engine) {\n throw new Error('Native Replay runtime is missing or incompatible. Install the matching Replay package and rerun the installer with --replay');\n }\n return this.nativeReplay = factory.create(sdk, this.context());\n }\n private implementation() { return platformImplementation(this.context(), this.target); }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FTCocosConfig } from './types.js';
|
|
2
|
+
import type { FTCocosWebConfig, FTWebReplayConfig } from '../web/types.js';
|
|
3
|
+
/** Native Replay options; Web encoding and privacy settings use FTWebReplayConfig. */
|
|
4
|
+
export interface FTNativeReplayConfig {
|
|
5
|
+
sessionReplaySamplingRate?: number;
|
|
6
|
+
sessionReplayOnErrorSamplingRate?: number;
|
|
7
|
+
captureFps?: number;
|
|
8
|
+
maxImageDimension?: number;
|
|
9
|
+
imagePolicy?: {
|
|
10
|
+
quality?: 'low' | 'medium' | 'high';
|
|
11
|
+
maxFrameBytes?: number;
|
|
12
|
+
};
|
|
13
|
+
touchPrivacy?: 'show' | 'hide';
|
|
14
|
+
}
|
|
15
|
+
/** SDK-owned sections of cocos-sdk.config.json; build-tool sections may coexist. */
|
|
16
|
+
export interface FTCocosProjectConfiguration {
|
|
17
|
+
configuration?: FTCocosConfig;
|
|
18
|
+
replay?: {
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
sessionReplaySamplingRate?: number;
|
|
21
|
+
sessionReplayOnErrorSamplingRate?: number;
|
|
22
|
+
native?: Omit<FTNativeReplayConfig, 'sessionReplaySamplingRate' | 'sessionReplayOnErrorSamplingRate'> | false;
|
|
23
|
+
web?: Omit<FTWebReplayConfig, 'enabled' | 'sessionReplaySamplingRate' | 'sessionReplayOnErrorSamplingRate'> | false;
|
|
24
|
+
};
|
|
25
|
+
web?: {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
configuration?: Partial<FTCocosWebConfig>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=platform-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-options.d.ts","sourceRoot":"","sources":["../../../../../src/core/platform-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,sFAAsF;AACtF,MAAM,WAAW,oBAAoB;IACnC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9E,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC;AAED,oFAAoF;AACpF,MAAM,WAAW,2BAA2B;IAC1C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,yBAAyB,CAAC,EAAE,MAAM,CAAC;QACnC,gCAAgC,CAAC,EAAE,MAAM,CAAC;QAC1C,MAAM,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,2BAA2B,GAAG,kCAAkC,CAAC,GAAG,KAAK,CAAC;QAC9G,GAAG,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,2BAA2B,GAAG,kCAAkC,CAAC,GAAG,KAAK,CAAC;KACrH,CAAC;IACF,GAAG,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;KAAE,CAAC;CACxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-options.js","sourceRoot":"","sources":["../../../../../src/core/platform-options.ts"],"names":[],"mappings":"","sourcesContent":["import type { FTCocosConfig } from './types.js';\nimport type { FTCocosWebConfig, FTWebReplayConfig } from '../web/types.js';\n\n/** Native Replay options; Web encoding and privacy settings use FTWebReplayConfig. */\nexport interface FTNativeReplayConfig {\n sessionReplaySamplingRate?: number;\n sessionReplayOnErrorSamplingRate?: number;\n captureFps?: number;\n maxImageDimension?: number;\n imagePolicy?: { quality?: 'low' | 'medium' | 'high'; maxFrameBytes?: number };\n touchPrivacy?: 'show' | 'hide';\n}\n\n/** SDK-owned sections of cocos-sdk.config.json; build-tool sections may coexist. */\nexport interface FTCocosProjectConfiguration {\n configuration?: FTCocosConfig;\n replay?: {\n enabled?: boolean;\n sessionReplaySamplingRate?: number;\n sessionReplayOnErrorSamplingRate?: number;\n native?: Omit<FTNativeReplayConfig, 'sessionReplaySamplingRate' | 'sessionReplayOnErrorSamplingRate'> | false;\n web?: Omit<FTWebReplayConfig, 'enabled' | 'sessionReplaySamplingRate' | 'sessionReplayOnErrorSamplingRate'> | false;\n };\n web?: { enabled?: boolean; configuration?: Partial<FTCocosWebConfig> };\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { FTEngineTrackingHooks } from './auto-tracking.js';
|
|
2
|
+
import type { FTCocosConfig, FTCocosHybridConfig } from './types.js';
|
|
3
|
+
import type { FTNativeReplayConfig } from './platform-options.js';
|
|
4
|
+
import type { FTCocosSDK } from './client.js';
|
|
5
|
+
import type { FTCocosWebSDK } from '../web/client.js';
|
|
6
|
+
export interface FTPlatformContext {
|
|
7
|
+
engine: 'creator2' | 'creator3';
|
|
8
|
+
platform: 'android' | 'ios' | 'unsupported' | 'web';
|
|
9
|
+
hooks: FTEngineTrackingHooks;
|
|
10
|
+
canvasIsPublic: () => boolean;
|
|
11
|
+
engineApi?: unknown;
|
|
12
|
+
reflection?: {
|
|
13
|
+
callStaticMethod(...args: string[]): unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export type FTPlatformImplementation = FTCocosSDK | FTCocosWebSDK;
|
|
17
|
+
export interface FTPlatformFactory {
|
|
18
|
+
protocol: 1;
|
|
19
|
+
version: string;
|
|
20
|
+
create(context: FTPlatformContext, target: FTPlatformGlobal): FTPlatformImplementation;
|
|
21
|
+
}
|
|
22
|
+
export interface FTNativeReplayFacade {
|
|
23
|
+
start(config: FTCocosConfig & {
|
|
24
|
+
replay?: FTNativeReplayConfig;
|
|
25
|
+
}): void;
|
|
26
|
+
attach(config: FTCocosHybridConfig & {
|
|
27
|
+
replay?: FTNativeReplayConfig;
|
|
28
|
+
}): void;
|
|
29
|
+
replay: {
|
|
30
|
+
start(config?: FTNativeReplayConfig): void;
|
|
31
|
+
stop(): void;
|
|
32
|
+
enterHybrid(): void;
|
|
33
|
+
leaveHybrid(): void;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface FTPlatformGlobal {
|
|
37
|
+
__FT_COCOS_CONFIGURATION__?: FTCocosConfig & {
|
|
38
|
+
replay?: FTNativeReplayConfig;
|
|
39
|
+
};
|
|
40
|
+
__FT_COCOS_REPLAY_FACTORY__?: {
|
|
41
|
+
protocol: 1;
|
|
42
|
+
version: string;
|
|
43
|
+
engine: string;
|
|
44
|
+
create(base: FTCocosSDK, context: FTPlatformContext): FTNativeReplayFacade;
|
|
45
|
+
};
|
|
46
|
+
__FT_COCOS_NATIVE_FACTORY__?: FTPlatformFactory;
|
|
47
|
+
__FT_COCOS_WEB_FACTORY__?: FTPlatformFactory;
|
|
48
|
+
__FT_COCOS_INSTANCES__?: Record<string, {
|
|
49
|
+
version: string;
|
|
50
|
+
sdk: FTPlatformImplementation;
|
|
51
|
+
replay?: FTNativeReplayFacade;
|
|
52
|
+
replayConfig?: FTNativeReplayConfig;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export declare function platformGlobal(): FTPlatformGlobal;
|
|
56
|
+
export declare function existingPlatformImplementation(context: FTPlatformContext, target?: FTPlatformGlobal): FTPlatformImplementation | undefined;
|
|
57
|
+
/** The engine module graph contains no platform implementation. Build assets supply factories. */
|
|
58
|
+
export declare function platformImplementation(context: FTPlatformContext, target?: FTPlatformGlobal, create?: () => FTPlatformImplementation): FTPlatformImplementation;
|
|
59
|
+
//# sourceMappingURL=platform-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-runtime.d.ts","sourceRoot":"","sources":["../../../../../src/core/platform-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;IAChC,QAAQ,EAAE,SAAS,GAAG,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC;IACpD,KAAK,EAAE,qBAAqB,CAAC;IAC7B,cAAc,EAAE,MAAM,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE;QAAE,gBAAgB,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAA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,CAAC,EAAE,oBAAoB,CAAC;QAAC,YAAY,CAAC,EAAE,oBAAoB,CAAA;KAAE,CAAC,CAAC;CACjK;AACD,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,GAAG,wBAAwB,GAAG,SAAS,CAI1I;AAED,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,wBAAwB,GAAG,wBAAwB,CAc/J"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.platformGlobal = platformGlobal;
|
|
4
|
+
exports.existingPlatformImplementation = existingPlatformImplementation;
|
|
5
|
+
exports.platformImplementation = platformImplementation;
|
|
6
|
+
var version_js_1 = require("./version.js");
|
|
7
|
+
function platformGlobal() {
|
|
8
|
+
return (typeof window !== 'undefined' ? window : globalThis);
|
|
9
|
+
}
|
|
10
|
+
function existingPlatformImplementation(context, target) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (target === void 0) { target = platformGlobal(); }
|
|
13
|
+
var previous = (_a = target.__FT_COCOS_INSTANCES__) === null || _a === void 0 ? void 0 : _a[context.engine + ':' + context.platform];
|
|
14
|
+
if (previous && previous.version !== version_js_1.FT_COCOS_SDK_VERSION)
|
|
15
|
+
throw new Error('Cocos SDK versions must match on the same page');
|
|
16
|
+
return previous === null || previous === void 0 ? void 0 : previous.sdk;
|
|
17
|
+
}
|
|
18
|
+
/** The engine module graph contains no platform implementation. Build assets supply factories. */
|
|
19
|
+
function platformImplementation(context, target, create) {
|
|
20
|
+
if (target === void 0) { target = platformGlobal(); }
|
|
21
|
+
var key = context.engine + ':' + context.platform;
|
|
22
|
+
var instances = target.__FT_COCOS_INSTANCES__ || (target.__FT_COCOS_INSTANCES__ = {});
|
|
23
|
+
var previous = existingPlatformImplementation(context, target);
|
|
24
|
+
if (previous)
|
|
25
|
+
return previous;
|
|
26
|
+
var factory = context.platform === 'web' ? target.__FT_COCOS_WEB_FACTORY__ : target.__FT_COCOS_NATIVE_FACTORY__;
|
|
27
|
+
if (!create && (!factory || factory.protocol !== 1 || factory.version !== version_js_1.FT_COCOS_SDK_VERSION)) {
|
|
28
|
+
throw new Error(context.platform === 'web'
|
|
29
|
+
? 'Cocos Web runtime is missing or incompatible. Run the installer with --web and rebuild, or load /web/bootstrap before game scripts.'
|
|
30
|
+
: 'Cocos native runtime is missing or incompatible. Rerun the SDK installer and rebuild the project.');
|
|
31
|
+
}
|
|
32
|
+
var sdk = create ? create() : factory.create(context, target);
|
|
33
|
+
instances[key] = { version: version_js_1.FT_COCOS_SDK_VERSION, sdk: sdk };
|
|
34
|
+
return sdk;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=platform-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-runtime.js","sourceRoot":"","sources":["../../../../../src/core/platform-runtime.ts"],"names":[],"mappings":";;AAyCA,wCAEC;AAED,wEAIC;AAGD,wDAcC;AA7DD,2CAAoD;AAoCpD,SAAgB,cAAc;IAC5B,OAAO,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAqB,CAAC;AACnF,CAAC;AAED,SAAgB,8BAA8B,CAAC,OAA0B,EAAE,MAAyB;;IAAzB,uBAAA,EAAA,SAAS,cAAc,EAAE;IAClG,IAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,sBAAsB,0CAAG,OAAO,CAAC,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1F,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,KAAK,iCAAoB;QAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAC7H,O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HybridConfig } from './types.js';\nimport type { FTNativeReplayConfig } from './platform-options.js';\nimport type { FTCocosSDK } from './client.js';\nimport type { FTCocosWebSDK } from '../web/client.js';\nimport { FT_COCOS_SDK_VERSION } from './version.js';\n\nexport interface FTPlatformContext {\n engine: 'creator2' | 'creator3';\n platform: 'android' | 'ios' | 'unsupported' | 'web';\n hooks: FTEngineTrackingHooks;\n canvasIsPublic: () => boolean;\n engineApi?: unknown;\n reflection?: { callStaticMethod(...args: string[]): unknown };\n}\nexport type FTPlatformImplementation = FTCocosSDK | FTCocosWebSDK;\nexport interface FTPlatformFactory {\n protocol: 1;\n version: string;\n create(context: FTPlatformContext, target: FTPlatformGlobal): FTPlatformImplementation;\n}\nexport interface FTNativeReplayFacade {\n start(config: FTCocosConfig & { replay?: FTNativeReplayConfig }): void;\n attach(config: FTCocosHybridConfig & { replay?: FTNativeReplayConfig }): void;\n replay: {\n start(config?: FTNativeReplayConfig): void;\n stop(): void;\n enterHybrid(): void;\n leaveHybrid(): void;\n };\n}\nexport interface FTPlatformGlobal {\n __FT_COCOS_CONFIGURATION__?: FTCocosConfig & { replay?: FTNativeReplayConfig };\n __FT_COCOS_REPLAY_FACTORY__?: {\n protocol: 1; version: string; engine: string;\n create(base: FTCocosSDK, context: FTPlatformContext): FTNativeReplayFacade;\n };\n __FT_COCOS_NATIVE_FACTORY__?: FTPlatformFactory;\n __FT_COCOS_WEB_FACTORY__?: FTPlatformFactory;\n __FT_COCOS_INSTANCES__?: Record<string, { version: string; sdk: FTPlatformImplementation; replay?: FTNativeReplayFacade; replayConfig?: FTNativeReplayConfig }>;\n}\nexport function platformGlobal(): FTPlatformGlobal {\n return (typeof window !== 'undefined' ? window : globalThis) as FTPlatformGlobal;\n}\n\nexport function existingPlatformImplementation(context: FTPlatformContext, target = platformGlobal()): FTPlatformImplementation | undefined {\n const previous = target.__FT_COCOS_INSTANCES__?.[context.engine + ':' + context.platform];\n if (previous && previous.version !== FT_COCOS_SDK_VERSION) throw new Error('Cocos SDK versions must match on the same page');\n return previous?.sdk;\n}\n\n/** The engine module graph contains no platform implementation. Build assets supply factories. */\nexport function platformImplementation(context: FTPlatformContext, target = platformGlobal(), create?: () => FTPlatformImplementation): FTPlatformImplementation {\n const key = context.engine + ':' + context.platform;\n const instances = target.__FT_COCOS_INSTANCES__ || (target.__FT_COCOS_INSTANCES__ = {});\n const previous = existingPlatformImplementation(context, target);\n if (previous) return previous;\n const factory = context.platform === 'web' ? target.__FT_COCOS_WEB_FACTORY__ : target.__FT_COCOS_NATIVE_FACTORY__;\n if (!create && (!factory || factory.protocol !== 1 || factory.version !== FT_COCOS_SDK_VERSION)) {\n throw new Error(context.platform === 'web'\n ? 'Cocos Web runtime is missing or incompatible. Run the installer with --web and rebuild, or load /web/bootstrap before game scripts.'\n : 'Cocos native runtime is missing or incompatible. Rerun the SDK installer and rebuild the project.');\n }\n const sdk = create ? create() : factory!.create(context, target);\n instances[key] = { version: FT_COCOS_SDK_VERSION, sdk };\n return sdk;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ type Public<T> = {
|
|
|
6
6
|
[K in keyof T]: T[K];
|
|
7
7
|
};
|
|
8
8
|
/** Structural contract shared by the CommonJS and ES module engine builds. */
|
|
9
|
-
export type FTCocosSDK = Omit<Public<SDK>, 'mobile' | 'rum' | 'logger' | 'trace'> & {
|
|
9
|
+
export type FTCocosSDK = Omit<Public<SDK>, 'mobile' | 'rum' | 'logger' | 'trace' | 'lifecycleMode' | 'isCocosEntered'> & {
|
|
10
10
|
mobile: Public<SDK['mobile']>;
|
|
11
11
|
rum: Public<SDK['rum']>;
|
|
12
12
|
logger: Public<SDK['logger']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-api.d.ts","sourceRoot":"","sources":["../../../../../src/core/plugin-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,cAAc,E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AAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-api.js","sourceRoot":"","sources":["../../../../../src/core/plugin-api.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"plugin-api.js","sourceRoot":"","sources":["../../../../../src/core/plugin-api.ts"],"names":[],"mappings":"","sourcesContent":["import type { FTCocosSDK as SDK } from './client.js';\nexport type { FTSDKLifecycle, FTSDKExtension } from './client.js';\nexport type { FTNativeTransport } from './transport.js';\nexport type { FTAttributes, FTCocosConfig, FTCocosHybridConfig, FTCocosEnterOptions, FTValue } from './types.js';\n\ntype Public<T> = { [K in keyof T]: T[K] };\n\n/** Structural contract shared by the CommonJS and ES module engine builds. */\nexport type FTCocosSDK = Omit<Public<SDK>, 'mobile' | 'rum' | 'logger' | 'trace' | 'lifecycleMode' | 'isCocosEntered'> & {\n mobile: Public<SDK['mobile']>;\n rum: Public<SDK['rum']>;\n logger: Public<SDK['logger']>;\n trace: Public<SDK['trace']>;\n};\n"]}
|
|
@@ -5,7 +5,7 @@ export interface FTTransportResponse<T = FTValue> {
|
|
|
5
5
|
error?: string;
|
|
6
6
|
}
|
|
7
7
|
export interface FTNativeTransport {
|
|
8
|
-
readonly platform: 'android' | 'ios' | 'unsupported';
|
|
8
|
+
readonly platform: 'android' | 'ios' | 'web' | 'unsupported';
|
|
9
9
|
/**
|
|
10
10
|
* Calls a native bridge operation synchronously and decodes its response.
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG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@@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../../src/core/transport.ts"],"names":[],"mappings":";;;AA0CA,wDAcC;AAtBD;IAAA;QACW,aAAQ,GAAG,aAAsB,CAAC;IAK7C,CAAC;IAHC,gCAAM,GAAN,UAAoB,OAAe,EAAE,QAAkB;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC;IACH,sBAAC;AAAD,CAAC,AAND,IAMC;AANY,0CAAe;AAQ5B,SAAgB,sBAAsB,CAAI,GAAY;IACpD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAEtE,IAAI,QAAQ,GAAY,GAAG,CAAC;IAC5B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,QAAa,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,2BAA2B,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,QAAQ,CAAC,KAAsB,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;AACtE,CAAC"}
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../../src/core/transport.ts"],"names":[],"mappings":";;;AA0CA,wDAcC;AAtBD;IAAA;QACW,aAAQ,GAAG,aAAsB,CAAC;IAK7C,CAAC;IAHC,gCAAM,GAAN,UAAoB,OAAe,EAAE,QAAkB;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC;IACH,sBAAC;AAAD,CAAC,AAND,IAMC;AANY,0CAAe;AAQ5B,SAAgB,sBAAsB,CAAI,GAAY;IACpD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAEtE,IAAI,QAAQ,GAAY,GAAG,CAAC;IAC5B,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,QAAa,CAAC;IACvB,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,2BAA2B,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,QAAQ,CAAC,KAAsB,CAAC;AACzC,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;AACtE,CAAC","sourcesContent":["import type { FTValue } from './types.js';\n\nexport interface FTTransportResponse<T = FTValue> {\n ok: boolean;\n value?: T;\n error?: string;\n}\n\nexport interface FTNativeTransport {\n readonly platform: 'android' | 'ios' | 'web' | 'unsupported';\n /**\n * Calls a native bridge operation synchronously and decodes its response.\n *\n * @param method - Native bridge operation name, such as `rum.startView`.\n * @param payload - Optional JSON-serializable arguments for the operation.\n * @returns The decoded result, or undefined when no value is returned or the\n * platform is unsupported.\n * @throws If serialization, the bridge call, or response decoding fails, or\n * the native bridge reports an error.\n */\n invoke<T = FTValue>(method: string, payload?: unknown): T | undefined;\n /**\n * Calls a native operation through an optional asynchronous transport.\n * Check that this method exists before calling it; supported operations depend\n * on the transport implementation.\n *\n * @param method - Native bridge operation supported by the async transport.\n * @param payload - Optional JSON-serializable arguments for the operation.\n * @returns A promise that resolves to the decoded result, or to undefined when\n * no value is returned. Rejects if the operation or response decoding fails.\n */\n invokeAsync?<T = FTValue>(method: string, payload?: unknown): Promise<T | undefined>;\n}\n\nexport class FTNoopTransport implements FTNativeTransport {\n readonly platform = 'unsupported' as const;\n\n invoke<T = FTValue>(_method: string, _payload?: unknown): T | undefined {\n return undefined;\n }\n}\n\nexport function parseTransportResponse<T>(raw: unknown): T | undefined {\n if (raw === undefined || raw === null || raw === '') return undefined;\n\n let response: unknown = raw;\n if (typeof raw === 'string') {\n response = JSON.parse(raw);\n }\n if (!isResponse(response)) {\n return response as T;\n }\n if (!response.ok) {\n throw new Error(response.error || 'Native bridge call failed');\n }\n return response.value as T | undefined;\n}\n\nfunction isResponse(value: unknown): value is FTTransportResponse {\n return typeof value === 'object' && value !== null && 'ok' in value;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/types.ts"],"names":[],"mappings":"","sourcesContent":["/** A scalar value accepted by SDK attributes. */\nexport type FTPrimitive = string | number | boolean | null;\n\n/** A JSON-compatible SDK attribute value. */\nexport type FTValue = FTPrimitive | FTValue[] | { [key: string]: FTValue };\n\n/** Custom attributes attached to RUM, Log, and Resource data. */\nexport type FTAttributes = Record<string, FTValue>;\n\n/** Deployment environment reported with SDK data. */\nexport type FTEnvironment = 'prod' | 'gray' | 'pre' | 'common' | 'local' | string;\n\n/** Base SDK connection and service settings. */\nexport interface FTSDKConfig {\n /** Datakit address used for direct data reporting. */\n datakitUrl?: string;\n /** DataWay address used for public data reporting. Requires {@link clientToken}. */\n datawayUrl?: string;\n /** Client token used with {@link datawayUrl}. Keep this value outside source control. */\n clientToken?: string;\n /** Service name attached to collected data. */\n serviceName?: string;\n /** Deployment environment attached to collected data. */\n env?: FTEnvironment;\n /** Enables native SDK debug output. */\n debug?: boolean;\n /** String attributes included with all data produced by the native SDK. */\n globalContext?: Record<string, string>;\n}\n\n/** User identity bound to subsequent SDK data. */\nexport interface FTUserData {\n /** Stable application-specific user identifier. */\n userId: string;\n /** Display name of the user. */\n userName?: string;\n /** Email address of the user. */\n userEmail?: string;\n /** Additional string attributes associated with the user. */\n extra?: Record<string, string>;\n}\n\n/** Real User Monitoring configuration. */\nexport interface FTRUMConfig {\n /** Android RUM application ID. */\n androidAppId?: string;\n /** iOS RUM application ID. */\n iosAppId?: string;\n /** Session sampling percentage from `0` to `100`. Supports decimals. @defaultValue `100` */\n sessionSamplingRate?: number;\n /**\n * Session sampling rate from `0` to `1`.\n * @deprecated Use {@link sessionSamplingRate}. This field keeps its original unit and behavior.\n */\n sampleRate?: number;\n /** Additional session sampling percentage from `0` to `100` for sessions that contain errors. Supports decimals. @defaultValue `0` */\n sessionOnErrorSamplingRate?: number;\n /**\n * Additional session sampling rate from `0` to `1` for sessions that contain errors.\n * @deprecated Use {@link sessionOnErrorSamplingRate}. This field keeps its original unit and behavior.\n */\n sessionOnErrorSampleRate?: number;\n /** Enables native user-action tracking. */\n enableNativeUserAction?: boolean;\n /** Enables native view tracking. */\n enableNativeUserView?: boolean;\n /** Enables native resource tracking. */\n enableNativeUserResource?: boolean;\n /** Enables native crash tracking. */\n enableNativeCrash?: boolean;\n /** Enables Android ANR tracking. Ignored on platforms that do not support it. */\n enableNativeAnr?: boolean;\n /** Enables native UI-block or freeze tracking. */\n enableNativeUiBlock?: boolean;\n /** Minimum native UI-block duration in milliseconds. */\n nativeUiBlockDurationMs?: number;\n /** Native SDK error-monitor bit mask. */\n errorMonitorType?: number;\n /** Native SDK device-metrics monitor bit mask. */\n deviceMetricsMonitorType?: number;\n /** Device-metrics collection frequency. */\n detectFrequency?: 'normal' | 'frequent' | 'rare';\n /** String attributes included with all RUM data. */\n globalContext?: Record<string, string>;\n}\n\n/** Log level accepted by the SDK logger. */\nexport type FTLogLevel = 'info' | 'warning' | 'error' | 'critical' | 'ok' | string;\n\n/** Logger configuration. */\nexport interface FTLoggerConfig {\n /** Log sampling percentage from `0` to `100`. Supports decimals. @defaultValue `100` */\n logSamplingRate?: number;\n /**\n * Log sampling rate from `0` to `1`.\n * @deprecated Use {@link logSamplingRate}. This field keeps its original unit and behavior.\n */\n sampleRate?: number;\n /** Associates logs with the current RUM session. */\n enableLinkRumData?: boolean;\n /** Enables logs submitted through the Cocos SDK logger. */\n enableCustomLog?: boolean;\n /** Mirrors custom logs to the platform console. */\n printCustomLogToConsole?: boolean;\n /** Policy used when the native log cache reaches its limit. */\n discardStrategy?: 'discard' | 'discardOldest';\n /** Log levels accepted by the native logger. */\n logLevelFilters?: FTLogLevel[];\n /** Maximum number of cached log entries. */\n logCacheLimitCount?: number;\n /** String attributes included with every log. */\n globalContext?: Record<string, string>;\n}\n\n/** Distributed-tracing propagation format. */\nexport type FTTraceType =\n | 'ddTrace'\n | 'zipkinMultiHeader'\n | 'zipkinSingleHeader'\n | 'traceparent'\n | 'skywalking'\n | 'jaeger';\n\n/** Distributed-tracing configuration. */\nexport interface FTTraceConfig {\n /** Trace sampling percentage from `0` to `100`. Supports decimals. @defaultValue `100` */\n traceSamplingRate?: number;\n /**\n * Trace sampling rate from `0` to `1`.\n * @deprecated Use {@link traceSamplingRate}. This field keeps its original unit and behavior.\n */\n sampleRate?: number;\n /** Header propagation format. */\n traceType?: FTTraceType;\n /** Associates trace data with the current RUM session. */\n enableLinkRumData?: boolean;\n /** Enables native automatic network tracing. */\n enableNativeAutoTrace?: boolean;\n}\n\n/** Request and response details recorded for a manually tracked resource. */\nexport interface FTResourceContent {\n /** Absolute resource URL. */\n url: string;\n /** HTTP method, such as `GET` or `POST`. */\n httpMethod: string;\n /** Request headers safe to include in observability data. */\n requestHeaders?: Record<string, string>;\n /** Response headers safe to include in observability data. */\n responseHeaders?: Record<string, string>;\n /** Optional response body safe to include in observability data. */\n responseBody?: string;\n /** HTTP response status code. */\n statusCode?: number;\n /** Response content type. */\n responseContentType?: string;\n /** Response content encoding. */\n responseContentEncoding?: string;\n}\n\n/** Optional timing metrics for a manually tracked resource. Values are nanosecond timestamps. */\nexport interface FTResourceMetrics {\n /** Time at which the fetch operation started. */\n fetchStartTime?: number;\n /** Time at which the TCP connection started. */\n tcpStartTime?: number;\n /** Time at which the TCP connection completed. */\n tcpEndTime?: number;\n /** Time at which DNS resolution started. */\n dnsStartTime?: number;\n /** Time at which DNS resolution completed. */\n dnsEndTime?: number;\n /** Time at which the first response data arrived. */\n responseStartTime?: number;\n /** Time at which the response completed. */\n responseEndTime?: number;\n /** Time at which the TLS handshake started. */\n sslStartTime?: number;\n /** Time at which the TLS handshake completed. */\n sslEndTime?: number;\n}\n\n/** Cocos events that the SDK can track automatically. */\nexport interface FTAutoTrackingConfig {\n /** Tracks Cocos scene changes as RUM views. */\n scenes?: boolean;\n /** Tracks supported pointer interactions as RUM actions. */\n actions?: boolean;\n /** Tracks supported Cocos errors as RUM errors. */\n errors?: boolean;\n /** Sends supported console output to the SDK logger. */\n console?: boolean;\n /**\n * Tracks supported network requests as RUM resources and traces. In Hybrid\n * mode, starts at attach() and stays active until detach(), including outside\n * Cocos pages. In standalone mode, follows start()/shutdown().\n */\n network?: boolean;\n}\n\n/** Complete configuration for a standalone Cocos application. */\nexport interface FTCocosConfig {\n /** Required base SDK configuration. */\n sdk: FTSDKConfig;\n /** Enables and configures RUM. */\n rum?: FTRUMConfig;\n /** Enables and configures logging. */\n logger?: FTLoggerConfig;\n /** Enables and configures distributed tracing. */\n trace?: FTTraceConfig;\n /** Enables selected Cocos automatic-tracking integrations. */\n autoTrack?: FTAutoTrackingConfig;\n}\n\n/** Cocos-side configuration for applications initialized by a native host. */\nexport interface FTCocosHybridConfig {\n /** Enables selected Cocos automatic-tracking integrations. */\n autoTrack?: FTAutoTrackingConfig;\n}\n\n/** Options applied when entering a Cocos runtime from a native host. */\nexport interface FTCocosEnterOptions {\n /** RUM view name used when automatic scene tracking is disabled. */\n viewName?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../src/core/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oCAMC;AAED,gDAMC;AAED,0DAgBC;AAED,kCAGC;AArCD,SAAgB,YAAY,CAAC,KAAyB,EAAE,IAAY;IAClE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,UAAU,CAAC,UAAG,IAAI,6BAA0B,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,kBAAkB,CAAC,KAAyB,EAAE,IAAY;IACxE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG,EAAE,CAAC;QACxD,MAAM,IAAI,UAAU,CAAC,UAAG,IAAI,+BAA4B,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,uBAAuB,CACrC,MAAS,EACT,KAAa,EACb,MAA8E;IAE9E,IAAM,MAAM,GAAG,aAAK,MAAM,CAA6B,CAAC;IACxD,MAAM,CAAC,OAAO,CAAC,UAAC,EAA8B;YAA7B,eAAe,QAAA,EAAE,WAAW,QAAA;QAC3C,IAAM,UAAU,GAAG,MAAM,CAAC,eAAe,CAAuB,CAAC;QACjE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,kBAAkB,CAAC,UAAU,EAAE,UAAG,KAAK,cAAI,eAAe,CAAE,CAAC,CAAC;Y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AAa,EACb,MAA8E;IAE9E,IAAM,MAAM,GAAG,aAAK,MAAM,CAA6B,CAAC;IACxD,MAAM,CAAC,OAAO,CAAC,UAAC,EAA8B;YAA7B,eAAe,QAAA,EAAE,WAAW,QAAA;QAC3C,IAAM,UAAU,GAAG,MAAM,CAAC,eAAe,CAAuB,CAAC;QACjE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,kBAAkB,CAAC,UAAU,EAAE,UAAG,KAAK,cAAI,eAAe,CAAE,CAAC,CAAC;YAC9D,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;YAC3B,OAAO;QACT,CAAC;QACD,YAAY,CAAC,MAAM,CAAC,WAAW,CAAuB,EAAE,UAAG,KAAK,cAAI,WAAW,CAAE,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;IACH,OAAO,MAAW,CAAC;AACrB,CAAC;AAED,SAAgB,WAAW,CAAC,KAAa,EAAE,IAAY;IACrD,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,UAAG,IAAI,uBAAoB,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["export function samplingRate(value: number | undefined, name: string): number | undefined {\n if (value === undefined) return undefined;\n if (!Number.isFinite(value) || value < 0 || value > 1) {\n throw new RangeError(`${name} must be between 0 and 1`);\n }\n return value;\n}\n\nexport function samplingPercentage(value: number | undefined, name: string): number | undefined {\n if (value === undefined) return undefined;\n if (!Number.isFinite(value) || value < 0 || value > 100) {\n throw new RangeError(`${name} must be between 0 and 100`);\n }\n return value;\n}\n\nexport function validatedSamplingConfig<T extends object>(\n config: T,\n scope: string,\n fields: ReadonlyArray<readonly [percentageField: string, legacyField: string]>,\n): T {\n const result = { ...config } as Record<string, unknown>;\n fields.forEach(([percentageField, legacyField]) => {\n const percentage = result[percentageField] as number | undefined;\n if (percentage !== undefined) {\n samplingPercentage(percentage, `${scope}.${percentageField}`);\n delete result[legacyField];\n return;\n }\n samplingRate(result[legacyField] as number | undefined, `${scope}.${legacyField}`);\n });\n return result as T;\n}\n\nexport function requireText(value: string, name: string): string {\n if (!value.trim()) throw new TypeError(`${name} must not be empty`);\n return value;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Version of the installed Cocos SDK package. */
|
|
2
|
-
export declare const FT_COCOS_SDK_VERSION = "0.1.1-alpha.
|
|
2
|
+
export declare const FT_COCOS_SDK_VERSION = "0.1.1-alpha.2";
|
|
3
3
|
/** Global-context key used to report the Cocos SDK package version. */
|
|
4
4
|
export declare const FT_COCOS_SDK_VERSION_KEY = "sdk_package_cocos";
|
|
5
5
|
/** Event attribute used to identify data emitted through a framework bridge. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FT_COCOS_SDK_BRIDGE_INFO = exports.FT_COCOS_SDK_BRIDGE_INFO_KEY = exports.FT_COCOS_SDK_VERSION_KEY = exports.FT_COCOS_SDK_VERSION = void 0;
|
|
4
4
|
/** Version of the installed Cocos SDK package. */
|
|
5
|
-
exports.FT_COCOS_SDK_VERSION = '0.1.1-alpha.
|
|
5
|
+
exports.FT_COCOS_SDK_VERSION = '0.1.1-alpha.2';
|
|
6
6
|
/** Global-context key used to report the Cocos SDK package version. */
|
|
7
7
|
exports.FT_COCOS_SDK_VERSION_KEY = 'sdk_package_cocos';
|
|
8
8
|
/** Event attribute used to identify data emitted through a framework bridge. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../src/core/version.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AACrC,QAAA,oBAAoB,GAAG,eAAe,CAAC;AAEpD,uEAAuE;AAC1D,QAAA,wBAAwB,GAAG,mBAAmB,CAAC;AAE5D,gFAAgF;AACnE,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AAE9D,wEAAwE;AAC3D,QAAA,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC;IACrD,KAAK,EAAE,4BAAoB;CAC5B,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../src/core/version.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AACrC,QAAA,oBAAoB,GAAG,eAAe,CAAC;AAEpD,uEAAuE;AAC1D,QAAA,wBAAwB,GAAG,mBAAmB,CAAC;AAE5D,gFAAgF;AACnE,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AAE9D,wEAAwE;AAC3D,QAAA,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC;IACrD,KAAK,EAAE,4BAAoB;CAC5B,CAAC,CAAC","sourcesContent":["/** Version of the installed Cocos SDK package. */\nexport const FT_COCOS_SDK_VERSION = '0.1.1-alpha.2';\n\n/** Global-context key used to report the Cocos SDK package version. */\nexport const FT_COCOS_SDK_VERSION_KEY = 'sdk_package_cocos';\n\n/** Event attribute used to identify data emitted through a framework bridge. */\nexport const FT_COCOS_SDK_BRIDGE_INFO_KEY = 'sdk_bridge_info';\n\n/** Serialized bridge metadata expected by the native SDK data model. */\nexport const FT_COCOS_SDK_BRIDGE_INFO = JSON.stringify({\n cocos: FT_COCOS_SDK_VERSION,\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto.js","sourceRoot":"","sources":["../../../../../src/creator2/auto.ts"],"names":[],"mappings":";;;AAGA;IAAA;IAeA,CAAC;IAdC,gDAAc,GAAd,UAAe,QAAgC,EAAE,cAAqB;QAArB,+BAAA,EAAA,qBAAqB;QACpE,IAAM,OAAO,GAAG,sBAAY,OAAA,QAAQ,CAAC,CAAA,MAAA,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,0CAAE,IAAI,KAAI,cAAc,CAAC,CAAA,EAAA,CAAC;QACrF,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CA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AAE,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACxG,CAAC,CAAC;QACF,OAAO,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IACH,8BAAC;AAAD,CAAC,AAfD,IAeC;AAfY,0DAAuB;AAiBpC,SAAS,YAAY,CAAC,IAAY,EAAE,OAA6B;IAC/D,IAAI,KAAU,CAAC;IACf,IAAM,IAAI,GAAG;QACX,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAC3C,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC/B,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC,CAAC;IACF,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;IAC3D,IAAI,EAAE,CAAC;IACP,OAAO;QACL,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAC5D,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { FTEngineTrackingHooks } from '../core/auto-tracking.js';\nimport type { FTAttributes } from '../core/types.js';\n\nexport class FTCreator2TrackingHooks implements FTEngineTrackingHooks {\n onSceneChanged(callback: (name: string) => void, includeCurrent = true): () => void {\n const handler = (): void => callback(cc.director.getScene()?.name || 'UnknownScene');\n cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, handler);\n if (includeCurrent && cc.director.getScene()) handler();\n return () => cc.director.off(cc.Director.EVENT_AFTER_SCENE_LAUNCH, handler);\n }\n\n onAction(callback: (name: string, attributes?: FTAttributes) => void): () => void {\n const handler = (event: any): void => {\n const location = event.getLocation?.();\n callback(event.target?.name || 'CocosTouch', location ? { x: location.x, y: location.y } : undefined);\n };\n return onSceneTouch(cc.Node.EventType.TOUCH_END, handler);\n }\n}\n\nfunction onSceneTouch(type: string, handler: (event: any) => void): () => void {\n let scene: any;\n const bind = (): void => {\n scene?.off(type, handler, undefined, true);\n scene = cc.director.getScene();\n scene?.on(type, handler, undefined, true);\n };\n cc.director.on(cc.Director.EVENT_AFTER_SCENE_LAUNCH, bind);\n bind();\n return () => {\n cc.director.off(cc.Director.EVENT_AFTER_SCENE_LAUNCH, bind);\n scene?.off(type, handler, undefined, true);\n };\n}\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/** Shared
|
|
3
|
-
export declare const guanceSdk:
|
|
1
|
+
import { FTCocosPlatformSDK } from '../core/platform-client.js';
|
|
2
|
+
/** Shared native and Web entry point for Cocos Creator 2.4 applications. */
|
|
3
|
+
export declare const guanceSdk: FTCocosPlatformSDK;
|
|
4
4
|
export * from '../core/index.js';
|
|
5
|
+
export type { FTCocosPlatformConfig } from '../core/platform-client.js';
|
|
6
|
+
export type { FTCocosWebConfig, FTWebConfig, FTWebReplayConfig } from '../web/types.js';
|
|
7
|
+
export type { FTNativeReplayConfig, FTCocosProjectConfiguration } from '../core/platform-options.js';
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/creator2/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/creator2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAKhE,4EAA4E;AAC5E,eAAO,MAAM,SAAS,oBAQpB,CAAC;AACH,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxF,YAAY,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC"}
|