// Metro module 14638 (f14639).
import { useEffect, useCallback } from "react";
import { View } from "react-native";
import CollectiblesCategoryStore from "../CollectiblesCategoryStore";
import { CollectiblesMobileShopScreen } from "../CollectiblesShopConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import { useCollectiblesAnalyticsContext } from "../CollectiblesAnalyticsContext";
import { useCollectiblesShopDeepLinkProps } from "./useCollectiblesShopDeepLinkProps";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { openProductDetailsActionSheet } from "./openProductDetailsActionSheet";
import ShopBlockItem from "./ShopBlockItem";
import { EmptyState } from "../../../design/void/native";
import { NoResults } from "../../../design/components/Illustration/native/redesign/generated/NoResults";
import { intl, t } from "../../../intl/index.native";
import ShopFlashList from "./ShopFlashList";
const useStyles = createStyles({
container: {
display: "flex",
flex: 1
}
});
export default ({ shopBlocks, fetchShopHomeError, onRenderFirstOrbsItem, getItemType }) => {
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const collectiblesAnalyticsContext = useCollectiblesAnalyticsContext();
const collectiblesShopDeepLinkProps = useCollectiblesShopDeepLinkProps({});
const { initialProductSkuId, initialVariantIndex, initialCategorySkuId } = collectiblesShopDeepLinkProps;
useEffect(() => {
if (initialProductSkuId != null && initialCategorySkuId != null) {
const category = CollectiblesCategoryStore.getCategory(initialCategorySkuId);
const product = category == null ? void 0 : category.products.find((product) => product.skuId === initialProductSkuId);
if (product != null) {
ActionSheetActionCreators.hideActionSheet();
let shopAnalyticsContext = collectiblesAnalyticsContext;
if (collectiblesAnalyticsContext == null) {
shopAnalyticsContext = void 0;
}
openProductDetailsActionSheet({
product,
initialVariantIndex,
analyticsLocations,
shopAnalyticsContext
});
}
}
}, [initialProductSkuId, initialVariantIndex, initialCategorySkuId, analyticsLocations, collectiblesAnalyticsContext]);
const callback = useCallback((a0) => {
const item = a0.item;
if (a0.index === 0) {
onRenderFirstOrbsItem();
}
return ;
}, [onRenderFirstOrbsItem]);
return fetchShopHomeError === null && shopBlocks.length !== 0 ? :
;
};