// Metro module 12280 (f12281). import CustomActivityLinksStore from "../stores/CustomActivityLinksStore"; import { Endpoints } from "../../../Constants"; import { decodeCustomActivityLink, CustomLinkType } from "../../../_bundle/Module12283"; import { HTTP } from "../../../_bundle/sendRequest"; import Dispatcher from "../../../Dispatcher"; let loadCustomActivityLink, c8480_11; const fetchCustomActivityLink = async function fetchCustomActivityLink(c27281_0, c27281_1) { let body, body2; L24: { L23: { L22: { L19: { if (c27281_0 == null) { break L24; } if (c27281_1 == null) { break L24; } const r36 = decodeCustomActivityLink(c27281_1); if (r36 == null) { break L23; } const type = r36.type; if (CustomLinkType.MANAGED === type) { body2 = (await HTTP.get({ url: Endpoints.APPLICATION_MANAGED_ACTIVITY_LINK(c27281_0, r36.decodedLinkId), rejectWithError: false })).body; break L22; } if (CustomLinkType.QUICK === type) { body = (await HTTP.get({ url: Endpoints.APPLICATION_QUICK_ACTIVITY_LINK(c27281_0, r36.decodedLinkId), rejectWithError: false })).body; break L19; } r36.type; return null; } return body; } return body2; } return null; } return null; }; loadCustomActivityLink = async function loadCustomActivityLink(c27283_0, c27283_1) { let r30, r54; let c27283_3; let c30518_0, c30518_1; L16: { L15: { L14: { c27283_3 = void 0; c30518_0 = c27283_0; c30518_1 = void 0; if (c27283_0 != null && c27283_1 != null) { c30518_1 = await fetchCustomActivityLink(c27283_0, c27283_1); if (c30518_1 == null) { r54 = Promise.reject("fetchCustomActivityLink body is null"); break L15; } Dispatcher.dispatch({ type: "CUSTOM_ACTIVITY_LINK_FETCH_SUCCESS", applicationId: c30518_0, link: c30518_1 }); break L14; } r30 = Promise.reject("appId or linkId null"); break L16; } return void 0; } return r54; } return r30; }; c8480_11 = new Set(); export { fetchCustomActivityLink }; export async function getCustomActivityLinkParams(c27282_0, c27282_1, c27282_2) { let r28, r30, r52; let customId; let c27282_6 = 0; let c30517_0; L20: { L19: { try { c30517_0 = void 0; customId = c27282_2; if (customId == null) { customId = void 0; } if (c27282_1 == null) { r28 = { customId }; break L20; } if (customId != null) { r30 = { customId }; break L19; } c27282_6 = 1; c30517_0 = await fetchCustomActivityLink(c27282_0, c27282_1); r52 = c30517_0 == null ? { customId: void 0 } : { customId: c30517_0.custom_id }; c27282_6 = 0; } catch ($e) { let r24 = $e; if (c27282_6 !== 0) { while (true) { try { c27282_6 = 0; } catch ($e) { r24 = $e; if (c27282_6 === 0) { break; } continue; } return { customId: void 0 }; } } throw r24; } return r52; } return r30; } return r28; } export function getQuickLinkImage(a0) { if (a0 != null) { return `${location.protocol}//${window.GLOBAL_ENV.CDN_HOST}/attachments-quick-links/${a0}`; } } export { loadCustomActivityLink }; export function getOrFetchCustomActivityLink(a0, a1) { let r8 = CustomActivityLinksStore.getOne(a0, a1); if (r8 == null) { const r10 = c8480_11.has(a1); r8 = null; if (!r10) { loadCustomActivityLink(a0, a1); c8480_11.add(a1); r8 = null; } } return r8; }