Files
discord-decomp/sources/modules/collectibles/native/ShelfBlock.tsx
T
2026-07-28 01:06:53 +03:00

220 lines
14 KiB
TypeScript

/* Metro module 14078; source: modules/collectibles/native/ShelfBlock.tsx; dependencies: [31, 27, 5121, 663, 661, 33, 4501, 697, 1484, 10023, 14057, 6771, 6789, 566, 14058, 14049, 5120, 10020, 4573, 4578, 1244, 6517, 8416, 2] */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import CollectiblesCategoryStore from '../CollectiblesCategoryStore.tsx'; /* Metro dependency 5121 */
import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import AnalyticsLocation from '../../app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */
import CollectiblesShopCardV2 from './CollectiblesShopCardV2.tsx'; /* Metro dependency 10020 */
import UseGetProductsFromSkus from '../hooks/useGetProductsFromSkus.tsx'; /* Metro dependency 14058 */
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 ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as CollectiblesShopConstantsModule from '../CollectiblesShopConstants.tsx'; /* Metro dependency 663 */
import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as LayerScopeNativeModule from '../../../design/components/Layers/native/LayerScope.native.tsx'; /* Metro dependency 6517 */
import * as UseAnalyticsLocationsModule from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import * as FlashListModule from '../../../external/discord_common/js/packages/flash-list/index.jsx'; /* Metro dependency 8416 */
import * as CollectiblesShopCardV2Module from './CollectiblesShopCardV2.tsx'; /* Metro dependency 10020 */
import * as CollectiblesAnalyticsContextModule from '../CollectiblesAnalyticsContext.tsx'; /* Metro dependency 10023 */
import * as UseFilteredAndSortedProductsModule from './hooks/useFilteredAndSortedProducts.tsx'; /* Metro dependency 14049 */
import * as CollectiblesCoachmarkScrollDismissContextModule from './CollectiblesCoachmarkScrollDismissContext.tsx'; /* Metro dependency 14057 */
function _fun106686(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#106686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:6, offset: 0x022e6904, size: 634 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_4 = value.Image;
const env0_5 = value.View;
value = require(33) /* metro dependency 33 */;
const env0_9 = value.jsx;
const env0_10 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {width: '100%'};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingTop = PX_16;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object2.paddingBottom = PX_16;
object.container = object2;
const object3 = {};
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object3.marginTop = PX_24;
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object3.paddingTop = PX_24;
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object3.paddingBottom = PX_24;
object3.overflow = 'hidden';
object.containerWithBackground = object3;
object.backgroundImage = {'position': 'absolute', 'top': 0, 'left': 0, 'bottom': 0, 'minWidth': '100%',
'aspectRatio': 2.5, 'resizeMode': 'cover'};
const object4 = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between'};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object4.gap = PX_12;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.paddingHorizontal = PX_16;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object4.marginBottom = PX_16;
object4.zIndex = 1;
object.header = object4;
object.headingWrapper = {flexShrink: 1};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.listEdgeSpacer = {width: PX_16};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.listItemSeparator = {width: PX_12};
const env0_11 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/collectibles/native/ShelfBlock.tsx');
exports.default = _default_106689;
function ListEdgeSpacer_106687() { // fn#106687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:926, offset: 0x022e6b7e, size: 41 bytes, params: 1, frame: 14
const styles = useStyles();
return <View style={styles.listEdgeSpacer} />;
}
function ListItemSeparator_106688() { // fn#106688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:997, offset: 0x022e6ba7, size: 41 bytes, params: 1, frame: 14
const styles = useStyles();
return <View style={styles.listItemSeparator} />;
}
function _default_106689({block, preferVCPrice}) { // fn#106689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:1062, offset: 0x022e6bd0, size: 1134 bytes, params: 2, frame: 39
var Button;
var intl;
const styles = useStyles();
const value3 = (UseNavigationNativeModule).useNavigation();
const value4 = (CollectiblesAnalyticsContextModule).useCollectiblesAnalyticsContext();
const env0_3 = value4;
const useCollectiblesCoachmarkScrollDismissContext = CollectiblesCoachmarkScrollDismissContextModule.useCollectiblesCoachmarkScrollDismissContext;
const handleDismissCoachmarkOnScroll = Reflect.apply(useCollectiblesCoachmarkScrollDismissContext,
CollectiblesCoachmarkScrollDismissContextModule, []).handleDismissCoachmarkOnScroll;
const defaultImport = UseAnalyticsLocations;
const COLLECTIBLES_SHOP_SHELF = (AnalyticsLocation).COLLECTIBLES_SHOP_SHELF;
const analyticsLocations = defaultImport(COLLECTIBLES_SHOP_SHELF).analyticsLocations;
const value5 = (FluxModule).useStateFromStores([CollectiblesCategoryStore],
_fun106690);
const value6 = (UseGetProductsFromSkus)();
const binding = env0_3;
const value8 = (UseFilteredAndSortedProductsModule).useFilteredAndSortedProducts({products: binding.useMemo(_fun106691,
[block.rankedSkuIds, value6])});
const value9 = binding.useCallback(_fun106692, [value5, value3, value4]);
const value10 = binding.useCallback(_fun106693, [block.name, preferVCPrice]);
const value11 = binding.useCallback(function(a0) {
return a0.skuId;
}, []);
if (value8.length === 0) {
return null;
}
const value12 = block.mobileBackgroundImage != null;
items2 = [styles.container];
items2[1] = value12 && styles.containerWithBackground;
const AnalyticsLocationProvider = (UseAnalyticsLocationsModule).AnalyticsLocationProvider;
const object = {style: items2};
items2 = [
value12 && block.mobileBackgroundImage != null && <Image style={styles.backgroundImage} source={{uri: block.mobileBackgroundImage}} />,
];
const Heading = (TextModule).Heading;
const view = (
<View style={styles.headingWrapper}>
<Heading variant="text-md/semibold" style={value12 ? {color: block.titleColor ?? '#ffffff'} : undefined}>
{block.name}
</Heading>
</View>
);
let r12 = block.showButton && value5 != null;
if (r12) {
Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
var buttonProps = {'variant': null, 'size': 'sm', 'shrink': true, 'grow': false,
variant: value12 ? 'primary-overlay' : 'secondary'};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
buttonProps.text = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.xFcotU);
buttonProps.onPress = value9;
r12 = <Button {...buttonProps} />;
}
items2[1] = (
<View style={styles.header}>
{view}
{r12}
</View>
);
const LayerScope = (LayerScopeNativeModule).LayerScope;
const FlashList = (FlashListModule).FlashList;
const flashListProps = {'horizontal': true, 'accessibilityRole': 'list', accessibilityLabel: block.name,
data: value8, keyExtractor: value11, onScroll: handleDismissCoachmarkOnScroll, renderItem: value10,
decelerationRate: 'fast'};
const COLLECTIBLES_SHOP_CARD_WIDTH = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_WIDTH;
const PX_12 = (Native).space.PX_12;
flashListProps.snapToInterval = COLLECTIBLES_SHOP_CARD_WIDTH + PX_12;
flashListProps.estimatedItemSize = COLLECTIBLES_SHOP_CARD_WIDTH;
flashListProps.showsHorizontalScrollIndicator = false;
flashListProps.ListHeaderComponent = ListEdgeSpacer_106687;
flashListProps.ListFooterComponent = ListEdgeSpacer_106687;
flashListProps.ItemSeparatorComponent = ListItemSeparator_106688;
items2[2] = (
<LayerScope>
<FlashList {...flashListProps} />
</LayerScope>
);
return (
<AnalyticsLocationProvider value={analyticsLocations}>
<View {...object}>
{items2}
</View>
</AnalyticsLocationProvider>
);
function _fun106690() { // fn#106690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:1362, offset: 0x022e703e, size: 54 bytes, params: 1, frame: 12
return block.categorySkuId != null ? CollectiblesCategoryStore.getCategory(block.categorySkuId) : undefined;
}
function _fun106691() { // fn#106691, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:1454, offset: 0x022e232c, size: 26 bytes, params: 1, frame: 11
return env0_5(block.rankedSkuIds);
}
function _fun106692() { // fn#106692, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:1568, offset: 0x022e7074, size: 187 bytes, params: 1, frame: 19
var isOrbsExclusive;
var value2;
var binding;
var object;
var openCollectiblesShopMobile;
var COLLECTIBLES_SHOP;
var value;
if (env0_4 != null) {
isOrbsExclusive = env0_4.isOrbsExclusive;
value2 = environment.__proto__;
if (isOrbsExclusive) {
value = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
openCollectiblesShopMobile = value.openCollectiblesShopMobile;
object = {};
COLLECTIBLES_SHOP = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).COLLECTIBLES_SHOP;
object.analyticsLocations = [COLLECTIBLES_SHOP];
COLLECTIBLES_SHOP = (importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).COLLECTIBLES_SHOP;
object.analyticsSource = COLLECTIBLES_SHOP;
object.screen = CollectiblesMobileShopScreen.ORBS;
Reflect.apply(openCollectiblesShopMobile, value, [object]);
} else {
binding = env0_2;
binding.push(UserSettingsSections.COLLECTIBLES_SHOP_VIEW_ALL_CATEGORY_ITEMS, {category: env0_4,
analyticsContext: env0_3});
}
}
}
function _fun106693({item, index}) { // fn#106693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14275:1858, offset: 0x022e712f, size: 129 bytes, params: 2, frame: 19
const value = environment.__proto__;
const CollectiblesAnalyticsProvider = (CollectiblesAnalyticsContextModule).CollectiblesAnalyticsProvider;
return (
<CollectiblesAnalyticsProvider newValue={{tilePosition: index, pageSection: block.name}}>
{((Component) => <Component product={item} preferVCPrice={preferVCPrice} />)(CollectiblesShopCardV2)}
</CollectiblesAnalyticsProvider>
);
}
}
}
global.__d(_fun106686, 14078, [31, 27, 5121, 663, 661, 33, 4501, 697, 1484, 10023, 14057, 6771, 6789, 566, 14058,
14049, 5120, 10020, 4573, 4578, 1244, 6517, 8416,
2]) /* metro module 14078, dependencies: [31, 27, 5121, 663, 661, 33, 4501, 697, 1484, 10023, 14057, 6771, 6789, 566, 14058, 14049, 5120, 10020, 4573, 4578, 1244, 6517, 8416, 2] */;