// Metro module 9489 (f9490). import { QuestHomeSortMethods, RewardFilterTypes, TaskFilterTypes } from "../QuestConstants"; import { intl, t } from "../../../intl/index.native"; 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 { copy } from "../../../utils/ClipboardUtils.native"; export function getContextualEntrypointHeading({ quest, taskDetails, thirdPartyTaskDetails }) { let r43; if (quest.userStatus?.completedAt != null) { return intl.string(t.BzFeTF); } if (quest.userStatus?.enrolledAt != null) { let percentComplete = taskDetails.percentComplete; if (thirdPartyTaskDetails != null) { percentComplete = thirdPartyTaskDetails.percentComplete; } L19: { if (percentComplete >= 0.75) { r43 = intl.string(t.gvCR4H); } else { if (percentComplete >= 0.45 && percentComplete <= 0.55) { r43 = intl.string(t.JNx8sG); break L19; } r43 = percentComplete > 0 ? intl.string(t.JMbfnc) : intl.string(t["7e5k7L"]); } } return r43; } return intl.formatToPlainString(t.EQa7os, { questName: quest.config.messages.questName }); } export function getDisclosureText({ isTargetedDisclosure, isContextualDisclosure, isVideoQuest, gamePublisher, gameTitle, cosponsorName }) { return isTargetedDisclosure ? isContextualDisclosure ? intl.string(t.nPg6f1) : `${cosponsorName == null ? intl.formatToPlainString(t.Piihy1, { gamePublisher }) : intl.formatToPlainString(t.DV47Gy, { gamePublisher, cosponsorName })} ${intl.string(t.fEbrT8)}` : isVideoQuest ? intl.formatToPlainString(t.rctMRl, { gamePublisher }) : intl.formatToPlainString(t["5bQWNG"], { gamePublisher, gameTitle }); } export function getExternalCtaLabel(a0) { return a0.config.ctaConfig.buttonLabel; } export function getSortMethodText(a0) { if (QuestHomeSortMethods.SUGGESTED === a0) { return intl.string(t.gBfXPZ); } if (QuestHomeSortMethods.MOST_RECENT === a0) { return intl.string(t.K6oEu2); } if (QuestHomeSortMethods.EXPIRING_SOON === a0) { return intl.string(t.IB22n3); } if (QuestHomeSortMethods.RECENTLY_ENROLLED === a0) { return intl.string(t["BB+2tX"]); } } export function getFilterTypeText(a0) { if (RewardFilterTypes.VIRTUAL_CURRENCY === a0) { return intl.string(t.ElYQFS); } if (RewardFilterTypes.COLLECTIBLE === a0) { return intl.string(t.Jg17Ut); } if (RewardFilterTypes.IN_GAME === a0) { return intl.string(t["O/J2kr"]); } if (TaskFilterTypes.VIDEO === a0) { return intl.string(t.e0iISA); } if (TaskFilterTypes.PLAY === a0) { return intl.string(t["1nJR4p"]); } } export function getFilterGroupHeadingText(a0) { if (a0 === "reward") { return intl.string(t.vjLqAU); } if (a0 === "task") { return intl.string(t.Hufmss); } } export function getQuestUrl(a0) { return `${location.protocol}//${location.host}/quests/${a0}`; } export function getCtaLink(a0) { return a0.ctaConfig.link; } export function copyShareLink(a0, a1) { const ctaContent = a1.ctaContent; if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "copy_share_link")) { captureAdUserAction({ type: AdUserActionType.CLICK_INTERNAL, adCreativeType: AdCreativeType.QUEST, adCreativeId: a0, questContentCTA: ctaContent, surfaceId: a1.content, sourceQuestContent: a1.sourceQuestContent, questContentPosition: a1.position, impressionId: a1.impressionId }); } else { trackQuestContentClicked({ questId: a0, questContent: a1.content, questContentCTA: ctaContent, questContentPosition: a1.position, impressionId: a1.impressionId, sourceQuestContent: a1.sourceQuestContent }); } copy(`${location.protocol}//${location.host}/quests/${a0}`); } export function getDefaultReward(a0) { if (a0.rewardsConfig.rewards.length === 0) { throw new Error(`Quest ${a0.id} has no rewards configured`); } return a0.rewardsConfig.rewards[0]; }