decord/source/modules/quests/native/QuestHomeBounties.tsx
2026-07-27 11:26:19 +00:00

464 lines
19 KiB
TypeScript

// Module ID: 14027
// Function ID: 107276
// Name: EmptyState
// Dependencies: [57, 31, 27, 5931, 4977, 1345, 33, 689, 14028, 4131, 10904, 1212, 6727, 4127, 14025, 1334, 8379, 686, 14029, 4100, 5949, 5959, 4980, 13968, 5582, 9406, 9407, 9408, 5960, 14041, 10908, 6619, 14042, 10428, 566, 14045, 2]
// Module 14027 (EmptyState)
import _slicedToArray from "_slicedToArray";
import importAllResult from "useModalDismissGuardRefreshControl";
import { View } from "AdUserActionType";
import closure_6 from "_createForOfIteratorHelperLoose";
import { BountyCarouselEmptyStateReason as closure_7 } from "QuestsExperimentLocations";
import { ContentDismissActionType } from "ContentDismissActionType";
import jsxProd from "_createForOfIteratorHelperLoose";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
let closure_10;
let closure_9;
const require = arg1;
function EmptyState(reason) {
reason = reason.reason;
const tmp = callback4();
let obj = require(10904) /* useTrackQuestEventWithImpression */;
const bountyCarouselEmptyStateAnalytics = obj.useBountyCarouselEmptyStateAnalytics(reason);
if (reason === constants.COMPLETED) {
const intl2 = require(1212) /* getSystemLocale */.intl;
let stringResult = intl2.string(require(1212) /* getSystemLocale */.t.O2hRaZ);
} else {
const intl = require(1212) /* getSystemLocale */.intl;
stringResult = intl.string(require(1212) /* getSystemLocale */.t.TKuW8z);
}
if (reason === constants.COMPLETED) {
let ReqPds = require(1212) /* getSystemLocale */.t["D/790X"];
} else {
ReqPds = require(1212) /* getSystemLocale */.t.ReqPds;
}
obj = { style: tmp.emptyState };
const items = [callback2(require(6727) /* AccountAgeTier10LargeBadge */.BountiesPosterIllocon, { size: 32 }), ];
obj = { style: tmp.emptyStateText };
const obj1 = { variant: "text-sm/semibold", color: "text-default", children: stringResult };
const items1 = [callback2(require(4127) /* Text */.Text, obj1), ];
const obj2 = { variant: "text-xs/medium", color: "text-muted" };
const intl3 = require(1212) /* getSystemLocale */.intl;
obj2.children = intl3.format(ReqPds, {
onClickLearnMore() {
outer1_1(outer1_2[14])();
}
});
items1[1] = callback2(require(4127) /* Text */.Text, obj2);
obj.children = items1;
items[1] = callback3(View, obj);
obj.children = items;
return callback3(View, obj);
}
function getSnapIndex(nativeEvent) {
return Math.round(nativeEvent.nativeEvent.contentOffset.x / closure_13);
}
function ItemSeparator() {
const style = { width: PX_16 };
return callback2(View, { style });
}
function keyExtractor(id) {
return id.id;
}
function QuestHomeBountiesCarousel(bounties) {
let obtainableOrbRewards;
let orbShopProducts;
let showOrbShopPlaceholderCarousel;
bounties = bounties.bounties;
({ orbShopProducts, obtainableOrbRewards, showOrbShopPlaceholderCarousel } = bounties);
if (showOrbShopPlaceholderCarousel === undefined) {
showOrbShopPlaceholderCarousel = false;
}
let ref;
let first;
let callback;
let first1;
let closure_5;
let first2;
let closure_7;
let closure_8;
let callback2;
let closure_10;
callback = undefined;
let closure_12;
let closure_13;
let callback4;
let closure_15;
let callback6;
let callback7;
let isInView;
let tmp = callback4();
let tmp2 = obtainableOrbRewards > 0;
if (tmp2) {
tmp2 = orbShopProducts.length >= bounties(first[18]).MIN_PRODUCTS_FOR_ORB_SHOP_CAROUSEL || showOrbShopPlaceholderCarousel;
const tmp5 = orbShopProducts.length >= bounties(first[18]).MIN_PRODUCTS_FOR_ORB_SHOP_CAROUSEL || showOrbShopPlaceholderCarousel;
}
let tmp6 = null;
ref = first1.useRef(null);
let tmp8 = callback(first1.useState(0), 2);
first = tmp8[0];
callback = tmp8[1];
const tmp10 = callback(first1.useState(0), 2);
first1 = tmp10[0];
closure_5 = tmp10[1];
const tmp12 = callback(first1.useState(false), 2);
first2 = tmp12[0];
closure_7 = tmp12[1];
closure_8 = first1.useRef(null);
callback2 = first1.useRef(false);
closure_10 = first1.useRef({ parent: { scrollX: 0 }, children: {}, axis: "horizontal" });
callback = first1.useCallback((arg0) => {
if (null != arg0) {
const _Object2 = Object;
if (Object.hasOwn(closure_10.current.children, arg0)) {
if (!tmp8) {
obj2.calculateVisibility();
}
tmp8 = null == closure_10.current.children[arg0] || null == closure_10.current.children[arg0].calculateVisibility;
}
} else {
const _Object = Object;
const values = Object.values(closure_10.current.children);
for (let num = 0; num < values.length; num = num + 1) {
let obj = values[num];
let tmp3 = null == obj || null == obj.calculateVisibility;
if (!tmp3) {
let calculateVisibilityResult1 = obj.calculateVisibility();
}
}
}
}, []);
const items = [callback];
const items1 = [bounties.length];
const callback1 = first1.useCallback((nativeEvent) => {
callback(nativeEvent.nativeEvent.layout.width);
closure_10.current.parent.layout = nativeEvent.nativeEvent.layout;
callback();
}, items);
const items2 = [first];
const memo = first1.useMemo(() => {
const array = new Array(bounties.length);
return array.fill(0).map((arg0, arg1) => arg1 * closure_13);
}, items1);
callback2 = first1.useCallback(() => {
let obj = {};
obj = { width: Math.max(0, first - bounties(first[8]).CARD_WIDTH - callback) };
obj.style = obj;
return callback4(closure_5, obj);
}, items2);
closure_12 = first1.useRef(first1);
closure_13 = first1.useRef(null);
const items3 = [callback];
const callback3 = first1.useCallback((nativeEvent) => {
const tmp = callback6(nativeEvent);
if (tmp !== ref.current) {
ref.current = tmp;
const _Date = Date;
const timestamp = Date.now();
let tmp3 = null == ref2.current;
if (!tmp3) {
tmp3 = timestamp - ref2.current >= 50;
}
if (tmp3) {
ref2.current = timestamp;
const result = bounties(first[19]).triggerHapticFeedback(bounties(first[19]).HapticFeedbackTypes.IMPACT_LIGHT);
const obj = bounties(first[19]);
}
}
closure_10.current.parent.scrollX = nativeEvent.nativeEvent.contentOffset.x;
callback();
}, items3);
callback4 = first1.useRef(false);
closure_15 = first1.useRef(null);
const items4 = [first1];
callback4 = first1.useCallback(() => {
closure_14.current = false;
if (null != closure_15.current) {
const _clearTimeout = clearTimeout;
clearTimeout(closure_15.current);
closure_15.current = null;
}
}, []);
const callback5 = first1.useCallback((arg0) => {
const tmp = callback6(arg0);
closure_14.current = false;
if (tmp !== first1) {
let result = {};
const BountyScrollingType = bounties(first[21]).BountyScrollingType;
result.scrollingType = tmp2 ? BountyScrollingType.AUTO : BountyScrollingType.MANUAL;
if (tmp > first1) {
let LEFT = bounties(first[21]).HorizontalScrollingDirection.RIGHT;
} else {
LEFT = bounties(first[21]).HorizontalScrollingDirection.LEFT;
}
result.scrollingDirection = LEFT;
result.carouselPosition = tmp;
result.questContent = bounties(first[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL;
result = bounties(first[20]).trackBountyCarouselScroll(result);
callback2(tmp);
const obj2 = bounties(first[20]);
}
}, items4);
callback6 = first1.useCallback((arg0) => {
let closure_0 = arg0;
if (null != closure_15.current) {
const _clearTimeout = clearTimeout;
clearTimeout(closure_15.current);
closure_15.current = null;
}
closure_15.current = setTimeout(() => {
outer1_14.current = true;
const current = outer1_1.current;
if (null != current) {
const obj = { offset: closure_0 * closure_13, animated: true };
current.scrollToOffset(obj);
}
outer1_15.current = null;
}, 350);
}, []);
const effect = first1.useEffect(() => () => {
if (null != outer1_15.current) {
const _clearTimeout = clearTimeout;
clearTimeout(outer1_15.current);
outer1_15.current = null;
}
}, []);
const items5 = [bounties, first1, callback6];
const effect1 = first1.useEffect(() => {
function handleModalClose(key) {
if (key.key === bounties(first[23]).BOUNTIES_MODAL_KEY) {
outer1_7(false);
const current = outer1_8.current;
outer1_8.current = null;
if (null != current) {
let isBountyCompletedResult = first2.isBountyCompleted(current);
if (isBountyCompletedResult) {
isBountyCompletedResult = !outer1_9.current;
}
outer1_9.current = false;
const findIndexResult = handleModalClose.findIndex((id) => id.id === current);
let closure_1 = findIndexResult;
if (-1 !== findIndexResult) {
const findIndexResult1 = handleModalClose.findIndex((id) => {
let tmp = arg1 > outer2_4;
if (tmp) {
tmp = arg1 > closure_1;
}
if (tmp) {
tmp = !first2.isBountyCompleted(id.id);
}
return tmp;
});
if (isBountyCompletedResult) {
isBountyCompletedResult = -1 !== findIndexResult1;
}
if (isBountyCompletedResult) {
isBountyCompletedResult = findIndexResult1 <= outer1_4 + 3;
}
if (isBountyCompletedResult) {
bounties(first[24]).runAfterInteractions(() => {
outer2_16(findIndexResult1);
});
const obj = bounties(first[24]);
}
}
}
}
}
const subscription = ref(first[17]).subscribe("MODAL_POP", handleModalClose);
return () => {
ref(first[17]).unsubscribe("MODAL_POP", handleModalClose);
};
}, items5);
callback7 = first1.useCallback((bountyId, questContentPosition) => {
let obj = bounties(first[25]);
if (obj.shouldMigrateToAdAnalyticsInterface(bounties(first[25]).AdAnalyticsInterfaceExperimentStep.STEP_2_CLICKED_INTERNAL, "quest_home_bounties")) {
let tmpResult = tmp(tmp2[26]);
obj = { type: tmp(tmp2[27]).AdUserActionType.CLICK_INTERNAL, adCreativeType: tmp(tmp2[28]).AdCreativeType.BOUNTY, adCreativeId: bountyId.id, questContentCTA: tmp(tmp2[21]).QuestContentCTA.START_BOUNTY, surfaceId: tmp(tmp2[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL, sourceQuestContent: tmp(tmp2[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL, questContentPosition };
tmpResult.captureAdUserAction(obj);
} else {
tmpResult = tmp(tmp2[20]);
obj = { adContentId: bountyId.id, adCreativeType: tmp(tmp2[28]).AdCreativeType.BOUNTY, questContent: tmp(tmp2[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL, questContentCTA: tmp(tmp2[21]).QuestContentCTA.START_BOUNTY, sourceQuestContent: tmp(tmp2[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL, questContentPosition };
const result = tmpResult.trackAdContentClicked(obj);
}
closure_8.current = bountyId.id;
closure_9.current = first2.isBountyCompleted(bountyId.id);
callback3(true);
const obj6 = ref(first[23]);
obj6.showModal({ bountyId: bountyId.id, sourceQuestContent: bounties(first[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL });
}, []);
const tmp25 = ref(first[29])();
isInView = tmp25.isInView;
const items6 = [first1, callback7, isInView, first2];
const items7 = [bounties, callback];
const callback8 = first1.useCallback((item) => {
item = item.item;
const index = item.index;
const obj = {
adContentId: item.id,
adCreativeType: bounties(first[28]).AdCreativeType.BOUNTY,
questContent: bounties(first[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL,
questContentPosition: index,
trackGuildAndChannelMetadata: false,
visibilityRef: closure_10,
sourceQuestContent: bounties(first[22]).QuestContent.QUEST_HOME_MOBILE_CAROUSEL,
overrideVisibility: !!isInView,
children() {
return callback(ref(first[8]), { bounty: item, index, isActive: index === outer1_4, isModalVisible: outer1_6, onPress: outer1_17 });
}
};
return closure_9(bounties(first[30]).QuestContentImpressionTrackerNative, obj, item.id);
}, items6);
const items8 = [isInView, first1, first2];
const callback9 = first1.useCallback((arg0) => {
let closure_0 = arg0;
let obj = {};
let merged = Object.assign(arg0);
obj["onLayout"] = function onLayout(nativeEvent) {
if (null != closure_0[closure_0.index]) {
const obj = {};
const merged = Object.assign(outer1_10.current.children[tmp.id]);
obj["layout"] = nativeEvent.nativeEvent.layout;
outer1_10.current.children[tmp.id] = obj;
outer1_11(tmp.id);
}
closure_0.onLayout(nativeEvent);
};
return callback4(closure_5, obj);
}, items7);
let obj = { style: tmp.container };
obj = { ref: tmp25.containerRef, onLayout: callback1 };
const memo1 = first1.useMemo(() => ({ isInView, activeIndex: first1, isModalVisible: first2 }), items8);
obj = { ref, horizontal: true, data: bounties, renderItem: callback8, keyExtractor: isInView, contentContainerStyle: tmp.listContentContainer, snapToOffsets: memo, snapToEnd: false, decelerationRate: "fast", showsHorizontalScrollIndicator: false, ItemSeparatorComponent: callback7, ListFooterComponent: callback2, onScroll: callback3, onScrollBeginDrag: callback4, onMomentumScrollEnd: callback5, scrollEventThrottle: 16, extraData: memo1, CellRendererComponent: callback9 };
obj.children = callback2(bounties(first[31]).FlashList, obj);
const items9 = [callback2(closure_5, obj), ];
if (tmp2) {
const obj1 = { orbShopProducts, obtainableOrbRewards, showOrbShopPlaceholderCarousel };
tmp6 = callback2(ref(first[32]), obj1);
}
items9[1] = tmp6;
obj.children = items9;
return closure_10(closure_5, obj);
}
({ jsx: closure_9, jsxs: closure_10 } = jsxProd);
let PX_16 = require("_createForOfIteratorHelperLoose").space.PX_16;
PX_16 = require("_createForOfIteratorHelperLoose").space.PX_16;
let closure_13 = require("CARD_WIDTH").CARD_WIDTH + PX_16;
let closure_14 = _createForOfIteratorHelperLoose.createStyles(() => {
let obj = {};
obj = { marginBottom: importDefault(689).space.PX_48 };
obj.container = obj;
obj = { paddingLeft: PX_16 };
obj.listContentContainer = obj;
const obj1 = { flexDirection: "row", alignItems: "center", gap: importDefault(689).space.PX_12, borderWidth: 1, borderColor: importDefault(689).colors.BORDER_MUTED, backgroundColor: importDefault(689).colors.BACKGROUND_SURFACE_HIGH, borderRadius: importDefault(689).radii.lg, overflow: "hidden", paddingHorizontal: importDefault(689).space.PX_16, paddingVertical: 14, marginHorizontal: importDefault(689).space.PX_16 };
obj.emptyState = obj1;
obj.emptyStateText = { flex: 1, gap: 2 };
return obj;
});
const memoResult = importAllResult.memo(function QuestHomeBounties(arg0) {
let obtainableOrbRewards;
let orbShopProducts;
let showOrbShopPlaceholderCarousel;
let verticalScrollEnabled;
({ verticalScrollEnabled, orbShopProducts, obtainableOrbRewards, showOrbShopPlaceholderCarousel } = arg0);
if (showOrbShopPlaceholderCarousel === undefined) {
showOrbShopPlaceholderCarousel = false;
}
let obj = require(10428) /* _createForOfIteratorHelperLoose */;
const questHomeBounties = obj.useQuestHomeBounties().questHomeBounties;
const tmp = callback4();
(function useBountiesNux(arg0) {
if (arg0) {
const items = [outer1_0(outer1_2[15]).DismissibleContent.BOUNTIES_NUX_PROMO_SHEET];
let items1 = items;
} else {
items1 = [];
}
const tmp3 = outer1_3(outer1_0(outer1_2[16]).useSelectedDismissibleContent(items1), 2);
const first = tmp3[0];
let closure_1 = tmp5;
let closure_2 = outer1_4.useRef(false);
const items2 = [first];
const effect = outer1_4.useEffect(() => {
let current = first !== outer2_0(outer2_2[15]).DismissibleContent.BOUNTIES_NUX_PROMO_SHEET;
if (!current) {
current = ref.current;
}
if (!current) {
ref.current = true;
outer2_1(outer2_2[14])();
}
}, items2);
const items3 = [first, tmp3[1]];
const effect1 = outer1_4.useEffect(() => {
function handleHide(key) {
if (key.key === outer3_0(outer3_2[14]).PROMO_SHEET_KEY) {
outer1_1(outer3_8.USER_DISMISS);
}
}
if (handleHide === outer2_0(outer2_2[15]).DismissibleContent.BOUNTIES_NUX_PROMO_SHEET) {
const subscription = outer2_1(outer2_2[17]).subscribe("HIDE_ACTION_SHEET", handleHide);
return () => {
outer3_1(outer3_2[17]).unsubscribe("HIDE_ACTION_SHEET", handleHide);
};
}
}, items3);
})(questHomeBounties.length > 0);
let tmp3 = 0 === questHomeBounties.length;
let obj1 = require(566) /* initialize */;
let items = [closure_6];
const stateFromStores = obj1.useStateFromStores(items, () => outer1_6.areAllBountiesCompleted());
let tmp5 = !tmp3;
if (!tmp3) {
tmp5 = !stateFromStores;
}
if (tmp5) {
tmp5 = obtainableOrbRewards > 0;
}
if (tmp5) {
tmp5 = orbShopProducts.length >= require(14029) /* _createForOfIteratorHelperLoose */.MIN_PRODUCTS_FOR_ORB_SHOP_CAROUSEL || showOrbShopPlaceholderCarousel;
const tmp8 = orbShopProducts.length >= require(14029) /* _createForOfIteratorHelperLoose */.MIN_PRODUCTS_FOR_ORB_SHOP_CAROUSEL || showOrbShopPlaceholderCarousel;
}
if (!tmp3) {
if (!stateFromStores) {
if (verticalScrollEnabled) {
obj = { style: tmp.container };
obj = { bounties: questHomeBounties };
let items1 = [callback2(importDefault(14045), obj), ];
let tmp17 = null;
if (tmp5) {
obj1 = { orbShopProducts, obtainableOrbRewards, showOrbShopPlaceholderCarousel };
tmp17 = callback2(importDefault(14042), obj1);
}
items1[1] = tmp17;
obj.children = items1;
let tmp12Result = closure_10(View, obj);
const tmp12 = closure_10;
const tmp13 = View;
} else {
const obj2 = { bounties: questHomeBounties, orbShopProducts, obtainableOrbRewards, showOrbShopPlaceholderCarousel };
tmp12Result = callback2(QuestHomeBountiesCarousel, obj2);
}
return tmp12Result;
}
}
const obj3 = { style: tmp.container };
if (verticalScrollEnabled) {
const obj4 = { bounties: questHomeBounties };
if (!tmp3) {
tmp3 = stateFromStores;
}
obj4.isEmptyOrCompleted = tmp3;
let tmp23Result = tmp23(importDefault(14045), obj4);
const tmp28 = importDefault(14045);
} else {
const obj5 = { reason: tmp3 ? closure_7.EMPTY : closure_7.COMPLETED };
tmp23Result = tmp23(EmptyState, obj5);
}
obj3.children = tmp23Result;
callback2(View, obj3);
});
let result = require("get ActivityIndicator").fileFinishedImporting("modules/quests/native/QuestHomeBounties.tsx");
export default memoResult;