decord/source/modules/routing/router_utils.tsx

187 lines
6.5 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1222
// Function ID: 1223
// Name: transitionTo
// Dependencies: [676, 3, 1223, 1231, 1234, 2]
// Exports: back, currentRouteHasBackNavigation, forward, getFingerprintLocation, getHistory, getLastRouteChangeSource, getLastRouteChangeSourceLocationStack, hasNavigated, isValidFingerprintRoute, replaceWith, shouldNavigate, transitionToGuild
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 1222 (transitionTo)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import timestampDefault from "timestamp" /* 3 */;
import ComponentDispatcher from "ComponentDispatcher" /* 1231 */;
import set2 from "set" /* 1234 */;
import ME from "ME" /* 676 */;
import _extends from "_extends" /* 1223 */;
2026-07-23 10:11:24 +00:00
2026-07-31 08:44:05 +00:00
function transitionTo(ME, closure_1) {
2026-08-24 06:08:38 +00:00
closure_0 = ME;
2026-08-04 21:03:28 +00:00
let tmp = typeof ME !== "string";
if (typeof ME === "string") {
2026-07-23 10:11:24 +00:00
tmp = !items.some((arg0) => ME.startsWith(arg0));
2026-07-20 16:05:17 +00:00
}
let flag = !tmp;
if (!tmp) {
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
logger.log("" + "assign" + " - route to external path " + ME);
2026-07-20 16:05:17 +00:00
const _window = window;
const _Event = Event;
const event = new Event("beforeunload");
window.dispatchEvent(event);
const _window2 = window;
const _location = window.location;
2026-07-31 08:44:05 +00:00
let obj = _location.assign(ME);
2026-07-20 16:05:17 +00:00
flag = true;
}
2026-07-29 08:29:29 +00:00
if (!flag) {
const _HermesInternal2 = HermesInternal;
2026-08-24 06:08:38 +00:00
logger.log("transitionTo - Transitioning to " + ME);
2026-07-29 08:29:29 +00:00
let source;
if (closure_1 != null) {
source = closure_1.source;
2026-07-20 16:05:17 +00:00
}
let sourceLocationStack;
2026-07-29 08:29:29 +00:00
if (closure_1 != null) {
sourceLocationStack = closure_1.sourceLocationStack;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (null == closure_1) {
2026-07-31 08:44:05 +00:00
_extends.push(ME);
2026-07-20 16:05:17 +00:00
} else {
const _URL = URL;
2026-07-29 08:29:29 +00:00
const _window3 = window;
const _HermesInternal3 = HermesInternal;
2026-07-31 08:44:05 +00:00
const uRL = new URL(ME, "https:" + window.GLOBAL_ENV.WEBAPP_ENDPOINT);
2026-07-29 08:29:29 +00:00
obj = { pathname: null, search: null, hash: null };
({ pathname: obj[0], search: obj[1], hash: obj[2] } = uRL);
const merged = Object.assign(closure_1);
2026-07-23 10:11:24 +00:00
_extends.push(obj);
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
({ Routes: c5, PageAnalyticsLocations: closure_6, ComponentActions: error } = ME);
2026-08-24 06:08:38 +00:00
let closure_8 = new timestampDefault("Routing/Utils");
2026-07-23 10:11:24 +00:00
const items = [ME.RelativeMarketingURLs.DEVELOPER_PORTAL];
_extends = _extends.createMemoryHistory();
let closure_10 = _extends.listen((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
if ("REPLACE" !== arg1) {
callback();
}
});
2026-08-24 06:08:38 +00:00
const tmp3 = new timestampDefault("Routing/Utils");
const result = set.fileFinishedImporting("modules/routing/router_utils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const shouldNavigate = function shouldNavigate() {
2026-08-24 06:08:38 +00:00
const ComponentDispatch = ComponentDispatcher.ComponentDispatch;
2026-07-29 08:29:29 +00:00
return !ComponentDispatch.hasSubscribers(constants2.MODAL_CLOSE);
};
2026-07-20 16:05:17 +00:00
export { transitionTo };
2026-07-29 08:29:29 +00:00
export const transitionToGuild = function transitionToGuild(guildId, channelId, messageId, closure_1) {
2026-08-24 06:08:38 +00:00
logger.log("transitionToGuild - Transitioning to " + JSON.stringify({ guildId, channelId, messageId }));
2026-07-29 08:29:29 +00:00
transitionTo(closure_5.CHANNEL(guildId, channelId, messageId), closure_1);
2026-07-20 16:05:17 +00:00
};
export const currentRouteHasBackNavigation = function currentRouteHasBackNavigation() {
let hasItem = null != closure_3;
if (hasItem) {
2026-08-24 06:08:38 +00:00
const ChannelBackNavigationSources = set2.ChannelBackNavigationSources;
2026-07-20 16:05:17 +00:00
hasItem = ChannelBackNavigationSources.has(closure_3);
}
return hasItem;
};
export const replaceWith = function replaceWith(ME, state) {
2026-08-24 06:08:38 +00:00
closure_0 = ME;
2026-08-04 21:03:28 +00:00
let tmp = typeof ME !== "string";
if (typeof ME === "string") {
2026-07-29 08:29:29 +00:00
tmp = !items.some((arg0) => ME.startsWith(arg0));
}
let flag = !tmp;
if (!tmp) {
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
logger.log("" + "replace" + " - route to external path " + ME);
2026-07-29 08:29:29 +00:00
const _window = window;
const _Event = Event;
const event = new Event("beforeunload");
window.dispatchEvent(event);
const _window2 = window;
const replaced = window.location.replace(ME);
flag = true;
const str5 = window.location;
}
if (!flag) {
const _HermesInternal2 = HermesInternal;
2026-08-24 06:08:38 +00:00
logger.log("Replacing route with " + ME);
2026-08-04 21:03:28 +00:00
if (typeof ME === "string") {
2026-07-29 08:29:29 +00:00
const replaced1 = _extends.replace(ME, state);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const replaced2 = _extends.replace(ME);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
closure_3 = arg2;
2026-07-20 16:05:17 +00:00
}
};
export function getHistory() {
2026-07-23 10:11:24 +00:00
return _extends;
2026-07-20 16:05:17 +00:00
}
export function getLastRouteChangeSource() {
return closure_3;
}
export function getLastRouteChangeSourceLocationStack() {
return closure_4;
}
export const isValidFingerprintRoute = function isValidFingerprintRoute(arg0) {
return true;
};
export const getFingerprintLocation = function getFingerprintLocation(arg0) {
let ACCOUNT_REVERT = arg0;
if (null == arg0) {
2026-07-29 08:29:29 +00:00
let str = _extends.location.pathname;
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
ACCOUNT_REVERT = str;
}
if (ACCOUNT_REVERT.startsWith(closure_5.LOGIN)) {
ACCOUNT_REVERT = constants.LOGIN;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.REGISTER)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.REGISTER;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.INVITE(""))) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.INVITE;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.VERIFY)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.VERIFY;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.DISABLE_EMAIL_NOTIFICATIONS)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.DISABLE_EMAIL_NOTIFICATIONS;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.DISABLE_SERVER_HIGHLIGHT_NOTIFICATIONS)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.DISABLE_SERVER_HIGHLIGHT_NOTIFICATIONS;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.REJECT_IP)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.REJECT_IP;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.REJECT_MFA)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.REJECT_MFA;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.AUTHORIZE_IP)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.AUTHORIZE_IP;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.AUTHORIZE_PAYMENT)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.AUTHORIZE_PAYMENT;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.RESET)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.RESET;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.REPORT)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.REPORT;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.REPORT_SECOND_LOOK)) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.REPORT_SECOND_LOOK;
2026-07-29 08:29:29 +00:00
} else if (ACCOUNT_REVERT.startsWith(obj.ACCOUNT_REVERT(""))) {
2026-07-20 16:05:17 +00:00
ACCOUNT_REVERT = constants.ACCOUNT_REVERT;
}
return ACCOUNT_REVERT;
};
export function hasNavigated() {
return false;
}
export const back = function back() {
2026-08-24 06:08:38 +00:00
const ComponentDispatch = ComponentDispatcher.ComponentDispatch;
2026-07-29 08:29:29 +00:00
if (!hasSubscribersResult) {
2026-08-24 06:08:38 +00:00
c3 = null;
2026-07-23 10:11:24 +00:00
_extends.goBack();
2026-07-20 16:05:17 +00:00
}
};
export const forward = function forward() {
2026-08-24 06:08:38 +00:00
const ComponentDispatch = ComponentDispatcher.ComponentDispatch;
2026-07-29 08:29:29 +00:00
if (!hasSubscribersResult) {
2026-08-24 06:08:38 +00:00
c3 = null;
2026-07-23 10:11:24 +00:00
_extends.goForward();
2026-07-20 16:05:17 +00:00
}
};