Files
discord-decomp/sources/modules/devtools/AnalyticsLogStore.tsx
T
2026-07-28 01:06:53 +03:00

187 lines
8.8 KiB
TypeScript

/* Metro module 12953; source: modules/devtools/AnalyticsLogStore.tsx; dependencies: [6, 7, 15, 17, 18, 1226, 7112, 490, 491, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import AuthenticationStore from '../../stores/AuthenticationStore.tsx'; /* Metro dependency 1226 */
import DeveloperExperimentStore from '../../stores/DeveloperExperimentStore.tsx'; /* Metro dependency 7112 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun98689(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#98689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:6, offset: 0x021b2524, size: 388 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_10 = [];
const env0_12 = [];
const Store = (Flux).Store;
let value = _fun98694(Store);
value.displayName = 'AnalyticsLogStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {TRACK: TRACK_98701,
TRACK_TRIGGER: TRACK_TRIGGER, SET_TRACK_TRIGGERS: function(a0) {
env0_13 = a0.enabled;
}, ANALYTICS_LOG_CLEAR: ANALYTICS_LOG_CLEAR});
(FileImportTrackerModule).fileFinishedImporting('modules/devtools/AnalyticsLogStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_98690() { // fn#98690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:168, offset: 0x021b26a8, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_98690_isNativeReflectConstruct = function() {
return !!result;
})();
}
function resolveFingerprint(a0) { // fn#98693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:388, offset: 0x021b270a, size: 66 bytes, params: 2, frame: 13
var r0;
var value;
if (a0 != null) {
value = require(490) /* metro dependency 490: FingerprintUtils */;
value = value.extractId(a0);
r0 = value;
} else {
r0 = AuthenticationStore.getId();
}
return r0;
}
function _fun98694(a0) { // fn#98694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:471, offset: 0x021b274c, size: 180 bytes, params: 2, frame: 16
const AnalyticsLogStore2 = AnalyticsLogStore;
Inherits(AnalyticsLogStore2, a0);
return CreateClass(AnalyticsLogStore2, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, DeveloperExperimentStore);
}}, {key: 'loggedEvents', get: get_98697}, {key: 'loggedEventsVersion', get: get_98698}, {key: 'loggedTriggers',
get: get_98699}, {key: 'trackTriggers', get: get_98700}]);
function AnalyticsLogStore() { // fn#98695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:483, offset: 0x0118e06f, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, AnalyticsLogStore);
const value3 = env1_5(AnalyticsLogStore);
return env1_4(this, _isNativeReflectConstruct_98690() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function get_98697() { // fn#98697, offset: 0x00fbd9ec, size: 9 bytes, params: 1, frame: 1
return env1_10;
}
function get_98698() { // fn#98698, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
return env1_11;
}
function get_98699() { // fn#98699, offset: 0x00e2f9de, size: 9 bytes, params: 1, frame: 1
return env1_12;
}
function get_98700() { // fn#98700, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
return env1_13;
}
}
function TRACK_98701({event, properties, fingerprint}) { // fn#98701, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:1091, offset: 0x021b2800, size: 217 bytes, params: 2, frame: 17
var binding;
var push;
var object;
var binding2;
var value2;
var Date;
var value3;
var date;
var slice;
var Math;
if (DeveloperExperimentStore.isDeveloper) {
binding = env0_10;
push = binding.push;
object = {};
binding2 = env0_9;
value2 = typeof binding2 === 'bigint' ? binding2 : +binding2;
env0_9 = typeof value2 === 'bigint' ? value2 + 1n : +value2 + 1;
object.key = value2.toString();
object.event = event;
object.properties = properties;
object.fingerprint = resolveFingerprint(fingerprint);
Date = global.Date;
value3 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
object.timestamp = date instanceof Object ? date : value3;
Reflect.apply(push, binding, [object]);
binding = env0_11;
env0_11 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
if (env0_10.length > 500) {
binding = env0_10;
slice = binding.slice;
Math = global.Math;
env0_10 = Reflect.apply(slice, binding, [-Math.floor(250)]);
}
}
}
function TRACK_TRIGGER({experimentId, descriptor, exposureType, excluded, location, previouslyTracked}) { // fn#98702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:1335, offset: 0x021b28d9, size: 233 bytes, params: 2, frame: 24
var binding;
var items2;
var value2;
var object;
var Date;
var value3;
var date;
let r1 = DeveloperExperimentStore.isDeveloper && env0_13;
if (r1) {
binding = items3;
items2 = [];
value2 = arraySpread(items2, binding, 0, undefined);
object = {};
object.key = (require(491) /* metro dependency 491 */).v4();
object.experimentId = experimentId;
object.descriptor = descriptor;
object.exposureType = exposureType;
object.excluded = excluded;
object.location = location;
object.previouslyTracked = previouslyTracked;
Date = global.Date;
value3 = Object.create(Date.prototype, {constructor: {value: Date}});
date = new Date();
object.timestamp = date instanceof Object ? date : value3;
items2[value2] = object;
value2 + 1;
items3 = items2;
r1 = items2.length > 500;
}
if (r1) {
items3.shift();
}
}
function ANALYTICS_LOG_CLEAR() { // fn#98704, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13143:1715, offset: 0x021b29d5, size: 34 bytes, params: 1, frame: 2
env0_10 = [];
const binding = env0_11;
env0_11 = typeof binding === 'bigint' ? binding + 1n : +binding + 1;
env0_12 = [];
}
}
global.__d(_fun98689, 12953, [6, 7, 15, 17, 18, 1226, 7112, 490, 491, 566, 694,
2]) /* metro module 12953, dependencies: [6, 7, 15, 17, 18, 1226, 7112, 490, 491, 566, 694, 2] */;