306 lines
20 KiB
TypeScript
306 lines
20 KiB
TypeScript
/* Metro module 14055; source: modules/collectibles/native/FramesHeroBlock.tsx; dependencies: [31, 27, 5121, 663, 661, 33, 10020, 4501, 697, 14056, 14057, 1484, 10023, 566, 4048, 10154, 14058, 14049, 6771, 6789, 683, 4002, 14060, 14061, 10155, 10089, 4589, 4573, 4578, 1244, 9480, 6533, 5278, 6818, 6517, 14062, 8416, 14065, 2] */
|
|
function _fun106582(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#106582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14252:6, offset: 0x022e1367, size: 1123 bytes, params: 8, frame: 28
|
|
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%'};
|
|
const object7 = {'position': 'absolute', 'top': null, 'left': 0, 'right': 0, 'paddingHorizontal': null,
|
|
'alignItems': 'flex-start', 'zIndex': 2};
|
|
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
|
|
object7.top = PX_24;
|
|
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object7.paddingHorizontal = PX_16;
|
|
object2.framesBadgeContainer = object7;
|
|
const object8 = {'marginTop': -250, 'paddingTop': 240, 'paddingBottom': null, 'paddingHorizontal': null,
|
|
'flexDirection': 'row', 'alignItems': 'center', 'borderRadius': null, 'overflow': 'hidden', 'zIndex': 0};
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object8.paddingBottom = PX_16;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object8.paddingHorizontal = PX_16;
|
|
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object2.framesBannerWrapper = object8;
|
|
const object9 = {'position': 'absolute', 'top': 0, 'left': 0, 'right': 0, 'bottom': 0, 'resizeMode': 'stretch'};
|
|
object9.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
|
|
object2.framesBannerBackgroundImage = object9;
|
|
const object10 = {flex: 1};
|
|
let PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
|
|
object10.paddingRight = PX_4;
|
|
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
|
|
object10.marginTop = PX_24;
|
|
object2.framesBannerTextContainer = object10;
|
|
PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
|
|
object2.framesBannerTitle = {marginBottom: PX_4};
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object2.framesBannerForegroundImage = {'width': 125, 'height': 125, 'resizeMode': 'contain',
|
|
transform: [{translateY: PX_16}]};
|
|
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.heroInfoContainer = {'display': 'flex', 'justifyContent': 'center', 'flex': 1, 'minWidth': '100%',
|
|
'maxHeight': 240, 'aspectRatio': 2.2};
|
|
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 object11 = {};
|
|
const CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT;
|
|
object11.backgroundColor = CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT;
|
|
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
|
|
object11.padding = PX_8;
|
|
object11.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
|
|
object2.heroViewAllIcon = object11;
|
|
const object14 = {};
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object14.paddingHorizontal = PX_16;
|
|
object14.alignItems = 'flex-start';
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object14.gap = PX_16;
|
|
object2.orbsInnerContainer = object14;
|
|
object2.orbsTitle = {'fontSize': 24, 'lineHeight': 30};
|
|
object2.productCardsContainer = {zIndex: 1};
|
|
const object16 = {flexDirection: 'row'};
|
|
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
|
|
object16.gap = PX_12;
|
|
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
|
|
object16.paddingHorizontal = PX_16;
|
|
object2.skeletonContainer = object16;
|
|
const env0_14 = Reflect.apply(createStyles, createStylesModule, [object2]);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/collectibles/native/FramesHeroBlock.tsx');
|
|
exports.default = _default_106585;
|
|
}
|
|
|
|
function SkeletonLoading({accessibilityLabel}) { // fn#106583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14252:2274, offset: 0x022e17ca, 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(_fun106584)}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function _default_106585({heroBlock, bannerBlock, preferVCPrice, screen}) { // fn#106585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14252:2555, offset: 0x022e1890, size: 2683 bytes, params: 2, frame: 49
|
|
var r21;
|
|
var r26;
|
|
var r14;
|
|
var length;
|
|
var jsxRuntimeEnv0_12Binding;
|
|
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 items4;
|
|
var items5;
|
|
var items6;
|
|
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 r30 = 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 r17 = 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 value6 = (require(14049) /* metro dependency 14049: useFilteredAndSortedProducts */).useFilteredAndSortedProducts({products: env0_3.useMemo(_fun106587,
|
|
[heroBlock.rankedSkuIds, (importDefault(14058) /* metro dependency 14058: useGetProductsFromSkus */)()]),
|
|
bypassAndroidUnsyncedFilter: r17});
|
|
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 r32 = heroBlock.mobileTitle ?? heroBlock.title;
|
|
const r33 = heroBlock.mobileSummary ?? heroBlock.summary;
|
|
r30 = r17 ? (require(4002) /* metro dependency 4002: shared */).isThemeDark(value3) ? importDefault(14060) /* metro dependency 14060: header_darkJpg */ : importDefault(14061) /* metro dependency 14061: header_lightJpg */ : r30;
|
|
const AnalyticsLocationProvider = (require(6771) /* metro dependency 6771: useAnalyticsLocations */).AnalyticsLocationProvider;
|
|
const VisibilitySensor = importDefault(10155) /* metro dependency 10155: VisibilitySensor */;
|
|
const items2 = [<View style={styles.framesBadgeContainer}>{((Component) => <Component location="CollectiblesShop" disablePressable />)(importDefault(10089) /* metro dependency 10089: FramesEarlyAccessBadge */)}</View>];
|
|
items2[1] = <View style={styles.heroBannerContainer}>{r30 != null && <>{r17 && ((Component) => <Component colors={['rgba(39, 30, 173, 0.3)',
|
|
'transparent']} start={VerticalGradient.START} end={VerticalGradient.END} style={styles.orbsBackgroundGradient} />)(importDefault(4589) /* metro dependency 4589 */)}<Image style={[styles.heroBannerImage]} source={{uri: r30}} /></>}</View>;
|
|
if (r17) {
|
|
var viewBinding6Props = {style: styles.orbsInnerContainer};
|
|
r26 = r32 != null && <Text variant="display-md" color="mobile-text-heading-primary" style={styles.orbsTitle}>{r32}</Text>;
|
|
items5 = [r26];
|
|
r26 = r33 != null && r33 !== '';
|
|
r26 = r26 && <Text variant="text-md/medium">{r33}</Text>;
|
|
items5[1] = r26;
|
|
items6 = [<View>{items5}</View>];
|
|
items6[1] = ((Button) => <Button variant="tertiary" shrink grow={false} size="sm" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.ynollq)} onPress={onPress_106588} />)((require(4578) /* metro dependency 4578: ButtonNative */).Button);
|
|
r14 = <View {...viewBinding6Props}>{items6}</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_106589;
|
|
var viewBinding3Props = {style: styles.innerContainer};
|
|
items4 = [heroLogoUrl != null && <View style={styles.heroLogoContainer}><Image style={styles.heroLogo} source={{uri: heroLogoUrl}} /></View>];
|
|
items4[1] = <View style={styles.heroViewAllIcon}>{((ChevronSmallRightIcon) => <ChevronSmallRightIcon size="sm" color="white" />)((require(6818) /* metro dependency 6818: ChevronSmallRightIcon */).ChevronSmallRightIcon)}</View>;
|
|
r14 = <PressableOpacity {...pressableOpacityProps} key={category.storeListingId}><View {...viewBinding3Props}>{items4}</View></PressableOpacity>;
|
|
}
|
|
items2[2] = <View style={styles.heroInfoContainer}>{r14}</View>;
|
|
const LayerScope = (require(6517) /* metro dependency 6517: LayerScopeNative */).LayerScope;
|
|
if (r17) {
|
|
FeedProductList = importDefault(14062) /* metro dependency 14062: FeedProductList */;
|
|
length = value6.length;
|
|
length = length === 0 ? 4 : value6.length;
|
|
r17 = <FeedProductList products={value6} loadingCardsNum={length} preferVCPrice={preferVCPrice} accessibilityLabel={intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.FNtLb3,
|
|
|
|
{category: category.name})} />;
|
|
} else {
|
|
jsxRuntimeEnv0_12Binding = jsxRuntimeEnv0_12;
|
|
if (value6.length === 0) {
|
|
r21 = <SkeletonLoading 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: value6, onScroll: handleDismissCoachmarkOnScroll,
|
|
renderItem: renderItem_106590, 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;
|
|
r21 = <FlashList {...flashListProps} />;
|
|
}
|
|
r17 = <>{r21}</>;
|
|
}
|
|
items2[3] = <View style={styles.productCardsContainer}><LayerScope>{r17}</LayerScope></View>;
|
|
const items7 = [bannerBlock.mobileBackgroundImage != null && <Image style={styles.framesBannerBackgroundImage} source={{uri: bannerBlock.mobileBackgroundImage}} />];
|
|
var Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
items7[1] = <View style={styles.framesBannerTextContainer}><Text variant="text-lg/bold" color="control-overlay-secondary-text-default" style={styles.framesBannerTitle}>{bannerBlock.title}</Text><Text variant="text-sm/normal" color="control-overlay-secondary-text-default">{bannerBlock.body}</Text></View>;
|
|
items7[2] = bannerBlock.mobileForegroundImage != null && <Image style={styles.framesBannerForegroundImage} source={{uri: bannerBlock.mobileForegroundImage}} />;
|
|
items2[4] = <View style={styles.framesBannerWrapper}>{items7}</View>;
|
|
return (
|
|
<AnalyticsLocationProvider value={analyticsLocations}>
|
|
<VisibilitySensor onChange={handleCardVisibilityChange}>
|
|
<View style={styles.heroContainer}>
|
|
{items2}
|
|
</View>
|
|
</VisibilitySensor>
|
|
</AnalyticsLocationProvider>
|
|
);
|
|
}
|
|
|
|
function _default_106585OnPress() { // fn#106588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14252:4376, owner: _default_106585.onPress, offset: 0x022e2346, 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_106585OnPress_106589() { // fn#106589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14252:4774, owner: _default_106585.onPress, offset: 0x022e2392, 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_106585RenderItem({item, index}) { // fn#106590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14252:6041, owner: _default_106585.renderItem, offset: 0x022e249c, 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>
|
|
);
|
|
}
|
|
|