89 lines
5.3 KiB
TypeScript
89 lines
5.3 KiB
TypeScript
/* Metro module 13017; source: modules/rpc/server/commands/application.tsx; dependencies: [4234, 4135, 661, 8079, 8081, 13018, 7504, 8076, 8097, 683, 507, 7502, 2] */
|
|
function _fun99372(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:6, offset: 0x021c5ddb, size: 246 bytes, params: 8, frame: 21
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const applicationStore = importDefault(4234) /* metro dependency 4234: ApplicationStore */;
|
|
const RPC_LOCAL_SCOPE = (require(4135) /* metro dependency 4135: Constants */).RPC_LOCAL_SCOPE;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_4 = constantsModule.ApplicationFlags;
|
|
const env0_5 = constantsModule.Endpoints;
|
|
const RPCCommands = constantsModule.RPCCommands;
|
|
const env0_6 = constantsModule.RPCErrors;
|
|
object2 = {};
|
|
const SEND_ANALYTICS_EVENT = RPCCommands.SEND_ANALYTICS_EVENT;
|
|
object2[SEND_ANALYTICS_EVENT] = {validation: validation, handler: handler_99374};
|
|
const GET_APPLICATION_TICKET = RPCCommands.GET_APPLICATION_TICKET;
|
|
object2[GET_APPLICATION_TICKET] = {scope: RPC_LOCAL_SCOPE, handler: handler_99375};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/rpc/server/commands/application.tsx');
|
|
exports.default = object2;
|
|
}
|
|
|
|
function validation(a0) { // fn#99373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:247, offset: 0x021c5ed1, size: 110 bytes, params: 2, frame: 18
|
|
let value = (importDefault(8079) /* metro dependency 8079: createRpcJoiSchemaObject */)(a0);
|
|
value = value.required();
|
|
const keys = value.keys;
|
|
const object2 = {};
|
|
object2.event_name = a0.string().required();
|
|
object2.event_properties = (importDefault(8079) /* metro dependency 8079: createRpcJoiSchemaObject */)(a0).required();
|
|
return Reflect.apply(keys, value, [object2]);
|
|
}
|
|
|
|
function handler_99374({socket, args}) { // fn#99374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:352, offset: 0x021c5f3f, size: 416 bytes, params: 2, frame: 21
|
|
var object3;
|
|
var activeAnalyticsSessionIDs;
|
|
var track;
|
|
var object4;
|
|
const event_name = args.event_name;
|
|
const event_properties = args.event_properties;
|
|
var value;
|
|
const rpcHelpersModule = require(8081) /* metro dependency 8081: RPCHelpers */;
|
|
rpcHelpersModule.validatePostMessageTransport(socket.transport);
|
|
const moduleValue2 = rpcHelpersModule;
|
|
moduleValue2.validateApplication(socket.application);
|
|
const id = socket.application.id;
|
|
const value3 = (importDefault(13018) /* metro dependency 13018: getCurrentEmbeddedActivityChannel */)();
|
|
const guildId = value3?.getGuildId();
|
|
const application = ApplicationStore.getApplication(id);
|
|
const applicationFlagUtilsModule = require(7504) /* metro dependency 7504: ApplicationFlagUtils */;
|
|
const hasApplicationFlag = applicationFlagUtilsModule.hasApplicationFlag;
|
|
const EMBEDDED_FIRST_PARTY = ApplicationFlags.EMBEDDED_FIRST_PARTY;
|
|
if (Reflect.apply(hasApplicationFlag, applicationFlagUtilsModule, [application, EMBEDDED_FIRST_PARTY])) {
|
|
activeAnalyticsSessionIDs = (require(8097) /* metro dependency 8097: EmbeddedActivitiesManager */).getActiveAnalyticsSessionIDs(id);
|
|
object3 = {activity_application_id: id};
|
|
object3.activity_channel_type = value3?.type;
|
|
object3.activity_guild_id = guildId;
|
|
object3.activity_user_session_id = activeAnalyticsSessionIDs?.activityUserSessionId;
|
|
value = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = value.track;
|
|
object4 = {};
|
|
copyDataProperties(object4, object3, application);
|
|
copyDataProperties(object4, event_properties, application);
|
|
Reflect.apply(track, value, [event_name, object4]);
|
|
return undefined;
|
|
}
|
|
const defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */;
|
|
const INVALID_COMMAND = RPCErrors.INVALID_COMMAND;
|
|
throw new defaultImport({errorCode: INVALID_COMMAND}, 'This application cannot access this API');
|
|
}
|
|
|
|
function handler_99375({socket}) { // fn#99375, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:1013, offset: 0x021c60df, size: 234 bytes, params: 2, frame: 18
|
|
const id = socket.application.id;
|
|
if (id == null) {
|
|
throw new (importDefault(8076) /* metro dependency 8076: RPCError */)({errorCode: RPCErrors.INVALID_COMMAND},
|
|
'No application.');
|
|
}
|
|
const HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
const post = HTTP.post;
|
|
const object3 = {'url': null, 'body': null, 'retries': 3, 'oldFormErrors': true, 'rejectWithError': false};
|
|
object3.url = Endpoints.APPLICATION_TICKET(id);
|
|
const object4 = {};
|
|
object4.test_mode = (require(7502) /* metro dependency 7502: TestModeUtils */).isTestModeForApplication(id);
|
|
object3.body = object4;
|
|
return Reflect.apply(post, HTTP, [object3]).then(function(a0) {
|
|
return a0.body;
|
|
});
|
|
}
|
|
|