196 lines
7.7 KiB
TypeScript
196 lines
7.7 KiB
TypeScript
// Module ID: 17388
|
|
// Function ID: 17389
|
|
// Name: _handleInteractionModalCreate
|
|
// Dependencies: [5, 4788, 7941, 1074, 1894, 17389, 1896, 1242, 1983, 1232, 17400, 17403, 7118, 2]
|
|
|
|
// Module 17388 (_handleInteractionModalCreate)
|
|
import initializeDefault from "initialize" /* 7118 */;
|
|
import closure_3 from "asyncGeneratorStep" /* 5 */;
|
|
import closure_4 from "addApplication" /* 4788 */;
|
|
import closure_5 from "deleteNonce" /* 7941 */;
|
|
import { AnalyticEvents } from "ME" /* 1074 */;
|
|
|
|
let require = arg1;
|
|
function _handleInteractionModalCreate() {
|
|
const self = this;
|
|
const tmp = callback((arg0) => {
|
|
closure_0 = arg0;
|
|
c3 = 0;
|
|
c4 = 0;
|
|
return (function*(arg0, openInteractionModal) {
|
|
if (c4 === 2) {
|
|
c4 = 3;
|
|
HermesBuiltin.throwTypeError();
|
|
} else if (tmp5 === 3) {
|
|
if (arg0 === 1) {
|
|
throw openInteractionModal;
|
|
} else if (arg0 === 2) {
|
|
let obj = { value: null, done: true };
|
|
obj[0] = openInteractionModal;
|
|
return obj;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c4 = 2;
|
|
if (0 === c3) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw openInteractionModal;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
obj = { value: null, done: true };
|
|
obj[0] = openInteractionModal;
|
|
return obj;
|
|
} else {
|
|
dependencyMap = tmp2;
|
|
let callback = tmp3;
|
|
callback = undefined;
|
|
c3 = 1;
|
|
c4 = 1;
|
|
obj1 = { value: null, done: false };
|
|
obj1[0] = lib(closure_1_2[6])(closure_1_2[5], closure_1_2.paths);
|
|
return obj1;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw openInteractionModal;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
const obj2 = { value: null, done: true };
|
|
obj2[0] = openInteractionModal;
|
|
return obj2;
|
|
} else {
|
|
openInteractionModal.openInteractionModal(lib);
|
|
const obj3 = { type: "interaction_modal", application_id: null };
|
|
obj3[1] = lib.application.id;
|
|
callback(1242).track(constants.OPEN_MODAL, obj3);
|
|
const AndroidPullModeRenderingExperiment = lib(1983).AndroidPullModeRenderingExperiment;
|
|
if (AndroidPullModeRenderingExperiment.getCurrentConfig().treatmentId >= 2) {
|
|
callback = (function getInteractionModalDebugData(closure_0) {
|
|
interactionDebugContext = interactionDebugContext.getInteractionDebugContext(closure_0.nonce);
|
|
let data;
|
|
if (interactionDebugContext != null) {
|
|
data = interactionDebugContext.interaction.data;
|
|
}
|
|
const obj = { interactionId: closure_0.id, nonce: closure_0.nonce, channelId: closure_0.channelId, applicationId: closure_0.application.id, hasApplicationRecord: null != application.getApplication(closure_0.application.id), hasActionApplicationBot: null != closure_0.application.bot, componentCount: closure_0.components.length, componentTypes: components.map((type) => type.type), sourceInteractionType: null, sourceApplicationId: null, sourceMessageId: null, hasSourceCustomId: null, hasSourceComponentId: null };
|
|
components = closure_0.components;
|
|
let interactionType;
|
|
if (data != null) {
|
|
interactionType = data.interactionType;
|
|
}
|
|
obj[8] = interactionType;
|
|
let applicationId;
|
|
if (data != null) {
|
|
applicationId = data.applicationId;
|
|
}
|
|
obj[9] = applicationId;
|
|
let messageId;
|
|
if (interactionDebugContext != null) {
|
|
messageId = interactionDebugContext.messageId;
|
|
}
|
|
obj[10] = messageId;
|
|
let interactionType1;
|
|
if (data != null) {
|
|
interactionType1 = data.interactionType;
|
|
}
|
|
let tmp9;
|
|
if (interactionType1 === callback(tmp2[4]).InteractionTypes.MESSAGE_COMPONENT) {
|
|
tmp9 = null != data.customId;
|
|
}
|
|
obj[11] = tmp9;
|
|
let interactionType2;
|
|
if (data != null) {
|
|
interactionType2 = data.interactionType;
|
|
}
|
|
let tmp11;
|
|
if (interactionType2 === callback(tmp2[4]).InteractionTypes.MESSAGE_COMPONENT) {
|
|
tmp11 = null != data.componentId;
|
|
}
|
|
obj[12] = tmp11;
|
|
return obj;
|
|
})(lib);
|
|
obj = callback(1232);
|
|
const obj4 = { category: "interaction_modal", message: "Interaction modal opened", data: null };
|
|
obj4[2] = callback;
|
|
obj.addBreadcrumb(obj4);
|
|
}
|
|
c4 = 3;
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} catch (tmp19) {
|
|
c4 = tmp;
|
|
throw tmp19;
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
closure_8 = tmp;
|
|
const apply = tmp.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
const interaction_iframe_modal = "interaction_iframe_modal";
|
|
initializeDefault;
|
|
let prototype = function InteractionModalManager() {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
require = applyArgumentsResult;
|
|
applyArgumentsResult.iframeModalOpenTimeMs = undefined;
|
|
applyArgumentsResult.actions = {
|
|
INTERACTION_MODAL_CREATE(arg0) {
|
|
!(function handleInteractionModalCreate(arg0) {
|
|
const self = this;
|
|
const apply = closure_8.apply;
|
|
if (typeof apply === "unknown") {
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
})(arg0);
|
|
},
|
|
INTERACTION_IFRAME_MODAL_CREATE(application) {
|
|
closure_0.iframeModalOpenTimeMs = Date.now();
|
|
closure_1_1(closure_1_2[10])(application);
|
|
let obj = closure_1_1(closure_1_2[7]);
|
|
obj = { type: closure_1_7, application_id: application.application.id };
|
|
obj.track(closure_1_6.OPEN_MODAL, obj);
|
|
},
|
|
INTERACTION_IFRAME_MODAL_CLOSE(applicationId) {
|
|
const iframeModalOpenTimeMs = applyArgumentsResult.iframeModalOpenTimeMs;
|
|
let diff;
|
|
if (null != iframeModalOpenTimeMs) {
|
|
const _Date = Date;
|
|
diff = Date.now() - iframeModalOpenTimeMs;
|
|
}
|
|
let obj = closure_1_1(closure_1_2[7]);
|
|
obj = { type: closure_1_7, application_id: applicationId.applicationId, duration_open_ms: diff };
|
|
obj.track(closure_1_6.MODAL_DISMISSED, obj);
|
|
applyArgumentsResult.iframeModalOpenTimeMs = undefined;
|
|
},
|
|
RPC_APP_DISCONNECTED(application) {
|
|
const iFrameModalApplicationId = uiStore.getIFrameModalApplicationId();
|
|
let tmp3 = application.application.id === iFrameModalApplicationId;
|
|
const iFrameModalKey = uiStore.getIFrameModalKey();
|
|
if (tmp3) {
|
|
tmp3 = null != iFrameModalApplicationId;
|
|
}
|
|
if (tmp3) {
|
|
callback(table[11])(iFrameModalApplicationId, iFrameModalKey);
|
|
}
|
|
}
|
|
};
|
|
return applyArgumentsResult;
|
|
}.prototype;
|
|
class prototype extends tmp2 {
|
|
}
|
|
prototype = new prototype();
|
|
const result = require("set").fileFinishedImporting("modules/interaction_components/InteractionModalManager.tsx");
|
|
|
|
export default prototype;
|
|
export const INTERACTION_IFRAME_MODAL_ANALYTICS_TYPE = "interaction_iframe_modal";
|