decord/source/modules/user_profile/UserProfileAnalyticsContext.tsx

173 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 8711
// Function ID: 8712
2026-07-20 16:05:17 +00:00
// Name: UserProfileAnalyticsProvider
2026-08-06 08:05:19 +00:00
// Dependencies: [19, 21, 5649, 8712, 514, 2]
2026-07-20 16:05:17 +00:00
// Exports: UserProfileAnalyticsProvider, useCreateUserProfileAnalyticsContext, useUserProfileAnalyticsContext
2026-08-06 08:05:19 +00:00
// Module 8711 (UserProfileAnalyticsProvider)
2026-07-29 08:29:29 +00:00
import importAllResult from "noop";
2026-07-23 10:11:24 +00:00
import { jsx } from "jsxProd";
const require = arg1;
2026-07-29 08:29:29 +00:00
let c3 = importAllResult;
2026-07-23 10:11:24 +00:00
let context = importAllResult.createContext(null);
2026-07-29 08:29:29 +00:00
let result = require("context").fileFinishedImporting("modules/user_profile/UserProfileAnalyticsContext.tsx");
2026-07-20 16:05:17 +00:00
export const UserProfileAnalyticsProvider = (children) => {
2026-07-23 10:11:24 +00:00
let dependencyMap;
let importDefault;
2026-07-20 16:05:17 +00:00
let isLoaded;
let openedAt;
let value;
({ value, openedAt } = children);
2026-07-23 10:11:24 +00:00
({ fetchStartedAt: importDefault, fetchEndedAt: dependencyMap, isLoaded } = children);
2026-07-20 16:05:17 +00:00
if (isLoaded === undefined) {
isLoaded = false;
}
2026-07-23 10:11:24 +00:00
let ref;
let obj;
2026-07-20 16:05:17 +00:00
let closure_6;
2026-07-29 08:29:29 +00:00
obj = isLoaded;
2026-07-23 10:11:24 +00:00
ref = isLoaded.useRef(undefined);
2026-07-20 16:05:17 +00:00
const ref1 = isLoaded.useRef(openedAt);
if (ref1.current !== openedAt) {
ref1.current = openedAt;
ref.current = undefined;
}
2026-08-06 08:05:19 +00:00
obj = { analyticsLocations: importDefault(5649)().analyticsLocations, value };
2026-07-29 08:29:29 +00:00
closure_6 = obj.useRef(obj);
const effect = obj.useEffect(() => {
2026-07-20 16:05:17 +00:00
closure_6.current = obj;
});
const items = [isLoaded];
2026-07-29 08:29:29 +00:00
const effect1 = obj.useEffect(() => {
2026-07-20 16:05:17 +00:00
let analyticsLocations;
let value;
const timestamp = Date.now();
2026-07-29 08:29:29 +00:00
let tmp3 = null == ref.current;
if (tmp3) {
tmp3 = null != openedAt;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp3) {
tmp2.current = timestamp - openedAt;
2026-07-20 16:05:17 +00:00
}
if (isLoaded) {
({ analyticsLocations, value } = ref.current);
2026-07-23 10:11:24 +00:00
let obj = openedAt(outer1_2[3]);
2026-07-29 08:29:29 +00:00
obj = { action: "VIEW", analyticsLocations: null };
obj[1] = analyticsLocations;
2026-07-20 16:05:17 +00:00
const merged = Object.assign(value);
const result = obj.trackUserProfileAction(obj);
2026-07-29 08:29:29 +00:00
obj = { profileUi: "USER_PROFILE", timeToInteractiveMs: null, timeToLoadMs: null, timeToFetchMs: null, viewStartedAt: null, fetchStartedAt: null, analyticsLocations: null };
obj[1] = tmp2.current;
2026-07-20 16:05:17 +00:00
let diff;
if (null != openedAt) {
2026-07-29 08:29:29 +00:00
diff = timestamp - tmp13;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = diff;
2026-07-20 16:05:17 +00:00
let diff1;
if (null != closure_1) {
if (null != closure_2) {
2026-07-29 08:29:29 +00:00
diff1 = closure_2 - tmp15;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
obj[3] = diff1;
obj[4] = openedAt;
obj[5] = closure_1;
obj[6] = analyticsLocations;
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(value);
2026-07-23 10:11:24 +00:00
const result1 = openedAt(outer1_2[3]).maybeTrackUserProfileUiViewed(obj);
const obj3 = openedAt(outer1_2[3]);
2026-07-20 16:05:17 +00:00
}
}, items);
2026-07-23 10:11:24 +00:00
return ref(obj.Provider, { value, children: children.children });
2026-07-20 16:05:17 +00:00
};
export const useCreateUserProfileAnalyticsContext = function useCreateUserProfileAnalyticsContext(layout) {
layout = layout.layout;
const userId = layout.userId;
const guildId = layout.guildId;
const channelId = layout.channelId;
const messageId = layout.messageId;
const roleId = layout.roleId;
const sourceSessionId = layout.sourceSessionId;
let flag = layout.showGuildProfile;
if (flag === undefined) {
flag = true;
}
let sessionId;
2026-07-23 10:11:24 +00:00
const context = channelId.useContext(roleId);
2026-07-20 16:05:17 +00:00
sessionId = undefined;
2026-07-29 08:29:29 +00:00
if (context != null) {
2026-07-20 16:05:17 +00:00
sessionId = context.sessionId;
}
const items = [sessionId, layout, userId, guildId, channelId, messageId, roleId, sourceSessionId, flag];
return channelId.useMemo(() => {
2026-07-29 08:29:29 +00:00
const obj = { sessionId: null, sourceSessionId: null, layout: null, userId: null, guildId: null, channelId: null, messageId: null, roleId: null, showGuildProfile: null };
obj[0] = layout(guildId[4]).v4();
let tmp = sourceSessionId;
if (sourceSessionId == null) {
tmp = sessionId;
}
obj[1] = tmp;
obj[2] = layout;
obj[3] = userId;
obj[4] = guildId;
obj[5] = channelId;
obj[6] = messageId;
obj[7] = roleId;
obj[8] = flag;
2026-07-20 16:05:17 +00:00
return obj;
}, items);
};
export const useUserProfileAnalyticsContext = function useUserProfileAnalyticsContext() {
const context = importAllResult.useContext(closure_5);
2026-08-06 08:05:19 +00:00
analyticsLocations = analyticsLocations(5649)().analyticsLocations;
2026-07-20 16:05:17 +00:00
const items = [context, analyticsLocations];
const items1 = [context, analyticsLocations];
const items2 = [context, analyticsLocations];
const items3 = [context, analyticsLocations];
return {
context,
trackUserProfileAction: importAllResult.useCallback((arg0) => {
if (null != context) {
2026-07-23 10:11:24 +00:00
let obj = context(outer1_2[3]);
2026-07-29 08:29:29 +00:00
obj = { analyticsLocations: null };
obj[0] = analyticsLocations;
const merged = Object.assign(tmp);
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(arg0);
const result = obj.trackUserProfileAction(obj);
}
}, items),
trackUserProfileEditAction: importAllResult.useCallback((arg0) => {
if (null != context) {
2026-07-23 10:11:24 +00:00
let obj = context(outer1_2[3]);
2026-07-29 08:29:29 +00:00
obj = { analyticsLocations: null };
obj[0] = analyticsLocations;
const merged = Object.assign(tmp);
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(arg0);
const result = obj.trackUserProfileEditAction(obj);
}
}, items1),
trackUserProfileEditSaved: importAllResult.useCallback((arg0) => {
if (null != context) {
2026-07-23 10:11:24 +00:00
let obj = context(outer1_2[3]);
2026-07-29 08:29:29 +00:00
obj = { analyticsLocations: null };
obj[0] = analyticsLocations;
const merged = Object.assign(tmp);
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(arg0);
const result = obj.trackUserProfileEditSaved(obj);
}
}, items2),
trackUserProfileWishlistAction: importAllResult.useCallback((arg0) => {
if (null != context) {
2026-07-23 10:11:24 +00:00
let obj = context(outer1_2[3]);
2026-07-29 08:29:29 +00:00
obj = { analyticsLocations: null };
obj[0] = analyticsLocations;
const merged = Object.assign(tmp);
2026-07-20 16:05:17 +00:00
const merged1 = Object.assign(arg0);
const result = obj.trackUserProfileWishlistAction(obj);
}
}, items3)
};
};