decord/source/modules/activities/utils/useActivityShelfItem.tsx

451 lines
15 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 11328
// Function ID: 11329
2026-07-29 08:29:29 +00:00
// Name: useActivityAction
2026-08-05 07:35:12 +00:00
// Dependencies: [5, 1371, 4280, 676, 10494, 500, 10615, 11329, 11330, 1906, 7482, 10600, 10599, 5601, 3873, 5595, 10481, 10482, 4265, 10854, 10507, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, getStaffReleasePhase
2026-07-20 16:05:17 +00:00
2026-08-05 07:35:12 +00:00
// Module 11328 (useActivityAction)
2026-07-23 10:11:24 +00:00
import set from "set";
2026-07-29 08:29:29 +00:00
import participantFromServer from "participantFromServer";
2026-07-23 10:11:24 +00:00
import { STAFF_RELEASE_PHASES } from "items3";
import { ApplicationFlags } from "ME";
const require = arg1;
2026-07-20 16:05:17 +00:00
function useActivityAction(applicationId) {
let context;
let fetchesApplication;
({ context, fetchesApplication } = applicationId);
if (fetchesApplication === undefined) {
fetchesApplication = true;
}
2026-07-23 10:11:24 +00:00
let getOrFetchApplication;
2026-07-20 16:05:17 +00:00
const START = obj.START;
let channel;
if ("channel" === context.type) {
channel = context.channel;
}
2026-08-05 07:35:12 +00:00
const tmp4 = importDefault(10600)();
const tmp5 = importDefault(10599)({ fetchesApplication });
obj = getOrFetchApplication(5601);
2026-07-29 08:29:29 +00:00
getOrFetchApplication = obj.useGetOrFetchApplication(applicationId.applicationId, fetchesApplication);
2026-08-05 07:35:12 +00:00
importDefault(11330)(channel);
2026-07-20 16:05:17 +00:00
if (null == getOrFetchApplication) {
return START;
} else {
2026-08-05 07:35:12 +00:00
const getEmbeddedActivityLocationChannelId = getOrFetchApplication(3873).getEmbeddedActivityLocationChannelId;
2026-07-29 08:29:29 +00:00
if (tmp4 != null) {
const _location = tmp4.location;
2026-07-20 16:05:17 +00:00
}
if (null != channel) {
2026-07-29 08:29:29 +00:00
if (tmp11 === channel.id) {
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (tmp5 != null) {
id = tmp5.id;
2026-07-20 16:05:17 +00:00
}
if (id === getOrFetchApplication.id) {
2026-07-29 08:29:29 +00:00
let JOIN = tmp.LEAVE;
2026-07-20 16:05:17 +00:00
}
return JOIN;
}
}
JOIN = START;
2026-07-29 08:29:29 +00:00
if (null != tmp9) {
JOIN = tmp.JOIN;
2026-07-20 16:05:17 +00:00
}
2026-08-05 07:35:12 +00:00
const tmp6Result = getOrFetchApplication(3873);
2026-07-20 16:05:17 +00:00
}
}
function useOnActivityItemSelected(arg0) {
2026-07-23 10:11:24 +00:00
let ApplicationFlags;
let STAFF_RELEASE_PHASES;
2026-07-20 16:05:17 +00:00
let application;
2026-07-29 08:29:29 +00:00
let closure_10;
2026-07-23 10:11:24 +00:00
let closure_11;
let set;
2026-07-29 08:29:29 +00:00
let participantFromServer;
2026-07-20 16:05:17 +00:00
let context;
2026-07-23 10:11:24 +00:00
let dependencyMap;
2026-07-20 16:05:17 +00:00
let fetchesApplication;
2026-07-23 10:11:24 +00:00
let obj;
let require;
let useActivityAction;
let useOnActivityItemSelected;
({ application, botUserIdForAppDM: require, context } = arg0);
2026-07-29 08:29:29 +00:00
({ locationObject: dependencyMap, embeddedActivitiesManager: set, onActivityItemSelectedProp: participantFromServer, launchingComponentId: STAFF_RELEASE_PHASES, commandOrigin: ApplicationFlags, sectionName: obj, source: useActivityAction, fetchesApplication } = arg0);
2026-07-20 16:05:17 +00:00
if (fetchesApplication === undefined) {
fetchesApplication = true;
}
2026-07-29 08:29:29 +00:00
({ customId: useOnActivityItemSelected, referrerId: closure_10, onConfirmActivityLaunchChecksAlertOpen: closure_11 } = arg0);
2026-07-20 16:05:17 +00:00
let str;
let analyticsLocations;
let closure_14;
let closure_15;
2026-07-29 08:29:29 +00:00
str = undefined;
if (application != null) {
str = application.id;
}
if (str == null) {
str = "";
}
let tmp = useActivityAction({ context, applicationId: str, fetchesApplication });
2026-08-05 07:35:12 +00:00
analyticsLocations = context(5595)().analyticsLocations;
closure_14 = context(10600)();
obj = require(10481) /* canLaunchFrame */;
2026-07-29 08:29:29 +00:00
closure_15 = obj.canLaunchFrame(application);
2026-07-20 16:05:17 +00:00
if (null == application) {
return () => {
2026-07-29 08:29:29 +00:00
if (participantFromServer != null) {
tmp({ applicationId: "" });
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
} else if (obj.START === tmp) {
return callback(function*() {
if (c5 === 2) {
c5 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let closure_1 = tmp3;
let closure_0 = tmp5;
closure_0 = undefined;
if (outer1_15) {
let c3 = 1;
let obj8 = outer1_1(outer1_2[17]);
const obj1 = { applicationId: null };
obj1[0] = outer1_12;
c4 = 2;
c5 = 1;
const obj2 = { value: null, done: false };
obj2[0] = obj8.launchFrame(obj1);
return obj2;
} else {
let id;
if ("channel" === outer1_1.type) {
id = outer1_1.channel.id;
}
closure_0 = id;
if (null != outer1_0) {
c3 = 2;
let obj5 = outer1_1(outer1_2[18]);
const obj3 = { recipientIds: null, navigateToChannel: true };
obj3[0] = tmp18;
c4 = 5;
c5 = 1;
const obj4 = { value: null, done: false };
obj4[0] = obj5.openPrivateChannel(obj3);
return obj4;
} else {
obj5 = { targetApplicationId: null, locationObject: null, channelId: null, analyticsLocations: null, componentId: null, commandOrigin: null, sectionName: null, source: null, customId: null, referrerId: null, onConfirmActivityLaunchChecksAlertOpen: null };
obj5[0] = closure_12;
obj5[1] = closure_2;
obj5[2] = closure_0;
obj5[3] = closure_13;
obj5[4] = c5;
obj5[5] = closure_6;
obj5[6] = closure_7;
obj5[7] = closure_8;
obj5[8] = closure_9;
obj5[9] = closure_10;
obj5[10] = closure_11;
outer1_1(outer1_2[19])(obj5).then((arg0) => {
let tmp = arg0;
if (arg0) {
let tmp2Result;
if (c4 != null) {
const obj = { applicationId: null };
obj[0] = closure_12;
tmp2Result = tmp2(obj);
}
tmp = tmp2Result;
}
return tmp;
});
c4 = 4;
c5 = 1;
const promise = outer1_1(outer1_2[19])(obj5);
}
}
}
} else if (1 === tmp8) {
c3 = 0;
c5 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
} else {
if (2 === tmp8) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c3 = 0;
c5 = 3;
const obj6 = { value: null, done: true };
obj6[0] = arg1;
return obj6;
} else {
if (c4 != null) {
const obj7 = { applicationId: null };
obj7[0] = closure_12;
tmp12(obj7);
}
c3 = 0;
}
} else if (3 === tmp8) {
c3 = 0;
c5 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
} else if (4 === tmp8) {
if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 3;
obj8 = { value: null, done: true };
obj8[0] = arg1;
return obj8;
}
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 !== 2) {
closure_0 = arg1;
c3 = 0;
}
c5 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
c3 = 0;
c5 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} catch (tmp40) {
closure_2 = tmp40;
if (tmp4 === c3) {
c5 = tmp2;
throw tmp40;
} else if (tmp === tmp42) {
c4 = tmp;
} else {
c4 = tmp2;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
}
});
} else if (tmp2.JOIN === tmp) {
return callback(function*() {
if (c0 === 2) {
c0 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c0 = 2;
if (0 === v0) {
if (arg0 === 1) {
c0 = 3;
throw arg1;
} else if (arg0 === 2) {
c0 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else if (!outer1_4.isLaunchingActivity()) {
const obj1 = { applicationId: null, activityChannelId: null, locationObject: null, analyticsLocations: null, componentId: null, sectionName: null, source: null, customId: null, referrerId: null };
obj1[0] = outer1_12;
let id;
if ("channel" === v0.type) {
id = v0.channel.id;
}
obj1[1] = id;
obj1[2] = outer1_2;
obj1[3] = outer1_13;
obj1[4] = outer1_5;
obj1[5] = outer1_7;
obj1[6] = outer1_8;
obj1[7] = outer1_9;
obj1[8] = outer1_10;
const tmp7 = v0(outer1_2[20]);
v0 = 1;
c0 = 1;
const obj2 = { value: null, done: false };
obj2[0] = v0(outer1_2[20])(obj1).then((arg0) => {
let tmp = arg0;
if (arg0) {
let tmp2Result;
if (participantFromServer != null) {
const obj = { applicationId: null };
obj[0] = closure_12;
tmp2Result = tmp2(obj);
}
tmp = tmp2Result;
}
return tmp;
});
return obj2;
}
} else if (arg0 === 1) {
c0 = 3;
throw arg1;
} else if (arg0 === 2) {
c0 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
c0 = 3;
2026-08-05 07:35:12 +00:00
return { value: "T", done: null };
2026-07-29 08:29:29 +00:00
} catch (tmp17) {
c0 = tmp;
throw tmp17;
}
}
});
} else {
return tmp2.LEAVE === tmp ? (() => {
if (!outer1_4.isLaunchingActivity()) {
if (null != closure_14) {
let obj = { location: null, applicationId: null };
obj[0] = tmp.location;
obj[1] = str;
set.leaveActivity(obj);
}
if (participantFromServer != null) {
obj = { applicationId: null };
obj[0] = str;
tmp6(obj);
}
}
}) : undefined;
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
let obj = { START: 0, [0]: "START", JOIN: 1, [1]: "JOIN", LEAVE: 2, [2]: "LEAVE" };
const result = require("items3").fileFinishedImporting("modules/activities/utils/useActivityShelfItem.tsx");
2026-07-20 16:05:17 +00:00
export default function useActivityShelfItem(backgroundResolution) {
let activityItem;
let assetNames;
let commandOrigin;
let context;
let embeddedActivitiesManager;
let launchingComponentId;
let locationObject;
let onActivityItemSelected;
let source;
({ activityItem, context, assetNames } = backgroundResolution);
({ locationObject, onActivityItemSelected, embeddedActivitiesManager } = backgroundResolution);
if (assetNames === undefined) {
2026-07-23 10:11:24 +00:00
assetNames = ["embedded_cover"];
2026-07-20 16:05:17 +00:00
}
let num = backgroundResolution.backgroundResolution;
if (num === undefined) {
num = 250;
}
2026-07-23 10:11:24 +00:00
let application;
application = activityItem.application;
2026-07-20 16:05:17 +00:00
const activity = activityItem.activity;
({ launchingComponentId, commandOrigin, source } = backgroundResolution);
2026-07-29 08:29:29 +00:00
let obj = application(500);
2026-08-05 07:35:12 +00:00
const tmp5 = activity.client_platform_config[importDefault(10494)(undefined, obj.getOS(obj))];
2026-07-20 16:05:17 +00:00
const timestamp = Date.now();
2026-07-29 08:29:29 +00:00
let tmp7 = null != tmp5.label_until;
if (tmp7) {
2026-07-20 16:05:17 +00:00
const _Date = Date;
2026-07-29 08:29:29 +00:00
tmp7 = timestamp < Date.parse(tmp5.label_until);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp7) {
tmp7 = null != tmp5.label_from;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp7) {
2026-07-20 16:05:17 +00:00
const _Date2 = Date;
2026-07-29 08:29:29 +00:00
tmp7 = timestamp > Date.parse(tmp5.label_from);
2026-07-20 16:05:17 +00:00
}
obj = { applicationId: application.id, size: num, names: assetNames, format: "webp" };
2026-07-29 08:29:29 +00:00
let tmp9 = null;
2026-08-05 07:35:12 +00:00
const tmp3 = importDefault(10494);
2026-07-20 16:05:17 +00:00
if (null != activity.activity_preview_video_asset_id) {
2026-08-05 07:35:12 +00:00
tmp9 = tmp(11329)(application.id, activity.activity_preview_video_asset_id);
2026-07-20 16:05:17 +00:00
}
let channel;
2026-08-05 07:35:12 +00:00
let tmpResult = tmp(11330);
2026-07-20 16:05:17 +00:00
if ("channel" === context.type) {
channel = context.channel;
}
2026-08-05 07:35:12 +00:00
const tmp8 = importDefault(10615)(obj);
2026-07-20 16:05:17 +00:00
obj = { context, applicationId: application.id };
2026-07-29 08:29:29 +00:00
const found = tmpResult(channel).find((embeddedActivity) => application.id === embeddedActivity.embeddedActivity.applicationId);
2026-07-20 16:05:17 +00:00
const obj1 = { application: activityItem.application, context, locationObject, embeddedActivitiesManager, onActivityItemSelectedProp: onActivityItemSelected, launchingComponentId, commandOrigin, source };
2026-07-29 08:29:29 +00:00
const tmpResultResult = tmpResult(channel);
const tmp13 = useActivityAction(obj);
2026-08-05 07:35:12 +00:00
let tmp4Result = tmp4(7482);
2026-07-29 08:29:29 +00:00
if (tmp4Result.hasApplicationFlag(application, ApplicationFlags.EMBEDDED_RELEASED)) {
2026-08-05 07:35:12 +00:00
tmpResult = tmp(10494);
2026-07-29 08:29:29 +00:00
tmp4Result = tmp4(500);
const str = activityItem.activity.client_platform_config[tmpResult(undefined, tmp4Result.getOS(tmp4Result))].release_phase;
let replaced;
if (STAFF_RELEASE_PHASES.includes(str)) {
replaced = str.replace("_", " ").replace(/(^\w|\s\w)/g, (str) => str.toUpperCase());
const str4 = str.replace("_", " ");
}
const tmp16 = replaced;
} else {
2026-08-05 07:35:12 +00:00
const tmp4Result1 = tmp4(7482);
2026-07-29 08:29:29 +00:00
}
const obj2 = { imageBackground: tmp8, videoUrl: tmp9, joinableEmbeddedApp: found, activityAction: tmp13, onActivityItemSelected: useOnActivityItemSelected(obj1), labelType: null, staffReleasePhase: null };
if (tmp7) {
let NONE = tmp5.label_type;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
NONE = tmp4(1906).EmbeddedActivityLabelTypes.NONE;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2[5] = NONE;
obj2[6] = tmp16;
2026-07-20 16:05:17 +00:00
return obj2;
};
export const ActivityAction = obj;
2026-07-29 08:29:29 +00:00
export const getStaffReleasePhase = function getStaffReleasePhase(application) {
if (!obj.hasApplicationFlag(application, ApplicationFlags.EMBEDDED_RELEASED)) {
2026-08-05 07:35:12 +00:00
let tmpResult = tmp(7482);
2026-07-29 08:29:29 +00:00
}
2026-08-05 07:35:12 +00:00
obj = require(7482) /* getApplicationFlags */;
2026-07-29 08:29:29 +00:00
const tmp3 = ApplicationFlags;
tmpResult = tmp(500);
2026-08-05 07:35:12 +00:00
const str = arg1.client_platform_config[importDefault(10494)(undefined, tmpResult.getOS(tmpResult))].release_phase;
2026-07-29 08:29:29 +00:00
let replaced;
if (STAFF_RELEASE_PHASES.includes(str)) {
replaced = str.replace("_", " ").replace(/(^\w|\s\w)/g, (str) => str.toUpperCase());
const str4 = str.replace("_", " ");
}
return replaced;
};
2026-07-20 16:05:17 +00:00
export { useActivityAction };
export { useOnActivityItemSelected };