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

98 lines
4 KiB
TypeScript
Raw Normal View History

// Module ID: 17470
// Function ID: 17471
2026-07-29 08:29:29 +00:00
// Name: isChannelEligible
// Dependencies: [7659, 1957, 4781, 2011, 8078, 1373, 17471, 1094, 1935, 10749, 8773, 1250, 4447, 9853, 2]
2026-07-20 16:05:17 +00:00
// Module 17470 (isChannelEligible)
import set2 from "set" /* 1094 */;
import fetchUserAffinitiesV2 from "fetchUserAffinitiesV2" /* 9853 */;
import onPostConnectionOpenDefault from "onPostConnectionOpen" /* 17471 */;
import closure_2 from "recomputeAffinities" /* 7659 */;
import closure_3 from "ensureGuildLoaded" /* 1957 */;
import closure_4 from "reinjectEphemerals" /* 4781 */;
import closure_5 from "handleConnectionOpen" /* 2011 */;
import closure_6 from "getCurrentTime" /* 8078 */;
import GuildFeatures from "GuildFeatures" /* 1373 */;
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;
const EnableFriendAnniversaryNotifications = _require(1935).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)) {
let tmpResult = tmp(10749);
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);
tmpResult = tmp(8773);
2026-07-29 08:29:29 +00:00
let obj = { name: null, type: null, properties: null };
obj[0] = tmp(1250).ImpressionNames.GIFT_INTENT_UNREAD_NOTIFICATION;
obj[1] = tmp(1250).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;