// Metro module 7937 (f7938). import { useCallback } from "react"; import UserProfileSettingsStore from "../UserProfileSettingsStore"; import useTrackCollectiblesItemTryOut from "../../collectibles/hooks/useTrackCollectiblesItemTryOut"; import { useStateFromStoresObject } from "../../../_bundle/defaultAreStatesEqual"; import { setPendingChanges } from "../UserProfileSettingsActionCreators"; import { announcePendingAvatarChange } from "../../profile_customization/ProfileCustomizationUtils"; import { setTryItOutAvatar, setTryItOutAvatarDecoration } from "../UserProfileActionCreators"; export default function usePendingAvatarSettings({ isTryItOut, analyticsLocations, guildId }) { const trackCollectiblesItemTryOut = useTrackCollectiblesItemTryOut(analyticsLocations); let c16110_2 = trackCollectiblesItemTryOut; const stateFromStoresObject = useStateFromStoresObject([UserProfileSettingsStore], () => { if (isTryItOut) { const tryItOutChanges = UserProfileSettingsStore.getTryItOutChanges(); return { pendingAvatar: tryItOutChanges.tryItOutAvatar, pendingAvatarDecoration: tryItOutChanges.tryItOutAvatarDecoration, pendingErrors: UserProfileSettingsStore.getErrors(guildId).avatarDecoration }; } const pendingChanges = UserProfileSettingsStore.getPendingChanges(guildId); return { pendingAvatar: pendingChanges.pendingAvatar, pendingAvatarDecoration: pendingChanges.pendingAvatarDecoration, pendingErrors: UserProfileSettingsStore.getErrors(guildId).avatarDecoration }; }); const { pendingAvatar, pendingAvatarDecoration, pendingErrors } = stateFromStoresObject; let setPendingAvatar = useCallback((a0) => { setPendingChanges({ guildId, avatar: a0 }); announcePendingAvatarChange(a0 == null ? "remove" : "set"); }, [guildId]); let setPendingAvatarDecoration = useCallback((a0) => { setPendingChanges({ guildId, avatarDecoration: a0 }); if (a0 != null) { c16110_2(a0); } }, [trackCollectiblesItemTryOut, guildId]); if (isTryItOut) { setPendingAvatar = setTryItOutAvatar; } if (isTryItOut) { setPendingAvatarDecoration = setTryItOutAvatarDecoration; } return { pendingAvatar, pendingAvatarDecoration, pendingErrors, setPendingAvatar, setPendingAvatarDecoration }; };