// Metro module 11527 (f11528). import { memo, useCallback } from "react"; import ChannelStore from "../../../stores/ChannelStore"; import UserStore from "../../../stores/UserStore"; import LurkingStore from "../LurkingStore"; import { JoinGuildSources } from "../../../Constants"; import { useStateFromStores } from "../../../_bundle/Module589"; import { setHubProgressActionComplete } from "../../hub/HubProgressActionCreators"; import { HubProgressStep } from "../../../_bundle/Module1306"; import { trackJoinClicked } from "../LurkerPreviewAnalytics"; import LurkerPreviewManager from "../LurkerPreviewManager"; import GuildActionCreators from "../../../actions/GuildActionCreators"; import { Button } from "../../../design/components/Button/native/Button.native"; import { intl, t } from "../../../intl/index.native"; import AvatarUtils from "../../../utils/AvatarUtils"; import UserUtils from "../../../utils/UserUtils"; const r29 = memo(function LurkerServerPreviewJoinButton(props) { const { guildId, joinSource, onBeforeJoin } = props; const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser()); const callback = useCallback(() => { const lurkingSourceForGuild = LurkingStore.getLurkingSourceForGuild(guildId); if (lurkingSourceForGuild?.type === JoinGuildSources.DIRECTORY_ENTRY) { const channel = ChannelStore.getChannel(lurkingSourceForGuild.directoryChannelId); if (channel != null) { setHubProgressActionComplete(channel.getGuildId(), HubProgressStep.JOIN_GUILD); } } trackJoinClicked(guildId, joinSource, LurkerPreviewManager.hasNavigatedAway(guildId)); if (onBeforeJoin != null) { onBeforeJoin(); } GuildActionCreators.joinGuild(guildId, { source: joinSource }); }, [guildId, joinSource, onBeforeJoin]); if (stateFromStores == null) { return