decord/source/modules/guild_profile/GuildProfileActionCreators.tsx

186 lines
7 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 8221
// Function ID: 65945
2026-07-20 16:05:17 +00:00
// Name: _fetchGuildTopGames
2026-07-25 08:10:48 +00:00
// Dependencies: [5, 3949, 1918, 8219, 653, 686, 507, 5128, 4030, 675, 2]
2026-07-20 16:05:17 +00:00
// Exports: fetchGuildTopGames, getGuildProfile, saveGuildProfile, setGuildProfileVisibility, trackGuildProfileViewed
2026-07-25 08:10:48 +00:00
// Module 8221 (_fetchGuildTopGames)
2026-07-23 10:11:24 +00:00
import dispatcher from "dispatcher";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_5 from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
import { GuildProfileFetchStatus } from "_isNativeReflectConstruct";
import ME from "ME";
let closure_8;
let closure_9;
const require = arg1;
2026-07-20 16:05:17 +00:00
function _fetchGuildTopGames() {
// CreateGeneratorClosureLongIndex (0x67)
const obj = callback(tmp);
return obj(...arguments);
}
2026-07-23 10:11:24 +00:00
({ AnalyticEvents: closure_8, Endpoints: closure_9 } = ME);
const result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/guild_profile/GuildProfileActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const getGuildProfile = function getGuildProfile(guildId, flag, arg2) {
let obj = arg2;
2026-07-23 10:11:24 +00:00
const _require = guildId;
2026-07-20 16:05:17 +00:00
if (arg2 === undefined) {
obj = {};
}
flag = obj.respectBackoff;
if (flag === undefined) {
flag = false;
}
if (null == guildId) {
return Promise.resolve(null);
} else {
const fetchStatus = store.getFetchStatus(guildId);
const lastSyncTimestamp = store.getLastSyncTimestamp(guildId);
const profile = store.getProfile(guildId);
const _Date2 = Date;
let num = 0;
const timestamp = Date.now();
if (null != lastSyncTimestamp) {
num = lastSyncTimestamp;
}
const diff = timestamp - num;
const nextFetchAllowedAt = store.getNextFetchAllowedAt(guildId);
if (flag) {
if (null != nextFetchAllowedAt) {
const _Date = Date;
if (Date.now() < nextFetchAllowedAt) {
let resolved = Promise.resolve(profile);
}
return resolved;
}
}
if (fetchStatus === GuildProfileFetchStatus.FETCHING) {
if (!flag) {
resolved = Promise.resolve(null);
}
}
if (null != profile) {
if (diff <= 60000) {
if (!flag) {
let resolved1 = Promise.resolve(profile);
}
}
}
obj = { type: "GUILD_PROFILE_FETCH", guildId };
2026-07-23 10:11:24 +00:00
importDefault(686).dispatch(obj);
const HTTP = _require(507).HTTP;
2026-07-20 16:05:17 +00:00
obj = { url: closure_9.GUILD_PROFILE(guildId) };
2026-07-23 10:11:24 +00:00
const obj2 = importDefault(686);
2026-07-20 16:05:17 +00:00
const obj6 = store;
2026-07-23 10:11:24 +00:00
obj.rejectWithError = _require(507).rejectWithMigratedError();
2026-07-20 16:05:17 +00:00
const value = HTTP.get(obj);
2026-07-23 10:11:24 +00:00
const obj5 = _require(507);
2026-07-20 16:05:17 +00:00
resolved1 = value.then((body) => {
2026-07-23 10:11:24 +00:00
let obj = guildId(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-23 10:11:24 +00:00
obj = { type: "GUILD_PROFILE_FETCH_SUCCESS", guildId, profile: guildProfileFromServer };
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
}).catch((arg0) => {
2026-07-23 10:11:24 +00:00
const aPIError = new guildId(outer1_2[8]).APIError(arg0);
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_FETCH_FAILURE", guildId, error: aPIError };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return null;
});
const nextPromise = value.then((body) => {
2026-07-23 10:11:24 +00:00
let obj = guildId(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-23 10:11:24 +00:00
obj = { type: "GUILD_PROFILE_FETCH_SUCCESS", guildId, profile: guildProfileFromServer };
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
});
}
};
export const saveGuildProfile = function saveGuildProfile(guildId, updates) {
2026-07-23 10:11:24 +00:00
const _require = guildId;
2026-07-20 16:05:17 +00:00
if (store.getIsUpdating(guildId)) {
let resolved = Promise.resolve(null);
} else {
2026-07-23 10:11:24 +00:00
let obj = importDefault(686);
2026-07-20 16:05:17 +00:00
obj = { type: "GUILD_PROFILE_UPDATE", guildId, updates };
obj.dispatch(obj);
2026-07-23 10:11:24 +00:00
const HTTP = _require(507).HTTP;
2026-07-25 08:10:48 +00:00
obj = { url: closure_9.GUILD_PROFILE(guildId), body: _require(5128).buildGuildProfileUpdateForServer(updates) };
const obj4 = _require(5128);
2026-07-23 10:11:24 +00:00
obj.rejectWithError = _require(507).rejectWithMigratedError();
const obj5 = _require(507);
2026-07-20 16:05:17 +00:00
const patchResult = HTTP.patch(obj);
resolved = HTTP.patch(obj).then((body) => {
2026-07-23 10:11:24 +00:00
let obj = guildId(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-23 10:11:24 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_SUCCESS", guildId, profile: guildProfileFromServer };
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
}).catch((arg0) => {
2026-07-23 10:11:24 +00:00
const aPIError = new guildId(outer1_2[8]).APIError(arg0);
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_UPDATE_FAILURE", guildId, error: aPIError };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return null;
});
const nextPromise = HTTP.patch(obj).then((body) => {
2026-07-23 10:11:24 +00:00
let obj = guildId(outer1_2[7]);
2026-07-20 16:05:17 +00:00
const guildProfileFromServer = obj.buildGuildProfileFromServer(body.body);
2026-07-23 10:11:24 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_SUCCESS", guildId, profile: guildProfileFromServer };
outer1_1(outer1_2[5]).dispatch(obj);
2026-07-20 16:05:17 +00:00
return guildProfileFromServer;
});
}
return resolved;
};
export const setGuildProfileVisibility = function setGuildProfileVisibility(guildId, visibility) {
2026-07-23 10:11:24 +00:00
const _require = guildId;
2026-07-20 16:05:17 +00:00
if (store.getIsUpdating(guildId)) {
let resolved = Promise.resolve(null);
} else {
2026-07-23 10:11:24 +00:00
let obj = importDefault(686);
2026-07-20 16:05:17 +00:00
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY", guildId, visibility };
obj.dispatch(obj);
2026-07-23 10:11:24 +00:00
const HTTP = _require(507).HTTP;
2026-07-20 16:05:17 +00:00
obj = { url: closure_9.GUILD_PROFILE_VISIBILITY(guildId) };
const obj1 = { visibility };
obj.body = obj1;
2026-07-23 10:11:24 +00:00
obj.rejectWithError = _require(507).rejectWithMigratedError();
const obj5 = _require(507);
2026-07-20 16:05:17 +00:00
const putResult = HTTP.put(obj);
resolved = HTTP.put(obj).then((body) => {
const visibility = body.body.visibility;
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY_SUCCESS", guildId: closure_0, visibility };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return visibility;
}).catch((arg0) => {
2026-07-23 10:11:24 +00:00
const aPIError = new guildId(outer1_2[8]).APIError(arg0);
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY_FAILURE", guildId, error: aPIError };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
throw aPIError;
});
const nextPromise = HTTP.put(obj).then((body) => {
const visibility = body.body.visibility;
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_2[5]);
obj = { type: "GUILD_PROFILE_UPDATE_VISIBILITY_SUCCESS", guildId: closure_0, visibility };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
return visibility;
});
}
return resolved;
};
export const fetchGuildTopGames = function fetchGuildTopGames() {
return _fetchGuildTopGames(...arguments);
};
export const trackGuildProfileViewed = function trackGuildProfileViewed(guildId, analyticsLocations) {
const tmp = null != selfMember.getSelfMember(guildId);
2026-07-23 10:11:24 +00:00
let obj = importDefault(675);
2026-07-20 16:05:17 +00:00
obj = { guild_id: guildId, location_stack: analyticsLocations, is_member: tmp, has_join_request: null != request.getRequest(guildId) };
obj.track(constants.GUILD_PROFILE_VIEWED, obj);
};