Files
discord-decomp/modules/collectibles/native/useWishlistNUXActionSheet.tsx
T
2026-11-01 12:12:55 +02:00

59 lines
2.7 KiB
TypeScript

// Metro module 8667 (f8668).
import { useCallback } from "react";
import UserProfileStore from "../../user_profile/UserProfileStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useIsDismissibleContentDismissed_UNSAFE, UNSAFE_markDismissibleContentAsDismissed } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { trackDismissibleContentShown } from "../../dismissible_content/DismissibleContentUtils";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
function $mk81102($env) {
return () => $env.$parent[4].getFirstWishlistId($env[0]);
}
function $mk81103($env) {
return () => {
const userProfile = $env.$parent[4].getUserProfile($env[0]);
return userProfile != null && userProfile.fetchEndedAt > 0;
};
}
let $mk81101 = function() {
return () => AuthenticationStore.getId();
};
let env5643 = {};
export default function useWishlistNUXActionSheet() {
let env16703;
const r4 = env16703 = {
$parent: env5643
};
env16703[0] = useStateFromStores([AuthenticationStore], $mk81101());
const stateFromStores = useStateFromStores([UserProfileStore], $mk81102(r4));
let shouldShowWishlistNUXActionSheet = useStateFromStores([UserProfileStore], $mk81103(r4)) && stateFromStores == null;
const isDismissibleContentDismissed_UNSAFE = useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.WISHLIST_MOBILE_NUX_ACTION_SHEET);
if (shouldShowWishlistNUXActionSheet) {
shouldShowWishlistNUXActionSheet = !isDismissibleContentDismissed_UNSAFE;
}
return {
shouldShowWishlistNUXActionSheet,
showWishlistNUXActionSheet: useCallback((a0) => {
trackDismissibleContentShown(DismissibleContent.WISHLIST_MOBILE_NUX_ACTION_SHEET);
ActionSheetActionCreators.openLazy(import("./WishlistNUXAddedItemActionSheet"), "WishlistNUXAddedItemActionSheet", {
product: a0
}, "stack");
UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.WISHLIST_MOBILE_NUX_ACTION_SHEET, {
dismissAction: ContentDismissActionType.USER_DISMISS,
forceTrack: true
});
}, [])
};
};
export function useHasNeverWishlisted() {
let env16702;
const r1 = env16702 = {
$parent: env5643
};
env16702[0] = useStateFromStores([AuthenticationStore], $mk81101());
const stateFromStores = useStateFromStores([UserProfileStore], $mk81102(r1));
return useStateFromStores([UserProfileStore], $mk81103(r1)) && stateFromStores == null;
}