277 lines
10 KiB
TypeScript
277 lines
10 KiB
TypeScript
// Metro module 12367 (f12368).
|
|
import { Image as Image2 } from "react-native";
|
|
import ThemeStore from "../../user_settings/ThemeStore";
|
|
import QuestStore from "../QuestStore";
|
|
import { QuestEmbedFallbackReason, QuestsExperimentLocations } from "../QuestConstants";
|
|
import { ThemeTypes } from "../../../Constants";
|
|
import { InviteTypes } from "../../instant_invite/Constants";
|
|
import * as _PlatformUtils from "../../../utils/PlatformUtils";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { getQuestTaskDetails, getThirdPartyTaskDetails } from "../utils/QuestTaskUtils";
|
|
import { getQuestsInstructionsToWinReward } from "../hooks/QuestCopyHooks";
|
|
import { QuestContent } from "../QuestTypes";
|
|
import { isThemeDark } from "../../../design/shared";
|
|
import { getQuestAsset, QuestAssetType } from "../lib/AssetUtils";
|
|
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
|
|
import Module12368 from "../../../_bundle/Module12368";
|
|
import { findQuestOrReplacement } from "../utils/QuestDataUtils";
|
|
import { trackQuestEmbedFallbackViewed } from "../lib/analytics/AnalyticsActions";
|
|
import { isShareableQuest } from "../utils/QuestUtils";
|
|
import getEmbedThemeColors from "../../messages/native/renderer/row_data/embeds/getEmbedThemeColors";
|
|
export function createQuestsEmbed(a0) {
|
|
let r91, r199, r200, r277, r328, r354, r399, acceptLabelText, subtitle2;
|
|
L54: {
|
|
const { questId, theme, currentUser } = a0;
|
|
const embedThemeColors = getEmbedThemeColors(theme);
|
|
if (isMetaQuest()) {
|
|
const titleText6 = intl.string(t["6LxbQM"]);
|
|
const subtitle5 = intl.string(t.CXEb9p);
|
|
const uri4 = Image2.resolveAssetSource(Module12368).uri;
|
|
const { baseColors: baseColors6, colors: colors7 } = embedThemeColors;
|
|
const r381 = {
|
|
...baseColors6,
|
|
headerColor: colors7.headerColor,
|
|
titleText: titleText6,
|
|
titleColor: colors7.titleColor,
|
|
subtitleColor: colors7.bodyTextColor,
|
|
bodyTextColor: colors7.bodyTextColor,
|
|
thumbnailUrl: uri4,
|
|
embedCanBeTapped: true,
|
|
canBeAccepted: true,
|
|
type: InviteTypes.GUILD
|
|
};
|
|
const isAndroid6 = _PlatformUtils.isAndroid();
|
|
const r395 = {
|
|
...r381
|
|
};
|
|
if (isAndroid6) {
|
|
r395.headerText = null;
|
|
r395.subtitle = subtitle5;
|
|
r399 = r395;
|
|
} else {
|
|
r395.headerText = void 0;
|
|
r395.subtitle = subtitle5;
|
|
r399 = r395;
|
|
}
|
|
r91 = {
|
|
...r399,
|
|
acceptLabelText: intl.string(t.hvVgAZ),
|
|
acceptLabelBackgroundColor: embedThemeColors.colors.acceptBlurpleLabelBackgroundColor,
|
|
acceptLabelColor: embedThemeColors.colors.acceptLabelGreenColor
|
|
};
|
|
} else {
|
|
const quest = findQuestOrReplacement(questId, QuestStore.quests, QuestStore.excludedQuests);
|
|
const r40 = QuestStore.excludedQuests.get(questId);
|
|
if (quest == null && QuestStore.isFetchingCurrentQuests) {
|
|
const r329 = {
|
|
themeColors: embedThemeColors
|
|
};
|
|
const { titleText, bodyText, themeColors, thumbnailUrl } = r329;
|
|
const { baseColors: baseColors5, colors: colors6 } = themeColors;
|
|
const r336 = {
|
|
...baseColors5,
|
|
headerColor: colors6.headerColor,
|
|
titleText,
|
|
titleColor: colors6.titleColor,
|
|
subtitleColor: colors6.bodyTextColor,
|
|
bodyTextColor: colors6.bodyTextColor,
|
|
thumbnailUrl,
|
|
embedCanBeTapped: true,
|
|
canBeAccepted: true,
|
|
type: InviteTypes.GUILD
|
|
};
|
|
const isAndroid5 = _PlatformUtils.isAndroid();
|
|
const r350 = {
|
|
...r336
|
|
};
|
|
if (isAndroid5) {
|
|
r350.headerText = null;
|
|
r350.subtitle = bodyText;
|
|
r354 = r350;
|
|
} else {
|
|
r350.headerText = void 0;
|
|
r350.subtitle = bodyText;
|
|
r354 = r350;
|
|
}
|
|
r91 = r354;
|
|
break L54;
|
|
}
|
|
if (quest == null) {
|
|
if (r40 != null) {
|
|
trackQuestEmbedFallbackViewed(questId, QuestEmbedFallbackReason.EXCLUDED_QUEST);
|
|
const titleText5 = intl.string(t.Dd6Daw);
|
|
const subtitle4 = intl.string(t.ii4mJo);
|
|
const uri3 = Image2.resolveAssetSource(Module12368).uri;
|
|
const { baseColors: baseColors4, colors: colors5 } = embedThemeColors;
|
|
const r310 = {
|
|
...baseColors4,
|
|
headerColor: colors5.headerColor,
|
|
titleText: titleText5,
|
|
titleColor: colors5.titleColor,
|
|
subtitleColor: colors5.bodyTextColor,
|
|
bodyTextColor: colors5.bodyTextColor,
|
|
thumbnailUrl: uri3,
|
|
embedCanBeTapped: true,
|
|
canBeAccepted: true,
|
|
type: InviteTypes.GUILD
|
|
};
|
|
const isAndroid4 = _PlatformUtils.isAndroid();
|
|
const r324 = {
|
|
...r310
|
|
};
|
|
if (isAndroid4) {
|
|
r324.headerText = null;
|
|
r324.subtitle = subtitle4;
|
|
r328 = r324;
|
|
} else {
|
|
r324.headerText = void 0;
|
|
r324.subtitle = subtitle4;
|
|
r328 = r324;
|
|
}
|
|
r277 = r328;
|
|
} else {
|
|
trackQuestEmbedFallbackViewed(questId, QuestEmbedFallbackReason.UNKNOWN_QUEST);
|
|
const titleText4 = intl.string(t["rxf+nx"]);
|
|
const subtitle3 = intl.string(t.Ow5AQI);
|
|
const uri2 = Image2.resolveAssetSource(Module12368).uri;
|
|
const { baseColors: baseColors3, colors: colors4 } = embedThemeColors;
|
|
const r259 = {
|
|
...baseColors3,
|
|
headerColor: colors4.headerColor,
|
|
titleText: titleText4,
|
|
titleColor: colors4.titleColor,
|
|
subtitleColor: colors4.bodyTextColor,
|
|
bodyTextColor: colors4.bodyTextColor,
|
|
thumbnailUrl: uri2,
|
|
embedCanBeTapped: true,
|
|
canBeAccepted: true,
|
|
type: InviteTypes.GUILD
|
|
};
|
|
const isAndroid3 = _PlatformUtils.isAndroid();
|
|
const r273 = {
|
|
...r259
|
|
};
|
|
if (isAndroid3) {
|
|
r273.headerText = null;
|
|
r273.subtitle = subtitle3;
|
|
r277 = r273;
|
|
} else {
|
|
r273.headerText = void 0;
|
|
r273.subtitle = subtitle3;
|
|
r277 = r273;
|
|
}
|
|
}
|
|
r91 = r277;
|
|
} else if (isShareableQuest(quest.config)) {
|
|
const colors2 = embedThemeColors.colors;
|
|
const r5 = quest.userStatus?.enrolledAt != null;
|
|
const r105 = quest.config.expiresAt < new Date().toISOString();
|
|
const r115 = isThemeDark(ThemeStore.getState().theme) ? ThemeTypes.DARK : ThemeTypes.LIGHT;
|
|
const r6 = QuestStore.questEnrollmentBlockedUntil != null;
|
|
const titleText3 = intl.formatToPlainString(t.EAYZAr, {
|
|
questName: quest.config.messages.questName
|
|
});
|
|
quest.config.messages.gamePublisher;
|
|
if (quest.config.expiresAt < new Date().toISOString()) {
|
|
subtitle2 = intl.formatToPlainString(t["ge+AJp"], {
|
|
questName: quest.config.messages.questName
|
|
});
|
|
} else {
|
|
const questTaskDetails = getQuestTaskDetails(quest);
|
|
let thirdPartyTaskDetails = getThirdPartyTaskDetails(quest);
|
|
if (thirdPartyTaskDetails == null) {
|
|
thirdPartyTaskDetails = void 0;
|
|
}
|
|
subtitle2 = getQuestsInstructionsToWinReward({
|
|
quest,
|
|
taskDetails: questTaskDetails,
|
|
location: QuestsExperimentLocations.EMBED_MOBILE,
|
|
sourceQuestContent: QuestContent.QUEST_EMBED_MOBILE,
|
|
thirdPartyTaskDetails,
|
|
withoutMarkdown: true,
|
|
currentUser
|
|
});
|
|
}
|
|
const url = getQuestAsset(quest, QuestAssetType.GAME_TILE, r115).url;
|
|
const { baseColors: baseColors2, colors: colors3 } = embedThemeColors;
|
|
const r182 = {
|
|
...baseColors2,
|
|
headerColor: colors3.headerColor,
|
|
titleText: titleText3,
|
|
titleColor: colors3.titleColor,
|
|
subtitleColor: colors3.bodyTextColor,
|
|
bodyTextColor: colors3.bodyTextColor,
|
|
thumbnailUrl: url,
|
|
embedCanBeTapped: true,
|
|
canBeAccepted: true,
|
|
type: InviteTypes.GUILD
|
|
};
|
|
const isAndroid2 = _PlatformUtils.isAndroid();
|
|
const r195 = {
|
|
...r182
|
|
};
|
|
if (isAndroid2) {
|
|
r195.headerText = null;
|
|
r195.subtitle = subtitle2;
|
|
r199 = r195;
|
|
} else {
|
|
r195.headerText = void 0;
|
|
r195.subtitle = subtitle2;
|
|
r199 = r195;
|
|
}
|
|
L32: {
|
|
r200 = {
|
|
...r199
|
|
};
|
|
if (!r5 && !r105) {
|
|
if (r6) {
|
|
acceptLabelText = intl.string(t["th2+0j"]);
|
|
break L32;
|
|
}
|
|
acceptLabelText = intl.string(t.kUQLMJ);
|
|
} else {
|
|
acceptLabelText = r105 ? intl.string(t.hvVgAZ) : intl.string(t["th2+0j"]);
|
|
}
|
|
}
|
|
r200.acceptLabelText = acceptLabelText;
|
|
r200.acceptLabelBackgroundColor = colors2.acceptBlurpleLabelBackgroundColor;
|
|
r200.acceptLabelColor = embedThemeColors.colors.acceptLabelGreenColor;
|
|
r200.thumbnailCornerRadius = 8;
|
|
r91 = r200;
|
|
} else {
|
|
trackQuestEmbedFallbackViewed(questId, QuestEmbedFallbackReason.NOT_SHAREABLE_QUEST);
|
|
const titleText2 = intl.string(t.Dd6Daw);
|
|
const subtitle = intl.string(t.NXrP3N);
|
|
const uri = Image2.resolveAssetSource(Module12368).uri;
|
|
const { baseColors, colors } = embedThemeColors;
|
|
const r76 = {
|
|
...baseColors,
|
|
headerColor: colors.headerColor,
|
|
titleText: titleText2,
|
|
titleColor: colors.titleColor,
|
|
subtitleColor: colors.bodyTextColor,
|
|
bodyTextColor: colors.bodyTextColor,
|
|
thumbnailUrl: uri,
|
|
embedCanBeTapped: true,
|
|
canBeAccepted: true,
|
|
type: InviteTypes.GUILD
|
|
};
|
|
const isAndroid = _PlatformUtils.isAndroid();
|
|
const r87 = {
|
|
...r76
|
|
};
|
|
if (isAndroid) {
|
|
r87.headerText = null;
|
|
r87.subtitle = subtitle;
|
|
r91 = r87;
|
|
} else {
|
|
r87.headerText = void 0;
|
|
r87.subtitle = subtitle;
|
|
r91 = r87;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return r91;
|
|
}
|