Files
discord-decomp/sources/modules/premium/powerups/GuildPowerupsActionCreators.tsx
T
2026-07-28 01:06:53 +03:00

160 lines
9.1 KiB
TypeScript

/* Metro module 12307; source: modules/premium/powerups/GuildPowerupsActionCreators.tsx; dependencies: [8259, 661, 694, 12308, 4141, 12309, 1360, 507, 2] */
import Dispatcher from '../../../Dispatcher.tsx'; /* Metro dependency 694 */
import StoreListingToGuildPowerup from './utils/storeListingToGuildPowerup.tsx'; /* Metro dependency 12309 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as StoreUtilsModule from '../../../utils/StoreUtils.tsx'; /* Metro dependency 4141 */
import * as GuildPowerupsConstantsModule from './constants/GuildPowerupsConstants.tsx'; /* Metro dependency 8259 */
import * as GuildPowerupMocksModule from './mocks/GuildPowerupMocks.tsx'; /* Metro dependency 12308 */
function _fun93980(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93980, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:6, offset: 0x020cd830, size: 221 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/premium/powerups/GuildPowerupsActionCreators.tsx');
exports.guildPowerupsAckNotification = guildPowerupsAckNotification;
exports.guildPowerupsResetNotifications = guildPowerupsResetNotifications;
exports.fetchPowerupCatalogForGuild = fetchPowerupCatalogForGuild;
exports.fetchGuildBoostEntitlements = fetchGuildBoostEntitlements;
exports.enablePowerupForGuild = function(a0, a1) {
var HTTP = require(dependencyMap[7]).HTTP;
var object = {};
object.url = Endpoints.GUILD_POWERUP_TOGGLE(a0, a1);
object.rejectWithError = true;
return HTTP.post(object);
};
exports.disablePowerupForGuild = function(a0, a1) {
var HTTP = require(dependencyMap[7]).HTTP;
var object = {};
object.url = Endpoints.GUILD_POWERUP_TOGGLE(a0, a1);
object.rejectWithError = true;
return HTTP.del(object);
};
function guildPowerupsAckNotification(a0) { // fn#93981, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:302, offset: 0x020cd90d, size: 56 bytes, params: 2, frame: 13
(Dispatcher).dispatch({type: 'GUILD_POWERUPS_ACK_NOTIFICATION',
guildId: a0});
}
function guildPowerupsResetNotifications() { // fn#93982, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:447, offset: 0x020cd945, size: 49 bytes, params: 1, frame: 13
(Dispatcher).dispatch({type: 'GUILD_POWERUPS_RESET_NOTIFICATIONS'});
}
function fetchPowerupCatalogForGuild(a0, a1) { // fn#93983, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:583, offset: 0x020cd976, size: 327 bytes, params: 3, frame: 21
var value;
var object;
const MOCK_LEVELS = (GuildPowerupMocksModule).MOCK_LEVELS;
const MOCK_PERKS = (GuildPowerupMocksModule).MOCK_PERKS;
var value2;
var dispatch;
var object3;
const env0_0 = a0;
if (a1 === true) {
value2 = MOCK_LEVELS.concat(MOCK_PERKS);
object = {};
object[GuildPowerupType.LEVEL] = MOCK_LEVELS;
object[GuildPowerupType.PERK] = MOCK_PERKS;
value = importDefault(694) /* metro dependency 694: Dispatcher */;
dispatch = value.dispatch;
object3 = {type: 'GUILD_POWERUP_CATALOG_FETCH_SUCCESS', guildId: a0};
object3.allPowerups = value2.sort(function({skuId}, a1) {
return skuId >= a1.skuId ? 1 : -1;
}).reduce(_fun93985, {});
object3.powerupCatalog = object;
Reflect.apply(dispatch, value, [object3]);
return undefined;
}
const httpGetWithCountryCodeQuery = StoreUtilsModule.httpGetWithCountryCodeQuery;
const STORE_PUBLISHED_LISTINGS_SKUS = Endpoints.STORE_PUBLISHED_LISTINGS_SKUS;
return Reflect.apply(httpGetWithCountryCodeQuery, StoreUtilsModule, [{url: STORE_PUBLISHED_LISTINGS_SKUS,
query: {application_id: GUILD_POWERUP_APPLICATION_ID, guild_id: a0}, oldFormErrors: true,
rejectWithError: false}]).then(_fun93986);
function _fun93986(a0) { // fn#93986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:1104, offset: 0x020cdaf0, size: 203 bytes, params: 2, frame: 18
const env0_0 = a0;
let value = a0.body.map(_fun93987);
value = value.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
value = value.sort(function({skuId}, a1) {
return skuId >= a1.skuId ? 1 : -1;
});
value = value.reduce(function(a0, a1) {
var property = a0.allPowerups;
var powerupCatalog = a0.powerupCatalog;
property[a1.skuId] = a1;
if (powerupCatalog[a1.type] == null) {
powerupCatalog[a1.type] = [];
}
property = powerupCatalog[a1.type];
if (!(property == null || property.push == null)) {
property.push(a1);
}
return a0;
}, {allPowerups: {}, powerupCatalog: {}});
(Dispatcher).dispatch({type: 'GUILD_POWERUP_CATALOG_FETCH_SUCCESS',
guildId: env0_0, allPowerups: value.allPowerups, powerupCatalog: value.powerupCatalog});
return a0.body;
function _fun93987(a0) { // fn#93987, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:1126, offset: 0x020cdbbb, size: 48 bytes, params: 2, frame: 13
const value = environment.__proto__.__proto__;
return (StoreListingToGuildPowerup)(env0_0.body, a0);
}
}
}
function fetchGuildBoostEntitlements(a0) { // fn#93990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:1596, offset: 0x020cdc4a, size: 121 bytes, params: 2, frame: 16
const value = a1;
const env0_0 = a0;
const r5 = !(value !== undefined) || value;
const httpGetWithCountryCodeQuery = StoreUtilsModule.httpGetWithCountryCodeQuery;
const object = {};
object.url = Endpoints.GUILD_POWERUPS(a0);
object.query = {include_ends_at: r5};
object.oldFormErrors = true;
object.rejectWithError = false;
return Reflect.apply(httpGetWithCountryCodeQuery, StoreUtilsModule, [object]).then(_fun93991);
function _fun93991({body}) { // fn#93991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:1779, offset: 0x020cdcc3, size: 107 bytes, params: 2, frame: 15
var environment;
const object = {};
const object3 = object;
body.forEach(_fun93992);
const value = environment.__proto__;
(Dispatcher).dispatch({type: 'GUILD_BOOST_ENTITLEMENTS_FETCH_SUCCESS',
guildId: object3, unlockedPowerups: object, unlockedGameServers: {}});
function _fun93992(a0) { // fn#93992, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:1813, offset: 0x020cdd2e, size: 188 bytes, params: 2, frame: 6
var powerup_metadata;
let sku = a0.sku;
const value = undefined;
if ((sku == null || sku.tenant_metadata == null || sku.tenant_metadata.guild_monetization == null ? value : sku.tenant_metadata.guild_monetization.powerup) != null) {
env0_0[a0.sku_id] = a0;
} else {
if (a0 == null) {
powerup_metadata = value;
} else {
sku = a0.sku;
powerup_metadata = sku == null ? value : sku.powerup_metadata;
}
if (powerup_metadata != null) {
env0_0[a0.sku_id] = a0;
} else {
sku = a0.sku;
if ((sku == null || sku.tenant_metadata == null || sku.tenant_metadata.guild_monetization == null ? value : sku.tenant_metadata.guild_monetization.game_server) != null) {
env0_1[a0.id] = a0;
}
}
}
return value;
}
}
}
}
function _fun93985(a0, a1) { // fn#93985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12493:896, offset: 0x020cdadf, size: 17 bytes, params: 3, frame: 3
a0[a1.skuId] = a1;
return a0;
}
global.__d(_fun93980, 12307, [8259, 661, 694, 12308, 4141, 12309, 1360, 507,
2]) /* metro module 12307, dependencies: [8259, 661, 694, 12308, 4141, 12309, 1360, 507, 2] */;