decord/source/modules/quests/native/QuestDock/QuestDockCreativeContext.tsx
github-actions 8d58bae3b2 chore: update source for alpha 347.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4907.js (118.4 MB)
2026-09-18 06:58:00 +00:00

101 lines
3.8 KiB
TypeScript

// Module ID: 15308
// Function ID: 15309
// Name: QuestDockCreativeContext
// Dependencies: [19, 21, 5621, 2]
// Exports: QuestDockBountyProvider, QuestDockQuestProvider, getCreativeAnalyticsParams, getDeliveredAdCreativeId, getDeliveredQuest, useBountyCreative, useQuestCreative, useQuestDockBounty, useQuestDockCreative, useQuestDockQuest
// Module 15308 (QuestDockCreativeContext)
import AdCreativeType from "AdCreativeType" /* 5621 */;
import noop from "module_19" /* 19 */;
require = fn;
const jsx = fn(21).jsx;
const redux = noop.createContext(null);
const size = fn(2);
const result = size.fileFinishedImporting("modules/quests/native/QuestDock/QuestDockCreativeContext.tsx");
export const getCreativeAnalyticsParams = function getCreativeAnalyticsParams(creative) {
const type = creative.type;
if (AdCreativeType.AdCreativeType.QUEST === type) {
const obj2 = { adCreativeType: tmp(5621).AdCreativeType.QUEST, adCreativeId: creative.quest.id };
return obj2;
} else if (tmp(5621).AdCreativeType.BOUNTY === type) {
const obj = { adCreativeType: tmp(5621).AdCreativeType.BOUNTY, adCreativeId: creative.bounty.id };
return obj;
}
};
export const getDeliveredQuest = function getDeliveredQuest(type) {
let quest = null;
if (type.type === AdCreativeType.AdCreativeType.QUEST) {
quest = type.quest;
}
return quest;
};
export const getDeliveredAdCreativeId = function getDeliveredAdCreativeId(type) {
type = type.type;
if (AdCreativeType.AdCreativeType.QUEST === type) {
return type.quest.id;
} else if (tmp(5621).AdCreativeType.BOUNTY === type) {
return type.bounty.id;
} else if (tmp(5621).AdCreativeType.NO_FILL === type) {
return null;
}
};
export const QuestDockQuestProvider = function QuestDockQuestProvider(children) {
const quest = children.quest;
const items = [quest];
return <redux.Provider value={noop.useMemo(() => ({ type: AdCreativeType.AdCreativeType.QUEST, quest }), items)}>{arg0.children}</redux.Provider>;
};
export const QuestDockBountyProvider = function QuestDockBountyProvider(bounty) {
bounty = bounty.bounty;
const items = [bounty];
return <redux.Provider value={noop.useMemo(() => ({ type: AdCreativeType.AdCreativeType.BOUNTY, bounty }), items)}>{arg0.children}</redux.Provider>;
};
export const useQuestDockQuest = function useQuestDockQuest() {
const context = noop.useContext(closure_4);
let type;
if (context != null) {
type = context.type;
}
if (type !== AdCreativeType.AdCreativeType.QUEST) {
const _Error = Error;
const error = new Error("useQuestDockQuest requires a QuestDockQuestProvider ancestor");
throw error;
} else {
return context.quest;
}
};
export const useQuestCreative = function useQuestCreative(quest) {
closure_0 = quest;
const items = [quest];
return noop.useMemo(() => ({ type: AdCreativeType.AdCreativeType.QUEST, quest }), items);
};
export const useQuestDockBounty = function useQuestDockBounty() {
const context = noop.useContext(closure_4);
let type;
if (context != null) {
type = context.type;
}
if (type !== AdCreativeType.AdCreativeType.BOUNTY) {
const _Error = Error;
const error = new Error("useQuestDockBounty requires a QuestDockBountyProvider ancestor");
throw error;
} else {
return context.bounty;
}
};
export const useBountyCreative = function useBountyCreative(questDockBounty) {
closure_0 = questDockBounty;
const items = [questDockBounty];
return noop.useMemo(() => ({ type: AdCreativeType.AdCreativeType.BOUNTY, bounty }), items);
};
export const useQuestDockCreative = function useQuestDockCreative() {
const context = noop.useContext(closure_4);
if (null == context) {
const _Error = Error;
const error = new Error("useQuestDockCreative requires a QuestDockBountyProvider or QuestDockQuestProvider ancestor");
throw error;
} else {
return context;
}
};