Files
discord-decomp/_bundle/Module503.js
T
2026-11-01 12:12:55 +02:00

75 lines
2.8 KiB
JavaScript

// Metro module 503 (f504).
import * as _defaultGetSessionId from "./defaultGetSessionId";
import * as _Module657 from "./Module657";
import { queueTrackingEventMaker } from "./Module658";
import isUndefinedOrNull from "./isUndefinedOrNull";
import Module38 from "./Module38";
import * as _Module662 from "./Module662";
import * as _Module663 from "./Module663";
import * as _getOS from "./getOS";
import { getOS } from "./getOS";
let c487_4 = {};
let c487_5 = {};
export const encodeProperties = _Module662.encodeProperties;
export const analyticsTrackingStoreMaker = _defaultGetSessionId.analyticsTrackingStoreMaker;
export const AnalyticsActionHandlers = _defaultGetSessionId.AnalyticsActionHandlers;
export const ImpressionTypes = _Module657.ImpressionTypes;
export const ImpressionGroups = _Module657.ImpressionGroups;
export const ImpressionNames = _Module663.ImpressionNames;
export const NetworkActionNames = _Module663.NetworkActionNames;
export const getSuperProperties = _getOS.getSuperProperties;
export const getSuperPropertiesBase64 = _getOS.getSuperPropertiesBase64;
export const extendSuperProperties = _getOS.extendSuperProperties;
exports.getOS = getOS;
export const getDevice = _getOS.getDevice;
export const getCampaignParams = _getOS.getCampaignParams;
export function isThrottled(a0) {
return c487_4[a0] != null && c487_4[a0] > Date.now();
}
export const trackMaker = ({ addBreadcrumb, analyticEventConfigs, dispatcher, TRACK_ACTION_NAME }) => {
let c12342_2 = queueTrackingEventMaker(dispatcher, TRACK_ACTION_NAME);
return function track(a0, a1, r9 = {}) {
if (global.isServerRendering != null && global.isServerRendering === true) {
return Promise.resolve();
}
const r14 = a1 == null ? {} : a1;
const r24 = analyticEventConfigs[a0];
let r10 = r24;
if (typeof r10 === "function") {
let r25 = r24(r14);
if (r25 == null) {
r25 = null;
}
r10 = r25;
}
if (r10 != null) {
if ("throttlePeriod" in r10) {
const r51 = [a0, ...r10.throttleKeys(r14)].join("_");
if (c487_4[r51] != null && c487_4[r51] > Date.now()) {
return Promise.resolve();
}
if (typeof r10.throttlePercent === "number" && Math.random() > r10.throttlePercent) {
return Promise.resolve();
}
if (r10.deduplicate) {
if (isUndefinedOrNull(c487_5[r51], r14)) {
return Promise.resolve();
}
c487_5[r51] = r14;
}
c487_4[r51] = Date.now() + r10.throttlePeriod;
} else if ("throttlePercent" in r10) {
if (Math.random() > r10.throttlePercent) {
return Promise.resolve();
}
} else {
Module38(false, `Unsupported analytics event config: ${r10}`);
}
}
if (addBreadcrumb != null) {
addBreadcrumb(a0);
}
return c12342_2(a0, a1, r9);
};
};