300 lines
17 KiB
TypeScript
300 lines
17 KiB
TypeScript
/* Metro module 14639; source: modules/premium/powerups/native/GuildPowerupsBottomSheet.tsx; dependencies: [27, 4502, 8260, 8259, 33, 4501, 697, 14635, 14636, 14640, 566, 14641, 3868, 14643, 4573, 14644, 14647, 14634, 4068, 1244, 2256, 12310, 14648, 14649, 14650, 14653, 14658, 14659, 4578, 6275, 2] */
|
|
import AccessibilityStore from '../../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
|
|
import UseHasAllocateBoostPermission from '../hooks/useHasAllocateBoostPermission.tsx'; /* Metro dependency 12310 */
|
|
import UsePowerupActiveStatus from '../hooks/usePowerupActiveStatus.tsx'; /* Metro dependency 14635 */
|
|
import UseGuildPowerupLevelPerks from '../hooks/useGuildPowerupLevelPerks.tsx'; /* Metro dependency 14647 */
|
|
import UseGuildPowerupCardFooterConfig from '../hooks/useGuildPowerupCardFooterConfig.tsx'; /* Metro dependency 14648 */
|
|
import UseCanGuildPowerupBeToggled from '../hooks/useCanGuildPowerupBeToggled.tsx'; /* Metro dependency 14649 */
|
|
import UseGuildPowerupOnActivate from './hooks/useGuildPowerupOnActivate.tsx'; /* Metro dependency 14650 */
|
|
import UseGuildPowerupOnShowDeactivate from './hooks/useGuildPowerupOnShowDeactivate.tsx'; /* Metro dependency 14653 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as IndexNativeModule from '../../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as TextModule from '../../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
|
|
import * as BottomSheetNativeModule from '../../../../design/components/Sheet/native/BottomSheet.native.tsx'; /* Metro dependency 6275 */
|
|
import * as GuildPowerupsConstantsModule from '../constants/GuildPowerupsConstants.tsx'; /* Metro dependency 8259 */
|
|
import * as GameServerConstantsModule from '../../game_server/GameServerConstants.tsx'; /* Metro dependency 8260 */
|
|
import * as GuildBoostingMarketingUtilsModule from '../../../guild_boosting/native/GuildBoostingMarketingUtils.tsx'; /* Metro dependency 14634 */
|
|
import * as UseCalculatePowerupCardStatusModule from '../utils/useCalculatePowerupCardStatus.tsx'; /* Metro dependency 14636 */
|
|
import * as GuildPowerupsCardFooterModule from './GuildPowerupsCardFooter.tsx'; /* Metro dependency 14644 */
|
|
|
|
function _fun110626(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#110626, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:6, offset: 0x023800c9, size: 763 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = GuildPowerupsConstantsModule;
|
|
const env0_6 = value.GuildPowerupType;
|
|
const env0_7 = value.GUILD_POWERUP_CONFIGURABLE_SKUS_DESKTOP;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_8 = value.jsx;
|
|
const env0_9 = value.jsxs;
|
|
const env0_10 = value.Fragment;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object = {};
|
|
const object2 = {};
|
|
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.padding = PX_16;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.gap = PX_16;
|
|
object.container = object2;
|
|
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
|
|
object.headerContainer = {marginTop: PX_24, alignItems: 'center'};
|
|
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object.statusContainer = {justifyContent: 'center', gap: PX_8};
|
|
const object5 = {flexDirection: 'column'};
|
|
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object5.gap = PX_8;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object5.marginTop = PX_16;
|
|
object.levelContainer = object5;
|
|
object.perkContainer = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between'};
|
|
object.perkIcon = {'width': 20, 'height': 20};
|
|
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object.perkText = {marginStart: PX_8};
|
|
const object7 = {};
|
|
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
|
|
object7.gap = PX_12;
|
|
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object7.marginTop = PX_8;
|
|
object.footerContainer = object7;
|
|
object.image = {'width': '100%', 'height': 160};
|
|
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
|
|
object.description = {marginHorizontal: PX_24, textAlign: 'center'};
|
|
const object9 = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'center'};
|
|
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
|
|
object9.gap = PX_4;
|
|
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object9.marginTop = PX_8;
|
|
object.cooldownInfo = object9;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object.gemContainer = {marginTop: PX_16};
|
|
const env0_11 = Reflect.apply(createStyles, value, [object]);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/premium/powerups/native/GuildPowerupsBottomSheet.tsx');
|
|
exports.default = GuildPowerupsBottomSheet;
|
|
function GuildPowerupsBottomSheetHeader({guildId, powerup}) { // fn#110627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:1097, offset: 0x023803c4, size: 611 bytes, params: 2, frame: 29
|
|
const styles = useStyles();
|
|
const value4 = (UseCalculatePowerupCardStatusModule).useCalculatePowerupCardStatus(powerup,
|
|
(UsePowerupActiveStatus)(guildId, powerup), false);
|
|
const r8 = (importDefault(14640) /* metro dependency 14640: useGetGuildPowerupBannerImage */)(powerup, true) ?? '';
|
|
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
|
|
function() {
|
|
return AccessibilityStore.useReducedMotion;
|
|
});
|
|
let skuId = powerup.skuId;
|
|
const r14 = skuId !== GAME_SERVER_POWERUP_SKU_ID ? undefined : '+';
|
|
skuId = powerup.skuId;
|
|
const type = powerup.type;
|
|
const LEVEL = GuildPowerupType.LEVEL;
|
|
const r5 = (
|
|
type === LEVEL
|
|
? ((Component) => <Component style={styles.gemContainer} />)(importDefault(14641) /* metro dependency 14641: GuildPowerupsBoostGem */)
|
|
: (
|
|
skuId === GAME_SERVER_POWERUP_SKU_ID
|
|
? (
|
|
<View style={styles.image}>
|
|
{((GameServerHostingRive) => <GameServerHostingRive stateMachine="SM_Auto" dataBinding={{reducedMotion: useReducedMotion}} />)((require(3868) /* metro dependency 3868: native */).GameServerHostingRive)}
|
|
</View>
|
|
)
|
|
: ((Component) => <Component imageUrl={r8} style={styles.image} isAnimated />)(importDefault(14643) /* metro dependency 14643: GuildPowerupsImage */)
|
|
)
|
|
);
|
|
const Text = (TextModule).Text;
|
|
const text = (
|
|
<Text variant="heading-xl/bold" accessibilityRole="header">
|
|
{powerup.title}
|
|
</Text>
|
|
);
|
|
const GuildPowerupsCardFooter = (GuildPowerupsCardFooterModule).GuildPowerupsCardFooter;
|
|
return (
|
|
<View>
|
|
{r5}
|
|
<View style={styles.headerContainer}>
|
|
{text}
|
|
<GuildPowerupsCardFooter
|
|
cost={powerup.cost}
|
|
costDecorator={r14}
|
|
status={value4}
|
|
style={styles.statusContainer}
|
|
/>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function GuildPowerupsBottomSheetLevelBody({powerup}) { // fn#110629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:1846, offset: 0x02380627, size: 102 bytes, params: 2, frame: 17
|
|
const styles = useStyles();
|
|
return (
|
|
<View style={styles.levelContainer}>
|
|
{(UseGuildPowerupLevelPerks)(powerup).map(_fun110630)}
|
|
</View>
|
|
);
|
|
function _fun110630(a0, a1) { // fn#110630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:1977, offset: 0x0238068d, size: 214 bytes, params: 3, frame: 22
|
|
const iconForPerk = (GuildBoostingMarketingUtilsModule).getIconForPerk(a0.perkIcon);
|
|
const stylesBinding = styles;
|
|
const perkContainer = stylesBinding.perkContainer;
|
|
const Text = (TextModule).Text;
|
|
return (
|
|
<View style={perkContainer} key={'perk-' + a1 + '-' + a0.perkIcon}>
|
|
<Text style={stylesBinding.perkText} variant="text-md/medium">
|
|
{a0.description}
|
|
</Text>
|
|
{((Component) => <Component style={stylesBinding.perkIcon} />)(iconForPerk)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function GuildPowerupsBottomSheetBody({powerup}) { // fn#110631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:2213, offset: 0x02380763, size: 434 bytes, params: 2, frame: 28
|
|
var r5;
|
|
var jsxRuntimeEnv0_10Binding;
|
|
const Text = (TextModule).Text;
|
|
var object2;
|
|
var description;
|
|
var items3;
|
|
var items2;
|
|
var intl;
|
|
const styles = useStyles();
|
|
const type = powerup.type;
|
|
const PERK = GuildPowerupType.PERK;
|
|
if (PERK === type) {
|
|
jsxRuntimeEnv0_10Binding = jsxRuntimeEnv0_10;
|
|
object2 = {};
|
|
description = styles.description;
|
|
object2.style = description;
|
|
object2.variant = 'text-md/medium';
|
|
description = powerup.description;
|
|
items3 = [
|
|
<Text {...object2}>
|
|
{description}
|
|
</Text>,
|
|
];
|
|
r5 = powerup.deactivationCooldownPeriodDays != null && powerup.deactivationCooldownPeriodDays > 0;
|
|
if (r5) {
|
|
var viewBindingProps = {style: styles.cooldownInfo};
|
|
const CircleInformationIcon = (require(4068) /* metro dependency 4068: CircleInformationIcon */).CircleInformationIcon;
|
|
items2 = [
|
|
<CircleInformationIcon size="xs" color={(importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED} />,
|
|
|
|
|
|
|
|
];
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
items2[1] = (
|
|
<Text variant="text-sm/medium" color="text-muted">
|
|
{intl.formatToPlainString((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */).GMhQcE,
|
|
|
|
|
|
{cooldownDays: powerup.deactivationCooldownPeriodDays})}
|
|
</Text>
|
|
);
|
|
r5 = (
|
|
<View {...viewBindingProps}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
items3[1] = r5;
|
|
return (
|
|
<>
|
|
{items3}
|
|
</>
|
|
);
|
|
}
|
|
const LEVEL = GuildPowerupType.LEVEL;
|
|
if (LEVEL === type) {
|
|
return <GuildPowerupsBottomSheetLevelBody powerup={powerup} />;
|
|
}
|
|
}
|
|
|
|
function GuildPowerupsBottomSheetFooter({guildId, powerup}) { // fn#110632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:2847, offset: 0x02380915, size: 779 bytes, params: 2, frame: 33
|
|
var r8;
|
|
var r5;
|
|
var value7;
|
|
const intl = (IndexNativeModule).intl;
|
|
var string;
|
|
var items2;
|
|
const Button = (ButtonNativeModule).Button;
|
|
var value;
|
|
const styles = useStyles();
|
|
const value2 = (UseHasAllocateBoostPermission)(guildId);
|
|
const {showToggleButton, showConfigureButton,
|
|
isPowerupActive} = (UseGuildPowerupCardFooterConfig)(guildId,
|
|
powerup);
|
|
const {disabled, reason} = (UseCanGuildPowerupBeToggled)(guildId,
|
|
powerup, isPowerupActive);
|
|
const value5 = (UseGuildPowerupOnActivate)(guildId, powerup);
|
|
const env0_1 = value5.onActivate;
|
|
const isLoading = value5.isLoading;
|
|
const env0_2 = (UseGuildPowerupOnShowDeactivate)(guildId,
|
|
powerup);
|
|
if (value2) {
|
|
value7 = GUILD_POWERUP_CONFIGURABLE_SKUS_DESKTOP.has(powerup.skuId);
|
|
r8 = !showConfigureButton && isPowerupActive;
|
|
r8 = r8 && powerup.type === GuildPowerupType.PERK;
|
|
r8 = r8 && value7;
|
|
r8 = !r8 ? powerup.skuId === GAME_SERVER_POWERUP_SKU_ID : r8;
|
|
var viewBindingProps = {style: styles.footerContainer};
|
|
r8 = r8 && ((Text) => <Text style={styles.description} variant="text-md/bold">{intl.string((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */)['jo5++h'])}</Text>)((require(4573) /* metro dependency 4573: Text */).Text);
|
|
items2 = [r8];
|
|
r8 = disabled && ((Component) => <Component text={reason ?? ''} />)(importDefault(14659) /* metro dependency 14659: GuildPowerupsDisabledWarning */);
|
|
items2[1] = r8;
|
|
items2[2] = showConfigureButton && <Button variant="primary" text={intl.string((importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */).g5Ds69)} onPress={(importDefault(14658) /* metro dependency 14658: useGuildPowerupConfigureCallback */)(guildId,
|
|
|
|
powerup)} />;
|
|
r5 = showToggleButton && powerup.skuId !== GAME_SERVER_POWERUP_SKU_ID;
|
|
if (r5) {
|
|
var buttonProps = {variant: isPowerupActive ? 'secondary' : 'primary'};
|
|
string = intl.string;
|
|
value = importDefault(2256) /* metro dependency 2256: GuildPowerupsMessages */;
|
|
buttonProps.text = isPowerupActive ? Reflect.apply(string, intl, [value.TZsu1U]) : Reflect.apply(string,
|
|
intl,
|
|
[value.gSxlHf]);
|
|
buttonProps.loading = isLoading;
|
|
buttonProps.disabled = disabled;
|
|
buttonProps.onPress = onPress_110633;
|
|
value = <Button {...buttonProps} />;
|
|
r5 = value;
|
|
}
|
|
items2[3] = r5;
|
|
return (
|
|
<View {...viewBindingProps}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
return null;
|
|
function GuildPowerupsBottomSheetFooterOnPress() { // fn#110633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:3684, owner: GuildPowerupsBottomSheetFooter.onPress, offset: 0x02380c20, size: 56 bytes, params: 1, frame: 10
|
|
if (isPowerupActive) {
|
|
if (env0_2 != null) {
|
|
env0_2();
|
|
}
|
|
} else if (onActivate != null) {
|
|
onActivate();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function GuildPowerupsBottomSheet({guildId, powerup}) { // fn#110634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14836:3828, offset: 0x02380c58, size: 198 bytes, params: 2, frame: 24
|
|
const styles = useStyles();
|
|
const BottomSheet = (BottomSheetNativeModule).BottomSheet;
|
|
return (
|
|
<BottomSheet startExpanded>
|
|
<View style={styles.container}>
|
|
<GuildPowerupsBottomSheetHeader guildId={guildId} powerup={powerup} />
|
|
<GuildPowerupsBottomSheetBody guildId={guildId} powerup={powerup} />
|
|
<GuildPowerupsBottomSheetFooter guildId={guildId} powerup={powerup} />
|
|
</View>
|
|
</BottomSheet>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun110626, 14639, [27, 4502, 8260, 8259, 33, 4501, 697, 14635, 14636, 14640, 566, 14641, 3868, 14643,
|
|
4573, 14644, 14647, 14634, 4068, 1244, 2256, 12310, 14648, 14649, 14650, 14653, 14658, 14659, 4578, 6275,
|
|
2]) /* metro module 14639, dependencies: [27, 4502, 8260, 8259, 33, 4501, 697, 14635, 14636, 14640, 566, 14641, 3868, 14643, 4573, 14644, 14647, 14634, 4068, 1244, 2256, 12310, 14648, 14649, 14650, 14653, 14658, 14659, 4578, 6275, 2] */;
|