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,60 @@
// Metro module 12194 (f12195).
import { PROFILE_SIDE_PADDING } from "../../native/Constants";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
export default function useCardGridLayout(r9 = {}) {
const { minCardSize = 150, maxCardSize = 180, gap = 16 } = r9;
let containerWidth = r9.containerWidth;
let maxWidth = r9.maxWidth;
let sidePadding = r9.sidePadding;
if (sidePadding === void 0) {
sidePadding = PROFILE_SIDE_PADDING;
}
const width = useWindowDimensions_native().width;
const r13 = Math;
if (containerWidth == null) {
containerWidth = width;
}
if (maxWidth == null) {
maxWidth = Infinity;
}
const r6 = r13.min(containerWidth, maxWidth) - 2 * sidePadding;
const r37 = Math.max(1, Math.floor((r6 + gap) / (minCardSize + gap)));
const r2 = (r6 - gap * 0) / 1;
const r40 = r2 > maxCardSize;
let r5 = r2;
let columns = 1;
if (r40) {
const r42 = 1 < r37;
let r1 = 1;
r5 = r2;
columns = 1;
if (r42) {
do {
const r43 = r1 + 1;
const r46 = (r6 - gap * (r43 - 1)) / r43;
r5 = r46;
columns = r43;
if (!(r46 > maxCardSize)) {
break;
}
r1 = r43;
r5 = r46;
columns = r1;
} while (columns < r37);
}
}
const cardWidth = Math.min(Math.max(r5, minCardSize), maxCardSize);
const r53 = cardWidth * columns;
const r54 = columns - 1;
return r6 < r53 + gap * r54 ? {
columns: 1,
cardWidth: void 0,
rowWidth: void 0,
gap
} : {
columns,
cardWidth,
rowWidth: cardWidth * columns + gap * r54,
gap
};
};
@@ -0,0 +1,53 @@
// Metro module 12177 (f12178).
import { useState, useCallback } from "react";
import { UserProfileSections } from "../../Constants";
export function useProfileTabIndices(a0, a1) {
let wishlistTabIndex2 = -1;
const boardTabIndex2 = a0 ? 1 : -1;
if (a1) {
wishlistTabIndex2 = a0 ? 2 : 1;
}
return {
boardTabIndex: boardTabIndex2,
wishlistTabIndex: wishlistTabIndex2
};
}
export function useProfileSectionTabs({ initialUserProfileSection, wishlistTabIndex, boardTabIndex, onTabChange }) {
let setState, c19700_5;
setState = void 0;
c19700_5 = void 0;
let activeProfileTabSection;
[activeProfileTabSection, setState] = useState(() => {
if (UserProfileSections.WISHLIST === initialUserProfileSection) {
return UserProfileSections.WISHLIST;
}
if (UserProfileSections.WIDGETS === initialUserProfileSection) {
return UserProfileSections.WIDGETS;
}
return UserProfileSections.MAIN;
});
const r19 = UserProfileSections.WISHLIST !== activeProfileTabSection ? UserProfileSections.WIDGETS !== activeProfileTabSection ? UserProfileSections.MAIN === activeProfileTabSection ? 0 : void 0 : boardTabIndex : wishlistTabIndex;
if (r19 < 0) {
setState(UserProfileSections.MAIN);
}
const activeProfileTabSectionIndex = r19 >= 0 ? r19 : 0;
c19700_5 = activeProfileTabSectionIndex;
return {
activeProfileTabSection,
setActiveProfileTabSection: setState,
handleTabChange: useCallback((a0) => {
const r8 = wishlistTabIndex === a0 ? UserProfileSections.WISHLIST : boardTabIndex === a0 ? UserProfileSections.WIDGETS : UserProfileSections.MAIN;
setState(r8);
if (onTabChange != null) {
onTabChange(r8);
}
}, [wishlistTabIndex, boardTabIndex, onTabChange]),
restoreActiveIndex: useCallback((a0) => {
const r5 = a0.activeIndex.get();
if (r5 !== c19700_5) {
a0.setActiveIndex(c19700_5, false, true);
}
}, [activeProfileTabSectionIndex]),
activeProfileTabSectionIndex
};
}
@@ -0,0 +1,41 @@
// Metro module 13706 (f13707).
import { useRef, useEffect } from "react";
import { findNodeHandle } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import ProfileCustomizationNavigationStore from "../../../profile_customization/ProfileCustomizationNavigationStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useScrollToUserProfileEditFormSection(c20652_0, c20652_1) {
const ref = useRef({});
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
useEffect(() => {
let r1 = c20652_1 != null;
if (r1) {
const current = ref.current;
r1 = (current == null ? void 0 : current[c20652_1]) != null;
}
if (r1) {
setTimeout(() => {
const r6 = ref.current[c20652_1];
const r11 = findNodeHandle(c20652_0.current);
if (r11 != null) {
if (r6 != null) {
r6.measureLayout(r11, (a0, a1) => {
const current = c20652_0.current;
if (current != null) {
current.scrollTo({
x: a0,
y: a1,
animated: !stateFromStores
});
}
});
}
ProfileCustomizationNavigationStore.setState({
scrollPosition: null
});
}
}, 0);
}
});
return ref;
};
@@ -0,0 +1,22 @@
// Metro module 12014 (f12015).
import { useEffect, useState } from "react";
import ContentInventoryOutboxStore from "../../../content_inventory/ContentInventoryOutboxStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useTrackUserProfileActivityView({ userId, onAction }) {
let setState, c19333_3;
setState = void 0;
c19333_3 = void 0;
const stateFromStores = useStateFromStores([ContentInventoryOutboxStore], () => ContentInventoryOutboxStore.isFetchingUserOutbox(userId));
let state;
[state, setState] = useState(false);
const r24 = stateFromStores ? !stateFromStores : !state;
c19333_3 = r24;
useEffect(() => {
if (c19333_3) {
onAction({
action: "VIEW_ACTIVITY_CARD"
});
setState(true);
}
}, [r24, onAction]);
};
@@ -0,0 +1,33 @@
// Metro module 12196 (f12197).
import { useEffect, useRef } from "react";
import WishlistStore from "../../../wishlists/WishlistStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function useTrackUserProfileWishlistView({ wishlistId, onAction, productLines, isVisible = true }) {
let ref;
let c19721_3 = isVisible;
ref = void 0;
const stateFromStores = useStateFromStores([WishlistStore], () => WishlistStore.isFetching(wishlistId));
ref = useRef(false);
useEffect(() => {
if (c19721_3) {
let r6 = stateFromStores;
if (!stateFromStores) {
r6 = ref.current;
}
if (!r6) {
let productLines2 = productLines;
if (productLines == null) {
productLines2 = void 0;
}
onAction({
action: "VIEW_WISHLIST",
wishlistId,
productLines: productLines2
});
ref.current = true;
}
} else {
ref.current = false;
}
}, [isVisible, stateFromStores, onAction, wishlistId, productLines]);
};
@@ -0,0 +1,86 @@
// Metro module 13708 (f13709).
import { useCallback } from "react";
import UserStore from "../../../../stores/UserStore";
import { Base64GIFPrefix, UpsellTypes, AnalyticsPages, AnalyticsSections, UPLOAD_MEDIUM_SIZE } from "../../../../Constants";
import { PremiumUpsellTypes } from "../../../premium/PremiumConstants";
import { useStateFromStores } from "../../../../_bundle/defaultAreStatesEqual";
import PremiumUpsellUtils from "../../../../utils/native/PremiumUpsellUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import UploadUtils from "../../../../utils/native/UploadUtils";
import PremiumUtils from "../../../../utils/PremiumUtils";
import { createPendingImage, generateAvatarDescription } from "../../../recent_avatars/RecentAvatarUtils";
import { setTryItOutAvatar } from "../../UserProfileActionCreators";
import { setPendingChanges } from "../../UserProfileSettingsActionCreators";
import { announcePendingAvatarChange } from "../../../profile_customization/ProfileCustomizationUtils";
function $mk116575($env) {
return function isGIF(a0) {
return a0.match(new RegExp("^" + Base64GIFPrefix, "i")) != null;
};
}
let env9523 = {};
export default function useUploadAvatar(a0) {
let c20654_4;
const { guildId, isTryItOut = false } = a0;
let c20654_1 = isTryItOut;
const analyticsLocations = a0.analyticsLocations;
c20654_4 = void 0;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const callback = useCallback(() => {
PremiumUpsellUtils.handleShowUpsellAlert({
initialUpsellKey: UpsellTypes.ANIMATED_AVATAR,
analyticsLocation: {
page: AnalyticsPages.USER_SETTINGS,
section: AnalyticsSections.SETTINGS_OVERVIEW
},
analyticsProperties: {
type: PremiumUpsellTypes.ANIMATED_USER_AVATAR_MODAL
},
analyticsLocations
});
}, [analyticsLocations]);
c20654_4 = callback;
return useCallback(async () => {
let c27564_0, c27564_1;
L18: {
let env30663;
c27564_1 = void 0;
const r25 = env30663 = {
$parent: env9523
};
c27564_0 = r25;
env30663[0] = void 0;
env30663[1] = void 0;
env30663[2] = void 0;
env30663[3] = void 0;
env30663[4] = void 0;
ActionSheetActionCreators.hideActionSheet();
env30663[0] = await UploadUtils.openImagePicker({
size: UPLOAD_MEDIUM_SIZE
});
env30663[1] = env30663[0].base64;
env30663[2] = env30663[0].originalMd5;
if (env30663[1] != null) {
env30663[3] = c20654_1 || PremiumUtils.canUseAnimatedAvatar(stateFromStores);
const r64 = env30663[1];
if ($mk116575(env9523)(r64) && !env30663[3]) {
(0, c20654_4)();
break L18;
}
env30663[4] = createPendingImage({
imageUri: env30663[1],
description: generateAvatarDescription(),
originalMd5: env30663[2]
});
if (c20654_1) {
setTryItOutAvatar(env30663[4]);
} else {
setPendingChanges({
guildId,
avatar: env30663[4]
});
announcePendingAvatarChange("set");
}
}
}
}, [stateFromStores, guildId, isTryItOut, callback]);
};
@@ -0,0 +1,34 @@
// Metro module 8362 (f8363).
import { useMemo } from "react";
import { UserProfileAnalyticsTypes } from "../../Constants";
export default function useUserProfileAnalyticsProperties({ userId, user, channelId, guildId, displayProfile, guildMember, profileEffectSkuId, type }) {
let memo2;
memo2 = void 0;
const memo = useMemo(() => {
let type2 = type;
if (type == null) {
type2 = UserProfileAnalyticsTypes.USER_SHEET;
}
return {
type: type2,
other_user_id: userId,
channel_id: channelId,
guild_id: guildId,
profile_has_nitro_customization: displayProfile != null && (displayProfile == null ? void 0 : displayProfile.hasPremiumCustomization()),
profile_has_theme_color_customized: displayProfile != null && displayProfile.hasThemeColors(),
profile_has_theme_animation: displayProfile?.popoutAnimationParticleType != null,
has_avatar_decoration: Boolean(guildMember?.avatarDecoration) || Boolean(user?.avatarDecoration),
has_profile_effect: profileEffectSkuId != null
};
}, [userId, channelId, guildId, displayProfile, guildMember?.avatarDecoration, user?.avatarDecoration, profileEffectSkuId, type]);
memo2 = useMemo(() => ({
has_nickname: Boolean(guildMember?.nick),
has_guild_member_avatar: Boolean(guildMember?.avatar),
has_guild_member_banner: displayProfile == null ? void 0 : displayProfile.isUsingGuildMemberBanner(),
has_guild_member_bio: displayProfile == null ? void 0 : displayProfile.isUsingGuildMemberBio()
}), [displayProfile, guildMember]);
return useMemo(() => guildId == null ? memo : {
...memo,
...memo2
}, [guildId, memo, memo2]);
};
@@ -0,0 +1,7 @@
// Metro module 8367 (f8368).
import { BANNER_ASPECT_RATIO } from "../../native/Constants";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
export default function useUserProfileBannerHeight(a0) {
const width = useWindowDimensions_native().width;
return Math.round((a0 != null ? Math.min(width, a0) : width) / BANNER_ASPECT_RATIO);
};
@@ -0,0 +1,47 @@
// Metro module 8081 (f8082).
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { ThemeTypes } from "../../../../_bundle/Module505";
import useTheme from "../../../../hooks/useTheme";
import { useProfileThemeValues } from "../../useProfileThemeValues.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import MobileVisualRefreshExperiment from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import { calculateOverlayedColor } from "../../UserProfileGradientUtils";
import { int2hex } from "../../../../_bundle/int2hslRaw";
export function useUserProfileColors({ theme, primaryColor, secondaryColor }) {
const theme2 = useTheme();
const profileThemeValues = useProfileThemeValues(theme);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.syncProfileThemeWithUserTheme);
const r31 = MobileVisualRefreshExperiment("useUserProfileColors");
const r39 = {
gradientFallbackBackground: useToken(Module712.colors.USER_PROFILE_GRADIENT_BACKGROUND, theme2),
gradientSecondaryBackground: useToken(Module712.colors.USER_PROFILE_GRADIENT_BACKGROUND, theme2),
containerBackground: useToken(r31 ? Module712.colors.CARD_MUTED_BG : Module712.colors.USER_PROFILE_CONTAINER_BACKGROUND, theme2),
containerBorderColor: useToken(Module712.colors.BORDER_MUTED, theme2),
avatarBackground: useToken(Module712.colors.BACKGROUND_BASE_LOWER, theme2),
statusBackground: useToken(Module712.colors.BACKGROUND_SURFACE_HIGH, theme2)
};
let containerBackground = useToken(Module712.colors.BACKGROUND_MOD_NORMAL, theme);
let OPACITY_WHITE_24 = Module712.unsafe_rawColors.OPACITY_WHITE_24;
if (theme === ThemeTypes.LIGHT) {
if (r31) {
OPACITY_WHITE_24 = r39.containerBackground;
}
containerBackground = OPACITY_WHITE_24;
} else if (r31) {
containerBackground = r39.containerBackground;
}
if (primaryColor != null && secondaryColor != null && profileThemeValues != null) {
const { sectionBox, overlay, overlaySyncedWithUserTheme } = profileThemeValues;
const r100 = calculateOverlayedColor(primaryColor, stateFromStores ? overlaySyncedWithUserTheme : overlay);
return {
...r39,
containerBackground,
gradientSecondaryBackground: int2hex(calculateOverlayedColor(secondaryColor, overlay)),
avatarBackground: int2hex(r100),
statusBackground: int2hex(calculateOverlayedColor(r100, sectionBox))
};
}
return r39;
}
@@ -0,0 +1,18 @@
// Metro module 8374 (f8375).
import { useMemo } from "react";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useThemeContext } from "../../../../_bundle/Module3901";
import { useProfileThemeValues } from "../../useProfileThemeValues.native";
import { calculateOverlayedColor, getUserProfileGradientContainerColors } from "../../UserProfileGradientUtils";
export function useUserProfileGradientColors(a0, a1, a2) {
let overlaySyncedWithUserTheme;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.syncProfileThemeWithUserTheme);
const profileThemeValues = useProfileThemeValues(useThemeContext().theme);
const r25 = profileThemeValues == null;
overlaySyncedWithUserTheme = stateFromStores ? r25 ? void 0 : profileThemeValues.overlaySyncedWithUserTheme : r25 ? void 0 : profileThemeValues.overlay;
return useMemo(() => {
const r6 = a0 != null ? overlaySyncedWithUserTheme != null ? calculateOverlayedColor(a0, overlaySyncedWithUserTheme) : null : null;
return getUserProfileGradientContainerColors(r6, a1 != null ? overlaySyncedWithUserTheme != null ? calculateOverlayedColor(a1, overlaySyncedWithUserTheme) : null : null, a2);
}, [a2, a0, a1, overlaySyncedWithUserTheme]);
}
@@ -0,0 +1,12 @@
// Metro module 12179 (f12180).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useMemo } from "react";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { useSelectedDismissibleContent } from "../../../dismissible_content/hooks/useSelectedDismissibleContent";
export function useWishlistViewerCoachmark({ isCurrentUser, shouldShowWishlistTab }) {
const r19 = _slicedToArray(useSelectedDismissibleContent(useMemo(() => !isCurrentUser && shouldShowWishlistTab ? [DismissibleContent.WISHLIST_MOBILE_VIEWER_COACHMARK] : [], [isCurrentUser, shouldShowWishlistTab])), 2);
return {
isVisible: r19[0] === DismissibleContent.WISHLIST_MOBILE_VIEWER_COACHMARK,
markAsDismissed: r19[1]
};
}