297 lines
19 KiB
TypeScript
297 lines
19 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] */
|
|
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
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_4 = value.Image;
|
|
const env0_5 = value.View;
|
|
const collectiblesCategoryStore = importDefault(5121) /* metro dependency 5121: CollectiblesCategoryStore */;
|
|
const env0_7 = (require(663) /* metro dependency 663: CollectiblesShopConstants */).CollectiblesMobileShopScreen;
|
|
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 = (require(10020) /* metro dependency 10020: CollectiblesShopCardV2 */).COLLECTIBLES_SHOP_CARD_WIDTH;
|
|
value = 0.75 * COLLECTIBLES_SHOP_CARD_WIDTH;
|
|
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = createStylesModule.createStyles;
|
|
object2 = {};
|
|
object2.heroContainer = {width: '100%'};
|
|
object2.heroBannerContainer = {'position': 'absolute', 'top': 0, 'left': 0, 'width': '100%', 'maxHeight': null,
|
|
'aspectRatio': 1.4883720930232558, maxHeight: 240 + value};
|
|
object2.heroBannerImage = {'width': '100%', 'height': '100%', 'resizeMode': 'cover'};
|
|
object2.orbsBackgroundGradient = {'position': 'absolute', 'top': 0, 'left': 0, 'bottom': 0, 'right': 0};
|
|
object2.fadeOutGradient = {'position': 'absolute', 'bottom': 0, 'height': '50%', 'width': '100%', 'zIndex': 1};
|
|
object2.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;
|
|
object2.innerContainer = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'space-between',
|
|
'paddingHorizontal': null, 'width': '100%', 'height': '100%', paddingHorizontal: PX_16};
|
|
object2.heroLogoContainer = {'flex': 1, 'maxWidth': '80%', 'maxHeight': '80%'};
|
|
object2.heroLogo = {'resizeMode': 'contain', 'maxHeight': '100%', 'maxWidth': '100%', 'aspectRatio': 1};
|
|
const object3 = {};
|
|
const CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT;
|
|
object3.backgroundColor = CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT;
|
|
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object3.padding = PX_8;
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
|
|
object2.heroViewAllIcon = object3;
|
|
const object4 = {};
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object4.paddingHorizontal = PX_16;
|
|
object4.alignItems = 'flex-start';
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object4.gap = PX_16;
|
|
object2.orbsInnerContainer = object4;
|
|
object2.orbsTitle = {'fontSize': 24, 'lineHeight': 30};
|
|
object2.productCardsContainer = {zIndex: 1};
|
|
const object7 = {flexDirection: 'row'};
|
|
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
|
|
object7.gap = PX_12;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object7.paddingHorizontal = PX_16;
|
|
object2.skeletonContainer = object7;
|
|
const env0_14 = Reflect.apply(createStyles, createStylesModule, [object2]);
|
|
(require(2) /* metro dependency 2 */).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 _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 object11;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var object;
|
|
var items5;
|
|
var items6;
|
|
var items7;
|
|
var FlashList;
|
|
var object27;
|
|
const COLLECTIBLES_SHOP_CARD_WIDTH = (require(10020) /* metro dependency 10020: CollectiblesShopCardV2 */).COLLECTIBLES_SHOP_CARD_WIDTH;
|
|
var space;
|
|
var PX_12;
|
|
var FeedProductList;
|
|
var object31;
|
|
const collectiblesCoachmarkScrollDismissContextModule = require(14057) /* metro dependency 14057: CollectiblesCoachmarkScrollDismissContext */;
|
|
const useCollectiblesCoachmarkScrollDismissContext = collectiblesCoachmarkScrollDismissContextModule.useCollectiblesCoachmarkScrollDismissContext;
|
|
const handleDismissCoachmarkOnScroll = Reflect.apply(useCollectiblesCoachmarkScrollDismissContext,
|
|
collectiblesCoachmarkScrollDismissContextModule, []).handleDismissCoachmarkOnScroll;
|
|
const env0_2 = (require(1484) /* metro dependency 1484: useNavigationNative */).useNavigation();
|
|
const env0_3 = (require(10023) /* metro dependency 10023: CollectiblesAnalyticsContext */).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 = (importDefault(4048) /* metro dependency 4048: useTheme */)();
|
|
const useTrackProductCardImpressionModule = require(10154) /* metro dependency 10154: useTrackProductCardImpression */;
|
|
const useTrackProductCardImpression = useTrackProductCardImpressionModule.useTrackProductCardImpression;
|
|
const handleCardVisibilityChange = Reflect.apply(useTrackProductCardImpression, useTrackProductCardImpressionModule,
|
|
[heroBlock.categoryStoreListingId, 'mobile_home', 'hero_block']).handleCardVisibilityChange;
|
|
const styles = useStyles();
|
|
const useTokenModule = require(3860) /* metro dependency 3860: useToken */;
|
|
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 colorUtilsModule = require(4000) /* metro dependency 4000: ColorUtils */;
|
|
const hexToRgbaString = colorUtilsModule.hexToRgbaString;
|
|
const moduleValue8 = colorUtilsModule;
|
|
const value5 = Reflect.apply(hexToRgbaString, colorUtilsModule, [moduleValue8.hexWithOpacity(value4, 0)]);
|
|
const moduleValue9 = useTokenModule;
|
|
useToken = moduleValue9.useToken;
|
|
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
|
|
const value6 = Reflect.apply(useToken, moduleValue9, [BACKGROUND_BASE_LOWEST]);
|
|
const value9 = (require(14049) /* metro dependency 14049: useFilteredAndSortedProducts */).useFilteredAndSortedProducts({products: env0_3.useMemo(_fun106647,
|
|
[heroBlock.rankedSkuIds, (importDefault(14058) /* metro dependency 14058: useGetProductsFromSkus */)()]),
|
|
bypassAndroidUnsyncedFilter: r16});
|
|
const FEATURED_PAGE = CollectiblesMobileShopScreen.FEATURED_PAGE;
|
|
const env0_6 = screen === FEATURED_PAGE;
|
|
const defaultImport = importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */;
|
|
const COLLECTIBLES_SHOP_HERO = (importDefault(6789) /* metro dependency 6789: 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 = (require(6771) /* metro dependency 6771: useAnalyticsLocations */).AnalyticsLocationProvider;
|
|
const VisibilitySensor = importDefault(10155) /* metro dependency 10155: VisibilitySensor */;
|
|
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)};
|
|
object = {};
|
|
object.radius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
pressableOpacityProps.androidRippleConfig = object;
|
|
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 = (require(6517) /* metro dependency 6517: LayerScopeNative */).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;
|
|
flashListProps.ListFooterComponent = ListFooterComponent;
|
|
flashListProps.ItemSeparatorComponent = ItemSeparatorComponent;
|
|
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 _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 = (require(6533) /* metro dependency 6533: QuestContent */).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 = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const COLLECTIBLES_SHOP_ELEMENT_CLICKED = AnalyticEvents.COLLECTIBLES_SHOP_ELEMENT_CLICKED;
|
|
const object2 = {};
|
|
object2.collectibles_shop_session_id = env0_3 == null ? value3 : env0_3.sessionId;
|
|
object2.sku_id = heroBlock.categoryStoreListingId;
|
|
object2.page_type = 'mobile_home';
|
|
object2.page_section = env0_3 == null ? value3 : env0_3.pageSection;
|
|
object2.page_category = env0_3 == null ? value3 : env0_3.pageCategory;
|
|
object2.tile_type = 'HERO_BLOCK';
|
|
const String = global.String;
|
|
object2.tile_position = String(env0_3 == null ? value3 : env0_3.tilePosition);
|
|
object2.cta_name = null;
|
|
Reflect.apply(track, defaultImport, [COLLECTIBLES_SHOP_ELEMENT_CLICKED, object2]);
|
|
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} />)(importDefault(10020) /* metro dependency 10020: CollectiblesShopCardV2 */);
|
|
const CollectiblesAnalyticsProvider = (require(10023) /* metro dependency 10023: CollectiblesAnalyticsContext */).CollectiblesAnalyticsProvider;
|
|
const object = {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={object} key={item.skuId}>
|
|
{r5}
|
|
</CollectiblesAnalyticsProvider>
|
|
);
|
|
}
|
|
|