Files
discord-decomp/modules/applications/message_embed/web/appMessageEmbedTracking.tsx
T
2026-11-01 12:12:55 +02:00

80 lines
2.3 KiB
TypeScript

// Metro module 5978 (f5979).
import { useRef } from "react";
import { AnalyticEvents } from "../../../../Constants";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { trackingConfigWithDefaults } from "./appMessageEmbedTrackingConfig";
import { useIsVisible } from "../../../../_bundle/Module5980";
const r18 = {
VIEW: "view",
PLAY: "play",
CLOUD_PLAY: "cloud_play",
JOIN: "join",
ADD_APP: "add_app",
JOIN_SERVER: "join_server",
INVITE: "invite",
SYNC: "sync",
CONTENT: "content",
BANNER: "banner",
STREAM: "stream",
CONNECT_ACCOUNT: "connect_account"
};
export { r18 as ClickArea };
export function trackAppEmbedClick(a0) {
const { applicationId, linkType, area } = a0;
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_CLICKED, {
application_id: applicationId,
link_type: linkType,
area,
referrer_id: a0.referrerId,
custom_id: a0.customId,
is_dead_end: a0.isDeadEnd,
message_id: a0.messageId
});
}
export function trackAppEmbedViewed(a0) {
const { appId, linkType, referrerId, customId } = a0;
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_VIEWED, {
application_id: appId,
link_type: linkType,
referrer_id: referrerId,
custom_id: customId,
guild_id: a0.guildId,
channel_id: a0.channelId,
message_id: a0.messageId,
app_embed_state: a0.appEmbedState
});
}
export function useTrackAppEmbedViewed(a0) {
let c15339_0 = trackingConfigWithDefaults(a0);
const ref = useRef(false);
return useIsVisible((a0) => {
const current = ref.current;
if (current ? !current : a0) {
ref.current = true;
const onView = c15339_0.onView;
if (onView != null) {
onView.call(c15339_0);
}
const { id, linkType, referrerId, activityCustomId } = c15339_0;
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_VIEWED, {
application_id: id,
link_type: linkType,
referrer_id: referrerId,
custom_id: activityCustomId,
guild_id: c15339_0.guildId,
channel_id: c15339_0.channelId,
message_id: c15339_0.messageId,
app_embed_state: c15339_0.appEmbedState
});
}
}, void 0);
}
export function trackAppEmbedLinkSent(a0, a1, a2, a3) {
AnalyticsUtils.track(AnalyticEvents.APP_EMBED_LINK_SENT, {
application_id: a0,
link_type: a1,
referrer_id: a2,
custom_id: a3
});
}