decord/source/modules/feedback/FeedbackManager.tsx

240 lines
8.4 KiB
TypeScript
Raw Normal View History

2026-07-30 10:14:41 +00:00
// Module ID: 16162
// Function ID: 16163
2026-07-29 08:29:29 +00:00
// Name: optOutEligibilityCheck
2026-07-30 10:14:41 +00:00
// Dependencies: [5650, 4261, 16163, 9517, 5649, 3862, 595, 12, 16164, 5134, 2]
2026-07-23 10:11:24 +00:00
2026-07-30 10:14:41 +00:00
// Module 16162 (optOutEligibilityCheck)
2026-07-23 10:11:24 +00:00
import set from "set";
2026-07-29 08:29:29 +00:00
import createRTCConnection from "createRTCConnection";
import initialize from "initialize";
2026-07-23 10:11:24 +00:00
import FeedbackRating from "FeedbackRating";
2026-07-29 08:29:29 +00:00
import "initialize";
2026-07-20 16:05:17 +00:00
let FeedbackGroup;
let FeedbackType;
2026-07-29 08:29:29 +00:00
let c5;
let closure_6;
let require = arg1;
2026-07-20 16:05:17 +00:00
function optOutEligibilityCheck(hotspot) {
2026-07-23 10:11:24 +00:00
const _require = hotspot;
2026-07-29 08:29:29 +00:00
const InAppFeedbackStates = _require(3862).InAppFeedbackStates;
const tmp3 = InAppFeedbackStates.getSetting()[hotspot.feedbackType];
2026-07-20 16:05:17 +00:00
let optOutExpiryTime;
2026-07-29 08:29:29 +00:00
if (tmp3 != null) {
optOutExpiryTime = tmp3.optOutExpiryTime;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp5 = null != optOutExpiryTime;
if (tmp5) {
2026-07-20 16:05:17 +00:00
const _Number = Number;
2026-07-29 08:29:29 +00:00
tmp5 = !Number.isNaN(optOutExpiryTime);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp5) {
2026-07-20 16:05:17 +00:00
const _Date = Date;
2026-07-29 08:29:29 +00:00
tmp5 = Date.now() < optOutExpiryTime;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const hasHotspotResult = set.hasHotspot(hotspot.hotspot);
let tmp10 = tmp9;
if (!hasHotspotResult) {
tmp10 = !tmp5;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp10) {
const InAppFeedbackStates2 = _require(3862).InAppFeedbackStates;
2026-07-20 16:05:17 +00:00
InAppFeedbackStates2.updateSetting((arg0) => {
let obj = {};
const merged = Object.assign(arg0);
obj = {};
2026-07-23 10:11:24 +00:00
const merged1 = Object.assign(arg0[hotspot.feedbackType]);
2026-07-29 08:29:29 +00:00
obj.optOutExpiryTime = outer1_6;
2026-07-23 10:11:24 +00:00
obj[hotspot.feedbackType] = obj;
2026-07-20 16:05:17 +00:00
return obj;
});
}
2026-07-29 08:29:29 +00:00
let tmp12 = !tmp5;
if (!tmp5) {
tmp12 = !tmp9;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp12;
2026-07-20 16:05:17 +00:00
}
function triggerRateEligibilityCheck(chance) {
return Math.random() < chance.chance;
}
2026-07-29 08:29:29 +00:00
function recencyEligibilityCheck(cooldown, storageKey) {
const _require = storageKey;
const InAppFeedbackStates = _require(3862).InAppFeedbackStates;
const tmp3 = InAppFeedbackStates.getSetting()[storageKey.feedbackType];
2026-07-20 16:05:17 +00:00
let lastImpressionTime;
2026-07-29 08:29:29 +00:00
if (tmp3 != null) {
lastImpressionTime = tmp3.lastImpressionTime;
2026-07-20 16:05:17 +00:00
}
let dependencyMap;
2026-07-29 08:29:29 +00:00
let isNaNResult = null != lastImpressionTime;
if (isNaNResult) {
2026-07-20 16:05:17 +00:00
const _Number = Number;
2026-07-29 08:29:29 +00:00
isNaNResult = !Number.isNaN(lastImpressionTime);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!isNaNResult) {
isNaNResult = null == storageKey.storageKey;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp7;
if (!isNaNResult) {
const Storage = tmp(595).Storage;
const value = Storage.get(storageKey.storageKey);
dependencyMap = value;
isNaNResult = null == value;
tmp7 = value;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!isNaNResult) {
const _Number2 = Number;
isNaNResult = Number.isNaN(tmp7);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!isNaNResult) {
const InAppFeedbackStates2 = tmp(3862).InAppFeedbackStates;
InAppFeedbackStates2.updateSetting((arg0) => {
let obj = {};
const merged = Object.assign(arg0);
obj = {};
const merged1 = Object.assign(arg0[storageKey.feedbackType]);
obj.lastImpressionTime = c1;
obj[storageKey.feedbackType] = obj;
return obj;
});
}
const items = [lastImpressionTime, tmp7];
let num = _require(12).max(items);
if (num == null) {
num = 0;
}
const sum = num + cooldown.cooldown;
2026-07-20 16:05:17 +00:00
return sum < Date.now();
}
function groupRecencyEligibilityCheck(cooldown) {
2026-07-23 10:11:24 +00:00
let closure_0 = cooldown;
2026-07-20 16:05:17 +00:00
const values = Object.values(obj);
2026-07-29 08:29:29 +00:00
const found = values.filter((group) => group.group === group.group);
obj = found[Symbol.iterator]();
while (obj !== undefined) {
let tmp3 = recencyEligibilityCheck;
if (recencyEligibilityCheck(cooldown, tmp2)) {
continue;
} else {
let tmp4 = obj;
obj.return();
let flag = false;
return false;
2026-07-20 16:05:17 +00:00
}
}
return true;
}
2026-07-29 08:29:29 +00:00
({ FeedbackGroup, FeedbackType, FeedbackTypePrecedence: c5, MAX_REPRESENTABLE_DATE: closure_6 } = FeedbackRating);
2026-07-23 10:11:24 +00:00
let obj = { chance: 0.2, cooldown: 86400000 };
2026-07-20 16:05:17 +00:00
obj = {};
obj = {};
2026-07-23 10:11:24 +00:00
let merged = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj.group = FeedbackGroup.AV;
obj.hotspot = require("HotspotStore").HotspotLocations.VOICE_CALL_FEEDBACK;
obj.storageKey = "lastVoiceFeedback";
obj.feedbackType = FeedbackType.VOICE;
2026-07-23 10:11:24 +00:00
let items = [
2026-07-20 16:05:17 +00:00
function voiceEligibilityCheck() {
2026-07-29 08:29:29 +00:00
if (wasEverRtcConnected.getWasEverRtcConnected()) {
return obj.getWasEverMultiParticipant();
2026-07-20 16:05:17 +00:00
} else {
return true;
}
2026-07-29 08:29:29 +00:00
obj = wasEverRtcConnected;
2026-07-20 16:05:17 +00:00
}
];
2026-07-29 08:29:29 +00:00
obj.eligibilityChecks = items;
2026-07-20 16:05:17 +00:00
obj[FeedbackType.VOICE] = obj;
const obj1 = {};
2026-07-23 10:11:24 +00:00
let merged1 = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj1.group = FeedbackGroup.AV;
obj1.hotspot = require("HotspotStore").HotspotLocations.REPORT_PROBLEM_POST_STREAM;
obj1.storageKey = "lastStreamFeedback";
obj1.feedbackType = FeedbackType.STREAM;
2026-07-20 16:05:17 +00:00
obj[FeedbackType.STREAM] = obj1;
const obj2 = {};
const merged2 = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj2.group = FeedbackGroup.AV;
obj2.hotspot = require("HotspotStore").HotspotLocations.VIDEO_BACKGROUND_FEEDBACK;
obj2.storageKey = "lastVideoBackgroundFeedback";
obj2.feedbackType = FeedbackType.VIDEO_BACKGROUND;
2026-07-20 16:05:17 +00:00
obj[FeedbackType.VIDEO_BACKGROUND] = obj2;
2026-07-29 08:29:29 +00:00
obj[FeedbackType.ACTIVITY] = { cooldown: 0, chance: 0.5, group: FeedbackGroup.AV, hotspot: require("HotspotStore").HotspotLocations.POST_ACTIVITY_FEEDBACK, storageKey: "lastActivityFeedback", feedbackType: FeedbackType.ACTIVITY };
2026-07-23 10:11:24 +00:00
const obj3 = { cooldown: 0, chance: 0.5, group: FeedbackGroup.AV, hotspot: require("HotspotStore").HotspotLocations.POST_ACTIVITY_FEEDBACK, storageKey: "lastActivityFeedback", feedbackType: FeedbackType.ACTIVITY };
2026-07-29 08:29:29 +00:00
obj[FeedbackType.IN_APP_REPORTS] = { cooldown: 172800000, chance: 0.5, group: FeedbackGroup.SAFETY, hotspot: require("HotspotStore").HotspotLocations.IN_APP_REPORTS_FEEDBACK, storageKey: "inAppReportsFeedback", feedbackType: FeedbackType.IN_APP_REPORTS };
2026-07-20 16:05:17 +00:00
const obj5 = {};
const merged3 = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj5.group = FeedbackGroup.SEARCH;
obj5.hotspot = require("HotspotStore").HotspotLocations.SEARCH_RESULTS_FEEDBACK;
obj5.storageKey = "searchResultsFeedback";
obj5.feedbackType = FeedbackType.SEARCH_RESULTS;
const items1 = [
2026-07-20 16:05:17 +00:00
function searchResultsEligibilityCheck() {
2026-07-30 10:14:41 +00:00
return require(16164) /* useIsSearchResultsFeedbackExperimentEnabled */.getIsSearchResultsFeedbackExperimentEnabled({ location: "FeedbackManager" });
2026-07-20 16:05:17 +00:00
}
];
2026-07-29 08:29:29 +00:00
obj5.eligibilityChecks = items1;
2026-07-20 16:05:17 +00:00
obj[FeedbackType.SEARCH_RESULTS] = obj5;
2026-07-29 08:29:29 +00:00
const obj6 = {};
const merged4 = Object.assign(obj);
obj6.chance = 0;
obj6.group = FeedbackGroup.AV;
obj6.hotspot = require("HotspotStore").HotspotLocations.VOICE_CALL_FEEDBACK;
obj6.storageKey = "lastVibegrationsFeedback";
obj6.feedbackType = FeedbackType.VIBEGRATIONS;
obj[FeedbackType.VIBEGRATIONS] = obj6;
class FeedbackManager extends tmp8 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
applyArgumentsResult.feedbackTypeToShow = null;
obj = require("apply");
applyArgumentsResult.showFeedbackModalDebounced = obj.debounce((arg0, arg1) => {
if (null != feedbackTypeToShow.feedbackTypeToShow) {
feedbackTypeToShow = tmp.feedbackTypeToShow;
const InAppFeedbackStates = applyArgumentsResult(outer1_1[5]).InAppFeedbackStates;
InAppFeedbackStates.updateSetting((arg0) => {
let obj = {};
const merged = Object.assign(arg0);
obj = {};
const merged1 = Object.assign(arg0[feedbackTypeToShow]);
obj.lastImpressionTime = Date.now();
obj[feedbackTypeToShow] = obj;
return obj;
});
tmp.feedbackTypeToShow = null;
arg0();
} else if (arg1 != null) {
arg1();
}
}, 200);
return applyArgumentsResult;
}
}
FeedbackManager.prototype["possiblyShowFeedbackModal"] = function possiblyShowFeedbackModal(ACTIVITY, arg1) {
feedbackConfig = feedbackConfig.getFeedbackConfig(ACTIVITY);
if (feedbackConfig == null) {
feedbackConfig = obj[ACTIVITY];
}
let eligibilityChecks = feedbackConfig.eligibilityChecks;
if (eligibilityChecks == null) {
eligibilityChecks = [];
}
const items = [triggerRateEligibilityCheck, optOutEligibilityCheck, groupRecencyEligibilityCheck];
if (!tmp3) {
if (arg2 != null) {
arg2();
}
} else {
const self = this;
self.feedbackTypeToShow = ACTIVITY;
const result = self.showFeedbackModalDebounced(arg1, arg2);
}
};
const obj4 = { cooldown: 172800000, chance: 0.5, group: FeedbackGroup.SAFETY, hotspot: require("HotspotStore").HotspotLocations.IN_APP_REPORTS_FEEDBACK, storageKey: "inAppReportsFeedback", feedbackType: FeedbackType.IN_APP_REPORTS };
let result = require("initialize").fileFinishedImporting("modules/feedback/FeedbackManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default FeedbackManager;
2026-07-20 16:05:17 +00:00
export const FeedbackConfig = obj;