Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
408 lines
15 KiB
TypeScript
408 lines
15 KiB
TypeScript
// Module ID: 11539
|
|
// Function ID: 11540
|
|
// Name: useActivityShelfItem
|
|
// Dependencies: [5, 2044, 2005, 1074, 8500, 8713, 1364, 8933, 11540, 11541, 1979, 8321, 8913, 8912, 6589, 4458, 6583, 8783, 8760, 4849, 10741, 8826, 2]
|
|
// Exports: default, getStaffReleasePhase
|
|
|
|
// Module 11539 (useActivityShelfItem)
|
|
import PlatformUtils from "PlatformUtils" /* 1364 */;
|
|
import embeddedActivityLocationUtils from "embeddedActivityLocationUtils" /* 4458 */;
|
|
import useGetOrFetchApplications from "useGetOrFetchApplications" /* 6589 */;
|
|
import ApplicationFlagUtils from "ApplicationFlagUtils" /* 8321 */;
|
|
import getPlatformDefault from "getPlatform" /* 8713 */;
|
|
import canLaunchFrame from "canLaunchFrame" /* 8783 */;
|
|
import useCurrentEmbeddedApplicationDefault from "useCurrentEmbeddedApplication" /* 8912 */;
|
|
import useCurrentEmbeddedActivityDefault from "useCurrentEmbeddedActivity" /* 8913 */;
|
|
import useEmbeddedActivityBackgroundDefault from "useEmbeddedActivityBackground" /* 8933 */;
|
|
import useEmbeddedAppsForChannelDefault from "useEmbeddedAppsForChannel" /* 11541 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 2044 */;
|
|
|
|
require = fn;
|
|
function useActivityAction(applicationId) {
|
|
({ context, fetchesApplication } = applicationId);
|
|
if (fetchesApplication === undefined) {
|
|
fetchesApplication = true;
|
|
}
|
|
let getOrFetchApplication;
|
|
const START = obj.START;
|
|
let channel;
|
|
if ("channel" === context.type) {
|
|
channel = context.channel;
|
|
}
|
|
const tmp4 = useCurrentEmbeddedActivityDefault();
|
|
const tmp5 = useCurrentEmbeddedApplicationDefault({ fetchesApplication });
|
|
obj = useGetOrFetchApplications;
|
|
getOrFetchApplication = obj.useGetOrFetchApplication(applicationId.applicationId, fetchesApplication);
|
|
useEmbeddedAppsForChannelDefault(channel);
|
|
if (null == getOrFetchApplication) {
|
|
return START;
|
|
} else {
|
|
const getEmbeddedActivityLocationChannelId = embeddedActivityLocationUtils.getEmbeddedActivityLocationChannelId;
|
|
if (tmp4 != null) {
|
|
const _location = tmp4.location;
|
|
}
|
|
if (null != channel) {
|
|
if (tmp11 === channel.id) {
|
|
let id;
|
|
if (tmp5 != null) {
|
|
id = tmp5.id;
|
|
}
|
|
if (id === getOrFetchApplication.id) {
|
|
let JOIN = tmp.LEAVE;
|
|
}
|
|
return JOIN;
|
|
}
|
|
}
|
|
JOIN = START;
|
|
if (null != tmp9) {
|
|
JOIN = tmp.JOIN;
|
|
}
|
|
const tmp6Result = embeddedActivityLocationUtils;
|
|
}
|
|
}
|
|
function useOnActivityItemSelected(arg0) {
|
|
({ application, botUserIdForAppDM: require, context } = arg0);
|
|
({ locationObject: dependencyMap, embeddedActivitiesManager: asyncGeneratorStep, onActivityItemSelectedProp: EmbeddedActivitiesStore, launchingComponentId: STAFF_RELEASE_PHASES, commandOrigin: ApplicationFlags, sectionName: MAIN_SURFACE, source: obj, fetchesApplication } = arg0);
|
|
if (fetchesApplication === undefined) {
|
|
fetchesApplication = true;
|
|
}
|
|
({ customId: useActivityAction, referrerId: useOnActivityItemSelected, onConfirmActivityLaunchChecksAlertOpen: closure_11 } = arg0);
|
|
let analyticsLocations;
|
|
closure_14 = undefined;
|
|
closure_15 = undefined;
|
|
let str;
|
|
if (application != null) {
|
|
str = application.id;
|
|
}
|
|
if (str == null) {
|
|
str = "";
|
|
}
|
|
let tmp = useActivityAction({ context, applicationId: str, fetchesApplication });
|
|
analyticsLocations = context(6583)().analyticsLocations;
|
|
closure_14 = context(8913)();
|
|
obj = canLaunchFrame;
|
|
closure_15 = obj.canLaunchFrame(application);
|
|
if (null == application) {
|
|
return () => {
|
|
if (EmbeddedActivitiesStore != null) {
|
|
tmp({ applicationId: "" });
|
|
}
|
|
};
|
|
} else if (obj.START === tmp) {
|
|
return asyncGeneratorStep(async (arg0, value) => {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp7 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
if (0 === c4) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
closure_0 = tmp5;
|
|
closure_128_0 = undefined;
|
|
if (closure_15) {
|
|
c3 = 1;
|
|
const obj4 = { applicationId: str, surface, analyticsContext: null };
|
|
const obj5 = { isStart: true, analyticsLocations, source, channelId: null };
|
|
let id;
|
|
if ("channel" === context.type) {
|
|
id = context.channel.id;
|
|
}
|
|
obj5.channelId = id;
|
|
obj4.analyticsContext = obj5;
|
|
c4 = 2;
|
|
c5 = 1;
|
|
const obj7 = { value: tmp3(tmp44[18]).launchFrame(obj4), done: false };
|
|
return obj7;
|
|
} else {
|
|
let id1;
|
|
if ("channel" === context.type) {
|
|
id1 = context.channel.id;
|
|
}
|
|
closure_128_0 = id1;
|
|
if (null != require) {
|
|
c3 = 2;
|
|
const obj8 = { recipientIds: tmp18, navigateToChannel: true };
|
|
c4 = 5;
|
|
c5 = 1;
|
|
const obj10 = { value: tmp3(tmp44[19]).openPrivateChannel(obj8), done: false };
|
|
return obj10;
|
|
} else {
|
|
const obj11 = { targetApplicationId: closure_129_12, locationObject: closure_129_2, channelId: closure_128_0, analyticsLocations: closure_129_13, componentId: closure_129_5, commandOrigin: closure_129_6, sectionName: closure_129_7, source: closure_129_8, customId: closure_129_9, referrerId: closure_129_10, onConfirmActivityLaunchChecksAlertOpen: closure_129_11 };
|
|
tmp3(tmp44[20])(obj11).then((result) => {
|
|
let tmp = result;
|
|
if (result) {
|
|
let tmp2Result;
|
|
if (closure_1_4 != null) {
|
|
const obj = { applicationId };
|
|
tmp2Result = tmp2(obj);
|
|
}
|
|
tmp = tmp2Result;
|
|
}
|
|
return tmp;
|
|
});
|
|
c4 = 4;
|
|
c5 = 1;
|
|
const promise = tmp3(tmp44[20])(obj11);
|
|
}
|
|
}
|
|
}
|
|
} else if (1 === tmp8) {
|
|
c3 = 0;
|
|
c5 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
} else {
|
|
if (2 === tmp8) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c3 = 0;
|
|
c5 = 3;
|
|
const obj12 = { value, done: true };
|
|
return obj12;
|
|
} else {
|
|
if (closure_129_4 != null) {
|
|
const obj13 = { applicationId: closure_129_12 };
|
|
tmp12(obj13);
|
|
}
|
|
c3 = 0;
|
|
}
|
|
} else if (3 === tmp8) {
|
|
c3 = 0;
|
|
c5 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
} else if (4 === tmp8) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj14 = { value, done: true };
|
|
return obj14;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_128_0 = value;
|
|
c3 = 0;
|
|
}
|
|
c5 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
c3 = 0;
|
|
c5 = 3;
|
|
let obj = { value, done: true };
|
|
return obj;
|
|
} catch (tmp44) {
|
|
if (tmp4 === c3) {
|
|
c5 = tmp2;
|
|
throw tmp44;
|
|
} else if (tmp === tmp46) {
|
|
c4 = tmp;
|
|
} else {
|
|
c4 = tmp2;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
} else if (tmp2.JOIN === tmp) {
|
|
return asyncGeneratorStep(async (arg0, value) => {
|
|
if (c0 === 2) {
|
|
c0 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp3 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c0 = 2;
|
|
if (0 === v1) {
|
|
if (arg0 === 1) {
|
|
c0 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c0 = 3;
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else if (!launchingActivity.isLaunchingActivity()) {
|
|
const obj4 = { applicationId: str, activityChannelId: null, locationObject: null, analyticsLocations: null, componentId: null, sectionName: null, source: null, customId: null, referrerId: null };
|
|
let id;
|
|
if ("channel" === context.type) {
|
|
id = context.channel.id;
|
|
}
|
|
obj4.activityChannelId = id;
|
|
obj4.locationObject = locationObject;
|
|
obj4.analyticsLocations = analyticsLocations;
|
|
obj4.componentId = componentId;
|
|
obj4.sectionName = sectionName;
|
|
obj4.source = source;
|
|
obj4.customId = customId;
|
|
obj4.referrerId = referrerId;
|
|
const tmp7 = v1(locationObject[21]);
|
|
v1 = 1;
|
|
c0 = 1;
|
|
const obj5 = {
|
|
value: v1(locationObject[21])(obj4).then((result) => {
|
|
let tmp = result;
|
|
if (result) {
|
|
let tmp2Result;
|
|
if (launchingActivity != null) {
|
|
const obj = { applicationId };
|
|
tmp2Result = tmp2(obj);
|
|
}
|
|
tmp = tmp2Result;
|
|
}
|
|
return tmp;
|
|
}),
|
|
done: false
|
|
};
|
|
return obj5;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c0 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c0 = 3;
|
|
let obj = { value, done: true };
|
|
return obj;
|
|
}
|
|
c0 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
} catch (tmp17) {
|
|
c0 = tmp;
|
|
throw tmp17;
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
return tmp2.LEAVE === tmp ? (() => {
|
|
if (!EmbeddedActivitiesStore.isLaunchingActivity()) {
|
|
if (null != closure_14) {
|
|
const obj = { location: tmp.location, applicationId: str };
|
|
asyncGeneratorStep.leaveActivity(obj);
|
|
}
|
|
if (closure_1_4 != null) {
|
|
const obj2 = { applicationId: str };
|
|
tmp6(obj2);
|
|
}
|
|
}
|
|
}) : undefined;
|
|
}
|
|
}
|
|
const STAFF_RELEASE_PHASES = fn(2005).STAFF_RELEASE_PHASES;
|
|
const ApplicationFlags = fn(1074).ApplicationFlags;
|
|
const MAIN_SURFACE = fn(8500).MAIN_SURFACE;
|
|
const ActivityAction = { START: 0, [0]: "START", JOIN: 1, [1]: "JOIN", LEAVE: 2, [2]: "LEAVE" };
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/activities/utils/useActivityShelfItem.tsx");
|
|
|
|
export default function useActivityShelfItem(backgroundResolution) {
|
|
({ activityItem, context, assetNames } = backgroundResolution);
|
|
({ locationObject, onActivityItemSelected, embeddedActivitiesManager } = backgroundResolution);
|
|
if (assetNames === undefined) {
|
|
assetNames = ["embedded_cover"];
|
|
}
|
|
let num = backgroundResolution.backgroundResolution;
|
|
if (num === undefined) {
|
|
num = 250;
|
|
}
|
|
const application = activityItem.application;
|
|
const activity = activityItem.activity;
|
|
({ launchingComponentId, commandOrigin, source } = backgroundResolution);
|
|
const obj = PlatformUtils;
|
|
const tmp5 = activity.client_platform_config[getPlatformDefault(undefined, obj.getOS(obj))];
|
|
const timestamp = Date.now();
|
|
let tmp7 = null != tmp5.label_until;
|
|
if (tmp7) {
|
|
const _Date = Date;
|
|
tmp7 = timestamp < Date.parse(tmp5.label_until);
|
|
}
|
|
if (tmp7) {
|
|
tmp7 = null != tmp5.label_from;
|
|
}
|
|
if (tmp7) {
|
|
const _Date2 = Date;
|
|
tmp7 = timestamp > Date.parse(tmp5.label_from);
|
|
}
|
|
let tmp9 = null;
|
|
const obj2 = { applicationId: application.id, size: num, names: assetNames, format: "webp" };
|
|
if (null != activity.activity_preview_video_asset_id) {
|
|
tmp9 = tmp(11540)(application.id, activity.activity_preview_video_asset_id);
|
|
}
|
|
let channel;
|
|
const tmp8 = useEmbeddedActivityBackgroundDefault({ applicationId: application.id, size: num, names: assetNames, format: "webp" });
|
|
if ("channel" === context.type) {
|
|
channel = context.channel;
|
|
}
|
|
const tmpResult = useEmbeddedAppsForChannelDefault;
|
|
const found = useEmbeddedAppsForChannelDefault(channel).find((embeddedActivity) => application.id === embeddedActivity.embeddedActivity.applicationId);
|
|
const obj3 = { context, applicationId: application.id };
|
|
const obj4 = { application: activityItem.application, context, locationObject, embeddedActivitiesManager, onActivityItemSelectedProp: onActivityItemSelected, launchingComponentId, commandOrigin, source };
|
|
const tmpResultResult = useEmbeddedAppsForChannelDefault(channel);
|
|
const tmp13 = useActivityAction({ context, applicationId: application.id });
|
|
const tmp14 = useOnActivityItemSelected(obj4);
|
|
if (tmp4Result.hasApplicationFlag(application, ApplicationFlags.EMBEDDED_RELEASED)) {
|
|
const tmp4Result3 = tmp4(1364);
|
|
const str = activityItem.activity.client_platform_config[tmp(8713)(undefined, tmp4Result3.getOS(tmp4Result3))].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;
|
|
const tmpResult2 = tmp(8713);
|
|
} else {
|
|
const tmp4Result4 = tmp4(8321);
|
|
}
|
|
const obj5 = { imageBackground: tmp8, videoUrl: tmp9, joinableEmbeddedApp: found, activityAction: tmp13, onActivityItemSelected: tmp14, labelType: null, staffReleasePhase: null };
|
|
if (tmp7) {
|
|
let NONE = tmp5.label_type;
|
|
} else {
|
|
NONE = tmp4(1979).EmbeddedActivityLabelTypes.NONE;
|
|
}
|
|
obj5.labelType = NONE;
|
|
obj5.staffReleasePhase = tmp16;
|
|
return obj5;
|
|
};
|
|
export { ActivityAction };
|
|
export const getStaffReleasePhase = function getStaffReleasePhase(application, arg1) {
|
|
if (!obj.hasApplicationFlag(application, ApplicationFlags.EMBEDDED_RELEASED)) {
|
|
const tmpResult = tmp(8321);
|
|
}
|
|
obj = ApplicationFlagUtils;
|
|
const tmpResult2 = PlatformUtils;
|
|
const str = arg1.client_platform_config[getPlatformDefault(undefined, tmpResult2.getOS(tmpResult2))].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("_", " ");
|
|
}
|
|
return replaced;
|
|
};
|
|
export { useActivityAction };
|
|
export { useOnActivityItemSelected };
|