decord/source/modules/quests/native/VideoQuestModal/VideoQuestModal.tsx
2026-08-13 07:00:46 +00:00

335 lines
14 KiB
TypeScript

// Module ID: 14441
// Function ID: 14442
// Name: VideoQuestModalSteps
// Dependencies: [32, 19, 17, 676, 21, 4342, 712, 14442, 11232, 7222, 14412, 8781, 4083, 4754, 1628, 8054, 14443, 5368, 14446, 14474, 11215, 10420, 11225, 5205, 11386, 2]
// Module 14441 (VideoQuestModalSteps)
import _slicedToArray from "_slicedToArray";
import importAllResult from "module_14474";
import get_ActivityIndicator from "SafeAreaPaddingView";
import { AnalyticEvents } from "ME";
import jsxProd from "useQuests";
import createCacheKey from "createCacheKey";
let StyleSheet;
let c5;
let error;
let metroImportAll;
const require = arg1;
let c4 = importAllResult;
({ View: c5, StyleSheet } = get_ActivityIndicator);
({ jsx: error, jsxs: metroImportAll } = jsxProd);
let closure_9 = { mass: 1.9, damping: 18, stiffness: 80, overshootClamping: true };
let obj = { WATCH_VIDEO: 0, [0]: "WATCH_VIDEO", POST_WATCH_VIDEO: 1, [1]: "POST_WATCH_VIDEO" };
obj = { root: null, pillarboxed: null, wrapper: null, contentWrapper: null, contentBackground: null, modalContentWrapper: null, backgroundWrapper: null };
obj[0] = { backgroundColor: require("Themes").colors.BACKGROUND_SCRIM };
obj[1] = { alignSelf: "center" };
obj[2] = { flexDirection: "column", flexGrow: 1, flexShrink: 1, zIndex: 1 };
obj[3] = { flex: 1 };
createCacheKey = {};
const merged = Object.assign(StyleSheet.absoluteFillObject);
createCacheKey.borderRadius = require("Themes").radii.lg;
createCacheKey.backgroundColor = require("Themes").colors.BACKGROUND_BASE_LOWEST;
obj[4] = createCacheKey;
obj[5] = { zIndex: 2 };
let obj3 = {};
const merged1 = Object.assign(StyleSheet.absoluteFillObject);
obj3.borderRadius = require("Themes").radii.lg;
obj3.flex = 1;
obj3.overflow = "hidden";
obj3.pointerEvents = "none";
obj3.zIndex = 1;
obj[6] = obj3;
let closure_11 = createCacheKey.createStyles(obj);
let closure_12 = { code: "function VideoQuestModalTsx1(){const{withSpring,clamp,postWatchAnimationState,BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG,interpolate,CLOUDS_BACKGROUND_INVISIBLE_OFFSET_Y}=this.__closure;return{opacity:withSpring(clamp(postWatchAnimationState.get(),0,1),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG),transform:[{translateY:withSpring(interpolate(postWatchAnimationState.get(),[0,1],[CLOUDS_BACKGROUND_INVISIBLE_OFFSET_Y,0]),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG)}]};}" };
let closure_13 = { code: "function VideoQuestModalTsx2(){const{withSpring,interpolate,postWatchAnimationState,safeAreaInsets,BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG}=this.__closure;return{transform:[{translateY:withSpring(interpolate(postWatchAnimationState.get(),[0,1],[safeAreaInsets.top,0]),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG)}],opacity:withSpring(postWatchAnimationState.get(),BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG)};}" };
let closure_14 = importAllResult.memo((sourceQuestContent) => {
let closure_7;
let height;
let initialStep;
let onClose;
let tmp12;
let width;
({ onClose, initialStep } = sourceQuestContent);
sourceQuestContent = sourceQuestContent.sourceQuestContent;
let obj = initialStep(quest[7]);
const videoQuestModalContext = obj.useVideoQuestModalContext();
quest = videoQuestModalContext.quest;
const videoSessionId = videoQuestModalContext.videoSessionId;
const userStatus = quest.userStatus;
let completedAt;
if (userStatus != null) {
completedAt = userStatus.completedAt;
}
let obj1 = importAllResult;
if (initialStep != null) {
const tmp9 = videoSessionId(importAllResult.useState(initialStep), 2);
const first = tmp9[0];
let closure_6 = tmp9[1];
[tmp12, closure_7] = videoSessionId(obj1.useState(false), 2);
let items = [quest.id, videoSessionId, sourceQuestContent];
const callback = obj1.useCallback((arg0) => {
const applyOrientationLock = initialStep(quest[8]).applyOrientationLock;
if (arg0) {
applyOrientationLock("LANDSCAPE");
} else {
applyOrientationLock("PORTRAIT");
}
callback2(arg0);
let obj = initialStep(quest[9]);
obj = { questId: quest.id, event: arg0 ? tmp5.QUEST_VIDEO_FULLSCREEN_ENTERED : tmp5.QUEST_VIDEO_FULLSCREEN_EXITED, properties: obj, sourceQuestContent };
obj = { video_session_id: videoSessionId };
obj.trackQuestEvent(obj);
}, items);
const tmp15 = sharedValue();
let closure_9 = tmp15;
const tmp17 = sourceQuestContent(tmp2[11])(obj1.useContext(tmp(tmp2[10]).QuestDockGestureContext).windowDimensions);
({ width, height } = tmp17);
let bound = null;
if (tmp17.landscape) {
bound = null;
if (!tmp12) {
const _Math = Math;
const _Math2 = Math;
bound = Math.min(width, Math.floor(0.5625 * height));
}
}
let items1 = [bound, tmp15.pillarboxed];
const items2 = [tmp5, initialStep];
const memo = obj1.useMemo(() => {
let tmp2 = null;
if (null != bound) {
const items = [tmp15.pillarboxed, ];
const obj = { width: null };
obj[0] = tmp;
items[1] = obj;
tmp2 = items;
}
return tmp2;
}, items1);
const layoutEffect = obj1.useLayoutEffect(() => {
let tmp = closure_4;
if (closure_4) {
tmp = null == initialStep;
}
if (tmp) {
callback(bound.POST_WATCH_VIDEO);
}
}, items2);
const items3 = [callback];
const callback1 = obj1.useCallback(() => {
callback(bound.WATCH_VIDEO);
}, []);
const callback2 = obj1.useCallback(() => {
callback(false);
callback(bound.POST_WATCH_VIDEO);
}, items3);
let tmpResult = tmp(tmp2[12]);
let num3 = 0;
if (first === bound.POST_WATCH_VIDEO) {
num3 = 1;
}
sharedValue = tmpResult.useSharedValue(num3);
tmpResult = tmp(tmp2[12]);
class L {
constructor() {
obj = { opacity: null, transform: null };
obj2 = initialStep(quest[13]);
obj3 = initialStep(quest[12]);
obj[0] = obj2.withSpring(obj3.clamp(POST_WATCH_VIDEO.get(), 0, 1), outer1_9);
obj = { translateY: null };
obj5 = initialStep(quest[13]);
obj6 = initialStep(quest[12]);
obj[0] = obj5.withSpring(obj6.interpolate(POST_WATCH_VIDEO.get(), [0, 1], [-100, 0]), outer1_9);
items = [];
items[0] = obj;
obj[1] = items;
return obj;
}
}
obj = { withSpring: null, clamp: null, postWatchAnimationState: null, BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG: null, interpolate: null, CLOUDS_BACKGROUND_INVISIBLE_OFFSET_Y: -100 };
obj[0] = tmp(tmp2[13]).withSpring;
obj[1] = tmp(tmp2[12]).clamp;
obj[2] = sharedValue;
obj[3] = closure_9;
obj[4] = tmp(tmp2[12]).interpolate;
L.__closure = obj;
L.__workletHash = 11571705142399;
L.__initData = closure_12;
const animatedStyle = tmpResult.useAnimatedStyle(L);
const tmp29 = sourceQuestContent(tmp2[14])();
closure_12 = tmp29;
const tmp11 = videoSessionId(obj1.useState(false), 2);
class U {
constructor() {
obj = { transform: null, opacity: null };
obj = { translateY: null };
obj3 = initialStep(quest[13]);
obj4 = initialStep(quest[12]);
items = [, ];
items[0] = closure_12.top;
items[1] = 0;
obj[0] = obj3.withSpring(obj4.interpolate(POST_WATCH_VIDEO.get(), [0, 1], items), outer1_9);
items1 = [];
items1[0] = obj;
obj[0] = items1;
obj5 = initialStep(quest[13]);
obj[1] = obj5.withSpring(POST_WATCH_VIDEO.get(), outer1_9);
return obj;
}
}
obj = { withSpring: null, interpolate: null, postWatchAnimationState: null, safeAreaInsets: null, BACKGROUND_ENTRANCE_ANIMATION_SPRING_CONFIG: null };
obj[0] = tmp(tmp2[13]).withSpring;
obj[1] = tmp(tmp2[12]).interpolate;
obj[2] = sharedValue;
obj[3] = tmp29;
obj[4] = closure_9;
U.__closure = obj;
U.__workletHash = 9769051401109;
U.__initData = closure_13;
const items4 = [sharedValue, first];
const animatedStyle1 = tmp(tmp2[12]).useAnimatedStyle(U);
const effect = obj1.useEffect(() => {
let num = 0;
if (first === bound.POST_WATCH_VIDEO) {
num = 1;
}
const result = sharedValue.set(num);
}, items4);
obj1 = { style: null, children: null };
obj1[0] = tmp15.root;
let obj2 = { style: null, children: null };
const items5 = [tmp15.modalContentWrapper, memo];
obj2[0] = items5;
let obj3 = { style: null, children: null };
const items6 = [tmp15.backgroundWrapper, ];
let obj4 = { height: null };
obj4[0] = height;
items6[1] = obj4;
obj3[0] = items6;
let tmp16Result = tmp16(tmp2[15]);
let obj5 = { style: null };
const items7 = [tmp15.contentBackground, ];
const obj6 = { top: null };
obj6[0] = tmp29.top;
items7[1] = obj6;
obj5[0] = items7;
const items8 = [callback(sourceQuestContent(tmp2[15]), obj5), , ];
const obj7 = { style: null };
const items9 = [tmp15.contentBackground, animatedStyle1];
obj7[0] = items9;
items8[1] = callback(sourceQuestContent(tmp2[15]), obj7);
const obj8 = { style: null, children: null };
obj8[0] = animatedStyle;
tmp16Result = tmp16(tmp2[15]);
obj8[1] = callback(sourceQuestContent(tmp2[16]), { align: "top" });
items8[2] = callback(tmp16Result, obj8);
obj3[1] = items8;
const items10 = [callback(first, obj3), ];
const obj9 = { top: true, style: null, children: null };
const items11 = [tmp15.wrapper, ];
const obj10 = { height: null };
obj10[0] = height;
items11[1] = obj10;
obj9[1] = items11;
const obj11 = { style: null, children: null };
obj11[0] = tmp15.contentWrapper;
let tmp33Result = first === tmp24.WATCH_VIDEO;
if (tmp33Result) {
if (bound == null) {
bound = width;
}
const obj12 = { contentWidth: null, isFullscreen: null, onNavigateToPostWatchVideo: null, onClose: null, onEnd: null, setIsFullscreen: null, sourceQuestContent: null };
obj12[0] = bound;
obj12[1] = tmp12;
obj12[2] = callback2;
obj12[3] = onClose;
obj12[4] = callback2;
obj12[5] = callback;
obj12[6] = sourceQuestContent;
tmp33Result = tmp33(tmp16(tmp2[18]), obj12);
const tmp16Result1 = tmp16(tmp2[18]);
}
const items12 = [tmp33Result, ];
tmp33Result = first === tmp24.POST_WATCH_VIDEO;
if (tmp33Result) {
const obj13 = { onClose: null, onRestartVideo: null, sourceQuestContent: null };
obj13[0] = onClose;
obj13[1] = callback1;
obj13[2] = sourceQuestContent;
tmp33Result = tmp33(tmp16(tmp2[19]), obj13);
}
items12[1] = tmp33Result;
obj11[1] = items12;
obj9[2] = callback(first, obj11);
items10[1] = callback(tmp(tmp2[17]).SafeAreaPaddingView, obj9);
obj2[1] = items10;
obj1[1] = callback(tmp16Result, obj2);
return callback(first, obj1);
}
});
const watch_mobile_video_quest = "watch_mobile_video_quest";
let obj1 = { backgroundColor: require("Themes").colors.BACKGROUND_SCRIM };
const memoResult = importAllResult.memo(function VideoQuestModal(questContentPosition) {
questContentPosition = questContentPosition.questContentPosition;
const onClose = questContentPosition.onClose;
const videoSessionId = questContentPosition.videoSessionId;
const initialStep = questContentPosition.initialStep;
const sourceQuestContent = questContentPosition.sourceQuestContent;
const items = [onClose];
const callback = sourceQuestContent.useCallback(() => {
const result = questContentPosition(videoSessionId[20]).showQuestUnavailableAlert();
onClose();
}, items);
let obj = questContentPosition(videoSessionId[21]);
const nonNullableQuest = obj.useNonNullableQuest(questContentPosition.questId, callback);
const items1 = [onClose, nonNullableQuest, videoSessionId, questContentPosition, initialStep, sourceQuestContent];
const memo = sourceQuestContent.useMemo(() => {
let tmp = null;
if (null != nonNullableQuest) {
let obj = {};
obj = { fullscreen: true, headerLeft: null, render: null };
obj[1] = function headerLeft() {
return null;
};
obj[2] = function render() {
obj = { value: obj, children: null };
obj = { quest: closure_5, videoSessionId: closure_2 };
obj = { children: null };
const obj1 = { overrideVisibility: true, questContent: null, questOrQuests: null, questContentPosition: null, sourceQuestContent: null, children: null };
obj1[1] = outer1_0(outer1_2[23]).QuestContent.VIDEO_MODAL_MOBILE;
obj1[2] = closure_5;
obj1[3] = closure_0;
obj1[4] = closure_4;
obj1[5] = function children() {
return outer1_7(outer1_14, { initialStep: _slicedToArray, onClose: closure_1, sourceQuestContent: closure_4 });
};
obj[0] = outer1_7(outer1_0(outer1_2[22]).BillableAdPlacementImpressionTrackerNative, obj1);
obj[1] = outer1_7(outer1_0(outer1_2[10]).QuestDockGestureContextProvider, obj);
return outer1_7(outer1_1(outer1_2[7]).Provider, obj);
};
obj[outer1_15] = obj;
tmp = obj;
}
return tmp;
}, items1);
const layoutEffect = sourceQuestContent.useLayoutEffect(() => {
questContentPosition(videoSessionId[8]).applyOrientationLock("PORTRAIT");
return questContentPosition(videoSessionId[8]).restoreDefaultOrientationLock;
}, []);
let tmp7 = null;
if (null != nonNullableQuest) {
tmp7 = null;
if (null != memo) {
obj = { hideTitle: true, initialRouteName: null, screens: null };
obj[1] = watch_mobile_video_quest;
obj[2] = memo;
tmp7 = callback(questContentPosition(videoSessionId[24]).Modal, obj);
}
}
return tmp7;
});
let result = require("get ActivityIndicator").fileFinishedImporting("modules/quests/native/VideoQuestModal/VideoQuestModal.tsx");
export default memoResult;
export const VideoQuestModalSteps = obj;