decord/source/modules/premium/powerups/GuildPowerupsActionCreators.tsx

157 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11706
// Function ID: 11707
2026-07-20 16:05:17 +00:00
// Name: guildPowerupsAckNotification
2026-08-24 06:08:38 +00:00
// Dependencies: [4266, 676, 709, 11707, 4388, 530, 11708, 1370, 2]
2026-07-20 16:05:17 +00:00
// Exports: disablePowerupForGuild, enablePowerupForGuild, fetchGuildBoostEntitlements, fetchPowerupCatalogForGuild, guildPowerupsAckNotification, guildPowerupsResetNotifications
2026-08-24 06:08:38 +00:00
// Module 11706 (guildPowerupsAckNotification)
import set from "set" /* 2 */;
import sendRequest from "sendRequest" /* 530 */;
import ME from "ME" /* 676 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import BoostedGuildTiers from "BoostedGuildTiers" /* 4266 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
({ GUILD_POWERUP_APPLICATION_ID: c3, GuildPowerupType: c4 } = BoostedGuildTiers);
2026-08-24 06:08:38 +00:00
const Endpoints = ME.Endpoints;
let result = set.fileFinishedImporting("modules/premium/powerups/GuildPowerupsActionCreators.tsx");
2026-07-23 10:11:24 +00:00
export const guildPowerupsAckNotification = function guildPowerupsAckNotification(closure_0) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-23 10:11:24 +00:00
obj = { type: "GUILD_POWERUPS_ACK_NOTIFICATION", guildId: closure_0 };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
};
export const guildPowerupsResetNotifications = function guildPowerupsResetNotifications() {
2026-08-24 06:08:38 +00:00
dispatcherDefault.dispatch({ type: "GUILD_POWERUPS_RESET_NOTIFICATIONS" });
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const fetchPowerupCatalogForGuild = function fetchPowerupCatalogForGuild(closure_0) {
const _require = closure_0;
2026-07-20 16:05:17 +00:00
if (true === arg1) {
2026-08-24 06:08:38 +00:00
const MOCK_LEVELS = _require(11707).MOCK_LEVELS;
const combined = MOCK_LEVELS.concat(_require(11707).MOCK_PERKS);
2026-07-20 16:05:17 +00:00
let obj = {};
2026-08-24 06:08:38 +00:00
obj[constants.LEVEL] = _require(11707).MOCK_LEVELS;
obj[constants.PERK] = _require(11707).MOCK_PERKS;
let obj2 = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "GUILD_POWERUP_CATALOG_FETCH_SUCCESS", guildId: null, allPowerups: null, powerupCatalog: null };
obj[1] = closure_0;
2026-07-23 10:11:24 +00:00
let sorted = combined.sort((skuId, skuId2) => {
2026-07-20 16:05:17 +00:00
let num = -1;
if (skuId.skuId >= skuId2.skuId) {
num = 1;
}
return num;
});
2026-07-29 08:29:29 +00:00
obj[2] = sorted.reduce((arg0, skuId) => {
2026-07-20 16:05:17 +00:00
arg0[skuId.skuId] = skuId;
return arg0;
}, {});
2026-07-29 08:29:29 +00:00
obj[3] = obj;
2026-07-20 16:05:17 +00:00
obj2.dispatch(obj);
} else {
2026-08-24 06:08:38 +00:00
obj1 = { url: null, query: null, oldFormErrors: true, rejectWithError: null };
2026-07-29 08:29:29 +00:00
obj1[0] = Endpoints.STORE_PUBLISHED_LISTINGS_SKUS;
obj2 = { application_id: null, guild_id: null };
obj2[0] = closure_3;
obj2[1] = closure_0;
obj1[1] = obj2;
2026-08-24 06:08:38 +00:00
const obj5 = _require(4388);
2026-07-29 08:29:29 +00:00
obj1[3] = _require(530).rejectWithMigratedError();
2026-07-20 16:05:17 +00:00
const result = obj5.httpGetWithCountryCodeQuery(obj1);
return result.then((body) => {
2026-07-29 08:29:29 +00:00
const callback = body;
2026-07-20 16:05:17 +00:00
body = body.body;
2026-08-24 06:08:38 +00:00
const mapped = body.map((arg0) => closure_1_1(closure_1_2[6])(body.body, arg0));
const found = mapped.filter(callback(closure_1_2[7]).isNotNullish);
2026-07-20 16:05:17 +00:00
const sorted = found.sort((skuId, skuId2) => {
let num = -1;
if (skuId.skuId >= skuId2.skuId) {
num = 1;
}
return num;
});
const reduced = sorted.reduce((powerupCatalog, skuId) => {
powerupCatalog = powerupCatalog.powerupCatalog;
powerupCatalog.allPowerups[skuId.skuId] = skuId;
if (null == powerupCatalog[skuId.type]) {
powerupCatalog[skuId.type] = [];
}
let arr = powerupCatalog[skuId.type];
2026-07-29 08:29:29 +00:00
if (arr != null) {
const push = arr.push;
if (push != null) {
arr = push(skuId);
}
2026-07-20 16:05:17 +00:00
}
return powerupCatalog;
}, { allPowerups: {}, powerupCatalog: {} });
({ allPowerups, powerupCatalog } = reduced);
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[2]).dispatch({ type: "GUILD_POWERUP_CATALOG_FETCH_SUCCESS", guildId: callback, allPowerups, powerupCatalog });
2026-07-20 16:05:17 +00:00
return body.body;
});
}
};
2026-07-23 10:11:24 +00:00
export const fetchGuildBoostEntitlements = function fetchGuildBoostEntitlements(closure_0, arg1) {
const _require = closure_0;
2026-07-29 08:29:29 +00:00
let flag = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
flag = true;
}
2026-08-24 06:08:38 +00:00
let obj = _require(4388);
obj = { url: Endpoints.GUILD_POWERUPS(closure_0), query: { include_ends_at: flag }, oldFormErrors: true, rejectWithError: _require(530).rejectWithMigratedError() };
2026-07-20 16:05:17 +00:00
const result = obj.httpGetWithCountryCodeQuery(obj);
return result.then((body) => {
let obj = {};
obj = {};
body = body.body;
const item = body.forEach((sku) => {
sku = sku.sku;
let powerup;
2026-07-29 08:29:29 +00:00
if (sku != null) {
2026-07-20 16:05:17 +00:00
const tenant_metadata = sku.tenant_metadata;
2026-07-29 08:29:29 +00:00
if (tenant_metadata != null) {
2026-07-20 16:05:17 +00:00
const guild_monetization = tenant_metadata.guild_monetization;
2026-07-29 08:29:29 +00:00
if (guild_monetization != null) {
2026-07-20 16:05:17 +00:00
powerup = guild_monetization.powerup;
}
}
}
if (null == powerup) {
let powerup_metadata;
2026-07-29 08:29:29 +00:00
if (sku != null) {
2026-07-20 16:05:17 +00:00
const sku2 = sku.sku;
2026-07-29 08:29:29 +00:00
if (sku2 != null) {
2026-07-20 16:05:17 +00:00
powerup_metadata = sku2.powerup_metadata;
}
}
if (null == powerup_metadata) {
const sku3 = sku.sku;
let game_server;
2026-07-29 08:29:29 +00:00
if (sku3 != null) {
2026-07-20 16:05:17 +00:00
const tenant_metadata2 = sku3.tenant_metadata;
2026-07-29 08:29:29 +00:00
if (tenant_metadata2 != null) {
2026-07-20 16:05:17 +00:00
const guild_monetization2 = tenant_metadata2.guild_monetization;
2026-07-29 08:29:29 +00:00
if (guild_monetization2 != null) {
2026-07-20 16:05:17 +00:00
game_server = guild_monetization2.game_server;
}
}
}
if (null != game_server) {
obj[sku.id] = sku;
}
}
}
obj[sku.sku_id] = sku;
});
2026-07-23 10:11:24 +00:00
obj = { type: "GUILD_BOOST_ENTITLEMENTS_FETCH_SUCCESS", guildId: obj, unlockedPowerups: obj, unlockedGameServers: obj };
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[2]).dispatch(obj);
2026-07-20 16:05:17 +00:00
});
};
export const enablePowerupForGuild = function enablePowerupForGuild(arg0, arg1) {
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-20 16:05:17 +00:00
return HTTP.post({ url: Endpoints.GUILD_POWERUP_TOGGLE(arg0, arg1), rejectWithError: true });
};
export const disablePowerupForGuild = function disablePowerupForGuild(arg0, arg1) {
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-20 16:05:17 +00:00
return HTTP.del({ url: Endpoints.GUILD_POWERUP_TOGGLE(arg0, arg1), rejectWithError: true });
};