58 lines
3.6 KiB
TypeScript
58 lines
3.6 KiB
TypeScript
// Metro module 15626 (f15627).
|
|
import CollectiblesMarketingsStore from "../CollectiblesMarketingsStore";
|
|
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
|
|
import { useSelectedVersionedDismissibleContent } from "../../dismissible_content/hooks/useSelectedDismissibleContent";
|
|
import { DismissibleContent } from "../../../_bundle/Module1358";
|
|
import YouScreenNavIcon from "../../main_tabs_v2/native/tabs/you/YouScreenNavIcon";
|
|
import { ShopIcon } from "../../../design/components/Icon/native/redesign/generated/ShopIcon";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import MobileShopButtonCoachmark from "./MobileShopButtonCoachmark";
|
|
import { useStateFromStores } from "../../../_bundle/defaultAreStatesEqual";
|
|
import { CollectiblesMarketingSurface } from "../../../_bundle/Module13124";
|
|
import { CollectiblesMarketingType } from "../../../_bundle/Module5822";
|
|
import SelectedDismissibleContent, { SelectedVersionedDismissibleContent } from "../../dismissible_content/native/SelectedDismissibleContent";
|
|
const CoachmarkVariant = function CoachmarkVariant(props) {
|
|
const { marketing, navigateToShop, shopButtonRef: shopButtonRef2 } = props;
|
|
const [r31, onDismiss] = useSelectedVersionedDismissibleContent(DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING, marketing.version, void 0, true);
|
|
let c22254_1 = onDismiss;
|
|
const showRedDot = r31 === DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING;
|
|
let c22254_2 = showRedDot;
|
|
return <>
|
|
<YouScreenNavIcon ref={shopButtonRef2} IconComponent={ShopIcon} accessibilityLabel={intl.string(t.pWG4ze)} onPress={() => {
|
|
if (c22254_2) {
|
|
c22254_1(ContentDismissActionType.TAKE_ACTION);
|
|
}
|
|
navigateToShop();
|
|
}} showRedDot={showRedDot} />
|
|
<MobileShopButtonCoachmark marketing={marketing} shopButtonRef={shopButtonRef2} navigateToShop={navigateToShop} visible={showRedDot} onDismiss={onDismiss} />
|
|
</>;
|
|
};
|
|
export default function CollectiblesShopEntryButton(props) {
|
|
let r48;
|
|
const { navigateToShop: navigateToShop2, shopButtonRef } = props;
|
|
const stateFromStores = useStateFromStores([CollectiblesMarketingsStore], () => CollectiblesMarketingsStore.getMarketingBySurface(CollectiblesMarketingSurface.MOBILE_SHOP_BUTTON));
|
|
const r1 = stateFromStores != null && "dismissibleContent" in stateFromStores && stateFromStores.dismissibleContent === DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING;
|
|
if (stateFromStores?.type === CollectiblesMarketingType.COACHMARK) {
|
|
return <CoachmarkVariant marketing={stateFromStores} navigateToShop={navigateToShop2} shopButtonRef={shopButtonRef} />;
|
|
}
|
|
const content = function content({ visibleContent, markAsDismissed }) {
|
|
return <YouScreenNavIcon ref={shopButtonRef} IconComponent={ShopIcon} accessibilityLabel={intl.string(t.pWG4ze)} onPress={() => {
|
|
navigateToShop2();
|
|
if (visibleContent != null) {
|
|
markAsDismissed(ContentDismissActionType.PRIMARY);
|
|
}
|
|
}} showRedDot={visibleContent != null} />;
|
|
};
|
|
if (r1) {
|
|
const contentType = stateFromStores?.type === CollectiblesMarketingType.BADGE ? DismissibleContent.COLLECTIBLES_SHOP_ENTRY_MARKETING : null;
|
|
let latestVersion = stateFromStores?.version;
|
|
if (latestVersion == null) {
|
|
latestVersion = 0;
|
|
}
|
|
r48 = <SelectedVersionedDismissibleContent contentType={contentType} latestVersion={latestVersion}>{content}</SelectedVersionedDismissibleContent>;
|
|
} else {
|
|
r48 = <SelectedDismissibleContent contentTypes={stateFromStores?.type === CollectiblesMarketingType.BADGE ? stateFromStores?.dismissibleContent != null ? [stateFromStores.dismissibleContent] : [] : []}>{content}</SelectedDismissibleContent>;
|
|
}
|
|
return r48;
|
|
};
|