Files
2026-07-28 01:06:53 +03:00

453 lines
22 KiB
TypeScript

/* Metro module 15711; source: modules/feedback/FeedbackManager.tsx; dependencies: [6, 7, 15, 17, 18, 6825, 4294, 15712, 9906, 6824, 3829, 587, 22, 15713, 4860, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import RTCConnectionStore from '../../stores/RTCConnectionStore.tsx'; /* Metro dependency 4294 */
import HotspotStore from '../hotspot/HotspotStore.tsx'; /* Metro dependency 6825 */
import FeedbackOverrideStore from './FeedbackOverrideStore.tsx'; /* Metro dependency 15712 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as Module00022Module from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import * as UserSettingsModule from '../user_settings/UserSettings.tsx'; /* Metro dependency 3829 */
import * as HotspotModule from '../hotspot/index.tsx'; /* Metro dependency 6824 */
import * as ConstantsModule from './Constants.tsx'; /* Metro dependency 9906 */
import * as SearchResultsFeedbackExperimentModule from '../search/experiments/SearchResultsFeedbackExperiment.tsx'; /* Metro dependency 15713 */
function _fun120555(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:6, offset: 0x0252faa1, size: 933 bytes, params: 8, frame: 29
const env0_0 = require;
const _arrayLikeToArray_120561 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const triggerRateEligibilityCheck = function(a0) {
var Math = global.Math;
return Math.random() < a0.chance;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const FeedbackGroup = value.FeedbackGroup;
const FeedbackType = value.FeedbackType;
const env0_10 = value.FeedbackTypePrecedence;
const env0_11 = value.MAX_REPRESENTABLE_DATE;
object = {'chance': 0.2, 'cooldown': 86400000};
const object2 = {};
const VOICE = FeedbackType.VOICE;
const object3 = {};
copyDataProperties(object3, object, undefined);
let AV = FeedbackGroup.AV;
object3['group'] = AV;
const HotspotLocations = (HotspotModule).HotspotLocations;
const VOICE_CALL_FEEDBACK = HotspotLocations.VOICE_CALL_FEEDBACK;
object3['hotspot'] = VOICE_CALL_FEEDBACK;
object3['storageKey'] = 'lastVoiceFeedback';
const VOICE2 = FeedbackType.VOICE;
object3['feedbackType'] = VOICE2;
object3['eligibilityChecks'] = [function() {
if (RTCConnectionStore.getWasEverRtcConnected()) {
return RTCConnectionStore.getWasEverMultiParticipant();
}
return true;
}];
object2[VOICE] = object3;
const STREAM = FeedbackType.STREAM;
const object4 = {};
copyDataProperties(object4, object, undefined);
AV = FeedbackGroup.AV;
object4['group'] = AV;
const REPORT_PROBLEM_POST_STREAM = HotspotLocations.REPORT_PROBLEM_POST_STREAM;
object4['hotspot'] = REPORT_PROBLEM_POST_STREAM;
object4['storageKey'] = 'lastStreamFeedback';
const STREAM2 = FeedbackType.STREAM;
object4['feedbackType'] = STREAM2;
object2[STREAM] = object4;
const VIDEO_BACKGROUND = FeedbackType.VIDEO_BACKGROUND;
const object5 = {};
copyDataProperties(object5, object, undefined);
AV = FeedbackGroup.AV;
object5['group'] = AV;
const VIDEO_BACKGROUND_FEEDBACK = HotspotLocations.VIDEO_BACKGROUND_FEEDBACK;
object5['hotspot'] = VIDEO_BACKGROUND_FEEDBACK;
object5['storageKey'] = 'lastVideoBackgroundFeedback';
const VIDEO_BACKGROUND2 = FeedbackType.VIDEO_BACKGROUND;
object5['feedbackType'] = VIDEO_BACKGROUND2;
object2[VIDEO_BACKGROUND] = object5;
const ACTIVITY = FeedbackType.ACTIVITY;
AV = FeedbackGroup.AV;
const POST_ACTIVITY_FEEDBACK = HotspotLocations.POST_ACTIVITY_FEEDBACK;
const ACTIVITY2 = FeedbackType.ACTIVITY;
object2[ACTIVITY] = {'cooldown': 0, 'chance': 0.5, 'group': null, 'hotspot': null,
'storageKey': 'lastActivityFeedback', group: AV, hotspot: POST_ACTIVITY_FEEDBACK, feedbackType: ACTIVITY2};
const IN_APP_REPORTS = FeedbackType.IN_APP_REPORTS;
const SAFETY = FeedbackGroup.SAFETY;
const IN_APP_REPORTS_FEEDBACK = HotspotLocations.IN_APP_REPORTS_FEEDBACK;
const IN_APP_REPORTS2 = FeedbackType.IN_APP_REPORTS;
object2[IN_APP_REPORTS] = {'cooldown': 172800000, 'chance': 0.5, 'group': null, 'hotspot': null,
'storageKey': 'inAppReportsFeedback', group: SAFETY, hotspot: IN_APP_REPORTS_FEEDBACK,
feedbackType: IN_APP_REPORTS2};
const SEARCH_RESULTS = FeedbackType.SEARCH_RESULTS;
const object8 = {};
copyDataProperties(object8, object, undefined);
const SEARCH = FeedbackGroup.SEARCH;
object8['group'] = SEARCH;
const SEARCH_RESULTS_FEEDBACK = HotspotLocations.SEARCH_RESULTS_FEEDBACK;
object8['hotspot'] = SEARCH_RESULTS_FEEDBACK;
object8['storageKey'] = 'searchResultsFeedback';
const SEARCH_RESULTS2 = FeedbackType.SEARCH_RESULTS;
object8['feedbackType'] = SEARCH_RESULTS2;
object8['eligibilityChecks'] = [searchResultsEligibilityCheck];
object2[SEARCH_RESULTS] = object8;
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun120571(value);
(FileImportTrackerModule).fileFinishedImporting('modules/feedback/FeedbackManager.tsx');
exports.default = value;
exports.FeedbackConfig = object2;
function _isNativeReflectConstruct_120556() { // fn#120556, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:280, offset: 0x0252fe46, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_120556_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_120559(a0, a1) { // fn#120559, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:473, offset: 0x0252fea8, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun120560;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_120561(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_120561(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_120561(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun120560;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun120560() { // fn#120560, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:1044, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function optOutEligibilityCheck(a0) { // fn#120562, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:2666, offset: 0x0253001c, size: 218 bytes, params: 2, frame: 17
const env0_0 = a0;
const value2 = undefined;
const InAppFeedbackStates = (UserSettingsModule).InAppFeedbackStates;
const property = InAppFeedbackStates.getSetting()[a0.feedbackType];
const optOutExpiryTime = property == null ? value2 : property.optOutExpiryTime;
const r2 = optOutExpiryTime != null && !global.Number.isNaN(optOutExpiryTime) && global.Date.now() < optOutExpiryTime;
const hotspotStoreBinding = HotspotStore;
const hasHotspot2 = hotspotStoreBinding.hasHotspot(a0.hotspot);
const value7 = !hasHotspot2;
if (hasHotspot2 ? value7 : !r2) {
InAppFeedbackStates.updateSetting(_fun120563);
}
return !r2 && !value7;
function _fun120563(a0) { // fn#120563, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:2932, offset: 0x025300f6, size: 70 bytes, params: 2, frame: 14
const object = {};
copyDataProperties(object, a0, a0);
const binding = env0_0;
const feedbackType = binding.feedbackType;
const object2 = {};
copyDataProperties(object2, a0[binding.feedbackType], a0);
object2['optOutExpiryTime'] = MAX_REPRESENTABLE_DATE;
object[feedbackType] = object2;
return object;
}
}
function recencyEligibilityCheck({cooldown}, a1) { // fn#120565, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3082, offset: 0x0253015d, size: 355 bytes, params: 3, frame: 19
var r2;
var r4;
var Storage;
const env0_0 = a1;
const InAppFeedbackStates = (UserSettingsModule).InAppFeedbackStates;
const lastImpressionTime = InAppFeedbackStates.getSetting()[a1.feedbackType]?.lastImpressionTime;
let r7 = lastImpressionTime != null && !global.Number.isNaN(lastImpressionTime);
r7 = !r7 ? a1.storageKey == null : r7;
if (r7) {
r4 = undefined;
} else {
Storage = (require(587) /* metro dependency 587: Storage */).Storage;
r2 = Storage.get(a1.storageKey) ?? undefined;
if (r2 == null || global.Number.isNaN(r2)) {
r4 = r2;
} else {
InAppFeedbackStates.updateSetting(_fun120566);
r4 = r2;
}
}
let value = Module00022Module;
value = value.max([lastImpressionTime, r4]);
value = (value ?? 0) + cooldown;
const Date = global.Date;
return value < Date.now();
function _fun120566(a0) { // fn#120566, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3414, offset: 0x025302c0, size: 67 bytes, params: 2, frame: 15
const object = {};
copyDataProperties(object, a0, a0);
const feedbackType = require.feedbackType;
const object2 = {};
copyDataProperties(object2, a0[require.feedbackType], a0);
object2['lastImpressionTime'] = env0_1;
object[feedbackType] = object2;
return object;
}
}
function groupRecencyEligibilityCheck(a0) { // fn#120567, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3555, offset: 0x02530303, size: 115 bytes, params: 2, frame: 16
var value6;
var value7;
const env0_0 = a0;
const _createForOfIteratorHelperLoose_120559Binding = _createForOfIteratorHelperLoose_120559;
const Object = global.Object;
const value4 = _createForOfIteratorHelperLoose_120559Binding(Object.values(env0_12).filter(_fun120568));
const value5 = value4();
let done = value5.done;
if (done) {
return true;
}
let r1 = value5;
loopExit1: while (true) {
value6 = r1.value;
if (recencyEligibilityCheck(a0, value6)) {
value7 = value4();
done = value7.done;
if (done) {
return true;
}
r1 = value7;
continue;
}
break loopExit1;
}
return false;
function _fun120568({group}) { // fn#120568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3665, offset: 0x02530376, size: 28 bytes, params: 2, frame: 2
return group === env0_0.group;
}
}
function searchResultsEligibilityCheck() { // fn#120570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:2529, offset: 0x025303bc, size: 56 bytes, params: 1, frame: 12
const getIsSearchResultsFeedbackExperimentEnabled = SearchResultsFeedbackExperimentModule.getIsSearchResultsFeedbackExperimentEnabled;
return !!Reflect.apply(getIsSearchResultsFeedbackExperimentEnabled, SearchResultsFeedbackExperimentModule, [{location: 'FeedbackManager'}]);
}
function _fun120571(a0) { // fn#120571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3780, offset: 0x025303f4, size: 72 bytes, params: 2, frame: 15
const FeedbackManager_1205722 = FeedbackManager_120572;
Inherits(FeedbackManager_1205722, a0);
return CreateClass(FeedbackManager_1205722, [{key: 'possiblyShowFeedbackModal', value: value_120576}]);
function FeedbackManager_120572(a0) { // fn#120572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:3792, offset: 0x0253043c, size: 188 bytes, params: 2, frame: 21
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_2;
binding(this, FeedbackManager_120572);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_5(FeedbackManager_120572);
binding = env1_4;
if (_isNativeReflectConstruct_120556()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_5(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
value.feedbackTypeToShow = null;
value.showFeedbackModalDebounced = (require(22) /* metro dependency 22 */).debounce(_fun120573, 200);
return value;
function _fun120573(a0, a1) { // fn#120573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4098, offset: 0x025304f8, size: 77 bytes, params: 3, frame: 13
var binding;
if (env0_0.feedbackTypeToShow != null) {
binding = env0_0;
((a0) => {
var env0_0 = a0;
var InAppFeedbackStates = (require(3829) /* metro dependency 3829: UserSettings */).InAppFeedbackStates;
InAppFeedbackStates.updateSetting(_fun120575);
})(binding.feedbackTypeToShow);
binding.feedbackTypeToShow = null;
a0();
} else if (a1 != null) {
a1();
}
function updateLastFeedbackDate(a0) { // fn#120574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4135, offset: 0x02530545, size: 60 bytes, params: 2, frame: 12
const env0_0 = a0;
const InAppFeedbackStates = (UserSettingsModule).InAppFeedbackStates;
InAppFeedbackStates.updateSetting(_fun120575);
function _fun120575(a0) { // fn#120575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4215, offset: 0x02530581, size: 68 bytes, params: 2, frame: 14
const object = {};
copyDataProperties(object, a0, undefined);
const binding = env0_0;
const object2 = {};
copyDataProperties(object2, a0[binding], undefined);
const Date = global.Date;
object2['lastImpressionTime'] = Date.now();
object[binding] = object2;
return object;
}
}
}
}
function value_120576(a0, a1, a2) { // fn#120576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4435, offset: 0x025305c5, size: 100 bytes, params: 4, frame: 15
var environment;
var value;
if (feedbackTypeIsEligibleToBeShown(a0)) {
if (this.feedbackTypeToShow == null) {
this.feedbackTypeToShow = a0;
this.showFeedbackModalDebounced(a1, a2);
} else {
value = environment.__proto__;
if (FeedbackTypePrecedence[this.feedbackTypeToShow] < FeedbackTypePrecedence[a0]) {
if (a2 != null) {
a2();
}
} else {
this.feedbackTypeToShow = a0;
this.showFeedbackModalDebounced(a1, a2);
}
}
} else if (a2 != null) {
a2();
}
function feedbackTypeIsEligibleToBeShown(a0) { // fn#120577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4452, owner: value_120576.feedbackTypeIsEligibleToBeShown, offset: 0x02530629, size: 128 bytes, params: 2, frame: 14
var environment;
const value = environment.__proto__.__proto__;
let r3 = FeedbackOverrideStore.getFeedbackConfig(a0) ?? env2_12[a0];
r3 = r3.eligibilityChecks ?? [];
return [triggerRateEligibilityCheck, optOutEligibilityCheck,
groupRecencyEligibilityCheck].every(_fun120578) && r3.every(_fun120579);
function _fun120578(a0) { // fn#120578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4678, offset: 0x00c44018, size: 19 bytes, params: 2, frame: 11
return a0(env0_0);
}
function _fun120579(a0) { // fn#120579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15919:4698, offset: 0x00c44018, size: 19 bytes, params: 2, frame: 11
return a0(env0_0);
}
}
}
}
}
global.__d(_fun120555, 15711, [6, 7, 15, 17, 18, 6825, 4294, 15712, 9906, 6824, 3829, 587, 22, 15713, 4860,
2]) /* metro module 15711, dependencies: [6, 7, 15, 17, 18, 6825, 4294, 15712, 9906, 6824, 3829, 587, 22, 15713, 4860, 2] */;