Decor: Fix change decoration modal being unable to be opened

This commit is contained in:
Nuckyz 2026-01-23 23:09:41 -03:00
parent e03bb9a6e6
commit 1e284c7cdf
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 10 additions and 6 deletions

View file

@ -109,6 +109,14 @@ export default definePlugin({
}
]
})),
// Patch avatar decoration preview to display Decor avatar decorations as if they are purchased
{
find: "#{intl::PREMIUM_UPSELL_PROFILE_AVATAR_DECO_INLINE_UPSELL_DESCRIPTION}",
replacement: {
match: /(#{intl::PREMIUM_UPSELL_PROFILE_AVATAR_DECO_INLINE_UPSELL_DESCRIPTION}.+?return null!=(\i)&&\()(null==\i)/,
replace: (_, rest, avatarDecoration, hasPurchase) => `${rest}(${avatarDecoration}.skuId!==$self.SKU_ID&&${hasPurchase})`
}
}
],
settings,

View file

@ -5,8 +5,7 @@
*/
import { AvatarDecoration } from "@plugins/decor";
import { findComponentByCode, LazyComponentWebpack } from "@webpack";
import { React } from "@webpack/common";
import { findComponentByCodeLazy } from "@webpack";
import type { ComponentType, HTMLProps, PropsWithChildren } from "react";
type DecorationGridItemComponent = ComponentType<PropsWithChildren<HTMLProps<HTMLDivElement>> & {
@ -17,10 +16,7 @@ type DecorationGridItemComponent = ComponentType<PropsWithChildren<HTMLProps<HTM
export let DecorationGridItem: DecorationGridItemComponent;
export const setDecorationGridItem = v => DecorationGridItem = v;
export const AvatarDecorationModalPreview = LazyComponentWebpack(() => {
const component = findComponentByCode(".shopPreviewBanner");
return React.memo(component);
});
export const AvatarDecorationModalPreview = findComponentByCodeLazy("#{intl::PREMIUM_UPSELL_PROFILE_AVATAR_DECO_INLINE_UPSELL_DESCRIPTION}");
type DecorationGridDecorationComponent = React.ComponentType<HTMLProps<HTMLDivElement> & {
avatarDecoration: AvatarDecoration;