Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
/* eslint-disable @typescript-eslint/camelcase */
import { createMemoryHistory } from "history";
import { cockroach } from "@cockroachlabs/crdb-protobuf-client";
import Long from "long";
const history = createMemoryHistory({ initialEntries: ["/transactions"] });
export const routeProps = {
history,
location: {
pathname: "/transactions",
search: "",
hash: "",
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
state: null,
},
match: {
path: "/transactions",
url: "/transactions",
isExact: true,
params: {},
return new Promise((resolve, reject) => {
// Prepare Redux store with in-memory history, and dispatch a navigation event.
// corresponding to the incoming URL.
const basename = params.baseUrl.substring(0, params.baseUrl.length - 1); // Remove trailing slash.
const urlAfterBasename = params.url.substring(basename.length);
const store = configureStore(createMemoryHistory());
store.dispatch(replace(urlAfterBasename));
// Prepare an instance of the application and perform an inital render that will
// cause any async tasks (e.g., data access) to begin.
const routerContext: any = {};
const app = (
);
const renderApp = (): string => {
return renderToString(app);
};
connect(params);
render() {
const history = createMemoryHistory();
return(
//
<div>
{(Meteor.settings.public.gtm)?:''}
</div>
const renderWithRouter = (
ui: React.ReactElement,
{
route = '/',
history = createMemoryHistory({ initialEntries: [route] }),
} = {},
) => ({
...render({ui}),
history,
})
function renderWithRouter(ui, url = '/') {
const history = createMemoryHistory({ initialEntries: [url] });
return {
...render({ui}),
history,
}
}
function createRouterInstallConfig(routerConfig: PoaRouteBootConfig): RouterInstallConfig {
const getContext = () => {
if (routerConfig.context) {
return { ...routerConfig.context(), store: getStore(), actions: getActions() };
}
return { store: getStore(), actions: getActions() };
};
switch (routerConfig.type) {
case RouterType.hash:
return { history: createHashHistory(), routes: routerConfig.routes, getContext };
case RouterType.memory:
return { history: createMemoryHistory(), routes: routerConfig.routes, getContext };
default:
return { history: createBrowserHistory(), routes: routerConfig.routes, getContext };
}
}
export default (props) => new History(createMemoryHistory(props));
async function renderFragment(createApp, routes, url, initialState, timeout, staticMarkup, ignoreTimeout) {
let asyncTime = 0;
let isTimeout = false;
const render = staticMarkup ? renderToStaticMarkup : renderToString;
const history = createMemoryHistory();
history.push(url);
const context = {};
const app = createApp({
history,
initialState,
});
if (!existSSRModel(app)) {
app.model(ssrModel);
}
app.router(options => (
<div>{routes}</div>
));
const asyncActions = getAsyncActions(app);
const branch = findRouteByUrl(routes, url);
if (branch.length === 0) {
return {};
import { createBrowserHistory, createMemoryHistory } from 'history'
import { connectRouter, routerMiddleware } from 'connected-react-router'
import { compose, combineReducers, createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import * as reducers from './reducers'
export const history = __SERVER__
? createMemoryHistory()
: createBrowserHistory()
const composeEnhancers =
(__DEV__ && !__SERVER__ && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
compose
export default initialState =>
createStore(
combineReducers({
router: connectRouter(history),
...reducers,
}),
initialState,
composeEnhancers(applyMiddleware(routerMiddleware(history), thunk)),
)
export const createUnlockStore = (
defaultState = {},
history = createMemoryHistory(),
middlewares = []
) => {
const reducers = {
router: connectRouter(history),
account: accountReducer,
keys: keysReducer,
locks: locksReducer,
modals: modalReducer,
network: networkReducer,
provider: providerReducer,
transactions: transactionsReducer,
currency: currencyReducer,
errors: errorsReducer,
walletStatus: walletStatusReducer,
}