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

94 lines
4.1 KiB
TypeScript
Raw Normal View History

// Module ID: 17581
// Function ID: 17582
// Name: MobileGiftIntentCardManager
// Dependencies: [7761, 1957, 4857, 2011, 8183, 1373, 17582, 1094, 1935, 10872, 8894, 1250, 1952, 9978, 2]
2026-07-20 16:05:17 +00:00
// Module 17581 (MobileGiftIntentCardManager)
import ChannelTypes from "ChannelTypes" /* 1094 */;
import Timers from "Timers" /* 1952 */;
import UserAffinitiesActionCreators from "UserAffinitiesActionCreators" /* 9978 */;
import UserAffinitiesV2Store from "UserAffinitiesV2Store" /* 7761 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import MessageStore from "MessageStore" /* 4857 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import PremiumGiftingIntentStore from "PremiumGiftingIntentStore" /* 8183 */;
import GiftIntentReconcilingManager from "GiftIntentReconcilingManager" /* 17582 */;
2026-07-23 10:11:24 +00:00
require = fn;
const PremiumConstants = fn(1373);
({ GiftIntentSecondaryAction: closure_7, GiftIntentType: closure_8 } = PremiumConstants);
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) {
return channel.type === ChannelTypes.ChannelTypes.DM;
2026-07-29 08:29:29 +00:00
};
prototype["maybeSendCard"] = function maybeSendCard(id, found) {
const self = this;
2026-08-24 06:08:38 +00:00
dependencyMap = id;
_require = found;
const EnableFriendAnniversaryNotifications = require("UserSettings").EnableFriendAnniversaryNotifications;
2026-07-29 08:29:29 +00:00
if (EnableFriendAnniversaryNotifications.getSetting()) {
if (!PremiumGiftingIntentStore.isGiftIntentMessageInCooldown(found)) {
if (id === SelectedChannelStore.getChannelId()) {
if (MessageStore.isReady(id)) {
if (self.trySendGiftingPromptSystemMessage(id, constants2.FRIEND_ANNIVERSARY, found, constants.SEND_MESSAGE)) {
const result = tmp(10872).logMessageGiftIntentShown(found);
const userAffinity = self.getUserAffinity(found);
const tmpResult = tmp(10872);
const obj = { name: tmp(1250).ImpressionNames.GIFT_INTENT_UNREAD_NOTIFICATION, type: tmp(1250).ImpressionTypes.VIEW, properties: null };
const obj2 = { gift_intent_type: tmp6.FRIEND_ANNIVERSARY, dm_affinity: null, channel_id: null };
2026-07-29 08:29:29 +00:00
let dmProbability;
if (userAffinity != null) {
dmProbability = userAffinity.dmProbability;
}
obj2.dm_affinity = dmProbability;
obj2.channel_id = id;
obj.properties = obj2;
tmp(8894).trackImpression(obj);
const tmpResult2 = tmp(8894);
2026-07-29 08:29:29 +00:00
}
tmp6 = constants2;
} else {
obj5.whenReady(id, () => {
if (SelectedChannelStore.getChannelId() === closure_1) {
2026-07-29 08:29:29 +00:00
self.maybeSendCard(tmp, closure_0);
}
});
}
obj5 = MessageStore;
2026-07-29 08:29:29 +00:00
}
}
}
};
prototype["sendCardInSelectedChannelIfEligible"] = function sendCardInSelectedChannelIfEligible(channelId) {
const self = this;
const channel = ChannelStore.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);
const friendAnniversaries = PremiumGiftingIntentStore.getFriendAnniversaries();
const found = friendAnniversaries.find((item) => set.has(item));
2026-07-29 08:29:29 +00:00
if (null != found) {
const delayedCall = new Timers.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() {
const userAffinitiesV2 = UserAffinitiesActionCreators.fetchUserAffinitiesV2();
const result = this.sendCardInSelectedChannelIfEligible(SelectedChannelStore.getChannelId());
2026-07-29 08:29:29 +00:00
};
const mobileGiftIntentCardManager = new MobileGiftIntentCardManager();
const size = fn(2);
let result = size.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;