This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+115
View File
@@ -0,0 +1,115 @@
// Metro module 14112 (f14113).
import _slicedToArray from "../../_bundle/_slicedToArray";
import QuestStore from "./QuestStore";
import { AdCreativeType } from "../../_bundle/Module6013";
import { isQuestExpired } from "./utils/QuestDataUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c9876_4, syncWithQuestStore;
const getOrCreateSet = function getOrCreateSet(adCreativeType) {
let r9 = c9876_4.get(adCreativeType);
if (r9 == null) {
const set = new Set();
c9876_4.set(adCreativeType, set);
r9 = set;
}
return r9;
};
syncWithQuestStore = function syncWithQuestStore() {
const orCreateSet = getOrCreateSet(AdCreativeType.QUEST);
let r41 = false;
for (const quest of QuestStore.quests) {
const [r48, r50] = quest;
let r52 = orCreateSet.has(r48) || isQuestExpired(r50);
if (!r52) {
const userStatus = r50.userStatus;
r52 = userStatus == null || userStatus.enrolledAt == null && userStatus.completedAt == null && userStatus.claimedAt == null && userStatus.dismissedQuestContent === 0;
}
if (!r52) {
orCreateSet.add(r48);
r41 = true;
}
}
if (QuestStore.lastFetchedCurrentQuests !== 0 && QuestStore.quests.size > 0) {
for (const item of orCreateSet) {
const r85 = QuestStore.quests.get(item);
if (r85 == null || isQuestExpired(r85)) {
orCreateSet.delete(item);
r41 = true;
}
}
}
const orCreateSet2 = getOrCreateSet(AdCreativeType.QUEST_HOME_HERO);
if (QuestStore.getLastFetchedQuestHomeHero() != null && orCreateSet2.size > 0) {
const questHomeHero = QuestStore.getQuestHomeHero();
for (const item2 of orCreateSet2) {
if (!(questHomeHero != null && item2 === questHomeHero.id)) {
orCreateSet2.delete(item2);
r41 = true;
}
}
}
return r41;
};
c9876_4 = new Map();
class AdContentSeenStore extends Module589.PersistedStore {
static displayName = "AdContentSeenStore";
static persistKey = "AdContentSeenStore";
initialize(a0) {
this.waitFor(QuestStore);
c9876_4 = new Map();
if (a0 != null) {
for (const item of Object.entries(a0.seenContentIds)) {
const [r42, r12] = item;
c9876_4.set(Number(r42), new Set(r12));
}
}
this.syncWith([QuestStore], syncWithQuestStore);
}
getState() {
const seenContentIds = {};
for (const item of c9876_4) {
const r27 = _slicedToArray(item, 2);
seenContentIds[r27[0]] = Array.from(r27[1]);
}
return {
seenContentIds
};
}
hasSeen(a0, a1) {
const r5 = c9876_4.get(a0);
let r7 = r5 == null ? void 0 : r5.has(a1);
if (r7 == null) {
r7 = false;
}
return r7;
}
}
const adContentSeenStore = new AdContentSeenStore(Dispatcher, {
AD_CONTENT_MARK_SEEN: function handleMarkSeen(a0) {
const orCreateSet = getOrCreateSet(a0.adCreativeType);
let r22 = false;
for (const contentId of a0.contentIds) {
if (!orCreateSet.has(contentId)) {
orCreateSet.add(contentId);
r22 = true;
}
}
return r22;
},
AD_CONTENT_MARK_UNSEEN: function handleMarkUnseen(a0) {
const r21 = c9876_4.get(a0.adCreativeType);
if (r21 == null) {
return false;
}
let r23 = false;
for (const contentId of a0.contentIds) {
if (r21.has(contentId)) {
r21.delete(contentId);
r23 = true;
}
}
return r23;
}
});
export default adContentSeenStore;
+235
View File
@@ -0,0 +1,235 @@
// Metro module 10885 (f10886).
import NetworkStore from "../../stores/NetworkStore";
import BountyStore from "./BountyStore";
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import { AdCreativeType } from "../../_bundle/Module6013";
import { bountyFromServer } from "../ads/BountyTypes";
import { questAdDecisionFromAdDecision } from "../ads/utils/AdDecisionUtils";
import APIError from "../../errors/APIError";
import { getSession } from "../analytics_sessions/SessionHeartbeatScheduler";
import { getOrRefreshAdSession, getCurrentAdSession } from "../analytics_sessions/SessionAdGenerator";
import { HTTP } from "../../_bundle/sendRequest";
import { getAdMetadataSealed, getAdTrafficMetadataSealed } from "./utils/QuestDataUtils";
import { HermesBuiltin } from "../../_hermes/prelude";
function $mk116053($env) {
return (a0) => {
if (a0.creative != null) {
const creative_type = a0.creative.creative_type;
if (creative_type === AdCreativeType.BOUNTY) {
const r15 = $env;
const r19 = bountyFromServer(a0.creative.creative_content);
r15[3].set(r19.id, questAdDecisionFromAdDecision(a0, {
fetchedAt: r15[1],
requestId: r15[2].request_id,
adCreativeId: r19.id
}));
return [r19];
}
}
return [];
};
}
let env7324 = {};
const fetchBountiesAndDispatch = async function fetchBountiesAndDispatch(c26829_0, c26829_1) {
let c26829_2, c26829_3, c26829_4;
let c26829_5 = 0;
const r12 = env7324;
L10: {
try {
let env30292;
c26829_3 = r12;
const r16 = env30292 = {
$parent: r12
};
c26829_2 = r16;
env30292[0] = c26829_0;
env30292[1] = void 0;
env30292[2] = void 0;
env30292[3] = void 0;
env30292[4] = void 0;
Dispatcher.dispatch({
type: "BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_BEGIN"
});
c26829_5 = 1;
env30292[1] = Date.now();
const r23 = await c26829_1();
const r55 = c26829_2;
env30292[2] = r23;
env30292[3] = new Map();
env30292[4] = env30292[2].decisions.flatMap($mk116053(r55));
Dispatcher.dispatch({
type: "BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_SUCCESS",
bounties: env30292[4],
placement: env30292[0],
adDecisionsByAdCreativeId: env30292[3],
fetchedAt: env30292[1]
});
c26829_5 = 0;
} catch ($e) {
const r27 = $e;
let r8 = r27;
c26829_4 = r27;
if (c26829_5 !== 0) {
while (true) {
try {
const r85 = c26829_4;
c26829_5 = 0;
env30292[5] = r85;
Dispatcher.dispatch({
type: "BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_FAILURE",
placement: env30292[0],
error: new APIError(env30292[5])
});
break L10;
} catch (r81) {
r8 = r81;
c26829_4 = r81;
if (c26829_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
};
export async function fetchQuestHomeBounties(c26830_0) {
L11: {
let c30293_0 = c26830_0;
if (BountyStore.isFetchingQuestHomeBounties) {
break L11;
}
await fetchBountiesAndDispatch(c26830_0, async () => {
let c31592_1;
c31592_1 = void 0;
let c32021_0 = await getSession();
let client_heartbeat_session_id = void 0;
let c32021_1 = getOrRefreshAdSession();
if (c32021_0 != null) {
client_heartbeat_session_id = c32021_0.uuid;
}
return (await HTTP.get({
url: Endpoints.QUESTS_GET_DECISIONS,
query: {
placement: c30293_0,
client_ad_session_id: c32021_1.uuid,
client_heartbeat_session_id,
num_decisions_requested: 5
},
rejectWithError: false,
context: {
connection_type: NetworkStore.getType()
}
})).body;
});
return void 0;
}
}
export async function fetchBountyPreview(c26831_0, c26831_1) {
L11: {
let c30294_0 = c26831_0;
let c30294_1 = c26831_1;
if (BountyStore.isFetchingQuestHomeBounties) {
break L11;
}
await fetchBountiesAndDispatch(c26831_1, async () => {
const r13 = URLSearchParams;
let c31593_0 = 0;
const r17 = c30294_0.map((item) => ["ad_creative_ids", item]);
const r29 = [,];
c31593_0 = HermesBuiltin.arraySpread(r29, r17, c31593_0);
r29[c31593_0] = ["placement", String(c30294_1)];
c31593_0 = c31593_0 + 1;
return (await HTTP.get({
url: `${Endpoints.QUESTS_CREATIVE_PREVIEW}?${new r13(r29).toString()}`,
rejectWithError: false
})).body;
});
return void 0;
}
}
export function setBountyVideoProgress(a0, a1) {
if (getCurrentAdSession() != null) {
getOrRefreshAdSession(true);
Dispatcher.dispatch({
type: "BOUNTIES_VIDEO_PROGRESS_UPDATE",
bountyId: a0,
timestampSec: a1.timestampSec,
maxTimestampSec: a1.maxTimestampSec,
duration: a1.duration
});
}
}
export async function claimBountyReward(bountyId, c26832_1) {
let c26832_4;
let c26832_5 = 0;
let c30295_0, c30295_1, c30295_2, c30295_3, c30295_4, c30295_5, c30295_6, c30295_7;
L21: {
try {
c30295_0 = bountyId;
c30295_1 = c26832_1;
c30295_2 = void 0;
c30295_3 = void 0;
c30295_4 = void 0;
c30295_5 = void 0;
c30295_6 = void 0;
if (BountyStore.isClaimingBountyReward(bountyId)) {
break L21;
}
Dispatcher.dispatch({
type: "BOUNTIES_CLAIM_REWARD_BEGIN",
bountyId
});
c26832_5 = 1;
c30295_2 = await getSession();
c30295_3 = getOrRefreshAdSession();
c30295_4 = getAdMetadataSealed(c30295_1, c30295_0);
c30295_5 = getAdTrafficMetadataSealed(c30295_1, void 0, c30295_0);
await HTTP.post({
url: Endpoints.QUESTS_CREATIVES_CLAIM_REWARD(c30295_0),
body: {
decision_metadata_sealed: c30295_4 != null ? c30295_4 : null,
traffic_metadata_sealed: c30295_5 != null ? c30295_5 : null,
client_ad_session_id: c30295_3.uuid,
client_heartbeat_session_id: c30295_2?.uuid
},
rejectWithError: false
});
Dispatcher.dispatch({
type: "BOUNTIES_CLAIM_REWARD_SUCCESS",
bountyId: c30295_0
});
c26832_5 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c26832_4 = r32;
if (c26832_5 !== 0) {
while (true) {
try {
const r150 = c26832_4;
c26832_5 = 0;
c30295_7 = r150;
c30295_6 = new APIError(c30295_7);
Dispatcher.dispatch({
type: "BOUNTIES_CLAIM_REWARD_FAILURE",
bountyId: c30295_0,
error: c30295_6
});
throw c30295_6;
} catch (r146) {
r8 = r146;
c26832_4 = r146;
if (c26832_5 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
+112
View File
@@ -0,0 +1,112 @@
// Metro module 5984 (f5985).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3779_0 = false;
const bounties = [];
let c3779_2 = new Set();
let c3779_3 = new Set();
let c3779_4 = new Map();
let c3779_5 = new Map();
class BountyStore extends Module589.Store {
static displayName = "BountyStore";
get isFetchingQuestHomeBounties() {
return c3779_0;
}
get questHomeBounties() {
return bounties;
}
isBountyCompleted(a0) {
return c3779_2.has(a0);
}
getCompletedBountyCount(a0) {
let r0 = 0;
for (const item of a0) {
if (c3779_2.has(item.id)) {
r0 = r0 + 1;
}
}
return r0;
}
isClaimingBountyReward(a0) {
return c3779_3.has(a0);
}
areAllBountiesCompleted() {
return bounties.every((bounty) => c3779_2.has(bounty.id));
}
getAdDecisionByPlacementAndAdCreativeId(a0, a1) {
const r5 = c3779_4.get(a0);
let r7 = r5 == null ? void 0 : r5.get(a1);
if (r7 == null) {
r7 = null;
}
return r7;
}
getBountyVideoProgress(a0) {
let r5 = c3779_5.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
}
const bountyStore = new BountyStore(Dispatcher, {
LOGOUT: function handleLogout() {
c3779_0 = false;
bounties = [];
c3779_2 = new Set();
c3779_3 = new Set();
c3779_4 = new Map();
c3779_5 = new Map();
},
BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_BEGIN: function handleFetchQuestHomeBountiesBegin() {
c3779_0 = true;
},
BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_SUCCESS: function handleFetchQuestHomeBountiesSuccess({ bounties: bounties2, placement, adDecisionsByAdCreativeId }) {
c3779_0 = false;
bounties = bounties2;
c3779_2 = new Set();
c3779_5 = new Map();
const map = new Map(c3779_4);
c3779_4 = map;
map.set(placement, adDecisionsByAdCreativeId);
},
BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_FAILURE: function handleFetchQuestHomeBountiesFailure({ placement }) {
c3779_0 = false;
bounties = [];
c3779_2 = new Set();
const map = new Map(c3779_4);
c3779_4 = map;
map.delete(placement);
},
BOUNTIES_CLAIM_REWARD_BEGIN: function handleClaimBountyRewardBegin({ bountyId }) {
const set = new Set(c3779_3);
set.add(bountyId);
c3779_3 = set;
},
BOUNTIES_CLAIM_REWARD_SUCCESS: function handleClaimBountyRewardSuccess({ bountyId }) {
const set = new Set(c3779_3);
set.delete(bountyId);
c3779_3 = set;
const set2 = new Set(c3779_2);
set2.add(bountyId);
c3779_2 = set2;
},
BOUNTIES_CLAIM_REWARD_FAILURE: function handleClaimBountyRewardFailure({ bountyId }) {
const set = new Set(c3779_3);
set.delete(bountyId);
c3779_3 = set;
},
BOUNTIES_VIDEO_PROGRESS_UPDATE: function handleBountyVideoProgressUpdate({ bountyId, timestampSec, maxTimestampSec, duration }) {
const map = new Map(c3779_5);
map.set(bountyId, {
timestampSec,
maxTimestampSec,
duration
});
c3779_5 = map;
},
AD_SESSION_RESET: function handleAdSessionReset() {
c3779_5 = new Map();
}
});
export default bountyStore;
+71
View File
@@ -0,0 +1,71 @@
// Metro module 5986 (f5987).
import { create } from "../../_bundle/Module644";
let c3781_0 = [];
const r16 = create((c15346_0, c15346_1) => ({
errorHintsByQuestId: new Map(),
setErrorHints: (c25663_0, c25663_1) => {
c15346_0((a0) => {
if (c25663_1.length === 0 && !a0.errorHintsByQuestId.has(c25663_0)) {
return a0;
}
const map = new Map(a0.errorHintsByQuestId);
if (c25663_1.length === 0) {
map.delete(c25663_0);
} else {
map.set(c25663_0, [...c25663_1]);
}
return {
errorHintsByQuestId: map
};
});
},
getErrorHints: (a0) => {
let r7 = c15346_1().errorHintsByQuestId.get(a0);
if (r7 == null) {
r7 = c3781_0;
}
return r7;
},
clearErrorHints: (c25664_0) => {
c15346_0((a0) => {
const errorHintsByQuestId = a0.errorHintsByQuestId;
if (errorHintsByQuestId.has(c25664_0)) {
const map = new Map(a0.errorHintsByQuestId);
map.delete(c25664_0);
return {
errorHintsByQuestId: map
};
}
return a0;
});
},
clearErrorHintsByType: (c25665_0, c25665_1) => {
c15346_0((a0) => {
const errorHintsByQuestId = a0.errorHintsByQuestId;
const r11 = errorHintsByQuestId.get(c25665_0);
if (r11 == null) {
return a0;
}
const r14 = r11.filter((item) => item.type !== c25665_1);
if (r14.length === r11.length) {
return a0;
}
const map = new Map(a0.errorHintsByQuestId);
if (r14.length === 0) {
map.delete(c25665_0);
} else {
map.set(c25665_0, r14);
}
return {
errorHintsByQuestId: map
};
});
},
reset: () => {
c15346_0({
errorHintsByQuestId: new Map()
});
}
}));
export default r16;
export { r16 as useConsoleQuestUIStore };
@@ -0,0 +1,72 @@
// Metro module 9478 (f9479).
import NetworkStore from "../../stores/NetworkStore";
import { AnalyticEvents } from "../../Constants";
import { getSignalStrength } from "../network/NetStats.android";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import getDeviceMetadata_native from "../device/getDeviceMetadata.native";
import { isForegrounded } from "../analytics_sessions/SessionForegroundUtils.native";
const trackRoundtrip = function trackRoundtrip(a0) {
if (!(Math.random() > 0.1)) {
const api_latency_ms = a0.apiResponseTimestamp == null ? null : a0.apiResponseTimestamp - a0.initialSendTimestamp;
const signalStrength = getSignalStrength();
AnalyticsUtils.track(AnalyticEvents.EARNED_DECISION_ROUNDTRIP, {
...getDeviceMetadata_native(),
endpoint: a0.endpoint,
was_successful: a0.wasSuccessful,
api_latency_ms,
mobile_network_type: NetworkStore.getType(),
...signalStrength != null && {
mobile_signal_strength_level: signalStrength
},
caller_source: a0.callerSource,
request_id: a0.requestId,
fetched_at: a0.fetchedAt,
is_foregrounded: isForegrounded()
});
}
};
class EarnedDecisionRoundtripTracker {
constructor() {
return {
__proto__: new.target.prototype,
pendingRequests: new Map()
};
}
recordEarnedRequestAttempt(a0, a1) {
this.pendingRequests.set(a0, {
initialSendTimestamp: Date.now(),
endpoint: "/quests/earned-decision",
apiResponseTimestamp: null,
wasSuccessful: false,
callerSource: a1,
requestId: null,
fetchedAt: null
});
setTimeout(() => {
const pendingRequests = this.pendingRequests;
const r7 = pendingRequests.get(a0);
if (r7 != null) {
trackRoundtrip(r7);
this.pendingRequests.delete(a0);
}
}, 30000);
}
recordEarnedRequestApiResponse(a0, { wasSuccessful, requestId = null, fetchedAt = null }) {
const r10 = this.pendingRequests.get(a0);
if (r10 != null) {
trackRoundtrip({
...r10,
apiResponseTimestamp: Date.now(),
wasSuccessful,
requestId,
fetchedAt
});
this.pendingRequests.delete(a0);
}
}
}
const r34 = {
__proto__: EarnedDecisionRoundtripTracker.prototype,
pendingRequests: new Map()
};
export default r34;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,64 @@
// Metro module 9476 (f9477).
import { AnalyticEvents } from "../../Constants";
import MonitoringAgent from "../monitoring/MonitoringAgent";
import { MetricEvents } from "../../_bundle/Module5872";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import DiscordAppState_native from "../app_state/DiscordAppState.native";
let c6250_4 = 30000;
class QuestBarRenderDelayTracker {
constructor() {
return {
__proto__: new.target.prototype,
startTime: null,
questId: null,
timeoutTimer: null
};
}
clearTimeoutTimer() {
if (this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
this.timeoutTimer = null;
}
}
sendMetric(a0, a1, a2) {
if (!(Math.random() > 0.1)) {
MonitoringAgent.distribution({
name: MetricEvents.QUEST_BAR_RENDER_DELAY,
tags: [`quest_id:${a0}`, `timeout:${a1}`]
}, a2);
AnalyticsUtils.track(AnalyticEvents.QUEST_BAR_RENDER_DELAY, {
quest_id: a0,
timeout: a1,
duration: a2
});
}
}
startTracking(a0) {
this.clearTracking();
this.startTime = performance.now();
this.questId = a0;
this.timeoutTimer = setTimeout(() => {
this.stopTracking(a0, true);
}, c6250_4);
}
stopTracking(a0, r6 = false) {
if (this.startTime !== null && this.questId === a0) {
if (DiscordAppState_native.getState() === "active") {
this.sendMetric(a0, r6, Math.min(r6 ? c6250_4 : Math.round(performance.now() - this.startTime), c6250_4));
}
this.clearTracking();
}
}
clearTracking() {
this.clearTimeoutTimer();
this.startTime = null;
this.questId = null;
}
}
const prototype = QuestBarRenderDelayTracker.prototype;
export default {
__proto__: prototype,
startTime: null,
questId: null,
timeoutTimer: null
};
+202
View File
@@ -0,0 +1,202 @@
// Metro module 5033 (f5034).
import * as _Module5034 from "../../_bundle/Module5034";
import Durations from "../../utils/Durations";
import { Quests } from "../../_bundle/Module5035";
import { getAPIBaseURL } from "../../_bundle/sendRequest";
import { AdPlacement } from "./QuestTypes";
import { FirstPartyQuestTaskTypes } from "../../_bundle/Module5040";
import { groupBy } from "../../_bundle/Module12";
import * as _Module5041 from "../../_bundle/Module5041";
const r29 = {
ACTIVITY_PANEL: "quests_bar_activity_panel",
QUESTS_MANAGER: "quests_manager",
QUESTS_CONSOLE_OPTIMISTIC_UPDATES_MANAGER: "quests_console_optimistic_updates_manager",
USER_SETTINGS_GIFT_INVENTORY: "user_settings_gift_inventory",
USER_SETTINGS_SEARCH_GIFT_INVENTORY: "user_settings_search_gift_inventory",
USE_QUESTS: "use_quests",
STREAM_SOURCE_SELECT: "stream_source_select",
MEMBERS_LIST: "members_list",
QUESTS_BAR: "quests_bar",
QUESTS_BAR_MOBILE: "quests_bar_mobile",
REWARD_CODE_MODAL: "reward_code_modal",
INGAME_REWARD_MODAL: "ingame_reward_modal",
INGAME_CONNECTION_MODAL: "ingame_connection_modal",
COLLECTIBLE_REWARD_MODAL: "collectible_reward_modal",
ORBS_REWARD_MODAL: "orbs_reward_modal",
QUESTS_MINOR_REWARD_CAPPING_CONFIG: "QUESTS_MINOR_REWARD_CAPPING_CONFIG",
QUESTS_CARD: "quests_card",
QUESTS_STORE: "quests_store",
QUEST_CHANNEL_CALL_HEADER: "quests_channel_call_header",
QUEST_HOME_DESKTOP: "quest_home_desktop",
QUEST_HOME_HERO_SHELF_DESKTOP: "quest_home_hero_shelf_desktop",
QUEST_HOME_MOBILE: "quest_home_mobile",
QUEST_PROGRESS_BAR: "quest_progress_bar",
EMBED_MOBILE: "embed_mobile",
EMBED_DESKTOP: "embed_desktop",
QUEST_CONTEXT_MENU: "context_menu",
CODED_LINK: "coded_link",
QUEST_DISCLOSURE_MODAL: "quest_disclosure_modal",
DISCOVERY_SIDEBAR: "discovery_sidebar",
DISCOVERY_COMPASS: "discovery_compass",
BADGE: "badge",
COLLECTIBLES_SHOP_HEADER_BAR: "collectibles_shop_header_bar",
ORBS_ANNOUNCEMENT_MODAL: "orbs_announcement_modal",
CONFLICT_CHECKS: "conflict_checks",
VIDEO_MODAL: "video_modal",
VIDEO_MODAL_MOBILE: "video_modal_mobile",
GAME_WIDGETS_POPOVER: "game_widgets_popover",
PRIVATE_CHANNELS_LIST: "private_channels_list",
INTERNAL_TOOLING: "internal_tooling",
QUEST_HOME_MOVED_CALLOUT: "quest_home_moved_callout",
IN_APP_NAVIGATION: "in_app_navigation",
QUEST_DEEP_LINK_UTIL: "quest_deep_link_util",
YOU_TAB_PROFILE_HEADER: "you_tab_profile_header",
QUEST_INSTRUCTIONS: "quest_instructions",
QUEST_ACTIVITY_BOTTOM_SHEET: "quest_activity_bottom_sheet",
QUEST_PRIMARY_CTA: "quest_primary_cta",
QUEST_ACTIVITY_HEADER: "quest_activity_header",
QUEST_ACTIVITY_UNENROLLED_MODAL: "quest_activity_unenrolled_modal",
NITRO_HOME_MARKETING: "nitro_home_marketing",
NITRO_HOME_TAB: "nitro_home_tab",
QUEST_ORB_MULTIPLIER_TAB_TOOLTIP: "quest_orb_multiplier_tab_tooltip",
PLAY_QUEST_CONNECTION_MODAL: "play_quest_connection_modal"
};
const set4 = new Set([_Module5034.QuestVariants.NITRO_2_POINT_0_CTA, _Module5034.QuestVariants.ORBS_MULTIPLIER_QUEST, _Module5034.QuestVariants.XBOX_GAME_PASS_QUEST]);
const r25 = Durations.Millis.MINUTE * Quests.ConsecutiveHeartbeatPeriodMinutes;
const r24 = {
CONSOLE: "CONSOLE",
DESKTOP: "DESKTOP"
};
const r23 = {
IN_GAME: "in_game",
WEB: "web"
};
const aPIBaseURL = getAPIBaseURL();
const r22 = aPIBaseURL.indexOf("localhost") === -1 ? aPIBaseURL.indexOf("127.0.0.1") !== -1 ? `${aPIBaseURL}/_cdn_storage/` : "https://cdn.discordapp.com/" : `${aPIBaseURL}/_cdn_storage/`;
const r21 = r22 + "quests/";
const r20 = {
COLLAPSED: "collapsed",
EXPANDED: "expanded",
CLOSED: "closed",
SOFT_DISMISSED: "soft-dismissed",
RESET_TO_PREVIOUS: "reset-to-previous"
};
const r19 = {
PLAYBACK: "k",
SPACE: " ",
SEEK_BACK: "j",
SEEK_FORWARD: "l",
CAPTION: "c",
FULLSCREEN: "f",
MUTE: "m"
};
const r18 = {
EXCLUDED_QUEST: "excluded_quest",
UNKNOWN_QUEST: "unknown_quest",
NOT_SHAREABLE_QUEST: "not_shareable_quest"
};
const r17 = {
EMPTY: "empty",
COMPLETED: "completed"
};
const set3 = new Set([AdPlacement.DESKTOP_ACCOUNT_PANEL_AREA, AdPlacement.MOBILE_HOME_DOCK_AREA, AdPlacement.QUEST_HOME_BANNER_DESKTOP, AdPlacement.QUEST_HOME_MOBILE_CAROUSEL, AdPlacement.VIDEO_MODAL_MOBILE]);
const set2 = new Set([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ON_XBOX, FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION, FirstPartyQuestTaskTypes.PLAY_ACTIVITY]);
const set = new Set([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ON_XBOX, FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION, FirstPartyQuestTaskTypes.PLAY_ACTIVITY]);
const set5 = new Set([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ON_XBOX, FirstPartyQuestTaskTypes.PLAY_ON_PLAYSTATION, FirstPartyQuestTaskTypes.PLAY_ACTIVITY]);
const r250 = {
SUGGESTED: "suggested",
MOST_RECENT: "most_recent",
EXPIRING_SOON: "expiring_soon",
RECENTLY_ENROLLED: "recently_enrolled"
};
let c3039_0 = {
VIDEO: "task_video",
PLAY: "task_play"
};
let c3039_1 = {
VIRTUAL_CURRENCY: "reward_virtual_currency",
COLLECTIBLE: "reward_collectible",
IN_GAME: "reward_in_game"
};
const r34 = [{
group: "task",
filter: c3039_0.PLAY
}, {
group: "task",
filter: c3039_0.VIDEO
}, {
group: "reward",
filter: c3039_1.VIRTUAL_CURRENCY
}, {
group: "reward",
filter: c3039_1.COLLECTIBLE
}, {
group: "reward",
filter: c3039_1.IN_GAME
}];
const _excluded = ["reward", "task"];
const r279 = Object.entries(groupBy(r34, "group")).sort((a, b) => {
const r10 = _excluded.indexOf(a[0]);
const r13 = _excluded.indexOf(b[0]);
return r10 < r13 ? -1 : r13 < r10 ? 1 : 0;
});
export { r29 as QuestsExperimentLocations };
export const DismissibleQuestContentFlags = _Module5041.DismissibleQuestContentFlags;
export const QuestVariants = _Module5034.QuestVariants;
export { set4 as NitroQuestVariants };
export const QUESTS_SETTINGS_SECTION = "inventory";
export { r25 as CONSECUTIVE_HEARTBEAT_PERIOD_MS };
export const QUEST_BAR_SPRING_CONFIG_QUEST_ACCEPTED = {
tension: 900,
friction: 45,
clamp: true
};
export const QUEST_BAR_SPRING_CONFIG_QUEST_UNACCEPTED = {
tension: 360,
friction: 30,
clamp: true
};
export const MIN_SEC_UNTIL_NEXT_PROGRESS_UPDATE = 6;
export const MIN_SEC_NOISE_PROGRESS_UPDATE = 2;
export { r24 as QuestTaskPlatform };
export { r23 as QuestAuthMethod };
export const QUEST_SPLIT_MODAL_PANEL_WIDTH = 454;
export const QUEST_SPLIT_MODAL_HERO_DISPLAY_MAX_HEIGHT = 190;
export const QUEST_SPLIT_MODAL_HERO_IMAGE_DENSITY = 2;
export { r22 as CDN_URL_BASE };
export { r21 as QUESTS_CDN_URL_BASE };
export { r20 as QuestDockMode };
export const DISCORD_APPLICATION_ID = "545364944258990091";
export { r19 as VideoKeyBindings };
export const QUEST_REWARD_CODE_CLAIM_BOTTOM_SHEET_KEY = "QuestRewardCodeClaimBottomSheet";
export const QUEST_REWARD_DETAILS_BOTTOM_SHEET_KEY = "QuestRewardDetailsBottomSheet";
export const REWARD_CODE_PLACEHOLDER = "{reward_code}";
export { r18 as QuestEmbedFallbackReason };
export { r17 as BountyCarouselEmptyStateReason };
export const ORBS_INTRO_QUEST_ID = "1333839522189938740";
export const MOBILE_ORBS_INTRO_QUEST_ID = "1410358070831480904";
export const PLAY_ACTIVITY_CLOUD_GAMING_QUEST_ID = "1420556874629251124";
export const PLAY_ACTIVITY_SOCIAL_ENTRY_APPLICATION_ID = "1402418703554842694";
export const DEFAULT_VIRTUAL_CURRENCY_QUEST_HOME_HERO_ID = "1496993616537587813";
export const DEFAULT_GENERIC_QUEST_HOME_HERO_ID = "1496993616537587812";
export const DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID = "1514687533122982012";
export { set3 as BILLABLE_PLACEMENTS };
export { set2 as ACTIVE_NOW_SOCIAL_ENTRY_POINT_ALLOWED_TASK_TYPES };
export { set as CHANNEL_HEADER_SOCIAL_ENTRY_POINT_ALLOWED_TASK_TYPES };
export { set5 as MEMBER_LIST_SOCIAL_ENTRY_POINT_ALLOWED_TASK_TYPES };
export const EMPTY_AD_DECISION_DATA = {
is_targeted: false
};
export { r250 as QuestHomeSortMethods };
export { c3039_0 as TaskFilterTypes };
export { c3039_1 as RewardFilterTypes };
export function getQuestHomeFilterOptionItem(a0) {
return Object.values(c3039_0).includes(a0) ? {
group: "task",
filter: a0
} : Object.values(c3039_1).includes(a0) ? {
group: "reward",
filter: a0
} : null;
}
export { r279 as SORTED_QUEST_HOME_FILTER_GROUPS };
@@ -0,0 +1,132 @@
// Metro module 9474 (f9475).
import NetworkStore from "../../stores/NetworkStore";
import QuestStore from "./QuestStore";
import { AnalyticEvents } from "../../Constants";
import { getSignalStrength } from "../network/NetStats.android";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import getDeviceMetadata_native from "../device/getDeviceMetadata.native";
import { isForegrounded } from "../analytics_sessions/SessionForegroundUtils.native";
import NewAdRequestBehaviorExperiment from "./experiments/NewAdRequestBehaviorExperiment";
const trackRoundtrip = function trackRoundtrip(a0, a1, a2) {
if (!(Math.random() > 0.1)) {
const api_latency_ms = a0.apiResponseTimestamp == null ? null : a0.apiResponseTimestamp - a0.initialSendTimestamp;
const signalStrength = getSignalStrength();
const QUEST_DECISION_ROUNDTRIP = AnalyticEvents.QUEST_DECISION_ROUNDTRIP;
const r30 = {
...getDeviceMetadata_native(),
endpoint: a0.endpoint,
was_successful: a0.wasSuccessful,
api_latency_ms,
mobile_network_type: NetworkStore.getType(),
...signalStrength != null && {
mobile_signal_strength_level: signalStrength
},
caller_source: a0.callerSource,
ad_request_id: a0.adRequestId,
fetched_at: a2
};
const previousAdDecision = a0.previousAdDecision;
let previous_ad_request_id = previousAdDecision == null ? void 0 : previousAdDecision.adDecisionData?.decision_id;
if (previous_ad_request_id == null) {
previous_ad_request_id = null;
}
r30.previous_ad_request_id = previous_ad_request_id;
let previous_fetched_at = a0.previousAdDecision?.fetchedAt;
if (previous_fetched_at == null) {
previous_fetched_at = null;
}
r30.previous_fetched_at = previous_fetched_at;
r30.transition_case = a1;
r30.is_foregrounded = isForegrounded();
AnalyticsUtils.track(QUEST_DECISION_ROUNDTRIP, r30);
}
};
class QuestDecisionRoundtripTracker {
constructor() {
return {
__proto__: new.target.prototype,
pendingRequests: new Map()
};
}
recordQuestRequestAttempt(a0, a1) {
let placement = arguments[2];
if (placement === void 0) {
placement = null;
}
const enableNewRequestBehavior = NewAdRequestBehaviorExperiment.getConfig({
location: "recordQuestRequestAttempt"
}).enableNewRequestBehavior;
let previousAdDecision = null;
if (enableNewRequestBehavior) {
const r3 = placement != null;
previousAdDecision = null;
if (r3) {
let r23 = QuestStore.questAdDecisionByPlacement.get(placement);
if (r23 == null) {
r23 = null;
}
previousAdDecision = r23;
}
}
this.pendingRequests.set(a0, {
initialSendTimestamp: Date.now(),
endpoint: a0,
apiResponseTimestamp: null,
wasSuccessful: false,
callerSource: a1,
adRequestId: null,
previousAdDecision,
placement
});
setTimeout(() => {
const pendingRequests = this.pendingRequests;
const r6 = pendingRequests.get(a0);
if (r6 != null) {
trackRoundtrip(r6, "timeout", null);
this.pendingRequests.delete(a0);
}
}, 30000);
}
recordQuestRequestApiResponse(a0, { wasSuccessful, adRequestId = null, currentQuestId = null, currentFetchedAt = null }) {
const r12 = this.pendingRequests.get(a0);
if (r12 != null) {
const enableNewRequestBehavior = NewAdRequestBehaviorExperiment.getConfig({
location: "recordQuestRequestApiResponse"
}).enableNewRequestBehavior;
let r31 = "legacy";
let r32 = null;
if (enableNewRequestBehavior) {
const r14 = currentFetchedAt !== null ? {
questId: currentQuestId,
adCreativeId: currentQuestId,
fetchedAt: currentFetchedAt,
ttlMillis: 0,
adDecisionData: adRequestId != null ? {
decision_id: adRequestId
} : void 0
} : null;
const previousAdDecision = r12.previousAdDecision;
const r36 = previousAdDecision == null;
let r19 = "null";
const r18 = r36 ? "null" : previousAdDecision.questId == null ? "no_serve" : "quest";
if (r14 != null) {
r19 = r14.questId == null ? "no_serve" : "quest";
}
r31 = r18 === "quest" && r19 === "quest" ? previousAdDecision?.questId === r14?.questId ? "same_quest" : "different_quest" : `${r18}_to_${r19}`;
r32 = currentFetchedAt;
}
trackRoundtrip({
...r12,
apiResponseTimestamp: Date.now(),
wasSuccessful,
adRequestId
}, r31, r32);
this.pendingRequests.delete(a0);
}
}
}
const r36 = {
__proto__: QuestDecisionRoundtripTracker.prototype,
pendingRequests: new Map()
};
export default r36;
+13
View File
@@ -0,0 +1,13 @@
// Metro module 9494 (f9495).
export function questHomeHeroCtaFromServer(a0) {
return {
url: a0.url,
buttonLabel: a0.button_label,
android: a0.android != null ? {
androidAppId: a0.android.android_app_id
} : void 0,
ios: a0.ios != null ? {
iosAppId: a0.ios.ios_app_id
} : void 0
};
}
+41
View File
@@ -0,0 +1,41 @@
// Metro module 9493 (f9494).
import { resolveAdCreativeCdnUrl, resolveOptionalAdCreativeCdnUrl } from "./lib/AssetUtils";
import { questHomeHeroCtaFromServer } from "./QuestHomeHeroCta";
export function questHomeHeroFromServer(a0) {
const creative_content = a0.creative_content;
const r2 = {
id: creative_content.id,
labelTitle: creative_content.label_title,
labelSubtitle: creative_content.label_subtitle,
heroImage: resolveAdCreativeCdnUrl(creative_content.hero_image),
heroVideo: resolveOptionalAdCreativeCdnUrl(creative_content.hero_video),
sponsorImage: resolveOptionalAdCreativeCdnUrl(creative_content.sponsor_image),
cta: questHomeHeroCtaFromServer(creative_content.cta),
questIds: creative_content.quest_ids,
questHomeEntrypoint: null,
shelfImage: null,
shelfVideo: null,
startsAt: null,
endsAt: null
};
const r36 = creative_content.quest_home_entrypoint != null;
let questHomeEntrypoint = void 0;
if (r36) {
const quest_home_entrypoint = creative_content.quest_home_entrypoint;
questHomeEntrypoint = {
linearGradient: quest_home_entrypoint.linear_gradient,
radialGradient: quest_home_entrypoint.radial_gradient,
gradientPreset: quest_home_entrypoint.gradient_preset,
image: resolveOptionalAdCreativeCdnUrl(quest_home_entrypoint.image),
tooltipImage: resolveOptionalAdCreativeCdnUrl(quest_home_entrypoint.tooltip_image),
tooltipTitle: quest_home_entrypoint.tooltip_title,
tooltipSubtitle: quest_home_entrypoint.tooltip_subtitle
};
}
r2.questHomeEntrypoint = questHomeEntrypoint;
r2.shelfImage = resolveOptionalAdCreativeCdnUrl(creative_content.shelf_image);
r2.shelfVideo = resolveOptionalAdCreativeCdnUrl(creative_content.shelf_video);
r2.startsAt = a0.starts_at;
r2.endsAt = a0.ends_at;
return r2;
}
@@ -0,0 +1,8 @@
// Metro module 10961 (f10962).
import { createZustandStore } from "../../lib/ZustandStore";
const r14 = (0, createZustandStore)(() => ({
sort: null,
filter: null,
scrollToQuestId: null
}));
export default r14;
@@ -0,0 +1,68 @@
// Metro module 14192 (f14193).
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import MonitoringAgent from "../monitoring/MonitoringAgent";
import { MetricEvents } from "../../_bundle/Module5872";
import DiscordAppState_native from "../app_state/DiscordAppState.native";
let c9966_4 = 30000;
class QuestHomeRoundtripTracker {
constructor() {
return {
__proto__: new.target.prototype,
startTime: null,
timeoutTimer: null
};
}
clearTimeoutTimer() {
if (this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
this.timeoutTimer = null;
}
}
sendMetric(a0, a1, a2) {
AnalyticsUtils.track(AnalyticEvents.QUEST_HOME_ROUNDTRIP, {
timeout: a0,
duration: a1
});
if (!(Math.random() > 0.1)) {
MonitoringAgent.distribution({
name: MetricEvents.QUEST_HOME_ROUNDTRIP,
tags: [`includes_bounties:${a2}`, `timeout:${a0}`]
}, a1);
}
}
startTracking(r4 = {}) {
let includesBounties2 = r4.includesBounties;
if (includesBounties2 === void 0) {
includesBounties2 = false;
}
const includesBounties = includesBounties2;
this.clearTracking();
this.startTime = performance.now();
this.timeoutTimer = setTimeout(() => {
this.stopTracking({
includesBounties,
timeout: true
});
}, c9966_4);
}
stopTracking(r2 = {}) {
const { includesBounties: includesBounties2 = false, timeout = false } = r2;
if (this.startTime != null) {
if (DiscordAppState_native.getState() === "active") {
this.sendMetric(timeout, Math.min(timeout ? c9966_4 : Math.round(performance.now() - this.startTime), c9966_4), includesBounties2);
}
this.clearTracking();
}
}
clearTracking() {
this.clearTimeoutTimer();
this.startTime = null;
}
}
const prototype = QuestHomeRoundtripTracker.prototype;
export default {
__proto__: prototype,
startTime: null,
timeoutTimer: null
};
+968
View File
@@ -0,0 +1,968 @@
// Metro module 5985 (f5986).
import _slicedToArray from "../../_bundle/_slicedToArray";
import ConsoleQuestUIStore from "./ConsoleQuestUIStore";
import VideoQuestUIStore from "./VideoQuestUIStore";
import { QuestsExperimentLocations } from "./QuestConstants";
import Durations from "../../utils/Durations";
import { isNil } from "../../_bundle/Module12";
import { FirstPartyQuestTaskTypesSets } from "../../_bundle/Module5040";
import { QuestRewardTypes } from "../../_bundle/Module5990";
import SentryUtils_native from "../../utils/SentryUtils.native";
import * as _QuestDataUtils from "./utils/QuestDataUtils";
import { findNextUpcomingExpirationEpochMs } from "./utils/QuestDataUtils";
import { QuestContent } from "./QuestTypes";
import { getQuestLogger } from "./lib/getQuestLogger";
import { questWithUserStatusFromServer, questUserStatusFromServer } from "./utils/QuestServerUtils";
import NewAdRequestBehaviorExperiment from "./experiments/NewAdRequestBehaviorExperiment";
import { resolveResponseTtl } from "../ads/utils/AdDecisionUtils";
import Backoff from "../../_bundle/Backoff";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3780_3, c3780_4, c3780_5, c3780_6, c3780_7, c3780_8, c3780_9, c3780_10, c3780_11, c3780_12, c3780_13, c3780_14, c3780_15, c3780_16, c3780_17, c3780_18, c3780_19, c3780_20, c3780_21, c3780_22, c3780_23, c3780_24, c3780_25, c3780_26, c3780_27, c3780_28, c3780_29, c3780_30, c3780_31, c3780_32, c3780_37, c3780_38, c3780_39, c3780_40, c3780_41, c3780_42, questHomeHero, c3780_44, updateQuestData, _runExpirationCheck, c3780_48, $mk77561 = function() {
return function syncQuestProgressingOnDesktop(a0, a1) {
if (a1.userStatus != null) {
const r7 = Object;
let r25 = a1.userStatus?.progress;
if (r25 == null) {
r25 = {};
}
for (const item of r7.values(r25)) {
if (!isNil(item) && FirstPartyQuestTaskTypesSets.DESKTOP.has(item.eventName)) {
if (item.heartbeat?.lastBeatAt != null) {
c3780_19.add(a0);
} else if (item.heartbeat?.lastBeatAt == null) {
c3780_19.delete(a0);
}
}
}
}
};
};
const initializeState = function initializeState() {
c3780_3 = false;
c3780_4 = false;
c3780_5 = new Map();
c3780_6 = false;
c3780_7 = false;
c3780_8 = new Map();
c3780_9 = new Map();
c3780_10 = new Map();
c3780_11 = new Map();
c3780_12 = 0;
c3780_13 = 0;
c3780_14 = new Set();
c3780_15 = new Set();
c3780_16 = new Set();
c3780_17 = new Set();
c3780_18 = new Set();
c3780_37 = new Map();
c3780_20 = new Map();
c3780_21 = new Map();
c3780_22 = new Map();
c3780_23 = new Map();
c3780_24 = new Map();
c3780_19 = new Set();
c3780_25 = new Map();
c3780_26 = new Map();
c3780_27 = new Map();
if (c3780_38 != null) {
clearTimeout(c3780_38);
c3780_38 = null;
}
c3780_28 = null;
c3780_32 = new Map();
c3780_44 = new Map();
c3780_29 = new Map();
c3780_30 = new Map();
c3780_31 = new Map();
c3780_41 = null;
questHomeHero = null;
};
updateQuestData = function updateQuestData(a0, a1) {
const map = new Map(c3780_9);
c3780_9 = map;
const r15 = map.get(a0);
if (r15 != null) {
const r9 = {
...r15,
...a1
};
$mk77561()(a0, a1);
c3780_9.set(a0, r9);
if (c3780_32.has(a0)) {
const r31 = c3780_32.get(a0);
if (r31 != null) {
const map2 = new Map(c3780_32);
c3780_32 = map2;
map2.set(a0, {
...r31,
...a1
});
}
}
}
};
_runExpirationCheck = function _runExpirationCheck() {
let c15344_0 = false;
const map = new Map(c3780_27);
let c15344_1 = map;
c3780_9.forEach((item, index) => {
if (c15344_1.get(index) !== true) {
if (_QuestDataUtils.isQuestExpired(item)) {
c15344_1.set(index, true);
c15344_0 = true;
} else if (!c15344_1.has(index)) {
c15344_1.set(index, false);
}
}
});
if (c15344_0) {
c3780_27 = map;
c3780_48.emitChange();
}
const r34 = findNextUpcomingExpirationEpochMs(Array.from(c3780_9.values()));
if (r34 != null) {
const r42 = Math.max(5000, r34 - Date.now() + 2000);
if (!(r42 > 864000000)) {
c3780_38 = setTimeout(() => {
_runExpirationCheck();
}, r42);
}
}
};
c3780_37 = new Map();
c3780_38 = null;
c3780_39 = 30 * Durations.Millis.SECOND;
c3780_40 = 10 * Durations.Millis.MINUTE;
c3780_41 = null;
c3780_42 = false;
questHomeHero = null;
c3780_44 = new Map();
initializeState();
class QuestStore extends Module589.Store {
static displayName = "QuestStore";
get quests() {
return c3780_9;
}
get excludedQuests() {
return c3780_10;
}
get claimedQuests() {
return c3780_11;
}
get isFetchingCurrentQuests() {
return c3780_3;
}
get isFetchingClaimedQuests() {
return c3780_6;
}
isFetchingQuestPreview(a0) {
return c3780_18.has(a0);
}
get lastFetchedCurrentQuests() {
return c3780_12;
}
get lastFetchedQuestToDeliver() {
return c3780_13;
}
get isFetchingQuestToDeliver() {
return c3780_4;
}
isFetchingQuestToDeliverByPlacement(a0) {
let r6 = c3780_5 == null ? void 0 : c3780_5.get(a0);
if (r6 == null) {
r6 = false;
}
return r6;
}
canRefreshAd(a0) {
const r3 = c3780_31 == null ? void 0 : c3780_31.get(a0);
return r3 == null || Date.now() >= r3;
}
getQuestPreviewOverride(a0) {
const r5 = c3780_23.get(a0);
return r5 == null ? void 0 : c3780_9.get(r5);
}
get questToDeliverForPlacement() {
return c3780_25;
}
get questEnrollmentBlockedUntil() {
return c3780_28;
}
get questAdDecisionByPlacement() {
return c3780_29;
}
getFetchQuestPreviewError(a0) {
return c3780_44.get(a0);
}
isEnrolling(a0) {
return c3780_14.has(a0);
}
isClaimingReward(a0) {
return c3780_15.has(a0);
}
isFetchingRewardCode(a0) {
return c3780_16.has(a0);
}
isDismissingContent(a0) {
return c3780_17.has(a0);
}
getRewardCode(a0) {
return c3780_20.get(a0);
}
getRewards(a0) {
return c3780_21.get(a0);
}
getStreamHeartbeatFailure(a0) {
return c3780_22.get(a0);
}
getQuest(a0) {
return c3780_9.get(a0);
}
getQuestConfig(a0) {
return this.getQuest(a0)?.config;
}
isProgressingOnDesktop(a0) {
return c3780_19.has(a0);
}
selectedTaskPlatform(a0) {
let r5 = c3780_24.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
getOptimisticProgress(a0, a1) {
const r4 = c3780_37.get(a0);
return r4 == null ? void 0 : r4.get(a1);
}
getExpiredQuestsMap() {
return c3780_27;
}
isQuestExpired(a0) {
let r5 = c3780_27.get(a0);
if (r5 == null) {
r5 = false;
}
return r5;
}
getQuestLoadedViaPreview(a0) {
return c3780_32.get(a0);
}
isFetchingQuestHomeHero() {
return c3780_42;
}
getQuestHomeHero() {
return questHomeHero;
}
getLastFetchedQuestHomeHero() {
return c3780_41;
}
get isFetchingEarnedQuestToDeliver() {
return c3780_7;
}
isFetchingEarnedQuestToDeliverByPlacement(a0) {
let r6 = c3780_8 == null ? void 0 : c3780_8.get(a0);
if (r6 == null) {
r6 = false;
}
return r6;
}
get earnedQuestForPlacement() {
return c3780_26;
}
}
c3780_48 = new QuestStore(Dispatcher, {
LOGOUT: function handleLogout() {
if (c3780_38 != null) {
clearTimeout(c3780_38);
c3780_38 = null;
}
initializeState();
VideoQuestUIStore.getState().clearState();
ConsoleQuestUIStore.getState().reset();
},
QUESTS_FETCH_CURRENT_QUESTS_BEGIN: function handleFetchCurrentQuestsBegin() {
c3780_3 = true;
},
QUESTS_FETCH_CURRENT_QUESTS_SUCCESS: function handleFetchCurrentQuestsSuccess({ quests: quests2, excludedQuests: excludedQuests2, questEnrollmentBlockedUntil: questEnrollmentBlockedUntil2 }) {
let r36;
let c15345_0;
c15345_0 = void 0;
const prevQuestIds = [...c3780_9.keys()];
const nextQuestIds = quests2.map((item) => item.id);
c15345_0 = nextQuestIds;
const removedIds = prevQuestIds.filter((prevQuestId) => !c15345_0.includes(prevQuestId));
if (removedIds.length > 0) {
SentryUtils_native.addBreadcrumb({
category: "quests.store",
message: `handleFetchCurrentQuestsSuccess: ${removedIds.length} quest(s) removed during rebuild`,
data: {
prevQuestIds,
nextQuestIds,
removedIds
}
});
}
c3780_12 = Date.now();
c3780_3 = false;
c3780_9 = new Map();
const map = new Map();
let r72 = quests2[Symbol.iterator]();
const next = r72.next;
while (true) {
const r78 = r72 === void 0 ? void 0 : (r36 = next.call(r72)).done ? r72 = void 0 : r36.value;
if (r72 === void 0) {
c3780_10 = new Map();
for (const item of excludedQuests2) {
c3780_10.set(item.id, item);
}
const r140 = c3780_32 == null ? void 0 : c3780_32.values();
for (const item2 of r140) {
if (!c3780_9.has(item2.id)) {
const r153 = c3780_9;
r153.set(item2.id, item2);
map.set(item2.id, _QuestDataUtils.isQuestExpired(item2));
}
}
c3780_27 = map;
(function _startExpirationChecker() {
if (c3780_38 != null) {
clearTimeout(c3780_38);
c3780_38 = null;
}
_runExpirationCheck();
})();
c3780_28 = questEnrollmentBlockedUntil2 != null ? new Date(questEnrollmentBlockedUntil2) : null;
return void 0;
} else {
try {
c3780_9.set(r78.id, r78);
map.set(r78.id, _QuestDataUtils.isQuestExpired(r78));
if (r78.targetedContent.includes(QuestContent.QUEST_BAR)) {
const questLogger = getQuestLogger({
location: QuestsExperimentLocations.QUESTS_STORE
});
questLogger.log(`Delivered ${r78.config.messages.questName} (${r78.id})`);
}
} catch (r120) {
if (r72 !== void 0 && typeof r72.return === "function") {
try {
r72.return();
} catch {}
}
throw r120;
}
}
}
},
QUESTS_FETCH_CURRENT_QUESTS_FAILURE: function handleFetchCurrentQuestsFailure() {
c3780_12 = 0;
c3780_3 = false;
},
QUESTS_FETCH_CLAIMED_QUESTS_BEGIN: function handleFetchClaimedQuestsBegin() {
c3780_6 = true;
},
QUESTS_FETCH_CLAIMED_QUESTS_SUCCESS: function handleFetchClaimedQuestsSuccess({ quests: quests2 }) {
c3780_6 = false;
c3780_11 = new Map();
for (const item of quests2) {
c3780_11.set(item.id, item);
}
},
QUESTS_FETCH_CLAIMED_QUESTS_FAILURE: function handleFetchClaimedQuestsFailure() {
c3780_6 = false;
},
QUESTS_FETCH_QUEST_TO_DELIVER_BEGIN: function handleFetchQuestToDeliverBegin({ placement }) {
c3780_4 = true;
const map = new Map(c3780_5);
c3780_5 = map;
map.set(placement, true);
},
QUESTS_FETCH_QUEST_TO_DELIVER_SUCCESS: function handleFetchQuestToDeliverSuccess({ quest, placement, adDecisionData, adContext, responseTtlSeconds, metadataSealed, trafficMetadataSealed, fetchedAt }) {
c3780_13 = Date.now();
c3780_4 = false;
const map = new Map(c3780_5);
c3780_5 = map;
map.set(placement, false);
const r29 = c3780_30.get(placement);
if (r29 != null) {
r29.succeed();
}
c3780_31.delete(placement);
if (NewAdRequestBehaviorExperiment.getConfig({
location: "handleFetchQuestToDeliverSuccess"
}).enableNewRequestBehavior) {
let questId = quest?.id;
if (questId == null) {
questId = null;
}
let adCreativeId = quest?.id;
if (adCreativeId == null) {
adCreativeId = null;
}
const r51 = {
questId,
adCreativeId,
fetchedAt,
ttlMillis: resolveResponseTtl(responseTtlSeconds),
adDecisionData,
adContext,
metadataSealed,
trafficMetadataSealed
};
const map2 = new Map(c3780_29);
c3780_29 = map2;
map2.set(placement, r51);
} else if (quest == null) {
c3780_25.delete(placement);
} else {
c3780_25.set(placement, {
quest,
adDecisionData,
adContext,
metadataSealed,
trafficMetadataSealed
});
}
},
QUESTS_FETCH_QUEST_TO_DELIVER_FAILURE: function handleFetchQuestToDeliverFailure({ placement }) {
c3780_25.delete(placement);
c3780_13 = Date.now();
c3780_4 = false;
const map = new Map(c3780_5);
c3780_5 = map;
map.set(placement, false);
let r24 = c3780_30.get(placement);
if (r24 == null) {
const backoff = new Backoff(c3780_39, c3780_40);
c3780_30.set(placement, backoff);
r24 = backoff;
}
c3780_31.set(placement, Date.now() + r24.fail());
},
QUESTS_CLEAR_EXPIRED_QUEST_TO_DELIVER: function handleClearExpiredQuestToDeliver({ placement, responseTtlSeconds, fetchedAt }) {
if (NewAdRequestBehaviorExperiment.getConfig({
location: "handleClearExpiredQuestToDeliver"
}).enableNewRequestBehavior) {
c3780_4 = false;
const map = new Map(c3780_5);
c3780_5 = map;
map.set(placement, false);
const r25 = {
questId: null,
adCreativeId: null,
fetchedAt,
ttlMillis: resolveResponseTtl(responseTtlSeconds)
};
const map2 = new Map(c3780_29);
c3780_29 = map2;
map2.set(placement, r25);
return void 0;
}
return false;
},
QUESTS_FETCH_EARNED_QUEST_TO_DELIVER_BEGIN: function handleFetchEarnedQuestToDeliverBegin({ content }) {
c3780_7 = true;
const map = new Map(c3780_8);
c3780_8 = map;
map.set(content, true);
},
QUESTS_FETCH_EARNED_QUEST_TO_DELIVER_SUCCESS: function handleFetchEarnedQuestToDeliverSuccess({ serverQuests, content, fetchedAt, responseTtlSeconds }) {
c3780_7 = false;
const map = new Map(c3780_8);
c3780_8 = map;
map.set(content, false);
const ttlMillis = resolveResponseTtl(responseTtlSeconds);
const map2 = new Map(c3780_26.get(content)?.earnedDecisionByQuestId);
for (const item of serverQuests) {
const [r20, r65] = item;
map2.set(r20, {
fetchedAt,
ttlMillis,
shouldDeliver: r65 != null
});
if (r65 != null) {
const r72 = c3780_9.get(r20);
const r81 = questWithUserStatusFromServer(r65);
if (r72 != null) {
updateQuestData(r20, r81);
} else {
const map3 = new Map(c3780_9);
c3780_9 = map3;
map3.set(r20, r81);
const map4 = new Map(c3780_27);
c3780_27 = map4;
map4.set(r20, _QuestDataUtils.isQuestExpired(r81));
}
}
}
c3780_26.set(content, {
earnedDecisionByQuestId: map2
});
},
QUESTS_FETCH_EARNED_QUEST_TO_DELIVER_FAILURE: function handleFetchEarnedQuestToDeliverFailure({ content }) {
c3780_7 = false;
const map = new Map(c3780_8);
c3780_8 = map;
map.set(content, false);
},
QUESTS_FETCH_PREVIEW_BEGIN: function handleFetchQuestPreviewBegin({ questId }) {
const set = new Set(c3780_18);
c3780_18 = set;
set.add(questId);
const map = new Map(c3780_44);
c3780_44 = map;
map.delete(questId);
},
QUESTS_FETCH_PREVIEW_SUCCESS: function handleFetchQuestPreviewSuccess({ questId, quest }) {
const set = new Set(c3780_18);
c3780_18 = set;
set.delete(questId);
const map = new Map(c3780_32);
c3780_32 = map;
map.set(questId, quest);
const map2 = new Map(c3780_9);
c3780_9 = map2;
map2.set(questId, quest);
const map3 = new Map(c3780_44);
c3780_44 = map3;
map3.delete(questId);
},
QUESTS_FETCH_PREVIEW_FAILURE: function handleFetchQuestPreviewFailure({ questId, error }) {
const set = new Set(c3780_18);
c3780_18 = set;
set.delete(questId);
const map = new Map(c3780_44);
c3780_44 = map;
map.set(questId, error);
},
QUESTS_SEND_HEARTBEAT_SUCCESS: function handleSendHeartbeatSuccess({ questId, streamKey, userStatus }) {
c3780_19.add(questId);
const r10 = {
userStatus
};
const map = new Map(c3780_9);
c3780_9 = map;
const r22 = map.get(questId);
if (r22 != null) {
const r23 = {
...r22,
...r10
};
$mk77561()(questId, r10);
c3780_9.set(questId, r23);
if (c3780_32.has(questId)) {
const r11 = c3780_32.get(questId);
if (r11 != null) {
const map2 = new Map(c3780_32);
c3780_32 = map2;
map2.set(questId, {
...r11,
...r10
});
}
}
}
if (streamKey != null && c3780_22.get(streamKey) != null) {
const map3 = new Map(c3780_22);
c3780_22 = map3;
map3.delete(streamKey);
}
},
QUESTS_SEND_HEARTBEAT_FAILURE: function handleSendHeartbeatFailure({ questId, streamKey }) {
if (streamKey != null && c3780_22.get(streamKey) == null) {
const map = new Map(c3780_22);
c3780_22 = map;
map.set(streamKey, {
questId,
streamKey,
firstFailedAt: Date.now()
});
}
},
QUESTS_ENROLL_BEGIN: function handleEnrollBegin({ questId }) {
const set = new Set(c3780_14);
set.add(questId);
c3780_14 = set;
},
QUESTS_ENROLL_SUCCESS: function handleEnrollSuccess({ enrolledQuestUserStatus }) {
const questId = enrolledQuestUserStatus.questId;
const r10 = {
userStatus: enrolledQuestUserStatus
};
const map = new Map(c3780_9);
c3780_9 = map;
const r18 = map.get(questId);
if (r18 != null) {
const r19 = {
...r18,
...r10
};
$mk77561()(questId, r10);
c3780_9.set(questId, r19);
if (c3780_32.has(questId)) {
const r11 = c3780_32.get(questId);
if (r11 != null) {
const map2 = new Map(c3780_32);
c3780_32 = map2;
map2.set(questId, {
...r11,
...r10
});
}
}
}
const questId2 = enrolledQuestUserStatus.questId;
const set = new Set(c3780_14);
set.delete(questId2);
c3780_14 = set;
},
QUESTS_ENROLL_FAILURE: function handleEnrollFailure({ questId }) {
const set = new Set(c3780_14);
set.delete(questId);
c3780_14 = set;
},
QUESTS_FETCH_REWARD_CODE_BEGIN: function handleFetchRewardCodeBegin({ questId }) {
const set = new Set(c3780_16);
set.add(questId);
c3780_16 = set;
},
QUESTS_FETCH_REWARD_CODE_SUCCESS: function handleFetchRewardCodeSuccess({ questId, rewardCode }) {
const set = new Set(c3780_16);
set.delete(questId);
c3780_16 = set;
const map = new Map(c3780_20);
map.set(questId, rewardCode);
c3780_20 = map;
const userStatus = c3780_9.get(questId)?.userStatus;
if (userStatus != null && userStatus.claimedAt == null) {
const r37 = {
userStatus: {
...userStatus,
claimedAt: rewardCode.claimedAt
}
};
const map2 = new Map(c3780_9);
c3780_9 = map2;
const r45 = map2.get(questId);
if (r45 != null) {
const r46 = {
...r45,
...r37
};
$mk77561()(questId, r37);
c3780_9.set(questId, r46);
if (c3780_32.has(questId)) {
const r63 = c3780_32.get(questId);
if (r63 != null) {
const map3 = new Map(c3780_32);
c3780_32 = map3;
map3.set(questId, {
...r63,
...r37
});
}
}
}
}
},
QUESTS_FETCH_REWARD_CODE_FAILURE: function handleFetchRewardCodeFailure({ questId }) {
const set = new Set(c3780_16);
set.delete(questId);
c3780_16 = set;
},
QUESTS_CLAIM_REWARD_BEGIN: function handleClaimRewardBegin({ questId }) {
const set = new Set(c3780_15);
set.add(questId);
c3780_15 = set;
},
QUESTS_CLAIM_REWARD_SUCCESS: function handleClaimRewardSuccess({ questId, entitlements }) {
const set = new Set(c3780_15);
set.delete(questId);
c3780_15 = set;
const map = new Map(c3780_21);
map.set(questId, entitlements.items);
c3780_21 = map;
const userStatus = c3780_9.get(questId)?.userStatus;
if (userStatus != null && userStatus.claimedAt == null) {
const tenantMetadata = entitlements.items[0].tenantMetadata;
const r38 = tenantMetadata == null ? void 0 : tenantMetadata.questRewards.reward;
const r46 = r38?.tag === QuestRewardTypes.REWARD_CODE ? r38.rewardCode : null;
if (r46 != null) {
const map2 = new Map(c3780_20);
map2.set(questId, r46);
c3780_20 = map2;
}
let claimedTier = r46?.tier;
if (claimedTier == null) {
claimedTier = null;
}
const r61 = {
userStatus: {
...userStatus,
claimedAt: entitlements.claimedAt,
claimedTier
}
};
const map3 = new Map(c3780_9);
c3780_9 = map3;
const r69 = map3.get(questId);
if (r69 != null) {
const r70 = {
...r69,
...r61
};
$mk77561()(questId, r61);
c3780_9.set(questId, r70);
if (c3780_32.has(questId)) {
const r87 = c3780_32.get(questId);
if (r87 != null) {
const map4 = new Map(c3780_32);
c3780_32 = map4;
map4.set(questId, {
...r87,
...r61
});
}
}
}
}
},
QUESTS_CLAIM_REWARD_FAILURE: function handleClaimRewardFailure({ questId }) {
const set = new Set(c3780_15);
set.delete(questId);
c3780_15 = set;
},
QUESTS_DISMISS_CONTENT_BEGIN: function handleDismissContentBegin({ questId }) {
const set = new Set(c3780_17);
set.add(questId);
c3780_17 = set;
const map = new Map(c3780_23);
let r34 = false;
for (const item of map) {
const r40 = _slicedToArray(item, 2);
const r41 = r40[0];
if (r40[1] === questId) {
map.delete(r41);
r34 = true;
}
}
if (r34) {
c3780_23 = map;
}
},
QUESTS_DISMISS_CONTENT_SUCCESS: function handleDismissContentSuccess({ dismissedQuestUserStatus }) {
const questId = dismissedQuestUserStatus.questId;
const r10 = {
userStatus: dismissedQuestUserStatus
};
const map = new Map(c3780_9);
c3780_9 = map;
const r18 = map.get(questId);
if (r18 != null) {
const r19 = {
...r18,
...r10
};
$mk77561()(questId, r10);
c3780_9.set(questId, r19);
if (c3780_32.has(questId)) {
const r11 = c3780_32.get(questId);
if (r11 != null) {
const map2 = new Map(c3780_32);
c3780_32 = map2;
map2.set(questId, {
...r11,
...r10
});
}
}
}
const questId2 = dismissedQuestUserStatus.questId;
const set = new Set(c3780_17);
set.delete(questId2);
c3780_17 = set;
},
QUESTS_DISMISS_CONTENT_FAILURE: function handleDismissContentFailure({ questId }) {
const set = new Set(c3780_17);
set.delete(questId);
c3780_17 = set;
},
QUESTS_USER_STATUS_UPDATE: function handleQuestUserStatusUpdate({ user_status }) {
const questLogger = getQuestLogger({
location: QuestsExperimentLocations.QUESTS_STORE
});
questLogger.log(`Received user status update for ${user_status.quest_id}`, user_status);
const userStatus = questUserStatusFromServer(user_status);
const quest_id = user_status.quest_id;
const r15 = {
userStatus
};
const map = new Map(c3780_9);
c3780_9 = map;
const r39 = map.get(quest_id);
if (r39 != null) {
const r40 = {
...r39,
...r15
};
$mk77561()(quest_id, r15);
c3780_9.set(quest_id, r40);
if (c3780_32.has(quest_id)) {
const r16 = c3780_32.get(quest_id);
if (r16 != null) {
const map2 = new Map(c3780_32);
c3780_32 = map2;
map2.set(quest_id, {
...r16,
...r15
});
}
}
}
const r73 = c3780_9.get(user_status.quest_id);
if (r73 != null) {
const isQuestExpired2 = _QuestDataUtils.isQuestExpired(r73);
if (c3780_27.get(user_status.quest_id) !== isQuestExpired2) {
c3780_27 = new Map(c3780_27).set(user_status.quest_id, isQuestExpired2);
}
}
if (Object.keys(userStatus.progress).length === 0 && c3780_37.has(userStatus.questId)) {
questLogger.log(`Removing optimistic progress for ${userStatus.questId}`);
c3780_37.delete(userStatus.questId);
}
},
STREAM_CLOSE: function handleStreamClose({ streamKey }) {
if (c3780_22.get(streamKey) != null) {
const map = new Map(c3780_22);
c3780_22 = map;
map.delete(streamKey);
}
},
QUESTS_DISMISS_PROGRESS_TRACKING_FAILURE_NOTICE: function handleDismissProgressTrackingFailureNotice({ streamKey }) {
if (c3780_22.get(streamKey) != null) {
const map = new Map(c3780_22);
c3780_22 = map;
map.delete(streamKey);
}
},
QUESTS_PREVIEW_UPDATE_SUCCESS: function handlePreviewUpdateSuccess({ previewQuestUserStatus }) {
const questId = previewQuestUserStatus.questId;
const r10 = {
userStatus: previewQuestUserStatus
};
const map = new Map(c3780_9);
c3780_9 = map;
const r18 = map.get(questId);
if (r18 != null) {
const r19 = {
...r18,
...r10
};
$mk77561()(questId, r10);
c3780_9.set(questId, r19);
if (c3780_32.has(questId)) {
const r11 = c3780_32.get(questId);
if (r11 != null) {
const map2 = new Map(c3780_32);
c3780_32 = map2;
map2.set(questId, {
...r11,
...r10
});
}
}
}
if (previewQuestUserStatus.claimedAt == null) {
const map3 = new Map(c3780_20);
c3780_20 = map3;
map3.delete(previewQuestUserStatus.questId);
}
if (previewQuestUserStatus.enrolledAt == null) {
const map4 = new Map(c3780_24);
c3780_24 = map4;
map4.delete(previewQuestUserStatus.questId);
VideoQuestUIStore.getState().resetQuest(previewQuestUserStatus.questId);
}
const r78 = c3780_9.get(previewQuestUserStatus.questId);
if (r78 != null) {
const isQuestExpired2 = _QuestDataUtils.isQuestExpired(r78);
if (c3780_27.get(previewQuestUserStatus.questId) !== isQuestExpired2) {
c3780_27 = new Map(c3780_27).set(previewQuestUserStatus.questId, isQuestExpired2);
}
}
},
QUESTS_PREVIEW_OVERRIDE: function handlePreviewOverride({ placement, questId }) {
const map = new Map(c3780_23);
if (map.get(placement) === questId) {
map.delete(placement);
} else {
map.set(placement, questId);
}
c3780_23 = map;
},
QUESTS_SELECT_TASK_PLATFORM: function handleSelectTaskPlatform({ questId, platform: platform2 }) {
c3780_24 = new Map(c3780_24);
if (platform2 == null) {
c3780_24.delete(questId);
} else {
c3780_24.set(questId, platform2);
}
},
QUESTS_UPDATE_OPTIMISTIC_PROGRESS: function handleUpdateOptimisticProgress({ questId, taskEventName, progress }) {
let r12 = c3780_37.get(questId);
if (r12 == null) {
r12 = new Map();
}
r12.set(taskEventName, progress);
c3780_37.set(questId, r12);
},
QUESTS_RESET_OPTIMISTIC_PROGRESS: function handleResetOptimisticProgress({ questId }) {
if (c3780_37.has(questId)) {
c3780_37.delete(questId);
}
VideoQuestUIStore.getState().resetQuest(questId);
},
QUESTS_USER_COMPLETION_UPDATE: function handleUserCompletionUpdate({ quest_enrollment_blocked_until }) {
c3780_28 = quest_enrollment_blocked_until != null ? new Date(quest_enrollment_blocked_until) : null;
},
QUESTS_FETCH_QUEST_HOME_HERO_BEGIN: function handleFetchQuestHomeHeroBegin({ placement }) {
c3780_42 = true;
const map = new Map(c3780_5);
c3780_5 = map;
map.set(placement, true);
},
QUESTS_FETCH_QUEST_HOME_HERO_SUCCESS: function handleFetchQuestHomeHeroSuccess(a0) {
c3780_42 = false;
c3780_41 = Date.now();
const map = new Map(c3780_5);
c3780_5 = map;
map.set(a0.placement, false);
questHomeHero = a0.questHomeHero;
let adCreativeId = a0.questHomeHero?.id;
if (adCreativeId == null) {
adCreativeId = null;
}
const r24 = {
questId: null,
adCreativeId,
fetchedAt: a0.fetchedAt,
ttlMillis: resolveResponseTtl(a0.responseTtlSeconds),
adDecisionData: a0.adDecisionData,
adContext: a0.adContext,
metadataSealed: a0.metadataSealed,
trafficMetadataSealed: a0.trafficMetadataSealed
};
const map2 = new Map(c3780_29);
c3780_29 = map2;
map2.set(a0.placement, r24);
},
QUESTS_FETCH_QUEST_HOME_HERO_FAILURE: function handleFetchQuestHomeHeroFailure({ placement }) {
c3780_42 = false;
const map = new Map(c3780_5);
c3780_5 = map;
map.set(placement, false);
}
});
export default c3780_48;
+34
View File
@@ -0,0 +1,34 @@
// Metro module 5036 (f5037).
import * as _Module5037 from "../../_bundle/Module5037";
import * as _Module5038 from "../../_bundle/Module5038";
import * as _Module5039 from "../../_bundle/Module5039";
const r9 = {
FIRST_LAYOUT: "FIRST_LAYOUT",
SCROLL: "SCROLL",
VISIBILITY_CHANGED: "VISIBILITY_CHANGED"
};
const set = new Set(Object.values(_Module5037.QuestRewardCodePlatforms).filter((item) => typeof item === "number"));
const r32 = {
GENERIC: "generic",
RATE_LIMITED: "rate_limited"
};
const r35 = {
DESKTOP: "desktop",
CONSOLE: "console",
SELECT: "select"
};
const r39 = {
PAUSE_BUTTON: "PAUSE_BUTTON",
LOST_FOCUS: "LOST_FOCUS",
MODAL_CLOSED: "MODAL_CLOSED",
ANOTHER_MODAL_OPENED: "ANOTHER_MODAL_OPENED",
PICTURE_IN_PICTURE: "PICTURE_IN_PICTURE"
};
export { r9 as QuestsVisibleMessagesChangedSource };
export { set as QUEST_REWARD_CODE_PLATFORMS_SET };
export const QuestRewardCodePlatforms = _Module5037.QuestRewardCodePlatforms;
export const QuestContent = _Module5038.QuestContent;
export const AdPlacement = _Module5039.AdPlacement;
export { r32 as QuestConsoleStartErrorLocal };
export { r35 as TaskPlatformScreen };
export { r39 as VideoPauseReason };
+16
View File
@@ -0,0 +1,16 @@
// Metro module 6007 (f6008).
import { create } from "../../_bundle/Module644";
let c3795_0 = create((c15349_0) => ({
utmSourceCurrent: void 0,
utmMediumCurrent: void 0,
utmCampaignCurrent: void 0,
utmContentCurrent: void 0,
setUtmCurrentContext: (a0) => c15349_0({
utmSourceCurrent: a0.utmSourceCurrent,
utmMediumCurrent: a0.utmMediumCurrent,
utmCampaignCurrent: a0.utmCampaignCurrent,
utmContentCurrent: a0.utmContentCurrent
}),
getUtmCurrentContext: () => c3795_0.getState()
}));
export default c3795_0;
@@ -0,0 +1,10 @@
// Metro module 10968 (f10969).
export function createGameSheetHook(a0) {
a0.quest;
a0.sourceQuestContent;
a0.applications;
a0.popoutTargetElementRef;
a0.onGameSheetOpened;
a0.onGameSheetClosed;
return (a0) => a0;
}
@@ -0,0 +1,51 @@
// Metro module 15858 (f15859).
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c11349_2 = new Set();
let autoEnroll = false;
c11349_2 = new Set();
autoEnroll = false;
class UnenrolledActivityQuestStore extends Module589.PersistedStore {
static displayName = "UnenrolledActivityQuestStore";
static persistKey = "UnenrolledActivityQuestStore";
initialize(a0) {
const r7 = Set;
let r10 = a0?.dismissedQuestIds;
if (r10 == null) {
r10 = [];
}
c11349_2 = new r7(r10);
let r14 = a0?.autoEnroll;
if (r14 == null) {
r14 = false;
}
autoEnroll = r14;
}
getState() {
return {
dismissedQuestIds: [...c11349_2],
autoEnroll
};
}
isDismissed(a0) {
return a0 != null && c11349_2.has(a0);
}
getDismissedQuestIds() {
return c11349_2;
}
}
const unenrolledActivityQuestStore = new UnenrolledActivityQuestStore(Dispatcher, {
UNENROLLED_ACTIVITY_QUEST_DISMISS: function handleDismissUnenrolledActivityQuest(a0) {
if (c11349_2.size >= 20) {
c11349_2 = new Set(Array.from(c11349_2).sort(SnowflakeUtils.compare).slice(Math.floor(10)).map((item) => item.toString()));
}
c11349_2.add(a0.questId);
return true;
},
UNENROLLED_ACTIVITY_QUEST_AUTO_ENROLL: function handleSetAutoEnroll(a0) {
autoEnroll = a0.autoEnroll;
return true;
}
});
export default unenrolledActivityQuestStore;
+137
View File
@@ -0,0 +1,137 @@
// Metro module 5987 (f5988).
import _objectWithoutProperties from "../../_bundle/_objectWithoutProperties";
import { createWithEqualityFn } from "../../_bundle/identity_700";
import { persist, createJSONStorage } from "../../_bundle/createJSONStorage";
import { DEFAULT_VIDEO_VOLUME } from "../../_bundle/Module5988";
import { batchUpdates } from "../../_bundle/Module705";
import LocalStorageWrapper from "../zustand/LocalStorageWrapper";
let c3782_5;
const _toPropertyKey = function _toPropertyKey(a0) {
let r2 = a0;
if (typeof a0 === "object") {
r2 = a0;
if (a0) {
const r5 = a0[Symbol.toPrimitive];
if (r5 !== void 0) {
r2 = r5.call(a0, "string");
if (typeof r2 === "object") {
throw new TypeError("@@toPrimitive must return a primitive value.");
}
} else {
r2 = String(a0);
}
}
}
let r19 = r2;
if (typeof r19 !== "symbol") {
r19 = "" + r2;
}
return r19;
};
c3782_5 = {
UNKNOWN: "UNKNOWN",
NOT_STARTED: "NOT_STARTED",
IN_PROGRESS: "IN_PROGRESS",
COMPLETED: "COMPLETED"
};
const r24 = {
NONE: "NONE",
FETCHING: "FETCHING",
SUCCESS: "SUCCESS",
FAILURE: "FAILURE"
};
const r41 = createWithEqualityFn()(persist((c15347_0, c15347_1) => ({
volume: DEFAULT_VIDEO_VOLUME,
muted: false,
transcriptEnabled: false,
captionEnabled: false,
videoProgress: {},
transcript: null,
setVolume: (volume) => {
batchUpdates(() => c15347_0({
volume
}));
},
setMuted: (muted) => {
batchUpdates(() => c15347_0({
muted
}));
},
setVideoProgress: (a0, a1, duration) => {
const timestampSec = a1;
let r7 = c15347_1().videoProgress[a0]?.maxTimestampSec;
if (r7 == null) {
r7 = 0;
}
const maxTimestampSec = Math.max(r7, a1);
batchUpdates(() => {
const videoProgress = {
...c15347_1().videoProgress
};
videoProgress[a0] = {
timestampSec,
duration,
maxTimestampSec
};
return c15347_0({
videoProgress
});
});
},
setTranscriptEnabled: (transcriptEnabled) => {
batchUpdates(() => c15347_0({
transcriptEnabled
}));
},
setCaptionEnabled: (captionEnabled) => {
batchUpdates(() => c15347_0({
captionEnabled
}));
},
getVideoProgress: (a0) => c15347_1().videoProgress[a0],
getVideoProgressState: (a0) => {
const r7 = c15347_1().videoProgress[a0];
return r7 == null ? c3782_5.UNKNOWN : r7.timestampSec === 0 ? c3782_5.NOT_STARTED : r7.timestampSec >= r7.duration ? c3782_5.COMPLETED : c3782_5.IN_PROGRESS;
},
resetQuest: (c25671_0) => {
batchUpdates(() => {
const videoProgress = c15347_1().videoProgress;
videoProgress[c25671_0];
c15347_0({
videoProgress: _objectWithoutProperties(videoProgress, [c25671_0].map(_toPropertyKey))
});
});
},
clearState: () => {
batchUpdates(() => {
c15347_0({
videoProgress: {}
});
});
},
setTranscriptAsset: (transcript) => {
batchUpdates(() => {
c15347_0({
transcript
});
});
}
}), {
name: "videoQuestUIState",
storage: createJSONStorage(() => LocalStorageWrapper),
partialize: (a0) => ({
volume: a0.volume,
muted: a0.muted,
videoProgress: a0.videoProgress
}),
version: 0
}));
export default r41;
export const DEFAULT_VIDEO_PROGRESS = {
timestampSec: 0,
duration: 10,
maxTimestampSec: 0
};
export { c3782_5 as VideoProgressState };
export { r24 as FetchStatus };
export { r41 as useVideoQuestUIStore };
@@ -0,0 +1,56 @@
// Metro module 8445 (f8446).
import { createApexExperiment } from "../../experiments/apex/index";
const r15 = {
STEP_1_LOADED: 0,
0: "STEP_1_LOADED",
STEP_2_CLICKED_INTERNAL: 1,
1: "STEP_2_CLICKED_INTERNAL",
STEP_3_CLICKED_EXTERNAL: 2,
2: "STEP_3_CLICKED_EXTERNAL",
STEP_4_VIEWED_NON_IMPRESSION: 3,
3: "STEP_4_VIEWED_NON_IMPRESSION",
STEP_5_VIEWED_IMPRESSION: 4,
4: "STEP_5_VIEWED_IMPRESSION"
};
const apexExperiment = createApexExperiment({
name: "2026-05-use-ad-analytics-interface",
kind: "user",
defaultConfig: {
enabled: false,
maxStep: -1
},
variations: {
0: {
enabled: false,
maxStep: -1
},
1: {
enabled: true,
maxStep: r15.STEP_1_LOADED
},
2: {
enabled: true,
maxStep: r15.STEP_2_CLICKED_INTERNAL
},
3: {
enabled: true,
maxStep: r15.STEP_3_CLICKED_EXTERNAL
},
4: {
enabled: true,
maxStep: r15.STEP_4_VIEWED_NON_IMPRESSION
},
5: {
enabled: true,
maxStep: r15.STEP_5_VIEWED_IMPRESSION
}
}
});
export { r15 as AdAnalyticsInterfaceExperimentStep };
export { apexExperiment as AdAnalyticsInterfaceExperiment };
export function shouldMigrateToAdAnalyticsInterface(a0, a1) {
const config = apexExperiment.getConfig({
location: a1
});
return config.enabled && a0 <= config.maxStep;
}
@@ -0,0 +1,27 @@
// Metro module 14143 (f14144).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-07-ad-recheck-interval-experiment",
kind: "user",
defaultConfig: {
enableFastAdRecheck: false
},
variations: {
1: {
enableFastAdRecheck: false
},
2: {
enableFastAdRecheck: true
},
3: {
enableFastAdRecheck: true
},
4: {
enableFastAdRecheck: true
},
5: {
enableFastAdRecheck: true
}
}
});
export default apexExperiment;
@@ -0,0 +1,20 @@
// Metro module 14037 (f14038).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-07-bounties-modal-transitions-refactor",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as BountiesModalTransitionsRefactorExperiment };
export function useIsBountiesModalTransitionsRefactorEnabled(a0) {
return apexExperiment.useConfig({
location: a0
}).enabled;
}
@@ -0,0 +1,30 @@
// Metro module 14097 (f14098).
import { createApexExperiment } from "../../experiments/apex/index";
const r14 = {
BASE: 0,
0: "BASE",
POPULARITY: 1,
1: "POPULARITY",
RECENCY: 2,
2: "RECENCY"
};
const apexExperiment = createApexExperiment({
name: "2026-06-bounties-shop-carousel",
kind: "user",
defaultConfig: {
enabled: false,
variation: r14.BASE
},
variations: {
1: {
enabled: true,
variation: r14.POPULARITY
},
2: {
enabled: true,
variation: r14.RECENCY
}
}
});
export { r14 as BountiesShopCarouselExperimentVariation };
export { apexExperiment as BountiesShopCarouselExperiment };
@@ -0,0 +1,97 @@
// Metro module 10883 (f10884).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-05-bounties-stage-1",
kind: "user",
defaultConfig: {
enabled: false,
verticalScrollEnabled: false,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 50
},
variations: {
1: {
enabled: true,
verticalScrollEnabled: false,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 50
},
2: {
enabled: true,
verticalScrollEnabled: false,
loopingEnabled: true,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 50
},
3: {
enabled: true,
verticalScrollEnabled: false,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 30
},
4: {
enabled: true,
verticalScrollEnabled: false,
loopingEnabled: false,
ctaTimerMilliSeconds: 0,
rewardTimerSeconds: 15,
orbAmount: 50
},
5: {
enabled: true,
verticalScrollEnabled: false,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 25,
orbAmount: 50
},
6: {
enabled: true,
verticalScrollEnabled: true,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 50
},
7: {
enabled: true,
verticalScrollEnabled: true,
loopingEnabled: true,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 50
},
8: {
enabled: true,
verticalScrollEnabled: true,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 15,
orbAmount: 30
},
9: {
enabled: true,
verticalScrollEnabled: true,
loopingEnabled: false,
ctaTimerMilliSeconds: 0,
rewardTimerSeconds: 15,
orbAmount: 50
},
10: {
enabled: true,
verticalScrollEnabled: true,
loopingEnabled: false,
ctaTimerMilliSeconds: 3000,
rewardTimerSeconds: 25,
orbAmount: 50
}
}
});
export { apexExperiment as BountiesStage1Experiment };
@@ -0,0 +1,82 @@
// Metro module 10882 (f10883).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-07-bounties-vertical-scroll",
kind: "user",
defaultConfig: {
enabled: false,
verticalScrollEnabled: false,
scrollAffordanceVariant: "none",
autoScrollLeadMs: 3000,
autoScrollEndCardMs: 3000,
peekFraction: 0,
ctaTimerMilliSeconds: 0
},
variations: {
1: {
enabled: true,
verticalScrollEnabled: false,
scrollAffordanceVariant: "none",
autoScrollLeadMs: 3000,
autoScrollEndCardMs: 3000,
peekFraction: 0,
ctaTimerMilliSeconds: 0
},
2: {
enabled: true,
verticalScrollEnabled: true,
scrollAffordanceVariant: "none",
autoScrollLeadMs: 3000,
autoScrollEndCardMs: 3000,
peekFraction: 0,
ctaTimerMilliSeconds: 0
},
3: {
enabled: true,
verticalScrollEnabled: true,
scrollAffordanceVariant: "indicator",
autoScrollLeadMs: 3000,
autoScrollEndCardMs: 3000,
peekFraction: 0,
ctaTimerMilliSeconds: 0
},
4: {
enabled: true,
verticalScrollEnabled: true,
scrollAffordanceVariant: "auto",
autoScrollLeadMs: 3000,
autoScrollEndCardMs: 3000,
peekFraction: 0,
ctaTimerMilliSeconds: 0
},
5: {
enabled: true,
verticalScrollEnabled: true,
scrollAffordanceVariant: "peek",
autoScrollLeadMs: 3000,
autoScrollEndCardMs: 3000,
peekFraction: 0.12,
ctaTimerMilliSeconds: 0
}
}
});
export { apexExperiment as BountiesVerticalScrollExperiment };
export function useIsBountiesVerticalScrollExperimentEnabled(a0) {
return apexExperiment.useConfig({
location: a0
}).verticalScrollEnabled;
}
export function useIsBountiesVerticalScrollExperimentActive(a0) {
return apexExperiment.useConfig({
location: a0
}).enabled;
}
export function shouldUseScrollIndicatorOverlay(a0) {
return a0 === "indicator" || a0 === "peek";
}
export function useIsScrollIndicatorOverlayVariant(a0) {
const scrollAffordanceVariant = apexExperiment.useConfig({
location: a0
}).scrollAffordanceVariant;
return scrollAffordanceVariant === "indicator" || scrollAffordanceVariant === "peek";
}
@@ -0,0 +1,18 @@
// Metro module 9475 (f9476).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-01-less-personalized-ads",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
export { apexExperiment as LessPersonalizedAdsExperiment };
@@ -0,0 +1,30 @@
// Metro module 6000 (f6001).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2025-10-ad-request-behavior-experiment",
kind: "user",
defaultConfig: {
enableNewRequestBehavior: false
},
variations: {
1: {
enableNewRequestBehavior: false
},
2: {
enableNewRequestBehavior: true
},
3: {
enableNewRequestBehavior: false
},
4: {
enableNewRequestBehavior: true
},
5: {
enableNewRequestBehavior: true
},
6: {
enableNewRequestBehavior: true
}
}
});
export default apexExperiment;
@@ -0,0 +1,18 @@
// Metro module 14116 (f14117).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-06-orbs-holdout",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
export { apexExperiment as OrbsHoldoutExperiment };
@@ -0,0 +1,25 @@
// Metro module 16654 (f16655).
import Durations from "../../../utils/Durations";
import { createApexExperiment } from "../../experiments/apex/index";
const defaultConfig = {
questFetchJitterMs: 5 * Durations.Millis.SECOND,
questHomeHeroJitterMs: 5 * Durations.Millis.SECOND
};
const apexExperiment = createApexExperiment({
name: "2026-06-quest-fetch-reconnect-jitter",
kind: "user",
defaultConfig,
variations: {
1: {
questFetchJitterMs: 60 * Durations.Millis.SECOND,
questHomeHeroJitterMs: 60 * Durations.Millis.SECOND
}
}
});
export default apexExperiment;
export { defaultConfig as DEFAULT_QUEST_FETCH_JITTER_CONFIG };
export function getQuestFetchReconnectJitterConfig(a0) {
return apexExperiment.getConfig({
location: a0.location
});
}
@@ -0,0 +1,15 @@
// Metro module 10884 (f10885).
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-03-quest-home-bounties",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
export { apexExperiment as QuestHomeBountiesExperiment };
+330
View File
@@ -0,0 +1,330 @@
// Metro module 10494 (f10495).
import { useState, useEffect } from "react";
import { createApexExperiment } from "../../experiments/apex/index";
import { useQuestOrbMultiplierEligibility } from "../hooks/QuestOrbMultiplierHooks";
import { QuestOrbMultiplierEligibilityType } from "../utils/QuestOrbMultiplierUtils";
import { QuestOrbsMultiplier } from "../../../_bundle/Module10495";
import Durations from "../../../utils/Durations";
const apexExperiment7 = createApexExperiment({
name: "2025-11-video-end-card-v2",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment6 = createApexExperiment({
name: "2026-02-new-video-quest-progress-bar-styling",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
const apexExperiment5 = createApexExperiment({
name: "2026-05-app-store-overlay-feature-gate",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment4 = createApexExperiment({
name: "2026-03-quest-reload-video-on-obscured",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const r16 = {
DEFAULT: 0,
0: "DEFAULT",
AUTO_ENABLE_CAPTIONS: 1,
1: "AUTO_ENABLE_CAPTIONS",
AUTO_UNMUTE: 2,
2: "AUTO_UNMUTE"
};
const apexExperiment3 = createApexExperiment({
name: "2026-03-muted-video-quest-new-defaults",
kind: "user",
defaultConfig: {
enabled: false,
variant: r16.DEFAULT
},
variations: {
0: {
enabled: false,
variant: r16.DEFAULT
},
1: {
enabled: true,
variant: r16.AUTO_ENABLE_CAPTIONS
},
2: {
enabled: true,
variant: r16.AUTO_UNMUTE
}
}
});
const apexExperiment = createApexExperiment({
name: "2026-04-quests-premium-orb-multiplier-marketing",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
const apexExperiment8 = createApexExperiment({
name: "2026-03-video-quest-player-refactor",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment9 = createApexExperiment({
name: "2026-04-composed-quest-player",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
1: {
enabled: true
}
}
});
const apexExperiment10 = createApexExperiment({
name: "2026-03-mobile-quest-home-red-dot-notification",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
const apexExperiment11 = createApexExperiment({
name: "2026-05-quest-home-tile-redesign",
kind: "user",
defaultConfig: {
useNewLayoutWithSearch: false,
useNewTile: false,
useLargeFeaturedTiles: false,
ctaOnHover: false,
clickableTile: false
},
variations: {
0: {
useNewLayoutWithSearch: false,
useNewTile: false,
useLargeFeaturedTiles: false,
ctaOnHover: false,
clickableTile: false
},
1: {
useNewLayoutWithSearch: true,
useNewTile: false,
useLargeFeaturedTiles: false,
ctaOnHover: false,
clickableTile: false
},
2: {
useNewLayoutWithSearch: true,
useNewTile: true,
useLargeFeaturedTiles: true,
ctaOnHover: true,
clickableTile: false
},
3: {
useNewLayoutWithSearch: true,
useNewTile: true,
useLargeFeaturedTiles: false,
ctaOnHover: true,
clickableTile: false
},
4: {
useNewLayoutWithSearch: true,
useNewTile: true,
useLargeFeaturedTiles: true,
ctaOnHover: false,
clickableTile: false
},
5: {
useNewLayoutWithSearch: true,
useNewTile: true,
useLargeFeaturedTiles: true,
ctaOnHover: true,
clickableTile: true
}
}
});
const apexExperiment12 = createApexExperiment({
name: "2026-05-bounty-stale-refresh-quest-home",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
const apexExperiment2 = createApexExperiment({
name: "2026-06-remove-quest-home-hero",
kind: "user",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
let c7040_6 = new Date("2026-08-01T10:00:00-07:00");
let c7040_7 = new Date("2026-08-07T10:00:00-07:00");
let c7040_8 = 5 * Durations.Millis.MINUTE;
const r156 = {
CONTROL: 0,
0: "CONTROL",
NEW_LAYOUT_WITH_SEARCH: 1,
1: "NEW_LAYOUT_WITH_SEARCH",
LARGE_MASK_MARGIN: 2,
2: "LARGE_MASK_MARGIN",
REMOVE_QUEST_TITLE_SUFFIX: 3,
3: "REMOVE_QUEST_TITLE_SUFFIX",
REPLACE_QUEST_NAME_WITH_GAME_PUBLISHER: 4,
4: "REPLACE_QUEST_NAME_WITH_GAME_PUBLISHER"
};
const apexExperiment13 = createApexExperiment({
name: "2026-06-quest-home-layout-visual-tweaks",
kind: "user",
defaultConfig: {
enabled: false,
variant: r156.CONTROL
},
variations: {
0: {
enabled: false,
variant: r156.CONTROL
},
1: {
enabled: true,
variant: r156.NEW_LAYOUT_WITH_SEARCH
},
2: {
enabled: true,
variant: r156.LARGE_MASK_MARGIN
},
3: {
enabled: true,
variant: r156.REMOVE_QUEST_TITLE_SUFFIX
},
4: {
enabled: true,
variant: r156.REPLACE_QUEST_NAME_WITH_GAME_PUBLISHER
}
}
});
const apexExperiment14 = createApexExperiment({
name: "2026-07-quest-bar-secondary-cta",
kind: "user",
defaultConfig: {
enabled: false,
showPlayInstantlyLabel: false
},
variations: {
0: {
enabled: false,
showPlayInstantlyLabel: false
},
1: {
enabled: true,
showPlayInstantlyLabel: false
},
2: {
enabled: true,
showPlayInstantlyLabel: true
}
}
});
export { apexExperiment7 as VideoEndCardV2Experiment };
export { apexExperiment6 as NewVideoQuestProgressBarStylingExperiment };
export { apexExperiment5 as AppStoreBottomSheetOverlayFeatureGate };
export { apexExperiment4 as QuestReloadVideoOnObscuredExperiment };
export { r16 as MutedVideoQuestNewDefaultsVariant };
export { apexExperiment3 as MutedVideoQuestNewDefaultsExperiment };
export function useQuestOrbsMultiplierMarketing(a0) {
const enabled = apexExperiment.useConfig({
location: a0
}).enabled;
const questOrbMultiplierEligibility = useQuestOrbMultiplierEligibility();
return {
shouldShowBonusOrbsUX: questOrbMultiplierEligibility !== QuestOrbMultiplierEligibilityType.INELIGIBLE && questOrbMultiplierEligibility !== QuestOrbMultiplierEligibilityType.CREPE && enabled,
multiplier: QuestOrbsMultiplier.PREMIUM_TIER_2_MULTIPLIER_PERCENTAGE_POINTS / 100
};
}
export { apexExperiment8 as VideoQuestPlayerRefactorExperiment };
export { apexExperiment9 as ComposedQuestPlayerExperiment };
export { apexExperiment10 as MobileQuestHomeRedDotNotificationExperiment };
export { apexExperiment11 as QuestHomeTileRedesignExperiment };
export { apexExperiment12 as BountyStaleRefreshQuestHomeExperiment };
export function useShouldRemoveQuestHomeHero() {
const [state, setState] = useState(() => new Date());
useEffect(() => {
let c26697_0 = setInterval(() => setState(new Date()), c7040_8);
return () => clearInterval(c26697_0);
}, []);
const r18 = state >= c7040_6 && state < c7040_7;
const enabled = apexExperiment2.useConfig({
location: r18 ? "remove-quest-home-hero-eligible" : "remove-quest-home-hero-ineligible"
}).enabled;
return !!r18 && enabled;
}
export { r156 as QuestHomeLayoutVisualTweakVariant };
export { apexExperiment13 as QuestHomeLayoutVisualTweaksExperiment };
export { apexExperiment14 as QuestBarSecondaryCtaExperiment };
@@ -0,0 +1,38 @@
// Metro module 10881 (f10882).
import { BountiesVerticalScrollExperiment } from "./BountiesVerticalScrollExperiment";
import { BountiesStage1Experiment } from "./BountiesStage1Experiment";
import { QuestHomeBountiesExperiment } from "./QuestHomeBountiesExperiment";
export function useBountiesExperience(a0) {
const config = BountiesVerticalScrollExperiment.useConfig({
location: a0
});
const config2 = BountiesStage1Experiment.useConfig({
location: a0
});
const config3 = QuestHomeBountiesExperiment.useConfig({
location: a0
});
const orbAmount = config2.enabled ? config2.orbAmount : 50;
const rewardTimerSeconds = config2.enabled ? config2.rewardTimerSeconds : 15;
return config.enabled ? {
showBounties: true,
ownedByVerticalScrollExperiment: true,
verticalScrollEnabled: config.verticalScrollEnabled,
loopingEnabled: false,
ctaTimerMilliSeconds: config.ctaTimerMilliSeconds,
scrollAffordanceVariant: config.scrollAffordanceVariant,
stage1Enabled: config2.enabled,
orbAmount,
rewardTimerSeconds
} : {
showBounties: config3.enabled,
ownedByVerticalScrollExperiment: false,
verticalScrollEnabled: config2.verticalScrollEnabled,
loopingEnabled: config2.loopingEnabled,
ctaTimerMilliSeconds: config2.ctaTimerMilliSeconds,
scrollAffordanceVariant: "none",
stage1Enabled: config2.enabled,
orbAmount,
rewardTimerSeconds
};
}
+671
View File
@@ -0,0 +1,671 @@
// 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"
};
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,12 @@
// Metro module 9486 (f9487).
import UserStore from "../../../stores/UserStore";
import { useStateFromStores } from "../../../_bundle/Module589";
import { QuestOrbMultiplierEligibilityType, getQuestOrbMultiplierSource, QuestOrbMultiplierSource } from "../utils/QuestOrbMultiplierUtils";
import PremiumUtils from "../../../utils/PremiumUtils";
const getQuestOrbMultiplierEligibilityForUser = function getQuestOrbMultiplierEligibilityForUser(a0) {
return a0 == null ? QuestOrbMultiplierEligibilityType.INELIGIBLE : PremiumUtils.canUseMoreQuestOrbs(a0) ? getQuestOrbMultiplierSource(a0) === QuestOrbMultiplierSource.CREPE ? QuestOrbMultiplierEligibilityType.CREPE : QuestOrbMultiplierEligibilityType.NITRO : (a0 == null ? void 0 : a0.isFractionalPremiumWithNoStandardSub()) ? QuestOrbMultiplierEligibilityType.INELIGIBLE : QuestOrbMultiplierEligibilityType.UPSELL;
};
export function useQuestOrbMultiplierEligibility() {
return useStateFromStores([UserStore], () => getQuestOrbMultiplierEligibilityForUser(UserStore.getCurrentUser()));
}
export { getQuestOrbMultiplierEligibilityForUser };
@@ -0,0 +1,274 @@
// Metro module 10965 (f10966).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useCallback, useEffect } from "react";
import { claimQuestReward, fetchQuestRewardCode } from "../QuestActionCreators";
import { QuestRewardCodePlatforms } from "../QuestTypes";
import { useTrackQuestContentClickedWithImpression } from "../lib/analytics/AnalyticsHooks";
import { useQuestImpressionId } from "../lib/analytics/ContentImpressionTrackerHooks";
import { shouldMigrateToAdAnalyticsInterface, AdAnalyticsInterfaceExperimentStep } from "../experiments/AdAnalyticsInterfaceExperiment";
import { captureAdUserAction } from "../../ads/analytics/captureAdUserAction";
import { AdUserActionType } from "../../ads/analytics/captureAdUserActionTypes";
import { AdCreativeType } from "../../../_bundle/Module6013";
import { QuestContentCTA } from "../lib/analytics/AnalyticsTypes";
function $mk85988($env) {
return () => {
const r7 = $env;
const r2 = r7[1];
if (r2 != null) {
const r3 = $env.$parent;
const r12 = r3[0];
const r1 = r3[2];
if (r12(r1[7]).shouldMigrateToAdAnalyticsInterface(r12(r1[7]).AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_reward_code_redemption_link")) {
const r38 = r12(r1[8]);
const r44 = {
type: r12(r1[9]).AdUserActionType.CLICK_INTERNAL,
adCreativeType: r12(r1[10]).AdCreativeType.QUEST,
adCreativeId: null,
questContentCTA: null,
surfaceId: null,
sourceQuestContent: null,
impressionId: null,
questContentPosition: null
};
const r11 = r7[0];
r44.adCreativeId = r11.id;
r44.questContentCTA = r12(r1[11]).QuestContentCTA.REDEEM_REWARD;
const surfaceId = r7[2];
r44.surfaceId = surfaceId;
const sourceQuestContent3 = r7[4];
r44.sourceQuestContent = sourceQuestContent3;
const impressionId = r7[6];
r44.impressionId = impressionId;
const questContentPosition3 = r7[3];
r44.questContentPosition = questContentPosition3;
r38.captureAdUserAction(r44);
r12(r1[8]).captureAdUserAction({
type: r12(r1[9]).AdUserActionType.CLICK_INTERNAL,
adCreativeType: r12(r1[10]).AdCreativeType.QUEST,
adCreativeId: r11.id,
questContentCTA: r12(r1[11]).QuestContentCTA.VISIT_REDEMPTION_LINK,
surfaceId,
sourceQuestContent: sourceQuestContent3,
impressionId,
questContentPosition: questContentPosition3
});
} else {
const r20 = r7[5];
const r10 = r7[0];
const id = r10.id;
const questContent2 = r7[2];
const r22 = {
questId: id,
questContent: questContent2,
questContentCTA: r12(r1[11]).QuestContentCTA.REDEEM_REWARD,
questContentPosition: null,
sourceQuestContent: null
};
const questContentPosition2 = r7[3];
r22.questContentPosition = questContentPosition2;
const sourceQuestContent2 = r7[4];
r22.sourceQuestContent = sourceQuestContent2;
r20(r22);
r20({
questId: r10.id,
questContent: questContent2,
questContentCTA: r12(r1[11]).QuestContentCTA.VISIT_REDEMPTION_LINK,
questContentPosition: questContentPosition2,
sourceQuestContent: sourceQuestContent2
});
}
(0, r3[1])(r1[12])(r2);
}
};
}
let env7387 = {};
export function useClaimOrFetchRewardCode(a0) {
let env18403 = {
$parent: env7387
};
const isClaimingReward = a0.isClaimingReward;
env18403[0] = isClaimingReward;
const isFetchingRewardCode = a0.isFetchingRewardCode;
env18403[1] = isFetchingRewardCode;
const questContent2 = a0.questContent;
env18403[2] = questContent2;
const quest2 = a0.quest;
env18403[3] = quest2;
const rewardCode = a0.rewardCode;
env18403[4] = rewardCode;
const preview = a0.preview;
env18403[5] = preview;
const r20 = _slicedToArray(useState(false), 2);
const hasError2 = r20[0];
env18403[6] = hasError2;
const setHasError = r20[1];
env18403[7] = setHasError;
const r23 = _slicedToArray(useState(false), 2);
const r16 = r23[0];
env18403[8] = r16;
env18403[9] = r23[1];
let c18404_0 = async (c30315_0, c30315_1, c30315_2) => {
let c30315_6 = 0;
L10: {
try {
c30315_6 = 1;
(0, env18403[9])(true);
await claimQuestReward(c30315_0, c30315_1, c30315_2);
(0, env18403[7])(false);
(0, env18403[9])(false);
c30315_6 = 0;
} catch ($e) {
let r7 = $e;
if (c30315_6 !== 0) {
while (true) {
try {
c30315_6 = 0;
(0, env18403[7])(true);
(0, env18403[9])(false);
break L10;
} catch ($e) {
r7 = $e;
if (c30315_6 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
const callback2 = useCallback(function() {
return c18404_0.apply(this, arguments);
}, []);
env18403[10] = callback2;
const callback3 = useCallback((a0) => {
try {
fetchQuestRewardCode(a0);
} catch ($e) {
(0, env18403[7])(true);
}
}, []);
env18403[11] = callback3;
useEffect(() => {
if (!(env18403[5] === true || env18403[4] != null || env18403[6] || env18403[0] || env18403[8] || env18403[1])) {
(0, env18403[7])(false);
const r13 = env18403[3];
if (r13.userStatus?.claimedAt == null) {
(0, env18403[10])(r13.id, QuestRewardCodePlatforms.CROSS_PLATFORM, env18403[2]);
} else if (r13.userStatus?.claimedAt != null) {
(0, env18403[11])(r13.id);
}
}
}, [callback2, callback3, hasError2, isClaimingReward, r16, isFetchingRewardCode, questContent2, quest2, rewardCode, preview]);
return {
claimCode: callback2,
fetchCode: callback3,
hasError: hasError2,
setHasError
};
}
export function useHandleRedemptionLinkClick(a0) {
let env18402;
const r1 = env18402 = {
$parent: env7387
};
const quest2 = a0.quest;
env18402[0] = quest2;
const redemptionLink2 = a0.redemptionLink;
env18402[1] = redemptionLink2;
const questContent2 = a0.questContent;
env18402[2] = questContent2;
const questContentPosition2 = a0.questContentPosition;
env18402[3] = questContentPosition2;
const sourceQuestContent2 = a0.sourceQuestContent;
env18402[4] = sourceQuestContent2;
env18402[5] = void 0;
env18402[6] = void 0;
const trackQuestContentClickedWithImpression2 = useTrackQuestContentClickedWithImpression();
env18402[5] = trackQuestContentClickedWithImpression2;
const questImpressionId2 = useQuestImpressionId();
env18402[6] = questImpressionId2;
const r22 = [quest2.id, questContent2, questContentPosition2, sourceQuestContent2, trackQuestContentClickedWithImpression2, questImpressionId2, redemptionLink2];
return useCallback($mk85988(r1), r22);
}
export function useClaimRewardCodePrimaryCtaClickHandler(a0) {
const { claimCode, fetchCode, hasError, onDismiss, quest, questContent, questContentCTA = QuestContentCTA.GET_REWARD_CODE } = a0;
let env18406;
const GET_REWARD_CODE = questContentCTA;
const { questContentPosition, redemptionLink, sourceQuestContent } = a0;
const trackQuestContentClickedWithImpression = useTrackQuestContentClickedWithImpression();
const questImpressionId = useQuestImpressionId();
const r35 = env18406 = {
$parent: env7387
};
env18406[0] = void 0;
env18406[1] = void 0;
env18406[2] = void 0;
env18406[3] = void 0;
env18406[4] = void 0;
const quest2 = a0.quest;
env18406[0] = quest2;
const redemptionLink2 = a0.redemptionLink;
env18406[1] = redemptionLink2;
const questContent2 = a0.questContent;
env18406[2] = questContent2;
const questContentPosition2 = a0.questContentPosition;
env18406[3] = questContentPosition2;
const sourceQuestContent2 = a0.sourceQuestContent;
env18406[4] = sourceQuestContent2;
env18406[5] = void 0;
env18406[6] = void 0;
const trackQuestContentClickedWithImpression2 = useTrackQuestContentClickedWithImpression();
env18406[5] = trackQuestContentClickedWithImpression2;
const questImpressionId2 = useQuestImpressionId();
env18406[6] = questImpressionId2;
const r47 = [quest2.id, questContent2, questContentPosition2, sourceQuestContent2, trackQuestContentClickedWithImpression2, questImpressionId2, redemptionLink2];
const callback = useCallback($mk85988(r35), r47);
const r52 = [claimCode, fetchCode, hasError, onDismiss, quest.id, , , , , , , , , ,];
const claimedAt = quest.userStatus?.claimedAt;
const r56 = () => {
if (hasError) {
if (quest.userStatus?.claimedAt != null) {
fetchCode(quest.id);
} else {
claimCode(quest.id, QuestRewardCodePlatforms.CROSS_PLATFORM, questContent);
if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_reward_code_primary_cta")) {
captureAdUserAction({
type: AdUserActionType.CLICK_INTERNAL,
adCreativeType: AdCreativeType.QUEST,
adCreativeId: quest.id,
questContentCTA: GET_REWARD_CODE,
surfaceId: questContent,
sourceQuestContent,
impressionId: questImpressionId,
questContentPosition
});
} else {
trackQuestContentClickedWithImpression({
questId: quest.id,
questContent,
questContentCTA: GET_REWARD_CODE,
questContentPosition,
sourceQuestContent
});
}
}
} else {
if (redemptionLink != null) {
callback();
}
onDismiss();
}
};
r52[5] = claimedAt;
r52[6] = questContent;
r52[7] = GET_REWARD_CODE;
r52[8] = questContentPosition;
r52[9] = trackQuestContentClickedWithImpression;
r52[10] = questImpressionId;
r52[11] = redemptionLink;
r52[12] = sourceQuestContent;
r52[13] = callback;
return useCallback(r56, r52);
}
@@ -0,0 +1,34 @@
// Metro module 15622 (f15623).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import AdContentSeenStore from "../AdContentSeenStore";
import QuestStore from "../QuestStore";
import { QuestsExperimentLocations } from "../QuestConstants";
import Durations from "../../../utils/Durations";
import { MobileQuestHomeRedDotNotificationExperiment } from "../experiments/index";
import { useStateFromStoresArray, useStateFromStores } from "../../../_bundle/Module589";
import { isQuestExpired } from "../utils/QuestDataUtils";
import { AdCreativeType } from "../../../_bundle/Module6013";
import { useSelectedTimeRecurringDismissibleContent } from "../../dismissible_content/hooks/useSelectedDismissibleContent";
import { DismissibleContent } from "../../../_bundle/Module1358";
const DAY = Durations.Millis.DAY;
export default function useHasNewAdContent() {
const enabled = MobileQuestHomeRedDotNotificationExperiment.useConfig({
location: QuestsExperimentLocations.YOU_TAB_PROFILE_HEADER
}).enabled;
const stateFromStoresArray = useStateFromStoresArray([QuestStore], () => enabled ? Array.from(QuestStore.quests.values()).filter((item) => !isQuestExpired(item)).map((item) => item.id) : [], [enabled]);
const r49 = _slicedToArray(useSelectedTimeRecurringDismissibleContent(useStateFromStores([AdContentSeenStore], () => {
for (const item of stateFromStoresArray) {
if (AdContentSeenStore.hasSeen(AdCreativeType.QUEST, item)) {
continue;
}
return true;
}
return false;
}, [stateFromStoresArray]) ? enabled ? DismissibleContent.QUEST_HOME_NEW_QUEST_BADGE : null : null, {
cooldownDurationMs: DAY
}, void 0, true), 2);
return {
showBadge: r49[0] != null,
dismissBadge: r49[1]
};
};
+404
View File
@@ -0,0 +1,404 @@
// Metro module 9479 (f9480).
import { CDN_URL_BASE, QUESTS_CDN_URL_BASE } from "../QuestConstants";
import { MEDIA_PROXY_MAX_TARGET_RESOLUTION } from "../../../Constants";
import Module9480 from "../../../_bundle/Module9480";
import Module9481 from "../../../_bundle/Module9481";
import Module9482 from "../../../_bundle/Module9482";
import Module9483 from "../../../_bundle/Module9483";
import { getQuestPrimaryReward } from "../utils/QuestRewardUtils";
import { QuestRewardTypes } from "../../../_bundle/Module5990";
import Module9491 from "../../../_bundle/Module9491";
import Module9492 from "../../../_bundle/Module9492";
import { FirstPartyQuestTaskTypes } from "../../../_bundle/Module5040";
import URLUtils from "../../../utils/URLUtils";
import getDevicePixelRatio_native from "../../../utils/getDevicePixelRatio.native";
let c6253_6, _excluded, c6253_8, c6253_10, c6253_11, getMimetype, getAssetUrlWithMediaProxyQueryParams, convertVideoToFirstFrameImageWithMediaProxy;
const resolveAsset = function resolveAsset(id, a1, a2) {
let url;
if (a1.startsWith("blob:")) {
let r41 = a1.split("?", 1).at(0);
if (r41 == null) {
r41 = a1;
}
url = r41;
} else {
url = a1.includes("/") ? `${CDN_URL_BASE}${a1}` : `${QUESTS_CDN_URL_BASE}${id}${a2?.theme != null ? `/${a2.theme}` : ""}/${a1}`;
}
const mimetype = getMimetype(a1);
return {
url,
mimetype,
isAnimated: mimetype != null && _excluded.includes(mimetype)
};
};
getMimetype = function getMimetype(a0) {
const r5 = a0.startsWith("blob:");
const r16 = URLUtils.toURLSafe(a0);
const r2 = r16 == null;
if (r5) {
let r40 = r2 ? void 0 : r16.searchParams.get("mimetype");
if (r40 == null) {
r40 = void 0;
}
return r40 != null ? decodeURIComponent(r40) : null;
}
let r18 = void 0;
if (!r2) {
const r19 = r16.searchParams.get("format");
r18 = r19 == null ? void 0 : r19.toLowerCase();
}
if (r18 == null) {
const r23 = c6253_6.exec(a0);
const r24 = r23 == null;
let r25 = void 0;
if (!r24) {
const r26 = r23[1];
r25 = r26 == null ? void 0 : r26.toLowerCase();
}
r18 = r25;
}
switch (r18) {
case "webm":
return "video/webm";
case "mp4":
return "video/mp4";
case "webp":
return "image/webp";
case "jpg":
case "jpeg":
return "image/jpeg";
case "png":
return "image/png";
case "gif":
return "image/gif";
case "svg":
return "image/svg+xml";
case "txt":
return "text/plain";
case "vtt":
return "text/vtt";
case "ts":
return "video/mp2t";
case "m3u8":
return "application/x-mpegURL";
default:
return null;
}
};
getAssetUrlWithMediaProxyQueryParams = function getAssetUrlWithMediaProxyQueryParams(assetUrl, r3 = {}) {
if (assetUrl.startsWith("blob:")) {
return assetUrl;
}
const r20 = URLUtils.toURLSafe(assetUrl);
let r22 = assetUrl;
if (r20 != null) {
if (r3.format != null) {
r20.searchParams.set("format", r3.format);
}
if (r3.width != null) {
r20.searchParams.set("width", `${Math.min(Math.ceil(r3.width), MEDIA_PROXY_MAX_TARGET_RESOLUTION)}`);
}
if (r3.height != null) {
r20.searchParams.set("height", `${Math.min(Math.ceil(r3.height), MEDIA_PROXY_MAX_TARGET_RESOLUTION)}`);
}
r22 = r20.toString();
}
return r22;
};
convertVideoToFirstFrameImageWithMediaProxy = function convertVideoToFirstFrameImageWithMediaProxy(assetUrl, a1) {
if (assetUrl.startsWith("blob:")) {
return assetUrl;
}
const r5 = URLUtils.toURLSafe(assetUrl);
const r1 = r5 == null;
let r22 = null;
if (!r1) {
r5.searchParams.set("format", "webp");
if (a1 != null) {
r5.searchParams.set("width", `${Math.min(Math.ceil(a1.width), MEDIA_PROXY_MAX_TARGET_RESOLUTION)}`);
r5.searchParams.set("height", `${Math.min(Math.ceil(a1.height), MEDIA_PROXY_MAX_TARGET_RESOLUTION)}`);
}
r22 = r5.toString();
}
return r22;
};
c6253_6 = /\.([a-zA-Z0-9]+)$/;
_excluded = ["video/mp4", "video/webm"];
c6253_8 = {
HERO: "hero",
HERO_IMAGE: "hero_image",
HERO_VIDEO: "hero_video",
QUEST_BAR_HERO: "quest_bar_hero",
QUEST_BAR_HERO_VIDEO: "quest_bar_hero_video",
QUEST_BAR_HERO_IMAGE: "quest_bar_hero_image",
REWARD: "reward",
REWARD_IMAGE: "reward_image",
GAME_TILE: "game_tile",
LOGO_TYPE: "logo_type",
COSPONSOR_LOGO_TYPE: "cosponsor_logo_type",
VIDEO_PLAYER_VIDEO: "video_player_video",
VIDEO_PLAYER_VIDEO_LOW_RES: "video_player_video_low_res",
VIDEO_PLAYER_VIDEO_HLS: "video_player_video_hls",
VIDEO_PLAYER_THUMBNAIL: "video_player_thumbnail",
VIDEO_PLAYER_CAPTION: "video_player_caption",
VIDEO_PLAYER_TRANSCRIPT: "video_player_transcript"
};
const r19 = {
VIDEO: "video",
VIDEO_LOW_RES: "videoLowRes",
VIDEO_HLS: "videoHls"
};
const r18 = {
VIDEO: "url",
THUMBNAIL: "thumbnail",
CAPTION: "caption",
TRANSCRIPT: "transcript"
};
const r57 = {
TIER_1: 1,
1: "TIER_1",
TIER_2: 2,
2: "TIER_2",
TIER_3: 3,
3: "TIER_3",
TIER_4: 4,
4: "TIER_4"
};
const r64 = {};
r64[c6253_8.VIDEO_PLAYER_VIDEO] = {
variant: r19.VIDEO,
property: r18.VIDEO
};
r64[c6253_8.VIDEO_PLAYER_VIDEO_LOW_RES] = {
variant: r19.VIDEO_LOW_RES,
property: r18.VIDEO
};
r64[c6253_8.VIDEO_PLAYER_VIDEO_HLS] = {
variant: r19.VIDEO_HLS,
property: r18.VIDEO
};
r64[c6253_8.VIDEO_PLAYER_THUMBNAIL] = {
variant: r19.VIDEO,
property: r18.THUMBNAIL
};
r64[c6253_8.VIDEO_PLAYER_CAPTION] = {
variant: r19.VIDEO,
property: r18.CAPTION
};
r64[c6253_8.VIDEO_PLAYER_TRANSCRIPT] = {
variant: r19.VIDEO,
property: r18.TRANSCRIPT
};
c6253_10 = r64;
const r86 = {};
r86[r57.TIER_1] = Module9480;
r86[r57.TIER_2] = Module9481;
r86[r57.TIER_3] = Module9482;
r86[r57.TIER_4] = Module9483;
c6253_11 = r86;
export { c6253_6 as EXTENSION_RE };
export { _excluded as ANIMATED_MIMETYPES };
export { c6253_8 as QuestAssetType };
export { resolveAsset };
export { r57 as OrbsValueTier };
export function getQuestAsset(a0, a1, a2, a3, a4) {
let r0, r1, hero;
L72: {
if (c6253_8.HERO === a1) {
a0.config.assets.heroVideo;
hero = a0.config.assets.hero;
r0 = false;
r1 = false;
} else if (c6253_8.HERO_IMAGE === a1) {
hero = a0.config.assets.hero;
r0 = false;
r1 = false;
} else if (c6253_8.HERO_VIDEO === a1) {
const heroVideo = a0.config.assets.heroVideo;
const r158 = heroVideo == null;
r0 = false;
r1 = false;
hero = heroVideo;
if (r158) {
return null;
}
} else if (c6253_8.QUEST_BAR_HERO === a1) {
a0.config.assets.questBarHeroVideo;
hero = a0.config.assets.questBarHero;
r0 = false;
r1 = false;
} else if (c6253_8.QUEST_BAR_HERO_VIDEO === a1) {
const questBarHeroVideo = a0.config.assets.questBarHeroVideo;
const r148 = questBarHeroVideo == null;
r0 = false;
r1 = false;
hero = questBarHeroVideo;
if (r148) {
return null;
}
} else if (c6253_8.QUEST_BAR_HERO_IMAGE === a1) {
hero = a0.config.assets.questBarHero;
r0 = false;
r1 = false;
} else if (c6253_8.REWARD === a1) {
const questPrimaryReward2 = getQuestPrimaryReward(a0);
if (questPrimaryReward2.type === QuestRewardTypes.VIRTUAL_CURRENCY) {
const url = a4 != null ? c6253_11[a4] : void 0;
return url != null ? {
url,
mimetype: "video/webm",
isAnimated: true
} : a3 ? {
url: Module9491,
mimetype: "video/mp4",
isAnimated: true
} : {
url: Module9492,
mimetype: "video/webm",
isAnimated: true
};
}
questPrimaryReward2.assetVideo;
hero = questPrimaryReward2.asset;
r0 = false;
r1 = false;
} else if (c6253_8.REWARD_IMAGE === a1) {
const questPrimaryReward = getQuestPrimaryReward(a0);
if (questPrimaryReward.type === QuestRewardTypes.VIRTUAL_CURRENCY) {
return null;
}
hero = questPrimaryReward.asset;
r0 = false;
r1 = false;
} else if (c6253_8.GAME_TILE === a1) {
if (a2 === "dark" && a0.config.assets.gameTileDark != null) {
hero = a0.config.assets.gameTileDark;
r0 = false;
r1 = false;
break L72;
}
if (a2 === "light" && a0.config.assets.gameTileLight != null) {
hero = a0.config.assets.gameTileLight;
r0 = false;
r1 = false;
break L72;
}
hero = a0.config.assets.gameTile;
r0 = false;
r1 = true;
} else if (c6253_8.LOGO_TYPE === a1) {
if (a2 === "dark" && a0.config.assets.logotypeDark != null) {
hero = a0.config.assets.logotypeDark;
r0 = false;
r1 = false;
break L72;
}
if (a2 === "light" && a0.config.assets.logotypeLight != null) {
hero = a0.config.assets.logotypeLight;
r0 = false;
r1 = false;
break L72;
}
hero = a0.config.assets.logotype;
r0 = false;
r1 = true;
} else if (c6253_8.COSPONSOR_LOGO_TYPE === a1) {
if (a0.config.cosponsorMetadata == null) {
return null;
}
if (a2 === "dark" && a0.config.cosponsorMetadata.logotypeDark != null) {
hero = a0.config.cosponsorMetadata.logotypeDark;
r0 = false;
r1 = false;
break L72;
}
if (a2 === "light" && a0.config.cosponsorMetadata.logotypeLight != null) {
hero = a0.config.cosponsorMetadata.logotypeLight;
r0 = false;
r1 = false;
break L72;
}
hero = a0.config.cosponsorMetadata.logotype;
r0 = false;
r1 = true;
} else {
if (c6253_8.VIDEO_PLAYER_VIDEO !== a1 && c6253_8.VIDEO_PLAYER_VIDEO_LOW_RES !== a1 && c6253_8.VIDEO_PLAYER_VIDEO_HLS !== a1 && c6253_8.VIDEO_PLAYER_THUMBNAIL !== a1 && c6253_8.VIDEO_PLAYER_CAPTION !== a1) {
const VIDEO_PLAYER_TRANSCRIPT = c6253_8.VIDEO_PLAYER_TRANSCRIPT;
r0 = false;
r1 = false;
hero = void 0;
if (VIDEO_PLAYER_TRANSCRIPT !== a1) {
break L72;
}
}
if (!("taskConfigV2" in a0.config)) {
return null;
}
const r43 = a0.config.taskConfigV2.tasks[a3 ? FirstPartyQuestTaskTypes.WATCH_VIDEO_ON_MOBILE : FirstPartyQuestTaskTypes.WATCH_VIDEO];
const r45 = c6253_10[a1];
const r3 = r43 == null;
let r47 = void 0;
if (!r3) {
const r50 = r43.assets[r45.variant];
r47 = r50 == null ? void 0 : r50[r45.property];
}
const r53 = r47 == null;
r0 = true;
r1 = false;
hero = r47;
if (r53) {
return null;
}
}
}
const r171 = resolveAsset(a0.id, hero, {
theme: r1 ? a2 : void 0
});
return r0 ? r171.mimetype != null ? r171 : null : r171;
}
export function buildUrl(a0, a1, a2) {
if (a1.startsWith("blob:")) {
let r41 = a1.split("?", 1).at(0);
if (r41 == null) {
r41 = a1;
}
return r41;
}
return a1.includes("/") ? `${CDN_URL_BASE}${a1}` : `${QUESTS_CDN_URL_BASE}${a0}${a2?.theme != null ? `/${a2.theme}` : ""}/${a1}`;
}
export function resolveOptionalAdCreativeCdnUrl(a0) {
if (a0 != null) {
return a0.startsWith("http://") ? a0 : a0.startsWith("https://") ? a0 : a0.startsWith("blob:") ? a0 : `${CDN_URL_BASE}${a0}`;
}
}
export function resolveAdCreativeCdnUrl(a0) {
return a0.startsWith("http://") ? a0 : a0.startsWith("https://") ? a0 : a0.startsWith("blob:") ? a0 : `${CDN_URL_BASE}${a0}`;
}
export { getMimetype };
export function getDevicePixelScaledDimensions(a0, a1) {
const devicePixelRatio_native = getDevicePixelRatio_native();
return devicePixelRatio_native < 3 ? {
width: a0,
height: a1
} : {
width: a0 * devicePixelRatio_native,
height: a1 * devicePixelRatio_native
};
}
export { getAssetUrlWithMediaProxyQueryParams };
export function getScaledImageUrl({ assetUrl, width, height }) {
const devicePixelRatio_native = getDevicePixelRatio_native();
return getAssetUrlWithMediaProxyQueryParams(assetUrl, {
width: width * devicePixelRatio_native,
height: height * devicePixelRatio_native,
format: "webp"
});
}
export { convertVideoToFirstFrameImageWithMediaProxy };
export function getScaledFirstFrameImageUrl({ assetUrl, width, height }) {
const devicePixelRatio_native = getDevicePixelRatio_native();
return convertVideoToFirstFrameImageWithMediaProxy(assetUrl, {
width: width * devicePixelRatio_native,
height: height * devicePixelRatio_native
});
}
@@ -0,0 +1,31 @@
// Metro module 9488 (f9489).
import { getFractionalPremiumUnitsHoursFromSkuIds } from "../../../utils/PremiumUtils";
import { intl, t } from "../../../intl/index.native";
import { QuestRewardTypes } from "../../../_bundle/Module5990";
import { unitsAsStrings, diffAsUnits } from "../../../utils/DateUtils";
import Durations from "../../../utils/Durations";
let $mk82598 = function() {
return (a0) => a0.type === QuestRewardTypes.FRACTIONAL_PREMIUM;
};
export function getDurationStringOfFractionalPremium(a0) {
const fractionalPremiumUnitsHoursFromSkuIds = getFractionalPremiumUnitsHoursFromSkuIds(a0.map((item) => item.skuId));
return fractionalPremiumUnitsHoursFromSkuIds % 24 === 0 ? intl.formatToPlainString(t.Cz1G97, {
days: fractionalPremiumUnitsHoursFromSkuIds / 24
}) : intl.formatToPlainString(t.J9Lu4h, {
hours: fractionalPremiumUnitsHoursFromSkuIds
});
}
export function getFractionalPremiumQuestRewards(a0) {
return a0.rewardsConfig.rewards.filter($mk82598());
}
export function getFractionalPremiumQuestRewardName(a0) {
const fractionalPremiumUnitsHoursFromSkuIds = getFractionalPremiumUnitsHoursFromSkuIds(a0.rewardsConfig.rewards.filter($mk82598()).flatMap((item) => Array(item.quantity).fill(item.skuId)));
const r9 = {
days: t.fYmirx,
hours: t["C3RO+g"],
minutes: t.r77oHc
};
return intl.formatToPlainString(t["4SqnVD"], {
time: unitsAsStrings(diffAsUnits(0, fractionalPremiumUnitsHoursFromSkuIds * Durations.Millis.HOUR), r9)
});
}
+5
View File
@@ -0,0 +1,5 @@
// Metro module 10493 (f10494).
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
export function getIsEligibleForQuests() {
return !isMetaQuest();
}
@@ -0,0 +1,497 @@
// Metro module 6002 (f6003).
import DevToolsSettingsStore from "../../../devtools/DevToolsSettingsStore";
import DeveloperOptionsStore from "../../../../stores/DeveloperOptionsStore";
import QuestStore from "../../QuestStore";
import { AnalyticEvents } from "../../../../Constants";
import { getActiveSessionUnsafe } from "../../../analytics_sessions/SessionHeartbeatScheduler";
import { getOrRefreshAdSession } from "../../../analytics_sessions/SessionAdGenerator";
import { getAdDecisionData, isBillableQuestContent, getAdMetadataSealed, getAdTrafficMetadataSealed } from "../../utils/QuestDataUtils";
import { getQuestType } from "../../utils/QuestUtils";
import { getAllApplicationIds } from "../../utils/QuestTaskUtils";
import { getQuestStatus, getQuestContentName, getContentProperties } from "./AnalyticsTypes";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import AppAnalyticsUtils from "../../../app_analytics/AppAnalyticsUtils";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { getAdUser } from "../../../ads/utils/AdDataUtils.android";
import getDeviceMetadata_native from "../../../device/getDeviceMetadata.native";
import { isIOS, isAndroid } from "../../../../utils/PlatformUtils";
import { v4 } from "../../../../_bundle/Module514";
import { getCurrentQuestHomeSearchSession } from "./QuestHomeSearchSession";
import { QuestContent } from "../../QuestTypes";
import { HermesBuiltin } from "../../../../_hermes/prelude";
let c3790_8, trackAdContentEvent, getCommonClickEventProperties;
const trackQuestEvent = function trackQuestEvent(a0) {
const { questId, event, properties: properties2 } = a0;
let trackGuildAndChannelMetadata = a0.trackGuildAndChannelMetadata;
let shouldExtendSession = a0.shouldExtendSession;
if (shouldExtendSession === void 0) {
shouldExtendSession = false;
}
L21: {
const sourceQuestContent = a0.sourceQuestContent;
const r24 = QuestStore.quests.get(questId);
if (r24 != null) {
const r10 = {
quest_id: r24.id,
quest_type: getQuestType(r24.config),
application_ids: null,
quest_status: null
};
let application_ids = getAllApplicationIds(r24);
if (application_ids == null) {
application_ids = [];
}
r10.application_ids = application_ids;
r10.quest_status = getQuestStatus(r24);
const id = r24.id;
const QUEST = AdCreativeType.QUEST;
let uuid2 = getOrRefreshAdSession(shouldExtendSession).uuid;
const adDecisionData = getAdDecisionData(id, sourceQuestContent);
const r51 = {
client_ad_session_id: uuid2,
billing_session_id: null,
ad_content_id: null
};
if (!isBillableQuestContent(sourceQuestContent)) {
let r58 = getActiveSessionUnsafe()?.uuid;
if (r58 == null) {
r58 = null;
}
uuid2 = r58;
}
r51.billing_session_id = uuid2;
r51.ad_content_id = id;
HermesBuiltin.copyDataProperties(r51, adDecisionData);
let creative_type = adDecisionData.creative_type;
if (creative_type == null) {
creative_type = QUEST;
}
const r61 = {};
r51.creative_type = creative_type;
HermesBuiltin.copyDataProperties(r10, r51);
HermesBuiltin.copyDataProperties(r61, r10);
HermesBuiltin.copyDataProperties(r61, properties2);
const preview = r24.preview;
if (trackGuildAndChannelMetadata === void 0) {
trackGuildAndChannelMetadata = false;
}
if (DevToolsSettingsStore.displayTools && DevToolsSettingsStore.lastOpenTabId === "quest_preview") {
break L21;
}
DeveloperOptionsStore.isLoggingAnalyticsEvents;
if (!preview) {
const flush = c3790_8.has(event);
if (trackGuildAndChannelMetadata) {
AppAnalyticsUtils.trackWithMetadata(event, r61, flush);
} else {
AnalyticsUtils.track(event, r61, {
flush
});
}
}
}
}
};
trackAdContentEvent = function trackAdContentEvent(a0) {
const { adContentId, relatedQuestId, adCreativeType, event, properties: properties2 } = a0;
let trackGuildAndChannelMetadata = a0.trackGuildAndChannelMetadata;
const { shouldExtendSession = false, sourceQuestContent } = a0;
const r13 = relatedQuestId != null ? QuestStore.getQuest(relatedQuestId) : null;
let uuid2 = getOrRefreshAdSession(shouldExtendSession).uuid;
const adDecisionData = getAdDecisionData(adContentId, sourceQuestContent);
const r32 = {
client_ad_session_id: uuid2,
billing_session_id: null,
ad_content_id: null
};
if (!isBillableQuestContent(sourceQuestContent)) {
let r40 = getActiveSessionUnsafe()?.uuid;
if (r40 == null) {
r40 = null;
}
uuid2 = r40;
}
r32.billing_session_id = uuid2;
r32.ad_content_id = adContentId;
HermesBuiltin.copyDataProperties(r32, adDecisionData);
let creative_type = adDecisionData.creative_type;
if (creative_type == null) {
creative_type = adCreativeType;
}
const r43 = {};
r32.creative_type = creative_type;
HermesBuiltin.copyDataProperties(r43, r32);
let metadata_sealed = getAdMetadataSealed(sourceQuestContent, adContentId);
if (metadata_sealed == null) {
metadata_sealed = null;
}
r43.metadata_sealed = metadata_sealed;
let traffic_metadata_sealed2 = getAdTrafficMetadataSealed(sourceQuestContent, void 0, adContentId);
if (traffic_metadata_sealed2 == null) {
traffic_metadata_sealed2 = null;
}
r43.traffic_metadata_sealed = traffic_metadata_sealed2;
const r55 = relatedQuestId != null ? {
quest_id: relatedQuestId,
quest_status: r13 != null ? getQuestStatus(r13) : null
} : {};
const r62 = {};
HermesBuiltin.copyDataProperties(r43, r55);
HermesBuiltin.copyDataProperties(r62, r43);
HermesBuiltin.copyDataProperties(r62, properties2);
if (trackGuildAndChannelMetadata === void 0) {
trackGuildAndChannelMetadata = false;
}
if (!(DevToolsSettingsStore.displayTools && DevToolsSettingsStore.lastOpenTabId === "quest_preview")) {
DeveloperOptionsStore.isLoggingAnalyticsEvents;
const flush = c3790_8.has(event);
if (trackGuildAndChannelMetadata) {
AppAnalyticsUtils.trackWithMetadata(event, r62, flush);
} else {
AnalyticsUtils.track(event, r62, {
flush
});
}
}
};
getCommonClickEventProperties = async function getCommonClickEventProperties(c25673_0) {
let c25673_3;
c25673_3 = void 0;
let c29647_0 = c25673_0.questContent;
let c29647_1 = c25673_0.questContentPosition;
let c29647_2 = c25673_0.questContentRowIndex;
let c29647_3 = c25673_0.questContentCTA;
let c29647_4 = c25673_0.impressionId;
let c29647_5 = c25673_0.clickId;
await void 0;
let c29647_6 = await getAdUser(getQuestContentName(c29647_0));
const r80 = {
...getContentProperties(c29647_0, c29647_1, c29647_2),
...getDeviceMetadata_native(),
cta_name: c29647_3,
impression_id: c29647_4,
apple_advertising_id: c29647_6 != null ? isIOS() ? c29647_6.advertisingId : null : null,
android_advertising_id: c29647_6 != null ? isAndroid() ? c29647_6.advertisingId : null : null
};
let click_id = c29647_5;
if (c29647_5 == null) {
click_id = v4();
}
r80.click_id = click_id;
return r80;
};
c3790_8 = new Set([AnalyticEvents.QUEST_CONTENT_VIEWED, AnalyticEvents.QUEST_CONTENT_CLICKED]);
export { trackQuestEvent };
export function trackAppStoreOverlayEvent(a0, a1, a2, a3, a4) {
const r9 = {
content_name: getQuestContentName(a1.content),
cta_name: a1.ctaContent,
impression_id: a1.impressionId,
source_content_name: getQuestContentName(a1.sourceQuestContent),
app_id: a2,
content_position: a1.position
};
trackQuestEvent({
questId: a0.id,
event: a3,
properties: (a3 === AnalyticEvents.QUEST_APP_STORE_OVERLAY_CLOSED || a3 === AnalyticEvents.QUEST_APP_STORE_OVERLAY_RETURNED) && a4 !== void 0 ? {
...r9,
time_spent_ms: a4
} : r9,
sourceQuestContent: a1.sourceQuestContent
});
}
export function trackAdContentAppStoreOverlayEvent({ adContentId, adCreativeType }, a1, a2, a3, a4) {
const r8 = {
content_name: getQuestContentName(a1.content),
cta_name: a1.ctaContent,
impression_id: a1.impressionId,
source_content_name: getQuestContentName(a1.sourceQuestContent),
app_id: a2,
content_position: a1.position
};
trackAdContentEvent({
adContentId,
adCreativeType,
event: a3,
properties: a3 !== AnalyticEvents.QUEST_APP_STORE_OVERLAY_CLOSED ? a3 === AnalyticEvents.QUEST_APP_STORE_OVERLAY_RETURNED ? a4 !== void 0 ? {
...r8,
time_spent_ms: a4
} : r8 : r8 : a4 !== void 0 ? {
...r8,
time_spent_ms: a4
} : r8,
sourceQuestContent: a1.sourceQuestContent
});
}
export { trackAdContentEvent };
export { getCommonClickEventProperties };
export async function trackQuestContentClicked(c25674_0) {
let c25674_6;
c25674_6 = void 0;
let c29648_0 = c25674_0.questId;
let c29648_1 = c25674_0.questContent;
let c29648_2 = c25674_0.questContentCTA;
let c29648_3 = c25674_0.questContentPosition;
let c29648_4 = c25674_0.questContentRowIndex;
let c29648_5 = c25674_0.impressionId;
let c29648_6 = c25674_0.clickId;
let c29648_7 = c25674_0.trackGuildAndChannelMetadata;
let c29648_8 = c25674_0.sourceQuestContent;
await void 0;
let c29648_9 = getAdTrafficMetadataSealed(c29648_8, c29648_0);
let c25674_8 = trackQuestEvent;
const r60 = {};
let c25674_5 = r60;
r60.questId = c29648_0;
r60.event = AnalyticEvents.QUEST_CONTENT_CLICKED;
const properties = {};
HermesBuiltin.copyDataProperties(properties, await (0, getCommonClickEventProperties)({
questContent: c29648_1,
questContentPosition: c29648_3,
questContentRowIndex: c29648_4,
questContentCTA: c29648_2,
impressionId: c29648_5,
clickId: c29648_6
}));
let adMetadataSealed = getAdMetadataSealed(c29648_8);
if (adMetadataSealed == null) {
adMetadataSealed = null;
}
properties.metadata_sealed = adMetadataSealed;
let traffic_metadata_sealed = c29648_9;
if (c29648_9 == null) {
traffic_metadata_sealed = null;
}
properties.traffic_metadata_sealed = traffic_metadata_sealed;
const uuid2 = getCurrentQuestHomeSearchSession()?.uuid;
let uuid = uuid2;
if (uuid2 == null) {
uuid = null;
}
properties.search_session_id = uuid;
c25674_5.properties = properties;
c25674_5.trackGuildAndChannelMetadata = c29648_7;
c25674_5.shouldExtendSession = isBillableQuestContent(c29648_1);
c25674_5.sourceQuestContent = c29648_8;
c25674_8(c25674_5);
}
export async function trackAdContentClicked(c25675_0) {
let c25675_3;
c25675_3 = void 0;
let c29649_0 = c25675_0.adContentId;
let c29649_1 = c25675_0.relatedQuestId;
let c29649_2 = c25675_0.adCreativeType;
let c29649_3 = c25675_0.questContent;
let c29649_4 = c25675_0.questContentCTA;
let c29649_5 = c25675_0.questContentPosition;
let c29649_6 = c25675_0.questContentRowIndex;
let c29649_7 = c25675_0.impressionId;
let c29649_8 = c25675_0.trackGuildAndChannelMetadata;
let c29649_9 = c25675_0.sourceQuestContent;
await void 0;
let c25675_2 = trackAdContentEvent;
const r12 = {};
let c25675_1 = r12;
r12.adContentId = c29649_0;
r12.relatedQuestId = c29649_1;
r12.adCreativeType = c29649_2;
r12.event = AnalyticEvents.QUEST_CONTENT_CLICKED;
const properties2 = await (0, getCommonClickEventProperties)({
questContent: c29649_3,
questContentPosition: c29649_5,
questContentRowIndex: c29649_6,
questContentCTA: c29649_4,
impressionId: c29649_7
});
c25675_1.properties = properties2;
c25675_1.trackGuildAndChannelMetadata = c29649_8;
c25675_1.shouldExtendSession = isBillableQuestContent(c29649_3);
c25675_1.sourceQuestContent = c29649_9;
c25675_2(c25675_1);
}
export function trackBountyCarouselScroll({ scrollingType, scrollingDirection, carouselPosition, questContent }) {
let uuid2 = getOrRefreshAdSession().uuid;
const BOUNTY_CAROUSEL_SCROLL = AnalyticEvents.BOUNTY_CAROUSEL_SCROLL;
const r24 = {
client_ad_session_id: uuid2,
billing_session_id: null,
scrolling_type: null,
scrolling_direction: null,
carousel_position: null,
content_name: null
};
if (!isBillableQuestContent(questContent)) {
let r31 = getActiveSessionUnsafe()?.uuid;
if (r31 == null) {
r31 = null;
}
uuid2 = r31;
}
r24.billing_session_id = uuid2;
r24.scrolling_type = scrollingType;
r24.scrolling_direction = scrollingDirection;
r24.carousel_position = carouselPosition;
r24.content_name = getQuestContentName(questContent);
AnalyticsUtils.track(BOUNTY_CAROUSEL_SCROLL, r24);
}
export function trackQuestHomeOrbShopCarouselViewed(a0) {
AnalyticsUtils.track(AnalyticEvents.QUEST_HOME_ORB_SHOP_CAROUSEL_VIEWED, {
obtainable_orb_rewards: a0.obtainableOrbRewards,
carousel_size: a0.carouselSize,
is_placeholder_carousel: a0.isPlaceholderCarousel
});
}
export function trackQuestHomeOrbShopCarouselScroll(a0) {
AnalyticsUtils.track(AnalyticEvents.QUEST_HOME_ORB_SHOP_CAROUSEL_SCROLL, {
scrolling_direction: a0.scrollingDirection,
carousel_position: a0.carouselPosition,
carousel_size: a0.carouselSize
});
}
export function trackBountyCarouselEmptyStateViewed(a0) {
let uuid2 = getOrRefreshAdSession().uuid;
const BOUNTY_CAROUSEL_EMPTY_STATE_VIEWED = AnalyticEvents.BOUNTY_CAROUSEL_EMPTY_STATE_VIEWED;
const r20 = {
client_ad_session_id: uuid2,
billing_session_id: null,
reason: null
};
if (!isBillableQuestContent(QuestContent.QUEST_HOME_MOBILE_CAROUSEL)) {
let r30 = getActiveSessionUnsafe()?.uuid;
if (r30 == null) {
r30 = null;
}
uuid2 = r30;
}
r20.billing_session_id = uuid2;
r20.reason = a0;
AnalyticsUtils.track(BOUNTY_CAROUSEL_EMPTY_STATE_VIEWED, r20);
}
export function trackBountyVerticalScroll({ scrollingType, scrollingDirection, verticalScrollingPosition, scrollSessionId, timeWatchedPreScrollMs }) {
const uuid2 = getOrRefreshAdSession().uuid;
const BOUNTY_VERTICAL_SCROLL = AnalyticEvents.BOUNTY_VERTICAL_SCROLL;
let billing_session_id = getActiveSessionUnsafe()?.uuid;
if (billing_session_id == null) {
billing_session_id = null;
}
AnalyticsUtils.track(BOUNTY_VERTICAL_SCROLL, {
client_ad_session_id: uuid2,
billing_session_id,
scrolling_type: scrollingType,
scrolling_direction: scrollingDirection,
vertical_scrolling_position: verticalScrollingPosition,
scroll_session_id: scrollSessionId,
time_watched_pre_scroll_ms: timeWatchedPreScrollMs
});
}
export function trackBountyAutoScrollDismissed({ verticalScrollingPosition, scrollSessionId }) {
const uuid2 = getOrRefreshAdSession().uuid;
const BOUNTY_AUTO_SCROLL_DISMISSED = AnalyticEvents.BOUNTY_AUTO_SCROLL_DISMISSED;
let billing_session_id = getActiveSessionUnsafe()?.uuid;
if (billing_session_id == null) {
billing_session_id = null;
}
AnalyticsUtils.track(BOUNTY_AUTO_SCROLL_DISMISSED, {
client_ad_session_id: uuid2,
billing_session_id,
vertical_scrolling_position: verticalScrollingPosition,
scroll_session_id: scrollSessionId
});
}
export function trackQuestHomeCarouselScroll({ scrollingType, scrollingDirection, scrollWindowStartIndex, scrollWindowEndIndex, scrollWindowSize, questContent, carouselSize }) {
let uuid2 = getOrRefreshAdSession().uuid;
const QUEST_HOME_CAROUSEL_SCROLL = AnalyticEvents.QUEST_HOME_CAROUSEL_SCROLL;
const r26 = {
scrolling_type: scrollingType,
client_ad_session_id: uuid2,
billing_session_id: null,
scrolling_direction: null,
scroll_window_start_index: null,
scroll_window_end_index: null,
scroll_window_size: null,
content_name: null,
content_id: null,
carousel_size: null
};
if (!isBillableQuestContent(questContent)) {
let r34 = getActiveSessionUnsafe()?.uuid;
if (r34 == null) {
r34 = null;
}
uuid2 = r34;
}
r26.billing_session_id = uuid2;
r26.scrolling_direction = scrollingDirection;
r26.scroll_window_start_index = scrollWindowStartIndex;
r26.scroll_window_end_index = scrollWindowEndIndex;
r26.scroll_window_size = scrollWindowSize;
r26.content_name = getQuestContentName(questContent);
r26.content_id = questContent;
r26.carousel_size = carouselSize;
AnalyticsUtils.track(QUEST_HOME_CAROUSEL_SCROLL, r26);
}
export function trackQuestHomeSearchEntered({ searchSessionId }) {
const uuid2 = getOrRefreshAdSession().uuid;
const QUEST_HOME_SEARCH_ENTERED = AnalyticEvents.QUEST_HOME_SEARCH_ENTERED;
let billing_session_id = getActiveSessionUnsafe()?.uuid;
if (billing_session_id == null) {
billing_session_id = null;
}
AnalyticsUtils.track(QUEST_HOME_SEARCH_ENTERED, {
client_ad_session_id: uuid2,
billing_session_id,
search_session_id: searchSessionId
});
}
export function trackQuestHomeSearchClosed({ searchSessionId, searchSessionDurationMs }) {
const uuid2 = getOrRefreshAdSession().uuid;
const QUEST_HOME_SEARCH_CLOSED = AnalyticEvents.QUEST_HOME_SEARCH_CLOSED;
let billing_session_id = getActiveSessionUnsafe()?.uuid;
if (billing_session_id == null) {
billing_session_id = null;
}
AnalyticsUtils.track(QUEST_HOME_SEARCH_CLOSED, {
client_ad_session_id: uuid2,
billing_session_id,
search_session_id: searchSessionId,
search_session_duration_ms: searchSessionDurationMs
});
}
export function trackQuestHomeSearchQuerySubmitted({ searchSessionId, searchQuery, searchQueryLength, resultsCount, hasResults }) {
const uuid2 = getOrRefreshAdSession().uuid;
const QUEST_HOME_SEARCH_QUERY_SUBMITTED = AnalyticEvents.QUEST_HOME_SEARCH_QUERY_SUBMITTED;
let billing_session_id = getActiveSessionUnsafe()?.uuid;
if (billing_session_id == null) {
billing_session_id = null;
}
AnalyticsUtils.track(QUEST_HOME_SEARCH_QUERY_SUBMITTED, {
client_ad_session_id: uuid2,
billing_session_id,
search_session_id: searchSessionId,
search_query: searchQuery,
search_query_length: searchQueryLength,
results_count: resultsCount,
has_results: hasResults
});
}
export function trackQuestBarOrDockModeChange({ questContent, sourceQuestContent, questId, mode, prevMode }) {
const contentProperties = getContentProperties(questContent);
trackQuestEvent({
questId,
event: AnalyticEvents.QUEST_BAR_MODE_CHANGED,
properties: {
content_id: contentProperties.content_id,
content_name: contentProperties.content_name,
mode,
previous_mode: prevMode
},
sourceQuestContent
});
}
export function trackQuestEmbedFallbackViewed(a0, a1) {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.QUEST_EMBED_FALLBACK_VIEWED, {
quest_id: a0,
reason: a1
});
}
@@ -0,0 +1,199 @@
// Metro module 10966 (f10967).
import { useCallback, useEffect, useMemo } from "react";
import { AnalyticEvents } from "../../../../Constants";
import { useQuestImpression } from "./ContentImpressionTrackerHooks";
import { trackQuestEmbedFallbackViewed, trackBountyCarouselEmptyStateViewed, trackAdContentEvent } from "./AnalyticsActions";
import { getAdMetadataSealed, getAdTrafficMetadataSealed, isBillableQuestContent } from "../../utils/QuestDataUtils";
import { getAdUser } from "../../../ads/utils/AdDataUtils.android";
import { getQuestContentName, getContentProperties } from "./AnalyticsTypes";
import getDeviceMetadata_native from "../../../device/getDeviceMetadata.native";
import { v4 } from "../../../../_bundle/Module514";
import { isIOS, isAndroid } from "../../../../utils/PlatformUtils";
import { getCurrentQuestHomeSearchSession } from "./QuestHomeSearchSession";
import { QuestContent } from "../../QuestTypes";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
function $mk85992($env) {
return (a0) => {
const r2 = $env.$parent;
const r4 = (0, r2[0])(r2[2][3]);
const r8 = $env[0];
r4.trackQuestEvent({
...a0,
properties: {
...a0.properties,
impression_id: r8 == null ? void 0 : r8.getId()
}
});
};
}
function $mk85993($env) {
return (a0) => {
const r2 = $env.$parent;
const r4 = (0, r2[0])(r2[2][3]);
const r8 = $env[0];
r4.trackAdContentEvent({
...a0,
properties: {
...a0.properties,
impression_id: r8 == null ? void 0 : r8.getId()
}
});
};
}
let env7388 = {};
export function useTrackQuestEventWithImpression() {
let env18407;
const r1 = env18407 = {
$parent: env7388
};
const questImpression = useQuestImpression();
env18407[0] = questImpression;
return useCallback($mk85992(r1), [questImpression]);
}
export function useTrackQuestContentClickedWithImpression() {
let env18410;
const r2 = env18410 = {
$parent: env7388
};
const questImpression = useQuestImpression();
env18410[0] = questImpression;
const callback = useCallback($mk85992(r2), [questImpression]);
return useCallback(({ questId, questContent, questContentCTA, questContentPosition, questContentRowIndex, trackGuildAndChannelMetadata, sourceQuestContent }) => {
const adMetadataSealed = getAdMetadataSealed(sourceQuestContent);
const adTrafficMetadataSealed = getAdTrafficMetadataSealed(sourceQuestContent, questId);
getAdUser(getQuestContentName(questContent)).then((result) => {
const properties = {
...getContentProperties(questContent, questContentPosition, questContentRowIndex),
...getDeviceMetadata_native(),
cta_name: questContentCTA,
click_id: v4(),
apple_advertising_id: result != null ? isIOS() ? result.advertisingId : null : null,
android_advertising_id: result != null ? isAndroid() ? result.advertisingId : null : null,
metadata_sealed: adMetadataSealed != null ? adMetadataSealed : null,
traffic_metadata_sealed: adTrafficMetadataSealed != null ? adTrafficMetadataSealed : null
};
let search_session_id = getCurrentQuestHomeSearchSession()?.uuid;
if (search_session_id == null) {
search_session_id = null;
}
properties.search_session_id = search_session_id;
callback({
questId,
event: AnalyticEvents.QUEST_CONTENT_CLICKED,
properties,
trackGuildAndChannelMetadata,
shouldExtendSession: isBillableQuestContent(questContent),
sourceQuestContent
});
});
}, [callback]);
}
export function useTrackAdContentEventWithImpression() {
let env18408;
const r1 = env18408 = {
$parent: env7388
};
const questImpression = useQuestImpression();
env18408[0] = questImpression;
return useCallback($mk85993(r1), [questImpression]);
}
export function useTrackAdContentClickedWithImpression() {
let env18412;
const r2 = env18412 = {
$parent: env7388
};
const questImpression = useQuestImpression();
env18412[0] = questImpression;
const callback2 = useCallback($mk85993(r2), [questImpression]);
return useCallback(({ adContentId, relatedQuestId, adCreativeType, questContent: questContent2, questContentCTA: questContentCTA2, questContentPosition: questContentPosition2, questContentRowIndex: questContentRowIndex2, trackGuildAndChannelMetadata: trackGuildAndChannelMetadata2, sourceQuestContent: sourceQuestContent2 }) => {
getAdUser(getQuestContentName(questContent2)).then((result) => {
const properties = {
...getContentProperties(questContent2, questContentPosition2, questContentRowIndex2),
...getDeviceMetadata_native(),
cta_name: questContentCTA2,
click_id: v4(),
apple_advertising_id: result != null ? isIOS() ? result.advertisingId : null : null,
android_advertising_id: result != null ? isAndroid() ? result.advertisingId : null : null
};
let search_session_id = getCurrentQuestHomeSearchSession()?.uuid;
if (search_session_id == null) {
search_session_id = null;
}
properties.search_session_id = search_session_id;
callback2({
adContentId,
relatedQuestId,
adCreativeType,
event: AnalyticEvents.QUEST_CONTENT_CLICKED,
properties,
trackGuildAndChannelMetadata: trackGuildAndChannelMetadata2,
shouldExtendSession: isBillableQuestContent(questContent2),
sourceQuestContent: sourceQuestContent2
});
});
}, [callback2]);
}
export function useQuestsEmbedFallbackAnalytics(a0, a1) {
useEffect(() => {
trackQuestEmbedFallbackViewed(a1, a0);
}, [a0, a1]);
}
export function useBountyCarouselEmptyStateAnalytics(a0) {
useEffect(() => {
if (a0 != null) {
trackBountyCarouselEmptyStateViewed(a0);
}
}, [a0]);
}
export function useQuestHomeEntrypointAnalyticsEvents({ questHomeHero, shouldShowQuestHomeHeroContent }) {
let callback3, callback4, callback5, callback6, callback7;
callback3 = void 0;
callback4 = void 0;
callback5 = void 0;
callback6 = void 0;
callback7 = void 0;
const QUEST_HOME_ENTRYPOINT_THEMED = shouldShowQuestHomeHeroContent ? QuestContent.QUEST_HOME_ENTRYPOINT_THEMED : QuestContent.QUEST_HOME_ENTRYPOINT;
const memo = useMemo(() => {
const contentProperties = getContentProperties(QUEST_HOME_ENTRYPOINT_THEMED);
delete contentProperties["row_index"];
return contentProperties;
}, [QUEST_HOME_ENTRYPOINT_THEMED]);
callback3 = useCallback((a0) => {
if (questHomeHero != null && shouldShowQuestHomeHeroContent) {
trackAdContentEvent({
adContentId: questHomeHero.id,
adCreativeType: AdCreativeType.QUEST_HOME_HERO,
event: a0,
properties: memo,
sourceQuestContent: QUEST_HOME_ENTRYPOINT_THEMED
});
} else {
AnalyticsUtils.track(a0, memo);
}
}, [questHomeHero, shouldShowQuestHomeHeroContent, QUEST_HOME_ENTRYPOINT_THEMED, memo]);
callback4 = useCallback(() => {
callback3(AnalyticEvents.QUEST_HOVER);
}, [callback3]);
callback5 = useCallback(() => {
callback3(AnalyticEvents.QUEST_HOVER_OFF);
}, [callback3]);
callback6 = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.QUEST_HOME_ONBOARDING_POPOVER_RENDERED);
}, []);
callback7 = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.QUEST_CONTENT_CLICKED, {
is_targeted: false,
...memo,
...questHomeHero != null ? {
ad_content_id: questHomeHero.id
} : {}
});
}, [memo, questHomeHero]);
return useMemo(() => ({
handleMouseEnter: callback4,
handleMouseLeave: callback5,
handleOnboardingPopoutRender: callback6,
handleEntrypointClick: callback7
}), [callback4, callback5, callback6, callback7]);
}
@@ -0,0 +1,131 @@
// Metro module 6012 (f6013).
import { QuestContent } from "../../QuestTypes";
function $mk77601($env) {
return (a0) => {
const r1 = $env.$parent;
return (0, r1[0])(r1[1][0]).QuestContent[a0] === $env[0];
};
}
let env3804 = {};
const c3804_2 = Object.keys(QuestContent);
const r19 = {
AUTO: "AUTO",
MANUAL: "MANUAL"
};
const r21 = {
LEFT: "LEFT",
RIGHT: "RIGHT"
};
const r24 = {
UP: "UP",
DOWN: "DOWN"
};
const r27 = {
ARROW: "ARROW",
AUTO: "AUTO",
MANUAL: "MANUAL"
};
const r28 = {
LEARN_MORE: "LEARN_MORE",
SHOW_REWARD: "SHOW_REWARD",
CLAIM_REWARD: "CLAIM_REWARD",
GET_REWARD_CODE: "GET_REWARD_CODE",
COPY_REWARD_CODE: "COPY_REWARD_CODE",
ACCEPT_QUEST: "ACCEPT_QUEST",
COPY_QUEST_URL: "COPY_QUEST_URL",
MOBILE_SHARESHEET: "MOBILE_SHARESHEET",
TRACK_PROGRESS: "TRACK_PROGRESS",
CONNECT_CONSOLE: "CONNECT_CONSOLE",
CONNECT_CONSOLE_LINK: "CONNECT_CONSOLE_LINK",
VIEW_CONSOLE_CONNECTIONS: "VIEW_CONSOLE_CONNECTION",
VIEW_CONSOLE_CONNECTIONS_LINK: "VIEW_CONSOLE_CONNECTIONS_LINK",
VIEW_REQUIREMENTS: "VIEW_REQUIREMENTS",
SELECT_CONSOLE_PLATFORM: "SELECT_CONSOLE_PLATFORM",
SELECT_DESKTOP_PLATFORM: "SELECT_DESKTOP_PLATFORM",
DESELECT_PLATFORM: "DESELECT_PLATFORM",
OPEN_ACCOUNT_LINK_MODAL: "OPEN_ACCOUNT_LINK_MODAL",
OPEN_ACCOUNT_LINK_INSTRUCTIONS: "OPEN_ACCOUNT_LINK_INSTRUCTIONS",
SELECT_IN_GAME_AUTH_METHOD: "SELECT_IN_GAME_AUTH_METHOD",
SELECT_WEB_AUTH_METHOD: "SELECT_WEB_AUTH_METHOD",
START_WEB_AUTHORIZATION: "START_WEB_AUTHORIZATION",
DEFIBRILLATOR: "DEFIBRILLATOR",
DEFIBRILLATOR_RECONNECT_CONSOLE: "DEFIBRILLATOR_RECONNECT_CONSOLE",
OPEN_DISCLOSURE: "OPEN_DISCLOSURE",
WATCH_STREAM: "WATCH_STREAM",
WATCH_STREAM_CONFIRM: "WATCH_STREAM_CONFIRM",
REWARD_LEARN_MORE: "REWARD_LEARN_MORE",
OPEN_GAME_LINK: "OPEN_GAME_LINK",
OPEN_CONTEXT_MENU: "OPEN_CONTEXT_MENU",
OPEN_QUEST_HOME: "OPEN_QUEST_HOME",
OPEN_QUEST_HOME_TO_CLAIM: "OPEN_QUEST_HOME_TO_CLAIM",
QUEST_BAR_COPY_LINK: "QUEST_BAR.COPY_LINK",
CONTEXT_MENU_COPY_LINK: "CONTEXT_MENU.COPY_LINK",
REWARD_MODAL_COPY_LINK: "REWARD_MODAL.COPY_LINK",
CONTEXT_MENU_HIDE_CONTENT: "CONTEXT_MENU.HIDE_CONTENT",
CONTEXT_MENU_OPEN_GAME_LINK: "CONTEXT_MENU.OPEN_GAME_LINK",
CONTEXT_MENU_OPEN_DISCLOSURE: "CONTEXT_MENU.OPEN_DISCLOSURE",
CONTEXT_MENU_LEARN_MORE: "CONTEXT_MENU.LEARN_MORE",
HOW_TO_HELP_ARTICLE_XBOX: "HOW_TO_HELP_ARTICLE_XBOX",
HOW_TO_HELP_ARTICLE_PLAYSTATION: "HOW_TO_HELP_ARTICLE_PLAYSTATION",
VIEW_QUESTS: "VIEW_QUESTS",
EXPAND: "EXPAND",
COLLAPSE: "COLLAPSE",
START_QUEST: "START_QUEST",
TRANSCRIPT_ENABLE: "TRANSCRIPT_ENABLE",
TRANSCRIPT_DISABLE: "TRANSCRIPT_DISABLE",
CLOSED_CAPTIONING_ENABLE: "CLOSED_CAPTIONING_ENABLE",
CLOSED_CAPTIONING_DISABLE: "CLOSED_CAPTIONING_DISABLE",
SEEK_BACKWARD: "SEEK_BACKWARD",
SEEK_FORWARD: "SEEK_FORWARD",
WATCH_VIDEO: "WATCH_VIDEO",
QUEST_BAR_VIDEO_QUEST_PREVIEW: "QUEST_BAR_VIDEO_QUEST_PREVIEW",
QUEST_HOME_TILE_HEADER_WATCH_VIDEO: "QUEST_HOME_TILE_HEADER_WATCH_VIDEO",
REDEEM_REWARD: "REDEEM_REWARD",
VISIT_REDEMPTION_LINK: "VISIT_REDEMPTION_LINK",
SPONSORED_QUEST_SHEET: "SPONSORED_QUEST_SHEET",
GAME_PROFILE_OPEN: "GAME_PROFILE_OPEN",
GAME_STORE_OPEN_GAME_LINK: "GAME_STORE_OPEN_GAME_LINK",
MOBILE_ORBS_ONBOARDING_DC: "MOBILE_ORBS_ONBOARDING_DC",
LAUNCH_MOBILE_ACTIVITY: "LAUNCH_MOBILE_ACTIVITY",
OPEN_NITRO_CHECKOUT: "OPEN_NITRO_CHECKOUT",
OPEN_NITRO_HOME: "OPEN_NITRO_HOME",
START_BOUNTY: "START_BOUNTY",
BACK_TO_BOUNTIES: "BACK_TO_BOUNTIES"
};
export function getQuestContentName(a0) {
let env15362;
const r1 = env15362 = {
$parent: env3804
};
env15362[0] = a0;
let r7 = c3804_2.find($mk77601(r1));
if (r7 == null) {
r7 = "";
}
return r7;
}
export function getQuestStatus(a0) {
return a0.userStatus?.claimedAt != null ? "COMPLETED_CLAIMED" : a0.userStatus?.completedAt != null ? "COMPLETED" : a0.userStatus?.enrolledAt != null ? "ENROLLED" : "NONE";
}
export function getContentProperties(a0, a1, a2) {
let env15363;
const r2 = env15363 = {
$parent: env3804
};
env15363[0] = a0;
let content_name = c3804_2.find($mk77601(r2));
if (content_name == null) {
content_name = "";
}
return {
content_id: a0,
content_name,
content_position: a1,
row_index: a2
};
}
export { r19 as BountyScrollingType };
export { r21 as HorizontalScrollingDirection };
export { r24 as VerticalScrollingDirection };
export { r27 as QuestHomeScrollingType };
export { r28 as QuestContentCTA };
@@ -0,0 +1,113 @@
// Metro module 8447 (f8448).
import { getVisibleChannelIdsMethod, getVisibleGuildIdsMethod } from "../../../guild_sidebar/SidebarVisibilityMethodStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import RelationshipStore from "../../../../stores/RelationshipStore";
import SelectedGuildStore from "../../../../stores/SelectedGuildStore";
import UserStore from "../../../../stores/UserStore";
import { MAX_BRAND_SAFETY_CONTEXT_ARRAY_LEN } from "./ContentImpressionTrackerConstants";
import * as _QuestDataUtils from "../../utils/QuestDataUtils";
import { getAdContext } from "../../utils/QuestDataUtils";
import AvatarUtils from "../../../../utils/AvatarUtils";
import { computeChannelName } from "../../../channel/useChannelName";
export function getBrandSafetyContext(a0) {
let guilds2;
const isBillableQuestContent = _QuestDataUtils.isBillableQuestContent(a0);
const adContext = getAdContext(a0);
const visibleGuildIdsMethod = getVisibleGuildIdsMethod();
const visibleChannelIdsMethod = getVisibleChannelIdsMethod();
if (adContext?.is_campaign_ias_enabled && isBillableQuestContent) {
const r5 = visibleGuildIdsMethod === void 0;
if (!r5) {
const r25 = visibleChannelIdsMethod === void 0;
if (!r25) {
const guildId = SelectedGuildStore.getGuildId();
const r29 = guildId != null ? GuildStore.getGuild(guildId) : null;
if (r5) {
guilds2 = [];
} else {
const r32 = visibleGuildIdsMethod();
const guilds = GuildStore.getGuilds();
guilds2 = r32.map((item) => {
const r7 = guilds[item];
if (r7 === void 0) {
return null;
}
const r11 = {
id: r7.id,
name: r7.name
};
if (r7.description !== null) {
r11.description = r7.description;
}
const icon = r7.icon;
let icon_url = null;
if (icon !== null) {
let r22 = AvatarUtils.getGuildIconURL({
id: r7.id,
icon: r7.icon,
size: 44,
canAnimate: true
});
if (r22 == null) {
r22 = null;
}
icon_url = r22;
}
if (icon_url !== null) {
r11.icon_url = icon_url;
}
return r11;
}).filter((item) => item !== null);
}
const r41 = {
guilds: guilds2,
channels: !r25 && r29 != null ? visibleChannelIdsMethod().map((item) => {
const channel = ChannelStore.getChannel(item);
if (channel === void 0) {
return null;
}
const r10 = {
id: channel.id,
name: computeChannelName(channel, UserStore, RelationshipStore)
};
if (channel.topic.length > 0) {
r10.channel_topic = channel.topic;
}
return r10;
}).filter((item) => item !== null) : []
};
if (guildId != null) {
r41.selected_guild_id = guildId;
}
const r51 = r29?.banner != null;
let selected_guild_banner_url = null;
if (r51) {
let r61 = AvatarUtils.getGuildBannerURL({
id: r29.id,
banner: r29.banner
}, true);
if (r61 == null) {
r61 = null;
}
selected_guild_banner_url = r61;
}
if (selected_guild_banner_url !== null) {
r41.selected_guild_banner_url = selected_guild_banner_url;
}
if (r41.guilds.length > MAX_BRAND_SAFETY_CONTEXT_ARRAY_LEN) {
r41.guilds = r41.guilds.slice(0, MAX_BRAND_SAFETY_CONTEXT_ARRAY_LEN);
r41.truncated = true;
}
if (r41.channels.length > MAX_BRAND_SAFETY_CONTEXT_ARRAY_LEN) {
r41.channels = r41.channels.slice(0, MAX_BRAND_SAFETY_CONTEXT_ARRAY_LEN);
r41.truncated = true;
}
return {
brand_safety_context: JSON.stringify(r41)
};
}
}
}
return null;
}
@@ -0,0 +1,453 @@
// Metro module 10497 (f10498).
import { createContext, useRef, useEffect } from "react";
import QuestStore from "../../QuestStore";
import { HEARTBEAT_SECONDS, MIN_QUEST_VIEW_TIME_SECONDS, MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE } from "./ContentImpressionTrackerConstants";
import { AnalyticEvents } from "../../../../Constants";
import { jsx } from "react/jsx-runtime";
import { v4 } from "../../../../_bundle/Module514";
import { shouldMigrateToAdAnalyticsInterface, AdAnalyticsInterfaceExperimentStep } from "../../experiments/AdAnalyticsInterfaceExperiment";
import { getAdMetadataSealed, isQuestExpired, isBillableQuestContent, getAdTrafficMetadataSealed, getQuestPlacementFromQuestContent } from "../../utils/QuestDataUtils";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { getAdUser } from "../../../ads/utils/AdDataUtils.android";
import { getQuestContentName, getContentProperties } from "./AnalyticsTypes";
import { isIOS, isAndroid } from "../../../../utils/PlatformUtils";
import getDeviceMetadata_native from "../../../device/getDeviceMetadata.native";
import { getBrandSafetyContext } from "./BrandSafetyContext";
import { markAdContentSeen } from "../../QuestActionCreators";
import { captureAdUserAction } from "../../../ads/analytics/captureAdUserAction";
import { AdUserActionType } from "../../../ads/analytics/captureAdUserActionTypes";
import { getQuestLogger } from "../getQuestLogger";
import { trackQuestEvent, trackAdContentEvent } from "./AnalyticsActions";
import { getCurrentQuestHomeSearchSession } from "./QuestHomeSearchSession";
import MonitoringAgent from "../../../monitoring/MonitoringAgent";
import { MetricEvents } from "../../../../_bundle/Module5872";
import { useQuestStatusChanged } from "./ContentImpressionTrackerHooks";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useMountEffect from "../../../../hooks/useMountEffect";
function $mk118168($env) {
return (a0, a1) => {
const r10 = $env;
const r32 = $env.$parent[0];
let metadata_sealed = getAdMetadataSealed(r32.sourceQuestContent, a0);
const shouldExtendSession2 = r32.shouldExtendSession(a0);
r32.trackViewedPlacement(a0);
const migrateQuestContentViewedToCaptureAdUserAction = r32.migrateQuestContentViewedToCaptureAdUserAction;
const adCreativeType = r32.entity.adCreativeType;
const QUEST = AdCreativeType.QUEST;
if (migrateQuestContentViewedToCaptureAdUserAction) {
if (adCreativeType === QUEST) {
const r151 = r32.entity.adContentIds[a1];
const quest2 = QuestStore.getQuest(r151);
if (!(quest2 == null || isQuestExpired(quest2))) {
markAdContentSeen(AdCreativeType.QUEST, [r151]);
}
}
r32.entity.adCreativeType;
AdCreativeType.QUEST;
const r177 = {
adCreativeType: r32.entity.adCreativeType,
adCreativeId: r32.entity.adContentIds[a1]
};
captureAdUserAction({
type: isBillableQuestContent(r32.questContent) ? AdUserActionType.VIEW_EXTERNAL_PAID_AD_PLACEMENT_IMPRESSION : AdUserActionType.VIEW_INTERNAL_SURFACE_IMPRESSION,
surfaceId: r32.questContent,
sourceQuestContent: r32.sourceQuestContent,
impressionId: r32.id,
triggeredByStatusChange: r32.triggeredByStatusChange,
minViewTimeSeconds: r32.minViewTimeSeconds,
minViewportPercentage: r32.minViewportPercentage,
isQuestEnrollmentBlocked: r32.isQuestEnrollmentBlocked,
shouldExtendSession: shouldExtendSession2,
adUser: r10[0],
questContentPosition: r32.questContentPosition,
questContentRowIndex: r32.questContentRowIndex,
trackGuildAndChannelMetadata: r32.trackGuildAndChannelMetadata,
...r177
});
getQuestLogger().info(`${a0} ad content viewed for at least ${r32.minViewTimeSeconds}s at ${getQuestContentName(r32.questContent)}`, {
impressionId: r32.id
});
return void 0;
}
if (adCreativeType === QUEST) {
const questId = r32.entity.adContentIds[a1];
const quest = QuestStore.getQuest(questId);
if (!(quest == null || isQuestExpired(quest))) {
markAdContentSeen(AdCreativeType.QUEST, [questId]);
}
const questLogger = getQuestLogger();
let r24 = quest == null ? void 0 : quest.config.messages.questName;
if (r24 == null) {
r24 = questId;
}
questLogger.info(`${r24} Quest viewed for at least ${r32.minViewTimeSeconds}s at ${getQuestContentName(r32.questContent)}`, {
impressionId: r32.id
});
const properties = {
...r10[2],
...r32.commonProperties()
};
if (metadata_sealed == null) {
metadata_sealed = null;
}
properties.metadata_sealed = metadata_sealed;
let search_session_id = getCurrentQuestHomeSearchSession()?.uuid;
if (search_session_id == null) {
search_session_id = null;
}
properties.search_session_id = search_session_id;
let traffic_metadata_sealed = getAdTrafficMetadataSealed(r32.sourceQuestContent, quest?.id);
if (traffic_metadata_sealed == null) {
traffic_metadata_sealed = null;
}
properties.traffic_metadata_sealed = traffic_metadata_sealed;
trackQuestEvent({
...r10[1],
shouldExtendSession: shouldExtendSession2,
questId,
event: AnalyticEvents.QUEST_CONTENT_VIEWED,
properties
});
} else {
const adContentId = r32.entity.adContentIds[a1];
getQuestLogger().info(`${adContentId} ad content viewed for at least ${r32.minViewTimeSeconds}s at ${getQuestContentName(r32.questContent)}`, {
impressionId: r32.id
});
trackAdContentEvent({
...r10[1],
shouldExtendSession: shouldExtendSession2,
adContentId,
adCreativeType: r32.entity.adCreativeType,
event: AnalyticEvents.QUEST_CONTENT_VIEWED,
properties: {
...r10[2],
...r32.commonProperties()
}
});
}
};
}
let QuestContentImpression, c7042_13;
let env7042 = {};
const c7042_11 = new Set();
const c7042_14 = class QuestContentImpression {
constructor(a0) {
let env18074;
const _this = this;
this.isRunning = false;
this.trackViewedPlacement = (a0) => {
const questPlacementFromQuestContent = getQuestPlacementFromQuestContent(_this.questContent);
if (questPlacementFromQuestContent != null && isBillableQuestContent(_this.questContent)) {
c7042_11.add(`${a0}_${questPlacementFromQuestContent}`);
}
};
this.shouldExtendSession = (a0) => {
const questPlacementFromQuestContent = getQuestPlacementFromQuestContent(_this.questContent);
return questPlacementFromQuestContent != null && !c7042_11.has(`${a0}_${questPlacementFromQuestContent}`) && isBillableQuestContent(_this.questContent);
};
env18074 = {
$parent: env7042
};
env18074[0] = this;
this.onMinViewTimeReached = async () => {
let env31534;
const r25 = env18074;
let c30234_1 = r25;
const r9 = env31534 = {
$parent: r25
};
let c30234_0 = r9;
env31534[0] = void 0;
env31534[1] = void 0;
env31534[2] = void 0;
env31534[0] = await getAdUser(getQuestContentName(env18074[0].questContent));
env31534[1] = {
trackGuildAndChannelMetadata: env18074[0].trackGuildAndChannelMetadata,
sourceQuestContent: env18074[0].sourceQuestContent
};
const apple_advertising_id = env31534[0] != null ? isIOS() ? env31534[0].advertisingId : null : null;
const android_advertising_id = env31534[0] != null ? isAndroid() ? env31534[0].advertisingId : null : null;
env31534[2] = {
min_view_time_seconds: env18074[0].minViewTimeSeconds,
min_viewport_percentage: env18074[0].minViewportPercentage,
triggered_by_status_change: env18074[0].triggeredByStatusChange,
apple_advertising_id,
android_advertising_id,
...getDeviceMetadata_native(),
...getBrandSafetyContext(env18074[0].questContent)
};
env18074[0].entity.adContentIds.forEach($mk118168(c30234_0));
const r108 = env18074[0];
const onImpressionCallback = r108.onImpressionCallback;
if (onImpressionCallback != null) {
onImpressionCallback.call(r108);
}
};
this.beat = function beat(is_termination_beat = false) {
let c26698_1, c26698_2, c26698_3;
let c26698_0 = is_termination_beat;
c26698_1 = void 0;
c26698_2 = void 0;
c26698_3 = void 0;
if (_this.lastBeatTime != null) {
const viewed_time_ms = Math.round(Date.now() - _this.lastBeatTime);
c26698_1 = viewed_time_ms;
c26698_2 = {
trackGuildAndChannelMetadata: _this.trackGuildAndChannelMetadata,
sourceQuestContent: _this.sourceQuestContent
};
c26698_3 = {
is_termination_beat,
viewed_time_ms,
triggered_by_status_change: _this.triggeredByStatusChange
};
_this.entity.adContentIds.forEach((a0, index) => {
if (_this.entity.adCreativeType === AdCreativeType.QUEST) {
const questId = _this.entity.adContentIds[index];
const quest = QuestStore.getQuest(questId);
const questLogger = getQuestLogger();
let r73 = quest == null ? void 0 : quest.config.messages.questName;
if (r73 == null) {
r73 = questId;
}
questLogger.info(`${r73} Quest impression ${c26698_0 ? "terminal " : ""}heartbeat: ${c26698_1}ms since last heartbeat`, {
impressionId: _this.id
});
trackQuestEvent({
...c26698_2,
questId,
event: AnalyticEvents.QUEST_CONTENT_VIEW_TIME,
properties: {
...c26698_3,
..._this.commonProperties()
}
});
} else {
const adContentId = _this.entity.adContentIds[index];
getQuestLogger().info(`${adContentId} ad content impression ${c26698_0 ? "terminal " : ""}heartbeat: ${c26698_1}ms since last heartbeat`, {
impressionId: _this.id
});
trackAdContentEvent({
...c26698_2,
adContentId,
adCreativeType: _this.entity.adCreativeType,
event: AnalyticEvents.QUEST_CONTENT_VIEW_TIME,
properties: {
...c26698_3,
..._this.commonProperties()
}
});
}
});
}
_this.lastBeatTime = Date.now();
};
this.commonProperties = () => ({
impression_id: _this.id,
is_quest_enrollment_blocked: _this.isQuestEnrollmentBlocked,
...getContentProperties(_this.questContent, _this.questContentPosition, _this.questContentRowIndex)
});
this.clone = ({ triggeredByStatusChange }) => {
_this.stop();
return new c7042_14({
questContent: _this.questContent,
questContentRowIndex: _this.questContentRowIndex,
questContentPosition: _this.questContentPosition,
trackGuildAndChannelMetadata: _this.trackGuildAndChannelMetadata,
triggeredByStatusChange,
isQuestEnrollmentBlocked: _this.isQuestEnrollmentBlocked,
onImpression: _this.onImpressionCallback,
sourceQuestContent: _this.sourceQuestContent,
..._this.entity
});
};
this.start = () => {
let c26699_0, c26699_1;
_this.stop(false);
_this.lastBeatTime = Date.now();
_this.heartbeatTimeoutId = window.setInterval(() => _this.beat(), 1000 * HEARTBEAT_SECONDS);
_this.minViewTimeReachedTimeoutId = window.setTimeout(_this.onMinViewTimeReached, 1000 * _this.minViewTimeSeconds);
c26699_0 = {
trackGuildAndChannelMetadata: _this.trackGuildAndChannelMetadata,
sourceQuestContent: _this.sourceQuestContent
};
c26699_1 = {
triggered_by_status_change: _this.triggeredByStatusChange
};
_this.entity.adContentIds.forEach((a0, index) => {
let metadata_sealed = getAdMetadataSealed(_this.sourceQuestContent, a0);
const migrateQuestContentLoadedToCaptureAdUserAction = _this.migrateQuestContentLoadedToCaptureAdUserAction;
const adCreativeType = _this.entity.adCreativeType;
const QUEST = AdCreativeType.QUEST;
if (migrateQuestContentLoadedToCaptureAdUserAction) {
captureAdUserAction({
type: AdUserActionType.END_CONTENT_LOAD,
surfaceId: _this.questContent,
sourceQuestContent: _this.sourceQuestContent,
impressionId: _this.id,
triggeredByStatusChange: _this.triggeredByStatusChange,
trackGuildAndChannelMetadata: _this.trackGuildAndChannelMetadata,
questContentPosition: _this.questContentPosition,
questContentRowIndex: _this.questContentRowIndex,
...{
adCreativeType: _this.entity.adCreativeType,
adCreativeId: _this.entity.adContentIds[index]
}
});
} else if (adCreativeType === QUEST) {
const questId = _this.entity.adContentIds[index];
const quest = QuestStore.getQuest(questId);
const questLogger = getQuestLogger();
let r18 = quest == null ? void 0 : quest.config.messages.questName;
if (r18 == null) {
r18 = questId;
}
questLogger.info(`${r18} Quest became visible at ${getQuestContentName(_this.questContent)}`, {
impressionId: _this.id
});
if (metadata_sealed == null) {
metadata_sealed = null;
}
const properties = {
...c26699_1,
metadata_sealed,
..._this.commonProperties()
};
let traffic_metadata_sealed = getAdTrafficMetadataSealed(_this.sourceQuestContent, quest?.id);
if (traffic_metadata_sealed == null) {
traffic_metadata_sealed = null;
}
properties.traffic_metadata_sealed = traffic_metadata_sealed;
trackQuestEvent({
...c26699_0,
questId,
event: AnalyticEvents.QUEST_CONTENT_LOADED,
properties
});
} else {
const adContentId = _this.entity.adContentIds[index];
getQuestLogger().info(`${adContentId} ad content became visible at ${getQuestContentName(_this.questContent)}`, {
impressionId: _this.id
});
trackAdContentEvent({
...c26699_0,
adContentId,
adCreativeType: _this.entity.adCreativeType,
event: AnalyticEvents.QUEST_CONTENT_LOADED,
properties: {
...c26699_1,
..._this.commonProperties()
}
});
}
});
MonitoringAgent.increment({
name: MetricEvents.QUEST_CONTENT_IMPRESSION,
tags: [`quest_content:${getQuestContentName(_this.questContent)}`]
});
_this.isRunning = true;
};
this.stop = function stop(r3 = true) {
if (r3) {
_this.beat(true);
}
_this.lastBeatTime = void 0;
clearInterval(_this.heartbeatTimeoutId);
clearTimeout(_this.minViewTimeReachedTimeoutId);
_this.isRunning = false;
};
const { adContentIds, adCreativeType, questContent, triggeredByStatusChange, trackGuildAndChannelMetadata, questContentPosition, questContentRowIndex, minViewTimeSeconds = MIN_QUEST_VIEW_TIME_SECONDS, isQuestEnrollmentBlocked, onImpression, sourceQuestContent: sourceQuestContent2 } = a0;
this.id = v4();
this.questContent = questContent;
this.questContentPosition = questContentPosition;
this.minViewTimeSeconds = minViewTimeSeconds;
this.minViewportPercentage = MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE;
this.trackGuildAndChannelMetadata = trackGuildAndChannelMetadata;
this.triggeredByStatusChange = triggeredByStatusChange;
this.questContentRowIndex = questContentRowIndex;
this.isQuestEnrollmentBlocked = isQuestEnrollmentBlocked;
this.onImpressionCallback = onImpression;
this.sourceQuestContent = sourceQuestContent2;
this.migrateQuestContentLoadedToCaptureAdUserAction = shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_1_LOADED, "quest_content_impression");
this.migrateQuestContentViewedToCaptureAdUserAction = shouldMigrateToAdAnalyticsInterface(isBillableQuestContent(questContent) ? AdAnalyticsInterfaceExperimentStep.STEP_5_VIEWED_IMPRESSION : AdAnalyticsInterfaceExperimentStep.STEP_4_VIEWED_NON_IMPRESSION, "quest_content_impression");
AdCreativeType.QUEST;
this.entity = {
adContentIds,
adCreativeType
};
}
getId() {
return this.id;
}
getQuestContentPosition() {
return this.questContentPosition;
}
};
QuestContentImpression = c7042_14;
const context = createContext(void 0);
c7042_13 = context;
export { c7042_14 as QuestContentImpression };
export { context as QuestImpressionContext };
export function QuestContentImpressionTracker(a0) {
const { visible, visibleChanged, focused, reference, focusedChanged, sourceQuestContent } = a0;
const questStatusChanged = useQuestStatusChanged(a0);
const ref = useRef(null);
const stateFromStores = useStateFromStores([QuestStore], () => QuestStore.questEnrollmentBlockedUntil != null, []);
useMountEffect(() => () => {
if (ref.current != null) {
ref.current.stop();
}
});
useEffect(() => {
let r5 = focused;
if (focused) {
r5 = visible;
}
let r4 = visibleChanged;
const r2 = ((visibleChanged ? visibleChanged : focusedChanged) || questStatusChanged) && r5;
let r3 = r2;
if (!r3) {
if (!visibleChanged) {
r4 = focusedChanged;
}
if (r4) {
r4 = !r5;
}
r3 = r4;
}
if (!r3) {
r3 = questStatusChanged;
}
if (r3) {
r3 = ref.current != null;
}
if (r3) {
ref.current.stop();
}
if (r2) {
const r19 = {
isQuestEnrollmentBlocked: stateFromStores,
minViewTimeSeconds: a0.minViewTimeSeconds,
onImpression: a0.onImpression,
questContent: a0.questContent,
questContentPosition: a0.questContentPosition,
questContentRowIndex: a0.questContentRowIndex,
sourceQuestContent,
trackGuildAndChannelMetadata: a0.trackGuildAndChannelMetadata,
triggeredByStatusChange: questStatusChanged
};
a0.adCreativeType;
AdCreativeType.QUEST;
ref.current = new QuestContentImpression({
...r19,
adContentIds: a0.adContentIds,
adCreativeType: a0.adCreativeType
});
ref.current.start();
}
}, [focused, visible, focusedChanged, visibleChanged, a0.adContentIds, a0.onImpression, a0.questContent, a0.questContentPosition, a0.questContentRowIndex, a0.trackGuildAndChannelMetadata, questStatusChanged, a0.minViewTimeSeconds, stateFromStores, sourceQuestContent, a0.adCreativeType]);
return (0, jsx)(c7042_13.Provider, {
value: ref,
children: a0.children(reference, ref)
});
}
@@ -0,0 +1,5 @@
// Metro module 8449 (f8450).
export const MAX_BRAND_SAFETY_CONTEXT_ARRAY_LEN = 100;
export const HEARTBEAT_SECONDS = 60;
export const MIN_QUEST_VIEW_TIME_SECONDS = 1;
export const MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE = 0.5;
@@ -0,0 +1,54 @@
// Metro module 10496 (f10497).
import { useMemo, useContext, useCallback } from "react";
import QuestStore from "../../QuestStore";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { getQuestStatus } from "./AnalyticsTypes";
import usePrevious from "../../../../hooks/usePrevious";
import { QuestImpressionContext } from "./ContentImpressionTracker";
export function useAdContentImpressionTrackerProps(a0) {
let QUEST;
const r11 = "questOrQuests" in a0 ? a0.questOrQuests : void 0;
const r10 = "adContentId" in a0 ? a0.adContentId : void 0;
const questOrQuests = r11;
const adContentId = r10;
const memo = useMemo(() => adContentId != null ? [adContentId] : questOrQuests != null ? Array.isArray(questOrQuests) ? questOrQuests.map((questOrQuest) => questOrQuest.id) : [questOrQuests.id] : [], [questOrQuests, adContentId]);
QUEST = "questOrQuests" in a0 ? AdCreativeType.QUEST : a0.adCreativeType;
return useMemo(() => {
const questContent = a0.questContent;
const key = `${[...memo].sort().join("_")}_${questContent}`;
AdCreativeType.QUEST;
return {
adContentIds: memo,
adCreativeType: QUEST,
key
};
}, [memo, a0.questContent, QUEST]);
}
export function useQuestStatusChanged({ adContentIds, adCreativeType }) {
const stateFromStores = useStateFromStores([QuestStore], () => adCreativeType === AdCreativeType.QUEST ? adContentIds.length === 1 ? QuestStore.getQuest(adContentIds[0]) : null : null, [adContentIds, adCreativeType]);
const memo2 = useMemo(() => stateFromStores != null ? getQuestStatus(stateFromStores) : null, [stateFromStores]);
return memo2 !== usePrevious(memo2);
}
export function useQuestImpressionRef() {
return useContext(QuestImpressionContext);
}
export function useQuestImpression() {
return useContext(QuestImpressionContext)?.current;
}
export function useQuestImpressionId() {
const current = useContext(QuestImpressionContext)?.current;
return current == null ? void 0 : current.getId();
}
export function useGetQuestImpressionId() {
const context = useContext(QuestImpressionContext);
return useCallback(() => {
const r2 = context == null;
let r6 = void 0;
if (!r2) {
const current = context.current;
r6 = current == null ? void 0 : current.getId();
}
return r6;
}, [context]);
}
@@ -0,0 +1,34 @@
// Metro module 6019 (f6020).
import { v4 } from "../../../../_bundle/Module514";
import { CLIENT_SESSION_STORAGE_VERSION } from "../../../analytics_sessions/SessionUtils";
let searchSession = null;
export function getOrCreateQuestHomeSearchSession() {
let r14;
const createdAtTimestamp = Date.now();
if (searchSession == null) {
const searchSession2 = {
uuid: v4(),
createdAtTimestamp,
lastUsedTimestamp: createdAtTimestamp,
version: CLIENT_SESSION_STORAGE_VERSION
};
searchSession = searchSession2;
r14 = {
searchSession: searchSession2,
isNew: true
};
} else {
searchSession.lastUsedTimestamp = createdAtTimestamp;
r14 = {
searchSession,
isNew: false
};
}
return r14;
}
export function clearQuestHomeSearchSession() {
searchSession = null;
}
export function getCurrentQuestHomeSearchSession() {
return searchSession;
}
+23
View File
@@ -0,0 +1,23 @@
// Metro module 5991 (f5992).
import DeveloperOptionsStore from "../../../stores/DeveloperOptionsStore";
import { NOOP } from "../../../_bundle/Module505";
import Logger from "../../debug/Logger";
export function getQuestLogger(r5 = {}) {
const { quest, location: location2 } = r5;
const r10 = quest == null ? void 0 : quest.config.messages.questName;
const r17 = location2 != null;
let r9 = "";
const r8 = r17 ? `-${location2}` : "";
if (r10 != null) {
r9 = `-${r10})`;
}
const logger = new Logger(`QuestLogger${r8}${r9}`);
return {
log: DeveloperOptionsStore.isLoggingQuestEvents ? logger.log : NOOP,
warn: DeveloperOptionsStore.isLoggingQuestEvents ? logger.warn : NOOP,
error: DeveloperOptionsStore.isLoggingQuestEvents ? logger.error : NOOP,
info: DeveloperOptionsStore.isLoggingQuestEvents ? logger.info : NOOP,
verbose: DeveloperOptionsStore.isLoggingQuestEvents ? logger.verbose : NOOP,
trace: DeveloperOptionsStore.isLoggingQuestEvents ? logger.trace : NOOP
};
}
@@ -0,0 +1,112 @@
// Metro module 16653 (f16654).
import QuestStore from "../QuestStore";
import Durations from "../../../utils/Durations";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { getIsEligibleForQuests } from "../lib/QuestsEligibility";
import SentryUtils_native from "../../../utils/SentryUtils.native";
import { fetchQuestHomeHero, fetchCurrentQuests, fetchQuestToDeliver } from "../QuestActionCreators";
import { isMac } from "../../../utils/PlatformUtils";
import DiscordAppState_native from "../../app_state/DiscordAppState.native";
import NewAdRequestBehaviorExperiment from "../experiments/NewAdRequestBehaviorExperiment";
import { AdPlacement } from "../QuestTypes";
import { getQuestFetchReconnectJitterConfig, DEFAULT_QUEST_FETCH_JITTER_CONFIG } from "../experiments/QuestFetchReconnectJitterExperiment";
const DAY = Durations.Millis.DAY;
let c11991_5 = 30 * Durations.Millis.MINUTE;
let c11991_6 = 5 * Durations.Millis.MINUTE;
Durations.Millis.HOUR;
let c11991_7 = 5 * Durations.Millis.MINUTE;
class QuestFetchManager extends AutomaticLifecycleManager {
instantiatedAt = Date.now();
initialFetchTimerId = null;
initialQuestHomeHeroFetchTimerId = null;
recurringFetchTimerId = null;
lastFetchAttemptedAt = 0;
lastFetchedQuestForLocaleChangeAt = 0;
hasHandledConnectionOpen = false;
handleQuestsFetchCurrentQuestsBegin = () => {
this.lastFetchAttemptedAt = Date.now();
};
handlePostConnectionOpen = () => {
const r6 = window;
r6.clearTimeout(this.initialFetchTimerId);
window.clearTimeout(this.initialQuestHomeHeroFetchTimerId);
window.clearTimeout(this.recurringFetchTimerId);
this.recurringFetchTimerId = window.setInterval(() => {
const r5 = Date.now();
if (r5 - this.lastFetchAttemptedAt > DAY) {
this._fetch("post_connect_recurring");
}
}, c11991_5);
const isEligibleForQuests = getIsEligibleForQuests();
const hasHandledConnectionOpen = this.hasHandledConnectionOpen;
this.hasHandledConnectionOpen = true;
const r35 = hasHandledConnectionOpen && isEligibleForQuests ? getQuestFetchReconnectJitterConfig({
location: "QuestFetchManager"
}) : DEFAULT_QUEST_FETCH_JITTER_CONFIG;
const { questFetchJitterMs, questHomeHeroJitterMs } = r35;
const r45 = Math.floor(Math.random() * questFetchJitterMs);
this.initialFetchTimerId = window.setTimeout(() => {
if (!(Date.now() - QuestStore.lastFetchedCurrentQuests <= c11991_7)) {
this._fetch("post_connect_initial");
}
}, r45);
if (isEligibleForQuests) {
this.initialQuestHomeHeroFetchTimerId = window.setTimeout(() => {
try {
fetchQuestHomeHero();
} catch ($e) {}
}, r45 + Math.floor(Math.random() * questHomeHeroJitterMs));
}
};
handleRunningGamesChange = () => {};
handleUserSettingsProtoUpdate = ({ partial, settings, wasSaved }) => {
if (!(!("localization" in settings.proto) || !partial || wasSaved || Date.now() - this.lastFetchedQuestForLocaleChangeAt <= c11991_6)) {
this.lastFetchedQuestForLocaleChangeAt = Date.now();
this._fetch("user_settings");
}
};
handleStartSession = () => {
this.hasHandledConnectionOpen = false;
};
handleLogout = () => {
const r6 = window;
r6.clearTimeout(this.initialFetchTimerId);
window.clearTimeout(this.initialQuestHomeHeroFetchTimerId);
window.clearTimeout(this.recurringFetchTimerId);
this.lastFetchAttemptedAt = 0;
this.lastFetchedQuestForLocaleChangeAt = 0;
this.hasHandledConnectionOpen = false;
};
actions = {
QUESTS_FETCH_CURRENT_QUESTS_BEGIN: this.handleQuestsFetchCurrentQuestsBegin,
POST_CONNECTION_OPEN: this.handlePostConnectionOpen,
RUNNING_GAMES_CHANGE: this.handleRunningGamesChange,
RUNNING_NON_GAMES_CHANGE: this.handleRunningGamesChange,
USER_SETTINGS_PROTO_UPDATE: this.handleUserSettingsProtoUpdate,
START_SESSION: this.handleStartSession,
LOGOUT: this.handleLogout
};
_fetch(a0) {
if (getIsEligibleForQuests() && !QuestStore.isFetchingCurrentQuests) {
SentryUtils_native.addBreadcrumb({
category: "quests.fetch",
message: "QuestFetchManager._fetch triggered",
data: {
callerSource: a0,
storeSize: QuestStore.quests.size,
lastFetchedCurrentQuests: QuestStore.lastFetchedCurrentQuests,
msSinceLastFetch: Date.now() - QuestStore.lastFetchedCurrentQuests,
isFetchingCurrentQuests: QuestStore.isFetchingCurrentQuests
}
});
fetchCurrentQuests();
if (!(isMac() && DiscordAppState_native.getState() !== "focused" || NewAdRequestBehaviorExperiment.getConfig({
location: "QuestFetchManager"
}).enableNewRequestBehavior)) {
fetchQuestToDeliver(AdPlacement.MOBILE_HOME_DOCK_AREA, a0);
}
}
}
}
const questFetchManager = new QuestFetchManager();
export default questFetchManager;
@@ -0,0 +1,486 @@
// Metro module 16655 (f16656).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import ActionSheetStore from "../../action_sheet/native/ActionSheetStore";
import ChannelRTCStore from "../../calls/ChannelRTCStore";
import { getIsChannelDetailsSearchActive, useChannelDetailsStore } from "../../main_tabs_v2/native/sidebar/details/stores/ChannelDetailsStore";
import VoicePanelStore from "../../voice_panel/VoicePanelStore";
import { isTextChannel } from "../../../records/ChannelRecord";
import ChannelStore from "../../../stores/ChannelStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import AlertStore from "../../../stores/native/AlertStore";
import AppStateStore from "../../../stores/native/AppStateStore";
import QuestStore from "../QuestStore";
import { MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE } from "../lib/analytics/ContentImpressionTrackerConstants";
import { MessageStates } from "../../../Constants";
import { getQuestLogger } from "../lib/getQuestLogger";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import LRUCache from "../../../_bundle/LRUCache";
import { CodedLinkType } from "../../coded_links/CodedLink";
import { QuestContent } from "../QuestTypes";
import { AdCreativeType } from "../../../_bundle/Module6013";
import { QuestContentImpression } from "../lib/analytics/ContentImpressionTracker";
import { isChannelFocused } from "../../panels/isChannelFocused.native";
import { getCurrentNavigationRouteName, getOpenModalKey } from "../../main_tabs_v2/helpers/NavigationRouteUtils.native";
import { AppStates } from "../../../ConstantsIOS";
import { ChannelTypes } from "../../../_bundle/Module692";
import { useAlertStore } from "../../../design/components/AlertModal/native/useAlertStore.native";
import { getQuestStatus } from "../lib/analytics/AnalyticsTypes";
import { getRootNavigationRef } from "../../main_tabs_v2/RootNavigationRef.native";
let questLogger, prototype, QuestMobileEmbedVisibilityManager;
const log = function log() {
Array.prototype.slice.call(arguments, 0);
let r8 = questLogger;
if (questLogger == null) {
r8 = getQuestLogger({
location: "QuestMobileEmbedVisibilityManager"
});
}
questLogger = r8;
};
const QuestMobileEmbedVisibilityManager2 = class QuestMobileEmbedVisibilityManager extends AutomaticLifecycleManager {
constructor() {
super(...arguments);
const _this = this;
this.impressionCache = new LRUCache({
max: 50
});
this.questStatuses = {};
this.chatChannelId = void 0;
this.previousChatChannelId = void 0;
this.channelsWithChatOpen = {};
this.handleVisibleMessagesChanged = ({ payload }) => {
const visibleMessages = payload.visibleMessages;
payload.source;
log();
const visibleEmbeds = [];
for (const item of visibleMessages) {
const { message, percentVisible, state } = item;
if (!(message.codedLinks.length <= 0 || [MessageStates.SENDING, MessageStates.SEND_FAILED].includes(state))) {
message.id;
message.content;
const r16 = Math;
log(r16.round(100 * percentVisible));
if (percentVisible > MIN_QUEST_CONTENT_VISIBILITY_PERCENTAGE) {
visibleEmbeds.push.apply(visibleEmbeds, [..._this.findQuestEmbedsInMessage(message)]);
}
}
}
_this.updateImpressionsForVisibleEmbeds({
visibleEmbeds
});
};
this.findQuestEmbedsInMessage = (a0) => {
const r0 = [];
let c28488_1 = r0;
let c28488_2 = new Set();
a0.codedLinks.forEach((codedLink, index) => {
if (codedLink.type === CodedLinkType.QUESTS_EMBED) {
const code = codedLink.code;
if (!c28488_2.has(code)) {
c28488_1.push({
questId: code,
questContentPosition: index,
messageId: a0.id,
channelId: a0.channel_id
});
c28488_2.add(code);
}
}
});
return r0;
};
this.updateImpressionsForVisibleEmbeds = ({ visibleEmbeds }) => {
for (const item of visibleEmbeds) {
const { questId, questContentPosition, messageId, channelId } = item;
const quest = QuestStore.getQuest(questId);
if (quest != null) {
const quest2 = quest;
_this.ensureImpression({
quest: quest2,
questContent: QuestContent.QUEST_EMBED_MOBILE,
triggeredByStatusChange: false,
questContentPosition,
channelId,
messageId,
questId: quest2.id,
isQuestEnrollmentBlocked: QuestStore.questEnrollmentBlockedUntil != null,
sourceQuestContent: QuestContent.QUEST_EMBED_MOBILE,
adCreativeType: AdCreativeType.QUEST
});
}
}
_this.stopMany({
visibleEmbeds,
shouldDeleteHiddenEmbeds: true
});
};
this.ensureImpression = ({ quest, ...rest }) => {
const cacheKey = _this.getCacheKey(rest);
const r9 = _this.impressionCache.get(cacheKey);
if (!(r9 != null && r9?.isRunning)) {
let r20 = r9;
if (r20 != null) {
r20 = r9.clone({
triggeredByStatusChange: rest.triggeredByStatusChange
});
}
if (r20 == null) {
r20 = new QuestContentImpression({
adContentIds: [quest.id],
...rest
});
}
if (_this.isChatViewable && !r20.isRunning) {
r20.start();
}
_this.impressionCache.set(cacheKey, r20);
}
};
this.stopOne = ({ key, shouldDelete }) => {
const r8 = _this.impressionCache.get(key);
let r11 = r8?.isRunning;
if (r11 == null) {
r11 = false;
}
if (r8 != null) {
r8.stop();
}
if (shouldDelete) {
log();
_this.impressionCache.del(key);
}
return r11;
};
this.stopMany = function stopMany(r1 = {
visibleEmbeds: [],
shouldDeleteHiddenEmbeds: false
}) {
const { visibleEmbeds = [], shouldDeleteHiddenEmbeds = false } = r1;
const set = new Set(visibleEmbeds.map((visibleEmbed) => _this.getCacheKey(visibleEmbed)));
for (const item of _this.impressionCache.keys()) {
const key = item;
if (!set.has(item)) {
_this.stopOne({
key,
shouldDelete: shouldDeleteHiddenEmbeds
});
}
}
};
this.getCacheKey = (a0) => a0.channelId + ":" + a0.messageId + ":" + a0.questId;
this.parseCacheKey = (a0) => {
const r8 = _slicedToArray(a0.split(":"), 3);
return {
channelId: r8[0],
messageId: r8[1],
questId: r8[2]
};
};
this.isOnChannelNavigationRoute = () => {
let r7 = isChannelFocused();
const currentNavigationRouteName = getCurrentNavigationRouteName();
if (r7) {
r7 = currentNavigationRouteName === "channel";
}
return r7;
};
this.isSearchShowing = () => _this.chatChannelId != null && getIsChannelDetailsSearchActive(_this.chatChannelId);
this.getIsChatViewable = () => {
if (_this.chatChannelId == null) {
log();
return false;
}
if (ActionSheetStore.isOpen()) {
log();
return false;
}
if (AppStateStore.getState() !== AppStates.ACTIVE) {
log();
return false;
}
const type = ChannelStore.getChannel(_this.chatChannelId)?.type;
const chatOpen = ChannelRTCStore.getChatOpen(_this.chatChannelId);
const r36 = type === ChannelTypes.GUILD_STAGE_VOICE && chatOpen;
const openModalKey = getOpenModalKey();
const r43 = `voice-channel-${_this.chatChannelId}`;
if (openModalKey != null && openModalKey !== r43) {
log();
return false;
}
if (_this.isSearchShowing()) {
log();
return false;
}
if (AlertStore.getAlert() == null && !(useAlertStore.getState().alerts.length > 0)) {
const r63 = type === ChannelTypes.GUILD_VOICE && chatOpen;
let r64 = type != null && isTextChannel(type);
const isAnyVoicePanelOpen = VoicePanelStore.getState().isAnyVoicePanelOpen();
const isOnChannelNavigationRoute2 = _this.isOnChannelNavigationRoute();
if (r64) {
r64 = isOnChannelNavigationRoute2;
}
if (r64) {
r64 = !isAnyVoicePanelOpen;
}
if (r64) {
r64 = !r36;
}
if (r64) {
r64 = !r63;
}
if (!r64) {
r64 = r36;
}
if (!r64) {
r64 = r63;
}
log(_this.chatChannelId);
return r64;
}
log();
return false;
};
this.updateImpressionsForChatBecameViewable = () => {
log();
for (const item of _this.impressionCache.keys()) {
const key = item;
const r38 = _this.impressionCache.get(item);
if (r38 != null) {
const channelId = _this.parseCacheKey(key).channelId;
if (r38.isRunning) {
log(_this.chatChannelId);
_this.stopOne({
key,
shouldDelete: false
});
}
if (channelId === _this.chatChannelId) {
log(_this.chatChannelId);
const r64 = r38.clone({
triggeredByStatusChange: false
});
r64.start();
_this.impressionCache.set(key, r64);
}
}
}
};
this.refreshImpressions = () => {
if (_this.isChatViewable) {
_this.updateImpressionsForChatBecameViewable();
} else {
log();
_this.stopMany();
}
};
this.checkChatViewable = () => {
const isChatViewable = _this.getIsChatViewable();
let r0 = isChatViewable !== _this.isChatViewable;
if (r0) {
log();
_this.isChatViewable = isChatViewable;
_this.refreshImpressions();
r0 = true;
}
return r0;
};
this.checkIsOnChannelNavigationRoute = () => {
const isOnChannelNavigationRoute2 = _this.isOnChannelNavigationRoute();
if (isOnChannelNavigationRoute2 !== _this.wasOnChannelNavigationRoute) {
log();
_this.checkChatViewable();
_this.wasOnChannelNavigationRoute = isOnChannelNavigationRoute2;
}
};
this.checkSearchShowing = () => {
const isSearchShowing2 = _this.isSearchShowing();
if (isSearchShowing2 !== _this.wasSearchShowing) {
log();
_this.checkChatViewable();
_this.wasSearchShowing = isSearchShowing2;
}
};
this.onChannelChanged = (a0) => {
_this.previousChatChannelId = _this.chatChannelId;
_this.chatChannelId = a0;
_this.previousChatChannelId;
log(_this.chatChannelId);
_this.stopMany({
shouldDeleteHiddenEmbeds: true
});
if (!_this.checkChatViewable()) {
_this.refreshImpressions();
}
};
this.checkOpenModalKey = () => {
const openModalKey = getOpenModalKey();
if (openModalKey !== _this.previouslyOpenModalKey) {
log(_this.previouslyOpenModalKey);
_this.checkChatViewable();
_this.previouslyOpenModalKey = openModalKey;
}
};
this.handleQuestStoreChanged = () => {
log();
const set = new Set(QuestStore.quests.keys());
for (const item of _this.impressionCache.keys()) {
const key = item;
const r49 = _this.parseCacheKey(item);
if (set.has(r49.questId)) {
const r57 = QuestStore.quests.get(r49.questId);
const r62 = _this.questStatuses[r49.questId];
const r64 = r57 != null ? getQuestStatus(r57) : null;
if (r64 !== r62) {
_this.questStatuses[r49.questId] = r64;
if (_this.isChatViewable) {
const r82 = _this.impressionCache.get(key);
if (r82?.isRunning === true) {
if (r57 != null) {
const r95 = r82.clone({
triggeredByStatusChange: true
});
r95.start();
_this.impressionCache.set(key, r95);
} else {
_this.stopOne({
key,
shouldDelete: true
});
}
}
}
}
}
}
};
this.handleSelectedChannelStoreChanged = () => {
log();
const channelId = SelectedChannelStore.getChannelId();
if (channelId !== _this.chatChannelId) {
const channel = ChannelStore.getChannel(_this.chatChannelId);
const r18 = channel?.type != null && [ChannelTypes.GUILD_STAGE_VOICE, ChannelTypes.GUILD_VOICE].includes(channel?.type);
if (!(_this.chatChannelId != null && r18)) {
log(_this.chatChannelId);
_this.onChannelChanged(channelId);
}
}
};
this.handleActionSheetStoreChanged = () => {
log();
const isOpen = ActionSheetStore.isOpen();
if (isOpen !== _this.wasActionSheetOpen) {
log();
_this.checkChatViewable();
_this.wasActionSheetOpen = isOpen;
}
};
this.handleAppStateStoreChanged = () => {
log();
const wasAppActive = AppStateStore.getState() === AppStates.ACTIVE;
if (_this.wasAppActive !== wasAppActive) {
log();
_this.checkChatViewable();
_this.wasAppActive = wasAppActive;
}
};
this.handleVoicePanelStoreChanged = () => {
log();
const isAnyVoicePanelOpen = VoicePanelStore.getState().isAnyVoicePanelOpen();
if (isAnyVoicePanelOpen !== _this.wasAnyVoicePanelOpen) {
log();
_this.checkChatViewable();
_this.wasAnyVoicePanelOpen = isAnyVoicePanelOpen;
}
};
this.handleChannelDetailsStoreChanged = () => {
_this.checkSearchShowing();
};
this.handleChannelRTCStoreChanged = () => {
log();
const allChatOpen = ChannelRTCStore.getAllChatOpen();
const r7 = Set;
const r36 = [...Object.keys(_this.channelsWithChatOpen), ...Object.keys(allChatOpen)];
for (const item of new r7(r36)) {
const channel = ChannelStore.getChannel(item);
if (channel?.type == null) {
continue;
}
if (![ChannelTypes.GUILD_STAGE_VOICE, ChannelTypes.GUILD_VOICE].includes(channel?.type)) {
continue;
}
let r76 = _this.channelsWithChatOpen[item];
if (r76 == null) {
r76 = false;
}
const r77 = r76;
let r79 = allChatOpen[item];
if (r79 == null) {
r79 = false;
}
const r80 = r79;
if (r77 !== r79) {
if (r80 && item !== _this.chatChannelId) {
_this.onChannelChanged(item);
break;
}
if (!r80) {
if (_this.previousChatChannelId !== _this.chatChannelId) {
_this.onChannelChanged(_this.previousChatChannelId);
break;
}
}
_this.checkChatViewable();
break;
}
}
_this.channelsWithChatOpen = {
...allChatOpen
};
};
this.handleNavigationStateChanged = () => {
log();
_this.checkIsOnChannelNavigationRoute();
_this.checkOpenModalKey();
};
this.handleAlertStoreChanged = () => {
const wasAlertOpen = AlertStore.getAlert() != null || useAlertStore.getState().alerts.length > 0;
if (wasAlertOpen !== _this.wasAlertOpen) {
log();
_this.checkChatViewable();
_this.wasAlertOpen = wasAlertOpen;
}
};
this.unsubscribeFromVoicePanelStore = () => {};
this.unsubscribeFromChannelDetailsStore = () => {};
this.unsubscribeFromAlertStore = () => {};
this.stores = new Map().set(QuestStore, this.handleQuestStoreChanged).set(SelectedChannelStore, this.handleSelectedChannelStoreChanged).set(ActionSheetStore, this.handleActionSheetStoreChanged).set(AppStateStore, this.handleAppStateStoreChanged).set(ChannelRTCStore, this.handleChannelRTCStoreChanged).set(AlertStore, this.handleAlertStoreChanged);
this.actions = {
QUESTS_VISIBLE_MOBILE_MESSAGES_CHANGED: this.handleVisibleMessagesChanged
};
}
_initialize() {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.addListener("state", this.handleNavigationStateChanged);
}
this.unsubscribeFromVoicePanelStore = VoicePanelStore.subscribe(this.handleVoicePanelStoreChanged);
this.unsubscribeFromChannelDetailsStore = useChannelDetailsStore.subscribe(this.handleChannelDetailsStoreChanged);
this.unsubscribeFromAlertStore = useAlertStore.subscribe(this.handleAlertStoreChanged);
Reflect.get(Object.getPrototypeOf(prototype), "_initialize", this).call(this);
}
_terminate() {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.removeListener("state", this.handleNavigationStateChanged);
}
this.unsubscribeFromVoicePanelStore();
this.unsubscribeFromChannelDetailsStore();
this.unsubscribeFromAlertStore();
Reflect.get(Object.getPrototypeOf(prototype), "_terminate", this).call(this);
}
};
const prototype2 = QuestMobileEmbedVisibilityManager2.prototype;
QuestMobileEmbedVisibilityManager = QuestMobileEmbedVisibilityManager2;
prototype = prototype2;
const questMobileEmbedVisibilityManager = new QuestMobileEmbedVisibilityManager();
export default questMobileEmbedVisibilityManager;
@@ -0,0 +1,383 @@
// Metro module 16727 (f16728).
import EmbeddedActivitiesStore from "../../activities/EmbeddedActivitiesStore";
import FramesStore from "../../frames/FramesStore";
import RunningGameStore_native from "../../game_detection/RunningGameStore.native";
import ApplicationStreamingStore from "../../../stores/ApplicationStreamingStore";
import DetectableGameStore from "../../../stores/DetectableGameStore";
import SortedVoiceStateStore from "../../../stores/views/SortedVoiceStateStore";
import QuestStore from "../QuestStore";
import UnenrolledActivityQuestStore from "../UnenrolledActivityQuestStore";
import { QuestsExperimentLocations, DISCORD_APPLICATION_ID } from "../QuestConstants";
import Durations from "../../../utils/Durations";
import { getQuestLogger } from "../lib/getQuestLogger";
import * as _QuestDataUtils from "../utils/QuestDataUtils";
import { getEligibleQuestsForApplicationId } from "../utils/QuestMatchingUtils";
import { QuestVariants } from "../../../_bundle/Module5034";
import { sendHeartbeat } from "../QuestActionCreators";
import { ROBLOX_APPLICATION_ID } from "../../roblox_subgame_detection/RobloxSubgameTypes";
import { isRobloxSubgame } from "../../roblox_subgame_detection/RobloxSubgameUtils";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { FirstPartyQuestTaskTypes, FirstPartyQuestTaskTypesSets } from "../../../_bundle/Module5040";
import { getQuestTaskDetails, getDesktopApplicationIds, getStreamingApplicationId, getPlayActivityApplicationId } from "../utils/QuestTaskUtils";
import { encodeStreamKey } from "../../go_live/utils/StreamKeyUtils";
import { assertNever } from "../../../utils/GlobalUtils";
import { removeExecutablePathPrefix } from "../../game_detection/GameAnalyticsUtils";
import { isPlayAnyActivityQuest } from "../utils/QuestUtils";
function $mk118584($env) {
return (a0) => {
let r1 = a0 != null;
if (r1) {
r1 = a0.config.features.includes(QuestVariants.MANUAL_HEARTBEAT_INITIALIZATION);
}
return !r1;
};
}
let handleEmbeddedActivityLaunchSuccess, isQuestRobloxRelated, c12056_13, c12056_14, c12056_15, c12056_19;
let env12056 = {};
const isQuestProgressable = function isQuestProgressable(a0) {
const isQuestExpired = _QuestDataUtils.isQuestExpired(a0);
return (isQuestExpired ? !isQuestExpired : a0.userStatus != null) && a0.userStatus.enrolledAt != null && a0.userStatus.completedAt == null;
};
handleEmbeddedActivityLaunchSuccess = function handleEmbeddedActivityLaunchSuccess(a0) {
const autoEnroll = UnenrolledActivityQuestStore.getState().autoEnroll;
for (const item of getEligibleQuestsForApplicationId(QuestStore.quests, a0)) {
if (!autoEnroll) {
continue;
}
const features = item.config.features;
if (!features.includes(QuestVariants.MOBILE_ACTIVITY_QUEST)) {
continue;
}
return require(dependencyMap[16]).enrollInQuest(item.id, {
questContent: require(dependencyMap[17]).QuestContent.RUNNING_ACTIVITY,
questContentCTA: require(dependencyMap[18]).QuestContentCTA.START_QUEST,
sourceQuestContent: require(dependencyMap[17]).QuestContent.RUNNING_ACTIVITY
});
}
};
isQuestRobloxRelated = function isQuestRobloxRelated(a0, a1) {
return a1 != null && (a0.some((item) => item === ROBLOX_APPLICATION_ID) && isRobloxSubgame(a1));
};
c12056_13 = 1 * Durations.Millis.MINUTE;
c12056_14 = 1 * Durations.Millis.SECOND;
c12056_15 = getQuestLogger({
location: QuestsExperimentLocations.QUESTS_MANAGER
});
class QuestProgressManager extends AutomaticLifecycleManager {
constructor() {
let c23395_0, c23395_1;
super(...arguments);
const _this = this;
const heartbeats = {};
heartbeats[FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP] = new Map();
heartbeats[FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP] = new Map();
heartbeats[FirstPartyQuestTaskTypes.PLAY_ACTIVITY] = new Map();
this.heartbeats = heartbeats;
this.calculateHeartbeatDurationMs = (a0) => {
const r7 = QuestStore.quests.get(a0);
if (r7 != null && r7.config != null && r7.userStatus != null) {
const questTaskDetails = getQuestTaskDetails(r7, FirstPartyQuestTaskTypesSets.DESKTOP);
const r33 = Math.max(0, (questTaskDetails.targetSeconds - questTaskDetails.progressSeconds) * Durations.Millis.SECOND);
let r34 = c12056_13;
if (r33 <= r34) {
r34 = r33 + c12056_14;
}
return r34;
}
return c12056_13;
};
this.initiateHeartbeat = (a0, a1, c28507_2) => {
let maybeSendHeartbeat2;
const questId = a0;
const r11 = _this.heartbeats[a1];
let c28507_3 = r11;
if (r11.has(a0)) {
c12056_15.log(`~ initiateHeartbeat -> Heartbeat already initiated for questId: ${a0}`);
} else {
maybeSendHeartbeat2 = () => {
const activelyProgressingQuests = _this.getActivelyProgressingQuests(a1);
if (activelyProgressingQuests.has(questId)) {
const r30 = activelyProgressingQuests.get(questId);
let applicationId = r30?.applicationId;
if (applicationId == null) {
applicationId = c28507_2?.applicationId;
}
const executableFingerprint = r30?.executableFingerprint;
let executablePath = r30?.executablePath;
if (executablePath == null) {
executablePath = c28507_2?.executablePath;
}
if (a1 === FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP) {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
if (currentUserActiveStream == null) {
c12056_15.log(`~ initiateHeartbeat -> Attempted to beat for stream quest but no active stream, terminating heartbeat for questId: ${questId}`);
_this.terminateHeartbeat(questId, a1);
return void 0;
}
const streamKey = encodeStreamKey(currentUserActiveStream);
c12056_15.log(`~ initiateHeartbeat -> Sending heartbeat for questId: ${questId}`);
sendHeartbeat({
questId,
streamKey,
applicationId,
executablePath,
executableFingerprint
});
} else {
c12056_15.log(`~ initiateHeartbeat -> Sending heartbeat for questId: ${questId}`);
sendHeartbeat({
questId,
applicationId,
executablePath,
executableFingerprint
});
}
c28507_3.set(questId, window.setTimeout(maybeSendHeartbeat2, _this.calculateHeartbeatDurationMs(questId)));
} else {
c12056_15.log(`~ initiateHeartbeat -> Quest ${questId} is no longer actively progressing, terminating heartbeat`);
_this.terminateHeartbeat(questId, a1);
}
};
c12056_15.log(`~ initiateHeartbeat -> Initiating heartbeat for Quest ${a0}`);
maybeSendHeartbeat2();
}
};
this.terminateHeartbeat = (a0, a1) => {
const r10 = _this.heartbeats[a1];
const r12 = r10.get(a0);
if (r12 != null) {
c12056_15.log(`~ terminateHeartbeat -> Terminating heartbeat for questId: ${a0}`);
window.clearTimeout(r12);
r10.delete(a0);
const r29 = QuestStore.quests.get(a0);
let r1 = r29 != null;
if (r1) {
const isQuestExpired = _QuestDataUtils.isQuestExpired(r29);
r1 = (isQuestExpired ? !isQuestExpired : r29.userStatus != null) && r29.userStatus.enrolledAt != null && r29.userStatus.completedAt == null;
}
if (r1) {
c12056_15.log(`~ terminateHeartbeat -> Sending terminal heartbeat for questId: ${a0}`);
sendHeartbeat({
questId: a0,
terminal: true
});
}
}
};
this.handleSendHeartbeatSuccess = ({ questId: questId3, userStatus }) => {
c12056_15.log(`~ handleSendHeartbeatSuccess -> Heartbeat succeeded for questId: ${questId3})`);
if (userStatus.completedAt != null) {
c12056_15.log(`~ handleSendHeartbeatSuccess -> Quest ${questId3} completed, terminating any heartbeats for it`);
for (const item of Object.keys(_this.heartbeats)) {
_this.terminateHeartbeat(questId3, item);
}
}
};
this.handleSendHeartbeatFailure = (a0) => {
c12056_15.log(`~ handleSendHeartbeatFailure -> Heartbeat failed for questId: ${a0.questId}`);
};
const actions = {
QUESTS_FETCH_CURRENT_QUESTS_SUCCESS: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP, FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP], "QUESTS_FETCH_CURRENT_QUESTS_SUCCESS"),
QUESTS_ENROLL_SUCCESS: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP, FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ACTIVITY], "QUESTS_ENROLL_SUCCESS", (a0) => !(a0 != null && a0.config.features.includes(QuestVariants.MANUAL_HEARTBEAT_INITIALIZATION))),
QUESTS_SEND_HEARTBEAT_SUCCESS: this.handleSendHeartbeatSuccess,
QUESTS_SEND_HEARTBEAT_FAILURE: this.handleSendHeartbeatFailure,
QUESTS_PREVIEW_UPDATE_SUCCESS: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP, FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP, FirstPartyQuestTaskTypes.PLAY_ACTIVITY], "QUESTS_PREVIEW_UPDATE_SUCCESS"),
RUNNING_GAMES_CHANGE: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP], "RUNNING_GAMES_CHANGE"),
RUNNING_NON_GAMES_CHANGE: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP], "RUNNING_NON_GAMES_CHANGE"),
STREAM_START: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP], "STREAM_START"),
STREAM_CREATE: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP], "STREAM_CREATE"),
STREAM_CLOSE: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP], "STREAM_CLOSE"),
PASSIVE_UPDATE_V2: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP], "PASSIVE_UPDATE_V2"),
VOICE_STATE_UPDATES: () => _this.syncHeartbeats([FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP], "VOICE_STATE_UPDATES"),
EMBEDDED_ACTIVITY_LAUNCH_SUCCESS: (a0) => {
handleEmbeddedActivityLaunchSuccess(a0.applicationId);
},
FRAME_LAUNCH: null,
FRAME_STOP: null,
EMBEDDED_ACTIVITY_UPDATE_V2: null,
QUEST_APPLICATION_START_TIMER: null
};
c23395_0 = void 0;
c23395_1 = this;
c23395_0 = async (c31107_0) => {
let c31107_2;
let env31840;
c31107_2 = void 0;
const r9 = env31840 = {
$parent: env12056
};
let c31107_1 = r9;
env31840[0] = void 0;
env31840[0] = c31107_0.applicationId;
await void 0;
await (0, handleEmbeddedActivityLaunchSuccess)(env31840[0]);
c23395_1.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ACTIVITY], "FRAME_LAUNCH", $mk118584(env12056));
};
actions.FRAME_LAUNCH = function FRAME_LAUNCH(a0) {
return c23395_0.apply(this, arguments);
};
actions.FRAME_STOP = () => {
_this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ACTIVITY], "FRAME_STOP");
};
actions.EMBEDDED_ACTIVITY_UPDATE_V2 = () => {
_this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ACTIVITY], "EMBEDDED_ACTIVITY_UPDATE_V2", (a0) => !(a0 != null && a0.config.features.includes(QuestVariants.MANUAL_HEARTBEAT_INITIALIZATION)));
};
actions.QUEST_APPLICATION_START_TIMER = ({ questId: questId2 }) => {
_this.syncHeartbeats([FirstPartyQuestTaskTypes.PLAY_ACTIVITY], "QUEST_APPLICATION_START_TIMER", (a0) => a0 != null && a0.id === questId2 && (a0 != null && a0.config.features.includes(QuestVariants.MANUAL_HEARTBEAT_INITIALIZATION)));
};
this.actions = actions;
}
syncHeartbeats(a0, a1, a2) {}
getActivelyProgressingQuests(a0) {
if (FirstPartyQuestTaskTypes.PLAY_ON_DESKTOP === a0) {
return this.getActivelyProgressingPlayOnDesktopQuests();
}
if (FirstPartyQuestTaskTypes.STREAM_ON_DESKTOP === a0) {
return this.getActivelyProgressingStreamOnDesktopQuests();
}
if (FirstPartyQuestTaskTypes.PLAY_ACTIVITY === a0) {
return this.getActivelyProgressingActivityQuests();
}
assertNever(a0);
}
getActivelyProgressingPlayOnDesktopQuests() {
let r30;
const map = new Map();
let c23396_0 = map;
const runningGames = RunningGameStore_native.getRunningGames();
const runningNonGames = RunningGameStore_native.getRunningNonGames();
const quests = QuestStore.quests;
c12056_15.log("~ getActivelyProgressingPlayOnDesktopQuestIds -> Running games: ", runningGames, "Running non-games: ", runningNonGames);
const r41 = {};
let c23396_2 = r41;
let r43 = runningGames[Symbol.iterator]();
const next = r43.next;
while (true) {
const r47 = r43 === void 0 ? void 0 : (r30 = next.call(r43)).done ? r43 = void 0 : r30.value;
if (r43 === void 0) {
for (const item of runningNonGames) {
if (item.id != null) {
r41[item.id] = item;
}
}
const _loop = function _loop(a0) {
const r9 = c23396_2[a0];
const executablePath = removeExecutablePathPrefix(r9.exePath);
for (const item of quests.values()) {
const desktopApplicationIds = getDesktopApplicationIds(item);
if (isQuestProgressable(item) && desktopApplicationIds != null) {
const applicationId = desktopApplicationIds.find((desktopApplicationId) => desktopApplicationId === a0);
if (applicationId != null) {
c23396_0.set(item.id, {
applicationId,
executablePath,
executableFingerprint: r9.executableFingerprint
});
} else if (isQuestRobloxRelated(desktopApplicationIds, r9)) {
c23396_0.set(item.id, {
applicationId: require(dependencyMap[19]).ROBLOX_APPLICATION_ID,
executablePath,
executableFingerprint: r9.executableFingerprint
});
}
}
}
};
for (const item2 of Object.keys(r41)) {
_loop(item2);
}
c12056_15.log("~ getActivelyProgressingPlayOnDesktopQuestIds -> Actively progressing questIds: ", Array.from(map.keys()));
return map;
} else {
try {
if (!r47.isLauncher) {
if (r47.id == null) {
const overrideForGame = RunningGameStore_native.getOverrideForGame(r47);
if (r47.distributor == null && overrideForGame != null) {
continue;
}
const r62 = DetectableGameStore.findGame(r47);
if (r62?.id != null) {
r41[r62.id] = r47;
}
} else {
r41[r47.id] = r47;
}
}
} catch (r69) {
if (r43 !== void 0 && typeof r43.return === "function") {
try {
r43.return();
} catch {}
}
throw r69;
}
}
}
}
getActivelyProgressingStreamOnDesktopQuests() {
const map = new Map();
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
if (currentUserActiveStream == null) {
return map;
}
if (SortedVoiceStateStore.countVoiceStatesForChannel(currentUserActiveStream.channelId) < 2) {
return map;
}
const streamerActiveStreamMetadata = ApplicationStreamingStore.getStreamerActiveStreamMetadata();
if (streamerActiveStreamMetadata == null) {
return map;
}
c12056_15.log("~ getActivelyProgressingStreamOnDesktopQuestIds -> Active stream metadata: ", streamerActiveStreamMetadata);
const id = streamerActiveStreamMetadata.id;
if (id == null) {
return map;
}
for (const item of QuestStore.quests.values()) {
const streamingApplicationId = getStreamingApplicationId(item);
if (isQuestProgressable(item) && streamingApplicationId != null && streamingApplicationId === id) {
map.set(item.id, {
applicationId: id
});
}
}
c12056_15.log("~ getActivelyProgressingStreamOnDesktopQuestIds -> Actively progressing questIds: ", Array.from(map.keys()));
return map;
}
getActivelyProgressingActivityQuests() {
const map = new Map();
const selfEmbeddedActivities = EmbeddedActivitiesStore.getSelfEmbeddedActivities();
const connectedFrame = FramesStore.getConnectedFrame();
const set = new Set(selfEmbeddedActivities.keys());
if (connectedFrame != null) {
set.add(connectedFrame.applicationId);
}
c12056_15.log("~ getActivelyProgressingActivityQuestIds -> Running activity applicationIds: ", Array.from(set));
if (set.size === 0) {
return map;
}
for (const item2 of set) {
const applicationId = item2;
for (const item of QuestStore.quests.values()) {
const playActivityApplicationId = getPlayActivityApplicationId(item);
if (isQuestProgressable(item) && playActivityApplicationId != null && playActivityApplicationId === applicationId) {
map.set(item.id, {
applicationId
});
}
}
}
for (const item3 of QuestStore.quests.values()) {
if (isQuestProgressable(item3) && isPlayAnyActivityQuest(item3)) {
map.set(item3.id, {
applicationId: DISCORD_APPLICATION_ID
});
}
}
c12056_15.log("~ getActivelyProgressingActivityQuestIds -> Actively progressing questIds: ", Array.from(map.keys()));
return map;
}
}
c12056_19 = QuestProgressManager;
const r75 = new QuestProgressManager();
export default r75;
@@ -0,0 +1,25 @@
// Metro module 16134 (f16135).
import AutomaticLifecycleManager from "../../../../lib/AutomaticLifecycleManager";
import { fetchAdUser } from "../../../ads/native/AdUserActionCreators.android";
import SentryUtils_native from "../../../../utils/SentryUtils.native";
class ATTManager extends AutomaticLifecycleManager {
_openATTPrePromptOrFlowTimeoutId = null;
actions = {
POST_CONNECTION_OPEN: this.onPostConnectionOpen
};
onPostConnectionOpen() {
try {
fetchAdUser("post_connection_open");
} catch ($e) {
SentryUtils_native.captureException($e);
}
}
_terminate() {
if (this._openATTPrePromptOrFlowTimeoutId != null) {
clearTimeout(this._openATTPrePromptOrFlowTimeoutId);
this._openATTPrePromptOrFlowTimeoutId = null;
}
}
}
const aTTManager = new ATTManager();
export default aTTManager;
+739
View File
@@ -0,0 +1,739 @@
// Metro module 14045 (f14046).
import { memo, useRef, useState, useCallback, useImperativeHandle, useEffect, useLayoutEffect } from "react";
import { ActivityIndicator, Pressable, View, StyleSheet } from "react-native";
import AppStateStore from "../../../stores/native/AppStateStore";
import { AppStates, ComponentActions } from "../../../Constants";
import Module712 from "../../../_bundle/Module712";
import Video from "../../../_bundle/Video_8143";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module689 from "../../../_bundle/Module689";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _spring from "../../../design/animation/reanimated/spring/spring";
import * as _springPresets from "../../../design/animation/reanimated/spring/springPresets";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../design/animation/reanimated/timing/timingPresets";
import { ComponentDispatch } from "../../../utils/ComponentDispatchUtils";
import { useStateFromStores } from "../../../_bundle/Module589";
import { isAndroid, isIOS } from "../../../utils/PlatformUtils";
import SentryUtils_native from "../../../utils/SentryUtils.native";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { intl, t } from "../../../intl/index.native";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { ClosedCaptionsOutlineIcon } from "../../../design/components/Icon/native/redesign/generated/ClosedCaptionsOutlineIcon";
import { TranscriptOutlineIcon } from "../../../design/components/Icon/native/redesign/generated/TranscriptOutlineIcon";
import { VideoQuestPlayerControlButton } from "./VideoQuestModal/VideoQuestPlayerControlButton";
import { SkipBackwardIcon } from "./VideoQuestModal/icons/SkipBackwardIcon";
import { RetryIcon } from "../../../design/components/Icon/native/redesign/generated/RetryIcon";
import { PlayIcon } from "../../../design/components/Icon/native/redesign/generated/PlayIcon";
import { PauseIcon } from "../../../design/components/Icon/native/redesign/generated/PauseIcon";
import { SkipForwardIcon } from "./VideoQuestModal/icons/SkipForwardIcon";
import { FullscreenEnterIcon } from "../../../design/components/Icon/native/redesign/generated/FullscreenEnterIcon";
let hasVideoEnded, canSeekForward, useStyles, PlayerState, c9821_19, __initData, __initData2, __initData3;
let c9821_13 = {
left: Module712.space.PX_16,
right: Module712.space.PX_16,
top: Module712.space.PX_16,
bottom: Module712.space.PX_16
};
let Component = memo(Video);
const hasVideoEnded2 = function hasVideoEnded(a0, a1) {
return a0 >= a1 - 1;
};
hasVideoEnded2.__closure = {};
hasVideoEnded2.__workletHash = 8992945176371;
hasVideoEnded2.__initData = {
code: "function hasVideoEnded_AdVideoPlayerTsx1(currentTime,videoDuration){return currentTime>=videoDuration-1;}"
};
hasVideoEnded = hasVideoEnded2;
const canSeekForward2 = function canSeekForward(a0, a1, a2, a3) {
const r2 = a0 >= a2 - 1;
return r2 ? !r2 : a3 ? a3 : a0 <= a1 - 1;
};
canSeekForward2.__closure = {
hasVideoEnded
};
canSeekForward2.__workletHash = 14098132092693;
canSeekForward2.__initData = {
code: "function canSeekForward_AdVideoPlayerTsx2(currentTime,maxTimestamp,videoDuration,allowUnrestrictedSeeking){const{hasVideoEnded}=this.__closure;return!hasVideoEnded(currentTime,videoDuration)&&(allowUnrestrictedSeeking||currentTime<=maxTimestamp-1);}"
};
canSeekForward = canSeekForward2;
useStyles = createStyles({
container: {
...StyleSheet.absoluteFillObject
},
loadingContainer: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
justifyContent: "center",
alignItems: "center"
},
bufferingSpinner: {
position: "absolute"
},
bufferingSpinnerCentered: {
...StyleSheet.absoluteFillObject,
justifyContent: "center",
alignItems: "center"
},
video: {
height: "100%",
width: "100%"
},
videoContainer: {
position: "relative",
height: "100%",
width: "100%"
},
controls: {
...StyleSheet.absoluteFillObject,
backgroundColor: Module689(Module712.unsafe_rawColors.BLACK).alpha(0.5).hex(),
justifyContent: "center",
alignItems: "center",
flexDirection: "column"
},
controlsTopBottom: {
flexDirection: "row",
justifyContent: "flex-end",
padding: Module712.space.PX_8,
position: "absolute",
left: 0,
right: 0
},
controlsMiddle: {
justifyContent: "center",
alignItems: "center",
flexGrow: 1,
flexDirection: "row",
gap: Module712.space.PX_24,
pointerEvents: "box-none"
},
controlsTop: {
top: 0
},
controlsBottom: {
bottom: 0
},
progressContainer: {
position: "absolute",
bottom: 0,
right: 0,
left: 0,
justifyContent: "flex-end",
height: Module712.space.PX_16,
overflow: "hidden"
},
progress: {
height: 1,
backgroundColor: Module712.colors.WHITE,
shadowOffset: {
width: 0,
height: 0
},
shadowRadius: 6,
shadowOpacity: 1,
elevation: 5,
shadowColor: Module712.colors.WHITE
},
icon: {
color: Module712.colors.TEXT_DEFAULT
},
iconDisabled: {
color: Module712.colors.TEXT_SUBTLE
},
controlButton: {
padding: Module712.space.PX_8
}
});
PlayerState = {
PAUSED: "paused",
PLAYING: "playing",
ENDED: "ended",
LOADING: "loading",
ERRORED: "errored"
};
c9821_19 = {
USER_INTERACTION: "USER_INTERACTION",
SYSTEM_INITIATED: "SYSTEM_INITIATED",
IMPERATIVE_API: "IMPERATIVE_API"
};
__initData = {
code: "function shouldShowControls_AdVideoPlayerTsx3(){const{hasLoaded,hideControls,showControls,playerState,PlayerState,isVideoEnded}=this.__closure;return hasLoaded&&!hideControls&&(showControls.get()||playerState===PlayerState.PAUSED||playerState===PlayerState.ENDED||playerState===PlayerState.ERRORED||isVideoEnded);}"
};
__initData2 = {
code: "function AdVideoPlayerTsx4(){const{shouldShowControls,withSpring,SUBTLE_SPRING}=this.__closure;const show=shouldShowControls();return{opacity:withSpring(show?1:0,SUBTLE_SPRING),pointerEvents:show?'auto':'none'};}"
};
__initData3 = {
code: "function AdVideoPlayerTsx5(){const{withTiming,progressSharedValue,timingFast}=this.__closure;return{width:withTiming(progressSharedValue.get()*100+\"%\",timingFast,'animate-always')};}"
};
const r162 = memo(function(a0) {
let r351, R3aFPe, children3;
let c20872_28, sharedValue, shouldShowControls2, sharedValue2, ref5, callback2, setState5, callback3, callback4, ref6, callback5, callback6, c20872_40, callback7;
const { source, initialProgress, contentDuration = 0 } = a0;
let allowUnrestrictedSeeking = a0.allowUnrestrictedSeeking;
if (allowUnrestrictedSeeking === void 0) {
allowUnrestrictedSeeking = false;
}
let c20872_1 = allowUnrestrictedSeeking;
let disableResumeOnLoad = a0.disableResumeOnLoad;
if (disableResumeOnLoad === void 0) {
disableResumeOnLoad = false;
}
let c20872_2 = disableResumeOnLoad;
const { style, isFullscreen, externallyPaused, contentInsets, captionsEnabled = false, onToggleCaptions, onOpenTranscript, onToggleFullscreen, renderCaptions, onLoadStart, onLoad, onReadyForDisplay, onProgress, onSeek, onBuffer: onBuffer2, onError, onEnd, onPlayerStateChange, onPausePlayback, onResumePlayback, onVideoTracks, onVideoLayout } = a0;
let videoRef = a0.videoRef;
let bufferingSpinnerPlacement = a0.bufferingSpinnerPlacement;
if (bufferingSpinnerPlacement === void 0) {
bufferingSpinnerPlacement = "top-left";
}
let showCaptionsButton = a0.showCaptionsButton;
if (showCaptionsButton === void 0) {
showCaptionsButton = false;
}
let showTranscriptButton = a0.showTranscriptButton;
if (showTranscriptButton === void 0) {
showTranscriptButton = false;
}
let showFullscreenButton = a0.showFullscreenButton;
if (showFullscreenButton === void 0) {
showFullscreenButton = false;
}
let showProgress = a0.showProgress;
if (showProgress === void 0) {
showProgress = false;
}
let showSkipButtons = a0.showSkipButtons;
if (showSkipButtons === void 0) {
showSkipButtons = true;
}
let hideControls = a0.hideControls;
if (hideControls === void 0) {
hideControls = false;
}
let c20872_13 = hideControls;
const { httpEngine, automaticallyWaitsToMinimizeStalling, maxBitRate, bufferConfig, preferredForwardBufferDuration, repeat = false } = a0;
let c20872_14 = repeat;
const ref8 = a0.ref;
c20872_28 = void 0;
sharedValue = void 0;
shouldShowControls2 = void 0;
sharedValue2 = void 0;
ref5 = void 0;
callback2 = void 0;
setState5 = void 0;
callback3 = void 0;
callback4 = void 0;
ref6 = void 0;
callback5 = void 0;
callback6 = void 0;
c20872_40 = void 0;
callback7 = void 0;
const styles = useStyles();
const ref9 = useRef(null);
if (videoRef == null) {
videoRef = ref9;
}
const ref = videoRef;
const [state, setState] = useState(contentDuration);
const [state2, setState2] = useState({
...initialProgress
});
const [state3, setState3] = useState(PlayerState.LOADING);
let [state5, setState4] = useState(false);
const state4 = state5;
const ref2 = useRef(null);
const ref3 = useRef(0);
const ref4 = useRef([]);
const callback = useCallback((a0) => {
setState3(a0);
if (onPlayerStateChange != null) {
onPlayerStateChange(a0);
}
}, [onPlayerStateChange]);
const isVideoEnded = (state4 ? state3 === PlayerState.ENDED : state4) && state2.timestampSec >= state2.duration - 1;
c20872_28 = isVideoEnded;
sharedValue = useSharedValue(false);
const shouldShowControls = function shouldShowControls() {
let r1 = state4;
if (state4) {
r1 = !c20872_13;
}
if (r1) {
r1 = sharedValue.get() || state3 === PlayerState.PAUSED || state3 === PlayerState.ENDED || state3 === PlayerState.ERRORED || c20872_28;
}
return r1;
};
shouldShowControls.__closure = {
hasLoaded: state4,
hideControls,
showControls: sharedValue,
playerState: state3,
PlayerState,
isVideoEnded
};
shouldShowControls.__workletHash = 8094403036162;
shouldShowControls.__initData = __initData;
shouldShowControls2 = shouldShowControls;
const Se = function Se() {
let r5 = state4;
if (state4) {
r5 = !c20872_13;
}
if (r5) {
r5 = sharedValue.get() || state3 === PlayerState.PAUSED || state3 === PlayerState.ENDED || state3 === PlayerState.ERRORED || c20872_28;
}
return {
opacity: _spring.withSpring(r5 ? 1 : 0, _springPresets.SUBTLE_SPRING),
pointerEvents: r5 ? "auto" : "none"
};
};
Se.__closure = {
shouldShowControls: shouldShowControls2,
withSpring: _spring.withSpring,
SUBTLE_SPRING: _springPresets.SUBTLE_SPRING
};
Se.__workletHash = 311315682972;
Se.__initData = __initData2;
const animatedStyle = useAnimatedStyle(Se);
if (state4) {
state5 = !hideControls;
}
if (state5) {
state5 = sharedValue.get() || state3 === PlayerState.PAUSED || state3 === PlayerState.ENDED || state3 === PlayerState.ERRORED || isVideoEnded;
}
sharedValue2 = useSharedValue(0);
const pe = () => ({
width: _timing.withTiming(100 * sharedValue2.get() + "%", _timingPresets.timingFast, "animate-always")
});
pe.__closure = {
withTiming: _timing.withTiming,
progressSharedValue: sharedValue2,
timingFast: _timingPresets.timingFast
};
pe.__workletHash = 11793601648786;
pe.__initData = __initData3;
const animatedStyle2 = useAnimatedStyle(pe);
ref5 = useRef(-1);
const callback8 = useCallback((c27618_0) => function(...args) {
clearTimeout(ref5.current);
sharedValue.set(true);
ref5.current = setTimeout(() => {
sharedValue.set(false);
}, 2000);
if (c27618_0 != null) {
return c27618_0.apply(void 0, [...args]);
}
}, [sharedValue]);
callback2 = useCallback((timestampSec, duration) => {
setState2((prevState2) => ({
timestampSec,
maxTimestampSec: Math.max(prevState2.maxTimestampSec, Math.floor(timestampSec)),
duration
}));
}, []);
let state6;
[state6, setState5] = useState(false);
const callback9 = useCallback(() => {
if (onReadyForDisplay != null) {
onReadyForDisplay();
}
setState5(true);
}, [onReadyForDisplay]);
callback3 = useCallback((a0) => {
if (ref.current != null) {
const current2 = Math.max(0, Math.min(a0, c20872_1 ? state2.duration : state2.maxTimestampSec));
ref3.current = (ref3.current + 1) % 100;
ref.current.seek(current2 + 0.0001 * ref3.current);
ref2.current = current2;
}
}, [allowUnrestrictedSeeking, state2.duration, state2.maxTimestampSec, ref]);
useImperativeHandle(ref8, () => ({
seekToStart: () => {
if (state3 !== PlayerState.ERRORED) {
callback3(0);
if (state3 === PlayerState.ENDED) {
callback(PlayerState.PLAYING);
if (onResumePlayback != null) {
onResumePlayback(c9821_19.IMPERATIVE_API);
}
}
}
},
play: () => {
if (state3 === PlayerState.PAUSED) {
callback(PlayerState.PLAYING);
if (onResumePlayback != null) {
onResumePlayback(c9821_19.IMPERATIVE_API);
}
}
},
pause: () => {
if (state3 === PlayerState.PLAYING) {
callback(PlayerState.PAUSED);
if (onPausePlayback != null) {
onPausePlayback(c9821_19.IMPERATIVE_API);
}
}
}
}), [callback3, state3, callback, onResumePlayback, onPausePlayback]);
const callback10 = useCallback((a0) => {
const duration2 = a0.duration;
setState(duration2);
setState4(true);
if (ref.current != null) {
const timestampSec2 = initialProgress.timestampSec;
if ((c20872_2 ? !c20872_2 : timestampSec2 > 5) && timestampSec2 < duration2 - 3) {
callback3(timestampSec2 - 1);
}
callback(PlayerState.PLAYING);
if (onLoad != null) {
onLoad(a0);
}
}
}, [ref, initialProgress.timestampSec, disableResumeOnLoad, callback, onLoad, callback3]);
callback4 = useCallback(function(r3 = {}) {
let shouldRestartVideo = r3.shouldRestartVideo;
if (shouldRestartVideo === void 0) {
shouldRestartVideo = true;
}
L16: {
L14: {
if (state3 !== PlayerState.ERRORED) {
if (c20872_28 && shouldRestartVideo) {
break L14;
}
if (state3 !== PlayerState.PAUSED && state3 !== PlayerState.LOADING) {
if (state3 !== PlayerState.PLAYING) {
break L16;
}
callback(PlayerState.PAUSED);
if (onPausePlayback == null) {
break L16;
}
onPausePlayback(c9821_19.USER_INTERACTION);
break L16;
}
callback(PlayerState.PLAYING);
if (onResumePlayback == null) {
break L16;
}
onResumePlayback(c9821_19.USER_INTERACTION);
break L16;
}
}
callback3(0);
callback(PlayerState.PLAYING);
if (onResumePlayback != null) {
onResumePlayback(c9821_19.USER_INTERACTION);
}
}
}, [state3, onPausePlayback, onResumePlayback, isVideoEnded, callback, callback3]);
const callback11 = useCallback(() => callback4(), [callback4]);
ref6 = useRef(false);
callback5 = useCallback(() => {
ref6.current = false;
if (state3 === PlayerState.PLAYING) {
ref6.current = true;
callback(PlayerState.PAUSED);
if (onPausePlayback != null) {
onPausePlayback(c9821_19.SYSTEM_INITIATED);
}
}
}, [state3, callback, onPausePlayback]);
callback6 = useCallback(() => {
if (ref6.current) {
ref6.current = false;
if (state3 !== PlayerState.ERRORED) {
callback(PlayerState.PLAYING);
if (onResumePlayback != null) {
onResumePlayback(c9821_19.SYSTEM_INITIATED);
}
}
}
}, [state3, callback, onResumePlayback]);
useEffect(() => {
ComponentDispatch.subscribe(ComponentActions.QUEST_GAME_LINK_OPENED, callback5);
ComponentDispatch.subscribe(ComponentActions.QUEST_APP_STORE_OVERLAY_FINISHED, callback6);
return () => {
ComponentDispatch.unsubscribe(ComponentActions.QUEST_GAME_LINK_OPENED, callback5);
ComponentDispatch.unsubscribe(ComponentActions.QUEST_APP_STORE_OVERLAY_FINISHED, callback6);
};
}, [callback5, callback6]);
const callback12 = useCallback(() => {
if (sharedValue.get()) {
sharedValue.set(false);
}
callback4({
shouldRestartVideo: false
});
}, [sharedValue, callback4]);
const callback13 = useCallback((a0) => {
let fromTimeSec = ref4.current.shift();
if (fromTimeSec == null) {
fromTimeSec = null;
}
if (ref.current != null) {
ref2.current = null;
if (state > 0) {
sharedValue2.set(a0.currentTime / state);
callback2(a0.currentTime, state);
}
if (onSeek != null) {
onSeek({
...a0,
fromTimeSec
});
}
}
}, [state, sharedValue2, onSeek, callback2, ref]);
let disabled = state3 === PlayerState.ERRORED;
if (!disabled) {
const { timestampSec: timestampSec2, maxTimestampSec } = state2;
const r8 = timestampSec2 >= state2.duration - 1;
let r229 = !r8;
if (!r8) {
if (!allowUnrestrictedSeeking) {
allowUnrestrictedSeeking = timestampSec2 <= maxTimestampSec - 1;
}
r229 = allowUnrestrictedSeeking;
}
disabled = !r229;
}
c20872_40 = disabled;
const callback14 = useCallback(() => {
if (!c20872_40) {
let current2 = ref2.current;
if (current2 == null) {
current2 = sharedValue2.get() * state;
}
ref4.current.push(current2);
callback3(current2 + 10);
}
}, [callback3, state, sharedValue2, disabled]);
const onPress = callback8(useCallback(() => {
let current2 = ref2.current;
if (current2 == null) {
current2 = sharedValue2.get() * state;
}
ref4.current.push(current2);
callback3(current2 - 10);
if (state3 === PlayerState.ENDED) {
callback(PlayerState.PLAYING);
}
}, [callback3, state, sharedValue2, state3, callback]));
const onPress2 = callback8(callback14);
const callback15 = useCallback((a0) => {
const r2 = a0.seekableDuration !== 0 ? a0.currentTime / a0.seekableDuration : 0;
callback2(a0.currentTime, a0.seekableDuration);
sharedValue2.set(r2);
const progress = r2;
if (onProgress != null) {
onProgress({
currentTime: a0.currentTime,
seekableDuration: a0.seekableDuration,
progress
});
}
}, [sharedValue2, callback2, onProgress]);
const callback16 = useCallback(() => {
if (!c20872_14) {
callback(PlayerState.ENDED);
}
if (onEnd != null) {
onEnd();
}
}, [callback, onEnd, repeat]);
const callback17 = useCallback(() => {
callback(PlayerState.LOADING);
if (onLoadStart != null) {
onLoadStart();
}
}, [callback, onLoadStart]);
const callback18 = useCallback((a0) => {
callback(PlayerState.ERRORED);
if (onError != null) {
onError(a0);
}
}, [callback, onError]);
const r266 = useStateFromStores([AppStateStore], () => AppStateStore.getState()) === AppStates.ACTIVE;
useLayoutEffect(() => {
if (isAndroid()) {
const current = ref.current;
return () => {
try {
if (current != null) {
const setNativeProps = current.setNativeProps;
if (setNativeProps != null) {
setNativeProps.call(current, {
paused: true,
repeat: false,
src: {
uri: null
}
});
}
}
} catch ($e) {
SentryUtils_native.captureException($e);
}
};
}
}, [ref]);
const paused = (r266 ? state3 === PlayerState.PAUSED : !r266) || state3 === PlayerState.LOADING || externallyPaused;
const onBuffer = onBuffer2;
const ref7 = useRef(false);
let [state7, setState6] = useState(false);
callback7 = useCallback((a0) => {
setState6(a0);
if (a0 !== ref7.current) {
ref7.current = a0;
if (onBuffer != null) {
onBuffer(a0);
}
}
}, [onBuffer]);
const callback19 = useCallback((a0) => {
let isBuffering;
L6: {
L4: {
isBuffering = a0.isBuffering;
if (isBuffering) {
if (state3 !== PlayerState.LOADING && isIOS()) {
break L4;
}
callback7(true);
break L6;
}
}
if (!isBuffering) {
callback7(false);
}
}
}, [callback7, state3]);
const callback20 = useCallback(() => {
if (isIOS()) {
callback7(true);
}
}, [callback7]);
const callback21 = useCallback(() => {
if (isIOS()) {
callback7(false);
}
}, [callback7]);
const safeAreaInsets_native = useSafeAreaInsets_native();
const r302 = isFullscreen && safeAreaInsets_native != null && {
paddingRight: Math.max(safeAreaInsets_native.right, c9821_13.right),
paddingLeft: Math.max(safeAreaInsets_native.left, c9821_13.left)
};
const props = {
style: [styles.container, style],
accessible: false,
children: null
};
const props2 = {
style: [styles.videoContainer],
onPress: callback12,
accessible: !state5,
accessibilityLabel: intl.string(paused ? t.R3aFPe : t.fTMEUi),
children: null
};
const children = [state3 !== PlayerState.ERRORED && <Component mixWithOthers="inherit" httpEngine={httpEngine} automaticallyWaitsToMinimizeStalling={automaticallyWaitsToMinimizeStalling} maxBitRate={maxBitRate} bufferConfig={bufferConfig} preferredForwardBufferDuration={preferredForwardBufferDuration} ref={ref} accessible={false} importantForAccessibility="no-hide-descendants" accessibilityRole="none" style={styles.video} paused={paused} repeat={repeat} source={source} onBuffer={callback19} onPlaybackStalled={callback20} onPlaybackResume={callback21} onLoad={callback10} onSeek={callback13} onProgress={callback15} onLoadStart={callback17} onEnd={callback16} onError={callback18} onReadyForDisplay={callback9} onVideoTracks={onVideoTracks} onLayout={onVideoLayout} resizeMode="contain" />, renderCaptions == null ? void 0 : renderCaptions(state2.timestampSec), , , , ,];
if (state7) {
const style2 = [styles.bufferingSpinner, ,];
if (!isFullscreen && bufferingSpinnerPlacement !== "center") {
let top = contentInsets?.top;
if (top == null) {
top = 0;
}
let left = contentInsets?.left;
if (left == null) {
left = 0;
}
r351 = {
top,
left
};
} else {
r351 = styles.bufferingSpinnerCentered;
}
style2[1] = r351;
state7 = <ActivityIndicator animating style={style2} color={Module712.unsafe_rawColors.WHITE} />;
}
children[2] = state7;
children[3] = state6 ? !state6 : <View style={styles.loadingContainer}>
<ActivityIndicator animating />
</View>;
const props3 = {
style: [styles.controls, animatedStyle],
accessible: false,
children: null
};
let r371 = showCaptionsButton ? showCaptionsButton : showTranscriptButton;
if (r371) {
if (showCaptionsButton) {
showCaptionsButton = <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.bDSZO1)} onPress={onToggleCaptions} style={styles.controlButton}>
<ClosedCaptionsOutlineIcon color={captionsEnabled ? styles.icon.color : styles.iconDisabled.color} />
</PressableOpacity>;
}
const r398 = [showCaptionsButton, ,];
if (showTranscriptButton) {
showTranscriptButton = <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.KCzjTi)} onPress={onOpenTranscript} style={styles.controlButton}>
<TranscriptOutlineIcon color={styles.iconDisabled.color} />
</PressableOpacity>;
}
r398[1] = showTranscriptButton;
r371 = <View style={[styles.controlsTopBottom, styles.controlsTop, r302]}>{r398}</View>;
}
const children2 = [r371, , ,];
const props4 = {
style: styles.controlsMiddle,
children: null
};
const r423 = showSkipButtons ? <VideoQuestPlayerControlButton disabled={state3 === PlayerState.ERRORED} accessibilityRole="button" accessibilityLabel={intl.string(t.r9s3Uv)} onPress={onPress}>
<SkipBackwardIcon color={styles.icon.color} width={16} height={16} />
</VideoQuestPlayerControlButton> : showSkipButtons;
L107: {
children3 = [r423, , ,];
if (!isVideoEnded && state3 !== PlayerState.ERRORED) {
if (paused) {
R3aFPe = t.R3aFPe;
break L107;
}
R3aFPe = t.fTMEUi;
} else {
R3aFPe = t.K0e7M9;
}
}
children3[1] = <VideoQuestPlayerControlButton accessibilityRole="button" accessibilityLabel={intl.string(R3aFPe)} onPress={callback11}>
{!isVideoEnded && state3 !== PlayerState.ERRORED ? paused ? <PlayIcon size="lg" /> : <PauseIcon size="lg" /> : <RetryIcon size="lg" />}
</VideoQuestPlayerControlButton>;
if (showSkipButtons) {
showSkipButtons = <VideoQuestPlayerControlButton disabled={disabled} accessibilityRole="button" accessibilityLabel={intl.string(t.zWDcNP)} onPress={onPress2}>
<SkipForwardIcon color={styles.icon.color} width={16} height={16} />
</VideoQuestPlayerControlButton>;
}
children3[2] = showSkipButtons;
props4.children = children3;
children2[1] = <View {...props4} />;
if (showFullscreenButton) {
showFullscreenButton = <View style={[styles.controlsTopBottom, styles.controlsBottom, r302]}>
<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.vKZT5t)} onPress={onToggleFullscreen} style={styles.controlButton}>
<FullscreenEnterIcon />
</PressableOpacity>
</View>;
}
children2[2] = showFullscreenButton;
props3.children = children2;
children[4] = <ReanimatedRexport.View {...props3} />;
if (showProgress) {
showProgress = <View style={styles.progressContainer}>
<ReanimatedRexport.View style={[styles.progress, animatedStyle2]} />
</View>;
}
children[5] = showProgress;
props2.children = children;
props.children = <Pressable {...props2} />;
return <View {...props} />;
});
exports.PlayerState = PlayerState;
export { c9821_19 as PlaybackTriggerSource };
export { r162 as AdVideoPlayer };
+8
View File
@@ -0,0 +1,8 @@
// Metro module 14060 (f14061).
import { isAndroid, isIOS } from "../../../utils/PlatformUtils";
let c9832_2 = [-1000, -1003, -1004, -1008];
export function isSourceError(a0) {
const r8 = a0 == null ? void 0 : a0.error.code;
const r7 = a0 == null ? void 0 : a0.error.errorException;
return isAndroid() ? !!(r7 == null ? void 0 : r7.includes("Source error")) : !!isIOS() && (r8 != null && c9832_2.includes(r8));
}
@@ -0,0 +1,48 @@
// Metro module 10499 (f10500).
import { AnalyticEvents } from "../../../Constants";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import * as _PlatformUtils from "../../../utils/PlatformUtils";
import { AppStates } from "../../../ConstantsIOS";
let c7044_3 = null;
let c7044_4 = null;
class AppStoreOverlayTelemetryManager extends AutomaticLifecycleManager {
actions = {
APP_STATE_UPDATE: (a0) => this.handleAppStateUpdate(a0)
};
handleAppStateUpdate({ state }) {
let r0;
const isAndroid = _PlatformUtils.isAndroid();
let r1 = !isAndroid;
if (!isAndroid) {
L7: {
r0 = c7044_3 != null;
if (r0) {
if (state === AppStates.ACTIVE && c7044_4 != null) {
c7044_3.trackOverlayEvent(AnalyticEvents.QUEST_APP_STORE_OVERLAY_RETURNED, Date.now() - c7044_4);
c7044_4 = null;
r0 = false;
break L7;
}
const BACKGROUND = AppStates.BACKGROUND;
r0 = false;
if (state === BACKGROUND) {
c7044_3.trackOverlayEvent(AnalyticEvents.QUEST_APP_STORE_OVERLAY_BACKGROUNDED);
c7044_4 = Date.now();
r0 = false;
}
}
}
r1 = r0;
}
return r1;
}
}
const appStoreOverlayTelemetryManager = new AppStoreOverlayTelemetryManager();
export default appStoreOverlayTelemetryManager;
export function setAppStoreOverlayOpen(a0) {
c7044_3 = a0;
}
export function clearAppStoreOverlayOpen() {
c7044_3 = null;
c7044_4 = null;
}
@@ -0,0 +1,20 @@
// Metro module 14113 (f14114).
import { memo } from "react";
import { StyleSheet, View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import { useStateFromStores } from "../../../_bundle/Module589";
import { VideoComponent } from "../../../components_native/common/Video";
import Module4611 from "../../../_bundle/Module4611";
const locations = [0, 0.6];
const _excluded = ["rgba(0, 0, 0, 0)", "rgba(0, 0, 0, 0.9)"];
const r29 = memo(function BountiesBannerBackground(props) {
const children = props.children;
return <View style={props.style}>
<VideoComponent source={{
uri: props.uri
}} style={StyleSheet.absoluteFillObject} resizeMode="cover" muted disableFocus paused={useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion)} importantForAccessibility="no-hide-descendants" />
<Module4611 colors={_excluded} locations={locations} style={StyleSheet.absoluteFillObject} />
{children}
</View>;
});
export default r29;
+157
View File
@@ -0,0 +1,157 @@
// Metro module 14111 (f14112).
import { useCallback, memo } from "react";
import { View, StyleSheet } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import AdContentSeenStore from "../AdContentSeenStore";
import { BountyCarouselEmptyStateReason, DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID, QuestsExperimentLocations } from "../QuestConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import { Text } from "../../../design/components/Text/native/Text";
import openBountiesNuxPromoSheet from "./openBountiesNuxPromoSheet";
import { useStateFromStores } from "../../../_bundle/Module589";
import { AdCreativeType } from "../../../_bundle/Module6013";
import { useBountiesExperience } from "../experiments/useBountiesExperience";
import { QuestContent } from "../QuestTypes";
import { trackAdContentClicked } from "../lib/analytics/AnalyticsActions";
import { QuestContentCTA } from "../lib/analytics/AnalyticsTypes";
import BountiesModalActionCreators from "./BountiesModal/BountiesModalActionCreators";
import BountiesBannerBackground from "./BountiesBannerBackground";
import Module14114 from "../../../_bundle/Module14114";
import { NewTag } from "../../../design/void/native";
import { Button } from "../../../design/components/Button/native/Button.native";
import useIsCarouselInView from "./useIsCarouselInView";
import { useBountyCarouselEmptyStateAnalytics } from "../lib/analytics/AnalyticsHooks";
import { ThemeContextProvider } from "../../../_bundle/Module3901";
import { ThemeTypes } from "../../../_bundle/Module6678";
import { QuestContentImpressionTrackerNative } from "./QuestContentImpressionTracker.native";
let useStyles, BountiesCtaHeaderInner;
const BountiesCtaDescription = function BountiesCtaDescription(props) {
const isEmptyOrCompleted = props.isEmptyOrCompleted;
const styles = useStyles();
const r28 = <Text variant="text-sm/medium" color="text-subtle">
{intl.string(isEmptyOrCompleted ? t.q4wlOE : t.AZGGo1)}
</Text>;
const r39 = intl.format(t.fjSvsC, {
onClick: openBountiesNuxPromoSheet
});
return isEmptyOrCompleted ? <Text variant="text-sm/medium">
{r28}
{" "}
{r39}
</Text> : <View style={styles.description}>
{r28}
<Text variant="text-sm/medium">{r39}</Text>
</View>;
};
BountiesCtaHeaderInner = function BountiesCtaHeaderInner(props) {
let VIDEO_MODAL_MOBILE;
const { bounties, isEmptyOrCompleted = false, containerRef: containerRef2 } = props;
VIDEO_MODAL_MOBILE = void 0;
const styles = useStyles();
useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const stateFromStores = useStateFromStores([AdContentSeenStore], () => bounties.some((bounty) => !AdContentSeenStore.hasSeen(AdCreativeType.BOUNTY, bounty.id)), [bounties]);
VIDEO_MODAL_MOBILE = useBountiesExperience(QuestsExperimentLocations.QUEST_HOME_MOBILE).verticalScrollEnabled ? QuestContent.VIDEO_MODAL_MOBILE : QuestContent.QUEST_HOME_MOBILE_CAROUSEL;
const callback = useCallback(() => {
const r5 = bounties[0];
trackAdContentClicked({
adContentId: DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID,
adCreativeType: AdCreativeType.BOUNTY,
questContent: QuestContent.QUEST_HOME_ENTRYPOINT_MOBILE,
questContentCTA: QuestContentCTA.START_BOUNTY,
sourceQuestContent: QuestContent.QUEST_HOME_ENTRYPOINT_MOBILE,
questContentPosition: 0
});
BountiesModalActionCreators.showModal({
bountyId: r5.id,
sourceQuestContent: VIDEO_MODAL_MOBILE
});
}, [bounties, VIDEO_MODAL_MOBILE]);
return <View ref={containerRef2} style={styles.container}>
<BountiesBannerBackground uri={Module14114} style={[styles.header, styles.headerRoundedBottom]}>
{stateFromStores && <NewTag variant="text-xs/bold" containerStyle={styles.newPill} textStyle={styles.newPillText} />}
<View style={styles.headerTextBox}>
<Text variant="text-lg/semibold" color="text-strong">
{intl.string(t.qetVDw)}
</Text>
<BountiesCtaDescription isEmptyOrCompleted={isEmptyOrCompleted} />
{isEmptyOrCompleted ? !isEmptyOrCompleted : <Button grow size="md" variant="primary-overlay" text={intl.string(t["1kkbKw"])} onPress={callback} />}
</View>
</BountiesBannerBackground>
{false}
</View>;
};
StyleSheet;
useStyles = createStyles(() => ({
container: {
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderWidth: 1,
borderColor: Module712.colors.BORDER_MUTED,
borderBottomLeftRadius: Module712.radii.xxl,
borderBottomRightRadius: Module712.radii.xxl,
overflow: "hidden"
},
header: {
width: "100%",
minHeight: 296,
justifyContent: "flex-end",
overflow: "hidden",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
headerRoundedBottom: {
borderBottomLeftRadius: Module712.radii.xxl,
borderBottomRightRadius: Module712.radii.xxl
},
newPill: {
position: "absolute",
top: Module712.space.PX_12,
left: Module712.space.PX_12,
zIndex: 1,
backgroundColor: Module712.colors.CONTROL_OVERLAY_PRIMARY_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.round,
paddingHorizontal: Module712.space.PX_8,
paddingVertical: Module712.space.PX_4
},
newPillText: {
color: Module712.colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT
},
headerTextBox: {
paddingBottom: Module712.space.PX_24,
paddingHorizontal: Module712.space.PX_20,
gap: Module712.space.PX_8
},
description: {
marginBottom: 16
},
bottomSection: {
width: "100%",
overflow: "hidden",
borderBottomLeftRadius: Module712.radii.xl,
borderBottomRightRadius: Module712.radii.xl
},
bottomContent: {
paddingBottom: 24,
paddingHorizontal: 20,
gap: Module712.space.PX_12
},
placeholderCards: {
alignSelf: "stretch",
height: 160,
borderRadius: Module712.radii.md,
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT
}
}));
const r41 = memo(function BountiesCtaHeader(props) {
let c20918_0 = props;
const isCarouselInView = useIsCarouselInView();
const { containerRef, isInView } = isCarouselInView;
const { bounties: bounties2, isEmptyOrCompleted = false } = props;
useBountyCarouselEmptyStateAnalytics(isEmptyOrCompleted ? bounties2.length === 0 ? BountyCarouselEmptyStateReason.EMPTY : BountyCarouselEmptyStateReason.COMPLETED : null);
return <ThemeContextProvider theme={ThemeTypes.DARKER}>
{isEmptyOrCompleted ? <BountiesCtaHeaderInner {...props} containerRef={containerRef} /> : <QuestContentImpressionTrackerNative adContentId={DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.QUEST_HOME_ENTRYPOINT_MOBILE} questContentPosition={0} overrideVisibility={isInView} sourceQuestContent={QuestContent.QUEST_HOME_ENTRYPOINT_MOBILE}>
{() => <BountiesCtaHeaderInner {...c20918_0} containerRef={containerRef} />}
</QuestContentImpressionTrackerNative>}
</ThemeContextProvider>;
});
export default r41;
@@ -0,0 +1,70 @@
// Metro module 14081 (f14082).
import { useEffect } from "react";
import { View } from "react-native";
import ReanimatedRexport, { useSharedValue, withRepeat, withSequence, Easing, cancelAnimation, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../../design/animation/reanimated/timing/timing";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useToken } from "../../../../design/tokens/native/useToken";
import { ArrowSmallUpIcon } from "../../../../design/components/Icon/native/redesign/generated/ArrowSmallUpIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { AnimatedCircularProgress } from "../../../../_bundle/Module14084";
let __initData, useStyles;
const BouncingArrow = function BouncingArrow(props) {
const children2 = props.children;
const sharedValue = useSharedValue(0);
useEffect(() => {
sharedValue.set(withRepeat(withSequence(withTiming(-6, {
duration: 500,
easing: Easing.inOut(Easing.quad)
}), withTiming(0, {
duration: 500,
easing: Easing.inOut(Easing.quad)
})), -1));
return () => cancelAnimation(sharedValue);
}, [sharedValue]);
const l = () => ({
transform: [{
translateY: sharedValue.get()
}]
});
l.__closure = {
translateY: sharedValue
};
l.__workletHash = 10126349088819;
l.__initData = __initData;
return <ReanimatedRexport.View style={useAnimatedStyle(l)}>{children2}</ReanimatedRexport.View>;
};
__initData = {
code: "function BountiesAutoScrollIndicatorTsx1(){const{translateY}=this.__closure;return{transform:[{translateY:translateY.get()}]};}"
};
useStyles = createStyles({
root: {
alignItems: "center",
gap: Module712.space.PX_8
},
ringContainer: {
alignItems: "center",
justifyContent: "center",
width: 40,
height: 40
}
});
export default function BountiesAutoScrollIndicator(props) {
const { progress, showProgressRing = true } = props;
const styles = useStyles();
const token = useToken(Module712.colors.WHITE);
const r16 = <ArrowSmallUpIcon size="md" color={Module712.colors.WHITE} />;
let c20889_0 = r16;
return <View style={styles.root}>
<Text variant="text-md/semibold" color="text-default">
{intl.string(t.eafsh4)}
</Text>
<View style={styles.ringContainer}>
{showProgressRing ? <AnimatedCircularProgress size={40} width={3} fill={100 * progress} duration={0} rotation={0} lineCap="round" tintColor={token} backgroundColor="rgba(255, 255, 255, 0.35)">
{() => c20889_0}
</AnimatedCircularProgress> : <BouncingArrow>{r16}</BouncingArrow>}
</View>
</View>;
};
@@ -0,0 +1,43 @@
// Metro module 14075 (f14076).
import { useEffect } from "react";
import { StyleSheet } from "react-native";
import Module712 from "../../../../_bundle/Module712";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../../design/animation/reanimated/timing/timing";
import { timingSlow } from "../../../../design/animation/reanimated/timing/timingPresets";
import Module4611 from "../../../../_bundle/Module4611";
const BRAND_500 = Module712.unsafe_rawColors.BRAND_500;
const __initData = {
code: "function BountiesAutoScrollOverlayNuxGradientTsx1(){const{opacity}=this.__closure;return{opacity:opacity.get()};}"
};
export default function BountiesAutoScrollOverlayNuxGradient(props) {
const active = props.active;
const sharedValue = useSharedValue(0);
useEffect(() => {
sharedValue.set(withTiming(active ? 1 : 0, timingSlow));
}, [active, sharedValue]);
const _ = () => ({
opacity: sharedValue.get()
});
_.__closure = {
opacity: sharedValue
};
_.__workletHash = 17406907036861;
_.__initData = __initData;
return <ReanimatedRexport.View style={[StyleSheet.absoluteFillObject, useAnimatedStyle(_)]} pointerEvents="none">
<Module4611 style={StyleSheet.absoluteFillObject} colors={[`${BRAND_500}80`, `${BRAND_500}00`]} locations={[0, 1]} start={{
x: 0.5,
y: 1
}} end={{
x: 0.5,
y: 0
}} />
<Module4611 style={StyleSheet.absoluteFillObject} colors={["rgba(0,0,0,0.4)", "rgba(0,0,0,0)"]} locations={[0, 0.5]} start={{
x: 0.5,
y: 1
}} end={{
x: 0.5,
y: 0
}} />
</ReanimatedRexport.View>;
};
@@ -0,0 +1,65 @@
// Metro module 14070 (f14071).
import { useCallback } from "react";
import { Pressable, View } from "react-native";
import { END_CARD_IMAGE_SIZE } from "./BountyConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useGetQuestImpressionId } from "../../lib/analytics/ContentImpressionTrackerHooks";
import { getBountyCtaInfo } from "./BountyCtaHelpers";
import { getScaledImageUrl } from "../../lib/AssetUtils";
import { openAdGameLinkDirectly } from "../../utils/QuestPlatformUtils";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContent } from "../../../../_bundle/Module5038";
import { QuestContentCTA } from "../../lib/analytics/AnalyticsTypes";
import FastImage from "../../../../components_native/common/FastImage";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles(() => ({
image: {
width: END_CARD_IMAGE_SIZE,
height: END_CARD_IMAGE_SIZE,
borderRadius: Module712.radii.xl,
borderWidth: 1,
borderColor: Module712.colors.BORDER_MUTED
},
info: {
gap: Module712.space.PX_4,
alignItems: "center",
marginTop: Module712.space.PX_12
},
ctaContainer: {
position: "relative",
alignItems: "center"
}
}));
export default function BountiesEndCardPressableCta(props) {
const { bounty, sourceQuestContent, disabled = false } = props;
const styles = useStyles();
const getQuestImpressionId = useGetQuestImpressionId();
const bountyCtaInfo = getBountyCtaInfo(bounty);
const uri = bountyCtaInfo.iconImageUri != null ? getScaledImageUrl({
assetUrl: bountyCtaInfo.iconImageUri,
width: END_CARD_IMAGE_SIZE,
height: END_CARD_IMAGE_SIZE
}) : void 0;
const callback = useCallback(() => {
openAdGameLinkDirectly({
adContentId: bounty.id,
adCreativeType: AdCreativeType.BOUNTY,
cta: bounty.cta
}, {
content: QuestContent.VIDEO_MODAL_ICON_END_CARD,
ctaContent: QuestContentCTA.OPEN_GAME_LINK,
impressionId: getQuestImpressionId(),
sourceQuestContent
});
}, [bounty.id, bounty.cta, getQuestImpressionId, sourceQuestContent]);
return <Pressable onPress={disabled ? void 0 : callback} disabled={disabled} hitSlop={16} accessibilityRole="button" accessibilityLabel={bountyCtaInfo.label} style={styles.ctaContainer}>
<FastImage source={{
uri
}} style={styles.image} />
<View style={styles.info}>
<Text variant="text-md/semibold" color="text-strong">{bountyCtaInfo.label}</Text>
<Text variant="text-sm/medium" color="text-default">{bountyCtaInfo.subtext}</Text>
</View>
</Pressable>;
};
@@ -0,0 +1,31 @@
// Metro module 14034 (f14035).
import * as Module19 from "react";
import { useMemo, useLayoutEffect } from "react";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import BountiesModalContentScroll from "./BountiesModalContentScroll";
import BountiesModalContent from "./BountiesModalContent";
import { lockOrientation, restoreDefaultOrientation } from "../../../device/native/DeviceOrientation";
import { Modal } from "../../../../design/components/Modal/native/Modal.native";
const initialRouteName = "bounty_main";
const r24 = Module19.memo(function BountiesModal(props) {
const { bountyId, sourceQuestContent } = props;
const verticalScrollEnabled = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE).verticalScrollEnabled;
const memo = useMemo(() => {
const r1 = {};
r1[initialRouteName] = {
fullscreen: true,
headerLeft: () => null,
render: () => verticalScrollEnabled ? <BountiesModalContentScroll bountyId={bountyId} sourceQuestContent={sourceQuestContent} /> : <BountiesModalContent bountyId={bountyId} sourceQuestContent={sourceQuestContent} />
};
return r1;
}, [bountyId, sourceQuestContent, verticalScrollEnabled]);
useLayoutEffect(() => {
lockOrientation("PORTRAIT", true);
return restoreDefaultOrientation;
}, []);
return <Modal hideTitle initialRouteName={initialRouteName} screens={memo} viewStyle={{
backgroundColor: "#000000"
}} />;
});
export default r24;
@@ -0,0 +1,16 @@
// Metro module 14033 (f14034).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
let c9809_3 = "BOUNTIES_MODAL";
const r15 = {
showModal: ({ bountyId, sourceQuestContent }) => {
ModalActionCreators.pushLazy(import("./BountiesModal"), {
bountyId,
sourceQuestContent
}, c9809_3);
},
hideModal: () => {
ModalActionCreators.popWithKey(c9809_3);
}
};
export default r15;
export const BOUNTIES_MODAL_KEY = "BOUNTIES_MODAL";
@@ -0,0 +1,191 @@
// Metro module 14066 (f14067).
import { useCallback } from "react";
import { StyleSheet, View, Pressable } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { QuestsExperimentLocations } from "../../QuestConstants";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import { getBountyCtaInfo } from "./BountyCtaHelpers";
import { getScaledImageUrl } from "../../lib/AssetUtils";
import { useButtonPressAnimationProps } from "../../../../design/components/Button/native/ButtonHooks.native";
import { useGetQuestImpressionId } from "../../lib/analytics/ContentImpressionTrackerHooks";
import { openAdGameLinkDirectly } from "../../utils/QuestPlatformUtils";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContentCTA } from "../../lib/analytics/AnalyticsTypes";
import { QuestContent } from "../../../../_bundle/Module5038";
import { BackgroundBlurView } from "../../../../design/components/experimental/BackgroundBlurView/native/BackgroundBlurView.native";
import FastImage from "../../../../components_native/common/FastImage";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { useIsBountiesModalTransitionsRefactorEnabled } from "../../experiments/BountiesModalTransitionsRefactorExperiment";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useVisibilityTransition } from "./useVisibilityTransition";
import AnimatedEnterExitItem from "../../../../design/components/AnimatedEnterExitItem/native/AnimatedEnterExitItem";
let _excluded, AnimatedComponent, useStyles, n, s2, __initData;
const BountiesModalAdvertiserCtaContent = function BountiesModalAdvertiserCtaContent(props) {
const { bounty, sourceQuestContent, opacityStyle, transformStyle } = props;
const styles = useStyles();
const bountyCtaInfo = getBountyCtaInfo(bounty);
const uri = bountyCtaInfo.iconImageUri != null ? getScaledImageUrl({
assetUrl: bountyCtaInfo.iconImageUri,
width: 40,
height: 40
}) : void 0;
const sharedValue = useSharedValue(0);
const buttonPressAnimationProps = useButtonPressAnimationProps(sharedValue);
const { style, ...rest } = buttonPressAnimationProps;
const getQuestImpressionId = useGetQuestImpressionId();
const callback = useCallback((a0) => {
openAdGameLinkDirectly({
adContentId: bounty.id,
adCreativeType: AdCreativeType.BOUNTY,
cta: bounty.cta
}, {
content: a0,
ctaContent: QuestContentCTA.OPEN_GAME_LINK,
impressionId: getQuestImpressionId(),
sourceQuestContent
});
}, [bounty.id, bounty.cta, sourceQuestContent, getQuestImpressionId]);
return <ReanimatedRexport.View style={[styles.outerContainer, opacityStyle, transformStyle]}>
<AnimatedComponent {...rest} onPress={useCallback(() => {
callback(QuestContent.VIDEO_MODAL_MOBILE);
}, [callback])} accessibilityRole="button" accessibilityLabel={bountyCtaInfo.label} style={[styles.ctaPressable, style]}>
<BackgroundBlurView blurTheme="dark" style={styles.cta} pressed={sharedValue}>
<View style={styles.ctaLogoContainer}>
<FastImage source={{
uri
}} style={styles.ctaLogo} resizeMode="cover" />
</View>
<View style={styles.ctaInfo}>
<Text lineClamp={2} variant="text-sm/semibold" color="text-default">{bountyCtaInfo.label}</Text>
<Text variant="text-xs/medium" color="text-default">{bountyCtaInfo.subtext}</Text>
</View>
<View accessible={false} importantForAccessibility="no-hide-descendants">
<Button variant="primary-overlay" text={bountyCtaInfo.buttonLabel} size="sm" onPress={useCallback(() => {
callback(QuestContent.VIDEO_MODAL_MOBILE_FOOTER);
}, [callback])} />
</View>
</BackgroundBlurView>
</AnimatedComponent>
</ReanimatedRexport.View>;
};
_excluded = ["style"];
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Pressable);
useStyles = createStyles(() => ({
outerContainer: {
position: "absolute",
bottom: 0,
left: 0,
right: 0,
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16,
alignItems: "center"
},
ctaPressable: {
...Module712.shadows.SHADOW_TOP_HIGH,
alignSelf: "stretch",
borderWidth: 1,
borderColor: "transparent",
borderRadius: Module712.radii.lg,
overflow: "hidden"
},
cta: {
flexDirection: "row",
alignItems: "center",
paddingLeft: Module712.space.PX_12,
paddingRight: Module712.space.PX_16,
paddingVertical: Module712.space.PX_12,
gap: Module712.space.PX_12
},
ctaLogoContainer: {
width: 40,
height: 40,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.md,
overflow: "hidden"
},
ctaLogo: {
...StyleSheet.absoluteFillObject
},
ctaInfo: {
flex: 1,
justifyContent: "center",
gap: 2
}
}));
const r43 = function n(a0) {
return {
opacity: _timing.withTiming(a0, _timingPresets.timingStandard, "respect-motion-settings")
};
};
r43.__closure = {
withTiming: _timing.withTiming,
timingStandard: _timingPresets.timingStandard
};
r43.__workletHash = 2981824910249;
r43.__initData = {
code: "function BountiesModalAdvertiserCtaTsx1(visible){const{withTiming,timingStandard}=this.__closure;return{opacity:withTiming(visible,timingStandard,'respect-motion-settings')};}"
};
n = r43;
const r52 = function(a0, a1) {
return {
opacity: _timing.withTiming(a0, _timingPresets.timingFast, "respect-motion-settings", a1)
};
};
r52.__closure = {
withTiming: _timing.withTiming,
timingFast: _timingPresets.timingFast
};
r52.__workletHash = 15850601331978;
r52.__initData = {
code: "function BountiesModalAdvertiserCtaTsx2(visible,cleanUp){const{withTiming,timingFast}=this.__closure;return{opacity:withTiming(visible,timingFast,'respect-motion-settings',cleanUp)};}"
};
s2 = r52;
__initData = {
code: "function BountiesModalAdvertiserCtaTsx3(){const{withTiming,interpolate,visibility,visible,timingStandard,timingFast}=this.__closure;return{transform:[{translateY:withTiming(interpolate(visibility,[0,1],[8,0]),visible?timingStandard:timingFast)}]};}"
};
export default function BountiesModalAdvertiserCta(props) {
let c20882_1, animatedStyle;
const { visible, ...props2 } = props;
c20882_1 = void 0;
animatedStyle = void 0;
const isBountiesModalTransitionsRefactorEnabled = useIsBountiesModalTransitionsRefactorEnabled(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const visibility = visible ? 1 : 0;
c20882_1 = visibility;
const r32 = () => ({
transform: [{
translateY: _timing.withTiming(_ReanimatedRexport.interpolate(c20882_1, [0, 1], [8, 0]), visible ? _timingPresets.timingStandard : _timingPresets.timingFast)
}]
});
r32.__closure = {
withTiming: _timing.withTiming,
interpolate: _ReanimatedRexport.interpolate,
visibility,
visible,
timingStandard: _timingPresets.timingStandard,
timingFast: _timingPresets.timingFast
};
r32.__workletHash = 252868467367;
r32.__initData = __initData;
animatedStyle = useAnimatedStyle(r32);
const callback2 = useCallback((a0, a1) => <BountiesModalAdvertiserCtaContent {...a0} opacityStyle={a1} transformStyle={animatedStyle} />, [animatedStyle]);
const visibilityTransition = useVisibilityTransition({
visible,
entranceTiming: _timingPresets.timingStandard,
exitTiming: _timingPresets.timingFast
});
const opacityStyle = visibilityTransition.opacityStyle;
let shouldRender = visibilityTransition.shouldRender;
if (isBountiesModalTransitionsRefactorEnabled) {
shouldRender = <AnimatedEnterExitItem useReducedMotion={stateFromStores} item={visible ? props2 : void 0} entering={n} exiting={s2} renderItem={callback2} />;
} else if (shouldRender) {
shouldRender = <BountiesModalAdvertiserCtaContent {...props2} opacityStyle={opacityStyle} transformStyle={animatedStyle} />;
}
return shouldRender;
};
@@ -0,0 +1,23 @@
// Metro module 14080 (f14081).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../intl/index.native";
import { XSmallIcon } from "../../../../design/components/Icon/native/redesign/generated/XSmallIcon";
const useStyles = createStyles(() => ({
closeButton: {
alignItems: "center",
justifyContent: "center",
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.round,
width: Module712.space.PX_32,
height: Module712.space.PX_32
}
}));
export default function BountiesModalCloseButton(props) {
const onPress = props.onPress;
const styles = useStyles();
return <PressableOpacity accessibilityLabel={intl.string(t.cpT0Cq)} accessibilityRole="button" hitSlop={12} onPress={onPress} style={styles.closeButton}>
<XSmallIcon size="sm" color={Module712.colors.CONTROL_OVERLAY_SECONDARY_TEXT_DEFAULT} />
</PressableOpacity>;
};
@@ -0,0 +1,2 @@
// Metro module 14057 (f14058).
export const BOUNTY_REWARD_CLAIM_FAILED_TOAST_DURATION_MS = 10000;
@@ -0,0 +1,262 @@
// Metro module 14087 (f14088).
import { useMemo, useCallback } from "react";
import { View } from "react-native";
import BountyStore from "../../BountyStore";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { AnalyticEvents } from "../../../../Constants";
import { ThemeTypes } from "../../../../_bundle/Module505";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useFetchVirtualCurrencyBalance } from "../../../virtual_currency/hooks/index";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import { BountyVideoEndMode, useBountiesModalTiming } from "./useBountiesModalTiming";
import { useBountyVideoProgressPersistence } from "./useBountyVideoProgressPersistence";
import { claimBountyReward } from "../../BountyActionCreators";
import { openBountyRewardClaimErrorToast } from "./bountyError";
import { useBountiesModalVideoAnalytics } from "./useBountiesModalVideoAnalytics";
import { trackAdContentEvent } from "../../lib/analytics/AnalyticsActions";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { getQuestContentName } from "../../lib/analytics/AnalyticsTypes";
import { QuestContent } from "../../../../_bundle/Module5038";
import { formatVideoProgressRatio } from "../../utils/VideoQuestUtils";
import BountiesModalActionCreators from "./BountiesModalActionCreators";
import { BountyVideo } from "./BountyVideo";
import { QuestContentImpressionTrackerNative, BillableAdPlacementImpressionTrackerNative } from "../QuestContentImpressionTracker.native";
import BountiesModalEndCard from "./BountiesModalEndCard";
import BountiesModalCloseButton from "./BountiesModalCloseButton";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import BountiesModalEndedCtaButtons from "./BountiesModalEndedCtaButtons";
import { useQuestHomeBounties } from "../../hooks/QuestHooks";
import { ThemeContextProvider } from "../../../../_bundle/Module3901";
let c9854_13, useStyles;
const BountiesModalContentInner = function BountiesModalContentInner(props) {
let c20892_4, handleProgress, flushProgress, handleVideoProgressAnalytics, isEndCardVisible, maxVideoProgressSeconds, videoDuration;
const { bounty, sourceQuestContent } = props;
c20892_4 = void 0;
handleProgress = void 0;
flushProgress = void 0;
handleVideoProgressAnalytics = void 0;
isEndCardVisible = void 0;
maxVideoProgressSeconds = void 0;
videoDuration = void 0;
const styles = useStyles();
const windowDimensions_native = useWindowDimensions_native();
const { width, height } = windowDimensions_native;
const safeAreaInsets_native = useSafeAreaInsets_native();
let c20893_2 = safeAreaInsets_native;
const memo = useMemo(() => {
const r11 = width - c20893_2.left - c20893_2.right;
const r13 = height - c20893_2.top - c20893_2.bottom;
let r21 = r11 / c9854_13;
let isFullWidth = true;
let r9 = r11;
if (r21 > r13) {
r9 = r13 * c9854_13;
isFullWidth = false;
r21 = r13;
}
return {
top: Math.floor(c20893_2.top + (r13 - r21) / 2),
left: Math.floor(c20893_2.left + (r11 - r9) / 2),
width: Math.floor(r9),
height: Math.floor(r21),
isFullWidth
};
}, [width, height, safeAreaInsets_native.top, safeAreaInsets_native.bottom, safeAreaInsets_native.left, safeAreaInsets_native.right]);
const memo4 = useMemo(() => [styles.videoWrapper, {
top: memo.top,
left: memo.left,
width: memo.width,
height: memo.height
}], [styles.videoWrapper, memo]);
const memo3 = useMemo(() => [styles.closeButton, {
top: memo.top + Module712.space.PX_8,
left: memo.left + memo.width - Module712.space.PX_32 - Module712.space.PX_8
}], [styles.closeButton, memo.top, memo.left, memo.width]);
const memo2 = useMemo(() => {
const isFullWidth = memo.isFullWidth;
const bottomContainer = styles.bottomContainer;
return isFullWidth ? [bottomContainer, styles.bottomContainerFullWidth] : [bottomContainer, styles.bottomContainerNotFullWidth, {
left: memo.left,
width: memo.width
}];
}, [styles.bottomContainer, styles.bottomContainerFullWidth, styles.bottomContainerNotFullWidth, memo.isFullWidth, memo.left, memo.width]);
const stateFromStores = useStateFromStores([BountyStore], () => BountyStore.isBountyCompleted(bounty.id));
const balance = useFetchVirtualCurrencyBalance().balance;
const bountiesExperience = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
const { loopingEnabled, ownedByVerticalScrollExperiment, stage1Enabled, rewardTimerSeconds } = bountiesExperience;
const endMode = loopingEnabled ? BountyVideoEndMode.LOOP : BountyVideoEndMode.END_CARD;
const rewardDurationMs = !stage1Enabled && !ownedByVerticalScrollExperiment ? 1000 * bounty.rewardTimerSeconds : 1000 * rewardTimerSeconds;
c20892_4 = rewardDurationMs;
const bountyVideoProgressPersistence = useBountyVideoProgressPersistence({
bountyId: bounty.id,
endMode
});
const initialProgress = bountyVideoProgressPersistence.initialProgress;
handleProgress = bountyVideoProgressPersistence.handleProgress;
flushProgress = bountyVideoProgressPersistence.flushProgress;
const callback = useCallback(async () => {
let c27624_2;
let c27624_3 = 0;
let c30697_0;
L10: {
try {
c27624_3 = 1;
await claimBountyReward(bounty.id, sourceQuestContent);
c27624_3 = 0;
} catch ($e) {
const r24 = $e;
let r7 = r24;
c27624_2 = r24;
if (c27624_3 !== 0) {
while (true) {
try {
const r57 = c27624_2;
c27624_3 = 0;
c30697_0 = r57;
openBountyRewardClaimErrorToast(c30697_0);
break L10;
} catch (r53) {
r7 = r53;
c27624_2 = r53;
if (c27624_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
}, [bounty.id, sourceQuestContent]);
const bountiesModalVideoAnalytics = useBountiesModalVideoAnalytics({
bountyId: bounty.id,
sourceQuestContent,
rewardDurationMs,
initialPlaybackTimeSec: initialProgress.timestampSec,
initialMaxVideoProgressSec: initialProgress.maxTimestampSec,
initialVideoDurationSec: initialProgress.duration,
wasPreloaded: false,
startupPath: "carousel",
verticalScrollingPosition: null
});
handleVideoProgressAnalytics = bountiesModalVideoAnalytics.handleVideoProgressAnalytics;
const { handleVideoEndAnalytics, handleVideoLoopedAnalytics, handleVideoPausedAnalytics, handleVideoResumedAnalytics, handleVideoErrorAnalytics, handleLoadStartAnalytics, handleVideoTracksAnalytics, handleReadyForDisplayAnalytics, handleBufferAnalytics } = bountiesModalVideoAnalytics;
const bountiesModalTiming = useBountiesModalTiming({
endMode,
rewardDurationMs,
isCompleted: stateFromStores,
onRewardEarned: callback,
onVideoProgress: useCallback((a0, a1, a2) => {
handleVideoProgressAnalytics(a0, a1, a2);
handleProgress(a0, a1, a2);
}, [handleVideoProgressAnalytics, handleProgress]),
onVideoEnd: handleVideoEndAnalytics,
onVideoLooped: handleVideoLoopedAnalytics,
onVideoPaused: handleVideoPausedAnalytics,
onVideoResumed: handleVideoResumedAnalytics,
initialProgressSec: initialProgress.timestampSec,
initialMaxVideoProgressSec: initialProgress.maxTimestampSec,
initialVideoDurationSec: initialProgress.duration > 0 ? initialProgress.duration : null
});
const isCtaVisible = bountiesModalTiming.isCtaVisible;
isEndCardVisible = bountiesModalTiming.isEndCardVisible;
const { handleVideoEnd, handleVideoProgress, handleVideoPaused, handleVideoResumed, rewardRemainingSeconds, rewardTotalSeconds, normalizedProgress } = bountiesModalTiming;
maxVideoProgressSeconds = bountiesModalTiming.maxVideoProgressSeconds;
videoDuration = bountiesModalTiming.videoDuration;
return <>
<View style={memo4}>
<BountyVideo isActive bounty={bounty} sourceQuestContent={sourceQuestContent} isCompleted={stateFromStores} isCtaVisible={isCtaVisible} isEndCardVisible={isEndCardVisible} isProgressBarVisible={!isEndCardVisible} orbsBalance={balance} handleVideoEnd={handleVideoEnd} handleVideoProgress={handleVideoProgress} handleVideoPaused={handleVideoPaused} handleVideoResumed={handleVideoResumed} handleVideoError={handleVideoErrorAnalytics} onLoadStart={handleLoadStartAnalytics} onBuffer={handleBufferAnalytics} onFirstFrame={handleReadyForDisplayAnalytics} onVideoTracks={handleVideoTracksAnalytics} rewardRemainingSeconds={rewardRemainingSeconds} rewardTotalSeconds={rewardTotalSeconds} normalizedProgress={normalizedProgress} repeat={loopingEnabled} initialProgress={initialProgress} renderEndCard={() => <QuestContentImpressionTrackerNative adContentId={bounty.id} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.VIDEO_MODAL_END_CARD} sourceQuestContent={sourceQuestContent} overrideVisibility={isEndCardVisible}>
{() => <BountiesModalEndCard bounty={bounty} visible={isEndCardVisible} sourceQuestContent={sourceQuestContent} />}
</QuestContentImpressionTrackerNative>} isScrollIndicatorEnabled={false} width={memo.width} height={memo.height} />
</View>
<View style={memo3}>
<BountiesModalCloseButton onPress={useCallback(() => {
const properties = {
content_name: getQuestContentName(QuestContent.VIDEO_MODAL_MOBILE),
content_id: QuestContent.VIDEO_MODAL_MOBILE,
video_progress: null,
threshold_met: null,
reward_timer_seconds: null
};
let r38 = videoDuration;
if (videoDuration == null) {
r38 = 0;
}
properties.video_progress = formatVideoProgressRatio(maxVideoProgressSeconds, r38);
const r1 = 1000 * maxVideoProgressSeconds;
properties.threshold_met = r1 >= c20892_4;
properties.reward_timer_seconds = c20892_4 / 1000;
trackAdContentEvent({
adContentId: bounty.id,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_MODAL_CLOSED,
properties,
sourceQuestContent
});
flushProgress();
BountiesModalActionCreators.hideModal();
}, [bounty.id, maxVideoProgressSeconds, rewardDurationMs, sourceQuestContent, videoDuration, flushProgress])} />
</View>
<SafeAreaPaddingView left={memo.isFullWidth} right={memo.isFullWidth} bottom style={memo2} pointerEvents="box-none">
<BountiesModalEndedCtaButtons bounty={bounty} visible={isEndCardVisible} sourceQuestContent={sourceQuestContent} onClose={useCallback(() => {
const properties = {
content_name: getQuestContentName(QuestContent.VIDEO_MODAL_END_CARD),
content_id: QuestContent.VIDEO_MODAL_END_CARD,
video_progress: null,
threshold_met: true,
reward_timer_seconds: null
};
let r36 = videoDuration;
if (videoDuration == null) {
r36 = 0;
}
properties.video_progress = formatVideoProgressRatio(maxVideoProgressSeconds, r36);
properties.reward_timer_seconds = c20892_4 / 1000;
trackAdContentEvent({
adContentId: bounty.id,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_MODAL_CLOSED,
properties,
sourceQuestContent
});
flushProgress();
BountiesModalActionCreators.hideModal();
}, [bounty.id, maxVideoProgressSeconds, rewardDurationMs, sourceQuestContent, videoDuration, flushProgress])} />
</SafeAreaPaddingView>
</>;
};
c9854_13 = 0.5625;
useStyles = createStyles(() => ({
videoWrapper: {
position: "absolute"
},
closeButton: {
position: "absolute"
},
bottomContainer: {
position: "absolute",
bottom: Module712.space.PX_24,
justifyContent: "flex-end"
},
bottomContainerFullWidth: {
left: Module712.space.PX_16,
right: Module712.space.PX_16
},
bottomContainerNotFullWidth: {
paddingLeft: Module712.space.PX_16,
paddingRight: Module712.space.PX_16
}
}));
export default function BountiesModalContent(props) {
const { bountyId, sourceQuestContent: sourceQuestContent2 } = props;
const bounty2 = useQuestHomeBounties().questHomeBounties.find((questHomeBounty) => questHomeBounty.id === bountyId);
return bounty2 != null ? <ThemeContextProvider theme={ThemeTypes.DARKER}>
<BillableAdPlacementImpressionTrackerNative adContentId={bounty2.id} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.VIDEO_MODAL_MOBILE} sourceQuestContent={sourceQuestContent2} overrideVisibility>
{() => <BountiesModalContentInner bounty={bounty2} sourceQuestContent={sourceQuestContent2} />}
</BillableAdPlacementImpressionTrackerNative>
</ThemeContextProvider> : null;
};
@@ -0,0 +1,799 @@
// Metro module 14035 (f14036).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useRef, useState, useCallback, useMemo, useEffect } from "react";
import { StyleSheet, View } from "react-native";
import BountyStore from "../../BountyStore";
import { DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID, QuestsExperimentLocations } from "../../QuestConstants";
import { AnalyticEvents } from "../../../../Constants";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import * as _Module501 from "../../../../_bundle/Module501";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle, useSharedValue, useAnimatedScrollHandler, useAnimatedReaction, useDerivedValue } from "../../../reanimated/ReanimatedRexport";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import BountiesScrollPromptFooter, { BOUNTIES_MODAL_BASE_FOOTER_HEIGHT } from "./BountiesScrollPromptFooter";
import { useQuestHomeBounties } from "../../hooks/QuestHooks";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import * as _BountiesVerticalScrollExperiment from "../../experiments/BountiesVerticalScrollExperiment";
import { useStateFromStores } from "../../../../_bundle/Module589";
import * as _useBountiesRecapScroll from "./useBountiesRecapScroll";
import { useBountiesRecapScroll } from "./useBountiesRecapScroll";
import { useBountySwipeUpNux } from "./useBountySwipeUpNux";
import { v4 } from "../../../../_bundle/Module514";
import * as _AnalyticsTypes from "../../lib/analytics/AnalyticsTypes";
import { BountyScrollingType, getQuestContentName } from "../../lib/analytics/AnalyticsTypes";
import { trackBountyAutoScrollDismissed, trackBountyVerticalScroll, trackAdContentEvent } from "../../lib/analytics/AnalyticsActions";
import { useBountiesAutoScroll, AUTO_SCROLL_PEEK_TOP_OFFSET, AUTO_SCROLL_PEEK_SCALE } from "./useBountiesAutoScroll";
import { useBountiesRecapOrbCount } from "./useBountiesRecapOrbCount";
import { markAdContentSeen } from "../../QuestActionCreators";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContent } from "../../../../_bundle/Module5038";
import { formatVideoProgressRatio } from "../../utils/VideoQuestUtils";
import BountiesModalActionCreators from "./BountiesModalActionCreators";
import { BountiesScrollVideoItem } from "./BountiesScrollVideoItem";
import BountiesScrollPromptNuxFooter from "./BountiesScrollPromptNuxFooter";
import { BountiesScrollRecapFooter } from "./BountiesScrollRecapFooter";
import BountiesAutoScrollOverlayNuxGradient from "./BountiesAutoScrollOverlayNuxGradient";
import { QuestContentImpressionTrackerNative } from "../QuestContentImpressionTracker.native";
import { BountiesScrollRecapPage } from "./BountiesScrollRecapPage";
import { AnimatedFlashList } from "../../../../_bundle/noop_6676";
import Module4611 from "../../../../_bundle/Module4611";
import BountiesModalCloseButton from "./BountiesModalCloseButton";
import BountiesAutoScrollIndicator from "./BountiesAutoScrollIndicator";
import { ThemeContextProvider } from "../../../../_bundle/Module3913";
import { ThemeTypes } from "../../../../_bundle/Module6678";
let isAndroid, zIndex, zIndex2, zIndex3, zIndex4, c9811_19, PX_8, _excluded, FOOTER_FADE_START_PROGRESS, FOOTER_FADE_END_PROGRESS, isScrollEventInBounds, BountiesRecapPullZone, useStyles, __initData, BountiesScrollVideoItemContainer, __initData2, __initData3, __initData4, __initData5, __initData6, __initData7, __initData8, __initData9, __initData10, __initData11, __initData12, __initData13, __initData14, __initData15, __initData16, __initData17, __initData18, __initData19, __initData20, BountiesModalContentScrollInner;
const ItemSeparator = function ItemSeparator(props) {
return props.trailingItem != null ? <View style={{
height: PX_8
}} /> : null;
};
BountiesRecapPullZone = function BountiesRecapPullZone(props) {
return <View style={{
height: props.height
}} />;
};
BountiesScrollVideoItemContainer = function BountiesScrollVideoItemContainer(props) {
const { index, slotHeight, scrollY, style, isPeekEnabled, children: children2 } = props;
const c = function c() {
const r19 = (scrollY.get() - index * slotHeight) / slotHeight;
return {
opacity: _ReanimatedRexport.interpolate(Math.abs(r19), [0, 0.3, 1], [1, 1, isPeekEnabled ? r19 < 0 ? index === 1 ? 0.8 : 0 : 0 : 0], _ReanimatedRexport.Extrapolation.CLAMP)
};
};
c.__closure = {
scrollY,
index,
slotHeight,
isPeekEnabled,
PEEK_OPACITY: 0.8,
interpolate: _ReanimatedRexport.interpolate,
FADE_DEADBAND: 0.3,
Extrapolation: _ReanimatedRexport.Extrapolation
};
c.__workletHash = 6532652233494;
c.__initData = __initData;
return <ReanimatedRexport.View style={[style, useAnimatedStyle(c)]}>{children2}</ReanimatedRexport.View>;
};
BountiesModalContentScrollInner = function BountiesModalContentScrollInner(props) {
let memo, questHomeBounties, state, orbAmount, ownedByVerticalScrollExperiment, rewardTimerSeconds, ownedByVerticalScrollExperiment2, isAutoScrollEnabled, c20862_13, height2, slotHeight2, c20862_16, c20862_17, height3, lastBounty, fullRecap, handleRecapMomentumEnd, state2, setState2, state3, setState3, setState4, setState5, state4, setState6, sharedValue, sharedValue2, sharedValue3, hasSingleUseSwipeUpNux, dismissSingleUseSwipeUpNux, hasRecurringSwipeUpNux, dismissRecurringSwipeUpNux, hasRecurringSwipeUpNux2, hasRecurringSwipeUpNux3, memo2, ref, ref2, peekScale, cancel, dismissOnClose, takeDidAutoScroll, onPlaybackTimeChange, onEndCardVisible, pauseCountdown, resumeCountdown, memo3, callback, callback2, bountiesRecapOrbCount, callback3, memo4, derivedValue;
let state5, width, height4, c20863_3;
const { initialBountyId, sourceQuestContent } = props;
memo = void 0;
questHomeBounties = void 0;
state = void 0;
orbAmount = void 0;
ownedByVerticalScrollExperiment = void 0;
rewardTimerSeconds = void 0;
ownedByVerticalScrollExperiment2 = void 0;
isAutoScrollEnabled = void 0;
c20862_13 = void 0;
height2 = void 0;
slotHeight2 = void 0;
c20862_16 = void 0;
c20862_17 = void 0;
height3 = void 0;
lastBounty = void 0;
fullRecap = void 0;
handleRecapMomentumEnd = void 0;
state2 = void 0;
setState2 = void 0;
state3 = void 0;
setState3 = void 0;
setState4 = void 0;
setState5 = void 0;
state4 = void 0;
setState6 = void 0;
sharedValue = void 0;
sharedValue2 = void 0;
sharedValue3 = void 0;
hasSingleUseSwipeUpNux = void 0;
dismissSingleUseSwipeUpNux = void 0;
hasRecurringSwipeUpNux = void 0;
dismissRecurringSwipeUpNux = void 0;
hasRecurringSwipeUpNux2 = void 0;
hasRecurringSwipeUpNux3 = void 0;
memo2 = void 0;
ref = void 0;
ref2 = void 0;
peekScale = void 0;
cancel = void 0;
dismissOnClose = void 0;
takeDidAutoScroll = void 0;
onPlaybackTimeChange = void 0;
onEndCardVisible = void 0;
pauseCountdown = void 0;
resumeCountdown = void 0;
memo3 = void 0;
callback = void 0;
callback2 = void 0;
bountiesRecapOrbCount = void 0;
callback3 = void 0;
memo4 = void 0;
derivedValue = void 0;
const styles = useStyles();
const height = useWindowDimensions_native().height;
const ref3 = useRef(null);
const [state6, setState] = useState(BOUNTIES_MODAL_BASE_FOOTER_HEIGHT);
const callback4 = useCallback((a0) => {
setState(Math.ceil(a0.nativeEvent.layout.height));
}, []);
state5 = state6;
width = void 0;
height4 = void 0;
c20863_3 = void 0;
const windowDimensions_native = useWindowDimensions_native();
width = windowDimensions_native.width;
height4 = windowDimensions_native.height;
const safeAreaInsets_native = useSafeAreaInsets_native();
c20863_3 = safeAreaInsets_native;
memo = useMemo(() => {
const r9 = width - c20863_3.left - c20863_3.right;
const r16 = height4 - c20863_3.top - state5;
let r18 = r9 / c9811_19;
let r7 = r9;
if (r18 > r16) {
r7 = r16 * c9811_19;
r18 = r16;
}
return {
top: c20863_3.top,
left: Math.floor(c20863_3.left + (r9 - r7) / 2),
width: Math.floor(r7),
height: Math.floor(r18)
};
}, [width, height4, safeAreaInsets_native.top, safeAreaInsets_native.left, safeAreaInsets_native.right, state5]);
questHomeBounties = useQuestHomeBounties().questHomeBounties;
state = _slicedToArray(useState(() => {
const r5 = questHomeBounties.findIndex((questHomeBounty) => questHomeBounty.id === initialBountyId);
return r5 <= 0 ? questHomeBounties : [...questHomeBounties.slice(r5), ...questHomeBounties.slice(0, r5)];
}), 1)[0];
const bountiesExperience = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
orbAmount = bountiesExperience.orbAmount;
ownedByVerticalScrollExperiment = bountiesExperience.ownedByVerticalScrollExperiment;
rewardTimerSeconds = bountiesExperience.rewardTimerSeconds;
const scrollAffordanceVariant = bountiesExperience.scrollAffordanceVariant;
ownedByVerticalScrollExperiment2 = ownedByVerticalScrollExperiment;
isAutoScrollEnabled = scrollAffordanceVariant === "auto";
const shouldUseScrollIndicatorOverlay = _BountiesVerticalScrollExperiment.shouldUseScrollIndicatorOverlay(scrollAffordanceVariant);
const stateFromStores = useStateFromStores([BountyStore], () => BountyStore.getCompletedBountyCount(state) * orbAmount, [state, orbAmount]);
const r121 = state[0];
c20862_13 = r121;
const stateFromStores2 = useStateFromStores([BountyStore], () => {
if (c20862_13 == null) {
return false;
}
const bountyVideoProgress = BountyStore.getBountyVideoProgress(c20862_13.id);
return bountyVideoProgress != null && bountyVideoProgress.maxTimestampSec >= rewardTimerSeconds;
}, [r121, rewardTimerSeconds]);
height2 = memo.height;
slotHeight2 = height2 + PX_8;
const lastBountyIndex = state.length - 1;
c20862_16 = lastBountyIndex;
const enabled = stateFromStores > 0;
c20862_17 = enabled;
height3 = height2;
lastBounty = lastBountyIndex * slotHeight2;
fullRecap = lastBounty + height2;
handleRecapMomentumEnd = useBountiesRecapScroll({
listRef: ref3,
enabled,
offsets: useMemo(() => ({
lastBounty,
fullRecap,
revealHeight: height3
}), [fullRecap, lastBounty, height2])
}).handleRecapMomentumEnd;
const memo5 = useMemo(() => {
const r5 = state.map((item, index) => index * slotHeight2);
if (c20862_17) {
r5.push(fullRecap);
}
return r5;
}, [state, fullRecap, enabled, slotHeight2]);
[state2, setState2] = useState(false);
[state3, setState3] = useState(false);
let state7;
[state7, setState4] = useState(true);
let state8;
[state8, setState5] = useState(false);
[state4, setState6] = useState(0);
sharedValue = useSharedValue(false);
sharedValue2 = useSharedValue(false);
sharedValue3 = useSharedValue(0);
const bountySwipeUpNux = useBountySwipeUpNux({
isEligible: state.length > 1,
location: QuestsExperimentLocations.VIDEO_MODAL_MOBILE
});
hasSingleUseSwipeUpNux = bountySwipeUpNux.hasSingleUseSwipeUpNux;
dismissSingleUseSwipeUpNux = bountySwipeUpNux.dismissSingleUseSwipeUpNux;
hasRecurringSwipeUpNux = bountySwipeUpNux.hasRecurringSwipeUpNux;
dismissRecurringSwipeUpNux = bountySwipeUpNux.dismissRecurringSwipeUpNux;
const r179 = state4 === 0;
let visible2 = r179 && hasSingleUseSwipeUpNux && stateFromStores2;
hasRecurringSwipeUpNux2 = scrollAffordanceVariant === "peek" && hasRecurringSwipeUpNux;
hasRecurringSwipeUpNux3 = shouldUseScrollIndicatorOverlay && hasRecurringSwipeUpNux;
memo2 = useMemo(() => v4(), []);
ref = useRef(0);
ref2 = useRef(0);
useEffect(() => {
ref.current = Date.now();
}, []);
const callback5 = useCallback((a0) => {
if (a0 === _AnalyticsTypes.VerticalScrollingDirection.DOWN) {
trackBountyAutoScrollDismissed({
verticalScrollingPosition: state4,
scrollSessionId: memo2
});
}
}, [state4, memo2]);
const enabled2 = isAutoScrollEnabled ? state4 < lastBountyIndex : isAutoScrollEnabled;
const mode = r179 ? hasRecurringSwipeUpNux ? "countdown" : "hint" : "hint";
let activeBountyId = state[state4]?.id;
if (activeBountyId == null) {
activeBountyId = null;
}
const bountiesAutoScroll = useBountiesAutoScroll({
listRef: ref3,
enabled: enabled2,
mode,
activeIndex: state4,
activeBountyId,
slotHeight: slotHeight2,
onCountdownCancelled: callback5
});
const { visible, peekActive, progress, showProgressRing } = bountiesAutoScroll;
peekScale = bountiesAutoScroll.peekScale;
cancel = bountiesAutoScroll.cancel;
dismissOnClose = bountiesAutoScroll.dismissOnClose;
takeDidAutoScroll = bountiesAutoScroll.takeDidAutoScroll;
onPlaybackTimeChange = bountiesAutoScroll.onPlaybackTimeChange;
onEndCardVisible = bountiesAutoScroll.onEndCardVisible;
pauseCountdown = bountiesAutoScroll.pauseCountdown;
resumeCountdown = bountiesAutoScroll.resumeCountdown;
memo3 = useMemo(() => ({
onPlaybackTimeChange,
onPaused: pauseCountdown,
onResumed: resumeCountdown,
onEndCardVisible
}), [onEndCardVisible, onPlaybackTimeChange, pauseCountdown, resumeCountdown]);
callback = useCallback(function(a0, scrollingType = BountyScrollingType.MANUAL) {
const current = ref2.current;
if (a0 !== current) {
ref2.current = a0;
const current2 = Date.now();
const timeWatchedPreScrollMs = current2 - ref.current;
ref.current = current2;
trackBountyVerticalScroll({
scrollingType,
scrollingDirection: a0 > current ? _AnalyticsTypes.VerticalScrollingDirection.DOWN : _AnalyticsTypes.VerticalScrollingDirection.UP,
verticalScrollingPosition: a0,
scrollSessionId: memo2,
timeWatchedPreScrollMs
});
}
}, [memo2]);
callback2 = useCallback((a0) => {
const r7 = takeDidAutoScroll();
setState6(a0);
callback(a0, r7 ? BountyScrollingType.AUTO : BountyScrollingType.MANUAL);
if (state4 === 0 && a0 > 0) {
if (hasSingleUseSwipeUpNux) {
dismissSingleUseSwipeUpNux(ContentDismissActionType.USER_DISMISS);
} else if (hasRecurringSwipeUpNux) {
dismissRecurringSwipeUpNux(ContentDismissActionType.USER_DISMISS);
}
}
}, [takeDidAutoScroll, callback, state4, hasSingleUseSwipeUpNux, hasRecurringSwipeUpNux, dismissSingleUseSwipeUpNux, dismissRecurringSwipeUpNux]);
bountiesRecapOrbCount = useBountiesRecapOrbCount({
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
recapRevealHeight: height2,
targetOrbAmount: stateFromStores,
enabled
});
useEffect(() => {
const r7 = state[state4];
if (r7 != null) {
markAdContentSeen(AdCreativeType.BOUNTY, [r7.id]);
}
}, [state, state4]);
const callback6 = useCallback(() => {
dismissOnClose();
const r10 = state[state4];
if (r10 != null) {
const bountyVideoProgress = BountyStore.getBountyVideoProgress(r10.id);
let r11 = bountyVideoProgress?.maxTimestampSec;
if (r11 == null) {
r11 = 0;
}
let r14 = bountyVideoProgress?.duration;
if (r14 == null) {
r14 = 0;
}
const r1 = 1000 * rewardTimerSeconds;
trackAdContentEvent({
adContentId: r10.id,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_MODAL_CLOSED,
properties: {
content_name: getQuestContentName(QuestContent.VIDEO_MODAL_MOBILE),
content_id: QuestContent.VIDEO_MODAL_MOBILE,
video_progress: formatVideoProgressRatio(r11, r14),
threshold_met: 1000 * r11 >= r1,
reward_timer_seconds: r1 / 1000
},
sourceQuestContent
});
}
BountiesModalActionCreators.hideModal();
}, [state, state4, dismissOnClose, rewardTimerSeconds, sourceQuestContent]);
callback3 = useCallback(() => {
trackAdContentEvent({
adContentId: DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_MODAL_CLOSED,
properties: {
content_name: getQuestContentName(QuestContent.BOUNTIES_END_INTERSTITIAL),
content_id: QuestContent.BOUNTIES_END_INTERSTITIAL
},
sourceQuestContent
});
BountiesModalActionCreators.hideModal();
}, [sourceQuestContent]);
const Tt = function Tt(a0) {
sharedValue3.set(a0.contentOffset.y);
if (sharedValue2.get()) {
const r28 = Math.max(0, a0.contentSize.height - a0.layoutMeasurement.height);
sharedValue.set(a0.contentOffset.y >= 0 && a0.contentOffset.y <= r28);
}
};
Tt.__closure = {
scrollY: sharedValue3,
isDraggingSharedValue: sharedValue2,
isScrollingInBoundsSharedValue: sharedValue,
isScrollEventInBounds
};
Tt.__workletHash = 7942598540397;
Tt.__initData = __initData2;
const Bt = function Bt(a0) {
sharedValue2.set(true);
const r23 = Math.max(0, a0.contentSize.height - a0.layoutMeasurement.height);
sharedValue.set(a0.contentOffset.y >= 0 && a0.contentOffset.y <= r23);
};
Bt.__closure = {
isDraggingSharedValue: sharedValue2,
isScrollingInBoundsSharedValue: sharedValue,
isScrollEventInBounds
};
Bt.__workletHash = 14039038912528;
Bt.__initData = __initData3;
const Ct = function Ct(a0) {
const r6 = a0.contentOffset.y < 0 ? _AnalyticsTypes.VerticalScrollingDirection.DOWN : _AnalyticsTypes.VerticalScrollingDirection.UP;
_ReanimatedRexport.runOnJS(cancel)(r6);
sharedValue2.set(false);
if (!isAndroid) {
sharedValue.set(false);
}
};
Ct.__closure = {
VerticalScrollingDirection: _AnalyticsTypes.VerticalScrollingDirection,
runOnJS: _ReanimatedRexport.runOnJS,
cancelScrollAffordance: cancel,
isDraggingSharedValue: sharedValue2,
IS_ANDROID: isAndroid,
isScrollingInBoundsSharedValue: sharedValue
};
Ct.__workletHash = 10752087179842;
Ct.__initData = __initData4;
const It = function It(a0) {
if (c20862_17) {
_ReanimatedRexport.runOnJS(handleRecapMomentumEnd)(a0);
}
sharedValue.set(false);
};
It.__closure = {
showRecapPullZone: enabled,
runOnJS: _ReanimatedRexport.runOnJS,
handleRecapMomentumEnd,
isScrollingInBoundsSharedValue: sharedValue
};
It.__workletHash = 13684210320337;
It.__initData = __initData5;
const animatedScrollHandler = useAnimatedScrollHandler({
onScroll: Tt,
onBeginDrag: Bt,
onEndDrag: Ct,
onMomentumEnd: It
});
const xt = () => Math.min(Math.max(Math.round(sharedValue3.get() / slotHeight2), 0), c20862_16);
xt.__closure = {
scrollY: sharedValue3,
slotHeight: slotHeight2,
lastBountyIndex
};
xt.__workletHash = 14048843158960;
xt.__initData = __initData6;
const mt = function mt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(callback2)(a0);
}
};
mt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
commitSwipe: callback2
};
mt.__workletHash = 14015091539518;
mt.__initData = __initData7;
useAnimatedReaction(xt, mt);
const wt = () => c20862_17 && sharedValue3.get() >= lastBounty - _useBountiesRecapScroll.RECAP_SNAP_EPSILON;
wt.__closure = {
showRecapPullZone: enabled,
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
RECAP_SNAP_EPSILON: _useBountiesRecapScroll.RECAP_SNAP_EPSILON
};
wt.__workletHash = 6584708256992;
wt.__initData = __initData8;
const yt = function yt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState5)(a0);
}
};
yt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setShowRecapFooter: setState5
};
yt.__workletHash = 10788669301891;
yt.__initData = __initData9;
useAnimatedReaction(wt, yt);
const Nt = () => c20862_17 && sharedValue3.get() > lastBounty;
Nt.__closure = {
showRecapPullZone: enabled,
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty
};
Nt.__workletHash = 6186370630693;
Nt.__initData = __initData10;
const Mt = function Mt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState2)(a0);
}
};
Mt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsRecapPageRevealed: setState2
};
Mt.__workletHash = 12713474352874;
Mt.__initData = __initData11;
useAnimatedReaction(Nt, Mt);
const Vt = () => c20862_17 && sharedValue3.get() >= fullRecap - _useBountiesRecapScroll.RECAP_SNAP_EPSILON;
Vt.__closure = {
showRecapPullZone: enabled,
scrollY: sharedValue3,
fullRecapScrollOffset: fullRecap,
RECAP_SNAP_EPSILON: _useBountiesRecapScroll.RECAP_SNAP_EPSILON
};
Vt.__workletHash = 5669564400667;
Vt.__initData = __initData12;
const bt = function bt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState3)(a0);
}
};
bt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsRecapPageOnTop: setState3
};
bt.__workletHash = 8102193741774;
bt.__initData = __initData13;
useAnimatedReaction(Vt, bt);
const memo6 = useMemo(() => c20862_17 ? <BountiesRecapPullZone height={height3} /> : null, [height2, enabled]);
const memo7 = useMemo(() => [styles.listWrapper, {
top: 0,
left: memo.left,
width: memo.width,
height: memo.top + memo.height + 97
}], [styles.listWrapper, memo]);
const memo8 = useMemo(() => ({
paddingTop: memo.top,
paddingBottom: 97
}), [memo.top]);
memo4 = useMemo(() => ({
width: memo.width,
height: memo.height
}), [memo.width, memo.height]);
const memo9 = useMemo(() => [styles.closeButton, {
top: memo.top + Module712.space.PX_8,
left: memo.left + memo.width - Module712.space.PX_32 - Module712.space.PX_8
}], [styles.closeButton, memo.top, memo.left, memo.width]);
const memo10 = useMemo(() => [styles.autoScrollIndicator, {
top: memo.top + AUTO_SCROLL_PEEK_TOP_OFFSET + memo.height * AUTO_SCROLL_PEEK_SCALE + Module712.space.PX_32,
left: memo.left,
width: memo.width
}], [styles.autoScrollIndicator, memo.top, memo.height, memo.left, memo.width]);
const memo11 = useMemo(() => [styles.recapPage, {
top: memo.top,
left: memo.left,
width: memo.width,
height: height - memo.top,
...state3 ? {
zIndex: zIndex4
} : null
}], [state3, styles.recapPage, memo.top, memo.left, memo.width, height]);
const Ft = () => _useBountiesRecapScroll.getRevealProgress(sharedValue3.get(), lastBounty, height3);
Ft.__closure = {
getRevealProgress: _useBountiesRecapScroll.getRevealProgress,
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
recapRevealHeight: height2
};
Ft.__workletHash = 8427964721554;
Ft.__initData = __initData14;
derivedValue = useDerivedValue(Ft);
const Yt = () => ({
opacity: _ReanimatedRexport.interpolate(derivedValue.get(), [0, 1], [0, 1], _ReanimatedRexport.Extrapolation.CLAMP)
});
Yt.__closure = {
interpolate: _ReanimatedRexport.interpolate,
recapPullProgress: derivedValue,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Yt.__workletHash = 1497321349449;
Yt.__initData = __initData15;
const animatedStyle = useAnimatedStyle(Yt);
const Jt = () => ({
opacity: _ReanimatedRexport.interpolate(derivedValue.get(), [FOOTER_FADE_START_PROGRESS, FOOTER_FADE_END_PROGRESS], [1, 0], _ReanimatedRexport.Extrapolation.CLAMP)
});
Jt.__closure = {
interpolate: _ReanimatedRexport.interpolate,
recapPullProgress: derivedValue,
FOOTER_FADE_START_PROGRESS,
FOOTER_FADE_END_PROGRESS,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Jt.__workletHash = 3685190194249;
Jt.__initData = __initData16;
const animatedStyle2 = useAnimatedStyle(Jt);
const Ut = function Ut() {
return {
opacity: _ReanimatedRexport.interpolate(sharedValue3.get() >= lastBounty - slotHeight2 / 2 ? derivedValue.get() : _useBountiesRecapScroll.getRevealProgress(sharedValue3.get(), 0, height3), [FOOTER_FADE_START_PROGRESS, FOOTER_FADE_END_PROGRESS], [1, 0], _ReanimatedRexport.Extrapolation.CLAMP)
};
};
Ut.__closure = {
scrollY: sharedValue3,
lastBountyScrollOffset: lastBounty,
slotHeight: slotHeight2,
recapPullProgress: derivedValue,
getRevealProgress: _useBountiesRecapScroll.getRevealProgress,
recapRevealHeight: height2,
interpolate: _ReanimatedRexport.interpolate,
FOOTER_FADE_START_PROGRESS,
FOOTER_FADE_END_PROGRESS,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Ut.__workletHash = 15092194442650;
Ut.__initData = __initData17;
const animatedStyle3 = useAnimatedStyle(Ut);
const memo12 = useMemo(() => [styles.peekGradient, {
left: memo.left,
width: memo.width,
top: memo.top + memo.height,
bottom: 0
}], [styles.peekGradient, memo.left, memo.width, memo.top, memo.height]);
const Gt = () => ({
opacity: _ReanimatedRexport.interpolate(sharedValue3.get(), [0, slotHeight2], [1, 0], _ReanimatedRexport.Extrapolation.CLAMP)
});
Gt.__closure = {
interpolate: _ReanimatedRexport.interpolate,
scrollY: sharedValue3,
slotHeight: slotHeight2,
Extrapolation: _ReanimatedRexport.Extrapolation
};
Gt.__workletHash = 5908400559291;
Gt.__initData = __initData18;
const animatedStyle4 = useAnimatedStyle(Gt);
const Zt = () => derivedValue.get() < FOOTER_FADE_END_PROGRESS;
Zt.__closure = {
recapPullProgress: derivedValue,
FOOTER_FADE_END_PROGRESS
};
Zt.__workletHash = 547045699209;
Zt.__initData = __initData19;
const Qt = function Qt(a0, a1) {
if (a0 !== a1) {
_ReanimatedRexport.runOnJS(setState4)(a0);
}
};
Qt.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
setIsCloseButtonPressable: setState4
};
Qt.__workletHash = 6290671204687;
Qt.__initData = __initData20;
useAnimatedReaction(Zt, Qt);
const callback7 = useCallback(({ item, index: index2 }) => {
const shouldLoadHls = ownedByVerticalScrollExperiment ? index2 === state4 || index2 === state4 + 1 : true;
const isActive = index2 === state4;
let isScrollIndicatorOverlayEnabled = hasRecurringSwipeUpNux3;
if (hasRecurringSwipeUpNux3) {
isScrollIndicatorOverlayEnabled = index2 === 0;
}
return <BountiesScrollVideoItemContainer index={index2} slotHeight={slotHeight2} scrollY={sharedValue3} style={memo4} isPeekEnabled={hasRecurringSwipeUpNux2}>
<BountiesScrollVideoItem key={item.id} bounty={item} sourceQuestContent={sourceQuestContent} width={memo.width} height={memo.height} index={index2} isActive={isActive} isRecapPageRevealed={state2} isRecapPageOnTop={state3} isScrollingInBoundsSharedValue={sharedValue} isScrollIndicatorOverlayEnabled={isScrollIndicatorOverlayEnabled} shouldLoadHls={shouldLoadHls} scrollAffordance={isAutoScrollEnabled ? memo3 : void 0} peekScale={isActive ? isAutoScrollEnabled ? peekScale : void 0 : void 0} softDownloadCapsEnabled={ownedByVerticalScrollExperiment2} />
</BountiesScrollVideoItemContainer>;
}, [slotHeight2, sharedValue3, memo4, hasRecurringSwipeUpNux2, isAutoScrollEnabled, peekScale, sourceQuestContent, memo.width, memo.height, state4, state2, state3, sharedValue, hasRecurringSwipeUpNux3, memo3, ownedByVerticalScrollExperiment, ownedByVerticalScrollExperiment]);
const memo13 = useMemo(() => ({
activeIndex: state4,
isRecapPageRevealed: state2,
isRecapPageOnTop: state3,
width: memo.width,
height: memo.height,
isPeekEnabled: hasRecurringSwipeUpNux2,
isAutoScrollEnabled,
canShowScrollIndicatorOverlay: hasRecurringSwipeUpNux3,
ownedByVerticalScrollExperiment,
isSoftCapPreload: ownedByVerticalScrollExperiment2
}), [state4, state2, state3, memo.width, memo.height, hasRecurringSwipeUpNux2, isAutoScrollEnabled, hasRecurringSwipeUpNux3, ownedByVerticalScrollExperiment, ownedByVerticalScrollExperiment]);
const callback8 = useCallback((a0) => {
a0.size = height2;
}, [height2]);
if (state.length === 0) {
return null;
}
const r496 = visible2 ? <BountiesScrollPromptNuxFooter /> : state8 ? <BountiesScrollRecapFooter orbAmount={stateFromStores} /> : null;
const r515 = [<BountiesAutoScrollOverlayNuxGradient active={peekActive} />, enabled ? <ReanimatedRexport.View style={[memo11, animatedStyle]} pointerEvents={state3 ? "box-none" : "none"}>
<QuestContentImpressionTrackerNative adContentId={DEFAULT_PLACEHOLDER_ENTRYPOINT_BOUNTY_ID} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.BOUNTIES_END_INTERSTITIAL} overrideVisibility={state3} sourceQuestContent={sourceQuestContent}>
{() => <BountiesScrollRecapPage orbAmount={bountiesRecapOrbCount} onClose={callback3} style={{
flex: 1
}} />}
</QuestContentImpressionTrackerNative>
</ReanimatedRexport.View> : null, <View style={memo7}>
<AnimatedFlashList ref={ref3} data={state} keyExtractor={(item) => item.id} renderItem={callback7} extraData={memo13} overrideItemLayout={callback8} ItemSeparatorComponent={ItemSeparator} ListFooterComponent={memo6} snapToOffsets={memo5} snapToEnd={false} decelerationRate={0.85} showsVerticalScrollIndicator={false} drawDistance={slotHeight2} onScroll={animatedScrollHandler} scrollEventThrottle={16} contentContainerStyle={memo8} />
</View>, hasRecurringSwipeUpNux2 ? state.length > 1 ? <ReanimatedRexport.View pointerEvents="none" style={[memo12, animatedStyle4]}>
<Module4611 colors={_excluded} style={StyleSheet.absoluteFill} />
</ReanimatedRexport.View> : null : null, <ReanimatedRexport.View style={[memo9, animatedStyle2]} pointerEvents={state7 ? "box-none" : "none"}>
{state7 ? <BountiesModalCloseButton onPress={callback6} /> : null}
</ReanimatedRexport.View>, visible ? <View style={memo10} pointerEvents="none">
<BountiesAutoScrollIndicator progress={progress} showProgressRing={showProgressRing} />
</View> : null, ,];
if (!visible2) {
visible2 = state8;
}
r515[6] = <BountiesScrollPromptFooter visible={visible2} onContentLayout={callback4} zIndex={zIndex4} opacityStyle={animatedStyle3}>{r496}</BountiesScrollPromptFooter>;
return <View style={styles.root}>{r515}</View>;
};
isAndroid = _Module501.isAndroid();
zIndex = 0;
zIndex2 = 1;
zIndex3 = 2;
zIndex4 = 3;
c9811_19 = 0.5625;
PX_8 = Module712.space.PX_8;
_excluded = ["rgba(0,0,0,0)", "rgba(0,0,0,0.75)"];
FOOTER_FADE_START_PROGRESS = 0.05;
FOOTER_FADE_END_PROGRESS = 0.1;
const isScrollEventInBounds2 = function isScrollEventInBounds(a0) {
const r12 = Math.max(0, a0.contentSize.height - a0.layoutMeasurement.height);
return a0.contentOffset.y >= 0 && a0.contentOffset.y <= r12;
};
isScrollEventInBounds2.__closure = {};
isScrollEventInBounds2.__workletHash = 14148486927190;
isScrollEventInBounds2.__initData = {
code: "function isScrollEventInBounds_BountiesModalContentScrollTsx1(event){const maxOffset=Math.max(0,event.contentSize.height-event.layoutMeasurement.height);return event.contentOffset.y>=0&&event.contentOffset.y<=maxOffset;}"
};
isScrollEventInBounds = isScrollEventInBounds2;
useStyles = createStyles(() => ({
root: {
flex: 1
},
recapPage: {
position: "absolute",
zIndex
},
listWrapper: {
position: "absolute",
zIndex: zIndex2,
overflow: "hidden"
},
closeButton: {
position: "absolute",
zIndex: zIndex4
},
peekGradient: {
position: "absolute",
zIndex: zIndex3
},
autoScrollIndicator: {
position: "absolute",
zIndex: zIndex4,
alignItems: "center"
}
}));
__initData = {
code: "function BountiesModalContentScrollTsx2(){const{scrollY,index,slotHeight,isPeekEnabled,PEEK_OPACITY,interpolate,FADE_DEADBAND,Extrapolation}=this.__closure;const signedDistance=(scrollY.get()-index*slotHeight)/slotHeight;const distance=Math.abs(signedDistance);const peekOpacity=isPeekEnabled&&signedDistance<0&&index===1?PEEK_OPACITY:0;const opacity=interpolate(distance,[0,FADE_DEADBAND,1],[1,1,peekOpacity],Extrapolation.CLAMP);return{opacity:opacity};}"
};
__initData2 = {
code: "function BountiesModalContentScrollTsx3(event){const{scrollY,isDraggingSharedValue,isScrollingInBoundsSharedValue,isScrollEventInBounds}=this.__closure;scrollY.set(event.contentOffset.y);if(isDraggingSharedValue.get()){isScrollingInBoundsSharedValue.set(isScrollEventInBounds(event));}}"
};
__initData3 = {
code: "function BountiesModalContentScrollTsx4(event){const{isDraggingSharedValue,isScrollingInBoundsSharedValue,isScrollEventInBounds}=this.__closure;isDraggingSharedValue.set(true);isScrollingInBoundsSharedValue.set(isScrollEventInBounds(event));}"
};
__initData4 = {
code: "function BountiesModalContentScrollTsx5(event){const{VerticalScrollingDirection,runOnJS,cancelScrollAffordance,isDraggingSharedValue,IS_ANDROID,isScrollingInBoundsSharedValue}=this.__closure;const scrollingDirection=event.contentOffset.y<0?VerticalScrollingDirection.DOWN:VerticalScrollingDirection.UP;runOnJS(cancelScrollAffordance)(scrollingDirection);isDraggingSharedValue.set(false);if(!IS_ANDROID){isScrollingInBoundsSharedValue.set(false);}}"
};
__initData5 = {
code: "function BountiesModalContentScrollTsx6(event){const{showRecapPullZone,runOnJS,handleRecapMomentumEnd,isScrollingInBoundsSharedValue}=this.__closure;if(showRecapPullZone){runOnJS(handleRecapMomentumEnd)(event);}isScrollingInBoundsSharedValue.set(false);}"
};
__initData6 = {
code: "function BountiesModalContentScrollTsx7(){const{scrollY,slotHeight,lastBountyIndex}=this.__closure;return Math.min(Math.max(Math.round(scrollY.get()/slotHeight),0),lastBountyIndex);}"
};
__initData7 = {
code: "function BountiesModalContentScrollTsx8(next,prev){const{runOnJS,commitSwipe}=this.__closure;if(next!==prev){runOnJS(commitSwipe)(next);}}"
};
__initData8 = {
code: "function BountiesModalContentScrollTsx9(){const{showRecapPullZone,scrollY,lastBountyScrollOffset,RECAP_SNAP_EPSILON}=this.__closure;return showRecapPullZone&&scrollY.get()>=lastBountyScrollOffset-RECAP_SNAP_EPSILON;}"
};
__initData9 = {
code: "function BountiesModalContentScrollTsx10(show,previousShow){const{runOnJS,setShowRecapFooter}=this.__closure;if(show!==previousShow){runOnJS(setShowRecapFooter)(show);}}"
};
__initData10 = {
code: "function BountiesModalContentScrollTsx11(){const{showRecapPullZone,scrollY,lastBountyScrollOffset}=this.__closure;return showRecapPullZone&&scrollY.get()>lastBountyScrollOffset;}"
};
__initData11 = {
code: "function BountiesModalContentScrollTsx12(revealed,previousRevealed){const{runOnJS,setIsRecapPageRevealed}=this.__closure;if(revealed!==previousRevealed){runOnJS(setIsRecapPageRevealed)(revealed);}}"
};
__initData12 = {
code: "function BountiesModalContentScrollTsx13(){const{showRecapPullZone,scrollY,fullRecapScrollOffset,RECAP_SNAP_EPSILON}=this.__closure;return showRecapPullZone&&scrollY.get()>=fullRecapScrollOffset-RECAP_SNAP_EPSILON;}"
};
__initData13 = {
code: "function BountiesModalContentScrollTsx14(onTop,previousOnTop){const{runOnJS,setIsRecapPageOnTop}=this.__closure;if(onTop!==previousOnTop){runOnJS(setIsRecapPageOnTop)(onTop);}}"
};
__initData14 = {
code: "function BountiesModalContentScrollTsx15(){const{getRevealProgress,scrollY,lastBountyScrollOffset,recapRevealHeight}=this.__closure;return getRevealProgress(scrollY.get(),lastBountyScrollOffset,recapRevealHeight);}"
};
__initData15 = {
code: "function BountiesModalContentScrollTsx16(){const{interpolate,recapPullProgress,Extrapolation}=this.__closure;return{opacity:interpolate(recapPullProgress.get(),[0,1],[0,1],Extrapolation.CLAMP)};}"
};
__initData16 = {
code: "function BountiesModalContentScrollTsx17(){const{interpolate,recapPullProgress,FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS,Extrapolation}=this.__closure;return{opacity:interpolate(recapPullProgress.get(),[FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS],[1,0],Extrapolation.CLAMP)};}"
};
__initData17 = {
code: "function BountiesModalContentScrollTsx18(){const{scrollY,lastBountyScrollOffset,slotHeight,recapPullProgress,getRevealProgress,recapRevealHeight,interpolate,FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS,Extrapolation}=this.__closure;const progress=scrollY.get()>=lastBountyScrollOffset-slotHeight/2?recapPullProgress.get():getRevealProgress(scrollY.get(),0,recapRevealHeight);return{opacity:interpolate(progress,[FOOTER_FADE_START_PROGRESS,FOOTER_FADE_END_PROGRESS],[1,0],Extrapolation.CLAMP)};}"
};
__initData18 = {
code: "function BountiesModalContentScrollTsx19(){const{interpolate,scrollY,slotHeight,Extrapolation}=this.__closure;return{opacity:interpolate(scrollY.get(),[0,slotHeight],[1,0],Extrapolation.CLAMP)};}"
};
__initData19 = {
code: "function BountiesModalContentScrollTsx20(){const{recapPullProgress,FOOTER_FADE_END_PROGRESS}=this.__closure;return recapPullProgress.get()<FOOTER_FADE_END_PROGRESS;}"
};
__initData20 = {
code: "function BountiesModalContentScrollTsx21(pressable,previousPressable){const{runOnJS,setIsCloseButtonPressable}=this.__closure;if(pressable!==previousPressable){runOnJS(setIsCloseButtonPressable)(pressable);}}"
};
export default function BountiesModalContentScroll(props) {
return <ThemeContextProvider theme={ThemeTypes.DARKER}>
<BountiesModalContentScrollInner initialBountyId={props.bountyId} sourceQuestContent={props.sourceQuestContent} />
</ThemeContextProvider>;
};
@@ -0,0 +1,56 @@
// Metro module 14088 (f14089).
import { StyleSheet, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import Module4611 from "../../../../_bundle/Module4611";
import BountiesEndCardPressableCta from "./BountiesEndCardPressableCta";
let __initData;
const useStyles = createStyles(() => ({
container: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
justifyContent: "center",
alignItems: "center"
},
backdropTint: {
...StyleSheet.absoluteFillObject,
backgroundColor: "rgba(241, 251, 169, 0.15)"
},
backdropGradient: {
...StyleSheet.absoluteFillObject
}
}));
__initData = {
code: "function BountiesModalEndCardTsx1(){const{withTiming,visible,timingStandard}=this.__closure;return{opacity:withTiming(visible?1:0,timingStandard)};}"
};
export default function BountiesModalEndCard(props) {
const bounty = props.bounty;
let visible2 = props.visible;
const visible = visible2;
const sourceQuestContent = props.sourceQuestContent;
const styles = useStyles();
const y = () => ({
opacity: _timing.withTiming(visible ? 1 : 0, _timingPresets.timingStandard)
});
y.__closure = {
withTiming: _timing.withTiming,
visible,
timingStandard: _timingPresets.timingStandard
};
y.__workletHash = 15062259404736;
y.__initData = __initData;
const animatedStyle = useAnimatedStyle(y);
if (visible) {
visible2 = <ReanimatedRexport.View style={[styles.container, animatedStyle]} pointerEvents="box-none">
<View style={styles.backdropTint} />
<Module4611 colors={["rgba(0, 0, 0, 0.60)", "rgba(0, 0, 0, 1)"]} locations={[0, 0.841]} style={styles.backdropGradient} />
<BountiesEndCardPressableCta bounty={bounty} sourceQuestContent={sourceQuestContent} />
</ReanimatedRexport.View>;
}
return visible2;
};
@@ -0,0 +1,61 @@
// Metro module 14072 (f14073).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useGetQuestImpressionId } from "../../lib/analytics/ContentImpressionTrackerHooks";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import { getBountyCtaInfo } from "./BountyCtaHelpers";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { openAdGameLinkDirectly } from "../../utils/QuestPlatformUtils";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContent } from "../../../../_bundle/Module5038";
import { QuestContentCTA } from "../../lib/analytics/AnalyticsTypes";
import { intl, t } from "../../../../intl/index.native";
let __initData;
const useStyles = createStyles(() => ({
container: {
gap: Module712.space.PX_8
}
}));
__initData = {
code: "function BountiesModalEndedCtaButtonsTsx1(){const{withTiming,visible,timingStandard}=this.__closure;return{opacity:withTiming(visible?1:0,timingStandard)};}"
};
export default function BountiesModalEndedCtaButtons(props) {
const bounty = props.bounty;
let visible2 = props.visible;
const visible = visible2;
const { sourceQuestContent, onClose, showCloseButton = true, disabled = false } = props;
const styles = useStyles();
const getQuestImpressionId = useGetQuestImpressionId();
const y = () => ({
opacity: _timing.withTiming(visible ? 1 : 0, _timingPresets.timingStandard)
});
y.__closure = {
withTiming: _timing.withTiming,
visible,
timingStandard: _timingPresets.timingStandard
};
y.__workletHash = 11417131685254;
y.__initData = __initData;
const animatedStyle = useAnimatedStyle(y);
const bountyCtaInfo = getBountyCtaInfo(bounty);
if (visible) {
visible2 = <ReanimatedRexport.View style={[styles.container, animatedStyle]}>
<Button variant="primary-overlay" text={bountyCtaInfo.buttonLabel} size="lg" disabled={disabled} onPress={() => {
openAdGameLinkDirectly({
adContentId: bounty.id,
adCreativeType: AdCreativeType.BOUNTY,
cta: bounty.cta
}, {
content: QuestContent.VIDEO_MODAL_END_CARD,
ctaContent: QuestContentCTA.OPEN_GAME_LINK,
impressionId: getQuestImpressionId(),
sourceQuestContent
});
}} />
{showCloseButton ? <Button variant="secondary-overlay" text={intl.string(t.cpT0Cq)} size="lg" disabled={disabled} onPress={onClose} /> : null}
</ReanimatedRexport.View>;
}
return visible2;
};
@@ -0,0 +1,98 @@
// Metro module 14062 (f14063).
import { useState } from "react";
import { StyleSheet, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
let __initData, __initData2;
const useStyles = createStyles(() => ({
progressContainer: {
height: 4
},
progressTrack: {
...StyleSheet.absoluteFillObject,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT,
opacity: 0.54
},
progressBar: {
position: "absolute",
height: "100%",
left: 0,
bottom: 0,
borderRadius: Module712.radii.round,
backgroundColor: Module712.unsafe_rawColors.GREEN_300,
shadowOffset: {
width: 0,
height: 0
},
shadowRadius: 8,
shadowOpacity: 1,
elevation: 4,
shadowColor: "#30C773"
},
progressBarGlowLayer: {
position: "absolute",
height: "100%",
left: 0,
bottom: 0,
borderRadius: Module712.radii.round,
backgroundColor: Module712.unsafe_rawColors.GREEN_300,
shadowOffset: {
width: 0,
height: 0
},
shadowRadius: 12,
shadowOpacity: 1,
elevation: 8,
shadowColor: Module712.unsafe_rawColors.GREEN_300
}
}));
__initData = {
code: "function BountiesModalProgressTsx1(){const{withTiming,visible,timingFast}=this.__closure;return{opacity:withTiming(visible?1:0,timingFast)};}"
};
__initData2 = {
code: "function BountiesModalProgressTsx2(){const{withTiming,progress,shouldSkipAnimation,timingNone,timingFast}=this.__closure;return{width:withTiming(progress*100+\"%\",shouldSkipAnimation?timingNone:timingFast,'animate-always')};}"
};
export default function BountiesModalProgress(props) {
const { progress, visible, style } = props;
const styles = useStyles();
const [state, setState] = useState(false);
const [state2, setState2] = useState(progress);
if (progress !== state2) {
setState2(progress);
setState(progress < state2);
}
const O = () => ({
opacity: _timing.withTiming(visible ? 1 : 0, _timingPresets.timingFast)
});
O.__closure = {
withTiming: _timing.withTiming,
visible,
timingFast: _timingPresets.timingFast
};
O.__workletHash = 5158131592262;
O.__initData = __initData;
const animatedStyle = useAnimatedStyle(O);
const B = () => ({
width: _timing.withTiming(100 * progress + "%", state ? _timingPresets.timingNone : _timingPresets.timingFast, "animate-always")
});
B.__closure = {
withTiming: _timing.withTiming,
progress,
shouldSkipAnimation: state,
timingNone: _timingPresets.timingNone,
timingFast: _timingPresets.timingFast
};
B.__workletHash = 15586067343237;
B.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(B);
return <ReanimatedRexport.View style={[styles.progressContainer, style, animatedStyle]}>
<View style={styles.progressTrack} />
<ReanimatedRexport.View style={[styles.progressBarGlowLayer, animatedStyle2]} />
<ReanimatedRexport.View style={[styles.progressBar, animatedStyle2]} />
</ReanimatedRexport.View>;
};
export const PROGRESS_BAR_HEIGHT = 4;
@@ -0,0 +1,171 @@
// Metro module 14068 (f14069).
import { useEffect, useRef } from "react";
import { View } from "react-native";
import { SMALL_BUTTON_HEIGHT } from "../../../../design/components/Button/native/ButtonConstants.native";
import ReanimatedRexport, { Easing, useSharedValue, withSequence, withDelay, useAnimatedProps, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import Module8531, { Circle } from "../../../../_bundle/Module8531";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { withTiming } from "../../../../design/animation/reanimated/timing/timing";
import { Text } from "../../../../design/components/Text/native/Text";
import { CheckmarkSmallBoldIcon } from "../../../../design/components/Icon/native/redesign/generated/CheckmarkSmallBoldIcon";
const stroke = "#2ECC71";
let c9839_8 = (SMALL_BUTTON_HEIGHT - 4) / 2;
const PROGRESS_CIRCUMFERENCE = 2 * Math.PI * c9839_8;
const easing = Easing.bezier(0.15, 0.21, 0.58, 1);
const easing2 = Easing.bezier(0.61, 0, 0.58, 1);
const easing3 = Easing.bezier(0.42, 0, 0.58, 1);
const AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Circle);
const useStyles = createStyles({
progress: {
alignItems: "center",
justifyContent: "center",
backgroundColor: Module712.colors.CONTROL_OVERLAY_SECONDARY_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.round,
width: SMALL_BUTTON_HEIGHT,
height: SMALL_BUTTON_HEIGHT
},
ring: {
position: "absolute",
transform: [{
rotate: "-90deg"
}]
},
trackPath: {
color: Module712.colors.BACKGROUND_SURFACE_HIGHEST
},
countdownText: {
color: Module712.colors.CONTROL_OVERLAY_SECONDARY_TEXT_DEFAULT,
lineHeight: isAndroid() ? 14 : void 0
},
checkmarkLayer: {
position: "absolute",
inset: 6,
alignItems: "center",
justifyContent: "center"
},
checkmarkBackground: {
width: 20,
height: 20,
backgroundColor: "#2ECC71",
borderRadius: Module712.radii.round
},
checkmarkIcon: {
width: 20,
height: 20
}
});
const __initData = {
code: "function BountiesModalTimerTsx1(){const{PROGRESS_CIRCUMFERENCE,animatedProgress}=this.__closure;return{strokeDashoffset:PROGRESS_CIRCUMFERENCE-PROGRESS_CIRCUMFERENCE*animatedProgress.get()};}"
};
const __initData2 = {
code: "function BountiesModalTimerTsx2(){const{checkmarkBackgroundScale}=this.__closure;return{transform:[{scale:checkmarkBackgroundScale.get()}]};}"
};
const __initData3 = {
code: "function BountiesModalTimerTsx3(){const{checkmarkScale}=this.__closure;return{transform:[{scale:checkmarkScale.get()}]};}"
};
export default function BountiesModalTimer(props) {
let r31;
let ref;
const { isCompleted, totalSeconds, remainingSeconds } = props;
ref = void 0;
const styles = useStyles();
const r12 = isCompleted || remainingSeconds <= 0;
let c20883_0 = r12;
const r21 = Math.max(1, Math.ceil(remainingSeconds));
let c20883_1 = 0;
if (isCompleted) {
c20883_1 = 1;
r31 = 1;
} else {
const r5 = totalSeconds > 0;
r31 = 0;
if (r5) {
const r3 = 1 - remainingSeconds / totalSeconds;
c20883_1 = r3;
r31 = r3;
}
}
const sharedValue = useSharedValue(r31);
const sharedValue2 = useSharedValue(0);
const sharedValue3 = useSharedValue(0);
useEffect(() => {
sharedValue.set(withTiming(c20883_1, {
duration: 500
}, "animate-always"));
}, [sharedValue, r31]);
ref = useRef(false);
useEffect(() => {
const current = ref.current;
ref.current = true;
if (c20883_0) {
if (current) {
sharedValue2.set(withSequence(withTiming(1.65, {
duration: 267,
easing
}), withTiming(1, {
duration: 233,
easing: easing2
})));
sharedValue3.set(withDelay(167, withSequence(withTiming(1.25, {
duration: 167,
easing: easing3
}), withTiming(1, {
duration: 333,
easing: easing3
}))));
} else {
sharedValue2.set(1);
sharedValue3.set(1);
}
} else {
sharedValue2.set(0);
sharedValue3.set(0);
}
}, [r12, sharedValue2, sharedValue3]);
const U = () => ({
strokeDashoffset: PROGRESS_CIRCUMFERENCE - PROGRESS_CIRCUMFERENCE * sharedValue.get()
});
U.__closure = {
PROGRESS_CIRCUMFERENCE,
animatedProgress: sharedValue
};
U.__workletHash = 12964700773124;
U.__initData = __initData;
const animatedProps = useAnimatedProps(U);
const x = () => ({
transform: [{
scale: sharedValue2.get()
}]
});
x.__closure = {
checkmarkBackgroundScale: sharedValue2
};
x.__workletHash = 10834015407160;
x.__initData = __initData2;
const animatedStyle = useAnimatedStyle(x);
const G = () => ({
transform: [{
scale: sharedValue3.get()
}]
});
G.__closure = {
checkmarkScale: sharedValue3
};
G.__workletHash = 7510845920441;
G.__initData = __initData3;
return <View style={styles.progress}>
<Module8531 height={SMALL_BUTTON_HEIGHT} width={SMALL_BUTTON_HEIGHT} style={styles.ring}>
<Circle cx={SMALL_BUTTON_HEIGHT / 2} cy={SMALL_BUTTON_HEIGHT / 2} r={c9839_8} fill="none" stroke={styles.trackPath.color} strokeWidth={4} />
<AnimatedComponent cx={SMALL_BUTTON_HEIGHT / 2} cy={SMALL_BUTTON_HEIGHT / 2} r={c9839_8} fill="none" stroke={stroke} strokeWidth={4} strokeDasharray={PROGRESS_CIRCUMFERENCE} strokeLinecap="round" animatedProps={animatedProps} />
</Module8531>
{r12 ? !r12 : <Text variant="text-sm/semibold" style={styles.countdownText} maxFontSizeMultiplier={1}>{r21}</Text>}
<ReanimatedRexport.View style={[styles.checkmarkLayer, animatedStyle]}>
<View style={styles.checkmarkBackground} />
</ReanimatedRexport.View>
<ReanimatedRexport.View style={[styles.checkmarkLayer, useAnimatedStyle(G)]}>
<CheckmarkSmallBoldIcon size="custom" color={Module712.colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT} style={styles.checkmarkIcon} />
</ReanimatedRexport.View>
</View>;
};
@@ -0,0 +1,149 @@
// Metro module 14069 (f14070).
import { useCallback } from "react";
import { Pressable, StyleSheet, View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import { useIsBountiesVerticalScrollExperimentEnabled } from "../../experiments/BountiesVerticalScrollExperiment";
import { getBountyCtaInfo } from "./BountyCtaHelpers";
import * as _index_native from "../../../../intl/index.native";
import { intl } from "../../../../intl/index.native";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import Module4611 from "../../../../_bundle/Module4611";
import BountiesEndCardPressableCta from "./BountiesEndCardPressableCta";
import BountiesModalEndedCtaButtons from "./BountiesModalEndedCtaButtons";
import { Text } from "../../../../design/components/Text/native/Text";
import { RetryIcon } from "../../../../design/components/Icon/native/redesign/generated/RetryIcon";
import { useIsBountiesModalTransitionsRefactorEnabled } from "../../experiments/BountiesModalTransitionsRefactorExperiment";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useVisibilityTransition } from "./useVisibilityTransition";
import AnimatedEnterExitItem from "../../../../design/components/AnimatedEnterExitItem/native/AnimatedEnterExitItem";
let useStyles, t, n, __initData;
const BountiesScrollEndCardContent = function BountiesScrollEndCardContent(props) {
const { bounty, visible, onReplay, isActive, isScrollingInBoundsSharedValue, sourceQuestContent, opacityStyle } = props;
const styles = useStyles();
const isBountiesVerticalScrollExperimentEnabled = useIsBountiesVerticalScrollExperimentEnabled("BountiesScrollEndCard");
const bountyCtaInfo = getBountyCtaInfo(bounty);
const accessibilityLabel = intl.string(_index_native.t["9UtZAY"]);
const y = function y() {
const r4 = isScrollingInBoundsSharedValue == null ? void 0 : isScrollingInBoundsSharedValue.get();
return {
opacity: _timing.withTiming(isActive ? r4 !== true ? 1 : 0 : 0, _timingPresets.timingStandard)
};
};
y.__closure = {
isScrollingInBoundsSharedValue,
withTiming: _timing.withTiming,
isActive,
timingStandard: _timingPresets.timingStandard
};
y.__workletHash = 4903386092677;
y.__initData = __initData;
const animatedStyle = useAnimatedStyle(y);
return <ReanimatedRexport.View style={[styles.container, opacityStyle]} pointerEvents="box-none">
<View style={styles.backdropTint} pointerEvents="none" />
<Module4611 colors={["rgba(0, 0, 0, 0.48)", "rgba(0, 0, 0, 0.8)"]} style={styles.backdropGradient} pointerEvents="none" />
{isBountiesVerticalScrollExperimentEnabled ? <ReanimatedRexport.View style={[styles.overlayContent, animatedStyle]} pointerEvents="box-none">
<BountiesEndCardPressableCta bounty={bounty} sourceQuestContent={sourceQuestContent} disabled={!isActive} />
<View style={styles.endedCtaButtonsContainer} pointerEvents="box-none">
<BountiesModalEndedCtaButtons bounty={bounty} visible={visible} sourceQuestContent={sourceQuestContent} onClose={() => {}} showCloseButton={false} disabled={!isActive} />
</View>
</ReanimatedRexport.View> : <Pressable onPress={isActive ? onReplay : void 0} disabled={!isActive} accessibilityRole="button" accessibilityLabel={accessibilityLabel} style={styles.pressable}>
<ReanimatedRexport.View style={[styles.overlayContent, animatedStyle]}>
<View style={styles.textBlock}>
<Text variant="heading-md/semibold" color="text-strong">{bountyCtaInfo.label}</Text>
<Text variant="heading-sm/medium" color="text-default">{accessibilityLabel}</Text>
</View>
<RetryIcon accessible={false} color={Module712.colors.CONTROL_OVERLAY_SECONDARY_TEXT_DEFAULT} style={styles.replayIcon} />
</ReanimatedRexport.View>
</Pressable>}
</ReanimatedRexport.View>;
};
useStyles = createStyles(() => ({
container: {
...StyleSheet.absoluteFillObject
},
backdropTint: {
...StyleSheet.absoluteFillObject,
backgroundColor: "rgba(0, 0, 0, 0.6)"
},
backdropGradient: {
...StyleSheet.absoluteFillObject
},
overlayContent: {
...StyleSheet.absoluteFillObject,
justifyContent: "center",
alignItems: "center"
},
pressable: {
...StyleSheet.absoluteFillObject,
justifyContent: "center",
alignItems: "center"
},
textBlock: {
alignItems: "center",
gap: Module712.space.PX_4
},
replayIcon: {
margin: Module712.space.PX_12
},
endedCtaButtonsContainer: {
position: "absolute",
left: Module712.space.PX_16,
right: Module712.space.PX_16,
bottom: Module712.space.PX_16
}
}));
const r36 = function t(a0) {
return {
opacity: _timing.withTiming(a0, _timingPresets.timingStandard, "respect-motion-settings")
};
};
r36.__closure = {
withTiming: _timing.withTiming,
timingStandard: _timingPresets.timingStandard
};
r36.__workletHash = 12127714049951;
r36.__initData = {
code: "function BountiesScrollEndCardTsx1(visible){const{withTiming,timingStandard}=this.__closure;return{opacity:withTiming(visible,timingStandard,'respect-motion-settings')};}"
};
t = r36;
const r45 = function n(a0, a1) {
return {
opacity: _timing.withTiming(a0, _timingPresets.timingStandard, "respect-motion-settings", a1)
};
};
r45.__closure = {
withTiming: _timing.withTiming,
timingStandard: _timingPresets.timingStandard
};
r45.__workletHash = 7470211880124;
r45.__initData = {
code: "function BountiesScrollEndCardTsx2(visible,cleanUp){const{withTiming,timingStandard}=this.__closure;return{opacity:withTiming(visible,timingStandard,'respect-motion-settings',cleanUp)};}"
};
n = r45;
__initData = {
code: "function BountiesScrollEndCardTsx3(){const{isScrollingInBoundsSharedValue,withTiming,isActive,timingStandard}=this.__closure;var _isScrollingInBoundsS;const isScrollingInBounds=((_isScrollingInBoundsS=isScrollingInBoundsSharedValue)===null||_isScrollingInBoundsS===void 0?void 0:_isScrollingInBoundsS.get())===true;return{opacity:withTiming(isActive&&!isScrollingInBounds?1:0,timingStandard)};}"
};
export default function BountiesScrollEndCard(props) {
const visible = props.visible;
const isBountiesModalTransitionsRefactorEnabled = useIsBountiesModalTransitionsRefactorEnabled(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const callback = useCallback((a0, a1) => <BountiesScrollEndCardContent {...a0} opacityStyle={a1} />, []);
const visibilityTransition = useVisibilityTransition({
visible,
entranceTiming: _timingPresets.timingStandard,
exitTiming: _timingPresets.timingStandard
});
const opacityStyle = visibilityTransition.opacityStyle;
let shouldRender = visibilityTransition.shouldRender;
if (isBountiesModalTransitionsRefactorEnabled) {
shouldRender = <AnimatedEnterExitItem useReducedMotion={stateFromStores} item={visible ? props : void 0} entering={t} exiting={n} renderItem={callback} />;
} else if (shouldRender) {
shouldRender = <BountiesScrollEndCardContent {...props} opacityStyle={opacityStyle} />;
}
return shouldRender;
};
@@ -0,0 +1,32 @@
// Metro module 14065 (f14066).
import { useState } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module712 from "../../../../_bundle/Module712";
import { BountiesScrollIndicatorRive } from "../../../../_bundle/Module3901";
const useStyles = createStyles(() => ({
container: {
width: 80,
height: 80
}
}));
export default function BountiesScrollIndicatorAnimation(props) {
const { visible, isFadingInContent } = props;
const styles = useStyles();
const token = useToken(Module712.colors.TEXT_DEFAULT);
const [key, setState] = useState(0);
const [state, setState2] = useState(visible);
if (visible !== state) {
setState2(visible);
if (visible) {
setState((prevState) => prevState + 1);
}
}
return <View style={styles.container}>
<BountiesScrollIndicatorRive key={key} stateMachine="State Machine 1" fit="contain" dataBinding={{
color: token,
startAnimation: !isFadingInContent
}} />
</View>;
};
@@ -0,0 +1,186 @@
// Metro module 14064 (f14065).
import { useState, useEffect, useCallback } from "react";
import { StyleSheet } from "react-native";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import { timingSlowDuration } from "../../../../design/animation/reanimated/timing/timingPresets";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import ReanimatedRexport, { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import Module4611 from "../../../../_bundle/Module4611";
import BountiesScrollIndicatorAnimation from "./BountiesScrollIndicatorAnimation";
import { Text } from "../../../../design/components/Text/native/Text";
import * as _index_native from "../../../../intl/index.native";
import { intl } from "../../../../intl/index.native";
function $mk118410($env) {
return () => {
let env32054;
const r8 = $env.$parent.$parent[1];
const r0 = $env[0];
r8(r0);
const r10 = $env.$parent;
const r11 = env32054 = {
$parent: r10
};
env32054[0] = !r0;
const r6 = setTimeout;
const r12 = r0 ? r10.$parent.$parent[9] : 5000;
r10[0] = r6($mk118410(r11), r12);
};
}
let c9835_11, c9835_12, c9835_13, c9835_14;
let env9835 = {};
const _excluded = ["rgba(0,0,0,0)", "rgba(0,0,0,0.7)", "rgba(0,0,0,1)"];
const c9835_9 = 5000 + timingSlowDuration;
const useStyles = createStyles(() => ({
scrollIndicator: {
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: "45%",
alignItems: "center",
justifyContent: "center",
paddingHorizontal: Module712.space.PX_16
},
scrollIndicatorContent: {
position: "absolute",
bottom: 124,
left: 0,
right: 0,
alignItems: "center",
justifyContent: "flex-start",
gap: Module712.space.PX_8
},
scrollIndicatorText: {
textAlign: "center"
}
}));
c9835_11 = {
code: "function BountiesScrollIndicatorOverlayTsx1(){const{withTiming,visible,enabled,timingSlow,timingStandard,runOnJS,animationCallbackJSThread}=this.__closure;return{opacity:withTiming(visible?1:0,enabled?timingSlow:timingStandard,'respect-motion-settings',function(){'worklet';runOnJS(animationCallbackJSThread)();})};}"
};
c9835_12 = {
code: "function BountiesScrollIndicatorOverlayTsx2(){const{runOnJS,animationCallbackJSThread}=this.__closure;runOnJS(animationCallbackJSThread)();}"
};
c9835_13 = {
code: "function BountiesScrollIndicatorOverlayTsx3(){const{withTiming,visible,isEndCardVisible,enabled,timingStandard,timingSlow}=this.__closure;return{opacity:withTiming(visible&&!isEndCardVisible?1:0,isEndCardVisible||!enabled?timingStandard:timingSlow)};}"
};
c9835_14 = {
code: "function BountiesScrollIndicatorOverlayTsx4(){const{withTiming,visible,timingStandard}=this.__closure;return{transform:[{scale:withTiming(visible?1:0.9,timingStandard)}]};}"
};
export default function BountiesScrollIndicatorOverlay(props) {
let state, setState, callback;
const { enabled, isEndCardVisible, opacityStyle } = props;
state = void 0;
setState = void 0;
callback = void 0;
const styles = useStyles();
let env20880 = {
$parent: env9835
};
env20880[0] = enabled;
env20880[1] = void 0;
const [state2, setState2] = useState(true);
env20880[1] = setState2;
const [state3, setState3] = useState(enabled);
if (enabled !== state3) {
setState3(enabled);
if (enabled) {
setState2(true);
}
}
useEffect(() => {
if (env20880[0]) {
let env30695;
let env30696;
const r6 = env30695 = {
$parent: env20880
};
const r2 = env30696 = {
$parent: r6
};
env30696[0] = false;
env30695[0] = setTimeout($mk118410(r2), c9835_9);
return () => clearTimeout(env30695[0]);
}
}, [enabled]);
state = enabled ? state2 : enabled;
let isFadingInContent;
[isFadingInContent, setState] = useState(state);
const [state4, setState4] = useState(state);
if (state !== state4) {
setState4(state);
if (state) {
setState(true);
}
}
callback = useCallback(() => {
setState(false);
}, []);
const E = () => {
const r0 = state ? 1 : 0;
const r6 = enabled ? _timingPresets.timingSlow : _timingPresets.timingStandard;
const t = function t() {
_ReanimatedRexport.runOnJS(callback)();
};
t.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
animationCallbackJSThread: callback
};
t.__workletHash = 7847207274031;
t.__initData = c9835_12;
return {
opacity: _timing.withTiming(r0, r6, "respect-motion-settings", t)
};
};
E.__closure = {
withTiming: _timing.withTiming,
visible: state,
enabled,
timingSlow: _timingPresets.timingSlow,
timingStandard: _timingPresets.timingStandard,
runOnJS: _ReanimatedRexport.runOnJS,
animationCallbackJSThread: callback
};
E.__workletHash = 2813930896935;
E.__initData = c9835_11;
const animatedStyle = useAnimatedStyle(E);
const j = () => ({
opacity: _timing.withTiming(state ? isEndCardVisible ? 0 : 1 : 0, !isEndCardVisible && enabled ? _timingPresets.timingSlow : _timingPresets.timingStandard)
});
j.__closure = {
withTiming: _timing.withTiming,
visible: state,
isEndCardVisible,
enabled,
timingStandard: _timingPresets.timingStandard,
timingSlow: _timingPresets.timingSlow
};
j.__workletHash = 12172713560290;
j.__initData = c9835_13;
const animatedStyle2 = useAnimatedStyle(j);
const A = () => ({
transform: [{
scale: _timing.withTiming(state ? 1 : 0.9, _timingPresets.timingStandard)
}]
});
A.__closure = {
withTiming: _timing.withTiming,
visible: state,
timingStandard: _timingPresets.timingStandard
};
A.__workletHash = 4041303236067;
A.__initData = c9835_14;
return <ReanimatedRexport.View style={[styles.scrollIndicator, opacityStyle]} pointerEvents="none">
<ReanimatedRexport.View style={[StyleSheet.absoluteFill, animatedStyle2]}>
<Module4611 colors={_excluded} style={StyleSheet.absoluteFill} />
</ReanimatedRexport.View>
<ReanimatedRexport.View style={[styles.scrollIndicatorContent, [animatedStyle, useAnimatedStyle(A)]]}>
<BountiesScrollIndicatorAnimation visible={state} isFadingInContent={isFadingInContent} />
<Text variant="text-sm/semibold" color="text-default" style={styles.scrollIndicatorText}>
{intl.string(_index_native.t.eafsh4)}
</Text>
</ReanimatedRexport.View>
</ReanimatedRexport.View>;
};
@@ -0,0 +1,103 @@
// Metro module 14036 (f14037).
import { useMemo, useCallback } from "react";
import { StyleSheet } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { BountiesScrollGradientRive } from "../../../../_bundle/Module3901";
import { useIsBountiesModalTransitionsRefactorEnabled } from "../../experiments/BountiesModalTransitionsRefactorExperiment";
import { useVisibilityTransition } from "./useVisibilityTransition";
import AnimatedEnterExitItem from "../../../../design/components/AnimatedEnterExitItem/native/AnimatedEnterExitItem";
let useStyles, t, n;
const BountiesScrollPromptFooterContent = function BountiesScrollPromptFooterContent(props) {
let c20864_1;
const { children, onContentLayout, zIndex, opacityStyle, visibilityOpacityStyle } = props;
c20864_1 = void 0;
const styles = useStyles();
const memo = useMemo(() => zIndex != null ? {
zIndex
} : void 0, [zIndex]);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const safeAreaInsets_native = useSafeAreaInsets_native();
c20864_1 = safeAreaInsets_native;
return <ReanimatedRexport.View style={[styles.root, visibilityOpacityStyle, memo]} pointerEvents="none">
<ReanimatedRexport.View style={[styles.gradient, opacityStyle]}>
<BountiesScrollGradientRive stateMachine="State Machine 1" fit="fill" alignment="bottom-center" withReducedMotion={stateFromStores ? "halt" : "play"} />
</ReanimatedRexport.View>
<ReanimatedRexport.View style={[styles.content, useMemo(() => ({
paddingBottom: Math.max(c20864_1.bottom, Module712.space.PX_8)
}), [safeAreaInsets_native.bottom]), opacityStyle]} onLayout={onContentLayout}>{children}</ReanimatedRexport.View>
</ReanimatedRexport.View>;
};
useStyles = createStyles(() => ({
root: {
position: "absolute",
bottom: 0,
left: 0,
right: 0
},
content: {
flex: 1,
minHeight: 97,
alignItems: "center",
justifyContent: "center",
paddingHorizontal: Module712.space.PX_16
},
gradient: {
...StyleSheet.absoluteFillObject
}
}));
const r34 = function t(a0) {
return {
opacity: _timing.withTiming(a0, _timingPresets.timingStandard, "respect-motion-settings")
};
};
r34.__closure = {
withTiming: _timing.withTiming,
timingStandard: _timingPresets.timingStandard
};
r34.__workletHash = 11416950434629;
r34.__initData = {
code: "function BountiesScrollPromptFooterTsx1(visible){const{withTiming,timingStandard}=this.__closure;return{opacity:withTiming(visible,timingStandard,'respect-motion-settings')};}"
};
t = r34;
const r43 = function n(a0, a1) {
return {
opacity: _timing.withTiming(a0, _timingPresets.timingStandard, "respect-motion-settings", a1)
};
};
r43.__closure = {
withTiming: _timing.withTiming,
timingStandard: _timingPresets.timingStandard
};
r43.__workletHash = 9928471408966;
r43.__initData = {
code: "function BountiesScrollPromptFooterTsx2(visible,cleanUp){const{withTiming,timingStandard}=this.__closure;return{opacity:withTiming(visible,timingStandard,'respect-motion-settings',cleanUp)};}"
};
n = r43;
export default function BountiesScrollPromptFooter(props) {
const { visible, ...props2 } = props;
const isBountiesModalTransitionsRefactorEnabled = useIsBountiesModalTransitionsRefactorEnabled(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const callback = useCallback((a0, a1) => <BountiesScrollPromptFooterContent {...a0} visibilityOpacityStyle={a1} />, []);
const visibilityTransition = useVisibilityTransition({
visible,
entranceTiming: _timingPresets.timingStandard,
exitTiming: _timingPresets.timingStandard
});
const opacityStyle = visibilityTransition.opacityStyle;
let shouldRender = visibilityTransition.shouldRender;
if (isBountiesModalTransitionsRefactorEnabled) {
shouldRender = <AnimatedEnterExitItem useReducedMotion={stateFromStores} item={visible ? props2 : void 0} entering={t} exiting={n} renderItem={callback} />;
} else if (shouldRender) {
shouldRender = <BountiesScrollPromptFooterContent {...props2} visibilityOpacityStyle={opacityStyle} />;
}
return shouldRender;
};
export const BOUNTIES_MODAL_BASE_FOOTER_HEIGHT = 97;
@@ -0,0 +1,29 @@
// Metro module 14073 (f14074).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles(() => ({
root: {
alignItems: "center",
gap: 2
},
titleText: {
textAlign: "center"
},
swipeText: {
textAlign: "center",
textTransform: "uppercase"
}
}));
export default function BountiesScrollPromptFooter() {
const styles = useStyles();
return <View style={styles.root}>
<Text variant="text-md/semibold" color="text-default" style={styles.titleText}>
{intl.string(t.H57f41)}
</Text>
<Text variant="text-xxs/semibold" color="text-muted" style={styles.swipeText}>
{intl.string(t.tG0zsk)}
</Text>
</View>;
};
@@ -0,0 +1,53 @@
// Metro module 14074 (f14075).
import { View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { isIOS } from "../../../../utils/PlatformUtils";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { OrbsIcon } from "../../../../design/components/Icon/native/redesign/generated/OrbsIcon";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { BountiesScrollGradientRive } from "../../../../_bundle/Module3901";
const useStyles = createStyles(() => ({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
gap: Module712.space.PX_4
},
headerLabel: {
textTransform: "uppercase"
},
orbRow: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
},
rive: {
flex: 1,
width: "100%"
},
orbAmount: {
marginTop: isIOS() ? 6 : 0
}
}));
export function BountiesScrollRecapFooter(props) {
const orbAmount = props.orbAmount;
const styles = useStyles();
const r6 = intl.string(t.d6Rrn6);
return <View style={styles.container} pointerEvents="none" accessible accessibilityRole="text" accessibilityLabel={`${r6}, +${orbAmount}`}>
<Text variant="text-xs/bold" color="text-brand" style={styles.headerLabel} accessible={false}>{r6}</Text>
<View style={styles.orbRow} accessible={false} importantForAccessibility="no-hide-descendants">
<OrbsIcon size="sm" color="icon-strong" accessible={false} />
<Text variant="display-sm" color="text-strong" accessible={false} style={styles.orbAmount}>
{`+${orbAmount}`}
</Text>
</View>
</View>;
}
export function BountiesScrollRecapFooterGradient() {
return <View style={useStyles().rive}>
<BountiesScrollGradientRive stateMachine="State Machine 1" fit="fill" alignment="bottom-center" withReducedMotion={useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion) ? "halt" : "play"} />
</View>;
}
@@ -0,0 +1,112 @@
// Metro module 14076 (f14077).
import { StyleSheet, View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { isAndroid, isIOS } from "../../../../utils/PlatformUtils";
import { APNGPlayer } from "../../../image/native/APNGPlayer.android";
import Module14077 from "../../../../_bundle/Module14077";
import { VideoComponent } from "../../../../components_native/common/Video";
import Module14078 from "../../../../_bundle/Module14078";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import Module14079 from "../../../../_bundle/Module14079";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { OrbsIcon } from "../../../../design/components/Icon/native/redesign/generated/OrbsIcon";
import { Button } from "../../../../design/components/Button/native/Button.native";
let lg, useStyles;
const BountiesRecapOrbsBackground = function BountiesRecapOrbsBackground(props) {
const { style, reducedMotion } = props;
return isAndroid() ? <View style={style} needsOffscreenAlphaCompositing renderToHardwareTextureAndroid pointerEvents="none">
<APNGPlayer url={Module14077} style={StyleSheet.absoluteFillObject} autoplay={!reducedMotion} />
</View> : <VideoComponent source={{
uri: Module14078
}} style={style} resizeMode="contain" paused={reducedMotion} disableFocus preventsDisplaySleepDuringVideoPlayback={false} importantForAccessibility="no-hide-descendants" />;
};
lg = Module712.radii.lg;
useStyles = createStyles(() => ({
root: {
overflow: "hidden",
borderRadius: lg,
backgroundColor: Module712.colors.MOBILE_ACTIONSHEET_BACKGROUND
},
content: {
flex: 1,
paddingHorizontal: Module712.space.PX_24,
justifyContent: "center",
alignItems: "center"
},
centeredCopy: {
alignItems: "center",
width: "100%"
},
orbsBackground: {
position: "absolute",
top: 0,
left: 0,
right: 0,
height: "40%",
zIndex: 1
},
headerLabel: {
paddingBottom: Module712.space.PX_4,
textTransform: "uppercase"
},
titleRow: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
paddingBottom: Module712.space.PX_24,
gap: Module712.space.PX_8
},
actions: {
position: "absolute",
left: Module712.space.PX_24,
right: Module712.space.PX_24,
gap: Module712.space.PX_12
},
orbAmount: {
marginTop: isIOS() ? 6 : 0,
lineHeight: 46
}
}));
export function BountiesScrollRecapPage(props) {
const { orbAmount, onClose, style } = props;
const styles = useStyles();
const safeAreaInsets_native = useSafeAreaInsets_native();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
return <View style={[styles.root, style]} pointerEvents="box-none">
<View style={StyleSheet.absoluteFillObject} pointerEvents="none">
<VideoComponent source={{
uri: Module14079
}} style={StyleSheet.absoluteFillObject} resizeMode="cover" paused={stateFromStores} disableFocus preventsDisplaySleepDuringVideoPlayback={false} importantForAccessibility="no-hide-descendants" />
<BountiesRecapOrbsBackground style={styles.orbsBackground} reducedMotion={stateFromStores} />
</View>
<View style={styles.content} pointerEvents="box-none">
<View style={styles.centeredCopy} pointerEvents="none">
<Text variant="text-xs/bold" color="text-brand" style={styles.headerLabel}>
{intl.string(t.d6Rrn6)}
</Text>
<View accessible accessibilityRole="text" accessibilityLabel={`+${orbAmount}`}>
<View style={styles.titleRow}>
<OrbsIcon size="lg" color="icon-strong" accessible={false} />
<Text variant="display-lg" color="text-strong" accessible={false} style={styles.orbAmount}>
{`+${orbAmount}`}
</Text>
</View>
</View>
<Text variant="text-md/medium" color="text-muted" style={{
textAlign: "center"
}}>
{intl.string(t.x0Ffz3)}
</Text>
</View>
<View style={[styles.actions, {
bottom: safeAreaInsets_native.bottom + Module712.space.PX_8
}]}>
<Button grow variant="primary" text={intl.string(t.i4jeWR)} size="lg" onPress={onClose} />
</View>
</View>
</View>;
}
@@ -0,0 +1,305 @@
// Metro module 14044 (f14045).
import { useMemo, useState, useRef, useCallback, useEffect } from "react";
import { View } from "react-native";
import VirtualCurrencyStore from "../../../virtual_currency/stores/VirtualCurrencyStore";
import BountyStore from "../../BountyStore";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { jsx } from "react/jsx-runtime";
import { PlayerState } from "../AdVideoPlayer";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import { BountyVideoEndMode, useBountiesModalTiming } from "./useBountiesModalTiming";
import { claimBountyReward } from "../../BountyActionCreators";
import { openBountyRewardClaimErrorToast } from "./bountyError";
import { useBountyVideoProgressPersistence } from "./useBountyVideoProgressPersistence";
import { useBountiesModalVideoAnalytics } from "./useBountiesModalVideoAnalytics";
import { BountyVideo } from "./BountyVideo";
import { QuestContentImpressionTrackerNative, BillableAdPlacementImpressionTrackerNative } from "../QuestContentImpressionTracker.native";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContent } from "../../../../_bundle/Module5038";
import BountiesScrollEndCard from "./BountiesScrollEndCard";
function $mk116636($env) {
return (a0) => a0 != null ? a0 + $env[7] : null;
}
let env9820 = {};
const BountiesScrollVideoItemInner = function BountiesScrollVideoItemInner(props) {
let env20869 = {
$parent: env9820
};
const bounty2 = props.bounty;
env20869[0] = bounty2;
const sourceQuestContent2 = props.sourceQuestContent;
env20869[1] = sourceQuestContent2;
const width2 = props.width;
env20869[2] = width2;
const height2 = props.height;
env20869[3] = height2;
const { index: index2, isActive: isActive3 } = props;
env20869[4] = isActive3;
const { isRecapPageRevealed: isRecapPageRevealed2, isRecapPageOnTop: isRecapPageOnTop2, isScrollingInBoundsSharedValue: isScrollingInBoundsSharedValue2 } = props;
env20869[5] = isScrollingInBoundsSharedValue2;
const { isScrollIndicatorOverlayEnabled: isScrollIndicatorOverlayEnabled2 = false, shouldLoadHls: shouldLoadHls2 = true, scrollAffordance: scrollAffordance2, peekScale: peekScale2, softDownloadCapsEnabled: softDownloadCapsEnabled2 = false } = props;
env20869[6] = void 0;
env20869[7] = void 0;
env20869[8] = void 0;
env20869[9] = void 0;
env20869[10] = void 0;
env20869[11] = void 0;
env20869[12] = void 0;
env20869[13] = void 0;
env20869[14] = void 0;
env20869[15] = void 0;
env20869[16] = void 0;
env20869[17] = void 0;
env20869[18] = void 0;
env20869[19] = void 0;
env20869[20] = void 0;
const memo = useMemo(() => ({
width: env20869[2],
height: env20869[3]
}), [width2, height2]);
const stateFromStores = useStateFromStores([BountyStore], () => BountyStore.isBountyCompleted(env20869[0].id));
env20869[6] = stateFromStores;
const [shouldLoadHls3, setState] = useState(shouldLoadHls2);
const [state, setState2] = useState(shouldLoadHls2);
if (state !== shouldLoadHls2) {
setState2(shouldLoadHls2);
if (shouldLoadHls2) {
setState(true);
}
}
const bountiesExperience = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
const { loopingEnabled, ownedByVerticalScrollExperiment, stage1Enabled, orbAmount } = bountiesExperience;
env20869[7] = orbAmount;
const rewardTimerSeconds = bountiesExperience.rewardTimerSeconds;
const endMode = loopingEnabled ? BountyVideoEndMode.LOOP : ownedByVerticalScrollExperiment ? BountyVideoEndMode.END_CARD : BountyVideoEndMode.END_CARD_WITH_CTA;
const rewardDurationMs = !stage1Enabled && !ownedByVerticalScrollExperiment ? 1000 * bounty2.rewardTimerSeconds : 1000 * rewardTimerSeconds;
env20869[8] = rewardDurationMs;
const ref4 = useRef(null);
const isActive = isActive3;
const ref = ref4;
const ref2 = useRef(true);
const ref3 = useRef(null);
const callback2 = useCallback((a0) => {
ref3.current = a0;
}, []);
useEffect(() => {
if (ref2.current) {
ref2.current = false;
} else {
let r7 = isActive;
if (isActive) {
r7 = ref3.current === PlayerState.PAUSED;
}
if (r7) {
const current = ref.current;
if (current != null) {
current.play();
}
}
}
}, [isActive, ref]);
const [state2, setState3] = useState(isActive);
const [orbsBalance, setState4] = useState(() => env20869[4] ? VirtualCurrencyStore.getCurrentBalance() : null);
env20869[9] = setState4;
const [balanceWidgetPillResetKey, setState5] = useState(0);
if (state2 !== isActive) {
setState3(isActive);
if (isActive) {
const currentBalance = VirtualCurrencyStore.getCurrentBalance();
setState4(currentBalance);
if (currentBalance !== orbsBalance) {
setState5((prevState5) => prevState5 + 1);
}
}
}
const callback = useCallback(async () => {
let c27617_0, c27617_1, c27617_2;
let c27617_3 = 0;
const r13 = env20869;
L14: {
try {
let env30694;
c27617_1 = r13;
const r28 = env30694 = {
$parent: r13
};
c27617_0 = r28;
env30694[0] = false;
c27617_3 = 1;
await claimBountyReward(env20869[0].id, env20869[1]);
env30694[0] = true;
c27617_3 = 0;
if (env30694[0] && env20869[4]) {
env20869[9]($mk116636(env20869));
}
} catch ($e) {
const r26 = $e;
let r7 = r26;
c27617_2 = r26;
if (c27617_3 !== 0) {
while (true) {
try {
const r70 = c27617_2;
c27617_3 = 0;
env30694[1] = r70;
openBountyRewardClaimErrorToast(env30694[1]);
if (!(env30694[0] && env20869[4])) {
break L14;
}
env20869[9]($mk116636(env20869));
break L14;
} catch (r66) {
r7 = r66;
c27617_2 = r66;
if (c27617_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
}, [bounty2.id, isActive, orbAmount, sourceQuestContent2]);
const bountyVideoProgressPersistence = useBountyVideoProgressPersistence({
bountyId: bounty2.id,
endMode
});
const { initialProgress, handleProgress } = bountyVideoProgressPersistence;
env20869[10] = handleProgress;
const flushProgress = bountyVideoProgressPersistence.flushProgress;
env20869[11] = flushProgress;
useEffect(() => () => (0, env20869[11])(), [flushProgress]);
const bountiesModalVideoAnalytics = useBountiesModalVideoAnalytics({
bountyId: bounty2.id,
sourceQuestContent: sourceQuestContent2,
rewardDurationMs,
initialPlaybackTimeSec: initialProgress.timestampSec,
initialMaxVideoProgressSec: initialProgress.maxTimestampSec,
initialVideoDurationSec: initialProgress.duration,
wasPreloaded: false,
startupPath: ownedByVerticalScrollExperiment ? "active_only" : "carousel",
verticalScrollingPosition: index2,
isActive
});
const handleVideoProgressAnalytics = bountiesModalVideoAnalytics.handleVideoProgressAnalytics;
env20869[12] = handleVideoProgressAnalytics;
const { handleVideoEndAnalytics, handleVideoLoopedAnalytics, handleVideoPausedAnalytics, handleVideoResumedAnalytics, handleVideoErrorAnalytics, handleLoadStartAnalytics, handleVideoTracksAnalytics, handleReadyForDisplayAnalytics, handleBufferAnalytics } = bountiesModalVideoAnalytics;
const onPlaybackTimeChange = scrollAffordance2?.onPlaybackTimeChange;
env20869[13] = onPlaybackTimeChange;
const onPaused = scrollAffordance2?.onPaused;
env20869[14] = onPaused;
const onResumed = scrollAffordance2?.onResumed;
env20869[15] = onResumed;
const onEndCardVisible = scrollAffordance2?.onEndCardVisible;
env20869[16] = onEndCardVisible;
const bountiesModalTiming = useBountiesModalTiming({
endMode,
rewardDurationMs,
isCompleted: stateFromStores,
onRewardEarned: callback,
onVideoProgress: useCallback((a0, a1, a2) => {
(0, env20869[12])(a0, a1, a2);
(0, env20869[10])(a0, a1, a2);
const r5 = env20869[13];
if (r5 != null) {
const r4 = env20869[6];
r5(a2, a1, r4 || 1000 * a0 >= env20869[8], a0, r4);
}
}, [handleVideoProgressAnalytics, handleProgress, stateFromStores, onPlaybackTimeChange, rewardDurationMs]),
onVideoEnd: handleVideoEndAnalytics,
onVideoLooped: handleVideoLoopedAnalytics,
onVideoPaused: handleVideoPausedAnalytics,
onVideoResumed: handleVideoResumedAnalytics,
playerRef: ref,
initialProgressSec: initialProgress.timestampSec,
initialMaxVideoProgressSec: initialProgress.maxTimestampSec,
initialVideoDurationSec: initialProgress.duration > 0 ? initialProgress.duration : null
});
const { isCtaVisible, isEndCardVisible } = bountiesModalTiming;
env20869[17] = isEndCardVisible;
const { handleVideoEnd, handleVideoProgress, handleVideoPaused } = bountiesModalTiming;
env20869[18] = handleVideoPaused;
const handleVideoResumed = bountiesModalTiming.handleVideoResumed;
env20869[19] = handleVideoResumed;
env20869[20] = bountiesModalTiming.handleReplay;
const { rewardRemainingSeconds, rewardTotalSeconds, normalizedProgress } = bountiesModalTiming;
const callback3 = useCallback((a0) => {
(0, env20869[18])(a0);
if (!env20869[17]) {
const r7 = env20869[14];
if (r7 != null) {
r7();
}
}
}, [handleVideoPaused, isEndCardVisible, onPaused]);
const callback4 = useCallback((a0) => {
(0, env20869[19])(a0);
const r6 = env20869[15];
if (r6 != null) {
r6();
}
}, [handleVideoResumed, onResumed]);
useEffect(() => {
if (env20869[17] && env20869[4]) {
const r3 = env20869[16];
if (r3 != null) {
r3();
}
}
}, [isActive, isEndCardVisible, onEndCardVisible]);
return <View style={memo}>
<BountyVideo bounty={bounty2} sourceQuestContent={sourceQuestContent2} isCompleted={stateFromStores} isCtaVisible={isCtaVisible} isEndCardVisible={isEndCardVisible} isScrollIndicatorEnabled={isScrollIndicatorOverlayEnabled2} isProgressBarVisible={isEndCardVisible ? !isEndCardVisible : !isRecapPageOnTop2} orbsBalance={orbsBalance} handleVideoEnd={handleVideoEnd} handleVideoProgress={handleVideoProgress} handleVideoPaused={callback3} handleVideoResumed={callback4} handleVideoError={handleVideoErrorAnalytics} onLoadStart={handleLoadStartAnalytics} onBuffer={handleBufferAnalytics} onFirstFrame={handleReadyForDisplayAnalytics} onVideoTracks={handleVideoTracksAnalytics} rewardRemainingSeconds={rewardRemainingSeconds} rewardTotalSeconds={rewardTotalSeconds} normalizedProgress={normalizedProgress} repeat={loopingEnabled} initialProgress={initialProgress} isActive={isActive} isRecapPageRevealed={isRecapPageRevealed2} isScrollingInBoundsSharedValue={isScrollingInBoundsSharedValue2} playerRef={ref} onPlayerStateChange={callback2} balanceWidgetPillResetKey={balanceWidgetPillResetKey} shouldLoadHls={shouldLoadHls3} width={width2} height={height2} peekScale={peekScale2} softDownloadCapsEnabled={softDownloadCapsEnabled2} renderEndCard={() => <QuestContentImpressionTrackerNative adContentId={env20869[0].id} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.VIDEO_MODAL_END_CARD} sourceQuestContent={env20869[1]} overrideVisibility={env20869[17]}>
{() => (0, jsx)(BountiesScrollEndCard, {
bounty: env20869[0],
visible: env20869[17],
onReplay: env20869[20],
isActive: env20869[4],
isScrollingInBoundsSharedValue: env20869[5],
sourceQuestContent: env20869[1]
})}
</QuestContentImpressionTrackerNative>} />
</View>;
};
export function BountiesScrollVideoItem(props) {
const { bounty, sourceQuestContent, width, height, index, isActive: isActive3 = false } = props;
const isActive2 = isActive3;
let isRecapPageRevealed2 = props.isRecapPageRevealed;
if (isRecapPageRevealed2 === void 0) {
isRecapPageRevealed2 = false;
}
const isRecapPageRevealed = isRecapPageRevealed2;
let isRecapPageOnTop2 = props.isRecapPageOnTop;
if (isRecapPageOnTop2 === void 0) {
isRecapPageOnTop2 = false;
}
const isRecapPageOnTop = isRecapPageOnTop2;
const { isScrollingInBoundsSharedValue, isScrollIndicatorOverlayEnabled: isScrollIndicatorOverlayEnabled2 = false } = props;
const isScrollIndicatorOverlayEnabled = isScrollIndicatorOverlayEnabled2;
let shouldLoadHls2 = props.shouldLoadHls;
if (shouldLoadHls2 === void 0) {
shouldLoadHls2 = true;
}
const shouldLoadHls = shouldLoadHls2;
const { scrollAffordance, peekScale, softDownloadCapsEnabled: softDownloadCapsEnabled2 = false } = props;
const softDownloadCapsEnabled = softDownloadCapsEnabled2;
return <BillableAdPlacementImpressionTrackerNative adContentId={bounty.id} adCreativeType={AdCreativeType.BOUNTY} questContent={QuestContent.VIDEO_MODAL_MOBILE} sourceQuestContent={sourceQuestContent} overrideVisibility={isActive2}>
{() => (0, jsx)(BountiesScrollVideoItemInner, {
bounty,
sourceQuestContent,
width,
height,
index,
isActive: isActive2,
isRecapPageRevealed,
isRecapPageOnTop,
isScrollingInBoundsSharedValue,
isScrollIndicatorOverlayEnabled,
shouldLoadHls,
scrollAffordance,
peekScale,
softDownloadCapsEnabled
})}
</BillableAdPlacementImpressionTrackerNative>;
}
@@ -0,0 +1,2 @@
// Metro module 14071 (f14072).
export const END_CARD_IMAGE_SIZE = 92;
@@ -0,0 +1,10 @@
// Metro module 14067 (f14068).
import { intl, t } from "../../../../intl/index.native";
export function getBountyCtaInfo(a0) {
return {
label: a0.productName,
subtext: a0.cta.buttonLabel,
buttonLabel: intl.string(t.LLLLPD),
iconImageUri: a0.productIcon
};
}
@@ -0,0 +1,232 @@
// Metro module 14061 (f14062).
import { useState, useRef, useMemo, useEffect, useCallback } from "react";
import { ActivityIndicator, StyleSheet, View } from "react-native";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { isAndroid } from "../../../../_bundle/Module501";
import { getScaledFirstFrameImageUrl } from "../../lib/AssetUtils";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import BountiesModalProgress, { PROGRESS_BAR_HEIGHT } from "./BountiesModalProgress";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import { useIsBountiesVerticalScrollExperimentEnabled } from "../../experiments/BountiesVerticalScrollExperiment";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { useToken } from "../../../../design/tokens/native/useToken";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _timingPresets from "../../../../design/animation/reanimated/timing/timingPresets";
import { timingFast } from "../../../../design/animation/reanimated/timing/timingPresets";
import * as _useBountiesAutoScroll from "./useBountiesAutoScroll";
import { AdVideoPlayer } from "../AdVideoPlayer";
import { SOFT_CAP_PRELOAD_MAX_BITRATE, SOFT_CAP_PRELOAD_BUFFER_CONFIG, SOFT_CAP_PRELOAD_FORWARD_BUFFER_SEC } from "./bountiesSoftCapPreload";
import FastImage from "../../../../components_native/common/FastImage";
import BountiesScrollIndicatorOverlay from "./BountiesScrollIndicatorOverlay";
import BountiesModalAdvertiserCta from "./BountiesModalAdvertiserCta";
import BountiesModalTimer from "./BountiesModalTimer";
import { BalanceWidgetPill } from "../../../virtual_currency/native/BalanceWidgetPill";
let __initData, __initData2, __initData3;
let c9833_12 = isAndroid() ? 150 : 0;
const contentInsets = {
top: 48,
bottom: 16,
left: 16,
right: 16
};
const lg = Module712.radii.lg;
const useStyles = createStyles(() => ({
videoContainer: {
...StyleSheet.absoluteFillObject,
overflow: "hidden",
borderRadius: lg
},
leftRow: {
position: "absolute",
top: Module712.space.PX_8,
left: Module712.space.PX_8,
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8
},
progress: {
position: "absolute",
bottom: 0,
height: PROGRESS_BAR_HEIGHT,
left: lg,
right: lg
},
poster: {
...StyleSheet.absoluteFillObject,
backgroundColor: "#000000",
justifyContent: "center",
alignItems: "center"
},
peekOrigin: {
transformOrigin: "top"
}
}));
__initData = {
code: "function BountyVideoTsx1(){const{posterOpacity}=this.__closure;return{opacity:posterOpacity.get()};}"
};
__initData2 = {
code: "function BountyVideoTsx2(){const{isScrollingInBoundsSharedValue,withTiming,isActive,timingStandard}=this.__closure;var _isScrollingInBoundsS;const isScrollingInBounds=((_isScrollingInBoundsS=isScrollingInBoundsSharedValue)===null||_isScrollingInBoundsS===void 0?void 0:_isScrollingInBoundsS.get())===true;return{opacity:withTiming(isActive&&!isScrollingInBounds?1:0,timingStandard)};}"
};
__initData3 = {
code: "function BountyVideoTsx3(){const{peekScale,AUTO_SCROLL_PEEK_SCALE,AUTO_SCROLL_PEEK_TOP_OFFSET}=this.__closure;if(peekScale==null){return{};}const scale=peekScale.get();const scaleProgress=(1-scale)/(1-AUTO_SCROLL_PEEK_SCALE);return{transform:[{translateY:scaleProgress*AUTO_SCROLL_PEEK_TOP_OFFSET},{scale:scale}]};}"
};
export function BountyVideo(props) {
let callback;
const { bounty, sourceQuestContent, isCompleted, isCtaVisible, isEndCardVisible } = props;
let isScrollIndicatorEnabled = props.isScrollIndicatorEnabled;
const { isProgressBarVisible, orbsBalance, handleVideoEnd, handleVideoProgress, handleVideoPaused, handleVideoResumed, handleVideoError, onLoadStart, onBuffer, onFirstFrame, onVideoTracks, rewardRemainingSeconds, rewardTotalSeconds, normalizedProgress, initialProgress, repeat } = props;
let isActive = props.isActive;
if (isActive === void 0) {
isActive = false;
}
let c20877_4 = isActive;
const { isRecapPageRevealed = false, isScrollingInBoundsSharedValue, renderEndCard, playerRef, onPlayerStateChange, balanceWidgetPillResetKey, shouldLoadHls = true, width, height, peekScale } = props;
let softDownloadCapsEnabled = props.softDownloadCapsEnabled;
if (softDownloadCapsEnabled === void 0) {
softDownloadCapsEnabled = false;
}
callback = void 0;
const styles = useStyles();
const bountiesExperience = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
const { ownedByVerticalScrollExperiment, stage1Enabled } = bountiesExperience;
const isBountiesVerticalScrollExperimentEnabled = useIsBountiesVerticalScrollExperimentEnabled("BountyVideo");
if (softDownloadCapsEnabled) {
softDownloadCapsEnabled = !isActive;
}
const [state2, setState] = useState(false);
const [state, setState2] = useState(false);
const ref = useRef(null);
const sharedValue = useSharedValue(1);
const memo = useMemo(() => getScaledFirstFrameImageUrl({
assetUrl: bounty.videoHls,
width,
height
}), [bounty, width, height]);
const token = useToken(Module712.colors.TEXT_DEFAULT);
const r98 = `${bounty.id}:${shouldLoadHls}`;
const [state3, setState3] = useState(r98);
if (state3 !== r98) {
setState3(r98);
setState2(false);
sharedValue.set(1);
}
useEffect(() => () => {
if (ref.current != null) {
clearTimeout(ref.current);
ref.current = null;
}
}, [r98]);
useEffect(() => {
if (state) {
sharedValue.set(_timing.withTiming(0, timingFast));
}
}, [state, sharedValue]);
callback = useCallback(() => {
if (ref.current != null) {
clearTimeout(ref.current);
ref.current = null;
}
setState2(true);
}, []);
const callback2 = useCallback(() => {
if (onFirstFrame != null) {
onFirstFrame();
}
if (ref.current != null) {
clearTimeout(ref.current);
}
ref.current = setTimeout(() => {
setState2(true);
ref.current = null;
}, c9833_12);
}, [onFirstFrame]);
const callback3 = useCallback((a0) => {
callback();
if (handleVideoError != null) {
handleVideoError(a0);
}
}, [callback, handleVideoError]);
const callback4 = useCallback((a0) => {
if (a0.currentTime > 0) {
setState(true);
}
handleVideoProgress(a0);
}, [handleVideoProgress]);
const Ce = () => ({
opacity: sharedValue.get()
});
Ce.__closure = {
posterOpacity: sharedValue
};
Ce.__workletHash = 4975136521719;
Ce.__initData = __initData;
const animatedStyle = useAnimatedStyle(Ce);
const Ae = function Ae() {
const r4 = isScrollingInBoundsSharedValue == null ? void 0 : isScrollingInBoundsSharedValue.get();
return {
opacity: _timing.withTiming(c20877_4 ? r4 !== true ? 1 : 0 : 0, _timingPresets.timingStandard)
};
};
Ae.__closure = {
isScrollingInBoundsSharedValue,
withTiming: _timing.withTiming,
isActive,
timingStandard: _timingPresets.timingStandard
};
Ae.__workletHash = 12676706441349;
Ae.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(Ae);
const Fe = function Fe() {
if (peekScale == null) {
return {};
}
const scale = peekScale.get();
return {
transform: [{
translateY: (1 - scale) / (1 - _useBountiesAutoScroll.AUTO_SCROLL_PEEK_SCALE) * _useBountiesAutoScroll.AUTO_SCROLL_PEEK_TOP_OFFSET
}, {
scale
}]
};
};
Fe.__closure = {
peekScale,
AUTO_SCROLL_PEEK_SCALE: _useBountiesAutoScroll.AUTO_SCROLL_PEEK_SCALE,
AUTO_SCROLL_PEEK_TOP_OFFSET: _useBountiesAutoScroll.AUTO_SCROLL_PEEK_TOP_OFFSET
};
Fe.__workletHash = 7501077341815;
Fe.__initData = __initData3;
const animatedStyle3 = useAnimatedStyle(Fe);
const visible = isBountiesVerticalScrollExperimentEnabled ? isCtaVisible ? !isEndCardVisible : isCtaVisible : isCtaVisible;
const r203 = [shouldLoadHls ? <AdVideoPlayer ref={playerRef} source={{
uri: bounty.videoHls
}} automaticallyWaitsToMinimizeStalling={(stage1Enabled ? !stage1Enabled : !ownedByVerticalScrollExperiment) && void 0} maxBitRate={softDownloadCapsEnabled ? SOFT_CAP_PRELOAD_MAX_BITRATE : void 0} bufferConfig={softDownloadCapsEnabled ? SOFT_CAP_PRELOAD_BUFFER_CONFIG : void 0} preferredForwardBufferDuration={softDownloadCapsEnabled ? SOFT_CAP_PRELOAD_FORWARD_BUFFER_SEC : void 0} initialProgress={initialProgress} isFullscreen={false} externallyPaused={(isActive ? isEndCardVisible : !isActive) || isRecapPageRevealed} style={StyleSheet.absoluteFillObject} contentInsets={contentInsets} onProgress={callback4} onEnd={handleVideoEnd} onPausePlayback={handleVideoPaused} onResumePlayback={handleVideoResumed} onError={callback3} onLoadStart={onLoadStart} onBuffer={onBuffer} onReadyForDisplay={callback2} onVideoTracks={onVideoTracks} hideControls={isEndCardVisible} showSkipButtons={false} repeat={repeat} bufferingSpinnerPlacement="center" onPlayerStateChange={onPlayerStateChange} /> : null, memo != null ? <ReanimatedRexport.View style={[styles.poster, animatedStyle]} pointerEvents="none">
<FastImage style={StyleSheet.absoluteFillObject} source={{
uri: memo
}} resizeMode="cover" />
{state ? !state : <ActivityIndicator animating size="small" color={token} />}
</ReanimatedRexport.View> : <ReanimatedRexport.View style={[styles.poster, animatedStyle]} pointerEvents="none" />, renderEndCard == null ? void 0 : renderEndCard(), , ,];
if (isScrollIndicatorEnabled) {
if (isActive) {
isActive = state2;
}
isScrollIndicatorEnabled = <BountiesScrollIndicatorOverlay opacityStyle={animatedStyle2} enabled={isActive} isEndCardVisible={isEndCardVisible} />;
}
r203[3] = isScrollIndicatorEnabled;
r203[4] = <ReanimatedRexport.View style={[StyleSheet.absoluteFillObject, animatedStyle2]} pointerEvents="box-none">
<BountiesModalAdvertiserCta bounty={bounty} visible={visible} sourceQuestContent={sourceQuestContent} />
</ReanimatedRexport.View>;
return <>
<ReanimatedRexport.View style={[StyleSheet.absoluteFillObject, styles.peekOrigin, animatedStyle3]}>
<View style={styles.videoContainer}>{r203}</View>
<ReanimatedRexport.View style={[styles.progress, animatedStyle2]}>
<BountiesModalProgress progress={normalizedProgress} visible={isProgressBarVisible} />
</ReanimatedRexport.View>
</ReanimatedRexport.View>
<ReanimatedRexport.View style={[styles.leftRow, animatedStyle2]}>
<BountiesModalTimer isCompleted={isCompleted} totalSeconds={rewardTotalSeconds} remainingSeconds={rewardRemainingSeconds} />
<BalanceWidgetPill key={balanceWidgetPillResetKey} balance={orbsBalance} />
</ReanimatedRexport.View>
</>;
}
@@ -0,0 +1,9 @@
// Metro module 14063 (f14064).
export const SOFT_CAP_PRELOAD_MAX_BITRATE = 500000;
export const SOFT_CAP_PRELOAD_BUFFER_CONFIG = {
minBufferMs: 1000,
maxBufferMs: 3000,
bufferForPlaybackMs: 500,
bufferForPlaybackAfterRebufferMs: 1000
};
export const SOFT_CAP_PRELOAD_FORWARD_BUFFER_SEC = 2;
@@ -0,0 +1,7 @@
// Metro module 14041 (f14042).
import { useLocalStorageState } from "../../../../hooks/useLocalStorageState";
let c9817_2 = "devtools-force-bounties-swipe-up-nux";
export const FORCE_BOUNTIES_SWIPE_UP_NUX_STORAGE_KEY = "devtools-force-bounties-swipe-up-nux";
export function useForceBountiesSwipeUpNux() {
return useLocalStorageState(c9817_2, false);
}
@@ -0,0 +1,14 @@
// Metro module 14056 (f14057).
import { BOUNTY_REWARD_CLAIM_FAILED_TOAST_DURATION_MS } from "./BountiesModalConstants";
import { intl, t } from "../../../../intl/index.native";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import Module9172 from "../../../../_bundle/Module9172";
let c9829_4 = new Set([260021]);
export function openBountyRewardClaimErrorToast(a0) {
ToastActionCreators.open({
key: "QUESTS_BOUNTIES_REWARD_CLAIM_FAILED",
content: a0?.code != null && c9829_4.has(a0.code) ? a0?.message != null ? a0.message : intl.string(t.uLjCfn) : intl.string(t.uLjCfn),
icon: Module9172,
toastDurationMs: BOUNTY_REWARD_CLAIM_FAILED_TOAST_DURATION_MS
});
}
@@ -0,0 +1,295 @@
// Metro module 14042 (f14043).
import { useState, useRef, useCallback, useEffect } from "react";
import { AppState } from "react-native";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { BountiesVerticalScrollExperiment } from "../../experiments/BountiesVerticalScrollExperiment";
import { useForceBountiesSwipeUpNux } from "./bountiesSwipeUpNuxDevTools";
import { useSharedValue } from "../../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../../design/animation/reanimated/timing/timing";
import { timingSlow, timingStandard } from "../../../../design/animation/reanimated/timing/timingPresets";
import { getIsInAppBrowserOpen, subscribeToIsInAppBrowserOpen } from "../../../links/native/BrowserManager";
let c9818_6 = new Set();
export const AUTO_SCROLL_PEEK_SCALE = 0.83;
export const AUTO_SCROLL_PEEK_TOP_OFFSET = 54;
export function clearDismissedScrollAffordanceBountyIds() {
c9818_6.clear();
}
export function useBountiesAutoScroll({ listRef, enabled, mode, activeIndex, activeBountyId, slotHeight, onCountdownCancelled }) {
let callback2, callback3, callback4, callback5, callback6, callback7, callback8, callback9, callback10, callback11, callback12, callback13;
callback2 = void 0;
callback3 = void 0;
callback4 = void 0;
callback5 = void 0;
callback6 = void 0;
callback7 = void 0;
callback8 = void 0;
callback9 = void 0;
callback10 = void 0;
callback11 = void 0;
callback12 = void 0;
callback13 = void 0;
const config = BountiesVerticalScrollExperiment.useConfig({
location: QuestsExperimentLocations.VIDEO_MODAL_MOBILE
});
const { autoScrollLeadMs, autoScrollEndCardMs, ctaTimerMilliSeconds } = config;
const r4 = autoScrollLeadMs / 1000;
let c20867_8 = r4;
const current = r4 + autoScrollEndCardMs / 1000;
const [r48] = useForceBountiesSwipeUpNux();
let c20867_10 = r48;
const [visible, setState] = useState(false);
const [peekActive, setState2] = useState(false);
const [progress, setState3] = useState(0);
const [showProgressRing, setState4] = useState(false);
const ref = useRef(false);
const ref2 = useRef(false);
const ref3 = useRef(false);
const ref4 = useRef(false);
const ref5 = useRef(null);
const ref6 = useRef(null);
const ref7 = useRef(0);
const ref8 = useRef(null);
const ref9 = useRef(false);
const ref10 = useRef(false);
const sharedValue = useSharedValue(1);
const ref11 = useRef(current);
const callback = useCallback(() => {
if (ref5.current != null) {
clearInterval(ref5.current);
ref5.current = null;
}
ref8.current = null;
}, []);
callback2 = useCallback(() => {
if (ref6.current != null) {
clearTimeout(ref6.current);
ref6.current = null;
}
}, []);
callback3 = useCallback((a0) => {
if (!(c20867_10 || a0 == null)) {
c9818_6.add(a0);
}
}, [r48]);
callback4 = useCallback((a0) => (c20867_10 ? !c20867_10 : a0 != null) && c9818_6.has(a0), [r48]);
callback5 = useCallback(() => {
setState(false);
setState2(false);
setState3(0);
setState4(false);
}, []);
const [state, setState5] = useState(activeIndex);
const [state2, setState6] = useState(activeBountyId);
if (!(state === activeIndex && state2 === activeBountyId)) {
setState5(activeIndex);
setState6(activeBountyId);
callback5();
}
useEffect(() => {
callback();
callback2();
ref.current = callback4(activeBountyId);
ref2.current = callback4(activeBountyId);
ref3.current = false;
ref4.current = false;
ref7.current = 0;
ref9.current = false;
ref10.current = false;
sharedValue.set(1);
}, [activeIndex, activeBountyId, callback, callback2, sharedValue, callback4]);
useEffect(() => () => {
callback();
callback2();
}, [callback, callback2]);
useEffect(() => {
ref11.current = current;
}, [current]);
callback6 = useCallback(function(r7 = 0) {
const r6 = ref2.current || ref.current || callback4(activeBountyId);
let r1 = !r6;
if (!r6) {
ref2.current = true;
callback3(activeBountyId);
callback2();
ref6.current = setTimeout(() => {
ref6.current = null;
if (!(ref.current || ref4.current)) {
sharedValue.set(withTiming(0.83, timingSlow));
setState2(true);
ref6.current = setTimeout(() => {
ref6.current = null;
if (!(ref.current || ref4.current)) {
setState(true);
}
}, 500);
}
}, r7);
r1 = true;
}
return r1;
}, [activeBountyId, callback2, callback3, sharedValue, callback4]);
callback7 = useCallback(() => {
if (!(ref4.current || ref.current)) {
ref4.current = true;
callback3(activeBountyId);
callback();
callback2();
callback5();
sharedValue.set(1);
const current2 = listRef.current;
if (current2 != null) {
current2.scrollToOffset({
offset: (activeIndex + 1) * slotHeight,
animated: true
});
}
}
}, [activeBountyId, activeIndex, callback, callback2, listRef, callback3, sharedValue, callback5, slotHeight]);
callback8 = useCallback(() => {
if (!ref.current && !ref9.current) {
const current3 = Date.now();
if (ref8.current != null) {
ref7.current = ref7.current + (current3 - ref8.current);
}
ref8.current = current3;
const current2 = ref11.current;
const r22 = ref7.current / 1000;
if (r22 >= current2) {
callback7();
} else {
setState3(r22 / current2);
}
}
}, [callback7]);
callback9 = useCallback(() => {
if (!(ref3.current || ref5.current != null || ref9.current)) {
ref3.current = true;
ref7.current = 0;
ref8.current = Date.now();
setState3(0);
setState4(true);
ref5.current = setInterval(callback8, 50);
}
}, [callback8]);
callback10 = useCallback(() => {
if (ref3.current && !ref9.current && ref5.current != null) {
const r6 = Date.now();
if (ref8.current != null) {
ref7.current = ref7.current + (r6 - ref8.current);
}
ref9.current = true;
callback();
}
}, [callback]);
callback11 = useCallback(() => {
if (ref3.current && ref9.current && !ref.current && !ref4.current) {
ref9.current = false;
ref8.current = Date.now();
ref5.current = setInterval(callback8, 50);
}
}, [callback8]);
callback12 = useCallback(() => {
if (!ref9.current) {
callback10();
ref10.current = true;
}
}, [callback10]);
callback13 = useCallback(() => {
if (ref10.current && !getIsInAppBrowserOpen()) {
ref10.current = false;
callback11();
}
}, [callback11]);
useEffect(() => {
let c27615_1;
let c27615_0 = AppState.addEventListener("change", (a0) => {
if (a0 === "active") {
callback13();
} else {
callback12();
}
});
c27615_1 = subscribeToIsInAppBrowserOpen((a0) => {
if (a0) {
callback12();
} else {
callback13();
}
});
return () => {
c27615_0.remove();
c27615_1();
};
}, [callback12, callback13]);
return {
visible,
peekActive,
progress,
showProgressRing,
peekScale: sharedValue,
cancel: useCallback((a0) => {
const current2 = ref2.current;
if (!((current2 ? ref.current : !current2) || ref4.current)) {
ref.current = true;
callback3(activeBountyId);
callback();
setState(false);
setState3(0);
sharedValue.set(withTiming(1, timingStandard));
if (mode === "countdown" && onCountdownCancelled != null) {
onCountdownCancelled(a0);
}
callback2();
callback5();
}
}, [activeBountyId, callback, callback2, callback3, mode, onCountdownCancelled, sharedValue, callback5]),
dismissOnClose: useCallback(() => {
if (ref2.current) {
ref.current = true;
callback3(activeBountyId);
callback();
callback2();
callback5();
sharedValue.set(1);
}
}, [activeBountyId, callback, callback2, callback3, sharedValue, callback5]),
takeDidAutoScroll: useCallback(() => {
const current2 = ref4.current;
ref4.current = false;
callback2();
callback5();
return current2;
}, [callback2, callback5]),
onPlaybackTimeChange: useCallback((a0, a1, a2, a3, a4) => {
if (!((enabled ? mode !== "countdown" : !enabled) || ref.current || ref4.current || a1 <= 0)) {
const current2 = ref2.current;
if (current2 ? !current2 : a4 ? a4 : 1000 * a3 > ctaTimerMilliSeconds) {
callback6(5000);
}
if ((a2 ? !ref3.current : a2) && !(a1 - a0 > c20867_8)) {
callback9();
}
}
}, [r4, ctaTimerMilliSeconds, enabled, mode, callback6, callback9]),
onEndCardVisible: useCallback(() => {
if (!((enabled ? ref.current : !enabled) || callback4(activeBountyId))) {
if (mode !== "hint") {
if (!ref2.current) {
callback6();
}
if (ref3.current) {
if (ref9.current) {
callback11();
}
} else {
callback9();
}
} else {
callback6();
}
}
}, [activeBountyId, enabled, mode, callback11, callback6, callback9, callback4]),
pauseCountdown: callback10,
resumeCountdown: callback11
};
}
@@ -0,0 +1,127 @@
// Metro module 14055 (f14056).
import { useState, useRef, useCallback } from "react";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
let c9828_5 = {
END_CARD: "END_CARD",
END_CARD_WITH_CTA: "END_CARD_WITH_CTA",
LOOP: "LOOP"
};
export { c9828_5 as BountyVideoEndMode };
export function useBountiesModalTiming(a0) {
let setState2, setState3, setState4, setState5, ref, ref2, ref3, ref4, ref5;
const { endMode, rewardDurationMs } = a0;
let isCompleted = a0.isCompleted;
const { onRewardEarned, onVideoProgress, onVideoEnd, onVideoLooped, onVideoPaused, onVideoResumed, playerRef, initialProgressSec = 0 } = a0;
let c20874_9 = initialProgressSec;
let initialMaxVideoProgressSec = a0.initialMaxVideoProgressSec;
if (initialMaxVideoProgressSec === void 0) {
initialMaxVideoProgressSec = 0;
}
let initialVideoDurationSec = a0.initialVideoDurationSec;
if (initialVideoDurationSec === void 0) {
initialVideoDurationSec = null;
}
let c20874_10 = initialVideoDurationSec;
setState2 = void 0;
setState3 = void 0;
setState4 = void 0;
setState5 = void 0;
ref = void 0;
ref2 = void 0;
ref3 = void 0;
ref4 = void 0;
ref5 = void 0;
const [isEndCardVisible, setState] = useState(initialVideoDurationSec != null && initialProgressSec >= initialVideoDurationSec - 1 && endMode !== c9828_5.LOOP);
let state;
[state, setState2] = useState(() => c20874_10 != null ? c20874_9 / c20874_10 : 0);
let normalizedProgress;
[normalizedProgress, setState3] = useState(null);
let maxVideoProgressSeconds;
[maxVideoProgressSeconds, setState4] = useState(initialMaxVideoProgressSec);
let videoDuration;
[videoDuration, setState5] = useState(initialVideoDurationSec);
ref = useRef(isCompleted);
ref2 = useRef(initialMaxVideoProgressSec);
if (initialVideoDurationSec == null) {
initialVideoDurationSec = 0;
}
ref3 = useRef(initialVideoDurationSec);
ref4 = useRef(0);
ref5 = useRef(initialProgressSec);
const callback = useCallback(({ progress, currentTime, seekableDuration }) => {
setState3(null);
const current2 = Math.max(currentTime, ref2.current);
ref2.current = current2;
ref3.current = seekableDuration;
ref5.current = currentTime;
setState2(progress);
setState4(current2);
setState5(seekableDuration);
onVideoProgress(current2, seekableDuration, currentTime);
const current = ref.current;
if (current ? !current : 1000 * current2 >= rewardDurationMs) {
ref.current = true;
onRewardEarned();
}
}, [onVideoProgress, onRewardEarned, rewardDurationMs]);
const callback2 = useCallback(() => {
onVideoEnd(ref2.current, ref3.current, ref5.current);
if (endMode === c9828_5.LOOP) {
ref4.current = ref4.current + 1;
onVideoLooped(ref4.current);
ref5.current = 0;
} else {
setState(true);
}
if (!ref.current) {
ref.current = true;
onRewardEarned();
}
}, [endMode, onVideoEnd, onVideoLooped, onRewardEarned]);
const callback3 = useCallback(() => {
if (playerRef != null) {
const current = playerRef.current;
if (current != null) {
current.seekToStart();
}
}
setState3(0);
setState(false);
}, [playerRef]);
const callback4 = useCallback((a0) => {
onVideoPaused(ref5.current, a0);
}, [onVideoPaused]);
const callback5 = useCallback((a0) => {
onVideoResumed(ref5.current, a0);
}, [onVideoResumed]);
const r2 = 1000 * maxVideoProgressSeconds;
const rewardTotalSeconds = rewardDurationMs / 1000;
const r91 = Math.max(0, rewardTotalSeconds - maxVideoProgressSeconds);
const rewardRemainingSeconds = r2 >= rewardDurationMs ? 0 : isEndCardVisible ? 0 : isCompleted ? 0 : videoDuration != null ? videoDuration > 0 ? Math.max(0, Math.min(rewardTotalSeconds, videoDuration) - maxVideoProgressSeconds) : r91 : r91;
const ctaTimerMilliSeconds = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE).ctaTimerMilliSeconds;
const r109 = isEndCardVisible && endMode !== c9828_5.END_CARD_WITH_CTA;
if (!isCompleted) {
isCompleted = r2 > ctaTimerMilliSeconds;
}
if (isCompleted) {
isCompleted = !r109;
}
if (normalizedProgress == null) {
normalizedProgress = state;
}
return {
isCtaVisible: isCompleted,
isEndCardVisible,
handleVideoEnd: callback2,
handleVideoProgress: callback,
handleVideoPaused: callback4,
handleVideoResumed: callback5,
handleReplay: callback3,
rewardRemainingSeconds,
rewardTotalSeconds,
normalizedProgress,
maxVideoProgressSeconds,
videoDuration
};
}
@@ -0,0 +1,454 @@
// Metro module 14059 (f14060).
import { useMemo, useRef, useCallback, useEffect } from "react";
import NetworkStore from "../../../../stores/NetworkStore";
import { AnalyticEvents } from "../../../../Constants";
import { useQuestImpressionId } from "../../lib/analytics/ContentImpressionTrackerHooks";
import { v4 } from "../../../../_bundle/Module514";
import { formatVideoProgressRatio } from "../../utils/VideoQuestUtils";
import { trackAdContentEvent } from "../../lib/analytics/AnalyticsActions";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { PlaybackTriggerSource } from "../AdVideoPlayer";
import { isSourceError } from "../AdsVideoUtils";
import MonitoringAgent from "../../../monitoring/MonitoringAgent";
import { MetricEvents } from "../../../../_bundle/Module5872";
let c9831_6 = [25, 50, 75];
export function useBountiesModalVideoAnalytics(a0) {
let ref, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, callback, memo2, callback2, callback3, callback4, callback5, callback6, callback7, callback8, callback9, callback10, callback11;
const { bountyId, sourceQuestContent, rewardDurationMs, initialPlaybackTimeSec = 0, initialMaxVideoProgressSec = 0 } = a0;
let c20876_3 = initialMaxVideoProgressSec;
let initialVideoDurationSec = a0.initialVideoDurationSec;
if (initialVideoDurationSec === void 0) {
initialVideoDurationSec = 0;
}
let c20876_4 = initialVideoDurationSec;
let wasPreloaded = a0.wasPreloaded;
if (wasPreloaded === void 0) {
wasPreloaded = false;
}
const was_preloaded = wasPreloaded;
let startupPath = a0.startupPath;
if (startupPath === void 0) {
startupPath = "carousel";
}
const startup_path = startupPath;
let verticalScrollingPosition = a0.verticalScrollingPosition;
if (verticalScrollingPosition === void 0) {
verticalScrollingPosition = null;
}
const vertical_scrolling_position = verticalScrollingPosition;
let isActive = a0.isActive;
if (isActive === void 0) {
isActive = true;
}
let c20876_8 = isActive;
ref = void 0;
ref2 = void 0;
ref3 = void 0;
ref4 = void 0;
ref5 = void 0;
ref6 = void 0;
ref7 = void 0;
ref8 = void 0;
ref9 = void 0;
ref10 = void 0;
ref11 = void 0;
ref12 = void 0;
callback = void 0;
memo2 = void 0;
callback2 = void 0;
callback3 = void 0;
callback4 = void 0;
callback5 = void 0;
callback6 = void 0;
callback7 = void 0;
callback8 = void 0;
callback9 = void 0;
callback10 = void 0;
callback11 = void 0;
const questImpressionId = useQuestImpressionId();
const memo = useMemo(() => v4(), []);
const set = new Set();
const r40 = initialPlaybackTimeSec > 0 || initialMaxVideoProgressSec > 0;
if (r40) {
set.add("start");
}
if (1000 * initialMaxVideoProgressSec >= rewardDurationMs) {
set.add("threshold");
}
ref = useRef(set);
ref2 = useRef(false);
ref3 = useRef(initialPlaybackTimeSec);
ref4 = useRef(initialVideoDurationSec);
ref5 = useRef(null);
ref6 = useRef(null);
ref7 = useRef(false);
ref8 = useRef(false);
ref9 = useRef(null);
ref10 = useRef(null);
ref11 = useRef(-1);
ref12 = useRef({
bitrateBps: null,
width: null,
height: null,
levelIndex: null
});
callback = useCallback(() => {
if (ref9.current != null) {
clearTimeout(ref9.current);
ref9.current = null;
}
}, []);
memo2 = useMemo(() => ({
was_preloaded,
startup_path,
vertical_scrolling_position,
reward_timer_seconds: rewardDurationMs / 1000
}), [was_preloaded, startup_path, vertical_scrolling_position, rewardDurationMs]);
callback2 = useCallback(() => {
const current = ref12.current;
return {
hls_level_index: current.levelIndex,
hls_segment_res_width: current.width,
hls_segment_res_height: current.height
};
}, []);
callback3 = useCallback((a0) => {
if (!ref2.current) {
let r5 = a0;
ref2.current = true;
if (!(a0 > 0)) {
r5 = c20876_4;
}
if (!(r5 <= 0)) {
const r6 = formatVideoProgressRatio(c20876_3, r5);
for (const item of c9831_6) {
if (r6 >= item / 100) {
ref.current.add(`p${item}`);
}
}
}
}
}, [initialMaxVideoProgressSec, initialVideoDurationSec]);
callback4 = useCallback((a0) => {
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_PROGRESSED,
properties: {
progress: a0.progress,
video_timestamp_seconds: a0.videoTimestampSeconds,
video_session_id: memo,
impression_id: questImpressionId,
threshold_met: a0.thresholdMet,
reward_timer_seconds: rewardDurationMs / 1000
},
sourceQuestContent
});
}, [bountyId, memo, questImpressionId, sourceQuestContent, rewardDurationMs]);
callback5 = useCallback(() => {
if (!ref.current.has("start")) {
ref.current.add("start");
callback4({
videoTimestampSeconds: 0,
progress: 0,
thresholdMet: false
});
}
}, [callback4]);
callback6 = useCallback((a0, a1) => {
if (!ref.current.has("threshold")) {
ref.current.add("threshold");
const videoTimestampSeconds = Math.max(rewardDurationMs / 1000, a0);
callback4({
videoTimestampSeconds,
progress: formatVideoProgressRatio(videoTimestampSeconds, a1),
thresholdMet: true
});
}
}, [callback4, rewardDurationMs]);
callback7 = useCallback((a0, a1) => {
if (!ref.current.has("end")) {
ref.current.add("end");
callback4({
videoTimestampSeconds: Math.max(a0, a1),
progress: 1,
thresholdMet: true
});
}
}, [callback4]);
callback8 = useCallback((a0, a1) => {
if (!(a1 <= 0)) {
const progress = formatVideoProgressRatio(a0, a1);
for (const item of c9831_6) {
const r15 = `p${item}`;
if (!ref.current.has(r15) && !(progress < item / 100)) {
ref.current.add(r15);
callback4({
videoTimestampSeconds: a0,
progress,
thresholdMet: 1000 * a0 >= rewardDurationMs
});
}
}
}
}, [callback4, rewardDurationMs]);
const callback12 = useCallback((a0, a1, a2) => {
ref3.current = a2;
ref4.current = a1;
callback3(a1);
if (a0 === 0) {
callback5();
}
if (1000 * a0 >= rewardDurationMs) {
callback6(a0, a1);
}
callback8(a0, a1);
}, [callback3, callback5, callback6, callback8, rewardDurationMs]);
const callback13 = useCallback((a0, a1, a2) => {
ref3.current = a2;
ref4.current = a1;
callback3(a1);
if (a0 === 0) {
callback5();
}
callback6(a0, a1);
callback8(a0, a1);
callback7(a0, a1);
}, [callback3, callback5, callback6, callback8, callback7]);
const callback14 = useCallback((a0) => {
ref3.current = 0;
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_LOOPED,
properties: {
video_session_id: memo,
impression_id: questImpressionId,
loop_count: a0,
reward_timer_seconds: rewardDurationMs / 1000
},
sourceQuestContent
});
}, [bountyId, memo, questImpressionId, sourceQuestContent, rewardDurationMs]);
const callback15 = useCallback((a0, a1) => {
if (a1 === PlaybackTriggerSource.USER_INTERACTION) {
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_PAUSED,
properties: {
video_timestamp_seconds: a0,
video_session_id: memo,
impression_id: questImpressionId,
reward_timer_seconds: rewardDurationMs / 1000
},
sourceQuestContent
});
}
}, [bountyId, memo, questImpressionId, sourceQuestContent, rewardDurationMs]);
const callback16 = useCallback((a0, a1) => {
if (a1 === PlaybackTriggerSource.USER_INTERACTION) {
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_RESUMED,
properties: {
video_timestamp_seconds: a0,
video_session_id: memo,
impression_id: questImpressionId,
reward_timer_seconds: rewardDurationMs / 1000
},
sourceQuestContent
});
}
}, [bountyId, memo, questImpressionId, sourceQuestContent, rewardDurationMs]);
const callback17 = useCallback((a0) => {
const properties = {
video_progress: formatVideoProgressRatio(ref3.current, ref4.current),
video_error_type: null,
network_connection_speed: null,
video_session_id: memo,
video_error_code: a0 == null ? void 0 : a0.error.code,
video_error_message: null,
video_network_state: null,
impression_id: null,
reward_timer_seconds: null
};
let video_error_message = a0 == null ? void 0 : a0.error.localizedDescription;
if (video_error_message == null) {
video_error_message = a0 == null ? void 0 : a0.error.errorString;
}
properties.video_error_message = video_error_message;
properties.impression_id = questImpressionId;
properties.reward_timer_seconds = rewardDurationMs / 1000;
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_ERROR,
properties,
sourceQuestContent
});
if (isSourceError(a0)) {
MonitoringAgent.increment({
name: MetricEvents.QUEST_VIDEO_ERROR,
tags: ["error_type:SOURCE_ERROR"]
});
}
}, [bountyId, memo, questImpressionId, sourceQuestContent, rewardDurationMs]);
callback9 = useCallback(() => {
if (ref10.current != null) {
const duration = Date.now() - ref10.current;
ref10.current = null;
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_BUFFERING_ENDED,
properties: {
video_session_id: memo,
impression_id: questImpressionId,
duration,
network_connection_speed: NetworkStore.getEffectiveConnectionSpeed(),
buffer_index: ref11.current,
video_bitrate_bps: ref12.current.bitrateBps,
...callback2(),
...memo2
},
sourceQuestContent
});
}
}, [bountyId, memo, questImpressionId, callback2, memo2, sourceQuestContent]);
callback10 = useCallback(() => {
if (!(ref7.current || ref5.current == null || ref6.current == null)) {
ref7.current = true;
callback();
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_TIME_TO_FIRST_FRAME,
properties: {
video_session_id: memo,
impression_id: questImpressionId,
duration_ms: ref6.current - ref5.current,
network_connection_speed: NetworkStore.getEffectiveConnectionSpeed(),
startup_bitrate_bps: ref12.current.bitrateBps,
...callback2(),
...memo2
},
sourceQuestContent
});
}
}, [bountyId, memo, questImpressionId, callback, callback2, memo2, sourceQuestContent]);
callback11 = useCallback(() => {
if (!(ref7.current || ref5.current == null || ref6.current == null)) {
if (ref12.current.bitrateBps == null) {
if (ref9.current == null) {
ref9.current = setTimeout(() => {
ref9.current = null;
callback10();
}, 500);
}
} else {
callback10();
}
}
}, [callback10]);
useEffect(() => () => {
if (ref9.current != null) {
callback10();
}
callback();
callback9();
}, [callback, callback9, callback10]);
useEffect(() => {
if (c20876_8) {
callback11();
} else {
if (ref9.current != null) {
callback10();
}
callback();
callback9();
}
}, [isActive, callback11, callback, callback9, callback10]);
return {
handleVideoProgressAnalytics: callback12,
handleVideoEndAnalytics: callback13,
handleVideoLoopedAnalytics: callback14,
handleVideoPausedAnalytics: callback15,
handleVideoResumedAnalytics: callback16,
handleVideoErrorAnalytics: callback17,
handleLoadStartAnalytics: useCallback(() => {
callback9();
callback();
ref5.current = Date.now();
ref6.current = null;
ref7.current = false;
ref8.current = false;
ref12.current = {
bitrateBps: null,
width: null,
height: null,
levelIndex: null
};
}, [callback, callback9]),
handleVideoTracksAnalytics: useCallback(({ videoTracks, selectedVideoTrackId }) => {
let current;
if (videoTracks.length === 0) {
current = {
bitrateBps: null,
width: null,
height: null,
levelIndex: null
};
} else {
const r7 = selectedVideoTrackId != null ? selectedVideoTrackId.length > 0 ? videoTracks.findIndex((videoTrack) => videoTrack.trackId === selectedVideoTrackId) : -1 : -1;
const r16 = r7 >= 0 ? videoTracks[r7] : videoTracks[0];
current = {
bitrateBps: r16.bitrate > 0 ? r16.bitrate : null,
width: r16.width > 0 ? r16.width : null,
height: r16.height > 0 ? r16.height : null,
levelIndex: r7 >= 0 ? r7 : null
};
}
ref12.current = current;
if (c20876_8 && ref6.current != null && ref12.current.bitrateBps != null) {
callback10();
}
}, [callback10, isActive]),
handleReadyForDisplayAnalytics: useCallback(() => {
ref8.current = true;
if (ref6.current == null) {
ref6.current = Date.now();
}
if (c20876_8) {
callback11();
}
}, [isActive, callback11]),
handleBufferAnalytics: useCallback((a0) => {
if (ref8.current && c20876_8) {
if (a0) {
ref10.current = Date.now();
ref11.current = ref11.current + 1;
trackAdContentEvent({
adContentId: bountyId,
adCreativeType: AdCreativeType.BOUNTY,
event: AnalyticEvents.AD_VIDEO_BUFFERING_STARTED,
properties: {
video_session_id: memo,
impression_id: questImpressionId,
network_connection_speed: NetworkStore.getEffectiveConnectionSpeed(),
buffer_index: ref11.current,
video_bitrate_bps: ref12.current.bitrateBps,
...callback2(),
...memo2
},
sourceQuestContent
});
} else {
callback9();
}
return void 0;
}
}, [bountyId, memo, questImpressionId, callback9, callback2, isActive, memo2, sourceQuestContent])
};
}
@@ -0,0 +1,87 @@
// Metro module 14043 (f14044).
import { useState, useCallback } from "react";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
import * as _useBountiesRecapScroll from "./useBountiesRecapScroll";
let getRecapOrbCountFromPullProgress, __initData, __initData2;
const getRecapOrbCountFromPullProgress2 = function getRecapOrbCountFromPullProgress(a0, a1) {
if (!(a1 <= 0) && Number.isFinite(a1)) {
return Math.round(Math.min(1, Math.max(0, a0)) * a1);
}
return 0;
};
getRecapOrbCountFromPullProgress2.__closure = {};
getRecapOrbCountFromPullProgress2.__workletHash = 14295638108053;
getRecapOrbCountFromPullProgress2.__initData = {
code: "function getRecapOrbCountFromPullProgress_useBountiesRecapOrbCountTsx1(progress,targetOrbAmount){if(targetOrbAmount<=0||!Number.isFinite(targetOrbAmount)){return 0;}const clampedProgress=Math.min(1,Math.max(0,progress));return Math.round(clampedProgress*targetOrbAmount);}"
};
getRecapOrbCountFromPullProgress = getRecapOrbCountFromPullProgress2;
__initData = {
code: "function useBountiesRecapOrbCountTsx2(){const{enabled,recapRevealHeight,getRevealProgress,scrollY,lastBountyScrollOffset,RECAP_ORB_COUNT_REACHES_TARGET_AT_PROGRESS,getRecapOrbCountFromPullProgress,targetOrbAmount}=this.__closure;if(!enabled||recapRevealHeight<=0){return{count:0,revealed:false};}const pullProgress=getRevealProgress(scrollY.get(),lastBountyScrollOffset,recapRevealHeight)/RECAP_ORB_COUNT_REACHES_TARGET_AT_PROGRESS;if(pullProgress<=0.1){return{count:0,revealed:false};}return{count:getRecapOrbCountFromPullProgress(pullProgress,targetOrbAmount),revealed:true};}"
};
__initData2 = {
code: "function useBountiesRecapOrbCountTsx3({count:count,revealed:revealed}){const{runOnJS,resetDisplayCount,setDisplayCountMonotonic}=this.__closure;if(!revealed){runOnJS(resetDisplayCount)();return;}runOnJS(setDisplayCountMonotonic)(count);}"
};
export { getRecapOrbCountFromPullProgress };
export function useBountiesRecapOrbCount({ scrollY, lastBountyScrollOffset, recapRevealHeight, targetOrbAmount, enabled }) {
let callback2;
callback2 = void 0;
const [state, setState] = useState(0);
const callback = useCallback((c27616_0) => {
setState((prevState) => {
let r0 = prevState;
if (c27616_0 > prevState) {
r0 = c27616_0;
}
return r0;
});
}, []);
callback2 = useCallback(() => {
setState(0);
}, []);
const b = function b() {
if (enabled && !(recapRevealHeight <= 0)) {
const r21 = _useBountiesRecapScroll.getRevealProgress(scrollY.get(), lastBountyScrollOffset, recapRevealHeight) / 0.95;
return r21 <= 0.1 ? {
count: 0,
revealed: false
} : {
count: targetOrbAmount <= 0 ? 0 : Number.isFinite(targetOrbAmount) ? Math.round(Math.min(1, Math.max(0, r21)) * targetOrbAmount) : 0,
revealed: true
};
}
return {
count: 0,
revealed: false
};
};
b.__closure = {
enabled,
recapRevealHeight,
getRevealProgress: _useBountiesRecapScroll.getRevealProgress,
scrollY,
lastBountyScrollOffset,
RECAP_ORB_COUNT_REACHES_TARGET_AT_PROGRESS: 0.95,
getRecapOrbCountFromPullProgress,
targetOrbAmount
};
b.__workletHash = 2855285055570;
b.__initData = __initData;
const r39 = function(a0) {
const count = a0.count;
if (a0.revealed) {
_ReanimatedRexport.runOnJS(callback)(count);
} else {
_ReanimatedRexport.runOnJS(callback2)();
}
};
r39.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
resetDisplayCount: callback2,
setDisplayCountMonotonic: callback
};
r39.__workletHash = 12006414940221;
r39.__initData = __initData2;
useAnimatedReaction(b, r39);
return state;
}
@@ -0,0 +1,46 @@
// Metro module 14039 (f14040).
import { useCallback } from "react";
let getRevealProgress;
const getRevealProgress2 = function getRevealProgress(a0, a1, a2) {
return a2 <= 0 ? 0 : (a0 - a1) / a2;
};
getRevealProgress2.__closure = {};
getRevealProgress2.__workletHash = 9769647749947;
getRevealProgress2.__initData = {
code: "function getRevealProgress_useBountiesRecapScrollTsx1(scrollOffset,startOffset,revealHeight){if(revealHeight<=0){return 0;}return(scrollOffset-startOffset)/revealHeight;}"
};
getRevealProgress = getRevealProgress2;
export const RECAP_SNAP_EPSILON = 2;
export { getRevealProgress };
export function useBountiesRecapScroll({ listRef, enabled, offsets }) {
let callback2;
callback2 = void 0;
const callback = useCallback((a0) => {
if (listRef.current != null) {
listRef.current.scrollToOffset({
offset: a0,
animated: true
});
}
}, [listRef]);
const callback3 = useCallback(() => {
callback(offsets.lastBounty);
}, [offsets.lastBounty, callback]);
callback2 = useCallback((a0) => {
if (enabled && !(a0 <= offsets.lastBounty)) {
const { lastBounty, revealHeight } = offsets;
const r15 = (revealHeight <= 0 ? 0 : (a0 - lastBounty) / revealHeight) >= 0.25 ? offsets.fullRecap : offsets.lastBounty;
if (!(Math.abs(a0 - r15) < 2)) {
callback(r15);
}
}
}, [enabled, offsets.fullRecap, offsets.lastBounty, offsets.revealHeight, callback]);
return {
scrollToLastBounty: callback3,
handleRecapMomentumEnd: useCallback((a0) => {
if (enabled) {
callback2(a0.contentOffset.y);
}
}, [enabled, callback2])
};
}
@@ -0,0 +1,34 @@
// Metro module 14040 (f14041).
import { BountiesVerticalScrollExperiment } from "../../experiments/BountiesVerticalScrollExperiment";
import { useForceBountiesSwipeUpNux } from "./bountiesSwipeUpNuxDevTools";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { useSelectedDismissibleContent, useSelectedTimeRecurringDismissibleContent } from "../../../dismissible_content/hooks/useSelectedDismissibleContent";
export function useBountySwipeUpNux(a0) {
let hasRecurringSwipeUpNux;
let isEligible = a0.isEligible;
const r3 = BountiesVerticalScrollExperiment.useConfig({
location: a0.location
}).scrollAffordanceVariant === "none";
const [r27] = useForceBountiesSwipeUpNux();
const r28 = isEligible && r3 ? [DismissibleContent.BOUNTIES_SWIPE_UP_NUX] : [];
const r14 = isEligible ? r3 ? null : DismissibleContent.BOUNTIES_RECURRING_SWIPE_UP_NUX : null;
const [r43, dismissSingleUseSwipeUpNux] = useSelectedDismissibleContent(r28);
const hasSingleUseSwipeUpNux = r27 ? isEligible ? r3 : isEligible : r43 === DismissibleContent.BOUNTIES_SWIPE_UP_NUX;
const [r55, dismissRecurringSwipeUpNux] = useSelectedTimeRecurringDismissibleContent(r14, {
cooldownDurationMs: 86400000
});
if (r27) {
if (isEligible) {
isEligible = !r3;
}
hasRecurringSwipeUpNux = isEligible;
} else {
hasRecurringSwipeUpNux = r55 === DismissibleContent.BOUNTIES_RECURRING_SWIPE_UP_NUX;
}
return {
hasSingleUseSwipeUpNux,
dismissSingleUseSwipeUpNux,
hasRecurringSwipeUpNux,
dismissRecurringSwipeUpNux
};
}
@@ -0,0 +1,83 @@
// Metro module 14058 (f14059).
import { useState, useRef, useCallback } from "react";
import BountyStore from "../../BountyStore";
import { QuestsExperimentLocations } from "../../QuestConstants";
import { useBountiesExperience } from "../../experiments/useBountiesExperience";
import { BountyVideoEndMode } from "./useBountiesModalTiming";
import { setBountyVideoProgress } from "../../BountyActionCreators";
let c9830_6 = {
timestampSec: 0,
maxTimestampSec: 0,
duration: 0
};
export function useBountyVideoProgressPersistence({ bountyId, endMode }) {
let ref, ref2, ref3, ref4;
ref = void 0;
ref2 = void 0;
ref3 = void 0;
ref4 = void 0;
const bountiesExperience = useBountiesExperience(QuestsExperimentLocations.VIDEO_MODAL_MOBILE);
let ownedByVerticalScrollExperiment = bountiesExperience.ownedByVerticalScrollExperiment;
const stage1Enabled2 = bountiesExperience.stage1Enabled;
if (!ownedByVerticalScrollExperiment) {
ownedByVerticalScrollExperiment = stage1Enabled2;
}
const stage1Enabled = ownedByVerticalScrollExperiment;
const [initialProgress] = useState(() => {
let r10;
if (stage1Enabled) {
L9: {
L8: {
r10 = BountyStore.getBountyVideoProgress(bountyId);
if (r10 != null) {
if (endMode === BountyVideoEndMode.LOOP) {
const { maxTimestampSec, duration } = r10;
if (duration > 0 && maxTimestampSec >= duration - 1) {
break L8;
}
}
if (!(r10.timestampSec <= 5)) {
break L9;
}
}
}
r10 = c9830_6;
}
return r10;
}
return c9830_6;
});
ref = useRef(0);
ref2 = useRef(initialProgress.timestampSec);
ref3 = useRef(initialProgress.maxTimestampSec);
ref4 = useRef(initialProgress.duration);
return {
initialProgress,
handleProgress: useCallback((a0, a1, a2) => {
ref2.current = a2;
ref3.current = a0;
ref4.current = a1;
let r11 = stage1Enabled;
if (stage1Enabled) {
r11 = a2 >= ref.current;
}
if (r11) {
ref.current = a2 + 1;
setBountyVideoProgress(bountyId, {
timestampSec: a2,
maxTimestampSec: a0,
duration: a1
});
}
}, [stage1Enabled, bountyId]),
flushProgress: useCallback(() => {
if (stage1Enabled) {
setBountyVideoProgress(bountyId, {
timestampSec: ref2.current,
maxTimestampSec: ref3.current,
duration: ref4.current
});
}
}, [stage1Enabled, bountyId])
};
}
@@ -0,0 +1,66 @@
// Metro module 14038 (f14039).
import { useState, useCallback } from "react";
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
const __initData = {
code: "function useVisibilityTransitionTsx1(){const{withTiming,visibility,visible,entranceTiming,exitTiming,runOnJS,animationCallbackJSThread}=this.__closure;return{opacity:withTiming(visibility,visible?entranceTiming:exitTiming,'respect-motion-settings',function(){'worklet';runOnJS(animationCallbackJSThread)();})};}"
};
const __initData2 = {
code: "function useVisibilityTransitionTsx2(){const{runOnJS,animationCallbackJSThread}=this.__closure;runOnJS(animationCallbackJSThread)();}"
};
export function useVisibilityTransition(a0) {
let c20865_5;
let visible2 = a0.visible;
const visible = visible2;
const { entranceTiming, exitTiming } = a0;
c20865_5 = void 0;
const [state, setState] = useState(false);
const [state2, setState2] = useState(visible);
if (state2 !== visible) {
setState2(visible);
if (!visible) {
setState(true);
}
}
const callback = useCallback(() => {
setState(false);
}, []);
const visibility = visible ? 1 : 0;
c20865_5 = visibility;
const k = () => {
const r6 = visible ? entranceTiming : exitTiming;
const n = function n() {
_ReanimatedRexport.runOnJS(callback)();
};
n.__closure = {
runOnJS: _ReanimatedRexport.runOnJS,
animationCallbackJSThread: callback
};
n.__workletHash = 11904317879470;
n.__initData = __initData2;
return {
opacity: _timing.withTiming(c20865_5, r6, "respect-motion-settings", n)
};
};
k.__closure = {
withTiming: _timing.withTiming,
visibility,
visible,
entranceTiming,
exitTiming,
runOnJS: _ReanimatedRexport.runOnJS,
animationCallbackJSThread: callback
};
k.__workletHash = 12648900540770;
k.__initData = __initData;
const r46 = {
opacityStyle: useAnimatedStyle(k),
shouldRender: null
};
if (!visible) {
visible2 = state;
}
r46.shouldRender = visible2;
return r46;
}
@@ -0,0 +1,25 @@
// Metro module 14092 (f14093).
import { useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { PROMO_SHEET_KEY } from "./openBountiesNuxPromoSheet";
import { PromoSheet } from "../../../design/components/Sheet/native/PromoSheet.native";
import { intl, t } from "../../../intl/index.native";
import { BountiesPosterSpotIllustration } from "../../../design/components/mana-assets/native/generated/BountiesPosterSpotIllustration.native";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
illustrationContainer: {
paddingTop: Module712.space.PX_12
}
});
export default function BountiesNuxPromoSheet() {
const styles = useStyles();
const callback = useCallback(() => {
ActionSheetActionCreators.hideActionSheet(PROMO_SHEET_KEY);
}, []);
return <PromoSheet gradientColor="purple" title={intl.string(t.DDpHZG)} description={intl.string(t["LY+igv"])} illustration={<View style={styles.illustrationContainer}>
<BountiesPosterSpotIllustration width={273} height={205} />
</View>} actions={<Button grow size="lg" variant="primary" text={intl.string(t.cpT0Cq)} onPress={callback} />} />;
};
+258
View File
@@ -0,0 +1,258 @@
// Metro module 14094 (f14095).
import * as Module19 from "react";
import { useCallback, useState, useRef, useEffect, useMemo } from "react";
import { AppState, StyleSheet, View } from "react-native";
import AccessibilityStore from "../../a11y/AccessibilityStore";
import BountyStore from "../BountyStore";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import * as _Module501 from "../../../_bundle/Module501";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getScaledImageUrl, getScaledFirstFrameImageUrl } from "../lib/AssetUtils";
import { useToken } from "../../../design/tokens/native/useToken";
import { Card } from "../../../design/components/Card/native/Card.native";
import Video from "../../../_bundle/Video_8143";
import FastImage from "../../../components_native/common/FastImage";
import { CheckmarkSmallBoldIcon } from "../../../design/components/Icon/native/redesign/generated/CheckmarkSmallBoldIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { CircleCheckIcon } from "../../../design/components/Icon/native/redesign/generated/CircleCheckIcon";
let c9860_14, isAndroid, isAndroid2;
const width = 188;
const useStyles = createStyles(() => ({
tile: {
gap: Module712.space.PX_12
},
card: {
width,
height: 313,
overflow: "hidden",
padding: 0
},
cardImage: {
...StyleSheet.absoluteFillObject
},
previewVideo: {
...StyleSheet.absoluteFillObject
},
badge: {
position: "absolute",
top: Module712.space.PX_12,
left: Module712.space.PX_12,
backgroundColor: Module712.colors.CONTROL_OVERLAY_PRIMARY_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.round,
paddingHorizontal: Module712.space.PX_8,
paddingVertical: Module712.space.PX_4,
color: Module712.colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT
},
badgeContent: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_4
},
badgeText: {
textTransform: "uppercase",
color: Module712.colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT
},
startButton: {
position: "absolute",
bottom: Module712.space.PX_8,
left: Module712.space.PX_8,
right: Module712.space.PX_8
},
cardFooter: {
flexDirection: "column",
alignItems: "flex-start",
maxWidth: width
},
advertiserRow: {
flexDirection: "row",
gap: Module712.space.PX_4,
alignItems: "center"
},
advertiserName: {
flexShrink: 1
},
advertiserIcon: {
flexShrink: 0,
opacity: 0.7
}
}));
c9860_14 = _Module501.isAndroid() ? 150 : 0;
isAndroid = _Module501.isAndroid();
isAndroid2 = _Module501.isAndroid();
const r52 = Module19.memo(function({ bounty, index, isActive, isModalVisible, onPress }) {
let setState, setState2, state, setState3, ref, ref2, setState4, state2;
setState = void 0;
setState2 = void 0;
state = void 0;
setState3 = void 0;
ref = void 0;
ref2 = void 0;
setState4 = void 0;
state2 = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([BountyStore], () => BountyStore.isBountyCompleted(bounty.id));
const callback2 = useCallback(() => {
onPress(bounty, index);
}, [onPress, bounty, index]);
const videoPreview = bounty.videoPreview;
let uri = bounty.imagePreview != null ? getScaledImageUrl({
assetUrl: bounty.imagePreview,
width,
height: 313
}) : null;
if (uri == null && videoPreview != null) {
uri = getScaledFirstFrameImageUrl({
assetUrl: videoPreview,
width,
height: 313
});
}
let state3;
[state3, setState] = useState(false);
const callback = useCallback(() => {
setState(true);
}, []);
let state4;
[state4, setState2] = useState(false);
let state5;
[state5, setState3] = useState(false);
state = state5;
const stateFromStores2 = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const token = useToken(Module712.modules.mobile.BOUNTY_TILE_BORDER_RADIUS);
ref = useRef(null);
const callback3 = useCallback(() => {
if (ref.current != null) {
clearTimeout(ref.current);
}
ref.current = setTimeout(() => {
setState2(true);
}, c9860_14);
}, []);
const [state6, setState5] = useState(isActive);
if (isActive !== state6) {
setState5(isActive);
if (isActive) {
if (state4 ? !state : state4) {
setState2(false);
}
if (state) {
setState3(false);
}
} else if (isAndroid) {
setState3(true);
}
}
ref2 = useRef(null);
useEffect(() => {
if (state) {
ref2.current = setTimeout(() => {
setState3(false);
setState2(false);
ref2.current = null;
}, 150);
}
return () => {
if (ref2.current != null) {
clearTimeout(ref2.current);
ref2.current = null;
}
};
}, [state]);
useEffect(() => {
let r2 = isActive;
if (isActive ? ref2.current != null : isActive) {
clearTimeout(ref2.current);
ref2.current = null;
}
if (!isActive) {
r2 = ref.current == null;
}
if (!r2) {
clearTimeout(ref.current);
ref.current = null;
}
}, [isActive]);
useEffect(() => () => {
if (ref.current != null) {
clearTimeout(ref.current);
ref.current = null;
}
}, []);
let state7;
[state7, setState4] = useState(AppState.currentState === "active");
useEffect(() => {
let c27629_0 = AppState.addEventListener("change", (a0) => {
setState4(a0 === "active");
});
return () => {
c27629_0.remove();
};
}, []);
let r126 = (isActive ? isActive : state) && videoPreview != null && state3;
let r127 = isAndroid2;
if (isAndroid2) {
r127 = isModalVisible;
}
let r128 = !r127;
if (!r127) {
if (state) {
state5 = !isActive;
}
r128 = !state5;
}
if (r128) {
r128 = r126;
}
if (r128) {
r128 = state4;
}
state2 = r128;
const memo = useMemo(() => ({
opacity: state2 ? 0 : 1
}), [state2]);
if (r126) {
r126 = <Video accessible={false} importantForAccessibility="no-hide-descendants" accessibilityRole="none" onReadyForDisplay={callback3} source={{
uri: videoPreview
}} style={styles.previewVideo} resizeMode="cover" repeat muted disableFocus paused={state7 ? stateFromStores2 : !state7} />;
}
const r150 = [r126, , , ,];
if (uri == null) {
uri = void 0;
}
r150[1] = <FastImage style={[styles.cardImage, memo]} onLoad={callback} source={{
uri
}} resizeMode="cover" />;
r150[2] = <View style={styles.badge}>
<View style={styles.badgeContent}>
{stateFromStores && <CheckmarkSmallBoldIcon size="xxs" color={Module712.colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT} />}
<Text variant="text-xs/bold" style={styles.badgeText}>
{intl.string(stateFromStores ? t.vlGTLf : t["fFIJ/9"])}
</Text>
</View>
</View>;
r150[3] = <View style={styles.startButton}>
<Button variant="secondary-overlay" text={stateFromStores ? intl.string(t["9UtZAY"]) : intl.string(t.LhlgY9)} onPress={callback2} />
</View>;
const r209 = [<Card style={styles.card} radius={token} onPress={callback2} android_ripple={{
color: "transparent"
}}>{r150}</Card>, ,];
let advertiserName = bounty.advertiserName;
if (advertiserName == null) {
advertiserName = "";
}
r209[1] = <View style={styles.cardFooter}>
<View style={styles.advertiserRow}>
<Text variant="text-sm/medium" color="text-subtle" lineClamp={1} style={styles.advertiserName}>{advertiserName}</Text>
<CircleCheckIcon size="xxs" style={styles.advertiserIcon} color={Module712.colors.ICON_SUBTLE} />
</View>
<Text variant="text-sm/medium" color="text-muted">
{intl.string(t.o6FLcF)}
</Text>
</View>;
return <View style={styles.tile}>{r209}</View>;
});
export default r52;
export const CARD_WIDTH = 188;
@@ -0,0 +1,111 @@
// Metro module 14187 (f14188).
import { useMemo } from "react";
import { StyleSheet, View } from "react-native";
import { jsx } from "react/jsx-runtime";
import { createStyles, createStyleProperties } from "../../../design/components/Styles/native/createStyles";
import { hexOpacityToRgba } from "../../../utils/ColorUtils";
import Module712 from "../../../_bundle/Module712";
import { useToken } from "../../../design/tokens/native/useToken";
import useTheme from "../../../hooks/useTheme";
import * as _Module4004 from "../../../_bundle/Module4004";
import Module4611 from "../../../_bundle/Module4611";
import Module5165 from "../../../_bundle/Module5165";
function $mk93257($env) {
return () => {
const r1 = $env;
return [r1[0], r1[1]];
};
}
let useStyles, start, end, start2, end2, styleProperties, PremiumRewardGlowGradient;
const PremiumRewardFillGradient = function PremiumRewardFillGradient(props) {
let env21020;
const { children, style } = props;
const styles = useStyles();
const r18 = env21020 = {};
env21020[0] = void 0;
env21020[1] = void 0;
const token2 = useToken(Module712.colors.EXPRESSIVE_GRADIENT_NITRO_PINK_START);
env21020[0] = token2;
const token = useToken(Module712.colors.EXPRESSIVE_GRADIENT_NITRO_PINK_END);
env21020[1] = token;
const memo = useMemo($mk93257(r18), [token2, token]);
const r36 = styleProperties();
const { transparentBlack, opaqueBlack, transparentWhite, opaqueWhite } = r36;
const isThemeDark = _Module4004.isThemeDark(useTheme());
return <View style={[styles.wrapper, style]}>
<Module4611 style={styles.fill} colors={memo} start={start} end={end} pointerEvents="none" />
<Module4611 style={styles.fill} colors={useMemo(() => isThemeDark ? [transparentBlack, opaqueBlack] : [transparentWhite, opaqueWhite], [transparentBlack, opaqueBlack, transparentWhite, opaqueWhite, isThemeDark])} start={start2} end={end2} pointerEvents="none" />
{children}
</View>;
};
PremiumRewardGlowGradient = function PremiumRewardGlowGradient(props) {
let env21021;
const { children, style } = props;
const styles = useStyles();
const r17 = env21021 = {};
env21021[0] = void 0;
env21021[1] = void 0;
const token2 = useToken(Module712.colors.EXPRESSIVE_GRADIENT_NITRO_PINK_START);
env21021[0] = token2;
const token = useToken(Module712.colors.EXPRESSIVE_GRADIENT_NITRO_PINK_END);
env21021[1] = token;
const memo = useMemo($mk93257(r17), [token2, token]);
const isThemeDark2 = _Module4004.isThemeDark(useTheme());
return <View style={[styles.wrapper, style]}>
<Module5165 style={[styles.glow, isThemeDark2 ? !isThemeDark2 : styles.glowLight]} maskElement={<Module4611 style={StyleSheet.absoluteFill} colors={["transparent", "black"]} start={start2} end={end2} />}>
<Module4611 style={StyleSheet.absoluteFill} colors={memo} start={start} end={end} />
</Module5165>
{children}
</View>;
};
useStyles = createStyles({
wrapper: {
position: "relative",
overflow: "hidden"
},
fill: {
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: "100%"
},
glow: {
position: "absolute",
left: 0,
right: 0,
bottom: 0,
height: "50%"
},
glowLight: {
opacity: 0.5
}
});
start = {
x: 0,
y: 0.5
};
end = {
x: 1,
y: 0.5
};
start2 = {
x: 0.5,
y: 0
};
end2 = {
x: 0.5,
y: 1
};
styleProperties = createStyleProperties({
transparentBlack: hexOpacityToRgba("#000000", 0),
opaqueBlack: Module712.colors.BLACK,
transparentWhite: hexOpacityToRgba("#FFFFFF", 0),
opaqueWhite: Module712.colors.WHITE
});
export default function QuestPremiumRewardGradientWrapper({ visible, style, children, glow }) {
return jsx(visible ? glow ? PremiumRewardGlowGradient : PremiumRewardFillGradient : View, {
style,
children
});
};
@@ -0,0 +1,262 @@
// Metro module 15859 (f15860).
import { useState, useMemo, useCallback } from "react";
import { Pressable, View } from "react-native";
import QuestStore from "../QuestStore";
import UnenrolledActivityQuestStore from "../UnenrolledActivityQuestStore";
import { QuestsExperimentLocations } from "../QuestConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import * as _Module501 from "../../../_bundle/Module501";
import { useTheme } from "../../../hooks/useTheme";
import { isThemeDark } from "../../../design/utils/shared/themes";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
import { getActivityApplicationId } from "../utils/QuestTaskUtils";
import { useQuestTaskDetails } from "../hooks/QuestHooks";
import { useQuestsInstructionsToWinReward } from "../hooks/QuestCopyHooks";
import { QuestContent } from "../QuestTypes";
import AvatarUtils from "../../../utils/AvatarUtils";
import { enrollInQuest, dismissQuestActivityModal, setAutoEnroll } from "../QuestActionCreators";
import { QuestContentCTA } from "../lib/analytics/AnalyticsTypes";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { useCheckboxA11yNative } from "../../../_bundle/Module3907";
import { Stack } from "../../../design/components/Stack/native/Stack.native";
import FastImage from "../../../components_native/common/FastImage";
import QuestRewardTile from "./QuestRewardTile";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { FormCheckbox } from "../../../design/components/Forms/native/FormCheckbox.native";
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
import Module7699 from "../../../_bundle/Module7699";
import { QuestContentImpressionTrackerNative } from "./QuestContentImpressionTracker.native";
import { Modal } from "../../../design/components/Modal/native/Modal.native";
import { HermesBuiltin } from "../../../_hermes/prelude";
let c11350_13, useStyles, CloseButton;
const QuestActivityUnenrolledModalInner = function QuestActivityUnenrolledModalInner(props) {
let state, setState, getOrFetchApplication;
const quest = props.quest;
state = void 0;
setState = void 0;
getOrFetchApplication = void 0;
const styles = useStyles(isThemeDark(useTheme()));
[state, setState] = useState(useStateFromStores([UnenrolledActivityQuestStore], () => UnenrolledActivityQuestStore.getState().autoEnroll));
getOrFetchApplication = useGetOrFetchApplication(getActivityApplicationId(quest));
const questsInstructionsToWinReward = useQuestsInstructionsToWinReward({
quest,
taskDetails: useQuestTaskDetails(quest),
location: QuestsExperimentLocations.QUEST_ACTIVITY_UNENROLLED_MODAL,
sourceQuestContent: QuestContent.QUEST_ACTIVITY_UNENROLLED_MODAL
});
const memo = useMemo(() => getOrFetchApplication != null ? AvatarUtils.getApplicationIconURL({
id: getOrFetchApplication.id,
icon: getOrFetchApplication.icon,
size: 87
}) : null, [getOrFetchApplication]);
const callback = useCallback(async () => {
let c28168_0;
c28168_0 = void 0;
await enrollInQuest(quest.id, {
questContent: QuestContent.QUEST_ACTIVITY_UNENROLLED_MODAL,
questContentCTA: QuestContentCTA.START_QUEST,
sourceQuestContent: QuestContent.QUEST_ACTIVITY_UNENROLLED_MODAL
});
ModalActionCreators.pop();
}, [quest.id]);
const checkboxA11yNative = useCheckboxA11yNative({
checked: state
});
const { accessibilityRole, accessibilityState } = checkboxA11yNative;
return <Stack direction="vertical" align="center" justify="center" style={styles.container}>
<View style={styles.content}>
<View style={styles.baseShadow}>
<View style={styles.imagesContainer}>
{memo != null && <View style={styles.appIconContainer}>
<FastImage source={{
uri: memo
}} style={styles.appIcon} />
</View>}
<View style={styles.rewardTileContainer}>
<QuestRewardTile quest={quest} height={87} width={87} style={styles.questRewardTile} />
</View>
</View>
</View>
<View style={styles.textContainer}>
<Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={{
textAlign: "center"
}}>
{intl.string(t.IrNgN4)}
</Text>
<Text variant="text-sm/normal" color="text-subtle" style={{
textAlign: "center"
}}>
{intl.format(t.V3NSJx, {
questName: quest.config.messages.questName
})}
{" "}
{questsInstructionsToWinReward}
</Text>
</View>
</View>
<View style={styles.footer}>
<View style={styles.buttonsContainer}>
<Button size="lg" text={intl.string(t.l7E81v)} onPress={callback} />
<Button size="lg" text={intl.string(t.fyT2ol)} onPress={function onPress() {
dismissQuestActivityModal(quest.id);
ModalActionCreators.pop();
}} variant="secondary" />
</View>
<Pressable accessibilityRole={accessibilityRole} accessibilityLabel={intl.string(t["931n1T"])} accessibilityState={accessibilityState} onPress={() => {
const r0 = !state;
setState(r0);
setAutoEnroll(r0);
}} style={{
alignSelf: "center",
flexDirection: "row",
alignItems: "center",
gap: 8
}}>
<FormCheckbox checked={state} />
<Text variant="text-sm/normal" color="text-subtle">
{intl.string(t["931n1T"])}
</Text>
</Pressable>
</View>
</Stack>;
};
CloseButton = function CloseButton() {
return <HeaderActionButton source={Module7699} onPress={function onPress() {
return ModalActionCreators.pop();
}} accessibilityLabel={intl.string(t.cpT0Cq)} />;
};
c11350_13 = {
MAIN: "main"
};
useStyles = createStyles((a0) => {
let baseShadow;
const imagesContainer = {
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
marginBottom: Module712.space.PX_32,
..._Module501.isIOS() ? a0 ? {
shadowColor: "rgb(144, 144, 251)",
shadowOffset: {
width: 0,
height: 0
},
shadowOpacity: 0.6,
shadowRadius: 85
} : {} : {
filter: a0 ? [{
dropShadow: {
standardDeviation: "85px",
color: "rgba(144, 144, 251, 0.65)",
offsetX: 0,
offsetY: 0
}
}, {
dropShadow: {
standardDeviation: "85px",
color: "rgba(144, 144, 250, 0.41)",
offsetX: 0,
offsetY: 0
}
}] : []
}
};
const isIOS = _Module501.isIOS();
const r49 = {};
if (isIOS) {
HermesBuiltin.copyDataProperties(r49, a0 ? {
shadowColor: "rgb(144, 144, 250)",
shadowOffset: {
width: 0,
height: 16
},
shadowOpacity: 0.4,
shadowRadius: 85
} : {});
baseShadow = r49;
} else {
baseShadow = r49;
}
return {
container: {
flex: 1,
paddingHorizontal: Module712.space.PX_24,
paddingVertical: Module712.space.PX_16,
paddingBottom: Module712.space.PX_48
},
content: {
marginTop: "auto"
},
imagesContainer,
baseShadow,
appIconContainer: {
borderRadius: Module712.radii.xl,
borderWidth: 2.18,
borderColor: "rgba(151, 151, 159, 0.24)",
borderStyle: "solid",
transform: [{
rotate: "-12.41deg"
}],
overflow: "hidden"
},
appIcon: {
width: 87,
height: 87,
borderRadius: Module712.radii.xl - 2.18
},
rewardTileContainer: {
borderWidth: 2.18,
borderColor: "rgba(151, 151, 159, 0.24)",
borderRadius: Module712.radii.xl,
borderStyle: "solid",
transform: [{
translateX: -10
}, {
rotate: "7.81deg"
}],
overflow: "hidden"
},
questRewardTile: {
borderRadius: Module712.radii.xl - 2.18
},
textContainer: {
alignItems: "center",
gap: Module712.space.PX_8
},
buttonsContainer: {
flexDirection: "column",
gap: Module712.space.PX_8,
marginBottom: 20
},
footer: {
flexDirection: "column",
width: "100%",
marginTop: "auto"
}
};
});
export default function QuestActivityUnenrolledModal(props) {
const questId = props.questId;
const stateFromStores = useStateFromStores([QuestStore], () => QuestStore.getQuest(questId));
if (stateFromStores == null) {
return null;
}
const screens = {};
screens[c11350_13.MAIN] = {
headerLeft: CloseButton,
headerRight: function headerRight() {
return null;
},
headerTitle: () => <Text variant="redesign/heading-18/bold" color="mobile-text-heading-primary">
{intl.string(t.l7E81v)}
</Text>,
render: () => <QuestContentImpressionTrackerNative questOrQuests={stateFromStores} questContent={QuestContent.QUEST_ACTIVITY_UNENROLLED_MODAL} sourceQuestContent={QuestContent.QUEST_ACTIVITY_UNENROLLED_MODAL}>
{() => <QuestActivityUnenrolledModalInner quest={stateFromStores} />}
</QuestContentImpressionTrackerNative>
};
return <Modal screens={screens} initialRouteName={c11350_13.MAIN} />;
};
@@ -0,0 +1,367 @@
// Metro module 14144 (f14145).
import Module19, { useState } from "react";
import { View } from "react-native";
import QuestStore from "../../QuestStore";
import { QuestTaskPlatform, QuestsExperimentLocations } from "../../QuestConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { getQuestLogger } from "../../lib/getQuestLogger";
import { manuallyStartConsoleQuest } from "../../QuestActionCreators";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { intl, t } from "../../../../intl/index.native";
import Module9172 from "../../../../_bundle/Module9172";
import { useQuestTaskDetails, useIsQuestProgressing, useTaskPlatformScreen, useConnectedAccounts, useQuestHowToHelpArticle } from "../../hooks/QuestHooks";
import { supportedConsoles } from "../../utils/QuestPlatformUtils";
import { TaskPlatformScreen, QuestContent } from "../../QuestTypes";
import { useHasWatchVideoOnMobileTasks, useMobileActivityQuest } from "../QuestHooks.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { QuestContentImpressionTrackerNative } from "../QuestContentImpressionTracker.native";
import * as _QuestTaskUtils from "../../utils/QuestTaskUtils";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import QuestBottomSheetHeader from "./QuestBottomSheetHeader";
import QuestBottomSheetFooter from "./QuestBottomSheetFooter";
import { useTrackQuestContentClickedWithImpression } from "../../lib/analytics/AnalyticsHooks";
import { useQuestImpressionId } from "../../lib/analytics/ContentImpressionTrackerHooks";
import { QuestContentCTA } from "../../lib/analytics/AnalyticsTypes";
import { shouldMigrateToAdAnalyticsInterface, AdAnalyticsInterfaceExperimentStep } from "../../experiments/AdAnalyticsInterfaceExperiment";
import { captureAdUserAction } from "../../../ads/analytics/captureAdUserAction";
import { AdUserActionType } from "../../../ads/analytics/captureAdUserActionTypes";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestBottomSheetProgressCardWatchTask, QuestBottomSheetProgressCardInGameTask, QuestBottomSheetProgressCardPlayStreamTask } from "./QuestBottomSheetProgressCard";
import QuestBottomSheetTaskSelect from "./QuestBottomSheetTaskSelect";
import QuestBottomSheetConsoleConnect from "./QuestBottomSheetConsoleConnect";
import { isSponsoredPlayQuest } from "../../utils/QuestUtils";
import { WarningIcon } from "../../../../design/components/Icon/native/redesign/generated/WarningIcon";
import { Text } from "../../../../design/components/Text/native/Text";
let c9898_13, useStyles, useEnrolledQuestContentProps, QuestBottomSheetContent, MicrophoneUnit, context;
const QuestBottomSheet = function QuestBottomSheet(props) {
let state, r55, Provider, defibrillator, footer, handleTaskSelect2, props2, quest5, showMicrophone, sourceQuestContent4, step, styles;
let setState;
L4: {
quest5 = props.quest;
const initialStep2 = props.initialStep;
sourceQuestContent4 = props.sourceQuestContent;
setState = void 0;
styles = useStyles();
const enrolledQuestContentProps = useEnrolledQuestContentProps({
quest: quest5,
initialStep: initialStep2,
location: QuestsExperimentLocations.QUEST_HOME_MOBILE,
sourceQuestContent: sourceQuestContent4
});
step = enrolledQuestContentProps.step;
defibrillator = enrolledQuestContentProps.defibrillator;
const stepActions = enrolledQuestContentProps.stepActions;
handleTaskSelect2 = enrolledQuestContentProps.handleTaskSelect;
showMicrophone = enrolledQuestContentProps.showMicrophone;
const hasWatchVideoOnMobileTasks3 = useHasWatchVideoOnMobileTasks(quest5.config);
const hasWatchVideoTasks = _QuestTaskUtils.hasWatchVideoTasks(quest5);
const isInGameQuest = _QuestTaskUtils.isInGameQuest(quest5);
let state;
[state, setState] = useState(0);
const memo4 = Module19.useMemo(() => ({
isInQuestBottomSheet: true
}), []);
Provider = context.Provider;
r55 = {
value: memo4,
children: null
};
props2 = {
header: <QuestBottomSheetHeader quest={quest5} step={step} location={QuestsExperimentLocations.QUEST_HOME_MOBILE} />,
footer: null,
startExpanded: true,
children: null
};
footer = null;
if (!isInGameQuest) {
if (hasWatchVideoTasks) {
footer = null;
if (!hasWatchVideoOnMobileTasks3) {
break L4;
}
}
footer = <QuestBottomSheetFooter quest={quest5} sourceQuestContent={sourceQuestContent4} step={step} isDefibrilating={defibrillator.isActive} onLayout={function onLayout(event) {
setState(event.nativeEvent.layout.height);
}} onBack={stepActions.onBack} onDefib={defibrillator.start} onConnectConsoleNext={stepActions.onNext} />;
}
}
props2.footer = footer;
props2.children = <View style={[styles.contentContainer, {
paddingBottom: step !== c9898_13.TASK_SELECT ? state : 0
}]}>
<QuestBottomSheetContent defibrillator={defibrillator} quest={quest5} handleTaskSelect={handleTaskSelect2} location={QuestsExperimentLocations.QUEST_HOME_MOBILE} showMicrophone={showMicrophone} sourceQuestContent={sourceQuestContent4} step={step} />
</View>;
r55.children = <BottomSheet {...props2} />;
return <Provider {...r55} />;
};
useEnrolledQuestContentProps = function useEnrolledQuestContentProps(a0) {
let xboxAndPlaystationAccounts, c20940_2, c20940_3, c20940_4, state, setState2, c20940_7, callback, hideConsoleSelect2, memo, memo2, memo3, hasWatchVideoOnMobileTasks, isMobileActivityQuest;
const { quest, initialStep: initialStep2 } = a0;
a0.location;
const sourceQuestContent = a0.sourceQuestContent;
const trackQuestContentClickedWithImpression = useTrackQuestContentClickedWithImpression();
const questImpressionId = useQuestImpressionId();
const questTaskDetails = useQuestTaskDetails(quest);
const isQuestProgressing = useIsQuestProgressing(quest);
let [r14, , c20939_4] = useTaskPlatformScreen(quest, questTaskDetails);
const hasWatchVideoOnMobileTasks3 = useHasWatchVideoOnMobileTasks(quest.config);
const quest2 = quest;
xboxAndPlaystationAccounts = void 0;
c20940_2 = void 0;
c20940_3 = void 0;
c20940_4 = void 0;
state = void 0;
setState2 = void 0;
c20940_7 = void 0;
callback = void 0;
memo = void 0;
memo2 = void 0;
memo3 = void 0;
hasWatchVideoOnMobileTasks = void 0;
isMobileActivityQuest = void 0;
const showConsoleSelect2 = function showConsoleSelect() {
return setState2(true);
};
hideConsoleSelect2 = function hideConsoleSelect() {
return setState2(false);
};
const r57 = quest.userStatus?.completedAt != null;
xboxAndPlaystationAccounts = useConnectedAccounts().xboxAndPlaystationAccounts;
const memo4 = Module19.useMemo(() => supportedConsoles(quest2).filter((c31707_0) => xboxAndPlaystationAccounts.find((xboxAndPlaystationAccount) => xboxAndPlaystationAccount.type === c31707_0) != null), [quest, xboxAndPlaystationAccounts]);
const questTaskDetails2 = useQuestTaskDetails(quest);
let r20 = useIsQuestProgressing(quest);
const [r26, r25, r77] = useTaskPlatformScreen(quest, questTaskDetails2);
c20940_2 = r26;
c20940_3 = r25;
c20940_4 = r77;
[state, setState2] = Module19.useState(memo4.length === 0 && !r57 && r26 === TaskPlatformScreen.CONSOLE || initialStep2 === c9898_13.CONSOLE_CONNECT);
if (!r20) {
r20 = questTaskDetails2.progressSeconds > 0;
}
c20940_7 = r20;
if (!(memo4.length !== 0 || r57 || r26 !== TaskPlatformScreen.CONSOLE || state)) {
setState2(true);
}
callback = Module19.useCallback(() => {
setState2(false);
c20940_4(null);
}, [r77]);
memo = Module19.useMemo(() => [{
type: c9898_13.TASK_STATUS,
shouldShow: true
}], []);
memo2 = Module19.useMemo(() => [{
type: c9898_13.CONSOLE_CONNECT,
shouldShow: state,
onNext: hideConsoleSelect2
}, {
type: c9898_13.TASK_STATUS,
shouldShow: true,
onBack: c20940_7 ? void 0 : showConsoleSelect2
}], [state, r20]);
memo3 = Module19.useMemo(() => {
const TASK_SELECT = c9898_13.TASK_SELECT;
const r15 = [{
type: TASK_SELECT,
shouldShow: c20940_2 === TaskPlatformScreen.SELECT
}, , ,];
const shouldShow = c20940_2 === TaskPlatformScreen.CONSOLE && state;
let r23 = callback;
r15[1] = {
type: c9898_13.CONSOLE_CONNECT,
shouldShow,
onBack: callback,
onNext: hideConsoleSelect2
};
let onBack = void 0;
if (!c20940_7) {
if (c20940_2 === TaskPlatformScreen.CONSOLE) {
r23 = showConsoleSelect2;
}
onBack = r23;
}
r15[2] = {
type: c9898_13.TASK_STATUS,
shouldShow: true,
onBack
};
return r15;
}, [r26, state, r20, callback]);
hasWatchVideoOnMobileTasks = useHasWatchVideoOnMobileTasks(quest.config);
isMobileActivityQuest = useMobileActivityQuest(quest).isMobileActivityQuest;
const memo5 = Module19.useMemo(() => {
let r16;
const r5 = c20940_3.length === 1 && c20940_3.includes(QuestTaskPlatform.DESKTOP);
const r12 = c20940_3.length === 1 && c20940_3.includes(QuestTaskPlatform.CONSOLE);
L10: {
r16 = memo3;
if (!r5 && (!hasWatchVideoOnMobileTasks && !isMobileActivityQuest)) {
if (!r12) {
break L10;
}
r16 = memo2;
} else {
r16 = memo;
}
}
let r21 = r16.find((item) => item.shouldShow);
const r23 = r16;
if (r21 == null) {
r21 = r23.at(-1);
}
return r21;
}, [r25, memo3, memo, memo2, hasWatchVideoOnMobileTasks, isMobileActivityQuest]);
const r130 = [memo5.type, ,];
const onBack = memo5?.onBack;
const onNext = memo5?.onNext;
r130[1] = {
onBack,
onNext
};
const [step, stepActions] = r130;
const quest3 = quest;
const questLogger = getQuestLogger({
quest,
location: QuestsExperimentLocations.QUEST_HOME_MOBILE
});
const [errorHints, setState3] = useState([]);
const [isActive, setState4] = useState(false);
return {
quest,
defibrillator: {
errorHints,
isActive,
start: Module19.useCallback(() => {
setState4(true);
manuallyStartConsoleQuest(quest3.id).then((result) => setState3(result.errorHints)).catch((error) => {
setState3([]);
questLogger.error("Failed to start console quest", error);
ToastActionCreators.open({
key: "START_DEFIBRILLATOR_ERROR",
content: intl.string(t.CKsXk3),
icon: Module9172
});
}).finally(() => setState4(false));
}, [quest, questLogger, setState4, setState3])
},
step,
stepActions,
showMicrophone: !(quest.userStatus?.completedAt != null) && !isQuestProgressing && r14 === TaskPlatformScreen.CONSOLE && !hasWatchVideoOnMobileTasks3,
handleTaskSelect: function handleTaskSelect(a0) {
const questContentCTA = a0 === QuestTaskPlatform.CONSOLE ? QuestContentCTA.SELECT_CONSOLE_PLATFORM : a0 === QuestTaskPlatform.DESKTOP ? QuestContentCTA.SELECT_DESKTOP_PLATFORM : QuestContentCTA.DESELECT_PLATFORM;
if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_bottom_sheet")) {
captureAdUserAction({
type: AdUserActionType.CLICK_INTERNAL,
adCreativeType: AdCreativeType.QUEST,
adCreativeId: quest.id,
questContentCTA,
surfaceId: QuestContent.QUEST_BOTTOM_SHEET,
sourceQuestContent,
impressionId: questImpressionId
});
} else {
trackQuestContentClickedWithImpression({
questId: quest.id,
questContent: QuestContent.QUEST_BOTTOM_SHEET,
questContentCTA,
sourceQuestContent
});
}
c20939_4(a0);
}
};
};
QuestBottomSheetContent = function QuestBottomSheetContent(props) {
const { defibrillator, quest: quest4, handleTaskSelect: handleTaskSelect2 } = props;
let showMicrophone = props.showMicrophone;
if (showMicrophone === void 0) {
showMicrophone = false;
}
const { sourceQuestContent: sourceQuestContent2, step } = props;
const hasWatchVideoOnMobileTasks2 = useHasWatchVideoOnMobileTasks(quest4.config);
const memo4 = Module19.useMemo(() => hasWatchVideoOnMobileTasks2 ? <QuestBottomSheetProgressCardWatchTask quest={quest4} sourceQuestContent={sourceQuestContent2} /> : _QuestTaskUtils.isInGameQuest(quest4) ? <QuestBottomSheetProgressCardInGameTask quest={quest4} sourceQuestContent={sourceQuestContent2} /> : <QuestBottomSheetProgressCardPlayStreamTask quest={quest4} sourceQuestContent={sourceQuestContent2} />, [quest4, hasWatchVideoOnMobileTasks2, sourceQuestContent2]);
const r33 = [step === c9898_13.TASK_SELECT && <QuestBottomSheetTaskSelect onTaskSelect={handleTaskSelect2} />, step === c9898_13.CONSOLE_CONNECT && <QuestBottomSheetConsoleConnect quest={quest4} step={step} sourceQuestContent={sourceQuestContent2} />, ,];
let r42 = step === c9898_13.TASK_STATUS;
if (r42) {
const r44 = [memo4, ,];
if (showMicrophone) {
showMicrophone = !hasWatchVideoOnMobileTasks2;
}
if (showMicrophone) {
showMicrophone = <MicrophoneUnit quest={quest4} errorHints={defibrillator?.errorHints} />;
}
r44[1] = showMicrophone;
r42 = <View>{r44}</View>;
}
r33[2] = r42;
return <>{r33}</>;
};
MicrophoneUnit = function MicrophoneUnit(props) {
const { quest: quest5, errorHints } = props;
const styles = useStyles();
const message = useQuestHowToHelpArticle().message;
let r27 = errorHints?.length;
if (r27 == null) {
r27 = 0;
}
const r28 = r27 > 0;
const r47 = r28 && errorHints != null ? [...errorHints.map((errorHint) => errorHint.message), message] : [isSponsoredPlayQuest(quest5) ? intl.string(t.bUyEZZ) : intl.formatToPlainString(t.GXqvC1, {
gameTitle: quest5.config.messages.gameTitle
})];
return <View style={styles.microphoneUnit}>
<View style={styles.microphoneUnitHeader}>
<WarningIcon color={r28 ? "text-feedback-critical" : "text-feedback-warning"} />
<Text variant="text-md/medium" color="mobile-text-heading-primary">
{r28 ? intl.formatToPlainString(t["28Ql27"], {
gameTitle: quest5.config.messages.gameTitle
}) : intl.string(t.YstzGO)}
</Text>
</View>
{r47.map((item, index) => <Text key={index} variant="text-sm/normal">
{item}
</Text>)}
</View>;
};
c9898_13 = {
TASK_SELECT: "TASK_SELECT",
CONSOLE_CONNECT: "CONSOLE_CONNECT",
TASK_STATUS: "TASK_STATUS"
};
useStyles = createStyles({
contentContainer: {
display: "flex",
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_24
},
microphoneUnit: {
display: "flex",
gap: Module712.space.PX_8,
marginHorizontal: -Module712.space.PX_16,
paddingHorizontal: Module712.space.PX_16,
marginTop: Module712.space.PX_16,
paddingTop: Module712.space.PX_16,
borderTopWidth: 1,
borderTopColor: Module712.colors.BORDER_SUBTLE
},
microphoneUnitHeader: {
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_8
}
});
context = Module19.createContext({
isInQuestBottomSheet: false
});
export default function QuestBottomSheetConnected(props) {
const { questId, initialStep, sourceQuestContent: sourceQuestContent3, questContentPosition } = props;
const stateFromStores = useStateFromStores([QuestStore], () => QuestStore.getQuest(questId));
return stateFromStores != null ? <QuestContentImpressionTrackerNative overrideVisibility questOrQuests={stateFromStores} questContent={QuestContent.QUEST_BOTTOM_SHEET} questContentPosition={questContentPosition} sourceQuestContent={sourceQuestContent3}>
{() => <QuestBottomSheet quest={stateFromStores} initialStep={initialStep} sourceQuestContent={sourceQuestContent3} />}
</QuestContentImpressionTrackerNative> : null;
};
export { c9898_13 as QuestBottomSheetStep };
export { useEnrolledQuestContentProps };
export { QuestBottomSheetContent };
export { context as QuestBottomSheetContext };
@@ -0,0 +1,135 @@
// Metro module 14186 (f14187).
import { useMemo } from "react";
import { View } from "react-native";
import { PlatformTypes, UserSettingsSections } from "../../../../Constants";
import { jsxs, Fragment } from "react/jsx-runtime";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useConnectedAccounts } from "../../hooks/QuestHooks";
import { useTrackQuestContentClickedWithImpression } from "../../lib/analytics/AnalyticsHooks";
import { useQuestImpressionId } from "../../lib/analytics/ContentImpressionTrackerHooks";
import { supportedConsoles } from "../../utils/QuestPlatformUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { openUserSettings } from "../../../user_settings/core/native/openUserSettings";
import { shouldMigrateToAdAnalyticsInterface, AdAnalyticsInterfaceExperimentStep } from "../../experiments/AdAnalyticsInterfaceExperiment";
import { captureAdUserAction } from "../../../ads/analytics/captureAdUserAction";
import { AdUserActionType } from "../../../ads/analytics/captureAdUserActionTypes";
import { AdCreativeType } from "../../../../_bundle/Module6013";
import { QuestContentCTA } from "../../lib/analytics/AnalyticsTypes";
import { QuestContent } from "../../QuestTypes";
import authorizeConnection_native from "../../../connections/authorizeConnection.native";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { PlaystationNeutralIcon } from "../../../../design/components/Icon/native/redesign/generated/PlaystationNeutralIcon";
import { intl, t } from "../../../../intl/index.native";
import { XboxNeutralIcon } from "../../../../design/components/Icon/native/redesign/generated/XboxNeutralIcon";
let ConsoleRow;
const NonInlineConsoleConnection = function NonInlineConsoleConnection(props) {
const { consoles, onConsoleSelect: onConsoleSelect2 } = props;
return <TableRowGroup hasIcons>
{consoles.map((console) => <ConsoleRow key={console.type} {...console} onPress={onConsoleSelect2} />)}
</TableRowGroup>;
};
ConsoleRow = function ConsoleRow(props) {
const { onPress: onPress2, ...rest } = props;
let c21017_1 = rest;
const type = rest.type;
if (PlatformTypes.PLAYSTATION === type) {
return <TableRow arrow icon={<PlaystationNeutralIcon />} label={intl.string(t.JafL6p)} subLabel={rest.account != null ? intl.string(t["u30/ut"]) : void 0} onPress={() => onPress2(c21017_1)} />;
}
if (PlatformTypes.XBOX === type) {
return <TableRow arrow icon={<XboxNeutralIcon />} label={intl.string(t.Nfvo72)} subLabel={rest.account != null ? intl.string(t["u30/ut"]) : void 0} onPress={() => onPress2(c21017_1)} />;
}
return null;
};
View;
jsxs;
Fragment;
Module712.unsafe_rawColors.PLATFORM_XBOX;
Module712.unsafe_rawColors.PLATFORM_PLAYSTATION;
createStyles({
platformButtonsContainer: {
display: "flex",
flexDirection: "row",
gap: Module712.space.PX_16,
justifyContent: "space-between"
},
platformButton: {
flex: 1,
display: "flex",
justifyContent: "center",
alignItems: "center"
}
});
export default function QuestBottomSheetConsoleConnect(props) {
let xboxAndPlaystationAccounts, trackQuestContentClickedWithImpression, questImpressionId;
const { quest, step, sourceQuestContent } = props;
xboxAndPlaystationAccounts = void 0;
trackQuestContentClickedWithImpression = void 0;
questImpressionId = void 0;
const openQuestBottomSheet2 = function openQuestBottomSheet() {
ActionSheetActionCreators.openLazy(import("./QuestBottomSheet"), "QuestBottomSheet", {
questId: quest.id,
initialStep: step,
sourceQuestContent
});
};
xboxAndPlaystationAccounts = useConnectedAccounts().xboxAndPlaystationAccounts;
trackQuestContentClickedWithImpression = useTrackQuestContentClickedWithImpression();
questImpressionId = useQuestImpressionId();
return <NonInlineConsoleConnection consoles={useMemo(() => supportedConsoles(quest).map((item) => {
return {
type: item,
account: xboxAndPlaystationAccounts.find((xboxAndPlaystationAccount) => xboxAndPlaystationAccount.type === item)
};
}), [quest, xboxAndPlaystationAccounts])} onConsoleSelect={function onConsoleSelect(event) {
if (event.account != null) {
if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_bottom_sheet_console_connect")) {
captureAdUserAction({
type: AdUserActionType.CLICK_INTERNAL,
adCreativeType: AdCreativeType.QUEST,
adCreativeId: quest.id,
questContentCTA: QuestContentCTA.VIEW_CONSOLE_CONNECTIONS,
surfaceId: QuestContent.QUEST_BOTTOM_SHEET,
sourceQuestContent,
impressionId: questImpressionId
});
} else {
trackQuestContentClickedWithImpression({
questId: quest.id,
questContent: QuestContent.QUEST_BOTTOM_SHEET,
questContentCTA: QuestContentCTA.VIEW_CONSOLE_CONNECTIONS,
sourceQuestContent
});
}
ActionSheetActionCreators.hideActionSheet();
openUserSettings({
screen: UserSettingsSections.CONNECTIONS
});
return void 0;
}
if (shouldMigrateToAdAnalyticsInterface(AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_bottom_sheet_console_connect")) {
captureAdUserAction({
type: AdUserActionType.CLICK_INTERNAL,
adCreativeType: AdCreativeType.QUEST,
adCreativeId: quest.id,
questContentCTA: QuestContentCTA.CONNECT_CONSOLE,
surfaceId: QuestContent.QUEST_BOTTOM_SHEET,
sourceQuestContent,
impressionId: questImpressionId
});
} else {
trackQuestContentClickedWithImpression({
questId: quest.id,
questContent: QuestContent.QUEST_BOTTOM_SHEET,
questContentCTA: QuestContentCTA.CONNECT_CONSOLE,
sourceQuestContent
});
}
authorizeConnection_native({
platformType: event.type,
location: "quests",
onClose: openQuestBottomSheet2
});
}} />;
};
Loaded 100 of 33051 files, more files were not shown because too many files have changed in this diff. Show more