672 lines
29 KiB
TypeScript
672 lines
29 KiB
TypeScript
// Metro module 10967 (f10968).
|
|
import { useMemo } from "react";
|
|
import LocaleStore from "../../user_settings/LocaleStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { ORBS_INTRO_QUEST_ID, QuestVariants, QuestsExperimentLocations } from "../QuestConstants";
|
|
import { HelpdeskArticles } from "../../../Constants";
|
|
import { PremiumTypes } from "../../premium/PremiumConstants";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { useThirdPartyTaskDetails, useQuestTaskDetails, useConnectedConsoleLinkOnClick, useQuestFormattedDate, useIsQuestProgressing, useTaskPlatformScreen } from "./QuestHooks";
|
|
import * as _QuestUtils from "../utils/QuestUtils";
|
|
import { isPlayAnyActivityQuest, canLaunchActivity, getQuestType } from "../utils/QuestUtils";
|
|
import { isConsoleQuest, shouldUsePlayOnDesktopTask, hasWatchVideoTasks, getDefaultWatchVideoTask, hasPlayActivityTask, hasAchievementInGameTask, getInGameApplicationId, getAllApplicationIds, hasPlayOnDesktopTask, hasStreamOnDesktopTask, hasWatchVideoOnMobileTasks, isInGameQuest } from "../utils/QuestTaskUtils";
|
|
import * as _QuestRewardUtils from "../utils/QuestRewardUtils";
|
|
import { getCollectibleQuestRewardDuration, getDefaultRewardNameWithArticle, getRewardCodeQuestReward } from "../utils/QuestRewardUtils";
|
|
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
|
|
import { createGameSheetHook } from "../SponsoredQuestUtils.native";
|
|
import * as _PremiumTypeUtils from "../../../utils/PremiumTypeUtils";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import { useInGameQuestConnectState } from "../useInGameQuestConnectState";
|
|
import useOpenGameProfileModal from "../../game_profile/hooks/useOpenGameProfileModal";
|
|
import { GameProfileSources } from "../../game_profile/GameProfileAnalyticUtils";
|
|
import { TaskPlatformScreen, QuestRewardCodePlatforms } from "../QuestTypes";
|
|
import { getContextualEntrypointHeading, getDefaultReward, getExternalCtaLabel } from "../utils/QuestCopyUtils";
|
|
import { formatPercent } from "../../../utils/NumberUtils";
|
|
import isActivitySupportedOnClientPlatform from "../../activities/utils/isActivitySupportedOnClientPlatform";
|
|
import { getVideoQuestWatchCtaText } from "../utils/MobileQuestVideoWatchCtaCopy";
|
|
import { openGameLinkDirectly } from "../utils/QuestPlatformUtils";
|
|
import { QuestContentCTA } from "../lib/analytics/AnalyticsTypes";
|
|
import { QuestType } from "../../../_bundle/Module6011";
|
|
let useQuestsInstructionsToWinReward, c7389_15;
|
|
const _getQuestsInstructionsToWinReward = function _getQuestsInstructionsToWinReward({ quest: quest3, taskDetails, thirdPartyTaskDetails, sourceQuestContent: sourceQuestContent2, withoutMarkdown, currentUser, popoutTargetElementRef, onGameSheetOpened, onGameSheetClosed, onGameTitleClick, needsToConnect }) {
|
|
let r90, r111, r130, r199, r255, r324, r374, r423, r515, gameTitle, gameTitle2, gameTitle4, gameTitle5, gameTitle6, targetMinutes, targetMinutes4, targetMinutes5, targetMinutes6;
|
|
const isPremium = _PremiumTypeUtils.isPremium(currentUser, PremiumTypes.TIER_2);
|
|
const collectibleQuestRewardDuration = getCollectibleQuestRewardDuration(quest3.config);
|
|
const r39 = isConsoleQuest(quest3) && shouldUsePlayOnDesktopTask(quest3);
|
|
L289: {
|
|
const isSponsoredPlayQuest = _QuestUtils.isSponsoredPlayQuest(quest3);
|
|
const defaultRewardNameWithArticle = getDefaultRewardNameWithArticle(quest3.config, currentUser);
|
|
if (isSponsoredPlayQuest) {
|
|
const targetMinutes7 = taskDetails.targetMinutes;
|
|
let applications = taskDetails.applications;
|
|
if (withoutMarkdown) {
|
|
r515 = intl.formatToPlainString(t["1votF6"], {
|
|
rewardNameWithArticle: defaultRewardNameWithArticle,
|
|
targetMinutes: targetMinutes7
|
|
});
|
|
} else {
|
|
if (applications == null) {
|
|
applications = [];
|
|
}
|
|
const gameSheetHook = createGameSheetHook({
|
|
quest: quest3,
|
|
sourceQuestContent: sourceQuestContent2,
|
|
applications,
|
|
popoutTargetElementRef,
|
|
onGameSheetOpened,
|
|
onGameSheetClosed
|
|
});
|
|
const r463 = {};
|
|
r463[QuestVariants.PACKAGE_ACTION_ADVENTURE] = t.H485IA;
|
|
r463[QuestVariants.PACKAGE_RPG_MMO] = t["3XS8Ni"];
|
|
r463[QuestVariants.PACKAGE_RACING_SPORTS] = t["X+UCju"];
|
|
r463[QuestVariants.PACKAGE_SANDBOX_CREATIVE] = t["6o4n1Q"];
|
|
r463[QuestVariants.PACKAGE_FAMILY_FRIENDLY] = t.DUsNmf;
|
|
r463[QuestVariants.PACKAGE_HOLIDAY_SEASON] = t["cWP8/Z"];
|
|
r463[QuestVariants.PACKAGE_NEW_YEARS] = t["8+sIJz"];
|
|
let c18416_0 = r463;
|
|
const r504 = quest3.config.features.find((feature) => feature in c18416_0);
|
|
let r506 = r504 != null ? r463[r504] : null;
|
|
if (r506 == null) {
|
|
r506 = t.CDeHul;
|
|
}
|
|
r515 = intl.format(r506, {
|
|
rewardNameWithArticle: defaultRewardNameWithArticle,
|
|
targetMinutes: targetMinutes7,
|
|
gameSheetHook
|
|
});
|
|
}
|
|
r111 = r515;
|
|
} else if (r39) {
|
|
L274: {
|
|
targetMinutes6 = taskDetails.targetMinutes;
|
|
gameTitle6 = quest3.config.messages.gameTitle;
|
|
const isCollectibleQuestRewardPremiumExtendable6 = _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(quest3.config);
|
|
const isCollectibleQuestRewardPermanentWithPremiumSubscription6 = _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(quest3.config);
|
|
const r417 = quest3.config.features.includes(QuestVariants.NON_GAMING_PLAY_QUEST);
|
|
const r419 = onGameTitleClick != null;
|
|
if (isPremium && isCollectibleQuestRewardPremiumExtendable6) {
|
|
r423 = isCollectibleQuestRewardPermanentWithPremiumSubscription6 ? r417 ? collectibleQuestRewardDuration != null ? t.u5QXpw : t.ztXW8V : collectibleQuestRewardDuration != null ? r419 ? t["/4XT0b"] : t["0hwcvM"] : r419 ? t.tQoqXX : t["eb/Sna"] : r417 ? t["1AcTqm"] : r419 ? t.klYWbT : t.ziB0HF;
|
|
} else if (!isCollectibleQuestRewardPremiumExtendable6 && collectibleQuestRewardDuration == null) {
|
|
if (r417) {
|
|
r423 = t["e+K3xJ"];
|
|
break L274;
|
|
}
|
|
if (r419) {
|
|
r423 = t.GFdaUK;
|
|
break L274;
|
|
}
|
|
r423 = t.NIimTt;
|
|
} else {
|
|
r423 = r417 ? t.enQ3jU : r419 ? t["4JS2QJ"] : t.AwuMRS;
|
|
}
|
|
}
|
|
const r447 = {
|
|
gameTitle: gameTitle6,
|
|
streamingDurationRequirement: targetMinutes6,
|
|
rewardNameWithArticle: defaultRewardNameWithArticle,
|
|
duration: collectibleQuestRewardDuration,
|
|
targetMinutes: targetMinutes6,
|
|
onGameTitleClick
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r423, r447) : intl.format(r423, r447);
|
|
} else if (isConsoleQuest(quest3)) {
|
|
L225: {
|
|
targetMinutes5 = taskDetails.targetMinutes;
|
|
gameTitle5 = quest3.config.messages.gameTitle;
|
|
const isCollectibleQuestRewardPremiumExtendable5 = _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(quest3.config);
|
|
const isCollectibleQuestRewardPermanentWithPremiumSubscription5 = _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(quest3.config);
|
|
const r370 = onGameTitleClick != null;
|
|
if (isPremium && isCollectibleQuestRewardPremiumExtendable5) {
|
|
r374 = isCollectibleQuestRewardPermanentWithPremiumSubscription5 ? collectibleQuestRewardDuration != null ? r370 ? t["/4XT0b"] : t["0hwcvM"] : r370 ? t.tQoqXX : t["eb/Sna"] : r370 ? t.klYWbT : t.ziB0HF;
|
|
} else if (!isCollectibleQuestRewardPremiumExtendable5 && collectibleQuestRewardDuration == null) {
|
|
if (r370) {
|
|
r374 = t.GFdaUK;
|
|
break L225;
|
|
}
|
|
r374 = t.NIimTt;
|
|
} else {
|
|
r374 = r370 ? t["4JS2QJ"] : t.AwuMRS;
|
|
}
|
|
}
|
|
const r391 = {
|
|
gameTitle: gameTitle5,
|
|
targetMinutes: targetMinutes5,
|
|
rewardNameWithArticle: defaultRewardNameWithArticle,
|
|
duration: collectibleQuestRewardDuration,
|
|
streamingDurationRequirement: targetMinutes5,
|
|
onGameTitleClick
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r374, r391) : intl.format(r374, r391);
|
|
} else if (shouldUsePlayOnDesktopTask(quest3)) {
|
|
L191: {
|
|
targetMinutes4 = taskDetails.targetMinutes;
|
|
gameTitle4 = quest3.config.messages.gameTitle;
|
|
const isCollectibleQuestRewardPremiumExtendable4 = _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(quest3.config);
|
|
const isCollectibleQuestRewardPermanentWithPremiumSubscription4 = _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(quest3.config);
|
|
const r318 = quest3.config.features.includes(QuestVariants.NON_GAMING_PLAY_QUEST);
|
|
const r320 = onGameTitleClick != null;
|
|
if (isPremium && isCollectibleQuestRewardPremiumExtendable4) {
|
|
r324 = isCollectibleQuestRewardPermanentWithPremiumSubscription4 ? r318 ? collectibleQuestRewardDuration != null ? t.u5QXpw : t.ztXW8V : collectibleQuestRewardDuration != null ? r320 ? t["/4XT0b"] : t["0hwcvM"] : r320 ? t.tQoqXX : t["eb/Sna"] : r318 ? t["1AcTqm"] : r320 ? t.klYWbT : t.ziB0HF;
|
|
} else if (!isCollectibleQuestRewardPremiumExtendable4 && collectibleQuestRewardDuration == null) {
|
|
if (r318) {
|
|
r324 = t["03VJqu"];
|
|
break L191;
|
|
}
|
|
if (r320) {
|
|
r324 = t.NrD2h8;
|
|
break L191;
|
|
}
|
|
r324 = t.FZL5Q5;
|
|
} else {
|
|
r324 = r318 ? t.enQ3jU : r320 ? t["4JS2QJ"] : t.AwuMRS;
|
|
}
|
|
}
|
|
const r348 = {
|
|
gameTitle: gameTitle4,
|
|
streamingDurationRequirement: targetMinutes4,
|
|
rewardNameWithArticle: defaultRewardNameWithArticle,
|
|
duration: collectibleQuestRewardDuration,
|
|
questReward: defaultRewardNameWithArticle,
|
|
onGameTitleClick
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r324, r348) : intl.format(r324, r348);
|
|
} else if (_QuestRewardUtils.isTieredRewardCodeQuest({
|
|
quest: quest3
|
|
})) {
|
|
const targetMinutes3 = taskDetails.targetMinutes;
|
|
const gameTitle3 = quest3.config.messages.gameTitle;
|
|
const r288 = onGameTitleClick != null ? t.HHVg4i : t["a/ia7F"];
|
|
const r292 = {
|
|
gameTitle: gameTitle3,
|
|
streamingDurationRequirement: targetMinutes3,
|
|
onGameTitleClick
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r288, r292) : intl.format(r288, r292);
|
|
} else if (hasWatchVideoTasks(quest3)) {
|
|
const defaultWatchVideoTask = getDefaultWatchVideoTask(quest3.config);
|
|
let videoTitle = defaultWatchVideoTask == null ? void 0 : defaultWatchVideoTask.messages.videoTitle;
|
|
if (videoTitle == null) {
|
|
videoTitle = "video";
|
|
}
|
|
L134: {
|
|
const isCollectibleQuestRewardPremiumExtendable3 = _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(quest3.config);
|
|
const isCollectibleQuestRewardPermanentWithPremiumSubscription3 = _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(quest3.config);
|
|
if (isCollectibleQuestRewardPremiumExtendable3 && isPremium) {
|
|
r255 = isCollectibleQuestRewardPermanentWithPremiumSubscription3 ? collectibleQuestRewardDuration != null ? t.tXwfJT : t["xqX+r5"] : t["vs/xBu"];
|
|
} else if (!isCollectibleQuestRewardPremiumExtendable3 && collectibleQuestRewardDuration == null) {
|
|
if (quest3.id === ORBS_INTRO_QUEST_ID) {
|
|
r255 = t.Rsd5bL;
|
|
break L134;
|
|
}
|
|
r255 = t["g+InPC"];
|
|
} else {
|
|
r255 = t["W/HkLO"];
|
|
}
|
|
}
|
|
const r273 = {
|
|
videoTitle,
|
|
rewardNameWithArticle: defaultRewardNameWithArticle,
|
|
duration: collectibleQuestRewardDuration
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r255, r273) : intl.format(r255, r273);
|
|
} else if (hasPlayActivityTask(quest3)) {
|
|
L111: {
|
|
const targetMinutes2 = taskDetails.targetMinutes;
|
|
if (isPlayAnyActivityQuest(quest3)) {
|
|
const VYwSSu = t.VYwSSu;
|
|
const r226 = {
|
|
streamingDurationRequirement: targetMinutes2,
|
|
questReward: defaultRewardNameWithArticle
|
|
};
|
|
r199 = withoutMarkdown ? intl.formatToPlainString(VYwSSu, r226) : intl.format(VYwSSu, r226);
|
|
} else {
|
|
if (quest3.config.features.includes(QuestVariants.CLOUD_GAMING_ACTIVITY) && quest3.config.features.includes(QuestVariants.CLOUD_GAMING_PROVIDER_NVIDIA)) {
|
|
const r204 = t["0NNM3l"];
|
|
const r208 = {
|
|
activityName: quest3.config.messages.gameTitle,
|
|
providerName: "NVIDIA GeForce NOW",
|
|
providerLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.NVIDIA_GEFORCE_CLOUD_GAMING_QUEST),
|
|
streamingDurationRequirement: targetMinutes2,
|
|
questReward: defaultRewardNameWithArticle
|
|
};
|
|
r199 = withoutMarkdown ? intl.formatToPlainString(r204, r208) : intl.format(r204, r208);
|
|
break L111;
|
|
}
|
|
const UuzHh8 = t.UuzHh8;
|
|
const r194 = {
|
|
activityName: quest3.config.messages.gameTitle,
|
|
streamingDurationRequirement: targetMinutes2,
|
|
questReward: defaultRewardNameWithArticle
|
|
};
|
|
r199 = withoutMarkdown ? intl.formatToPlainString(UuzHh8, r194) : intl.format(UuzHh8, r194);
|
|
}
|
|
}
|
|
r111 = r199;
|
|
} else {
|
|
if (hasAchievementInGameTask(quest3) && thirdPartyTaskDetails != null) {
|
|
L88: {
|
|
gameTitle2 = quest3.config.messages.gameTitle;
|
|
const isCollectibleQuestRewardPremiumExtendable2 = _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(quest3.config);
|
|
const isCollectibleQuestRewardPermanentWithPremiumSubscription2 = _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(quest3.config);
|
|
const r126 = onGameTitleClick != null;
|
|
if (needsToConnect) {
|
|
r130 = r126 ? t["0SLl/G"] : t.BlfaHK;
|
|
} else {
|
|
if (isPremium && isCollectibleQuestRewardPremiumExtendable2) {
|
|
r130 = isCollectibleQuestRewardPermanentWithPremiumSubscription2 ? collectibleQuestRewardDuration != null ? r126 ? t.uLVYG5 : t.NdXW5c : r126 ? t["2Ctf1d"] : t["8066TK"] : collectibleQuestRewardDuration != null ? r126 ? t.yMEn77 : t["6FOKAX"] : r126 ? t.bxN0nx : t.thO6iA;
|
|
break L88;
|
|
}
|
|
if (!isCollectibleQuestRewardPremiumExtendable2 && collectibleQuestRewardDuration == null) {
|
|
if (r126) {
|
|
r130 = t.bxN0nx;
|
|
break L88;
|
|
}
|
|
r130 = t.thO6iA;
|
|
break L88;
|
|
}
|
|
r130 = r126 ? t.ojhBxZ : t["IACEB/"];
|
|
}
|
|
}
|
|
const description = thirdPartyTaskDetails.description;
|
|
const r156 = {
|
|
gameTitle: gameTitle2,
|
|
objective: needsToConnect ? description.charAt(0).toLowerCase() + description.slice(1) : description,
|
|
duration: collectibleQuestRewardDuration,
|
|
questReward: defaultRewardNameWithArticle,
|
|
onGameTitleClick
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r130, r156) : intl.format(r130, r156);
|
|
break L289;
|
|
}
|
|
if (thirdPartyTaskDetails != null) {
|
|
r111 = thirdPartyTaskDetails.description;
|
|
} else {
|
|
L41: {
|
|
targetMinutes = taskDetails.targetMinutes;
|
|
gameTitle = quest3.config.messages.gameTitle;
|
|
const isCollectibleQuestRewardPremiumExtendable = _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(quest3.config);
|
|
const isCollectibleQuestRewardPermanentWithPremiumSubscription = _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(quest3.config);
|
|
const r2 = onGameTitleClick != null;
|
|
if (isPremium && isCollectibleQuestRewardPremiumExtendable) {
|
|
r90 = isCollectibleQuestRewardPermanentWithPremiumSubscription ? collectibleQuestRewardDuration != null ? r2 ? t["3RwRv8"] : t.TmKqHw : r2 ? t.l9yxDa : t["X8Yt/1"] : r2 ? t.eEuma3 : t.smG9ql;
|
|
} else if (!isCollectibleQuestRewardPremiumExtendable && collectibleQuestRewardDuration == null) {
|
|
if (r2) {
|
|
r90 = t.ER9rII;
|
|
break L41;
|
|
}
|
|
r90 = t["hkJ+Gs"];
|
|
} else {
|
|
r90 = r2 ? t.Cko4a4 : t.BLyDvO;
|
|
}
|
|
}
|
|
const r106 = {
|
|
gameTitle,
|
|
streamingDurationRequirement: targetMinutes,
|
|
duration: collectibleQuestRewardDuration,
|
|
questReward: defaultRewardNameWithArticle,
|
|
onGameTitleClick
|
|
};
|
|
r111 = withoutMarkdown ? intl.formatToPlainString(r90, r106) : intl.format(r90, r106);
|
|
}
|
|
}
|
|
}
|
|
return r111;
|
|
};
|
|
useQuestsInstructionsToWinReward = function useQuestsInstructionsToWinReward(a0) {
|
|
let applicationId;
|
|
const quest3 = a0.quest;
|
|
let gameProfileSource = a0.gameProfileSource;
|
|
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
|
|
let thirdPartyTaskDetails = useThirdPartyTaskDetails(quest3);
|
|
const inGameQuestConnectState = useInGameQuestConnectState(quest3);
|
|
if (hasAchievementInGameTask(quest3)) {
|
|
applicationId = getInGameApplicationId(quest3);
|
|
} else {
|
|
const allApplicationIds = getAllApplicationIds(quest3);
|
|
applicationId = allApplicationIds == null ? void 0 : allApplicationIds[0];
|
|
}
|
|
if (gameProfileSource == null) {
|
|
gameProfileSource = GameProfileSources.QuestHome;
|
|
}
|
|
useOpenGameProfileModal({
|
|
applicationId,
|
|
location: QuestsExperimentLocations.QUEST_INSTRUCTIONS,
|
|
source: gameProfileSource
|
|
});
|
|
if (thirdPartyTaskDetails == null) {
|
|
thirdPartyTaskDetails = void 0;
|
|
}
|
|
return _getQuestsInstructionsToWinReward({
|
|
...a0,
|
|
currentUser: stateFromStores,
|
|
withoutMarkdown: false,
|
|
thirdPartyTaskDetails,
|
|
onGameTitleClick: void 0,
|
|
needsToConnect: inGameQuestConnectState === false
|
|
});
|
|
};
|
|
c7389_15 = {
|
|
PLAY: 0,
|
|
0: "PLAY",
|
|
STREAM: 1,
|
|
1: "STREAM",
|
|
WATCH_VIDEO: 2,
|
|
2: "WATCH_VIDEO",
|
|
IN_GAME: 3,
|
|
3: "IN_GAME"
|
|
};
|
|
export function useQuestInstructionTitle(a0, a1, a2, a3) {
|
|
const targetMinutes = useQuestTaskDetails(a0).targetMinutes;
|
|
const thirdPartyTaskDetails = useThirdPartyTaskDetails(a0);
|
|
const connectedConsoleLinkOnClick = useConnectedConsoleLinkOnClick({
|
|
quest: a0,
|
|
questContent: a2,
|
|
sourceQuestContent: a3
|
|
});
|
|
const isSponsoredPlayQuest = _QuestUtils.isSponsoredPlayQuest(a0);
|
|
if (isConsoleQuest(a0) && !hasPlayOnDesktopTask({
|
|
quest: a0
|
|
})) {
|
|
return intl.format(t["l4S+cQ"], {
|
|
minutes: targetMinutes,
|
|
onClick: connectedConsoleLinkOnClick,
|
|
gameTitle: a0.config.messages.gameTitle
|
|
});
|
|
}
|
|
if (isConsoleQuest(a0)) {
|
|
return isSponsoredPlayQuest ? intl.format(t.gbtCpW, {
|
|
onClick: connectedConsoleLinkOnClick,
|
|
minutes: targetMinutes
|
|
}) : intl.format(t.Ajlcd7, {
|
|
minutes: targetMinutes,
|
|
onClick: connectedConsoleLinkOnClick,
|
|
gameTitle: a0.config.messages.gameTitle
|
|
});
|
|
}
|
|
if (isSponsoredPlayQuest) {
|
|
return intl.format(t.Hu8SKW, {
|
|
targetMinutes
|
|
});
|
|
}
|
|
if (hasWatchVideoTasks(a0)) {
|
|
const defaultWatchVideoTask = getDefaultWatchVideoTask(a0.config);
|
|
const videoTitle = defaultWatchVideoTask == null ? void 0 : defaultWatchVideoTask.messages.videoTitle;
|
|
return videoTitle == null ? intl.string(t["o+e9yh"]) : intl.formatToPlainString(t["9m9Mna"], {
|
|
videoTitle
|
|
});
|
|
}
|
|
if (thirdPartyTaskDetails != null) {
|
|
return thirdPartyTaskDetails.title;
|
|
}
|
|
if (hasPlayActivityTask(a0)) {
|
|
return isPlayAnyActivityQuest(a0) ? intl.format(t["1NaRSs"], {
|
|
minutes: targetMinutes
|
|
}) : intl.format(t.xHXCyf, {
|
|
minutes: targetMinutes,
|
|
activityName: a0.config.messages.gameTitle
|
|
});
|
|
}
|
|
let r64 = t["6zWtV8"];
|
|
if (hasPlayOnDesktopTask({
|
|
quest: a0
|
|
})) {
|
|
r64 = a0.config.features.includes(QuestVariants.NON_GAMING_PLAY_QUEST) ? t.fe7Xec : t["wmOh/q"];
|
|
}
|
|
return intl.format(r64, {
|
|
minutes: targetMinutes,
|
|
gameTitle: a0.config.messages.gameTitle
|
|
});
|
|
}
|
|
export function getQuestsInstructionsToWinReward(a0) {
|
|
let currentUser = a0.currentUser;
|
|
if (currentUser == null) {
|
|
currentUser = UserStore.getCurrentUser();
|
|
}
|
|
return _getQuestsInstructionsToWinReward({
|
|
...a0,
|
|
currentUser
|
|
});
|
|
}
|
|
export { useQuestsInstructionsToWinReward };
|
|
export function useQuestDescription(a0, a1, a2, a3, a4) {
|
|
let r17 = useQuestsInstructionsToWinReward({
|
|
quest: a0,
|
|
taskDetails: useQuestTaskDetails(a0),
|
|
location: a2,
|
|
sourceQuestContent: a1,
|
|
popoutTargetElementRef: a4,
|
|
gameProfileSource: a3
|
|
});
|
|
const r20 = a0.userStatus?.claimedAt != null;
|
|
const questFormattedDate = useQuestFormattedDate(a0.userStatus?.claimedAt);
|
|
if (r20) {
|
|
r17 = intl.formatToPlainString(t.lOVr0O, {
|
|
claimDate: questFormattedDate
|
|
});
|
|
}
|
|
return r17;
|
|
}
|
|
export function useQuestBarSubtitle({ quest: quest3, isExpanded, sourceQuestContent: sourceQuestContent2, activeScreen, popoutTargetElementRef, onGameSheetOpened, onGameSheetClosed, hasAlreadyLinked, onClickGameTitle }) {
|
|
let r79, r93;
|
|
const questFormattedDate = useQuestFormattedDate(quest3.config.rewardsConfig.rewardsExpireAt);
|
|
const questTaskDetails = useQuestTaskDetails(quest3);
|
|
let thirdPartyTaskDetails = useThirdPartyTaskDetails(quest3);
|
|
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
|
|
const r3 = quest3.userStatus?.completedAt != null;
|
|
const r5 = quest3.userStatus?.enrolledAt != null;
|
|
const r47 = questTaskDetails.percentComplete > 0;
|
|
const isQuestProgressing = useIsQuestProgressing(quest3);
|
|
const questsInstructionsToWinReward = useQuestsInstructionsToWinReward({
|
|
quest: quest3,
|
|
location: QuestsExperimentLocations.QUESTS_BAR,
|
|
taskDetails: questTaskDetails,
|
|
sourceQuestContent: sourceQuestContent2,
|
|
popoutTargetElementRef,
|
|
onGameSheetOpened,
|
|
onGameSheetClosed,
|
|
gameProfileSource: GameProfileSources.QuestBar
|
|
});
|
|
const r61 = thirdPartyTaskDetails != null ? thirdPartyTaskDetails.percentComplete : questTaskDetails.percentComplete;
|
|
if (r3) {
|
|
return intl.formatToPlainString(t.APddvF, {
|
|
expirationDate: questFormattedDate
|
|
});
|
|
}
|
|
if (hasAchievementInGameTask(quest3) && hasAlreadyLinked === false) {
|
|
return intl.string(t.mAdqf7);
|
|
}
|
|
if (isExpanded) {
|
|
if (hasAchievementInGameTask(quest3) && hasAlreadyLinked === true) {
|
|
const gameTitle = quest3.config.messages.gameTitle;
|
|
return onClickGameTitle != null ? intl.format(t.X8hBDz, {
|
|
gameTitle,
|
|
onClickGameTitle
|
|
}) : intl.format(t.u3mdpP, {
|
|
gameTitle
|
|
});
|
|
}
|
|
if (activeScreen !== TaskPlatformScreen.SELECT && _QuestUtils.isSponsoredPlayQuest(quest3) && r5 && !r47) {
|
|
return intl.format(t["1votF6"], {
|
|
rewardNameWithArticle: getDefaultRewardNameWithArticle(quest3.config, stateFromStores),
|
|
targetMinutes: questTaskDetails.targetMinutes
|
|
});
|
|
}
|
|
return questsInstructionsToWinReward;
|
|
}
|
|
if (hasWatchVideoTasks(quest3)) {
|
|
r79 = intl.string(t["o+e9yh"]);
|
|
} else if (r61 > 0) {
|
|
if (hasAchievementInGameTask(quest3) && hasAlreadyLinked === true) {
|
|
r93 = intl.string(t.JkyCIO);
|
|
} else if (isQuestProgressing) {
|
|
if (thirdPartyTaskDetails == null) {
|
|
thirdPartyTaskDetails = void 0;
|
|
}
|
|
r93 = getContextualEntrypointHeading({
|
|
quest: quest3,
|
|
taskDetails: questTaskDetails,
|
|
thirdPartyTaskDetails
|
|
});
|
|
} else {
|
|
r93 = intl.string(t.mOrpXG);
|
|
}
|
|
r79 = r93;
|
|
} else {
|
|
r79 = intl.string(t.S6UUc5);
|
|
}
|
|
return r79;
|
|
}
|
|
export function useQuestBarTitle(a0, a1) {
|
|
const stateFromStores = useStateFromStores([LocaleStore], () => LocaleStore.locale);
|
|
const questTaskDetails = useQuestTaskDetails(a0);
|
|
const [r26] = useTaskPlatformScreen(a0, questTaskDetails);
|
|
const thirdPartyTaskDetails = useThirdPartyTaskDetails(a0);
|
|
const r32 = a0.userStatus?.completedAt != null;
|
|
const r33 = thirdPartyTaskDetails != null ? thirdPartyTaskDetails.percentComplete : questTaskDetails.percentComplete;
|
|
if (r32) {
|
|
return intl.string(t["ij5E/5"]);
|
|
}
|
|
if (hasAchievementInGameTask(a0) && a1 === false) {
|
|
return intl.string(t.s9r2a1);
|
|
}
|
|
if (hasAchievementInGameTask(a0) && a1 === true && r33 === 0) {
|
|
return intl.string(t["2+opCy"]);
|
|
}
|
|
if (a0.userStatus?.enrolledAt != null && r33 > 0) {
|
|
return intl.formatToPlainString(t.lVZaXD, {
|
|
percent: formatPercent(stateFromStores, r33, {
|
|
roundingMode: "floor"
|
|
})
|
|
});
|
|
}
|
|
return r26 === TaskPlatformScreen.SELECT ? intl.string(t.EMrUHQ) : isConsoleQuest(a0) ? intl.string(t.mOrpXG) : intl.string(t["7e5k7L"]);
|
|
}
|
|
export function usePrimaryCtaCopy({ quest: quest3, application, shortText = false, showPlayInstantlyLabel = false }) {
|
|
const quest = quest3;
|
|
const memo = useMemo(() => {
|
|
let STREAM;
|
|
L13: {
|
|
if (!isConsoleQuest(quest) && !hasPlayActivityTask(quest)) {
|
|
if (hasStreamOnDesktopTask({
|
|
quest
|
|
})) {
|
|
STREAM = c7389_15.STREAM;
|
|
break L13;
|
|
}
|
|
if (hasWatchVideoOnMobileTasks(quest)) {
|
|
STREAM = c7389_15.WATCH_VIDEO;
|
|
break L13;
|
|
}
|
|
if (isInGameQuest(quest)) {
|
|
STREAM = c7389_15.IN_GAME;
|
|
break L13;
|
|
}
|
|
STREAM = c7389_15.PLAY;
|
|
} else {
|
|
STREAM = c7389_15.PLAY;
|
|
}
|
|
}
|
|
return STREAM;
|
|
}, [quest]);
|
|
const questTaskDetails = useQuestTaskDetails(quest);
|
|
if (c7389_15.PLAY === memo) {
|
|
if (!!quest.config.features.includes(QuestVariants.MOBILE_ACTIVITY_QUEST) && (application == null || isActivitySupportedOnClientPlatform(application == null ? void 0 : application.embeddedActivityConfig?.supported_platforms))) {
|
|
if (quest.config.features.includes(QuestVariants.CLOUD_GAMING_ACTIVITY)) {
|
|
return intl.string(showPlayInstantlyLabel ? t.V5Qt9D : t["+qoymD"]);
|
|
}
|
|
if (canLaunchActivity(quest)) {
|
|
return intl.string(shortText ? t.E4kW5O : t["Ie9++s"]);
|
|
}
|
|
}
|
|
return intl.string(t.l7E81v);
|
|
}
|
|
if (c7389_15.STREAM === memo) {
|
|
return intl.string(t.l7E81v);
|
|
}
|
|
if (c7389_15.WATCH_VIDEO === memo) {
|
|
return getVideoQuestWatchCtaText(questTaskDetails);
|
|
}
|
|
if (c7389_15.IN_GAME === memo) {
|
|
const r53 = canLaunchActivity(quest) ? !!quest.config.features.includes(QuestVariants.MOBILE_ACTIVITY_QUEST) && (application == null || isActivitySupportedOnClientPlatform(application == null ? void 0 : application.embeddedActivityConfig?.supported_platforms)) ? intl.string(shortText ? t.CkUzLd : t["hRIVy+"]) : intl.string(t.l7E81v) : intl.string(t.l7E81v);
|
|
return r53;
|
|
}
|
|
}
|
|
export function usePremiumExtendableCopy(a0) {
|
|
const memo = useMemo(() => _QuestRewardUtils.isCollectibleQuestRewardPremiumExtendable(a0), [a0]);
|
|
const memo2 = useMemo(() => _QuestRewardUtils.isCollectibleQuestRewardPermanentWithPremiumSubscription(a0), [a0]);
|
|
return memo ? memo2 ? intl.string(t["hh7Rb/"]) : intl.string(t.GYGb3A) : null;
|
|
}
|
|
export function getRewardCodeRedemptionInstructions({ quest: quest3, rewardCode }) {
|
|
const isTieredRewardCodeQuest = _QuestRewardUtils.isTieredRewardCodeQuest({
|
|
quest: quest3
|
|
});
|
|
let r18 = rewardCode?.platform;
|
|
if (r18 == null) {
|
|
r18 = QuestRewardCodePlatforms.CROSS_PLATFORM;
|
|
}
|
|
let r22 = null;
|
|
if (isTieredRewardCodeQuest) {
|
|
let idx = rewardCode?.tier;
|
|
if (idx == null) {
|
|
idx = quest3.userStatus?.claimedTier;
|
|
}
|
|
r22 = getRewardCodeQuestReward({
|
|
quest: quest3,
|
|
idx
|
|
});
|
|
}
|
|
const defaultReward = getDefaultReward(quest3.config);
|
|
let r34 = r22 == null ? void 0 : r22.messages?.redemptionInstructionsByPlatform;
|
|
if (r34 == null) {
|
|
r34 = defaultReward.messages.redemptionInstructionsByPlatform;
|
|
}
|
|
return r18 != null ? r34[r18] : void 0;
|
|
}
|
|
export function useModalCtaConfig({ quest: quest2, questContent, preCtaClick, getImpressionId, sourceQuestContent }) {
|
|
let _defaultOnClickCta2 = function _defaultOnClickCta() {
|
|
const r9 = async () => {
|
|
let c30316_0;
|
|
c30316_0 = void 0;
|
|
await (preCtaClick == null ? void 0 : preCtaClick());
|
|
openGameLinkDirectly(quest2, {
|
|
content: questContent,
|
|
ctaContent: QuestContentCTA.OPEN_GAME_LINK,
|
|
impressionId: getImpressionId == null ? void 0 : getImpressionId(),
|
|
sourceQuestContent
|
|
});
|
|
};
|
|
_defaultOnClickCta2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
const memo = useMemo(() => {
|
|
let taskTitle;
|
|
let r12 = quest2.config.ctaConfig?.subtitle;
|
|
if (r12 == null) {
|
|
L11: {
|
|
if (hasAchievementInGameTask(quest2)) {
|
|
taskTitle = quest2.config.taskConfigV2.tasks.ACHIEVEMENT_IN_GAME.messages.taskTitle;
|
|
} else {
|
|
if (getQuestType(quest2.config) === QuestType.GAMEPLAY && !quest2.config.features.includes(QuestVariants.NON_GAMING_PLAY_QUEST) && !_QuestUtils.isSponsoredPlayQuest(quest2)) {
|
|
taskTitle = intl.string(t["wirwN+"]);
|
|
break L11;
|
|
}
|
|
taskTitle = intl.string(t.y8Xf3k);
|
|
}
|
|
}
|
|
r12 = taskTitle;
|
|
}
|
|
return r12;
|
|
}, [quest2]);
|
|
return {
|
|
ctaText: getExternalCtaLabel(quest2),
|
|
ctaVariant: "secondary",
|
|
onClickCta: function defaultOnClickCta() {
|
|
return _defaultOnClickCta2.apply(this, arguments);
|
|
},
|
|
title: quest2.config.messages.gameTitle,
|
|
subtitle: memo,
|
|
ctaIconPosition: "end"
|
|
};
|
|
}
|