decord/source/modules/premium/gifting/native/MobileGiftIntentCardManager.tsx
github-actions a36fe4ec9c chore: update source for alpha 347.0
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-14 20:04:03 +00:00

93 lines
4.1 KiB
TypeScript

// Module ID: 17582
// Function ID: 17583
// Name: MobileGiftIntentCardManager
// Dependencies: [7761, 1957, 4857, 2011, 8183, 1373, 17583, 1094, 1935, 10873, 8894, 1248, 1952, 9978, 2]
// Module 17582 (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" /* 17583 */;
require = fn;
const PremiumConstants = fn(1373);
({ GiftIntentSecondaryAction: closure_7, GiftIntentType: closure_8 } = PremiumConstants);
class MobileGiftIntentCardManager extends tmp3 {
}
const prototype = MobileGiftIntentCardManager.prototype;
prototype["isChannelEligible"] = function isChannelEligible(channel) {
return channel.type === ChannelTypes.ChannelTypes.DM;
};
prototype["maybeSendCard"] = function maybeSendCard(id, found) {
const self = this;
dependencyMap = id;
_require = found;
const EnableFriendAnniversaryNotifications = require("UserSettings").EnableFriendAnniversaryNotifications;
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(10873).logMessageGiftIntentShown(found);
const userAffinity = self.getUserAffinity(found);
const tmpResult = tmp(10873);
const obj = { name: tmp(1248).ImpressionNames.GIFT_INTENT_UNREAD_NOTIFICATION, type: tmp(1248).ImpressionTypes.VIEW, properties: null };
const obj2 = { gift_intent_type: tmp6.FRIEND_ANNIVERSARY, dm_affinity: null, channel_id: null };
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);
}
tmp6 = constants2;
} else {
obj5.whenReady(id, () => {
if (SelectedChannelStore.getChannelId() === closure_1) {
self.maybeSendCard(tmp, closure_0);
}
});
}
obj5 = MessageStore;
}
}
}
};
prototype["sendCardInSelectedChannelIfEligible"] = function sendCardInSelectedChannelIfEligible(channelId) {
const self = this;
const channel = ChannelStore.getChannel(channelId);
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));
if (null != found) {
const delayedCall = new Timers.DelayedCall(1000, () => {
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());
};
const mobileGiftIntentCardManager = new MobileGiftIntentCardManager();
const size = fn(2);
let result = size.fileFinishedImporting("modules/premium/gifting/native/MobileGiftIntentCardManager.tsx");
export default mobileGiftIntentCardManager;