Files
2026-07-28 01:06:53 +03:00

399 lines
24 KiB
TypeScript

/* Metro module 14067; source: modules/collectibles/native/HeroBlock.tsx; dependencies: [31, 27, 5121, 663, 661, 33, 10020, 4501, 697, 14056, 14057, 1484, 10023, 566, 4048, 10154, 3860, 4000, 14058, 14049, 6771, 6789, 683, 4002, 14060, 14061, 10155, 4589, 4573, 4578, 1244, 9480, 6533, 5278, 6818, 6517, 14062, 8416, 14065, 2] */
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import UseTheme from '../../../hooks/useTheme.tsx'; /* Metro dependency 4048 */
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 VisibilitySensor from './VisibilitySensor.tsx'; /* Metro dependency 10155 */
import SkeletonCard from './SkeletonCard.tsx'; /* Metro dependency 14056 */
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 CollectiblesShopConstantsModule from '../CollectiblesShopConstants.tsx'; /* Metro dependency 663 */
import * as UseNavigationNativeModule from '../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */
import * as UseTokenModule from '../../../design/tokens/native/useToken.tsx'; /* Metro dependency 3860 */
import * as ColorUtilsModule from '../../../utils/ColorUtils.tsx'; /* Metro dependency 4000 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as LayerScopeNativeModule from '../../../design/components/Layers/native/LayerScope.native.tsx'; /* Metro dependency 6517 */
import * as QuestContentModule from '../../../external/discord_common/js/shared/shared-constants/QuestContent.tsx'; /* Metro dependency 6533 */
import * as UseAnalyticsLocationsModule from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */
import * as CollectiblesShopCardV2Module from './CollectiblesShopCardV2.tsx'; /* Metro dependency 10020 */
import * as CollectiblesAnalyticsContextModule from '../CollectiblesAnalyticsContext.tsx'; /* Metro dependency 10023 */
import * as UseTrackProductCardImpressionModule from '../hooks/useTrackProductCardImpression.tsx'; /* Metro dependency 10154 */
import * as UseFilteredAndSortedProductsModule from './hooks/useFilteredAndSortedProducts.tsx'; /* Metro dependency 14049 */
import * as CollectiblesCoachmarkScrollDismissContextModule from './CollectiblesCoachmarkScrollDismissContext.tsx'; /* Metro dependency 14057 */
function _fun106642(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#106642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:6, offset: 0x022e3c6a, size: 786 bytes, params: 8, frame: 24
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(661) /* metro dependency 661: Constants */;
const env0_8 = value.AnalyticEvents;
const env0_9 = value.UserSettingsSections;
const env0_10 = value.VerticalGradient;
value = require(33) /* metro dependency 33 */;
const env0_11 = value.jsx;
const env0_12 = value.Fragment;
const env0_13 = value.jsxs;
const COLLECTIBLES_SHOP_CARD_WIDTH = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_WIDTH;
value = 0.75 * COLLECTIBLES_SHOP_CARD_WIDTH;
const createStyles = CreateStylesModule.createStyles;
object = {};
object.heroContainer = {width: '100%'};
object.heroBannerContainer = {'position': 'absolute', 'top': 0, 'left': 0, 'width': '100%', 'maxHeight': null,
'aspectRatio': 1.4883720930232558, maxHeight: 240 + value};
object.heroBannerImage = {'width': '100%', 'height': '100%', 'resizeMode': 'cover'};
object.orbsBackgroundGradient = {'position': 'absolute', 'top': 0, 'left': 0, 'bottom': 0, 'right': 0};
object.fadeOutGradient = {'position': 'absolute', 'bottom': 0, 'height': '50%', 'width': '100%', 'zIndex': 1};
object.heroInfoContainer = {'display': 'flex', 'justifyContent': 'center', 'flex': 1, 'minWidth': '100%',
'maxHeight': 240, 'aspectRatio': 2.2};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.innerContainer = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between',
'paddingHorizontal': null, 'width': '100%', 'height': '100%', paddingHorizontal: PX_16};
object.heroLogoContainer = {'flex': 1, 'maxWidth': '80%', 'maxHeight': '80%'};
object.heroLogo = {'resizeMode': 'contain', 'maxHeight': '100%', 'maxWidth': '100%', 'aspectRatio': 1};
const object5 = {};
const CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT;
object5.backgroundColor = CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT;
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object5.padding = PX_8;
object5.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
object.heroViewAllIcon = object5;
const object6 = {};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object6.paddingHorizontal = PX_16;
object6.alignItems = 'flex-start';
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object6.gap = PX_16;
object.orbsInnerContainer = object6;
object.orbsTitle = {'fontSize': 24, 'lineHeight': 30};
object.productCardsContainer = {zIndex: 1};
const object8 = {flexDirection: 'row'};
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object8.gap = PX_12;
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object8.paddingHorizontal = PX_16;
object.skeletonContainer = object8;
const env0_14 = Reflect.apply(createStyles, CreateStylesModule, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/collectibles/native/HeroBlock.tsx');
exports.default = _default_106645;
function SkeletonLoading_106643({accessibilityLabel}) { // fn#106643, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:1585, offset: 0x022e3f7c, size: 129 bytes, params: 2, frame: 17
const styles = useStyles();
const Array = global.Array;
return (
<View
style={styles.skeletonContainer}
accessibilityRole="list"
accessibilityLabel={accessibilityLabel}
accessibilityState={{busy: true}}
accessible
>
{Array.from({length: 10}).map(_fun106644)}
</View>
);
function _fun106644(a0, a1) { // fn#106644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:1787, offset: 0x022e184b, size: 69 bytes, params: 3, frame: 17
const COLLECTIBLES_SHOP_CARD_WIDTH = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_WIDTH;
return <SkeletonCard width={COLLECTIBLES_SHOP_CARD_WIDTH} key={a1} />;
}
}
function _default_106645({heroBlock, preferVCPrice, screen}) { // fn#106645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:1866, offset: 0x022e3ffd, size: 2510 bytes, params: 2, frame: 50
var r18;
var r11;
var r28;
var r15;
var length;
var jsxRuntimeEnv0_12Binding;
var items2;
var PressableOpacity;
var object;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var object5;
var items5;
var items6;
var items7;
var FlashList;
var object3;
const COLLECTIBLES_SHOP_CARD_WIDTH = (CollectiblesShopCardV2Module).COLLECTIBLES_SHOP_CARD_WIDTH;
var space;
var PX_12;
var FeedProductList;
var object4;
const useCollectiblesCoachmarkScrollDismissContext = CollectiblesCoachmarkScrollDismissContextModule.useCollectiblesCoachmarkScrollDismissContext;
const handleDismissCoachmarkOnScroll = Reflect.apply(useCollectiblesCoachmarkScrollDismissContext,
CollectiblesCoachmarkScrollDismissContextModule, []).handleDismissCoachmarkOnScroll;
const env0_2 = (UseNavigationNativeModule).useNavigation();
const env0_3 = (CollectiblesAnalyticsContextModule).useCollectiblesAnalyticsContext();
let r32 = heroBlock.mobileHeroUrl ?? heroBlock.heroBannerUrl;
const heroLogoUrl = heroBlock.heroLogoUrl;
const category = (require(566) /* metro dependency 566: flux */).useStateFromStores([CollectiblesCategoryStore],
function() {
return CollectiblesCategoryStore.getCategory(heroBlock.categorySkuId);
});
let r16 = category != null && category.isOrbsExclusive;
const value3 = (UseTheme)();
const useTrackProductCardImpression = UseTrackProductCardImpressionModule.useTrackProductCardImpression;
const handleCardVisibilityChange = Reflect.apply(useTrackProductCardImpression, UseTrackProductCardImpressionModule,
[heroBlock.categoryStoreListingId, 'mobile_home', 'hero_block']).handleCardVisibilityChange;
const styles = useStyles();
let useToken = UseTokenModule.useToken;
const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW;
const value4 = Reflect.apply(useToken, UseTokenModule, [BACKGROUND_BASE_LOW]);
const hexToRgbaString = ColorUtilsModule.hexToRgbaString;
const value5 = Reflect.apply(hexToRgbaString, ColorUtilsModule, [ColorUtilsModule.hexWithOpacity(value4, 0)]);
useToken = UseTokenModule.useToken;
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
const value6 = Reflect.apply(useToken, UseTokenModule, [BACKGROUND_BASE_LOWEST]);
const value9 = (UseFilteredAndSortedProductsModule).useFilteredAndSortedProducts({products: env0_3.useMemo(_fun106647,
[heroBlock.rankedSkuIds, (UseGetProductsFromSkus)()]),
bypassAndroidUnsyncedFilter: r16});
const FEATURED_PAGE = CollectiblesMobileShopScreen.FEATURED_PAGE;
const env0_6 = screen === FEATURED_PAGE;
const defaultImport = UseAnalyticsLocations;
const COLLECTIBLES_SHOP_HERO = (AnalyticsLocation).COLLECTIBLES_SHOP_HERO;
const analyticsLocations = defaultImport(COLLECTIBLES_SHOP_HERO).analyticsLocations;
if (category === undefined) {
return null;
}
const r33 = heroBlock.mobileTitle ?? heroBlock.title;
const r34 = heroBlock.mobileSummary ?? heroBlock.summary;
r32 = r16 ? (require(4002) /* metro dependency 4002: shared */).isThemeDark(value3) ? importDefault(14060) /* metro dependency 14060: header_darkJpg */ : importDefault(14061) /* metro dependency 14061: header_lightJpg */ : r32;
const AnalyticsLocationProvider = (UseAnalyticsLocationsModule).AnalyticsLocationProvider;
const value10 = r32 != null;
if (value10) {
jsxRuntimeEnv0_12Binding = jsxRuntimeEnv0_12;
items2 = [
r16 && ((Component) => <Component colors={['rgba(39, 30, 173, 0.3)',
'transparent']} start={VerticalGradient.START} end={VerticalGradient.END} style={styles.orbsBackgroundGradient} />)(importDefault(4589) /* metro dependency 4589 */),
];
items2[1] = <Image style={[styles.heroBannerImage]} source={{uri: r32}} />;
items2[2] = ((Component) => <Component colors={[value5,
value6]} start={VerticalGradient.START} end={VerticalGradient.END} style={styles.fadeOutGradient} />)(importDefault(4589) /* metro dependency 4589 */);
r11 = (
<>
{items2}
</>
);
} else {
r11 = value10;
}
const items4 = [
<View style={styles.heroBannerContainer}>
{r11}
</View>,
];
if (r16) {
var viewBinding6Props = {style: styles.orbsInnerContainer};
r28 = r33 != null && ((Text) => <Text variant="display-md" color="mobile-text-heading-primary" style={styles.orbsTitle}>{r33}</Text>)((require(4573) /* metro dependency 4573: Text */).Text);
items6 = [r28];
r28 = r34 != null && r34 !== '';
r28 = r28 && ((Text) => <Text variant="text-md/medium">{r34}</Text>)((require(4573) /* metro dependency 4573: Text */).Text);
items6[1] = r28;
items7 = [
<View>
{items6}
</View>,
];
items7[1] = ((Button) => <Button variant="tertiary" shrink grow={false} size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.ynollq)} onPress={onPress_106648} />)((require(4578) /* metro dependency 4578: ButtonNative */).Button);
r15 = (
<View {...viewBinding6Props}>
{items7}
</View>
);
} else {
PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
var pressableOpacityProps = {'accessibilityRole': 'button', 'accessibilityLabel': null,
'accessibilityHint': null,
'activeOpacity': 0.6, 'androidRippleConfig': null, 'hitSlop': 8,
accessibilityLabel: intl.formatToPlainString(t.FNtLb3, {category: category.name}),
accessibilityHint: intl.string(t.F8ma9x)};
object5 = {};
object5.radius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
pressableOpacityProps.androidRippleConfig = object5;
pressableOpacityProps.onPress = onPress_106649;
var viewBinding3Props = {style: styles.innerContainer};
items5 = [
heroLogoUrl != null && <View style={styles.heroLogoContainer}><Image style={styles.heroLogo} source={{uri: heroLogoUrl}} /></View>,
];
items5[1] = (
<View style={styles.heroViewAllIcon}>
{((ChevronSmallRightIcon) => <ChevronSmallRightIcon size="sm" color="white" />)((require(6818) /* metro dependency 6818: ChevronSmallRightIcon */).ChevronSmallRightIcon)}
</View>
);
r15 = (
<PressableOpacity {...pressableOpacityProps} key={category.storeListingId}>
<View {...viewBinding3Props}>
{items5}
</View>
</PressableOpacity>
);
}
items4[1] = (
<View style={styles.heroInfoContainer}>
{r15}
</View>
);
const LayerScope = (LayerScopeNativeModule).LayerScope;
if (r16) {
FeedProductList = importDefault(14062) /* metro dependency 14062: FeedProductList */;
length = value9.length;
length = length === 0 ? 4 : value9.length;
r16 = (
<FeedProductList
products={value9}
loadingCardsNum={length}
preferVCPrice={preferVCPrice}
accessibilityLabel={intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.FNtLb3,
{category: category.name})}
/>
);
} else {
jsxRuntimeEnv0_12Binding = jsxRuntimeEnv0_12;
if (value9.length === 0) {
r18 = (
<SkeletonLoading_106643
accessibilityLabel={intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.FNtLb3,
{category: category.name})}
/>
);
} else {
FlashList = (require(8416) /* metro dependency 8416: flashList */).FlashList;
var flashListProps = {'horizontal': true, 'accessibilityLabel': null, 'accessibilityRole': 'list',
accessibilityLabel: intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.FNtLb3,
{category: category.name}), data: value9, onScroll: handleDismissCoachmarkOnScroll,
renderItem: renderItem_106650, decelerationRate: 'fast'};
space = (importDefault(697) /* metro dependency 697: native */).space;
PX_12 = space.PX_12;
flashListProps.snapToInterval = COLLECTIBLES_SHOP_CARD_WIDTH + PX_12;
space = (importDefault(697) /* metro dependency 697: native */).space;
PX_12 = space.PX_12;
flashListProps.estimatedItemSize = COLLECTIBLES_SHOP_CARD_WIDTH + PX_12;
flashListProps.showsHorizontalScrollIndicator = false;
flashListProps.ListHeaderComponent = ListHeaderComponent_106651;
flashListProps.ListFooterComponent = ListFooterComponent_106652;
flashListProps.ItemSeparatorComponent = ItemSeparatorComponent_106653;
r18 = <FlashList {...flashListProps} />;
}
r16 = (
<>
{r18}
</>
);
}
items4[2] = (
<View style={styles.productCardsContainer}>
<LayerScope>
{r16}
</LayerScope>
</View>
);
return (
<AnalyticsLocationProvider value={analyticsLocations}>
<VisibilitySensor onChange={handleCardVisibilityChange}>
<View style={styles.heroContainer}>
{items4}
</View>
</VisibilitySensor>
</AnalyticsLocationProvider>
);
function _fun106647() { // fn#106647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:2577, offset: 0x022e232c, size: 26 bytes, params: 1, frame: 11
return env0_5(heroBlock.rankedSkuIds);
}
function _default_106645OnPress() { // fn#106648, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:3813, owner: _default_106645.onPress, offset: 0x022e49cb, size: 76 bytes, params: 1, frame: 15
let value = environment.__proto__;
value = require(9480) /* metro dependency 9480: QuestUtilsNative */;
const openQuestHome = value.openQuestHome;
const QuestContent = (QuestContentModule).QuestContent;
const ORBS_SHOP_HERO_CTA = QuestContent.ORBS_SHOP_HERO_CTA;
Reflect.apply(openQuestHome, value, [{mergeExistingRoutes: true, fromContent: ORBS_SHOP_HERO_CTA}]);
}
function _default_106645OnPress_106649() { // fn#106649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:4211, owner: _default_106645.onPress, offset: 0x022e4a17, size: 266 bytes, params: 1, frame: 21
const categoryBinding = category;
const value3 = undefined;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const COLLECTIBLES_SHOP_ELEMENT_CLICKED = AnalyticEvents.COLLECTIBLES_SHOP_ELEMENT_CLICKED;
const object = {};
object.collectibles_shop_session_id = env0_3 == null ? value3 : env0_3.sessionId;
object.sku_id = heroBlock.categoryStoreListingId;
object.page_type = 'mobile_home';
object.page_section = env0_3 == null ? value3 : env0_3.pageSection;
object.page_category = env0_3 == null ? value3 : env0_3.pageCategory;
object.tile_type = 'HERO_BLOCK';
const String = global.String;
object.tile_position = String(env0_3 == null ? value3 : env0_3.tilePosition);
object.cta_name = null;
Reflect.apply(track, defaultImport, [COLLECTIBLES_SHOP_ELEMENT_CLICKED, object]);
const binding = env0_2;
const push = binding.push;
const COLLECTIBLES_SHOP_VIEW_ALL_CATEGORY_ITEMS = UserSettingsSections.COLLECTIBLES_SHOP_VIEW_ALL_CATEGORY_ITEMS;
Reflect.apply(push, binding, [COLLECTIBLES_SHOP_VIEW_ALL_CATEGORY_ITEMS, {category: categoryBinding,
analyticsContext: env0_3}]);
return value3;
}
function _default_106645RenderItem({item, index}) { // fn#106650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:5478, owner: _default_106645.renderItem, offset: 0x022e4b21, size: 198 bytes, params: 2, frame: 21
var r5;
let value = environment.__proto__;
const value3 = ((Component) => <Component solidBackground product={item} unpublishedAt={category.unpublishedAt} preferVCPrice={preferVCPrice} />)(CollectiblesShopCardV2);
const CollectiblesAnalyticsProvider = (CollectiblesAnalyticsContextModule).CollectiblesAnalyticsProvider;
const object2 = {tilePosition: index};
if (index !== 0) {
r5 = value3;
} else if (env0_6) {
value = importDefault(14065) /* metro dependency 14065: FeaturedFirstCardCoachmarkAnchor */;
value = ((Component) => <Component>{value3}</Component>)(value);
r5 = value;
} else {
r5 = value3;
}
return (
<CollectiblesAnalyticsProvider newValue={object2} key={item.skuId}>
{r5}
</CollectiblesAnalyticsProvider>
);
}
function _default_106645ListHeaderComponent() { // fn#106651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:5949, owner: _default_106645.ListHeaderComponent, offset: 0x022e2562, size: 63 bytes, params: 1, frame: 16
const PX_16 = (Native).space.PX_16;
return <View style={{width: PX_16}} />;
}
function _default_106645ListFooterComponent() { // fn#106652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:6014, owner: _default_106645.ListFooterComponent, offset: 0x022e2562, size: 63 bytes, params: 1, frame: 16
const PX_16 = (Native).space.PX_16;
return <View style={{width: PX_16}} />;
}
function _default_106645ItemSeparatorComponent() { // fn#106653, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14264:6082, owner: _default_106645.ItemSeparatorComponent, offset: 0x022e25a1, size: 64 bytes, params: 1, frame: 16
const PX_12 = (Native).space.PX_12;
return <View style={{width: PX_12}} />;
}
}
}
global.__d(_fun106642, 14067, [31, 27, 5121, 663, 661, 33, 10020, 4501, 697, 14056, 14057, 1484, 10023, 566, 4048,
10154, 3860, 4000, 14058, 14049, 6771, 6789, 683, 4002, 14060, 14061, 10155, 4589, 4573, 4578, 1244, 9480, 6533,
5278, 6818, 6517, 14062, 8416, 14065,
2]) /* metro module 14067, dependencies: [31, 27, 5121, 663, 661, 33, 10020, 4501, 697, 14056, 14057, 1484, 10023, 566, 4048, 10154, 3860, 4000, 14058, 14049, 6771, 6789, 683, 4002, 14060, 14061, 10155, 4589, 4573, 4578, 1244, 9480, 6533, 5278, 6818, 6517, 14062, 8416, 14065, 2] */;