496 lines
18 KiB
TypeScript
496 lines
18 KiB
TypeScript
// Module ID: 8145
|
|
// Function ID: 64987
|
|
// Name: openInviteModal
|
|
// Dependencies: [57, 5, 4168, 5751, 5611, 1194, 1918, 1838, 4116, 4350, 1907, 3948, 4971, 653, 655, 5612, 686, 4117, 6636, 8146, 1935, 5049, 5626, 8155, 4115, 4120, 5922, 3822, 675, 10546, 11074, 12213, 5668, 4141, 10581, 12217, 9692, 10429, 1443, 10898, 4982, 12218, 5769, 4325, 4322, 12219, 12221, 2]
|
|
// Exports: default
|
|
|
|
// Module 8145 (openInviteModal)
|
|
import _slicedToArray from "_slicedToArray";
|
|
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
|
|
import closure_5 from "_isNativeReflectConstruct";
|
|
import "_isNativeReflectConstruct";
|
|
import "_isNativeReflectConstruct";
|
|
import closure_6 from "_isNativeReflectConstruct";
|
|
import closure_7 from "_isNativeReflectConstruct";
|
|
import "_createForOfIteratorHelperLoose";
|
|
import closure_8 from "_isNativeReflectConstruct";
|
|
import "_isNativeReflectConstruct";
|
|
import closure_9 from "_isNativeReflectConstruct";
|
|
import closure_10 from "_isNativeReflectConstruct";
|
|
import closure_11 from "_isNativeReflectConstruct";
|
|
import ME from "ME";
|
|
import items from "items";
|
|
import { isGameShopPath } from "STOREFRONT_MARKETING_GUILD_ID";
|
|
|
|
let AbortCodes;
|
|
let AppContext;
|
|
let JoinGuildSources;
|
|
let Routes;
|
|
let closure_12;
|
|
let closure_13;
|
|
let closure_14;
|
|
let closure_15;
|
|
const require = arg1;
|
|
function openInviteModal() {
|
|
return _openInviteModal(...arguments);
|
|
}
|
|
async function _openInviteModal(arg0, arg1, arg2, arg3) {
|
|
let obj = outer2_1(outer2_2[16]);
|
|
obj = { type: "DISPLAYED_INVITE_SHOW", code: arg1, username: undefined, deeplinkAttemptId: undefined, invite_instance_id: arg2 };
|
|
yield obj.dispatch(obj);
|
|
}
|
|
async function _handleInviteCodedLink(arg0, arg1, arg2) {
|
|
let _Set;
|
|
const code = arg0.code;
|
|
let obj = outer2_0(outer2_2[17]);
|
|
const inviteInstanceId = obj.getInviteInstanceId(code, arg1);
|
|
let invite = outer2_8.getInvite(code);
|
|
if (null == invite) {
|
|
obj = { inviteInstanceId };
|
|
invite = yield outer2_1(outer2_2[18]).resolveInvite(code, "Markdown Link", obj).invite;
|
|
let tmp6;
|
|
if (null != invite) {
|
|
tmp6 = invite;
|
|
}
|
|
invite = tmp6;
|
|
const obj2 = outer2_1(outer2_2[18]);
|
|
}
|
|
if (null != invite) {
|
|
if (invite.state !== outer2_13.EXPIRED) {
|
|
if (invite.state !== outer2_13.BANNED) {
|
|
if (invite.state !== outer2_13.ERROR) {
|
|
const flattenedGuildIds = outer2_11.getFlattenedGuildIds();
|
|
let id;
|
|
if (null != invite) {
|
|
const guild = invite.guild;
|
|
if (null != guild) {
|
|
id = guild.id;
|
|
}
|
|
}
|
|
const tmp12 = null != id && flattenedGuildIds.includes(id);
|
|
let flag = false;
|
|
if (tmp12) {
|
|
flag = false;
|
|
if (null != invite.roles) {
|
|
flag = false;
|
|
if (invite.roles.length > 0) {
|
|
const member = outer2_7.getMember(id, outer2_6.getId());
|
|
_Set = Set;
|
|
let roles;
|
|
if (null != member) {
|
|
roles = member.roles;
|
|
}
|
|
if (null == roles) {
|
|
roles = [];
|
|
}
|
|
const prototype = _Set.prototype;
|
|
_Set = new _Set(roles);
|
|
roles = invite.roles;
|
|
flag = roles.some((id) => !_Set.has(id.id));
|
|
}
|
|
}
|
|
}
|
|
if (tmp12) {
|
|
if (!flag) {
|
|
obj = { forceTransition: true };
|
|
outer2_1(outer2_2[18]).transitionToInvite(invite, obj);
|
|
const obj5 = outer2_1(outer2_2[18]);
|
|
}
|
|
}
|
|
yield outer2_18(invite, code, inviteInstanceId);
|
|
}
|
|
}
|
|
}
|
|
return yield outer2_18(invite, code, inviteInstanceId);
|
|
}
|
|
}
|
|
({ AbortCodes, AnalyticEvents: closure_12, AppContext, InviteStates: closure_13, JoinGuildSources, Routes } = ME);
|
|
({ CollectibleShopTab: closure_14, CollectiblesMobileShopScreen: closure_15 } = items);
|
|
let closure_17 = { skipExtensionCheck: undefined, analyticsLocations: [] };
|
|
let result = require("_isNativeReflectConstruct").fileFinishedImporting("lib/getOnClick.tsx");
|
|
|
|
export default function getOnClick(outer1_0) {
|
|
let channelId;
|
|
let dependencyMap;
|
|
let hash;
|
|
let host;
|
|
let hostname;
|
|
let importDefault;
|
|
let pathname;
|
|
let search;
|
|
let tmp = arg1;
|
|
const _require = outer1_0;
|
|
if (arg1 === undefined) {
|
|
tmp = closure_17;
|
|
}
|
|
({ analyticsLocations: importDefault, messageId: dependencyMap, channelId } = tmp);
|
|
let c3;
|
|
pathname = undefined;
|
|
let obj;
|
|
obj = _require(4115);
|
|
const findCodedLinkResult = obj.findCodedLink(outer1_0);
|
|
c3 = findCodedLinkResult;
|
|
if (null != findCodedLinkResult) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
(function handleInviteCodedLink(c3, closure_2) {
|
|
return outer2_20(...arguments);
|
|
})(c3, closure_2);
|
|
return true;
|
|
};
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
return (preventDefault) => {
|
|
let applicationId;
|
|
let skuId;
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const code = _undefined.code;
|
|
if (_undefined.type !== outer1_0(outer1_2[25]).CodedLinkType.APP_DIRECTORY_PROFILE) {
|
|
if (_undefined.type !== outer1_0(outer1_2[25]).CodedLinkType.APP_DIRECTORY_STOREFRONT) {
|
|
let obj = outer1_0(outer1_2[26]);
|
|
let result = obj.parseStorefrontSkuCodedLink(code);
|
|
if (null == result) {
|
|
obj = { applicationId: undefined, skuId: undefined };
|
|
result = obj;
|
|
}
|
|
}
|
|
({ applicationId, skuId } = result);
|
|
const guildId = outer1_10.getGuildId();
|
|
if (null != guildId) {
|
|
const tmp9 = guildId;
|
|
}
|
|
if (null != applicationId) {
|
|
obj = { application_id: applicationId, device_platform: "mobile_native", guild_id: tmp9, channel_id: outer1_9.getChannelId() };
|
|
outer1_1(outer1_2[28]).track(outer1_12.APP_DIRECTORY_PROFILE_EMBED_URL_CLICKED, obj);
|
|
const obj4 = outer1_1(outer1_2[28]);
|
|
}
|
|
outer1_1(outer1_2[27])(outer1_0);
|
|
return true;
|
|
}
|
|
result = { applicationId: code, skuId: undefined };
|
|
};
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.ACTIVITY_BOOKMARK) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const code = _undefined.code;
|
|
const application = obj.getApplication(code);
|
|
const uRL = new URL(_undefined.url);
|
|
let searchParams = uRL.searchParams;
|
|
let value = searchParams.get("referrer_id");
|
|
let tmp5;
|
|
if (null != value) {
|
|
tmp5 = value;
|
|
}
|
|
let closure_2 = tmp5;
|
|
_undefined = outer1_1(outer1_2[29])();
|
|
obj = outer1_0(outer1_2[30]);
|
|
const playInContext = obj.getPlayInContext(code);
|
|
const currentChannelId = playInContext.currentChannelId;
|
|
const instanceId = playInContext.instanceId;
|
|
if (playInContext.canLaunchInChannel) {
|
|
let flag2 = !playInContext.isCurrentlyInInstance && null != currentChannelId;
|
|
if (flag2) {
|
|
let searchParams2 = uRL.searchParams;
|
|
const searchParams3 = uRL.searchParams;
|
|
value = searchParams2.get("link_id");
|
|
const customActivityLinkParams = outer1_0(outer1_2[31]).getCustomActivityLinkParams(code, value, searchParams3.get("custom_id"));
|
|
const obj4 = outer1_0(outer1_2[31]);
|
|
customActivityLinkParams.then((() => {
|
|
let closure_0 = pathname(async (arg0) => {
|
|
const iter = (function*(customId) {
|
|
yield undefined;
|
|
let obj = callback(outer4_2[32]);
|
|
obj = { channelId: outer2_4, applicationId: callback, isStart: null == outer2_5, embeddedActivitiesManager: outer2_3, customId: customId.customId, referrerId: outer2_2, analyticsLocations: uRL };
|
|
yield obj.runPrimaryAppCommandOrJoinEmbeddedActivity(obj);
|
|
})();
|
|
iter.next();
|
|
return iter;
|
|
});
|
|
return function() {
|
|
return callback(...arguments);
|
|
};
|
|
})()).catch(() => {
|
|
|
|
});
|
|
flag2 = true;
|
|
const nextPromise = customActivityLinkParams.then((() => {
|
|
let closure_0 = pathname(async (arg0) => {
|
|
const iter = (function*(customId) {
|
|
yield undefined;
|
|
let obj = callback(outer4_2[32]);
|
|
obj = { channelId: outer2_4, applicationId: callback, isStart: null == outer2_5, embeddedActivitiesManager: outer2_3, customId: customId.customId, referrerId: outer2_2, analyticsLocations: uRL };
|
|
yield obj.runPrimaryAppCommandOrJoinEmbeddedActivity(obj);
|
|
})();
|
|
iter.next();
|
|
return iter;
|
|
});
|
|
return function() {
|
|
return callback(...arguments);
|
|
};
|
|
})());
|
|
}
|
|
return flag2;
|
|
} else {
|
|
let id;
|
|
if (null != application) {
|
|
const bot = application.bot;
|
|
if (null != bot) {
|
|
id = bot.id;
|
|
}
|
|
}
|
|
let flag = null != id;
|
|
if (flag) {
|
|
obj = { recipientIds: id };
|
|
const obj2 = outer1_1(outer1_2[33]);
|
|
const openPrivateChannelResult = outer1_1(outer1_2[33]).openPrivateChannel(obj);
|
|
outer1_1(outer1_2[33]).openPrivateChannel(obj).then((() => {
|
|
let closure_0 = pathname(async (arg0) => {
|
|
let obj = callback(outer4_2[31]);
|
|
const searchParams = outer2_1.searchParams;
|
|
const searchParams2 = outer2_1.searchParams;
|
|
const value = searchParams.get("link_id");
|
|
obj = { targetApplicationId: callback, channelId: arg0, analyticsLocations: uRL, customId: yield obj.getCustomActivityLinkParams(closure_0, value, searchParams2.get("custom_id")).customId, referrerId: outer2_2 };
|
|
outer4_1(outer4_2[34])(obj);
|
|
});
|
|
return function() {
|
|
return callback(...arguments);
|
|
};
|
|
})()).catch(() => {
|
|
|
|
});
|
|
flag = true;
|
|
const nextPromise1 = outer1_1(outer1_2[33]).openPrivateChannel(obj).then((() => {
|
|
let closure_0 = pathname(async (arg0) => {
|
|
let obj = callback(outer4_2[31]);
|
|
const searchParams = outer2_1.searchParams;
|
|
const searchParams2 = outer2_1.searchParams;
|
|
const value = searchParams.get("link_id");
|
|
obj = { targetApplicationId: callback, channelId: arg0, analyticsLocations: uRL, customId: yield obj.getCustomActivityLinkParams(closure_0, value, searchParams2.get("custom_id")).customId, referrerId: outer2_2 };
|
|
outer4_1(outer4_2[34])(obj);
|
|
});
|
|
return function() {
|
|
return callback(...arguments);
|
|
};
|
|
})());
|
|
}
|
|
return flag;
|
|
}
|
|
};
|
|
}
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.GUILD_PRODUCT) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const tmp2 = _undefined(_undefined.code.split("-"), 2);
|
|
const outer1_0 = tmp2[0];
|
|
let closure_1 = tmp2[1];
|
|
outer1_0(outer1_2[20])(outer1_2[35], outer1_2.paths).then((openGuildProductLink) => {
|
|
openGuildProductLink.openGuildProductLink(closure_0, closure_1);
|
|
});
|
|
return true;
|
|
};
|
|
}
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.SOCIAL_LAYER_STOREFRONT) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const str = _undefined.code;
|
|
const tmp2 = _undefined(_undefined.code.split("-"), 2);
|
|
const result = outer1_0(outer1_2[36]).openSocialLayerStorefrontProductDetailsModal({ skuId: _undefined(_undefined.code.split("-"), 2)[0], analyticsLocations: closure_1 });
|
|
return true;
|
|
};
|
|
}
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.SOCIAL_LAYER_STOREFRONT_APP) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const str = _undefined.code;
|
|
const tmp2 = _undefined(_undefined.code.split("-"), 2);
|
|
const result = outer1_0(outer1_2[36]).openSocialLayerStorefrontProductDetailsModal({ skuId: _undefined(_undefined.code.split("-"), 2)[0], analyticsLocations: closure_1 });
|
|
return true;
|
|
};
|
|
}
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.QUESTS_EMBED) {
|
|
if (obj2.getIsEligibleForQuests()) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
let obj = outer1_1(outer1_2[38]);
|
|
let toURLSafeResult = obj.toURLSafe(_undefined.url);
|
|
if (null == toURLSafeResult) {
|
|
toURLSafeResult = {};
|
|
}
|
|
const search = toURLSafeResult.search;
|
|
let tmp2;
|
|
let tmp3;
|
|
if (null != search) {
|
|
const _URLSearchParams = URLSearchParams;
|
|
const uRLSearchParams = new URLSearchParams(search);
|
|
let value = uRLSearchParams.get("sort");
|
|
let tmp10;
|
|
if (null != value) {
|
|
tmp10 = value;
|
|
}
|
|
value = uRLSearchParams.get("filter");
|
|
let tmp12;
|
|
if (null != value) {
|
|
tmp12 = value;
|
|
}
|
|
tmp3 = tmp12;
|
|
tmp2 = tmp10;
|
|
}
|
|
obj = { scrollToQuestId: _undefined.code };
|
|
let tmp13 = null;
|
|
if (null != tmp2) {
|
|
tmp13 = tmp2;
|
|
}
|
|
obj.sort = tmp13;
|
|
let tmp14 = null;
|
|
if (null != tmp3) {
|
|
tmp14 = tmp3;
|
|
}
|
|
obj.filter = tmp14;
|
|
obj.fromContent = outer1_0(outer1_2[40]).QuestContent.QUEST_SHARE_LINK;
|
|
outer1_0(outer1_2[39]).openQuestHome(obj);
|
|
return true;
|
|
};
|
|
}
|
|
obj2 = _require(10429);
|
|
}
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.COLLECTIBLES_SHOP) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const enabled = outer1_0(outer1_2[41]).isVirtualCurrencyEnabled().enabled;
|
|
let obj = outer1_0(outer1_2[41]);
|
|
outer1_0(outer1_2[20])(outer1_2[42], outer1_2.paths).then((openCollectiblesShopMobile) => {
|
|
const tmp3 = callback(outer1_3.code.split("-"), 2)[1];
|
|
if (enabled) {
|
|
if (tmp2 === outer2_14.ORBS) {
|
|
let ORBS = outer2_15.ORBS;
|
|
}
|
|
const obj = { analyticsSource: outer1_1[outer1_1.length - 1], analyticsLocations: outer1_1, screen: ORBS };
|
|
let tmp9;
|
|
if (tmp4) {
|
|
tmp9 = tmp3;
|
|
}
|
|
obj.initialProductSkuId = tmp9;
|
|
const result = openCollectiblesShopMobile.openCollectiblesShopMobile(obj);
|
|
}
|
|
ORBS = tmp4 ? tmp6.SHOP_ALL : tmp6.FEATURED_PAGE;
|
|
});
|
|
return true;
|
|
};
|
|
}
|
|
}
|
|
let toURLSafeResult = importDefault(1443).toURLSafe(outer1_0);
|
|
if (null == toURLSafeResult) {
|
|
toURLSafeResult = {};
|
|
}
|
|
({ host, hostname, pathname } = toURLSafeResult);
|
|
({ search, hash } = toURLSafeResult);
|
|
const obj3 = importDefault(1443);
|
|
let tmp19 = null;
|
|
if (null != hostname) {
|
|
tmp19 = hostname;
|
|
}
|
|
let isDiscordHostnameResult = importDefault(1443).isDiscordHostname(tmp19);
|
|
if (!isDiscordHostnameResult) {
|
|
let tmp23 = null;
|
|
if (null != host) {
|
|
tmp23 = host;
|
|
}
|
|
let tmp24 = null;
|
|
if (null != hostname) {
|
|
tmp24 = hostname;
|
|
}
|
|
isDiscordHostnameResult = importDefault(1443).isDiscordLocalhost(tmp23, tmp24);
|
|
const obj6 = importDefault(1443);
|
|
}
|
|
if (isDiscordHostnameResult) {
|
|
if (null != pathname) {
|
|
if (isGameShopPath(pathname)) {
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
const result = outer1_0(outer1_2[36]).openSocialLayerStorefrontUnsupportedOnMobileAlert();
|
|
return true;
|
|
};
|
|
}
|
|
}
|
|
}
|
|
if (null != pathname) {
|
|
if (isDiscordHostnameResult) {
|
|
if (obj7.isAppRoute(pathname)) {
|
|
obj = { navigationReplace: false, openChannel: true };
|
|
if (null != search) {
|
|
obj.search = search;
|
|
}
|
|
if (null != hash) {
|
|
obj.hash = hash;
|
|
}
|
|
return (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
outer1_1(outer1_2[22])(pathname, obj);
|
|
return true;
|
|
};
|
|
}
|
|
obj7 = importDefault(1443);
|
|
}
|
|
}
|
|
if (null != findCodedLinkResult) {
|
|
if (findCodedLinkResult.type === _require(4120).CodedLinkType.APP_OAUTH2_LINK) {
|
|
let fn = (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
let obj = outer1_1(outer1_2[43]);
|
|
obj = { application_id: _undefined.code };
|
|
obj.trackWithMetadata(outer1_12.APP_OAUTH2_LINK_EMBED_URL_CLICKED, obj);
|
|
outer1_1(outer1_2[27])(closure_0);
|
|
return true;
|
|
};
|
|
}
|
|
return fn;
|
|
}
|
|
const obj5 = importDefault(1443);
|
|
let result = _require(4322).tryParseEventDetailsPath(pathname);
|
|
if (!tmp.skipExtensionCheck) {
|
|
if (null != obj9.isSuspiciousDownload(outer1_0)) {
|
|
fn = (preventDefault) => {
|
|
if (null != preventDefault) {
|
|
preventDefault.preventDefault();
|
|
}
|
|
outer1_1(outer1_2[46]).show(closure_0);
|
|
return true;
|
|
};
|
|
}
|
|
obj9 = _require(12219);
|
|
}
|
|
};
|