101 lines
3.4 KiB
TypeScript
101 lines
3.4 KiB
TypeScript
// Metro module 6687 (f6688).
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import SocialLayerStorefrontStore from "./SocialLayerStorefrontStore";
|
|
import { GuildFeatures, Routes } from "../../Constants";
|
|
import { fetchSocialLayerStorefront, fetchSocialLayerStorefrontForApplication } from "./SocialLayerStorefrontActionCreators";
|
|
import { getSocialLayerStorefrontGuildId } from "./SlayerStorefrontUtils";
|
|
import { transitionTo } from "../routing/router_utils";
|
|
import { startLurking } from "../../utils/GuildDiscoveryUtils";
|
|
import InstantInviteActionCreators from "../../actions/InstantInviteActionCreators";
|
|
const navigateToSocialLayerStorefrontWithGuildPreview = async function navigateToSocialLayerStorefrontWithGuildPreview(c25948_0) {
|
|
let r95;
|
|
let c25948_2;
|
|
let c29812_0, c29812_1, c29812_2, c29812_3, c29812_4, c29812_5, c29812_6;
|
|
L28: {
|
|
c25948_2 = void 0;
|
|
c29812_0 = void 0;
|
|
c29812_1 = void 0;
|
|
c29812_2 = void 0;
|
|
c29812_3 = void 0;
|
|
c29812_4 = void 0;
|
|
c29812_0 = c25948_0.guildId;
|
|
c29812_1 = c25948_0.invite;
|
|
c29812_2 = c25948_0.pageIndex;
|
|
c29812_3 = c25948_0.skuId;
|
|
c29812_4 = c25948_0.slug;
|
|
c29812_5 = void 0;
|
|
c29812_6 = void 0;
|
|
await void 0;
|
|
c29812_5 = null;
|
|
if (c29812_1 != null) {
|
|
c29812_0 = c29812_1.guild?.id;
|
|
c29812_5 = new Set(c29812_1.guild?.features);
|
|
}
|
|
if (c29812_0 != null) {
|
|
c29812_6 = GuildStore.getGuild(c29812_0);
|
|
const joinedAt = c29812_6?.joinedAt;
|
|
L20: {
|
|
if (joinedAt == null) {
|
|
if (c29812_5 != null && !c29812_5.has(GuildFeatures.PREVIEW_ENABLED)) {
|
|
if (c29812_1 != null) {
|
|
await InstantInviteActionCreators.acceptInvite({
|
|
inviteKey: c29812_1.code,
|
|
context: {
|
|
location: "game_shop"
|
|
},
|
|
skipOnboarding: true
|
|
});
|
|
break L20;
|
|
}
|
|
break L20;
|
|
}
|
|
await startLurking(c29812_0, {}, {
|
|
shouldNavigate: false
|
|
});
|
|
}
|
|
}
|
|
r95 = transitionTo(Routes.CHANNELS_GAME_SHOP(c29812_0, c29812_2, c29812_3, c29812_4));
|
|
break L28;
|
|
}
|
|
return void 0;
|
|
}
|
|
return r95;
|
|
};
|
|
export default function navigateToSocialLayerStorefront({ applicationId, guildId, pageIndex, invite, skuId, slug }) {
|
|
let r9 = applicationId;
|
|
if (r9 == null) {
|
|
r9 = SocialLayerStorefrontStore.getApplicationIdFromGuildId(guildId);
|
|
}
|
|
let guildId2 = guildId;
|
|
if (guildId2 == null) {
|
|
guildId2 = getSocialLayerStorefrontGuildId(applicationId);
|
|
}
|
|
return r9 == null && (guildId2 == null && invite == null) ? Promise.resolve() : r9 != null ? Promise.resolve(transitionTo(Routes.COLLECTIBLES_SHOP_GAME_SHOP(r9, pageIndex, skuId, slug))) : navigateToSocialLayerStorefrontWithGuildPreview({
|
|
guildId: guildId2,
|
|
pageIndex,
|
|
invite,
|
|
skuId,
|
|
slug
|
|
});
|
|
};
|
|
export function eagerNavigateToSocialLayerStorefront(a0) {
|
|
let guildId = a0.guildId;
|
|
const { invite, forceFetch } = a0;
|
|
if (invite != null) {
|
|
guildId = invite.guild?.id;
|
|
}
|
|
if (guildId != null) {
|
|
fetchSocialLayerStorefront(guildId, {
|
|
eager: true,
|
|
forceFetch
|
|
});
|
|
}
|
|
}
|
|
export function eagerNavigateToSocialLayerStorefrontForApplication(a0) {
|
|
fetchSocialLayerStorefrontForApplication(a0.applicationId, {
|
|
eager: true,
|
|
forceFetch: a0.forceFetch
|
|
});
|
|
}
|
|
export { navigateToSocialLayerStorefrontWithGuildPreview };
|