This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,15 @@
// Metro module 11290 (f11291).
import { createApexExperiment } from "../experiments/apex/index";
const apexExperiment = createApexExperiment({
kind: "user",
name: "2025-01-allow-nonstaff-to-preview-app-collections",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export default apexExperiment;
@@ -0,0 +1,650 @@
// Metro module 11245 (f11246).
import DevSettingsStore from "../devtools/dev_settings/DevSettingsStore";
import LocaleStore from "../user_settings/LocaleStore";
import "../../stores/DeveloperOptionsStore";
import ApplicationDirectoryApplicationsStore, { FetchState } from "./stores/ApplicationDirectoryApplicationsStore";
import ApplicationDirectoryCategoriesStore from "./stores/ApplicationDirectoryCategoriesStore";
import ApplicationDirectoryCollectionsStore, { FetchState as FetchState2 } from "./stores/ApplicationDirectoryCollectionsStore";
import ApplicationDirectorySearchStore, { FetchState as FetchState3 } from "./stores/ApplicationDirectorySearchStore";
import ApplicationDirectorySimilarApplicationsStore, { FetchState as FetchState4 } from "./stores/ApplicationDirectorySimilarApplicationsStore";
import MyGuildApplicationsStore, { FetchState as FetchState5 } from "./stores/MyGuildApplicationsStore";
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import Backoff from "../../_bundle/Backoff";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import { SearchAppsRequestSource } from "../../_bundle/Module11243";
import { isAndroid, isIOS } from "../../utils/PlatformUtils";
import { ApplicationCollectionPlatforms } from "../../_bundle/Module11250";
import { ApplicationCollectionSurface } from "../../_bundle/Module11251";
import { ApplicationCollectionActiveState } from "../../_bundle/Module11252";
let c7622_18 = 600000;
let c7622_19 = new Map();
export async function getEmbedApplication(applicationId) {
let c27000_1, c27000_2, c27000_3, c27000_4;
let c27000_5 = 0;
const r12 = void 0;
L17: {
L16: {
try {
let env30376;
c27000_3 = r12;
const r36 = env30376 = {};
c27000_2 = r36;
env30376[0] = applicationId;
env30376[1] = void 0;
env30376[2] = void 0;
env30376[3] = void 0;
const r20 = Date.now();
const r39 = c7622_19.get(applicationId);
c27000_1 = r39;
if (r39 == null) {
c27000_1 = 0;
}
const r21 = c27000_1;
if (ApplicationDirectoryApplicationsStore.getApplicationFetchState(applicationId) === FetchState.FETCHING) {
break L17;
}
if (ApplicationDirectoryApplicationsStore.isInvalidApplication(applicationId)) {
break L17;
}
if (r20 < r21 + c7622_18) {
break L17;
}
c7622_19.set(applicationId, r20);
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_APPLICATION",
applicationId
});
const backoff = new Backoff(1000, 5000);
env30376[1] = backoff;
const interceptResponse = (a0, c31619_0) => {
let r1 = a0.status === 429 && env30376[1].fails < 10;
if (r1) {
env30376[1].fail(() => {
c31619_0(void 0, env30376[2]);
});
r1 = true;
}
return r1;
};
env30376[2] = interceptResponse;
c27000_5 = 1;
env30376[3] = (await HTTP.get({
url: Endpoints.APPLICATION_DIRECTORY_EMBED_APPLICATION(applicationId),
backoff,
retries: 10,
interceptResponse,
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_APPLICATION_SUCCESS",
application: env30376[3]
});
c27000_5 = 0;
} catch ($e) {
const r34 = $e;
let r8 = r34;
c27000_4 = r34;
if (c27000_5 !== 0) {
while (true) {
try {
c27000_5 = 0;
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_APPLICATION_FAILURE",
applicationId: env30376[0],
isInvalidApplication: true
});
break L16;
} catch (r114) {
r8 = r114;
c27000_4 = r114;
if (c27000_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
export async function getApplication(c27001_0, c27001_1) {
let c27001_2;
let c27001_6 = 0;
let c30377_1, c30377_0, c30377_2, c30377_3, c30377_4, c30377_5, c30377_6, c30377_7;
L19: {
try {
c30377_1 = void 0;
c30377_0 = c27001_0;
let r34 = c27001_1;
if (r34 === void 0) {
r34 = {};
}
c30377_1 = r34;
c30377_2 = void 0;
c30377_3 = void 0;
c30377_4 = void 0;
c30377_5 = void 0;
c30377_6 = void 0;
c30377_7 = void 0;
await void 0;
c30377_2 = Date.now();
c30377_3 = ApplicationDirectoryApplicationsStore.getApplicationFetchState(c30377_0);
c30377_4 = ApplicationDirectoryApplicationsStore.getApplicationLastFetchTime(c30377_0);
c30377_5 = c30377_1.dontRefetchMs;
c30377_6 = c30377_1.noCache;
if (c30377_3 !== FetchState.FETCHING) {
if (c30377_4 != null) {
const r98 = c30377_4;
const r99 = c30377_5;
c27001_2 = r99;
if (r99 == null) {
c27001_2 = c7622_18;
}
if (r98 + c27001_2 > c30377_2) {
break L19;
}
}
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_APPLICATION",
applicationId: c30377_0
});
c27001_6 = 1;
c30377_7 = await HTTP.get({
url: Endpoints.APPLICATION_DIRECTORY_APPLICATION(c30377_0),
query: {
locale: LocaleStore.locale,
nocache: c30377_6
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_APPLICATION_SUCCESS",
application: c30377_7.body
});
c27001_6 = 0;
}
} catch ($e) {
let r8 = $e;
if (c27001_6 !== 0) {
while (true) {
try {
c27001_6 = 0;
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_APPLICATION_FAILURE",
applicationId: c30377_0,
isInvalidApplication: true
});
break L19;
} catch ($e) {
r8 = $e;
if (c27001_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export async function getCategories() {
let c27002_1;
let c30378_0;
L14: {
L10: {
c27002_1 = void 0;
c30378_0 = void 0;
const r29 = Date.now();
const lastFetchTimeMs = ApplicationDirectoryCategoriesStore.getLastFetchTimeMs();
if (lastFetchTimeMs != null && lastFetchTimeMs + c7622_18 > r29) {
break L10;
}
c30378_0 = await HTTP.get({
url: Endpoints.APPLICATION_DIRECTORY_CATEGORIES,
query: {
locale: LocaleStore.locale
},
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_CATEGORIES_SUCCESS",
categories: c30378_0.body
});
break L14;
}
return void 0;
}
}
export async function getSimilarApplications(c27003_0) {
let c27003_1, similarApplications;
let c27003_6 = 0;
let c30379_0, c30379_1, c30379_2, c30379_3, c30379_4, c30379_5, c30379_6, c30379_7;
L19: {
try {
c30379_0 = void 0;
c30379_1 = void 0;
c30379_2 = void 0;
c30379_0 = c27003_0.applicationId;
c30379_1 = c27003_0.guildId;
c30379_2 = c27003_0.options;
c30379_3 = void 0;
c30379_4 = void 0;
c30379_5 = void 0;
c30379_6 = void 0;
c30379_7 = void 0;
await void 0;
const r54 = c30379_2;
c27003_1 = r54;
if (r54 == null) {
c27003_1 = {};
}
c30379_3 = c27003_1.page;
c30379_4 = Date.now();
c30379_5 = ApplicationDirectorySimilarApplicationsStore.getFetchState({
applicationId: c30379_0,
guildId: c30379_1
});
const similarApplications2 = ApplicationDirectorySimilarApplicationsStore.getSimilarApplications({
applicationId: c30379_0,
guildId: c30379_1
});
similarApplications = similarApplications2;
if (similarApplications2 == null) {
similarApplications = {};
}
c30379_6 = similarApplications.lastFetchTimeMs;
if (c30379_5 !== FetchState4.FETCHING) {
if (c30379_6 != null) {
if (c30379_6 + c7622_18 > c30379_4) {
break L19;
}
}
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_SIMILAR_APPLICATIONS",
applicationId: c30379_0,
guildId: c30379_1,
page: c30379_3
});
c27003_6 = 1;
c30379_7 = await HTTP.get({
url: Endpoints.APPLICATION_DIRECTORY_SIMILAR(c30379_0),
query: {
guild_id: c30379_1,
page: c30379_3,
locale: LocaleStore.locale
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_SIMILAR_APPLICATIONS_SUCCESS",
applicationId: c30379_0,
guildId: c30379_1,
similarApplications: c30379_7.body.applications,
loadId: c30379_7.body.load_id,
page: c30379_3,
totalPages: c30379_7.body.num_pages
});
c27003_6 = 0;
}
} catch ($e) {
let r8 = $e;
if (c27003_6 !== 0) {
while (true) {
try {
c27003_6 = 0;
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_SIMILAR_APPLICATIONS_FAILURE",
applicationId: c30379_0,
guildId: c30379_1,
page: c30379_3
});
break L19;
} catch ($e) {
r8 = $e;
if (c27003_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export async function search(c27004_0) {
let c27004_1, searchResults;
let c27004_6 = 0;
let c30380_0, c30380_1, c30380_2, c30380_3, c30380_4, c30380_5, c30380_6, c30380_7, c30380_8, c30380_9, c30380_10, c30380_11, c30380_12, c30380_13, c30380_14, c30380_15, c30380_16, c30380_17, c30380_18;
L24: {
try {
c30380_0 = void 0;
c30380_1 = void 0;
c30380_2 = void 0;
c30380_3 = void 0;
c30380_0 = c27004_0.query;
c30380_1 = c27004_0.guildId;
c30380_2 = c27004_0.options;
c30380_3 = c27004_0.onSuccessCallback;
c30380_4 = void 0;
c30380_5 = void 0;
c30380_6 = void 0;
c30380_7 = void 0;
c30380_8 = void 0;
c30380_9 = void 0;
c30380_10 = void 0;
c30380_11 = void 0;
c30380_12 = void 0;
c30380_13 = void 0;
c30380_14 = void 0;
c30380_15 = void 0;
c30380_16 = void 0;
c30380_17 = void 0;
c30380_18 = void 0;
await void 0;
const r54 = c30380_2;
c27004_1 = r54;
if (r54 == null) {
c27004_1 = {};
}
c30380_4 = c27004_1;
c30380_5 = c30380_4.page;
c30380_6 = c30380_4.pageSize;
c30380_7 = c30380_4.categoryId;
c30380_8 = c30380_4.integrationType;
c30380_9 = c30380_4.minUserInstallCommandCount;
c30380_10 = c30380_4.excludeAppsWithCustomInstallUrl;
c30380_11 = c30380_4.excludeNonEmbeddedApps;
c30380_12 = c30380_4.excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand;
c30380_13 = c30380_4.source;
c30380_14 = c30380_13 === void 0 ? SearchAppsRequestSource.APP_DIRECTORY : c30380_13;
c30380_15 = Date.now();
c30380_16 = ApplicationDirectorySearchStore.getFetchState({
query: c30380_0,
guildId: c30380_1,
page: c30380_5,
pageSize: c30380_6,
categoryId: c30380_7,
integrationType: c30380_8
});
searchResults = ApplicationDirectorySearchStore.getSearchResults({
query: c30380_0,
guildId: c30380_1,
page: c30380_5,
pageSize: c30380_6,
categoryId: c30380_7,
integrationType: c30380_8
});
if (searchResults == null) {
searchResults = {};
}
c30380_17 = searchResults.lastFetchTimeMs;
if (c30380_16 !== FetchState3.FETCHING) {
if (c30380_17 != null) {
if (c30380_17 + c7622_18 > c30380_15) {
break L24;
}
}
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_SEARCH",
query: c30380_0,
guildId: c30380_1,
page: c30380_5,
pageSize: c30380_6,
categoryId: c30380_7,
integrationType: c30380_8,
minUserInstallCommandCount: c30380_9,
excludeAppsWithCustomInstallUrl: c30380_10,
excludeNonEmbeddedApps: c30380_11,
excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand: c30380_12,
source: c30380_14
});
c27004_6 = 1;
c30380_18 = await HTTP.get({
url: Endpoints.APPLICATION_DIRECTORY_SEARCH,
query: {
query: c30380_0,
guild_id: c30380_1,
page: c30380_5,
page_size: c30380_6,
category_id: c30380_7,
locale: LocaleStore.locale,
integration_type: c30380_8,
min_user_install_command_count: c30380_9,
exclude_apps_with_custom_install_url: c30380_10,
exclude_non_embedded_apps: c30380_11,
exclude_embedded_apps_without_primary_entry_point_app_command: c30380_12,
source: c30380_14
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_SEARCH_SUCCESS",
query: c30380_0,
guildId: c30380_1,
page: c30380_5,
pageSize: c30380_6,
categoryId: c30380_7,
integrationType: c30380_8,
result: {
results: c30380_18.body.results,
countsByCategory: c30380_18.body.counts_by_category,
totalCount: c30380_18.body.result_count,
totalPages: c30380_18.body.num_pages,
type: c30380_18.body.type,
loadId: c30380_18.body.load_id
},
minUserInstallCommandCount: c30380_9,
excludeAppsWithCustomInstallUrl: c30380_10,
excludeNonEmbeddedApps: c30380_11,
excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand: c30380_12,
source: c30380_14
});
const r224 = c30380_3;
if (r224 != null) {
r224(c30380_18.body.result_count);
}
c27004_6 = 0;
}
} catch ($e) {
let r8 = $e;
if (c27004_6 !== 0) {
while (true) {
try {
c27004_6 = 0;
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_SEARCH_FAILURE",
query: c30380_0,
guildId: c30380_1,
page: c30380_5,
pageSize: c30380_6,
categoryId: c30380_7,
integrationType: c30380_8,
minUserInstallCommandCount: c30380_9,
excludeAppsWithCustomInstallUrl: c30380_10,
excludeNonEmbeddedApps: c30380_11,
excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand: c30380_12,
source: c30380_14
});
break L24;
} catch ($e) {
r8 = $e;
if (c27004_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export async function fetchCollections(c27005_0) {
let c27005_4 = 0;
let c30381_0, c30381_1, c30381_2, c30381_3, c30381_4, c30381_5, c30381_6, c30381_7;
L30: {
try {
c30381_0 = void 0;
c30381_1 = void 0;
let r17 = c27005_0;
if (r17 === void 0) {
r17 = {};
}
let surface = r17.surface;
if (surface === void 0) {
surface = ApplicationCollectionSurface.APPLICATION_DIRECTORY;
}
c30381_0 = surface;
let activeState = r17.activeState;
if (activeState === void 0) {
activeState = ApplicationCollectionActiveState.ACTIVE;
}
c30381_1 = activeState;
c30381_2 = void 0;
c30381_3 = void 0;
c30381_4 = void 0;
c30381_5 = void 0;
c30381_6 = void 0;
c30381_7 = void 0;
await void 0;
c30381_2 = DevSettingsStore.get("disable_app_collections_cache");
c30381_3 = Date.now();
c30381_4 = ApplicationDirectoryCollectionsStore.getFetchState({
surface: c30381_0,
activeState: c30381_1
});
c30381_5 = ApplicationDirectoryCollectionsStore.getLastFetchTimeMs({
surface: c30381_0,
activeState: c30381_1
});
if (c30381_4 !== FetchState2.FETCHING) {
const r86 = c30381_2;
c30381_6 = r86 ? !r86 : c30381_1 === ApplicationCollectionActiveState.ACTIVE;
if (c30381_6 && c30381_5 != null) {
if (c30381_5 + c7622_18 > c30381_3) {
break L30;
}
}
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_COLLECTIONS",
surface: c30381_0,
activeState: c30381_1
});
c27005_4 = 1;
c30381_7 = await HTTP.get({
url: Endpoints.APPLICATION_DIRECTORY_COLLECTIONS,
query: {
surface: c30381_0,
active_state: c30381_1,
platform: isAndroid() ? ApplicationCollectionPlatforms.ANDROID : isIOS() ? ApplicationCollectionPlatforms.IOS : ApplicationCollectionPlatforms.WEB,
locale: LocaleStore.locale,
cache: c30381_6
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_COLLECTIONS_SUCCESS",
collections: c30381_7.body,
surface: c30381_0,
activeState: c30381_1
});
c27005_4 = 0;
}
} catch ($e) {
let r8 = $e;
if (c27005_4 !== 0) {
while (true) {
try {
c27005_4 = 0;
Dispatcher.dispatch({
type: "APPLICATION_DIRECTORY_FETCH_COLLECTIONS_FAILURE",
surface: c30381_0,
activeState: c30381_1
});
break L30;
} catch ($e) {
r8 = $e;
if (c27005_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export async function fetchIntegrationApplicationIdsForMyGuilds() {
let c27006_2;
let c27006_3 = 0;
let c30382_0, c30382_1, c30382_2;
L17: {
L16: {
try {
c30382_0 = void 0;
c30382_1 = void 0;
const r33 = Date.now();
const fetchState = MyGuildApplicationsStore.getFetchState();
const lastFetchTimeMs = MyGuildApplicationsStore.getLastFetchTimeMs();
const nextFetchRetryTimeMs = MyGuildApplicationsStore.getNextFetchRetryTimeMs();
if (fetchState === FetchState5.FETCHING) {
break L17;
}
if (lastFetchTimeMs != null && lastFetchTimeMs + 86400000 > r33) {
break L17;
}
if (nextFetchRetryTimeMs != null && r33 < nextFetchRetryTimeMs) {
break L17;
}
Dispatcher.dispatch({
type: "FETCH_INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS"
});
c27006_3 = 1;
c30382_0 = await HTTP.get({
url: Endpoints.INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS,
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "FETCH_INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS_SUCCESS",
guildIdToApplicationIds: c30382_0.body
});
c27006_3 = 0;
} catch ($e) {
const r29 = $e;
let r8 = r29;
c27006_2 = r29;
if (c27006_3 !== 0) {
while (true) {
try {
const r101 = c27006_2;
c27006_3 = 0;
c30382_2 = r101;
c30382_1 = c30382_2?.status === 429;
const r114 = c30382_1;
let retryAfterSeconds = void 0;
if (r114) {
const r119 = c30382_2;
retryAfterSeconds = r119 == null ? void 0 : r119.body?.retry_after;
}
Dispatcher.dispatch({
type: "FETCH_INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS_FAILURE",
retryAfterSeconds
});
break L16;
} catch (r98) {
r8 = r98;
c27006_2 = r98;
if (c27006_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
}
@@ -0,0 +1,27 @@
// Metro module 684 (f685).
const r11 = {
ABOUT: "about",
STORE: "store"
};
const r14 = {
FEATURED: "Featured",
GAMES: "Games",
ENTERTAINMENT: "Entertainment",
MODERATION_AND_TOOLS: "Moderation & Tools",
SOCIAL: "Social",
UTILITIES: "Utilities"
};
const r21 = {
GENERAL: "general",
IMAGES: "images",
PREMIUM_DEPRECATED: "premium",
STORE: "store",
PRIVACY: "privacy"
};
export const GLOBAL_DISCOVERY_APPS_FEATURED_CATEGORY_ID = 0;
export const EMPTY_QUERY = "";
export const MAX_PAGES = 100;
export const PAGE_SIZE = 48;
export { r11 as GlobalDiscoveryAppsSections };
export { r14 as GlobalDiscoveryAppsTabId };
export { r21 as ApplicationDirectoryProfileSections };
@@ -0,0 +1,14 @@
// Metro module 5977 (f5978).
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../stores/SelectedGuildStore";
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export function trackAppDirectoryProfileEmbed(a0, a1) {
AnalyticsUtils.track(AnalyticEvents.APP_DIRECTORY_PROFILE_EMBED_SENT, {
application_id: a0,
device_platform: "mobile_native",
guild_id: SelectedGuildStore.getGuildId(),
channel_id: SelectedChannelStore.getChannelId(),
section: a1
});
}
@@ -0,0 +1,101 @@
// Metro module 5517 (f5518).
import ApplicationRecord from "../../../records/ApplicationRecord";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c3390_1 = {
FETCHING: 0,
0: "FETCHING",
FETCHED: 1,
1: "FETCHED",
ERROR: 2,
2: "ERROR"
};
let c3390_2 = {};
let c3390_3 = {};
let c3390_4 = new Set();
let c3390_5 = {};
class ApplicationDirectoryApplicationsStore extends Module589.Store {
static displayName = "ApplicationDirectoryApplicationsStore";
getApplication(a0) {
if (a0 != null) {
return c3390_2[a0];
}
}
getApplicationRecord(a0) {
if (a0 != null) {
const r4 = c3390_2[a0];
if (r4 != null) {
return ApplicationRecord.createFromServer(r4);
}
}
}
getApplications() {
return c3390_2;
}
getApplicationFetchState(a0) {
if (a0 != null) {
return c3390_3[a0];
}
}
getApplicationFetchStates() {
return c3390_3;
}
isInvalidApplication(a0) {
return a0 != null && c3390_4.has(a0);
}
getInvalidApplicationIds() {
return c3390_4;
}
isFetching(a0) {
return this.getApplicationFetchState(a0) === c3390_1.FETCHING;
}
getApplicationLastFetchTime(a0) {
if (a0 != null) {
return c3390_5[a0];
}
}
}
const applicationDirectoryApplicationsStore = new ApplicationDirectoryApplicationsStore(Dispatcher, {
APPLICATION_DIRECTORY_FETCH_APPLICATION: function handleFetchAppDirectoryApplication({ applicationId }) {
const r7 = {
...c3390_3
};
r7[applicationId] = c3390_1.FETCHING;
c3390_3 = r7;
},
APPLICATION_DIRECTORY_FETCH_APPLICATION_SUCCESS: function handleFetchAppDirectoryAppSuccess({ application }) {
const r10 = {
...c3390_2
};
r10[application.id] = application;
c3390_2 = r10;
const r12 = {
...c3390_3
};
r12[application.id] = c3390_1.FETCHED;
c3390_3 = r12;
const r6 = Date.now();
const r21 = {
...c3390_5
};
r21[application.id] = r6;
c3390_5 = r21;
if (c3390_4.has(application.id)) {
c3390_4.delete(application.id);
c3390_4 = new Set(c3390_4);
}
},
APPLICATION_DIRECTORY_FETCH_APPLICATION_FAILURE: function handleFetchAppDirectoryAppFailure({ applicationId, isInvalidApplication: isInvalidApplication2 }) {
const r3 = {
...c3390_3
};
r3[applicationId] = c3390_1.ERROR;
c3390_3 = r3;
if (isInvalidApplication2) {
c3390_4.add(applicationId);
c3390_4 = new Set(c3390_4);
}
}
});
export default applicationDirectoryApplicationsStore;
export { c3390_1 as FetchState };
@@ -0,0 +1,24 @@
// Metro module 11246 (f11247).
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
const categories = [];
let c7623_1 = null;
class ApplicationDirectoryCategoriesStore extends Module589.Store {
static displayName = "ApplicationDirectoryCategoriesStore";
getLastFetchTimeMs() {
return c7623_1;
}
getCategories() {
return categories;
}
getCategory(c18682_0) {
return categories.find((category) => category.id === c18682_0);
}
}
const applicationDirectoryCategoriesStore = new ApplicationDirectoryCategoriesStore(Dispatcher, {
APPLICATION_DIRECTORY_FETCH_CATEGORIES_SUCCESS: function handleFetchAppDirectoryCategoriesSuccess(a0) {
categories = a0.categories;
c7623_1 = Date.now();
}
});
export default applicationDirectoryCategoriesStore;
@@ -0,0 +1,73 @@
// Metro module 11247 (f11248).
import Module12 from "../../../_bundle/Module12";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c7624_2 = {
FETCHING: 0,
0: "FETCHING",
FETCHED: 1,
1: "FETCHED",
ERROR: 2,
2: "ERROR"
};
let c7624_3 = [];
let c7624_4 = {};
let c7624_5 = {};
let c7624_6 = {};
class ApplicationDirectoryCollectionsStore extends Module589.Store {
getLastFetchTimeMs(a0) {
return c7624_6[`surface:${a0.surface} activeState:${a0.activeState}`];
}
getFetchState(a0) {
return c7624_5[`surface:${a0.surface} activeState:${a0.activeState}`];
}
getCollections(a0) {
let r12 = c7624_4[`surface:${a0.surface} activeState:${a0.activeState}`];
if (r12 == null) {
r12 = c7624_3;
}
return r12;
}
}
const applicationDirectoryCollectionsStore = new ApplicationDirectoryCollectionsStore(Dispatcher, {
APPLICATION_DIRECTORY_FETCH_COLLECTIONS: function handleFetchAppDirectoryCollections({ surface, activeState }) {
const r11 = {
...c7624_5
};
r11[`surface:${surface} activeState:${activeState}`] = c7624_2.FETCHING;
c7624_5 = r11;
},
APPLICATION_DIRECTORY_FETCH_COLLECTIONS_SUCCESS: function handleFetchAppDirectoryCollectionsSuccess(a0) {
const collections = a0.collections;
const r14 = `surface:${a0.surface} activeState:${a0.activeState}`;
const r24 = Module12.sortBy(collections.map((collection) => {
collection.application_directory_collection_items = Module12.sortBy(collection.application_directory_collection_items, ["position", "id"]);
return collection;
}), ["position", "id"]);
const r25 = {
...c7624_4
};
r25[r14] = r24;
c7624_4 = r25;
const r27 = {
...c7624_5
};
r27[r14] = c7624_2.FETCHED;
c7624_5 = r27;
const r35 = Date.now();
const r36 = {
...c7624_6
};
r36[r14] = r35;
c7624_6 = r36;
},
APPLICATION_DIRECTORY_FETCH_COLLECTIONS_FAILURE: function handleFetchAppDirectoryCollectionsFailure({ surface, activeState }) {
const r11 = {
...c7624_5
};
r11[`surface:${surface} activeState:${activeState}`] = c7624_2.ERROR;
c7624_5 = r11;
}
});
export default applicationDirectoryCollectionsStore;
export { c7624_2 as FetchState };
@@ -0,0 +1,58 @@
// Metro module 11242 (f11243).
import { SearchAppsRequestSource } from "../../../_bundle/Module11243";
import LRUCache from "../../../_bundle/LRUCache";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c7620_2 = {
FETCHING: 0,
0: "FETCHING",
FETCHED: 1,
1: "FETCHED",
ERROR: 2,
2: "ERROR"
};
let c7620_3 = new LRUCache({
max: 20
});
let c7620_4 = {};
class ApplicationDirectorySearchStore extends Module589.Store {
static displayName = "ApplicationDirectorySearchStore";
getSearchResults({ query, guildId, page, pageSize, categoryId, integrationType, minUserInstallCommandCount, excludeAppsWithCustomInstallUrl, excludeNonEmbeddedApps, excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand, source = SearchAppsRequestSource.APP_DIRECTORY }) {
return c7620_3.get(`query:'${query}' guildId:${guildId} page:${page} pageSize:${pageSize} categoryId:${categoryId} integrationType:${integrationType} minUserInstallCommandCount:${minUserInstallCommandCount} excludeAppsWithCustomInstallUrl:${excludeAppsWithCustomInstallUrl} excludeNonEmbeddedApps:${excludeNonEmbeddedApps} excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand:${excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand} source:${source}`);
}
getFetchState({ query, guildId, page, pageSize, categoryId, integrationType, minUserInstallCommandCount, excludeAppsWithCustomInstallUrl, excludeNonEmbeddedApps, excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand, source = SearchAppsRequestSource.APP_DIRECTORY }) {
return c7620_4[`query:'${query}' guildId:${guildId} page:${page} pageSize:${pageSize} categoryId:${categoryId} integrationType:${integrationType} minUserInstallCommandCount:${minUserInstallCommandCount} excludeAppsWithCustomInstallUrl:${excludeAppsWithCustomInstallUrl} excludeNonEmbeddedApps:${excludeNonEmbeddedApps} excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand:${excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand} source:${source}`];
}
}
const applicationDirectorySearchStore = new ApplicationDirectorySearchStore(Dispatcher, {
APPLICATION_DIRECTORY_FETCH_SEARCH: function handleSearchFetch({ query, guildId, page, pageSize, categoryId, integrationType, minUserInstallCommandCount, excludeAppsWithCustomInstallUrl, excludeNonEmbeddedApps, excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand, source = SearchAppsRequestSource.APP_DIRECTORY }) {
const r4 = `query:'${query}' guildId:${guildId} page:${page} pageSize:${pageSize} categoryId:${categoryId} integrationType:${integrationType} minUserInstallCommandCount:${minUserInstallCommandCount} excludeAppsWithCustomInstallUrl:${excludeAppsWithCustomInstallUrl} excludeNonEmbeddedApps:${excludeNonEmbeddedApps} excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand:${excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand} source:${source}`;
const r53 = {
...c7620_4
};
r53[r4] = c7620_2.FETCHING;
c7620_4 = r53;
},
APPLICATION_DIRECTORY_FETCH_SEARCH_SUCCESS: function handleSearchFetchSuccess({ query, guildId, page, pageSize, categoryId, result, integrationType, minUserInstallCommandCount, excludeAppsWithCustomInstallUrl, excludeNonEmbeddedApps, excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand, source = SearchAppsRequestSource.APP_DIRECTORY }) {
const r4 = `query:'${query}' guildId:${guildId} page:${page} pageSize:${pageSize} categoryId:${categoryId} integrationType:${integrationType} minUserInstallCommandCount:${minUserInstallCommandCount} excludeAppsWithCustomInstallUrl:${excludeAppsWithCustomInstallUrl} excludeNonEmbeddedApps:${excludeNonEmbeddedApps} excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand:${excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand} source:${source}`;
c7620_3.set(r4, {
lastFetchTimeMs: Date.now(),
...result
});
const r62 = {
...c7620_4
};
r62[r4] = c7620_2.FETCHED;
c7620_4 = r62;
},
APPLICATION_DIRECTORY_FETCH_SEARCH_FAILURE: function handleSearchFetchFailure({ query, guildId, page, pageSize, categoryId, integrationType, minUserInstallCommandCount, excludeAppsWithCustomInstallUrl, excludeNonEmbeddedApps, excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand, source = SearchAppsRequestSource.APP_DIRECTORY }) {
const r4 = `query:'${query}' guildId:${guildId} page:${page} pageSize:${pageSize} categoryId:${categoryId} integrationType:${integrationType} minUserInstallCommandCount:${minUserInstallCommandCount} excludeAppsWithCustomInstallUrl:${excludeAppsWithCustomInstallUrl} excludeNonEmbeddedApps:${excludeNonEmbeddedApps} excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand:${excludeEmbeddedAppsWithoutPrimaryEntryPointAppCommand} source:${source}`;
const r53 = {
...c7620_4
};
r53[r4] = c7620_2.ERROR;
c7620_4 = r53;
}
});
export default applicationDirectorySearchStore;
export { c7620_2 as FetchState };
@@ -0,0 +1,66 @@
// Metro module 11248 (f11249).
import LRUCache from "../../../_bundle/LRUCache";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c7625_0 = {
NOT_FETCHED: 0,
0: "NOT_FETCHED",
FETCHING: 1,
1: "FETCHING",
FETCHED: 2,
2: "FETCHED",
ERROR: 3,
3: "ERROR"
};
let c7625_1 = new LRUCache({
max: 20
});
let c7625_2 = {};
class ApplicationDirectorySimilarApplicationsStore extends Module589.Store {
static displayName = "ApplicationDirectorySimilarApplicationsStore";
getSimilarApplications({ applicationId, guildId, page }) {
if (applicationId != null) {
return c7625_1.get(`applicationId:${applicationId} guildId:${guildId} page:${page}`);
}
}
getFetchState({ applicationId, guildId, page }) {
if (applicationId != null) {
return c7625_2[`applicationId:${applicationId} guildId:${guildId} page:${page}`];
}
}
}
const applicationDirectorySimilarApplicationsStore = new ApplicationDirectorySimilarApplicationsStore(Dispatcher, {
APPLICATION_DIRECTORY_FETCH_SIMILAR_APPLICATIONS: function handleFetchSimilarApplications(a0) {
const r4 = `applicationId:${a0.applicationId} guildId:${a0.guildId} page:${a0.page}`;
const r17 = {
...c7625_2
};
r17[r4] = c7625_0.FETCHING;
c7625_2 = r17;
},
APPLICATION_DIRECTORY_FETCH_SIMILAR_APPLICATIONS_SUCCESS: function handleFetchSimilarApplicationsSuccess({ applicationId, guildId, similarApplications, loadId, page, totalPages }) {
const r4 = `applicationId:${applicationId} guildId:${guildId} page:${page}`;
c7625_1.set(r4, {
lastFetchTimeMs: Date.now(),
applications: similarApplications,
loadId,
page,
totalPages
});
const r25 = {
...c7625_2
};
r25[r4] = c7625_0.FETCHED;
c7625_2 = r25;
},
APPLICATION_DIRECTORY_FETCH_SIMILAR_APPLICATIONS_FAILURE: function handleFetchSimilarApplicationsFailure(a0) {
const r4 = `applicationId:${a0.applicationId} guildId:${a0.guildId} page:${a0.page}`;
const r17 = {
...c7625_2
};
r17[r4] = c7625_0.ERROR;
c7625_2 = r17;
}
});
export default applicationDirectorySimilarApplicationsStore;
export { c7625_0 as FetchState };
@@ -0,0 +1,111 @@
// Metro module 11249 (f11250).
import Durations from "../../../utils/Durations";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c7626_2, c7626_3;
const addToApplicationIdToGuildIds = function addToApplicationIdToGuildIds({ applicationId, guildId }) {
if (c7626_3.applicationIdToGuildIds[applicationId] == null) {
c7626_3.applicationIdToGuildIds[applicationId] = new Set();
}
c7626_3.applicationIdToGuildIds[applicationId].add(guildId);
c7626_3.applicationIdToGuildIds[applicationId] = new Set(c7626_3.applicationIdToGuildIds[applicationId]);
};
c7626_2 = {
NOT_FETCHED: 0,
0: "NOT_FETCHED",
FETCHING: 1,
1: "FETCHING",
FETCHED: 2,
2: "FETCHED",
ERROR: 3,
3: "ERROR"
};
c7626_3 = {
applicationIdToGuildIds: {},
lastFetchTimeMs: null,
nextFetchRetryTimeMs: null,
fetchState: c7626_2.NOT_FETCHED
};
class MyGuildApplicationsStore extends Module589.PersistedStore {
static displayName = "MyGuildApplicationsStore";
static persistKey = "MyGuildApplicationsStore";
initialize(a0) {
if (a0 != null) {
c7626_3.lastFetchTimeMs = a0.lastFetchTimeMs;
c7626_3.nextFetchRetryTimeMs = a0.nextFetchRetryTimeMs;
c7626_3.fetchState = a0.fetchState;
const applicationIdToGuildIds = a0.applicationIdToGuildIds;
for (const key in applicationIdToGuildIds) {
c7626_3.applicationIdToGuildIds[key] = new Set(a0.applicationIdToGuildIds[key]);
}
}
}
getState() {
return c7626_3;
}
getGuildIdsForApplication(a0) {
if (a0 != null) {
return c7626_3.applicationIdToGuildIds[a0];
}
}
getLastFetchTimeMs() {
return c7626_3.lastFetchTimeMs;
}
getNextFetchRetryTimeMs() {
return c7626_3.nextFetchRetryTimeMs;
}
getFetchState() {
return c7626_3.fetchState;
}
}
const myGuildApplicationsStore = new MyGuildApplicationsStore(Dispatcher, {
LOGOUT: function handleLogout() {
c7626_3.applicationIdToGuildIds = {};
c7626_3.lastFetchTimeMs = null;
c7626_3.nextFetchRetryTimeMs = null;
c7626_3.fetchState = c7626_2.NOT_FETCHED;
},
FETCH_INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS: function handleGuildApplicationsFetch() {
c7626_3.fetchState = c7626_2.FETCHING;
},
FETCH_INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS_SUCCESS: function handleGuildApplicationsFetchSuccess({ guildIdToApplicationIds }) {
c7626_3.fetchState = c7626_2.FETCHED;
c7626_3.lastFetchTimeMs = Date.now();
c7626_3.applicationIdToGuildIds = {};
c7626_3.nextFetchRetryTimeMs = null;
for (const key in guildIdToApplicationIds) {
const guildId = key;
for (const item of guildIdToApplicationIds[guildId]) {
addToApplicationIdToGuildIds({
applicationId: item,
guildId
});
}
}
},
FETCH_INTEGRATION_APPLICATION_IDS_FOR_MY_GUILDS_FAILURE: function handleGuildApplicationsFetchFailure({ retryAfterSeconds }) {
c7626_3.fetchState = c7626_2.ERROR;
if (retryAfterSeconds != null) {
const r14 = retryAfterSeconds * Durations.Millis.SECOND;
c7626_3.nextFetchRetryTimeMs = Date.now() + r14;
}
},
INTEGRATION_CREATE: function handleIntegrationCreate({ application, guildId }) {
if (application != null) {
const id = application.id;
if (c7626_3.applicationIdToGuildIds[id] == null) {
c7626_3.applicationIdToGuildIds[id] = new Set();
}
c7626_3.applicationIdToGuildIds[id].add(guildId);
c7626_3.applicationIdToGuildIds[id] = new Set(c7626_3.applicationIdToGuildIds[id]);
}
},
INTEGRATION_DELETE: function handleIntegrationDelete({ applicationId, guildId }) {
if (applicationId != null && c7626_3.applicationIdToGuildIds[applicationId] != null) {
c7626_3.applicationIdToGuildIds[applicationId].delete(guildId);
c7626_3.applicationIdToGuildIds[applicationId] = new Set(c7626_3.applicationIdToGuildIds[applicationId]);
}
}
});
export default myGuildApplicationsStore;
export { c7626_2 as FetchState };
@@ -0,0 +1,13 @@
// Metro module 11298 (f11299).
import { Endpoints } from "../../../Constants";
import { getBestMediaProxySize, getDevicePixelRatio } from "../../image_upload/ImageLoaderUtils";
import { SUPPORTS_WEBP } from "../../../utils/AvatarUtils";
const GLOBAL_ENV = window.GLOBAL_ENV;
const { API_ENDPOINT, CDN_HOST } = GLOBAL_ENV;
export function getCollectionItemAssetUrl({ itemId, hash, containerWidth = 1024 }) {
const r11 = new URLSearchParams({
size: getBestMediaProxySize(containerWidth * getDevicePixelRatio()).toString()
}).toString();
const r10 = SUPPORTS_WEBP ? "webp" : "png";
return CDN_HOST != null ? `https://${CDN_HOST}/app-assets/application-directory/collection-items/${itemId}/${hash}.${r10}?${r11}` : `${location.protocol}${API_ENDPOINT}${Endpoints.APPLICATION_DIRECTORY_COLLECTION_ITEM_IMAGE(itemId, hash, r10)}?${r11}`;
}