mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-21 22:57:17 +01:00
chore(suite): move env util from suite to trezor package to make it reusable for native
- `getEnvironment` util will be used for message system validation shared between all environments. - Define `Environment` type globally in env-utils instead of analytics where it makes less sense.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
"build:lib": "rimraf lib && yarn tsc --build ./tsconfig.lib.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trezor/env-utils": "workspace:*",
|
||||
"@trezor/utils": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export type App = 'suite' | 'connect';
|
||||
import { Environment } from '@trezor/env-utils';
|
||||
|
||||
export type Environment = 'desktop' | 'web' | 'mobile';
|
||||
export type App = 'suite' | 'connect';
|
||||
|
||||
export type InitOptions = {
|
||||
sessionId?: string;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { App, Environment, Event as AnalyticsEvent } from './types';
|
||||
import type { Environment } from '@trezor/env-utils';
|
||||
import type { App, Event as AnalyticsEvent } from './types';
|
||||
import { getWeakRandomId } from '@trezor/utils';
|
||||
|
||||
export const getTrackingRandomId = () => getWeakRandomId(10);
|
||||
|
||||
@@ -2,5 +2,8 @@
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src/**/*", "package.json"],
|
||||
"compilerOptions": { "outDir": "libDev" },
|
||||
"references": [{ "path": "../utils" }]
|
||||
"references": [
|
||||
{ "path": "../env-utils" },
|
||||
{ "path": "../utils" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ import { getLocales } from 'expo-localization';
|
||||
|
||||
import { EnvUtils } from './types';
|
||||
|
||||
const isWeb = () => false;
|
||||
|
||||
const isDesktop = () => false;
|
||||
|
||||
const getEnvironment = () => 'mobile' as const;
|
||||
|
||||
const getUserAgent = () => '';
|
||||
|
||||
const isChromeOs = () => false;
|
||||
@@ -63,6 +69,9 @@ const getOsNameWeb = () => '';
|
||||
const getOsFamily = (): 'Linux' => 'Linux';
|
||||
|
||||
export const envUtils: EnvUtils = {
|
||||
isWeb,
|
||||
isDesktop,
|
||||
getEnvironment,
|
||||
getUserAgent,
|
||||
isAndroid,
|
||||
isChromeOs,
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import UAParser from 'ua-parser-js';
|
||||
|
||||
import { EnvUtils } from './types';
|
||||
import { EnvUtils, Environment } from './types';
|
||||
|
||||
export const isWeb = () => process.env.SUITE_TYPE === 'web';
|
||||
|
||||
export const isDesktop = () => process.env.SUITE_TYPE === 'desktop';
|
||||
|
||||
export const getEnvironment = (): Environment => {
|
||||
if (isWeb()) return 'web';
|
||||
return 'desktop';
|
||||
};
|
||||
|
||||
let userAgentParser: UAParser;
|
||||
|
||||
@@ -104,6 +113,9 @@ const getOsFamily = () => {
|
||||
const getDeviceType = () => getUserAgentParser().getDevice().type;
|
||||
|
||||
export const envUtils: EnvUtils = {
|
||||
isWeb,
|
||||
isDesktop,
|
||||
getEnvironment,
|
||||
getUserAgent,
|
||||
isAndroid,
|
||||
isChromeOs,
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { envUtils } from './envUtils';
|
||||
|
||||
export type { Environment } from './types';
|
||||
|
||||
export const {
|
||||
isWeb,
|
||||
isDesktop,
|
||||
getEnvironment,
|
||||
getUserAgent,
|
||||
isAndroid,
|
||||
isChromeOs,
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
export type Environment = 'desktop' | 'web' | 'mobile';
|
||||
|
||||
export interface EnvUtils {
|
||||
isWeb: () => boolean;
|
||||
isDesktop: () => boolean;
|
||||
getEnvironment: () => Environment;
|
||||
getUserAgent: () => string;
|
||||
isAndroid: () => boolean;
|
||||
isChromeOs: () => boolean;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { analytics, EventType } from '@trezor/suite-analytics';
|
||||
import { resolveStaticPath } from '@suite-common/suite-utils';
|
||||
|
||||
import { FIRMWARE } from '@firmware-actions/constants';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
|
||||
import { Dispatch, GetState, AppState, AcquiredDevice, FirmwareType } from '@suite-types';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { allowSentryReport, setSentryUser } from '@suite-utils/sentry';
|
||||
import { getEnvironment } from '@suite-utils/env';
|
||||
import { getEnvironment } from '@trezor/env-utils';
|
||||
import type { Dispatch, GetState } from '@suite-types';
|
||||
|
||||
import {
|
||||
|
||||
@@ -20,7 +20,8 @@ import {
|
||||
getDerivationType,
|
||||
} from '@wallet-utils/cardanoUtils';
|
||||
|
||||
import { submitRequestForm as envSubmitRequestForm, isDesktop } from '@suite-utils/env';
|
||||
import { submitRequestForm as envSubmitRequestForm } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import * as formDraftActions from '@wallet-actions/formDraftActions';
|
||||
import {
|
||||
amountToSatoshi,
|
||||
|
||||
@@ -9,8 +9,13 @@ import { useActions, useDevice, useSelector } from '@suite-hooks';
|
||||
import * as guideActions from '@suite-actions/guideActions';
|
||||
import { ViewWrapper, Header, Content } from '@guide-components';
|
||||
import { Rating, FeedbackCategory, FeedbackType, UserData } from '@suite-common/suite-types';
|
||||
import { getEnvironment } from '@suite-utils/env';
|
||||
import { getUserAgent, getWindowHeight, getWindowWidth, getOsName } from '@trezor/env-utils';
|
||||
import {
|
||||
getEnvironment,
|
||||
getUserAgent,
|
||||
getWindowHeight,
|
||||
getWindowWidth,
|
||||
getOsName,
|
||||
} from '@trezor/env-utils';
|
||||
|
||||
const Headline = styled.div`
|
||||
font-size: ${variables.FONT_SIZE.TINY};
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as guideActions from '@suite-actions/guideActions';
|
||||
import { useActions, useSelector } from '@suite-hooks';
|
||||
import { Icon, Link, variables } from '@trezor/components';
|
||||
import { ViewWrapper, Header, Content } from '@guide-components';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { UpdateState } from '@suite-reducers/desktopUpdateReducer';
|
||||
import { getFirmwareVersion } from '@trezor/device-utils';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { isTranslationMode } from '@suite-utils/l10n';
|
||||
import { useSelector } from '@suite-hooks';
|
||||
import { selectBannerMessage } from '@suite-common/message-system';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { findRouteByName } from '@suite-utils/router';
|
||||
import { useActions, useSelector } from '@suite-hooks';
|
||||
import { useCustomBackends } from '@settings-hooks/backends';
|
||||
import { ActionItem } from './components/ActionItem';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { NavTor } from './components/NavTor';
|
||||
import { NavEarlyAccess } from './components/NavEarlyAccess';
|
||||
import { NavNotifications } from './components/NavNotifications';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from '@trezor/components';
|
||||
import { Translation, TroubleshootingTips } from '@suite-components';
|
||||
import { useDevice, useActions } from '@suite-hooks';
|
||||
import * as suiteActions from '@suite-actions/suiteActions';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
|
||||
export const DeviceAcquire = () => {
|
||||
const { isLocked } = useDevice();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Button } from '@trezor/components';
|
||||
import { desktopApi } from '@trezor/suite-desktop-api';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop, isLinux } from '@trezor/env-utils';
|
||||
import { Translation, TroubleshootingTips } from '@suite-components';
|
||||
import UdevDownload from '@suite-components/UdevDownload';
|
||||
import {
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
import { useActions } from '@suite-hooks';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
import type { TrezorDevice } from '@suite-types';
|
||||
import { isLinux } from '@trezor/env-utils';
|
||||
|
||||
// linux web
|
||||
const UdevWeb = () => (
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import React from 'react';
|
||||
import TrezorLink from '@suite-components/TrezorLink';
|
||||
import { Translation } from '@suite-components/Translation';
|
||||
import { isWeb } from '@suite-utils/env';
|
||||
import { isLinux, isAndroid } from '@trezor/env-utils';
|
||||
import { isWeb, isLinux, isAndroid } from '@trezor/env-utils';
|
||||
import { useActions } from '@suite-hooks';
|
||||
import * as routerActions from '@suite-actions/routerActions';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useSelector } from '@suite-hooks';
|
||||
import { selectBannerMessage } from '@suite-common/message-system';
|
||||
import MessageSystemBanner from '@suite-components/Banners/MessageSystemBanner';
|
||||
import TrezorLink from '@suite-components/TrezorLink';
|
||||
import { isWeb } from '@suite-utils/env';
|
||||
import { isWeb } from '@trezor/env-utils';
|
||||
import { TREZOR_URL, SUITE_URL } from '@trezor/urls';
|
||||
import { resolveStaticPath } from '@suite-common/suite-utils';
|
||||
import { GuideButton, GuidePanel } from '@guide-components';
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as modalActions from '@suite-actions/modalActions';
|
||||
import { Account, Network, NetworkSymbol } from '@wallet-types';
|
||||
import { UnavailableCapabilities } from '@trezor/connect';
|
||||
import { AddButton } from './AddButton';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { isDevEnv } from '@suite-common/suite-utils';
|
||||
import { Dispatch } from '@suite-types';
|
||||
import { RequestEnableTorResponse } from '@suite-components/modals/RequestEnableTor';
|
||||
|
||||
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
||||
|
||||
import { Select } from '@trezor/components';
|
||||
import { Translation } from '@suite-components';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
|
||||
import type { Network } from '@wallet-types';
|
||||
import type { BackendOption } from '@settings-hooks/backends';
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { Button, P } from '@trezor/components';
|
||||
import { Modal, Translation } from '@suite-components';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { useSelector } from '@suite-hooks/useSelector';
|
||||
import { getIsTorLoading } from '@suite-utils/tor';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as coinmarketBuyActions from '@wallet-actions/coinmarketBuyActions';
|
||||
import * as routerActions from '@suite-actions/routerActions';
|
||||
import { UseOffersProps, ContextValues } from '@wallet-types/coinmarketBuyOffers';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { useCoinmarketNavigation } from '@wallet-hooks/useCoinmarketNavigation';
|
||||
import { InvityAPIReloadQuotesAfterSeconds } from '@wallet-constants/coinmarket/metadata';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
createReturnLink,
|
||||
getPaymentFrequencyOptions,
|
||||
} from '@wallet-utils/coinmarket/savingsUtils';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { useFormDraft } from '@wallet-hooks/useFormDraft';
|
||||
import { TypedValidationRules } from '@suite-common/wallet-types';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} from '@wallet-constants/coinmarket/savings';
|
||||
import invityAPI, { SavingsTradeKYCFinalStatuses } from '@suite-services/invityAPI';
|
||||
import { createReturnLink } from '@wallet-utils/coinmarket/savingsUtils';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
|
||||
export const useCoinmarketSavingsSetupWaiting = ({
|
||||
selectedAccount,
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as coinmarketCommonActions from '@wallet-actions/coinmarket/coinmarketC
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
import type { FormState } from '@wallet-types/sendForm';
|
||||
import { amountToSatoshi, getFeeLevels } from '@suite-common/wallet-utils';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { useCompose } from './form/useCompose';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { DEFAULT_PAYMENT, DEFAULT_VALUES } from '@suite-common/wallet-constants';
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
KYCStatusPollingIntervalMilliseconds,
|
||||
KYCStatusPollingMaxCount,
|
||||
} from '@wallet-constants/coinmarket/savings';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
|
||||
const coinmarketSavingsMiddleware =
|
||||
(api: MiddlewareAPI<Dispatch, AppState>) =>
|
||||
|
||||
@@ -8,8 +8,7 @@ import { variables } from '@trezor/components';
|
||||
import { SUITE, STORAGE } from '@suite-actions/constants';
|
||||
import { DISCOVERY } from '@wallet-actions/constants';
|
||||
import type { Locale } from '@suite-config/languages';
|
||||
import { isWeb } from '@suite-utils/env';
|
||||
import { getWindowWidth } from '@trezor/env-utils';
|
||||
import { isWeb, getWindowWidth } from '@trezor/env-utils';
|
||||
import { ensureLocale } from '@suite-utils/l10n';
|
||||
import { getNumberFromPixelString, versionUtils } from '@trezor/utils';
|
||||
import type { OAuthServerEnvironment } from '@suite-types/metadata';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CoinjoinBackend, CoinjoinClient } from '@trezor/coinjoin';
|
||||
import { createIpcProxy } from '@trezor/ipc-proxy';
|
||||
import { PartialRecord } from '@trezor/type-utils';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { CoinjoinServerEnvironment } from '@wallet-types/coinjoin';
|
||||
import { NetworkSymbol } from '@wallet-types';
|
||||
import { getCoinjoinConfig } from './config';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getDeviceModel, getFirmwareType, getFirmwareVersion } from '@trezor/device-utils';
|
||||
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { getUserAgent, getScreenWidth, getScreenHeight } from '@trezor/env-utils';
|
||||
import { isDesktop, getUserAgent, getScreenWidth, getScreenHeight } from '@trezor/env-utils';
|
||||
import type { TrezorDevice } from '@suite-types';
|
||||
import type { TransportInfo } from '@trezor/connect';
|
||||
import { GITHUB_REPO_URL } from '@trezor/urls';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { METADATA } from '@suite-actions/constants';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { OAuthServerEnvironment, Tokens } from '@suite-types/metadata';
|
||||
import { extractCredentialsFromAuthorizationFlow, getOauthReceiverUrl } from '@suite-utils/oauth';
|
||||
import { getCodeChallenge } from '@suite-utils/random';
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
WatchSavingTradeItemResponse,
|
||||
FormResponse,
|
||||
} from 'invity-api';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import type { InvityServerEnvironment, InvityServers } from '@suite-common/invity';
|
||||
|
||||
export const SavingsTradeKYCFinalStatuses: SavingsKYCStatus[] = ['Failed', 'Verified'];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { toWei } from 'web3-utils';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import type { State } from '@wallet-reducers/settingsReducer';
|
||||
import type { CustomBackend, BlockbookUrl } from '@wallet-types/backend';
|
||||
import type { Network, Account, Discovery } from '@wallet-types';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { desktopApi } from '@trezor/suite-desktop-api';
|
||||
|
||||
import { isWeb, isDesktop } from '@suite-utils/env';
|
||||
import { isWeb, isDesktop } from '@trezor/env-utils';
|
||||
import { useActions } from '@suite-hooks';
|
||||
import * as protocolActions from '@suite-actions/protocolActions';
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ import { TorStatus } from '@suite-types';
|
||||
import { useActions, useSelector } from '@suite-hooks';
|
||||
import { getIsTorDomain } from '@suite-utils/tor';
|
||||
import * as suiteActions from '@suite-actions/suiteActions';
|
||||
import { isWeb, isDesktop } from '@suite-utils/env';
|
||||
import { getLocationHostname } from '@trezor/env-utils';
|
||||
import { isWeb, isDesktop, getLocationHostname } from '@trezor/env-utils';
|
||||
import { selectTorState } from '@suite-reducers/suiteReducer';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import type { GuideAction } from '@suite-actions/guideActions';
|
||||
import type { Route } from '@suite-constants/routes';
|
||||
|
||||
import { analyticsActions } from '@suite-common/analytics';
|
||||
import { Environment } from '@trezor/analytics';
|
||||
import type { ObjectValues } from '@trezor/type-utils';
|
||||
import type { UiEvent, DeviceEvent, TransportEvent, BlockchainEvent } from '@trezor/connect';
|
||||
import { transactionsActions } from '@suite-common/wallet-core';
|
||||
@@ -32,7 +31,7 @@ export type { ExtendedMessageDescriptor } from '@suite-components/Translation/co
|
||||
export type { AppState } from '@suite/reducers/store';
|
||||
export type { SuiteThemeColors } from '@trezor/components';
|
||||
export type { PrerequisiteType } from '@suite-utils/prerequisites';
|
||||
export type { Route, Environment as EnvironmentType };
|
||||
export type { Route };
|
||||
export type {
|
||||
ButtonRequest,
|
||||
ExtendedDevice,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as env from '@suite-utils/env';
|
||||
|
||||
import * as envUtils from '@trezor/env-utils';
|
||||
|
||||
import * as messageSystem from '../messageSystem';
|
||||
@@ -117,7 +115,7 @@ describe('Message system utils', () => {
|
||||
jest.spyOn(envUtils, 'getOsName').mockImplementation(() => f.osName);
|
||||
userAgentGetter.mockReturnValue(f.userAgent);
|
||||
// @ts-expect-error
|
||||
jest.spyOn(env, 'getEnvironment').mockImplementation(() => f.environment);
|
||||
jest.spyOn(envUtils, 'getEnvironment').mockImplementation(() => f.environment);
|
||||
process.env.VERSION = f.suiteVersion;
|
||||
|
||||
// @ts-expect-error
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
import { Environment } from '@trezor/analytics';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { desktopApi, SuiteThemeVariant } from '@trezor/suite-desktop-api';
|
||||
|
||||
export const isWeb = () => process.env.SUITE_TYPE === 'web';
|
||||
|
||||
export const isDesktop = () => process.env.SUITE_TYPE === 'desktop';
|
||||
|
||||
export const getEnvironment = (): Environment => {
|
||||
if (isWeb()) return 'web';
|
||||
return 'desktop';
|
||||
};
|
||||
|
||||
export const submitRequestForm = async (
|
||||
formMethod: 'GET' | 'POST' | 'IFRAME',
|
||||
formAction: string,
|
||||
|
||||
@@ -2,13 +2,8 @@ import { Account, Discovery } from '@wallet-types';
|
||||
import { DISCOVERY } from '@wallet-actions/constants';
|
||||
import { SUITE } from '@suite-actions/constants';
|
||||
import { AppState, TrezorDevice } from '@suite-types';
|
||||
import { getEnvironment } from '@suite-utils/env';
|
||||
import { getIsTorEnabled } from '@suite-utils/tor';
|
||||
|
||||
import { LogEntry } from '@suite-common/logger';
|
||||
import { DEVICE } from '@trezor/connect';
|
||||
import { getCustomBackends } from '@suite-common/wallet-utils';
|
||||
import {
|
||||
getEnvironment,
|
||||
getBrowserName,
|
||||
getBrowserVersion,
|
||||
getOsName,
|
||||
@@ -19,6 +14,11 @@ import {
|
||||
getWindowHeight,
|
||||
getWindowWidth,
|
||||
} from '@trezor/env-utils';
|
||||
import { getIsTorEnabled } from '@suite-utils/tor';
|
||||
|
||||
import { LogEntry } from '@suite-common/logger';
|
||||
import { DEVICE } from '@trezor/connect';
|
||||
import { getCustomBackends } from '@suite-common/wallet-utils';
|
||||
import {
|
||||
getBootloaderHash,
|
||||
getBootloaderVersion,
|
||||
|
||||
@@ -6,13 +6,19 @@ import {
|
||||
getFirmwareVersion,
|
||||
} from '@trezor/device-utils';
|
||||
|
||||
import { getEnvironment } from '@suite-utils/env';
|
||||
import { getBrowserName, getBrowserVersion, getOsName, getOsVersion } from '@trezor/env-utils';
|
||||
import {
|
||||
getEnvironment,
|
||||
getBrowserName,
|
||||
getBrowserVersion,
|
||||
getOsName,
|
||||
getOsVersion,
|
||||
Environment as EnvironmentType,
|
||||
} from '@trezor/env-utils';
|
||||
|
||||
import type { TransportInfo } from '@trezor/connect';
|
||||
|
||||
import type { Network } from '@wallet-types';
|
||||
import type { EnvironmentType, TrezorDevice } from '@suite-types';
|
||||
import type { TrezorDevice } from '@suite-types';
|
||||
import type {
|
||||
Duration,
|
||||
MessageSystem,
|
||||
|
||||
@@ -5,8 +5,7 @@ import { AppState } from '@suite-types';
|
||||
import { AmountLimits } from '@wallet-types/coinmarketBuyForm';
|
||||
import { BuyTrade, BuyTradeQuoteRequest, BuyTradeStatus } from 'invity-api';
|
||||
import { invityApiSymbolToSymbol } from '@wallet-utils/coinmarket/coinmarketUtils';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { getLocationOrigin } from '@trezor/env-utils';
|
||||
import { isDesktop, getLocationOrigin } from '@trezor/env-utils';
|
||||
|
||||
// loop through quotes and if all quotes are either with error below minimum or over maximum, return the limits
|
||||
export function getAmountLimits(
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import type { CurrentFiatRates } from '@wallet-types/fiatRates';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import type { PaymentFrequencyOption } from '@wallet-types/coinmarketCommonTypes';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { desktopApi } from '@trezor/suite-desktop-api';
|
||||
import { Translation } from '@suite-components/Translation';
|
||||
import type { PaymentFrequencyTranslationId } from '@wallet-types/coinmarketSavingsSetup';
|
||||
|
||||
@@ -3,8 +3,7 @@ import { desktopApi } from '@trezor/suite-desktop-api';
|
||||
import { Account } from '@wallet-types';
|
||||
import { AmountLimits } from '@wallet-types/coinmarketSellForm';
|
||||
import { SellFiatTrade, SellFiatTradeQuoteRequest, SellTradeStatus } from 'invity-api';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { getLocationOrigin } from '@trezor/env-utils';
|
||||
import { isDesktop, getLocationOrigin } from '@trezor/env-utils';
|
||||
import { ComposedTransactionInfo } from '@wallet-reducers/coinmarketReducer';
|
||||
|
||||
// loop through quotes and if all quotes are either with error below minimum or over maximum, return the limits
|
||||
|
||||
@@ -4,7 +4,7 @@ import { SUITE_MOBILE_APP_STORE, SUITE_MOBILE_PLAY_STORE, SUITE_URL } from '@tre
|
||||
import { EventType, analytics } from '@trezor/suite-analytics';
|
||||
import { Button, Icon, Image, Tooltip, variables } from '@trezor/components';
|
||||
import { Translation, QrCode, TrezorLink } from '@suite-components';
|
||||
import { isWeb } from '@suite-utils/env';
|
||||
import { isWeb } from '@trezor/env-utils';
|
||||
import { useLayoutSize } from '@suite-hooks/useLayoutSize';
|
||||
import { DESKTOP_HORIZONTAL_PADDINGS, MOBILE_HORIZONTAL_PADDINGS } from '@suite-constants/layout';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
||||
import { Translation } from '@suite-components';
|
||||
import { Icon, useTheme, CollapsibleCard } from '@trezor/components';
|
||||
import { useSelector } from '@suite-hooks';
|
||||
import { isDesktop, isWeb } from '@suite-utils/env';
|
||||
import { isDesktop, isWeb } from '@trezor/env-utils';
|
||||
import { TorSection } from './TorSection';
|
||||
import { getIsTorEnabled } from '@suite-utils/tor';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
|
||||
import { SettingsLayout } from '@settings-components';
|
||||
import { SettingsSection } from '@suite-components/Settings';
|
||||
import { isWeb } from '@suite-utils/env';
|
||||
import { isWeb } from '@trezor/env-utils';
|
||||
|
||||
import { TranslationMode } from './TranslationMode';
|
||||
import { GithubIssue } from './GithubIssue';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { Checkbox } from '@trezor/components';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { useSelector, useActions } from '@suite-hooks';
|
||||
import * as suiteActions from '@suite-actions/suiteActions';
|
||||
import { DebugModeOptions } from '@suite/reducers/suite/suiteReducer';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { SettingsLayout } from '@settings-components';
|
||||
import { SettingsSection } from '@suite-components/Settings';
|
||||
import { Translation } from '@suite-components';
|
||||
import { useLayoutSize, useSelector } from '@suite-hooks';
|
||||
import { isDesktop, isWeb } from '@suite-utils/env';
|
||||
import { isDesktop, isWeb } from '@trezor/env-utils';
|
||||
|
||||
import { Language } from './Language';
|
||||
import { Fiat } from './Fiat';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { DATA_URL, HELP_CENTER_TOR_URL, GITHUB_BRIDGE_CHANGELOG_URL } from '@tre
|
||||
import { Translation, TrezorLink, Modal, Metadata } from '@suite-components';
|
||||
import { Button, P, Link, Select, Image, useTheme, variables, Loader } from '@trezor/components';
|
||||
import * as routerActions from '@suite-actions/routerActions';
|
||||
import { isDesktop, isWeb } from '@suite-utils/env';
|
||||
import { isDesktop, isWeb } from '@trezor/env-utils';
|
||||
import { useSelector, useActions } from '@suite-hooks';
|
||||
import { selectTorState } from '@suite-reducers/suiteReducer';
|
||||
import { DeviceModel } from '@trezor/device-utils';
|
||||
|
||||
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
||||
|
||||
import { Button, Note } from '@trezor/components';
|
||||
import { Translation } from '@suite-components';
|
||||
import { isDesktop } from '@suite-utils/env';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { useCoinmarketSpendContext } from '@wallet-hooks/useCoinmarketSpend';
|
||||
import { NoProviders, Wrapper } from '@wallet-views/coinmarket';
|
||||
import { CoinmarketSkeleton } from '@wallet-views/coinmarket/skeleton';
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
"@reduxjs/toolkit": "1.9.5",
|
||||
"@suite-common/metadata-types": "workspace:*",
|
||||
"@suite-common/wallet-config": "workspace:*",
|
||||
"@trezor/analytics": "workspace:*",
|
||||
"@trezor/connect": "workspace:*",
|
||||
"@trezor/env-utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Environment } from '@trezor/analytics';
|
||||
import { Environment } from '@trezor/env-utils';
|
||||
|
||||
/**
|
||||
* A group of Guide content.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"references": [
|
||||
{ "path": "../metadata-types" },
|
||||
{ "path": "../wallet-config" },
|
||||
{ "path": "../../packages/analytics" },
|
||||
{ "path": "../../packages/connect" }
|
||||
{ "path": "../../packages/connect" },
|
||||
{ "path": "../../packages/env-utils" }
|
||||
]
|
||||
}
|
||||
|
||||
29
yarn.lock
29
yarn.lock
@@ -4559,26 +4559,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@reduxjs/toolkit@npm:1.9.2":
|
||||
version: 1.9.2
|
||||
resolution: "@reduxjs/toolkit@npm:1.9.2"
|
||||
dependencies:
|
||||
immer: ^9.0.16
|
||||
redux: ^4.2.0
|
||||
redux-thunk: ^2.4.2
|
||||
reselect: ^4.1.7
|
||||
peerDependencies:
|
||||
react: ^16.9.0 || ^17.0.0 || ^18
|
||||
react-redux: ^7.2.1 || ^8.0.2
|
||||
peerDependenciesMeta:
|
||||
react:
|
||||
optional: true
|
||||
react-redux:
|
||||
optional: true
|
||||
checksum: 8eac4fb65aa5ef969545e4d72a81c5a7679935d08df8cc4dd955362beb0b0b8d3cb1e2252df256a50bbe0c887b797a0e2e271656d6b50cbec5d26f61da3a80d4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@reduxjs/toolkit@npm:1.9.5":
|
||||
version: 1.9.5
|
||||
resolution: "@reduxjs/toolkit@npm:1.9.5"
|
||||
@@ -6366,8 +6346,8 @@ __metadata:
|
||||
"@reduxjs/toolkit": 1.9.5
|
||||
"@suite-common/metadata-types": "workspace:*"
|
||||
"@suite-common/wallet-config": "workspace:*"
|
||||
"@trezor/analytics": "workspace:*"
|
||||
"@trezor/connect": "workspace:*"
|
||||
"@trezor/env-utils": "workspace:*"
|
||||
bignumber.js: ^9.1.1
|
||||
jest: ^26.6.3
|
||||
typescript: 4.9.5
|
||||
@@ -7410,6 +7390,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@trezor/analytics@workspace:packages/analytics"
|
||||
dependencies:
|
||||
"@trezor/env-utils": "workspace:*"
|
||||
"@trezor/utils": "workspace:*"
|
||||
jest: ^26.6.3
|
||||
typescript: 4.9.5
|
||||
@@ -19965,7 +19946,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"immer@npm:9.0.21, immer@npm:^9.0.16, immer@npm:^9.0.21":
|
||||
"immer@npm:9.0.21, immer@npm:^9.0.21":
|
||||
version: 9.0.21
|
||||
resolution: "immer@npm:9.0.21"
|
||||
checksum: 70e3c274165995352f6936695f0ef4723c52c92c92dd0e9afdfe008175af39fa28e76aafb3a2ca9d57d1fb8f796efc4dd1e1cc36f18d33fa5b74f3dfb0375432
|
||||
@@ -29040,7 +29021,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"redux@npm:^4.0.0, redux@npm:^4.0.5, redux@npm:^4.2.0, redux@npm:^4.2.1":
|
||||
"redux@npm:^4.0.0, redux@npm:^4.0.5, redux@npm:^4.2.1":
|
||||
version: 4.2.1
|
||||
resolution: "redux@npm:4.2.1"
|
||||
dependencies:
|
||||
@@ -29325,7 +29306,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"reselect@npm:^4.0.0, reselect@npm:^4.1.7, reselect@npm:^4.1.8":
|
||||
"reselect@npm:^4.0.0, reselect@npm:^4.1.8":
|
||||
version: 4.1.8
|
||||
resolution: "reselect@npm:4.1.8"
|
||||
checksum: a4ac87cedab198769a29be92bc221c32da76cfdad6911eda67b4d3e7136dca86208c3b210e31632eae31ebd2cded18596f0dd230d3ccc9e978df22f233b5583e
|
||||
|
||||
Reference in New Issue
Block a user