Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
116 lines
3.7 KiB
TypeScript
116 lines
3.7 KiB
TypeScript
// Module ID: 13934
|
|
// Function ID: 13935
|
|
// Name: MidjourneyOnboardingUtils
|
|
// Dependencies: [1979, 4426, 13935, 504, 2]
|
|
// Exports: hasRedirectedToGuild, isEligibleForMidjourneyRedirect, isMidjourneyOnboardingFlow, useIsMidjourneyOnboardingFlow
|
|
|
|
// Module 13934 (MidjourneyOnboardingUtils)
|
|
import initialize from "initialize" /* 504 */;
|
|
import GuildStore from "GuildStore" /* 1979 */;
|
|
import SelectedGuildStore from "SelectedGuildStore" /* 4426 */;
|
|
|
|
require = fn;
|
|
const MidjourneyOnboardingConstants = fn(13935);
|
|
({ MIDJOURNEY_BOT_ID: closure_4, MIDJOURNEY_GUILD_ID: hasOwnProperty } = MidjourneyOnboardingConstants);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/midjourney_onboarding/MidjourneyOnboardingUtils.tsx");
|
|
|
|
export const isMidjourneyOnboardingFlow = function isMidjourneyOnboardingFlow() {
|
|
let obj = arg0;
|
|
if (arg0 === undefined) {
|
|
obj = {};
|
|
}
|
|
let guildStore = obj.guildStore;
|
|
if (guildStore == null) {
|
|
guildStore = GuildStore;
|
|
}
|
|
const guild = guildStore.getGuild(hasOwnProperty);
|
|
let joinedAt1;
|
|
if (guild != null) {
|
|
joinedAt1 = guild.joinedAt;
|
|
}
|
|
let tmp3 = joinedAt1 instanceof Date;
|
|
if (tmp3) {
|
|
const _Date = Date;
|
|
const joinedAt = guild.joinedAt;
|
|
const timestamp = Date.now();
|
|
tmp3 = timestamp - joinedAt.getTime() <= 3600000;
|
|
}
|
|
return 1 === guildStore.getGuildCount() && tmp3;
|
|
};
|
|
export const useIsMidjourneyOnboardingFlow = function useIsMidjourneyOnboardingFlow() {
|
|
const items = [GuildStore];
|
|
return initialize.useStateFromStores(items, () => {
|
|
guildStore = { guildStore }.guildStore;
|
|
const guild = guildStore.getGuild(closure_1_5);
|
|
let joinedAt1;
|
|
if (guild != null) {
|
|
joinedAt1 = guild.joinedAt;
|
|
}
|
|
let tmp3 = joinedAt1 instanceof Date;
|
|
if (tmp3) {
|
|
const _Date = Date;
|
|
const joinedAt = guild.joinedAt;
|
|
const timestamp = Date.now();
|
|
tmp3 = timestamp - joinedAt.getTime() <= 3600000;
|
|
}
|
|
return 1 === guildStore.getGuildCount() && tmp3;
|
|
}, []);
|
|
};
|
|
export const isEligibleForMidjourneyRedirect = function isEligibleForMidjourneyRedirect(channel) {
|
|
let isDMResult = channel.isDM();
|
|
if (isDMResult) {
|
|
isDMResult = 1 === channel.rawRecipients.length;
|
|
}
|
|
if (isDMResult) {
|
|
isDMResult = channel.rawRecipients[0].id === React4;
|
|
}
|
|
if (isDMResult) {
|
|
let guildStore = {}.guildStore;
|
|
if (guildStore == null) {
|
|
guildStore = GuildStore;
|
|
}
|
|
const guild = guildStore.getGuild(hasOwnProperty);
|
|
let joinedAt1;
|
|
if (guild != null) {
|
|
joinedAt1 = guild.joinedAt;
|
|
}
|
|
const _Date = Date;
|
|
let tmp8 = joinedAt1 instanceof Date;
|
|
if (tmp8) {
|
|
const _Date2 = Date;
|
|
const joinedAt = guild.joinedAt;
|
|
const timestamp = Date.now();
|
|
tmp8 = timestamp - joinedAt.getTime() <= 3600000;
|
|
}
|
|
isDMResult = 1 === guildStore.getGuildCount() && tmp8;
|
|
const tmp10 = 1 === guildStore.getGuildCount() && tmp8;
|
|
}
|
|
return isDMResult;
|
|
};
|
|
export const hasRedirectedToGuild = function hasRedirectedToGuild(arg0) {
|
|
closure_0 = arg0;
|
|
return new Promise((fn, arg1) => {
|
|
closure_0 = fn;
|
|
closure_1 = arg1;
|
|
function handleSelectedGuildUpdate() {
|
|
if (SelectedGuildStore.getGuildId() === closure_0) {
|
|
SelectedGuildStore.removeChangeListener(handleSelectedGuildUpdate);
|
|
const _clearTimeout = clearTimeout;
|
|
clearTimeout(closure_2);
|
|
closure_0();
|
|
}
|
|
}
|
|
if (guildId.getGuildId() !== closure_0) {
|
|
const _setTimeout = setTimeout;
|
|
const timeout = setTimeout(() => {
|
|
SelectedGuildStore.removeChangeListener(handleSelectedGuildUpdate);
|
|
clearTimeout(closure_2);
|
|
closure_1();
|
|
}, 3000);
|
|
guildId.addChangeListener(handleSelectedGuildUpdate);
|
|
} else {
|
|
fn();
|
|
}
|
|
});
|
|
};
|