decord/source/modules/premium/gifting/native/MobileGiftIntentCardManager.tsx

98 lines
4 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 16813
// Function ID: 16814
2026-07-29 08:29:29 +00:00
// Name: isChannelEligible
2026-08-25 06:04:03 +00:00
// Dependencies: [7265, 1391, 4623, 1981, 8331, 1924, 16814, 692, 4070, 7468, 9497, 503, 4264, 9229, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 16813 (isChannelEligible)
2026-08-24 06:08:38 +00:00
import set2 from "set" /* 692 */;
2026-08-25 06:04:03 +00:00
import fetchUserAffinitiesV2 from "fetchUserAffinitiesV2" /* 9229 */;
import onPostConnectionOpenDefault from "onPostConnectionOpen" /* 16814 */;
import closure_2 from "recomputeAffinities" /* 7265 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "reinjectEphemerals" /* 4623 */;
import closure_5 from "handleConnectionOpen" /* 1981 */;
import closure_6 from "getCurrentTime" /* 8331 */;
2026-08-24 06:08:38 +00:00
import GuildFeatures from "GuildFeatures" /* 1924 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
({ GiftIntentSecondaryAction: error, GiftIntentType: closure_8 } = GuildFeatures);
onPostConnectionOpenDefault;
2026-07-29 08:29:29 +00:00
class MobileGiftIntentCardManager extends tmp3 {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = MobileGiftIntentCardManager.prototype;
prototype["isChannelEligible"] = function isChannelEligible(channel) {
2026-08-24 06:08:38 +00:00
return channel.type === set2.ChannelTypes.DM;
2026-07-29 08:29:29 +00:00
};
prototype["maybeSendCard"] = function maybeSendCard(id, closure_0) {
let self = this;
self = this;
2026-08-24 06:08:38 +00:00
dependencyMap = id;
2026-07-29 08:29:29 +00:00
const _require = closure_0;
2026-08-25 06:04:03 +00:00
const EnableFriendAnniversaryNotifications = _require(4070).EnableFriendAnniversaryNotifications;
2026-07-29 08:29:29 +00:00
if (EnableFriendAnniversaryNotifications.getSetting()) {
2026-08-24 06:08:38 +00:00
if (!closure_6.isGiftIntentMessageInCooldown(closure_0)) {
2026-07-29 08:29:29 +00:00
if (id === store.getChannelId()) {
if (ready.isReady(id)) {
2026-08-13 07:00:46 +00:00
if (self.trySendGiftingPromptSystemMessage(id, constants2.FRIEND_ANNIVERSARY, closure_0, constants.SEND_MESSAGE)) {
2026-08-25 06:04:03 +00:00
let tmpResult = tmp(7468);
2026-07-29 08:29:29 +00:00
const result = tmpResult.logMessageGiftIntentShown(closure_0);
2026-08-24 06:08:38 +00:00
const userAffinity = self.getUserAffinity(closure_0);
2026-08-25 06:04:03 +00:00
tmpResult = tmp(9497);
2026-07-29 08:29:29 +00:00
let obj = { name: null, type: null, properties: null };
2026-08-24 06:08:38 +00:00
obj[0] = tmp(503).ImpressionNames.GIFT_INTENT_UNREAD_NOTIFICATION;
obj[1] = tmp(503).ImpressionTypes.VIEW;
2026-07-29 08:29:29 +00:00
obj = { gift_intent_type: null, dm_affinity: null, channel_id: null };
obj[0] = tmp6.FRIEND_ANNIVERSARY;
let dmProbability;
if (userAffinity != null) {
dmProbability = userAffinity.dmProbability;
}
obj[1] = dmProbability;
obj[2] = id;
obj[2] = obj;
tmpResult.trackImpression(obj);
}
tmp6 = constants2;
} else {
obj5.whenReady(id, () => {
2026-08-24 06:08:38 +00:00
if (closure_1_5.getChannelId() === closure_1) {
2026-07-29 08:29:29 +00:00
self.maybeSendCard(tmp, closure_0);
}
});
}
obj5 = ready;
}
}
}
};
prototype["sendCardInSelectedChannelIfEligible"] = function sendCardInSelectedChannelIfEligible(channelId) {
let self = this;
self = this;
2026-08-24 06:08:38 +00:00
const channel = self.getChannel(channelId);
2026-07-29 08:29:29 +00:00
if (null != channel) {
if (self.isChannelEligible(channel)) {
const _Set = Set;
const set = new Set(channel.recipients);
2026-08-24 06:08:38 +00:00
const friendAnniversaries = closure_6.getFriendAnniversaries();
2026-07-29 08:29:29 +00:00
const found = friendAnniversaries.find((arg0) => set.has(arg0));
if (null != found) {
2026-08-24 06:08:38 +00:00
const delayedCall = new found(channel[12]).DelayedCall(1000, () => {
2026-07-29 08:29:29 +00:00
self.maybeSendCard(channel.id, found);
});
delayedCall.delay();
}
}
}
};
prototype["onChannelSelect"] = function onChannelSelect(channelId) {
const result = this.sendCardInSelectedChannelIfEligible(channelId.channelId);
};
prototype["sendGiftingPromptSystemMessagesIfEligible"] = function sendGiftingPromptSystemMessagesIfEligible() {
2026-08-24 06:08:38 +00:00
const userAffinitiesV2 = fetchUserAffinitiesV2.fetchUserAffinitiesV2();
const result = this.sendCardInSelectedChannelIfEligible(store.getChannelId());
2026-07-29 08:29:29 +00:00
};
const mobileGiftIntentCardManager = new MobileGiftIntentCardManager();
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/premium/gifting/native/MobileGiftIntentCardManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default mobileGiftIntentCardManager;