Files
discord-decomp/sources/modules/user_profile/UserProfileAnalyticsContext.tsx
T
2026-07-27 16:20:00 +03:00

196 lines
9.8 KiB
TypeScript

/* Metro module 8514; source: modules/user_profile/UserProfileAnalyticsContext.tsx; dependencies: [31, 33, 6771, 8515, 491, 2] */
function _fun67474(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#67474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:6, offset: 0x01c24aa6, size: 185 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(33) /* metro dependency 33 */).jsx;
const env0_5 = value.createContext(null);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_profile/UserProfileAnalyticsContext.tsx');
exports.UserProfileAnalyticsProvider = UserProfileAnalyticsProvider;
exports.useCreateUserProfileAnalyticsContext = useCreateUserProfileAnalyticsContext;
exports.useUserProfileAnalyticsContext = useUserProfileAnalyticsContext;
}
function UserProfileAnalyticsProvider({value, children, openedAt, fetchStartedAt, fetchEndedAt, isLoaded}) { // fn#67475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:261, offset: 0x01c24b5f, size: 230 bytes, params: 2, frame: 18
isLoaded = !(isLoaded === undefined) && isLoaded;
const env0_3 = isLoaded;
const analyticsLocations = (importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */)().analyticsLocations;
const binding = env0_3;
const env0_4 = binding.useRef(undefined);
const object2 = {analyticsLocations: analyticsLocations, value: value};
const env0_5 = object2;
const env0_6 = binding.useRef(object2);
binding.useEffect(_fun67476);
binding.useEffect(_fun67477, [isLoaded]);
const Provider = env0_5.Provider;
return (
<Provider value={value}>
{children}
</Provider>
);
}
function useCreateUserProfileAnalyticsContext({layout, userId, guildId, channelId, messageId, roleId, sourceSessionId, showGuildProfile}) { // fn#67478, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1002, offset: 0x01c24d8f, size: 200 bytes, params: 2, frame: 23
const env0_3 = channelId;
const env0_5 = roleId;
showGuildProfile = showGuildProfile === undefined || showGuildProfile;
return env0_3.useMemo(_fun67479, [env0_3.useContext(env0_5)?.sessionId, layout, userId, guildId, channelId,
messageId, roleId, sourceSessionId, showGuildProfile]);
}
function useUserProfileAnalyticsContext() { // fn#67480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1375, offset: 0x01c24eda, size: 212 bytes, params: 1, frame: 17
const binding = env0_3;
const value2 = binding.useContext(env0_5);
const analyticsLocations = (importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */)().analyticsLocations;
const object2 = {context: value2};
object2.trackUserProfileAction = binding.useCallback(_fun67481, [value2, analyticsLocations]);
object2.trackUserProfileEditAction = binding.useCallback(_fun67482, [value2, analyticsLocations]);
object2.trackUserProfileEditSaved = binding.useCallback(_fun67483, [value2, analyticsLocations]);
object2.trackUserProfileWishlistAction = binding.useCallback(_fun67484, [value2, analyticsLocations]);
return object2;
}
function _fun67477() { // fn#67477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:497, offset: 0x01c24c5a, size: 309 bytes, params: 1, frame: 22
var r6;
var analyticsLocations;
var value5;
var value6;
var value7;
var moduleValue;
var trackUserProfileAction;
var object2;
var value8;
var moduleValue2;
var maybeTrackUserProfileUiViewed;
const Date = global.Date;
let value = Date.now();
let current = env0_4.current;
if (current == null && openedAt != null) {
env0_4.current = value - openedAt;
}
if (isLoaded) {
current = env0_6.current;
analyticsLocations = current.analyticsLocations;
value5 = current.value;
value6 = environment.__proto__;
value7 = undefined;
moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */;
trackUserProfileAction = moduleValue.trackUserProfileAction;
object2 = {action: 'VIEW', analyticsLocations: analyticsLocations};
value8 = copyDataProperties(object2, value5, 'VIEW');
Reflect.apply(trackUserProfileAction, moduleValue, [object2]);
moduleValue2 = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */;
maybeTrackUserProfileUiViewed = moduleValue2.maybeTrackUserProfileUiViewed;
object2 = {profileUi: 'USER_PROFILE'};
current = env0_4.current;
object2.timeToInteractiveMs = current;
if (openedAt != null) {
value -= openedAt;
r6 = value;
} else {
r6 = value7;
}
object2.timeToLoadMs = r6;
r6 = fetchStartedAt != null && fetchEndedAt != null ? fetchEndedAt - fetchStartedAt : value7;
object2.timeToFetchMs = r6;
object2.viewStartedAt = openedAt;
object2.fetchStartedAt = fetchStartedAt;
object2.analyticsLocations = analyticsLocations;
copyDataProperties(object2, value5, value8);
Reflect.apply(maybeTrackUserProfileUiViewed, moduleValue2, [object2]);
}
}
function _fun67479() { // fn#67479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1180, offset: 0x01c24e57, size: 131 bytes, params: 1, frame: 12
const object2 = {};
const value = environment.__proto__;
object2.sessionId = (require(491) /* metro dependency 491 */).v4();
object2.sourceSessionId = sourceSessionId ?? sessionId;
object2.layout = layout;
object2.userId = userId;
object2.guildId = guildId;
object2.channelId = channelId;
object2.messageId = messageId;
object2.roleId = roleId;
object2.showGuildProfile = showGuildProfile;
return object2;
}
function _fun67481(a0) { // fn#67481, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1488, offset: 0x01c24fae, size: 85 bytes, params: 2, frame: 14
var value2;
var moduleValue;
var trackUserProfileAction;
var object2;
var analyticsLocationsBinding;
if (env0_0 != null) {
value2 = environment.__proto__;
moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */;
trackUserProfileAction = moduleValue.trackUserProfileAction;
object2 = {};
analyticsLocationsBinding = analyticsLocations;
object2.analyticsLocations = analyticsLocationsBinding;
copyDataProperties(object2, env0_0, analyticsLocationsBinding);
copyDataProperties(object2, a0, analyticsLocationsBinding);
Reflect.apply(trackUserProfileAction, moduleValue, [object2]);
}
}
function _fun67482(a0) { // fn#67482, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1617, offset: 0x01c25003, size: 85 bytes, params: 2, frame: 14
var value2;
var moduleValue;
var trackUserProfileEditAction;
var object2;
var analyticsLocationsBinding;
if (env0_0 != null) {
value2 = environment.__proto__;
moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */;
trackUserProfileEditAction = moduleValue.trackUserProfileEditAction;
object2 = {};
analyticsLocationsBinding = analyticsLocations;
object2.analyticsLocations = analyticsLocationsBinding;
copyDataProperties(object2, env0_0, analyticsLocationsBinding);
copyDataProperties(object2, a0, analyticsLocationsBinding);
Reflect.apply(trackUserProfileEditAction, moduleValue, [object2]);
}
}
function _fun67483(a0) { // fn#67483, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1749, offset: 0x01c25058, size: 85 bytes, params: 2, frame: 14
var value2;
var moduleValue;
var trackUserProfileEditSaved;
var object2;
var analyticsLocationsBinding;
if (env0_0 != null) {
value2 = environment.__proto__;
moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */;
trackUserProfileEditSaved = moduleValue.trackUserProfileEditSaved;
object2 = {};
analyticsLocationsBinding = analyticsLocations;
object2.analyticsLocations = analyticsLocationsBinding;
copyDataProperties(object2, env0_0, analyticsLocationsBinding);
copyDataProperties(object2, a0, analyticsLocationsBinding);
Reflect.apply(trackUserProfileEditSaved, moduleValue, [object2]);
}
}
function _fun67484(a0) { // fn#67484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1885, offset: 0x01c250ad, size: 85 bytes, params: 2, frame: 14
var value2;
var moduleValue;
var trackUserProfileWishlistAction;
var object2;
var analyticsLocationsBinding;
if (env0_0 != null) {
value2 = environment.__proto__;
moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */;
trackUserProfileWishlistAction = moduleValue.trackUserProfileWishlistAction;
object2 = {};
analyticsLocationsBinding = analyticsLocations;
object2.analyticsLocations = analyticsLocationsBinding;
copyDataProperties(object2, env0_0, analyticsLocationsBinding);
copyDataProperties(object2, a0, analyticsLocationsBinding);
Reflect.apply(trackUserProfileWishlistAction, moduleValue, [object2]);
}
}