190 lines
7.6 KiB
TypeScript
190 lines
7.6 KiB
TypeScript
// Module ID: 17518
|
|
// Function ID: 17519
|
|
// Name: InteractionModalManager
|
|
// Dependencies: [5, 5118, 7600, 1085, 1985, 17519, 1987, 1252, 559, 1242, 17530, 17533, 6613, 2]
|
|
|
|
// Module 17518 (InteractionModalManager)
|
|
import Constants from "Constants" /* 1085 */;
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1252 */;
|
|
import openInteractionIframeModalDefault from "openInteractionIframeModal" /* 17530 */;
|
|
import closeIFrameModalDefault from "closeIFrameModal" /* 17533 */;
|
|
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
|
|
import ApplicationStore from "ApplicationStore" /* 5118 */;
|
|
import InteractionStore from "InteractionStore" /* 7600 */;
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6613 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
let closure_2, data, interactionDebugContext;
|
|
|
|
let obj = function _handleInteractionModalCreate() {
|
|
let paths;
|
|
obj = _asyncToGenerator(async (arg0) => {
|
|
const application = arg0;
|
|
let c3 = 0;
|
|
let c4 = 0;
|
|
return (async (arg0, value) => {
|
|
function getInteractionModalDebugData(interactionId) {
|
|
let applicationId;
|
|
let components;
|
|
let interactionType;
|
|
let messageId;
|
|
let tmp11;
|
|
let tmp9;
|
|
interactionDebugContext = interactionDebugContext.getInteractionDebugContext(interactionId.nonce);
|
|
data = undefined;
|
|
if (interactionDebugContext != null) {
|
|
data = interactionDebugContext.interaction.data;
|
|
}
|
|
obj = { interactionId: interactionId.id, nonce: interactionId.nonce, channelId: interactionId.channelId, applicationId: interactionId.application.id, hasApplicationRecord: null != application.getApplication(interactionId.application.id), hasActionApplicationBot: null != interactionId.application.bot, componentCount: interactionId.components.length, componentTypes: components.map((type) => type.type), sourceInteractionType: interactionType, sourceApplicationId: applicationId, sourceMessageId: messageId, hasSourceCustomId: tmp9, hasSourceComponentId: tmp11 };
|
|
components = interactionId.components;
|
|
interactionType = undefined;
|
|
if (data != null) {
|
|
interactionType = data.interactionType;
|
|
}
|
|
applicationId = undefined;
|
|
if (data != null) {
|
|
applicationId = data.applicationId;
|
|
}
|
|
messageId = undefined;
|
|
if (interactionDebugContext != null) {
|
|
messageId = interactionDebugContext.messageId;
|
|
}
|
|
let interactionType1;
|
|
if (data != null) {
|
|
interactionType1 = data.interactionType;
|
|
}
|
|
tmp9 = undefined;
|
|
const tmp7 = closure_1_0;
|
|
const tmp8 = closure_1_2;
|
|
if (interactionType1 === closure_1_0(closure_1_2[4]).InteractionTypes.MESSAGE_COMPONENT) {
|
|
tmp9 = null != data.customId;
|
|
}
|
|
let interactionType2;
|
|
if (data != null) {
|
|
interactionType2 = data.interactionType;
|
|
}
|
|
tmp11 = undefined;
|
|
if (interactionType2 === tmp7(tmp8[4]).InteractionTypes.MESSAGE_COMPONENT) {
|
|
tmp11 = null != data.componentId;
|
|
}
|
|
return obj;
|
|
}
|
|
if (c4 === 2) {
|
|
c4 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
return { value, done: true };
|
|
} else {
|
|
return { value: "IconComponent", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c4 = 2;
|
|
if (0 === c3) {
|
|
if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
return { value, done: true };
|
|
} else {
|
|
closure_2 = tmp;
|
|
data = undefined;
|
|
c3 = 1;
|
|
c4 = 1;
|
|
const obj4 = { value: require("asyncRequire")(paths[5], paths.paths), done: false };
|
|
return obj4;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c4 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c4 = 3;
|
|
return { value, done: true };
|
|
} else {
|
|
value.openInteractionModal(application);
|
|
const obj6 = { type: "interaction_modal", application_id: application.application.id };
|
|
const obj7 = closure_130_1(closure_130_2[7]);
|
|
obj7.track(closure_130_6.OPEN_MODAL, obj6);
|
|
const AndroidPullModeRenderingExperiment = closure_130_0(closure_130_2[8]).AndroidPullModeRenderingExperiment;
|
|
if (AndroidPullModeRenderingExperiment.getCurrentConfig().treatmentId >= 2) {
|
|
let tmp7 = closure_2;
|
|
let tmp8 = application;
|
|
data = getInteractionModalDebugData(application);
|
|
let tmp9 = closure_130_1;
|
|
obj = closure_130_1(closure_130_2[9]);
|
|
let tmp11 = data;
|
|
const obj8 = { category: "interaction_modal", message: "Interaction modal opened", data };
|
|
obj.addBreadcrumb(obj8);
|
|
}
|
|
c4 = 3;
|
|
return { value: "IconComponent", done: null };
|
|
}
|
|
} catch (tmp18) {
|
|
c4 = 3;
|
|
throw tmp18;
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
return obj(...arguments);
|
|
};
|
|
const AnalyticEvents = Constants.AnalyticEvents;
|
|
const interaction_iframe_modal = "interaction_iframe_modal";
|
|
class InteractionModalManager extends AutomaticLifecycleManager {
|
|
constructor() {
|
|
let uiStore;
|
|
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
|
|
require = applyArgumentsResult;
|
|
applyArgumentsResult.iframeModalOpenTimeMs = undefined;
|
|
applyArgumentsResult.actions = {
|
|
INTERACTION_MODAL_CREATE(arg0) {
|
|
function handleInteractionModalCreate() {
|
|
return closure_1_8(...arguments);
|
|
}
|
|
!handleInteractionModalCreate(arg0);
|
|
},
|
|
INTERACTION_IFRAME_MODAL_CREATE(application) {
|
|
require.iframeModalOpenTimeMs = Date.now();
|
|
openInteractionIframeModalDefault(application);
|
|
obj = AnalyticsUtilsDefault;
|
|
const obj2 = { type: interaction_iframe_modal, application_id: application.application.id };
|
|
obj.track(AnalyticEvents.OPEN_MODAL, obj2);
|
|
},
|
|
INTERACTION_IFRAME_MODAL_CLOSE(applicationId) {
|
|
const iframeModalOpenTimeMs = require.iframeModalOpenTimeMs;
|
|
let diff;
|
|
const tmp = require;
|
|
if (null != iframeModalOpenTimeMs) {
|
|
const _Date = Date;
|
|
diff = Date.now() - iframeModalOpenTimeMs;
|
|
}
|
|
obj = AnalyticsUtilsDefault;
|
|
const obj2 = { type: interaction_iframe_modal, application_id: applicationId.applicationId, duration_open_ms: diff };
|
|
obj.track(AnalyticEvents.MODAL_DISMISSED, obj2);
|
|
tmp.iframeModalOpenTimeMs = undefined;
|
|
},
|
|
RPC_APP_DISCONNECTED(application) {
|
|
application = application.application;
|
|
const iFrameModalApplicationId = uiStore.getIFrameModalApplicationId();
|
|
let tmp3 = application.id === iFrameModalApplicationId;
|
|
const iFrameModalKey = uiStore.getIFrameModalKey();
|
|
if (tmp3) {
|
|
tmp3 = null != iFrameModalApplicationId;
|
|
}
|
|
if (tmp3) {
|
|
closeIFrameModalDefault(iFrameModalApplicationId, iFrameModalKey);
|
|
}
|
|
}
|
|
};
|
|
return applyArgumentsResult;
|
|
}
|
|
}
|
|
const interactionModalManager = new InteractionModalManager();
|
|
const result = size.fileFinishedImporting("modules/interaction_components/InteractionModalManager.tsx");
|
|
|
|
export default interactionModalManager;
|
|
export const INTERACTION_IFRAME_MODAL_ANALYTICS_TYPE = "interaction_iframe_modal";
|