159 lines
9.0 KiB
TypeScript
159 lines
9.0 KiB
TypeScript
// Metro module 14129 (f14130).
|
|
import { UserSettingsSections } from "../../../../Constants";
|
|
import * as _QuestUtils from "../../utils/QuestUtils";
|
|
import { useQuestPreviewActions } from "../../hooks/QuestHooks";
|
|
import { getExternalCtaLabel, copyShareLink } from "../../utils/QuestCopyUtils";
|
|
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
|
|
import { ActionSheetRow } from "../../../../design/components/Sheet/native/ActionSheetRow.native";
|
|
import { LinkExternalMediumIcon } from "../../../../design/components/Icon/native/redesign/generated/LinkExternalMediumIcon";
|
|
import { FormLabel } from "../../../../design/void/Form/native/index";
|
|
import { openGameLinkDirectly } from "../../utils/QuestPlatformUtils";
|
|
import { QuestContent } from "../../QuestTypes";
|
|
import { QuestContentCTA } from "../../lib/analytics/AnalyticsTypes";
|
|
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
|
|
import { CopyIcon } from "../../../../design/components/Icon/native/redesign/generated/CopyIcon";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import WreathIcon from "./WreathIcon";
|
|
import { shouldMigrateToAdAnalyticsInterface, AdAnalyticsInterfaceExperimentStep } from "../../experiments/AdAnalyticsInterfaceExperiment";
|
|
import { captureAdUserAction } from "../../../ads/analytics/captureAdUserAction";
|
|
import { AdUserActionType } from "../../../ads/analytics/captureAdUserActionTypes";
|
|
import { AdCreativeType } from "../../../../_bundle/Module6013";
|
|
import { trackQuestContentClicked } from "../../lib/analytics/AnalyticsActions";
|
|
import { openQuestHome } from "../QuestUtils.native";
|
|
import { CircleQuestionIcon } from "../../../../design/components/Icon/native/redesign/generated/CircleQuestionIcon";
|
|
import QuestDisclosureModalActionCreators from "../QuestDisclosureModal/QuestDisclosureModalActionCreators";
|
|
import { XSmallIcon } from "../../../../design/components/Icon/native/redesign/generated/XSmallIcon";
|
|
import { dismissQuestContent, markAdContentUnseen } from "../../QuestActionCreators";
|
|
import { displayQuestDismissalToast } from "../QuestDockDismissalToast";
|
|
import { TrophyIcon } from "../../../../design/components/Icon/native/redesign/generated/TrophyIcon";
|
|
import { RedoIcon } from "../../../../design/components/Icon/native/redesign/generated/RedoIcon";
|
|
import { UndoIcon } from "../../../../design/components/Icon/native/redesign/generated/UndoIcon";
|
|
import { UnsendIcon } from "../../../../design/components/Icon/native/redesign/generated/UnsendIcon";
|
|
import { EyeIcon } from "../../../../design/components/Icon/native/redesign/generated/EyeIcon";
|
|
import { openUserSettings } from "../../../user_settings/core/native/openUserSettings";
|
|
import { copy } from "../../../../utils/ClipboardUtils.native";
|
|
export default function QuestDockContextMenuActionSheet(props) {
|
|
const quest = props.quest;
|
|
const isShareableQuest = _QuestUtils.isShareableQuest(quest.config);
|
|
const questPreviewActions = useQuestPreviewActions(quest.id);
|
|
const { handleComplete, handleProgress, handleResetDismissibilityClick, handleResetStatusClick } = questPreviewActions;
|
|
return <ActionSheet>
|
|
<ActionSheetRow.Group hasIcons>
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={LinkExternalMediumIcon} />} label={<FormLabel text={getExternalCtaLabel(quest)} />} onPress={() => {
|
|
openGameLinkDirectly(quest, {
|
|
content: QuestContent.QUEST_BAR_MOBILE,
|
|
ctaContent: QuestContentCTA.CONTEXT_MENU_OPEN_GAME_LINK,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
{isShareableQuest && <ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={CopyIcon} />} label={<FormLabel text={intl.string(t.WqhZss)} />} onPress={() => {
|
|
copyShareLink(quest.id, {
|
|
content: QuestContent.QUEST_BAR_MOBILE,
|
|
ctaContent: QuestContentCTA.CONTEXT_MENU_COPY_LINK,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />}
|
|
</ActionSheetRow.Group>
|
|
<ActionSheetRow.Group hasIcons>
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={WreathIcon} />} label={<FormLabel text={intl.string(t.LLLLPD)} />} onPress={() => {
|
|
if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_dock_context_menu")) {
|
|
captureAdUserAction({
|
|
type: AdUserActionType.CLICK_INTERNAL,
|
|
adCreativeType: AdCreativeType.QUEST,
|
|
adCreativeId: quest.id,
|
|
questContentCTA: QuestContentCTA.CONTEXT_MENU_LEARN_MORE,
|
|
surfaceId: QuestContent.QUEST_BAR_MOBILE,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
} else {
|
|
trackQuestContentClicked({
|
|
questId: quest.id,
|
|
questContent: QuestContent.QUEST_BAR_MOBILE,
|
|
questContentCTA: QuestContentCTA.CONTEXT_MENU_LEARN_MORE,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
}
|
|
openQuestHome({
|
|
scrollToQuestId: quest.id,
|
|
fromContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={CircleQuestionIcon} />} label={<FormLabel text={intl.string(t.GcsZKJ)} />} onPress={() => {
|
|
QuestDisclosureModalActionCreators.showModal({
|
|
quest,
|
|
isTargetedDisclosure: true,
|
|
trackingCtx: {
|
|
content: QuestContent.QUEST_BAR_MOBILE,
|
|
ctaContent: QuestContentCTA.CONTEXT_MENU_OPEN_DISCLOSURE,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
}
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={XSmallIcon} />} label={<FormLabel text={intl.string(t.NN79E9)} />} subLabel={intl.string(t.V6htN5)} onPress={async () => {
|
|
let c27643_0;
|
|
c27643_0 = void 0;
|
|
const r38 = dismissQuestContent(quest.id, QuestContent.QUEST_BAR_MOBILE);
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_dock_context_menu")) {
|
|
captureAdUserAction({
|
|
type: AdUserActionType.CLICK_INTERNAL,
|
|
adCreativeType: AdCreativeType.QUEST,
|
|
adCreativeId: quest.id,
|
|
questContentCTA: QuestContentCTA.CONTEXT_MENU_HIDE_CONTENT,
|
|
surfaceId: QuestContent.QUEST_BAR_MOBILE,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
} else {
|
|
trackQuestContentClicked({
|
|
questId: quest.id,
|
|
questContent: QuestContent.QUEST_BAR_MOBILE,
|
|
questContentCTA: QuestContentCTA.CONTEXT_MENU_HIDE_CONTENT,
|
|
sourceQuestContent: QuestContent.QUEST_BAR_MOBILE
|
|
});
|
|
}
|
|
await r38;
|
|
displayQuestDismissalToast();
|
|
}} />
|
|
</ActionSheetRow.Group>
|
|
{quest.preview && <ActionSheetRow.Group title={intl.string(t["Ape+mm"])} hasIcons>
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={TrophyIcon} />} label={<FormLabel text={intl.string(t.jQEfRT)} />} onPress={() => {
|
|
handleComplete();
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={RedoIcon} />} label={<FormLabel text={intl.string(t.cKSLr4)} />} onPress={() => {
|
|
handleProgress(0.9 * Math.random() + 0.03);
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={UndoIcon} />} label={<FormLabel text={intl.string(t.taqkwK)} />} onPress={() => {
|
|
handleResetStatusClick();
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={UnsendIcon} />} label={<FormLabel text={intl.string(t.JF6W66)} />} onPress={() => {
|
|
handleResetDismissibilityClick();
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={EyeIcon} />} label={<FormLabel text={intl.string(t["lL6/zF"])} />} onPress={() => {
|
|
markAdContentUnseen(AdCreativeType.QUEST, [quest.id]);
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={EyeIcon} />} label={<FormLabel text={intl.string(t.tx5Ax5)} />} onPress={() => {
|
|
openUserSettings({
|
|
screen: UserSettingsSections.QUEST_PREVIEW_TOOL_2,
|
|
params: {
|
|
questId: quest.id
|
|
}
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
<ActionSheetRow icon={<ActionSheetRow.Icon IconComponent={CopyIcon} />} label={<FormLabel text={intl.string(t.oisrFi)} />} onPress={() => {
|
|
copy(quest.id);
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
}} />
|
|
</ActionSheetRow.Group>}
|
|
</ActionSheet>;
|
|
};
|