Update content of files

This commit is contained in:
GitHub Action 2023-09-15 09:59:27 +00:00
parent fabc8e2853
commit b07ae27e51
543 changed files with 70745 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,117 @@
import { FC, createContext, useEffect, useMemo, useState } from 'react';
import { hexToRgb } from 'utils/common/color';
import { isIOS, isLinux, isMacos, isWindows } from 'utils/common/common';
import { setCSSVariable } from 'utils/common/css';
const WebApp = window.Telegram.WebApp;
let resolvedTheme: 'apple' | 'material';
if (WebApp.platform) {
resolvedTheme =
WebApp.platform === 'macos' || WebApp.platform === 'ios'
? 'apple'
: 'material';
} else if (isIOS() || isMacos()) {
resolvedTheme = 'apple';
} else {
resolvedTheme = 'material';
}
function setOwnCssVariables() {
if (WebApp.themeParams.button_color) {
setCSSVariable(
document.documentElement,
'second-button-color',
hexToRgb({
hex: WebApp.themeParams.button_color,
opacity: 0.1,
}) as string,
);
}
if (WebApp.themeParams.text_color) {
setCSSVariable(
document.documentElement,
'monochrome-overlay-color',
hexToRgb({
hex: WebApp.themeParams.text_color,
opacity: 0.12,
}) as string,
);
}
if (WebApp.themeParams.hint_color) {
setCSSVariable(
document.documentElement,
'skeleton-color',
hexToRgb({
hex: WebApp.themeParams.hint_color,
opacity: 0.16,
}) as string,
);
}
if (WebApp.themeParams.bg_color) {
setCSSVariable(
document.documentElement,
'tg-theme-bg-color-rgb',
hexToRgb({
hex: WebApp.themeParams.bg_color,
asArray: true,
}) as string,
);
}
}
setOwnCssVariables();
export const AppearanceContext = createContext<{
theme: 'apple' | 'material';
colorScheme: 'light' | 'dark';
}>({
colorScheme: WebApp.colorScheme,
theme: resolvedTheme,
});
export const AppearanceProvider: FC<{ theme?: 'apple' | 'material' }> = ({
children,
theme = resolvedTheme,
}) => {
const [colorScheme, setColorScheme] = useState<'light' | 'dark'>(
WebApp.colorScheme,
);
useEffect(() => {
document.body.classList.add(theme);
if (isMacos() || isWindows() || isLinux()) {
document.body.classList.add('desktop');
}
// eslint-disable-next-line
}, []);
useEffect(() => {
WebApp.onEvent('themeChanged', () => {
setOwnCssVariables();
setColorScheme(WebApp.colorScheme);
});
}, []);
useEffect(() => {
document.body.setAttribute('data-color-scheme', colorScheme);
}, [colorScheme]);
const value = useMemo(() => {
return {
theme,
colorScheme,
};
}, [colorScheme, theme]);
return (
<AppearanceContext.Provider value={value}>
{children}
</AppearanceContext.Provider>
);
};

View file

@ -0,0 +1,348 @@
/* tslint:disable */
/* eslint-disable */
/**
* events_gateway/events_gateway.proto
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: version not set
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
// @ts-ignore
import {
BASE_PATH,
BaseAPI,
COLLECTION_FORMATS,
RequestArgs,
RequiredError,
} from './base';
// Some imports not used depending on template conditions
// @ts-ignore
import {
DUMMY_BASE_URL,
assertParamExists,
createRequestFunction,
serializeDataIfNeeded,
setApiKeyToObject,
setBasicAuthToObject,
setBearerAuthToObject,
setOAuthToObject,
setSearchParams,
toPathString,
} from './common';
import { Configuration } from './configuration';
/**
*
* @export
* @interface EventsGatewayGenericEvent
*/
export interface EventsGatewayGenericEvent {
/**
*
* @type {string}
* @memberof EventsGatewayGenericEvent
*/
name?: string;
/**
*
* @type {number}
* @memberof EventsGatewayGenericEvent
*/
version?: number;
/**
*
* @type {string}
* @memberof EventsGatewayGenericEvent
*/
userId?: string;
/**
*
* @type {string}
* @memberof EventsGatewayGenericEvent
*/
clientId?: string;
/**
*
* @type {string}
* @memberof EventsGatewayGenericEvent
*/
traceId?: string;
/**
*
* @type {{ [key: string]: EventsGatewayProperty; }}
* @memberof EventsGatewayGenericEvent
*/
eventProperties?: { [key: string]: EventsGatewayProperty };
/**
*
* @type {string}
* @memberof EventsGatewayGenericEvent
*/
clientTime?: string;
/**
*
* @type {string}
* @memberof EventsGatewayGenericEvent
*/
idempotencyKey?: string;
/**
*
* @type {boolean}
* @memberof EventsGatewayGenericEvent
*/
unsafe?: boolean;
}
/**
*
* @export
* @interface EventsGatewayNewEventsRequest
*/
export interface EventsGatewayNewEventsRequest {
/**
*
* @type {Array<EventsGatewayGenericEvent>}
* @memberof EventsGatewayNewEventsRequest
*/
events?: Array<EventsGatewayGenericEvent>;
}
/**
*
* @export
* @interface EventsGatewayNewEventsResponse
*/
export interface EventsGatewayNewEventsResponse {
/**
*
* @type {{ [key: string]: string; }}
* @memberof EventsGatewayNewEventsResponse
*/
fails?: { [key: string]: string };
}
/**
*
* @export
* @interface EventsGatewayProperty
*/
export interface EventsGatewayProperty {
/**
*
* @type {string}
* @memberof EventsGatewayProperty
*/
value?: string;
/**
*
* @type {string}
* @memberof EventsGatewayProperty
*/
type?: string;
/**
*
* @type {string}
* @memberof EventsGatewayProperty
*/
kind?: string;
}
/**
*
* @export
* @interface ProtobufAny
*/
export interface ProtobufAny {
[key: string]: object | any;
/**
*
* @type {string}
* @memberof ProtobufAny
*/
'@type'?: string;
}
/**
*
* @export
* @interface RpcStatus
*/
export interface RpcStatus {
/**
*
* @type {number}
* @memberof RpcStatus
*/
code?: number;
/**
*
* @type {string}
* @memberof RpcStatus
*/
message?: string;
/**
*
* @type {Array<ProtobufAny>}
* @memberof RpcStatus
*/
details?: Array<ProtobufAny>;
}
/**
* EventsGatewayApi - axios parameter creator
* @export
*/
export const EventsGatewayApiAxiosParamCreator = function (
configuration?: Configuration,
) {
return {
/**
*
* @summary Registrate new events with batch
* @param {EventsGatewayNewEventsRequest} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
eventsGatewayNewEvents: async (
body: EventsGatewayNewEventsRequest,
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
// verify required parameter 'body' is not null or undefined
assertParamExists('eventsGatewayNewEvents', 'body', body);
const localVarPath = `/v1/events`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'POST',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
localVarRequestOptions.data = serializeDataIfNeeded(
body,
localVarRequestOptions,
configuration,
);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* EventsGatewayApi - functional programming interface
* @export
*/
export const EventsGatewayApiFp = function (configuration?: Configuration) {
const localVarAxiosParamCreator =
EventsGatewayApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Registrate new events with batch
* @param {EventsGatewayNewEventsRequest} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async eventsGatewayNewEvents(
body: EventsGatewayNewEventsRequest,
options?: AxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise<EventsGatewayNewEventsResponse>
> {
const localVarAxiosArgs =
await localVarAxiosParamCreator.eventsGatewayNewEvents(body, options);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
};
};
/**
* EventsGatewayApi - factory interface
* @export
*/
export const EventsGatewayApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance,
) {
const localVarFp = EventsGatewayApiFp(configuration);
return {
/**
*
* @summary Registrate new events with batch
* @param {EventsGatewayNewEventsRequest} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
eventsGatewayNewEvents(
body: EventsGatewayNewEventsRequest,
options?: any,
): AxiosPromise<EventsGatewayNewEventsResponse> {
return localVarFp
.eventsGatewayNewEvents(body, options)
.then((request) => request(axios, basePath));
},
};
};
/**
* EventsGatewayApi - object-oriented interface
* @export
* @class EventsGatewayApi
* @extends {BaseAPI}
*/
export class EventsGatewayApi extends BaseAPI {
/**
*
* @summary Registrate new events with batch
* @param {EventsGatewayNewEventsRequest} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof EventsGatewayApi
*/
public eventsGatewayNewEvents(
body: EventsGatewayNewEventsRequest,
options?: AxiosRequestConfig,
) {
return EventsGatewayApiFp(this.configuration)
.eventsGatewayNewEvents(body, options)
.then((request) => request(this.axios, this.basePath));
}
}

View file

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* events_gateway/events_gateway.proto
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: version not set
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
import { Configuration } from './configuration';
export const BASE_PATH = 'http://localhost'.replace(/\/+$/, '');
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ',',
ssv: ' ',
tsv: '\t',
pipes: '|',
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(
configuration?: Configuration,
protected basePath: string = BASE_PATH,
protected axios: AxiosInstance = globalAxios,
) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
}
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: 'RequiredError' = 'RequiredError';
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,183 @@
/* tslint:disable */
/* eslint-disable */
/**
* events_gateway/events_gateway.proto
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: version not set
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AxiosInstance, AxiosResponse } from 'axios';
import { RequestArgs, RequiredError } from './base';
import { Configuration } from './configuration';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com';
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (
functionName: string,
paramName: string,
paramValue: unknown,
) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
);
}
};
/**
*
* @export
*/
export const setApiKeyToObject = async function (
object: any,
keyParamName: string,
configuration?: Configuration,
) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue =
typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};
/**
*
* @export
*/
export const setBasicAuthToObject = function (
object: any,
configuration?: Configuration,
) {
if (configuration && (configuration.username || configuration.password)) {
object['auth'] = {
username: configuration.username,
password: configuration.password,
};
}
};
/**
*
* @export
*/
export const setBearerAuthToObject = async function (
object: any,
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const accessToken =
typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + accessToken;
}
};
/**
*
* @export
*/
export const setOAuthToObject = async function (
object: any,
name: string,
scopes: string[],
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue =
typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;
}
};
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
};
/**
*
* @export
*/
export const serializeDataIfNeeded = function (
value: any,
requestOptions: any,
configuration?: Configuration,
) {
const nonString = typeof value !== 'string';
const needsSerialization =
nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: value || '';
};
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash;
};
/**
*
* @export
*/
export const createRequestFunction = function (
axiosArgs: RequestArgs,
globalAxios: AxiosInstance,
BASE_PATH: string,
configuration?: Configuration,
) {
return <T = unknown, R = AxiosResponse<T>>(
axios: AxiosInstance = globalAxios,
basePath: string = BASE_PATH,
) => {
const axiosRequestArgs = {
...axiosArgs.options,
url: (configuration?.basePath || basePath) + axiosArgs.url,
};
return axios.request<T, R>(axiosRequestArgs);
};
};

View file

@ -0,0 +1,16 @@
import axios from 'axios';
import { EventsGatewayApi } from './generated';
const axiosInstance = axios.create();
const config = {
basePath: 'https://events-gateway.ncdev.site',
isJsonMime: () => false,
};
const API = {
EventsGateway: new EventsGatewayApi(config, '', axiosInstance),
};
export default API;

View file

@ -0,0 +1,60 @@
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios';
import API from 'api/wallet';
export function interceptors({
authHeaderPrefix = 'Bearer ',
customErrorHandler,
}: {
authHeaderPrefix?: string;
customErrorHandler: (error: AxiosError) => unknown;
}) {
const onRequest = (config: AxiosRequestConfig): AxiosRequestConfig => {
const authToken = sessionStorage.getItem('authToken') || '';
if (authToken) {
return {
...config,
headers: {
...config.headers,
Authorization: `${authHeaderPrefix}${authToken}`,
},
};
}
return config;
};
const onResponseError = async (
error: AxiosError,
axiosInstance: AxiosInstance = axios,
) => {
if (!error.response) return Promise.reject(error);
if (error.response.status === 401) {
if (error.response.data.code === 'token_corrupted') {
window.Telegram.WebApp.close();
} else if (window.Telegram.WebApp.initData) {
try {
const response = await API.Users.authUser({
web_view_init_data_raw: window.Telegram.WebApp.initData,
});
error.config.headers = {
...error.config.headers,
Authorization: `${authHeaderPrefix}${response.data.value}`,
};
sessionStorage.setItem('authToken', response.data.value);
return axiosInstance(error.config);
} catch (_error) {
return Promise.reject(_error);
}
} else {
return Promise.reject(error);
}
} else if (customErrorHandler) {
return customErrorHandler(error);
} else {
return Promise.reject(error);
}
};
return { onRequest, onResponseError };
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
/* tslint:disable */
/* eslint-disable */
/**
* P2P Market
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
export const BASE_PATH = "http://localhost:17001".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,138 @@
/* tslint:disable */
/* eslint-disable */
/**
* P2P Market
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
import { RequiredError, RequestArgs } from "./base";
import { AxiosInstance, AxiosResponse } from 'axios';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

View file

@ -0,0 +1,101 @@
/* tslint:disable */
/* eslint-disable */
/**
* P2P Market
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface ConfigurationParameters {
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
username?: string;
password?: string;
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* base options for axios calls
*
* @type {any}
* @memberof Configuration
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
this.baseOptions = param.baseOptions;
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View file

@ -0,0 +1,971 @@
/* tslint:disable */
/* eslint-disable */
/**
* Exchange Rate Provider
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
// @ts-ignore
import {
BASE_PATH,
BaseAPI,
COLLECTION_FORMATS,
RequestArgs,
RequiredError,
} from './base';
// Some imports not used depending on template conditions
// @ts-ignore
import {
DUMMY_BASE_URL,
assertParamExists,
createRequestFunction,
serializeDataIfNeeded,
setApiKeyToObject,
setBasicAuthToObject,
setBearerAuthToObject,
setOAuthToObject,
setSearchParams,
toPathString,
} from './common';
import { Configuration } from './configuration';
/**
*
* @export
* @interface ApiUsage
*/
export interface ApiUsage {
/**
*
* @type {RequestsUsage}
* @memberof ApiUsage
*/
current_minute: RequestsUsage;
/**
*
* @type {CreditsUsage}
* @memberof ApiUsage
*/
current_day: CreditsUsage;
/**
*
* @type {CreditsUsage}
* @memberof ApiUsage
*/
current_month: CreditsUsage;
}
/**
*
* @export
* @interface ApplicationInfo
*/
export interface ApplicationInfo {
/**
*
* @type {string}
* @memberof ApplicationInfo
*/
app_name: string;
/**
*
* @type {string}
* @memberof ApplicationInfo
*/
app_version: string;
/**
*
* @type {string}
* @memberof ApplicationInfo
*/
host_name?: string;
/**
*
* @type {string}
* @memberof ApplicationInfo
*/
app_time: string;
}
/**
*
* @export
* @interface CreditsUsage
*/
export interface CreditsUsage {
/**
*
* @type {number}
* @memberof CreditsUsage
*/
credits_used: number;
/**
*
* @type {number}
* @memberof CreditsUsage
*/
credits_left: number;
}
/**
*
* @export
* @interface HealthStatusResponse
*/
export interface HealthStatusResponse {
/**
*
* @type {string}
* @memberof HealthStatusResponse
*/
instance_id: string;
/**
*
* @type {{ [key: string]: string; }}
* @memberof HealthStatusResponse
*/
resources_status: { [key: string]: string };
}
export const HealthStatusResponseResourcesStatusEnum = {
Ok: 'OK',
ConnectionFailed: 'CONNECTION_FAILED',
} as const;
export type HealthStatusResponseResourcesStatusEnum =
typeof HealthStatusResponseResourcesStatusEnum[keyof typeof HealthStatusResponseResourcesStatusEnum];
/**
*
* @export
* @interface KeyInfo
*/
export interface KeyInfo {
/**
*
* @type {ApiUsage}
* @memberof KeyInfo
*/
usage: ApiUsage;
}
/**
* Response payload, present if status is SUCCESS
* @export
* @interface RateDto
*/
export interface RateDto {
/**
*
* @type {string}
* @memberof RateDto
*/
base: string;
/**
*
* @type {string}
* @memberof RateDto
*/
quote: string;
/**
*
* @type {string}
* @memberof RateDto
*/
rate: string;
/**
*
* @type {string}
* @memberof RateDto
*/
lastUpdateDateTime: string;
}
/**
*
* @export
* @interface RequestsUsage
*/
export interface RequestsUsage {
/**
*
* @type {number}
* @memberof RequestsUsage
*/
requests_made: number;
/**
*
* @type {number}
* @memberof RequestsUsage
*/
requests_left: number;
}
/**
*
* @export
* @interface RestDataResponseGetRateStatusRateDto
*/
export interface RestDataResponseGetRateStatusRateDto {
/**
* Operation result status, always present
* @type {string}
* @memberof RestDataResponseGetRateStatusRateDto
*/
status: RestDataResponseGetRateStatusRateDtoStatusEnum;
/**
* Verbose reason of non-success result
* @type {string}
* @memberof RestDataResponseGetRateStatusRateDto
*/
message?: string;
/**
*
* @type {RateDto}
* @memberof RestDataResponseGetRateStatusRateDto
*/
data?: RateDto;
}
export const RestDataResponseGetRateStatusRateDtoStatusEnum = {
Success: 'SUCCESS',
UnsupportedBaseCurrency: 'UNSUPPORTED_BASE_CURRENCY',
UnsupportedQuoteCurrency: 'UNSUPPORTED_QUOTE_CURRENCY',
RateIsNotAvailable: 'RATE_IS_NOT_AVAILABLE',
} as const;
export type RestDataResponseGetRateStatusRateDtoStatusEnum =
typeof RestDataResponseGetRateStatusRateDtoStatusEnum[keyof typeof RestDataResponseGetRateStatusRateDtoStatusEnum];
/**
* ApplicationRestApi - axios parameter creator
* @export
*/
export const ApplicationRestApiAxiosParamCreator = function (
configuration?: Configuration,
) {
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCoinMarketCapKeyInfo: async (
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
const localVarPath = `/system/coin-market-cap/key-info`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStatus: async (
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
const localVarPath = `/system/info`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* ApplicationRestApi - functional programming interface
* @export
*/
export const ApplicationRestApiFp = function (configuration?: Configuration) {
const localVarAxiosParamCreator =
ApplicationRestApiAxiosParamCreator(configuration);
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCoinMarketCapKeyInfo(
options?: AxiosRequestConfig,
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<KeyInfo>
> {
const localVarAxiosArgs =
await localVarAxiosParamCreator.getCoinMarketCapKeyInfo(options);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getStatus(
options?: AxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise<ApplicationInfo>
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getStatus(
options,
);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
};
};
/**
* ApplicationRestApi - factory interface
* @export
*/
export const ApplicationRestApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance,
) {
const localVarFp = ApplicationRestApiFp(configuration);
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCoinMarketCapKeyInfo(options?: any): AxiosPromise<KeyInfo> {
return localVarFp
.getCoinMarketCapKeyInfo(options)
.then((request) => request(axios, basePath));
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStatus(options?: any): AxiosPromise<ApplicationInfo> {
return localVarFp
.getStatus(options)
.then((request) => request(axios, basePath));
},
};
};
/**
* ApplicationRestApi - object-oriented interface
* @export
* @class ApplicationRestApi
* @extends {BaseAPI}
*/
export class ApplicationRestApi extends BaseAPI {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApplicationRestApi
*/
public getCoinMarketCapKeyInfo(options?: AxiosRequestConfig) {
return ApplicationRestApiFp(this.configuration)
.getCoinMarketCapKeyInfo(options)
.then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApplicationRestApi
*/
public getStatus(options?: AxiosRequestConfig) {
return ApplicationRestApiFp(this.configuration)
.getStatus(options)
.then((request) => request(this.axios, this.basePath));
}
}
/**
* HealthCheckRestApi - axios parameter creator
* @export
*/
export const HealthCheckRestApiAxiosParamCreator = function (
configuration?: Configuration,
) {
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resourcesHealthStatus: async (
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
const localVarPath = `/system/health`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* HealthCheckRestApi - functional programming interface
* @export
*/
export const HealthCheckRestApiFp = function (configuration?: Configuration) {
const localVarAxiosParamCreator =
HealthCheckRestApiAxiosParamCreator(configuration);
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async resourcesHealthStatus(
options?: AxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise<HealthStatusResponse>
> {
const localVarAxiosArgs =
await localVarAxiosParamCreator.resourcesHealthStatus(options);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
};
};
/**
* HealthCheckRestApi - factory interface
* @export
*/
export const HealthCheckRestApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance,
) {
const localVarFp = HealthCheckRestApiFp(configuration);
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
resourcesHealthStatus(options?: any): AxiosPromise<HealthStatusResponse> {
return localVarFp
.resourcesHealthStatus(options)
.then((request) => request(axios, basePath));
},
};
};
/**
* HealthCheckRestApi - object-oriented interface
* @export
* @class HealthCheckRestApi
* @extends {BaseAPI}
*/
export class HealthCheckRestApi extends BaseAPI {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof HealthCheckRestApi
*/
public resourcesHealthStatus(options?: AxiosRequestConfig) {
return HealthCheckRestApiFp(this.configuration)
.resourcesHealthStatus(options)
.then((request) => request(this.axios, this.basePath));
}
}
/**
* ProfilerReporterRestApi - axios parameter creator
* @export
*/
export const ProfilerReporterRestApiAxiosParamCreator = function (
configuration?: Configuration,
) {
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
metrics: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/system/prometheus/metrics`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* ProfilerReporterRestApi - functional programming interface
* @export
*/
export const ProfilerReporterRestApiFp = function (
configuration?: Configuration,
) {
const localVarAxiosParamCreator =
ProfilerReporterRestApiAxiosParamCreator(configuration);
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async metrics(
options?: AxiosRequestConfig,
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.metrics(
options,
);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
};
};
/**
* ProfilerReporterRestApi - factory interface
* @export
*/
export const ProfilerReporterRestApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance,
) {
const localVarFp = ProfilerReporterRestApiFp(configuration);
return {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
metrics(options?: any): AxiosPromise<string> {
return localVarFp
.metrics(options)
.then((request) => request(axios, basePath));
},
};
};
/**
* ProfilerReporterRestApi - object-oriented interface
* @export
* @class ProfilerReporterRestApi
* @extends {BaseAPI}
*/
export class ProfilerReporterRestApi extends BaseAPI {
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ProfilerReporterRestApi
*/
public metrics(options?: AxiosRequestConfig) {
return ProfilerReporterRestApiFp(this.configuration)
.metrics(options)
.then((request) => request(this.axios, this.basePath));
}
}
/**
* RateApi - axios parameter creator
* @export
*/
export const RateApiAxiosParamCreator = function (
configuration?: Configuration,
) {
return {
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRate: async (
base: string,
quote: string,
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
// verify required parameter 'base' is not null or undefined
assertParamExists('getRate', 'base', base);
// verify required parameter 'quote' is not null or undefined
assertParamExists('getRate', 'quote', quote);
const localVarPath = `/rates/internal-api/v1/rate/crypto-to-fiat`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
if (base !== undefined) {
localVarQueryParameter['base'] = base;
}
if (quote !== undefined) {
localVarQueryParameter['quote'] = quote;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRate1: async (
base: string,
quote: string,
options: AxiosRequestConfig = {},
): Promise<RequestArgs> => {
// verify required parameter 'base' is not null or undefined
assertParamExists('getRate1', 'base', base);
// verify required parameter 'quote' is not null or undefined
assertParamExists('getRate1', 'quote', quote);
const localVarPath = `/rates/public-api/v1/rate/crypto-to-fiat`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
if (base !== undefined) {
localVarQueryParameter['base'] = base;
}
if (quote !== undefined) {
localVarQueryParameter['quote'] = quote;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* RateApi - functional programming interface
* @export
*/
export const RateApiFp = function (configuration?: Configuration) {
const localVarAxiosParamCreator = RateApiAxiosParamCreator(configuration);
return {
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getRate(
base: string,
quote: string,
options?: AxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise<RestDataResponseGetRateStatusRateDto>
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getRate(
base,
quote,
options,
);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getRate1(
base: string,
quote: string,
options?: AxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise<RestDataResponseGetRateStatusRateDto>
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getRate1(
base,
quote,
options,
);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
);
},
};
};
/**
* RateApi - factory interface
* @export
*/
export const RateApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance,
) {
const localVarFp = RateApiFp(configuration);
return {
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRate(
base: string,
quote: string,
options?: any,
): AxiosPromise<RestDataResponseGetRateStatusRateDto> {
return localVarFp
.getRate(base, quote, options)
.then((request) => request(axios, basePath));
},
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRate1(
base: string,
quote: string,
options?: any,
): AxiosPromise<RestDataResponseGetRateStatusRateDto> {
return localVarFp
.getRate1(base, quote, options)
.then((request) => request(axios, basePath));
},
};
};
/**
* RateApi - object-oriented interface
* @export
* @class RateApi
* @extends {BaseAPI}
*/
export class RateApi extends BaseAPI {
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RateApi
*/
public getRate(base: string, quote: string, options?: AxiosRequestConfig) {
return RateApiFp(this.configuration)
.getRate(base, quote, options)
.then((request) => request(this.axios, this.basePath));
}
/**
* Получение рыночного курса валют
* @param {string} base
* @param {string} quote
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RateApi
*/
public getRate1(base: string, quote: string, options?: AxiosRequestConfig) {
return RateApiFp(this.configuration)
.getRate1(base, quote, options)
.then((request) => request(this.axios, this.basePath));
}
}

View file

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Exchange Rate Provider
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
import { Configuration } from './configuration';
export const BASE_PATH = 'http://localhost:17002'.replace(/\/+$/, '');
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ',',
ssv: ' ',
tsv: '\t',
pipes: '|',
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(
configuration?: Configuration,
protected basePath: string = BASE_PATH,
protected axios: AxiosInstance = globalAxios,
) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
}
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: 'RequiredError' = 'RequiredError';
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,183 @@
/* tslint:disable */
/* eslint-disable */
/**
* Exchange Rate Provider
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AxiosInstance, AxiosResponse } from 'axios';
import { RequestArgs, RequiredError } from './base';
import { Configuration } from './configuration';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com';
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (
functionName: string,
paramName: string,
paramValue: unknown,
) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
);
}
};
/**
*
* @export
*/
export const setApiKeyToObject = async function (
object: any,
keyParamName: string,
configuration?: Configuration,
) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue =
typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};
/**
*
* @export
*/
export const setBasicAuthToObject = function (
object: any,
configuration?: Configuration,
) {
if (configuration && (configuration.username || configuration.password)) {
object['auth'] = {
username: configuration.username,
password: configuration.password,
};
}
};
/**
*
* @export
*/
export const setBearerAuthToObject = async function (
object: any,
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const accessToken =
typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + accessToken;
}
};
/**
*
* @export
*/
export const setOAuthToObject = async function (
object: any,
name: string,
scopes: string[],
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue =
typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;
}
};
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
};
/**
*
* @export
*/
export const serializeDataIfNeeded = function (
value: any,
requestOptions: any,
configuration?: Configuration,
) {
const nonString = typeof value !== 'string';
const needsSerialization =
nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: value || '';
};
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash;
};
/**
*
* @export
*/
export const createRequestFunction = function (
axiosArgs: RequestArgs,
globalAxios: AxiosInstance,
BASE_PATH: string,
configuration?: Configuration,
) {
return <T = unknown, R = AxiosResponse<T>>(
axios: AxiosInstance = globalAxios,
basePath: string = BASE_PATH,
) => {
const axiosRequestArgs = {
...axiosArgs.options,
url: (configuration?.basePath || basePath) + axiosArgs.url,
};
return axios.request<T, R>(axiosRequestArgs);
};
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
/* tslint:disable */
/* eslint-disable */
/**
* User Service
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
export const BASE_PATH = "https://tgweb-demo9.ncdev.site".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,138 @@
/* tslint:disable */
/* eslint-disable */
/**
* User Service
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
import { RequiredError, RequestArgs } from "./base";
import { AxiosInstance, AxiosResponse } from 'axios';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

View file

@ -0,0 +1,61 @@
import { captureException } from '@sentry/react';
import axios from 'axios';
import { interceptors } from 'api/interceptors';
import { config as appConfig } from 'config';
import {
AntifraudApi,
AppealApi,
Configuration,
CountryApi,
CurrencyApi as CurrencyApiP2p,
OfferApi,
OrderApi,
OrderChatApi,
PaymentDetailsApi,
UserSettingsApi,
UserStatisticsApi,
} from './generated-common';
import { RateApi } from './generated-exchange';
import { UserApi } from './generated-userservice';
const axiosInstance = axios.create();
const config = {
basePath: `https://${appConfig.apiHost}`,
isJsonMime: new Configuration().isJsonMime,
};
const API = {
PaymentDetails: new PaymentDetailsApi(config, '', axiosInstance),
Order: new OrderApi(config, '', axiosInstance),
Offer: new OfferApi(config, '', axiosInstance),
UserSettings: new UserSettingsApi(config, '', axiosInstance),
User: new UserApi(config, '', axiosInstance),
Rate: new RateApi(config, '', axiosInstance),
UserStatistics: new UserStatisticsApi(config, '', axiosInstance),
Country: new CountryApi(config, '', axiosInstance),
Chat: new OrderChatApi(config, '', axiosInstance),
Appeal: new AppealApi(config, '', axiosInstance),
Currency: new CurrencyApiP2p(config, '', axiosInstance),
Antifraud: new AntifraudApi(config, '', axiosInstance),
};
const { onRequest, onResponseError } = interceptors({
customErrorHandler: (error) => {
if (error?.response?.status && error.response.status >= 400) {
captureException(
`P2P API error. URL: ${error.config.url}. STATUS: ${error.response.status}`,
);
}
return Promise.reject(error);
},
});
axiosInstance.interceptors.request.use(onRequest);
axiosInstance.interceptors.response.use(undefined, (error) =>
onResponseError(error, axiosInstance),
);
export default API;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* SCW Service API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
import { Configuration } from './configuration';
export const BASE_PATH = 'http://localhost'.replace(/\/+$/, '');
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ',',
ssv: ' ',
tsv: '\t',
pipes: '|',
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(
configuration?: Configuration,
protected basePath: string = BASE_PATH,
protected axios: AxiosInstance = globalAxios,
) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
}
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: 'RequiredError' = 'RequiredError';
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,183 @@
/* tslint:disable */
/* eslint-disable */
/**
* SCW Service API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AxiosInstance, AxiosResponse } from 'axios';
import { RequestArgs, RequiredError } from './base';
import { Configuration } from './configuration';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com';
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (
functionName: string,
paramName: string,
paramValue: unknown,
) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
);
}
};
/**
*
* @export
*/
export const setApiKeyToObject = async function (
object: any,
keyParamName: string,
configuration?: Configuration,
) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue =
typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};
/**
*
* @export
*/
export const setBasicAuthToObject = function (
object: any,
configuration?: Configuration,
) {
if (configuration && (configuration.username || configuration.password)) {
object['auth'] = {
username: configuration.username,
password: configuration.password,
};
}
};
/**
*
* @export
*/
export const setBearerAuthToObject = async function (
object: any,
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const accessToken =
typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + accessToken;
}
};
/**
*
* @export
*/
export const setOAuthToObject = async function (
object: any,
name: string,
scopes: string[],
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue =
typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;
}
};
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
};
/**
*
* @export
*/
export const serializeDataIfNeeded = function (
value: any,
requestOptions: any,
configuration?: Configuration,
) {
const nonString = typeof value !== 'string';
const needsSerialization =
nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: value || '';
};
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash;
};
/**
*
* @export
*/
export const createRequestFunction = function (
axiosArgs: RequestArgs,
globalAxios: AxiosInstance,
BASE_PATH: string,
configuration?: Configuration,
) {
return <T = unknown, R = AxiosResponse<T>>(
axios: AxiosInstance = globalAxios,
basePath: string = BASE_PATH,
) => {
const axiosRequestArgs = {
...axiosArgs.options,
url: (configuration?.basePath || basePath) + axiosArgs.url,
};
return axios.request<T, R>(axiosRequestArgs);
};
};

View file

@ -0,0 +1,25 @@
import { captureException } from '@sentry/react';
import axios from 'axios';
import { config as appConfig } from 'config';
import { AddressesApi, StatusApi } from './generated';
const axiosInstance = axios.create();
const config = {
basePath: appConfig.scwApiHost || `https://${appConfig.apiHost}/scwapi`,
isJsonMime: () => false,
};
const API = {
Status: new StatusApi(config, '', axiosInstance),
Address: new AddressesApi(config, '', axiosInstance),
};
axiosInstance.interceptors.response.use(undefined, (error) => {
captureException(
`SCW API error. URL: ${error.config.url}. STATUS: ${error.response.status}`,
);
});
export default API;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* usdt-raffle
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
import { Configuration } from './configuration';
export const BASE_PATH = 'http://localhost:17008'.replace(/\/+$/, '');
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ',',
ssv: ' ',
tsv: '\t',
pipes: '|',
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(
configuration?: Configuration,
protected basePath: string = BASE_PATH,
protected axios: AxiosInstance = globalAxios,
) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
}
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: 'RequiredError' = 'RequiredError';
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,183 @@
/* tslint:disable */
/* eslint-disable */
/**
* usdt-raffle
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: DEVELOPMENT
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AxiosInstance, AxiosResponse } from 'axios';
import { RequestArgs, RequiredError } from './base';
import { Configuration } from './configuration';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com';
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (
functionName: string,
paramName: string,
paramValue: unknown,
) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
);
}
};
/**
*
* @export
*/
export const setApiKeyToObject = async function (
object: any,
keyParamName: string,
configuration?: Configuration,
) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue =
typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};
/**
*
* @export
*/
export const setBasicAuthToObject = function (
object: any,
configuration?: Configuration,
) {
if (configuration && (configuration.username || configuration.password)) {
object['auth'] = {
username: configuration.username,
password: configuration.password,
};
}
};
/**
*
* @export
*/
export const setBearerAuthToObject = async function (
object: any,
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const accessToken =
typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + accessToken;
}
};
/**
*
* @export
*/
export const setOAuthToObject = async function (
object: any,
name: string,
scopes: string[],
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue =
typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;
}
};
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
};
/**
*
* @export
*/
export const serializeDataIfNeeded = function (
value: any,
requestOptions: any,
configuration?: Configuration,
) {
const nonString = typeof value !== 'string';
const needsSerialization =
nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: value || '';
};
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash;
};
/**
*
* @export
*/
export const createRequestFunction = function (
axiosArgs: RequestArgs,
globalAxios: AxiosInstance,
BASE_PATH: string,
configuration?: Configuration,
) {
return <T = unknown, R = AxiosResponse<T>>(
axios: AxiosInstance = globalAxios,
basePath: string = BASE_PATH,
) => {
const axiosRequestArgs = {
...axiosArgs.options,
url: (configuration?.basePath || basePath) + axiosArgs.url,
};
return axios.request<T, R>(axiosRequestArgs);
};
};

View file

@ -0,0 +1,38 @@
import { captureException } from '@sentry/react';
import axios from 'axios';
import { interceptors } from 'api/interceptors';
import { config as appConfig } from 'config';
import { ParticipationApi, SettingsApi, TicketsApi } from './generated';
const axiosInstance = axios.create();
const config = {
basePath: `https://${appConfig.apiHost}`,
isJsonMime: () => false,
};
const API = {
Settings: new SettingsApi(config, '', axiosInstance),
Tickets: new TicketsApi(config, '', axiosInstance),
Participation: new ParticipationApi(config, '', axiosInstance),
};
const { onRequest, onResponseError } = interceptors({
customErrorHandler: (error) => {
if (error?.response?.status && error.response.status >= 400) {
captureException(
`USDT ruffle API error. URL: ${error.config.url}. STATUS: ${error.response.status}`,
);
}
return Promise.reject(error);
},
});
axiosInstance.interceptors.request.use(onRequest);
axiosInstance.interceptors.response.use(undefined, (error) =>
onResponseError(error, axiosInstance),
);
export default API;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Wallet API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
} from 'axios';
import { Configuration } from './configuration';
export const BASE_PATH = 'http://localhost'.replace(/\/+$/, '');
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ',',
ssv: ' ',
tsv: '\t',
pipes: '|',
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(
configuration?: Configuration,
protected basePath: string = BASE_PATH,
protected axios: AxiosInstance = globalAxios,
) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
}
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: 'RequiredError' = 'RequiredError';
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,183 @@
/* tslint:disable */
/* eslint-disable */
/**
* Wallet API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AxiosInstance, AxiosResponse } from 'axios';
import { RequestArgs, RequiredError } from './base';
import { Configuration } from './configuration';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com';
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (
functionName: string,
paramName: string,
paramValue: unknown,
) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(
paramName,
`Required parameter ${paramName} was null or undefined when calling ${functionName}.`,
);
}
};
/**
*
* @export
*/
export const setApiKeyToObject = async function (
object: any,
keyParamName: string,
configuration?: Configuration,
) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue =
typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};
/**
*
* @export
*/
export const setBasicAuthToObject = function (
object: any,
configuration?: Configuration,
) {
if (configuration && (configuration.username || configuration.password)) {
object['auth'] = {
username: configuration.username,
password: configuration.password,
};
}
};
/**
*
* @export
*/
export const setBearerAuthToObject = async function (
object: any,
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const accessToken =
typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + accessToken;
}
};
/**
*
* @export
*/
export const setOAuthToObject = async function (
object: any,
name: string,
scopes: string[],
configuration?: Configuration,
) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue =
typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;
}
};
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
};
/**
*
* @export
*/
export const serializeDataIfNeeded = function (
value: any,
requestOptions: any,
configuration?: Configuration,
) {
const nonString = typeof value !== 'string';
const needsSerialization =
nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: value || '';
};
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash;
};
/**
*
* @export
*/
export const createRequestFunction = function (
axiosArgs: RequestArgs,
globalAxios: AxiosInstance,
BASE_PATH: string,
configuration?: Configuration,
) {
return <T = unknown, R = AxiosResponse<T>>(
axios: AxiosInstance = globalAxios,
basePath: string = BASE_PATH,
) => {
const axiosRequestArgs = {
...axiosArgs.options,
url: (configuration?.basePath || basePath) + axiosArgs.url,
};
return axios.request<T, R>(axiosRequestArgs);
};
};

View file

@ -0,0 +1,123 @@
/* tslint:disable */
/* eslint-disable */
/**
* Wallet API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface ConfigurationParameters {
apiKey?:
| string
| Promise<string>
| ((name: string) => string)
| ((name: string) => Promise<string>);
username?: string;
password?: string;
accessToken?:
| string
| Promise<string>
| ((name?: string, scopes?: string[]) => string)
| ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?:
| string
| Promise<string>
| ((name: string) => string)
| ((name: string) => Promise<string>);
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
username?: string;
/**
* parameter for basic security
*
* @type {string}
* @memberof Configuration
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
* @memberof Configuration
*/
accessToken?:
| string
| Promise<string>
| ((name?: string, scopes?: string[]) => string)
| ((name?: string, scopes?: string[]) => Promise<string>);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* base options for axios calls
*
* @type {any}
* @memberof Configuration
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.basePath = param.basePath;
this.baseOptions = param.baseOptions;
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp(
'^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$',
'i',
);
return (
mime !== null &&
(jsonMime.test(mime) ||
mime.toLowerCase() === 'application/json-patch+json')
);
}
}

View file

@ -0,0 +1,46 @@
import { captureException } from '@sentry/react';
import axios from 'axios';
import { interceptors } from 'api/interceptors';
import { config as appConfig } from 'config';
import {
Configuration,
PasscodeApi,
RecoveryEmailApi,
RecoveryKeysApi,
} from './generated';
const axiosInstance = axios.create();
const config = {
basePath: `https://${appConfig.v2ApiHost}`,
isJsonMime: new Configuration().isJsonMime,
headers: {
'Access-Control-Allow-Origin': '*',
},
};
const API = {
RecoveryEmail: new RecoveryEmailApi(config, '', axiosInstance),
Passcodes: new PasscodeApi(config, '', axiosInstance),
RecoveryKeys: new RecoveryKeysApi(config, '', axiosInstance),
};
const { onRequest, onResponseError } = interceptors({
customErrorHandler: (error) => {
if (error?.response?.status && error.response.status >= 400) {
captureException(
`WalletV2 API error. URL: ${error.config.url}. STATUS: ${error.response.status}`,
);
}
return Promise.reject(error);
},
});
axiosInstance.interceptors.request.use(onRequest);
axiosInstance.interceptors.response.use(undefined, (error) =>
onResponseError(error, axiosInstance),
);
export default API;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
/* tslint:disable */
/* eslint-disable */
/**
* Telegram Integration API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
// Some imports not used depending on template conditions
// @ts-ignore
import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @export
* @class BaseAPI
*/
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath || this.basePath;
}
}
};
/**
*
* @export
* @class RequiredError
* @extends {Error}
*/
export class RequiredError extends Error {
name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}

View file

@ -0,0 +1,138 @@
/* tslint:disable */
/* eslint-disable */
/**
* Telegram Integration API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Configuration } from "./configuration";
import { RequiredError, RequestArgs } from "./base";
import { AxiosInstance, AxiosResponse } from 'axios';
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
for (const object of objects) {
for (const key in object) {
if (Array.isArray(object[key])) {
searchParams.delete(key);
for (const item of object[key]) {
searchParams.append(key, item);
}
} else {
searchParams.set(key, object[key]);
}
}
}
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

View file

@ -0,0 +1,66 @@
import { captureException } from '@sentry/react';
import axios from 'axios';
import { interceptors } from 'api/interceptors';
import { config as appConfig } from 'config';
import {
AccountsApi,
CampaignsApi,
ClientsApi,
CurrenciesApi,
CurrencyApi,
ExchangesApi,
LanguageApi,
LanguagesApi,
PricesApi,
PurchasesApi,
TransactionsApi,
TransfersApi,
UsersApi,
WVSettingsApi,
WalletsApi,
WithdrawalsApi,
} from './generated';
const config = {
basePath: `https://${appConfig.apiHost}`,
isJsonMime: () => false,
};
const API = {
Currency: new CurrencyApi(config),
Currencies: new CurrenciesApi(config),
Language: new LanguageApi(config),
Languages: new LanguagesApi(config),
Prices: new PricesApi(config),
Transactions: new TransactionsApi(config),
Purchases: new PurchasesApi(config),
Transfers: new TransfersApi(config),
AccountsApi: new AccountsApi(config),
Users: new UsersApi(config),
Campaigns: new CampaignsApi(config),
WVSettings: new WVSettingsApi(config),
Wallets: new WalletsApi(config),
Withdrawals: new WithdrawalsApi(config),
Exchange: new ExchangesApi(config),
Clients: new ClientsApi(config),
};
const { onRequest, onResponseError } = interceptors({
authHeaderPrefix: '',
customErrorHandler: (error) => {
if (error?.response?.status && error.response.status >= 500) {
captureException(
`Wallet API error. URL: ${error.config.url}. STATUS: ${error.response.status}`,
);
}
return Promise.reject(error);
},
});
axios.interceptors.request.use(onRequest);
axios.interceptors.response.use(undefined, onResponseError);
export default API;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"icon":"S5cS","stretched":"t2TV","root":"V7r1","shiny":"NLX3","slide":"Cwry","root__apple":"VX8q","tapped":"eXcs","root__material":"EGpD","container":"dEpV","medium":"Jgbh","container__apple":"MB7U","container__material":"qSw9","small":"x4dM","vertical":"aPJp","alternative":"dDTU","text":"m_Vw","horizontal":"ROPJ","icon__apple":"k7nG","icon__material":"GnzX","text__material":"JelQ","text__apple":"pBNw","primary":"vM7P","secondary":"JNH9","destructive":"oD5l","tertiary":"kYOg","overlay":"VpO0","skeleton":"Xetq","transparent":"Kp43"};

View file

@ -0,0 +1,113 @@
import classNames from 'classnames';
import { AllHTMLAttributes, ReactNode, forwardRef } from 'react';
import Tappable from 'components/Tappable/Tappable';
import { Text } from 'components/Text/Text';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './ActionButton.module.scss';
export interface ActionButtonProps
extends Omit<AllHTMLAttributes<HTMLElement>, 'size'> {
mode?:
| 'primary'
| 'secondary'
| 'tertiary'
| 'destructive'
| 'overlay'
| 'transparent';
layout?: 'vertical' | 'horizontal';
alternative?: boolean;
size?: 'small' | 'medium';
stretched?: boolean;
icon?: ReactNode;
Component?: keyof JSX.IntrinsicElements;
shiny?: boolean;
skeleton?: boolean;
}
const ActionButton = forwardRef<JSX.Element, ActionButtonProps>(
(
{
Component = 'button',
children,
mode = 'primary',
size = 'small',
icon,
layout = 'vertical',
stretched = false,
shiny = false,
alternative = false,
className,
skeleton = false,
...restProps
},
ref,
) => {
const { theme, themeClassName } = useTheme(styles);
return (
<Tappable
mode={theme === 'apple' ? 'opacity' : 'overlay'}
Component={Component}
rootClassName={classNames(
themeClassName('root'),
styles[mode],
styles[layout],
styles[size],
alternative && styles.alternative,
stretched && styles.stretched,
shiny && styles.shiny,
skeleton && styles.skeleton,
className,
)}
className={styles.inner}
ref={ref}
{...restProps}
>
<div className={classNames(themeClassName('container'))}>
{icon && <span className={themeClassName('icon')}>{icon}</span>}
{layout === 'vertical' && (
<Text
apple={
alternative
? {
variant: 'subheadline2',
rounded: true,
weight: 'semibold',
}
: size === 'medium'
? { variant: 'body', weight: 'semibold' }
: { variant: 'caption2', weight: 'medium' }
}
material={
alternative
? { variant: 'subtitle2', weight: 'medium' }
: size === 'medium'
? { variant: 'button1' }
: { variant: 'caption2', weight: 'medium' }
}
className={themeClassName('text')}
skeleton={skeleton}
>
{children}
</Text>
)}
{layout === 'horizontal' && (
<Text
apple={{ variant: 'body', weight: 'semibold' }}
material={{ variant: 'button1' }}
skeleton={skeleton}
className={themeClassName('text')}
>
{children}
</Text>
)}
</div>
</Tappable>
);
},
);
export default ActionButton;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"U4Ek","img":"j5SK","loading":"cPrk"};

View file

@ -0,0 +1,61 @@
import classNames from 'classnames';
import * as React from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import { Image } from '../Image/Image';
import styles from './AliasAvatar.module.scss';
interface AliasAvatarProps {
avatarCode?: string;
id?: number;
className?: string;
size?: number;
loading?: boolean;
}
const bgColors = [
['#e17076', '#ff885e', '#ff516a'], // red
['#faa774', '#ffcd6a', '#ffa85c'], // orange
['#a695e7', '#82b1ff', '#665fff'], // purple
['#7bc862', '#a0de7e', '#54cb68'], // green
['#6ec9cb', '#53edd6', '#28c9b7'], // cyan
['#65aadd', '#72d5fd', '#2a9ef1'], // blue
['#ee7aae', '#e0a2f3', '#d669ed'], // pink
];
export const AliasAvatar: React.FC<AliasAvatarProps> = ({
id = 0,
avatarCode,
className,
size = 40,
loading,
}) => {
const { theme } = useTheme(styles);
const src = avatarCode ? `/static/images/alias/${avatarCode}.svg` : '';
const bgIndex = id % 7;
const [color, topColor, bottomColor] = bgColors[bgIndex];
const style: React.CSSProperties = {
width: size,
height: size,
};
if (avatarCode) {
style.background =
theme === 'apple'
? `linear-gradient(180deg, ${topColor} 0%, ${bottomColor} 100%)`
: color;
}
return (
<div
style={style}
className={classNames(styles.root, loading && styles.loading, className)}
>
{!loading && <Image className={classNames(styles.img)} src={src} />}
</div>
);
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"Oube","img":"smtz"};

View file

@ -0,0 +1,33 @@
import classNames from 'classnames';
import { CSSProperties, forwardRef } from 'react';
import { Image } from 'components/Image/Image';
import styles from './Avatar.module.scss';
export interface AvatarProps {
size?: number;
src?: string;
className?: string;
style?: CSSProperties;
}
const Avatar = forwardRef<HTMLDivElement, AvatarProps>(
({ size = 40, className, style, src }, ref) => {
return (
<div
ref={ref}
className={classNames(styles.root, className)}
style={{
width: size,
height: size,
...style,
}}
>
<Image src={src} className={styles.img} />
</div>
);
},
);
export default Avatar;

View file

@ -0,0 +1,44 @@
import { FC, useEffect } from 'react';
interface BackButtonProps {
onClick?: VoidFunction;
}
const backButton = window.Telegram.WebApp.BackButton;
let isButtonShown = false;
export const BackButton: FC<BackButtonProps> = ({
onClick = () => {
window.history.back();
},
}) => {
const platform = window.Telegram.WebApp.platform;
useEffect(() => {
backButton.show();
isButtonShown = true;
return () => {
isButtonShown = false;
// Мы ждем 10мс на случай, если на следующем экране тоже нужен BackButton.
// Если через это время isButtonShown не стал true, значит следующему экрану кнопка не нужна и мы её прячем
// На MacOS этот прием создает проблему с перекрашиванием шапки, поэтому там сразу прячем кнопку
platform === 'macos'
? backButton.hide()
: setTimeout(() => {
if (!isButtonShown) {
backButton.hide();
}
}, 10);
};
}, []);
useEffect(() => {
window.Telegram.WebApp.onEvent('backButtonClicked', onClick);
return () => {
window.Telegram.WebApp.offEvent('backButtonClicked', onClick);
};
}, [onClick]);
return null;
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"backgroundBlur":"TtcG","active":"Nk7N"};

View file

@ -0,0 +1,28 @@
import classNames from 'classnames';
import { useEffect } from 'react';
import styles from './BackgroundBlur.module.scss';
type BackgroundBlurProps = {
active?: boolean;
timeout?: number;
};
export const BackgroundBlur: React.FC<BackgroundBlurProps> = ({
active,
timeout = 0,
}) => {
useEffect(() => {
document.documentElement.style.setProperty(
'--blur-animation-duration',
`${timeout}ms`,
);
}, [timeout]);
return (
<div
className={classNames(styles.backgroundBlur, active && styles.active)}
style={{ background: document.documentElement.style.background }}
/>
);
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"KQRi"};

View file

@ -0,0 +1,26 @@
import classNames from 'classnames';
import { CSSProperties } from 'react';
import * as React from 'react';
import styles from './BottomContent.module.scss';
type Props = {
className?: string;
style?: CSSProperties;
'data-testid'?: string;
children: React.ReactNode;
};
export const BottomContent = React.forwardRef<HTMLDivElement, Props>(
(props, ref) => {
const { className, children, ...restProps } = props;
return (
<div
className={classNames(styles.root, className)}
{...restProps}
ref={ref}
>
{children}
</div>
);
},
);

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"primary":"MyaG","danger":"ICdD"};

View file

@ -0,0 +1,32 @@
import classNames from 'classnames';
import { ButtonHTMLAttributes, FC } from 'react';
import { Cell } from 'components/Cells';
import { CellProps } from 'components/Cells/Cell/Cell';
import styles from './ButtonCell.module.scss';
interface CellButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
mode?: 'danger' | 'primary';
start?: CellProps['start'];
}
const ButtonCell: FC<CellButtonProps> = ({
children,
mode = 'primary',
className,
...restProps
}) => {
return (
<Cell
tappable
className={classNames(className, styles[mode])}
{...restProps}
>
<Cell.Text title={children} titleAppearance={mode} />
</Cell>
);
};
export default ButtonCell;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"tappable":"tizz","root":"dAgC","separator":"wGYJ","container":"f5GT","container__apple":"iN2n","container__material":"Wv9y","start":"t1CP","start__apple":"d_AG","start__material":"Bcb3","end":"eslG","end__apple":"bXxi","end__material":"CFak","chevron":"p_ZQ","chevron__apple":"Z8RF","chevron__material":"v61B"};

View file

@ -0,0 +1,121 @@
import classNames from 'classnames';
import {
CSSProperties,
ElementType,
FC,
ReactNode,
createElement,
} from 'react';
import * as React from 'react';
import { Link, LinkProps } from 'react-router-dom';
import Tappable from 'components/Tappable/Tappable';
import { useTheme } from 'hooks/utils/useTheme';
import { ReactComponent as ChevronSVG } from 'images/chevron.svg';
import styles from './Cell.module.scss';
import { CellList } from './components/CellList/CellList';
import { CellPart } from './components/CellPart/CellPart';
import { CellText } from './components/CellText/CellText';
export type CellProps = {
className?: string;
style?: CSSProperties;
'data-testid'?: string;
/**
* Cell.Part is preferred
*/
start?: ReactNode;
/**
* CellText is preferred
*/
children?: ReactNode;
/**
* Cell.Part or Cell.Text are preferred
*/
end?: ReactNode;
tappable?: boolean;
/**
* Use this prop to force separator visibility.
* Otherwise, wrap Cells by Cell.List, that places separators automatically
*/
separator?: boolean;
chevron?: boolean;
} & (
| ({
Component: typeof Link;
} & LinkProps)
| {
Component?: ElementType;
}
);
export const Cell: FC<CellProps> & {
Text: typeof CellText;
Part: typeof CellPart;
List: typeof CellList;
} = ({
className,
start,
children,
end,
tappable,
Component = 'div',
separator,
chevron,
...restProps
}) => {
const { themeClassName } = useTheme(styles);
const childrenComponent = (
<>
{start && <div className={themeClassName('start')}>{start}</div>}
<div className={themeClassName('container')}>
{children}
{end && <div className={themeClassName('end')}>{end}</div>}
{chevron && <ChevronSVG className={themeClassName('chevron')} />}
</div>
</>
);
if (tappable) {
return (
<>
{createElement(
Tappable,
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Component,
rootClassName: classNames(styles.tappable, className),
className: classNames(
themeClassName('root'),
separator && styles.separator,
),
...restProps,
},
childrenComponent,
)}
</>
);
} else {
return (
<Component
className={classNames(
themeClassName('root'),
separator && styles.separator,
className,
)}
{...restProps}
>
{childrenComponent}
</Component>
);
}
};
Cell.Text = CellText;
Cell.Part = CellPart;
Cell.List = CellList;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"mjig","separator":"LQUd","root__apple":"JueU","overlap":"wrze","root__material":"ODmG","card":"Hk4R","card__apple":"nHIA","card__material":"Ntau"};

View file

@ -0,0 +1,38 @@
import classNames from 'classnames';
import { FC } from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './CellList.module.scss';
/**
* Use this component if you want to draw several Cells in a row and separate them by 1px line
*/
export const CellList: FC<{
separator?: boolean;
className?: string;
mode?: 'plain' | 'card';
overlap?: boolean;
}> = ({
children,
separator = true,
className,
mode = 'plain',
overlap = false,
}) => {
const { themeClassName } = useTheme(styles);
return (
<div
className={classNames(
themeClassName('root'),
separator && styles.separator,
mode === 'card' && themeClassName('card'),
overlap && styles.overlap,
className,
)}
>
{children}
</div>
);
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"avatar":"RkvK","roundedIcon":"XeMW","checkbox":"HR3Y","radio":"vZ3f","switch":"GT7o","tabs":"FPYQ","segmentedControl":"UllT","icon":"aErX"};

View file

@ -0,0 +1,18 @@
import classnames from 'classnames/bind';
import { FC } from 'react';
import styles from './CellPart.module.scss';
export const CellPart: FC<{
type:
| 'avatar'
| 'switch'
| 'checkbox'
| 'radio'
| 'icon'
| 'roundedIcon'
| 'tabs'
| 'segmentedControl';
}> = ({ type, children }) => {
return <div className={classnames(styles[type])}>{children}</div>;
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"jOCs","inverted":"If_N","start":"NXXw","end":"Giho","root__apple":"UurQ","doubledecker":"HfZf","root__material":"TYgZ","title":"kzP3","title__apple":"rcPo","title__material":"r2_P","bold":"kkH2","primary":"qZlq","danger":"Ppli","success":"IYjp","muted":"vYKu","disabled":"q7y1","description":"Bgj6","description__apple":"gDVz","description__material":"Udan","multilineDescription":"ymvs","skeleton":"BiJe"};

View file

@ -0,0 +1,94 @@
import classNames from 'classnames';
import { CSSProperties, FC, ReactNode } from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './CellText.module.scss';
type CellTextBaseProps = {
className?: string;
titleClassName?: string;
style?: CSSProperties;
'data-testid'?: string;
align?: 'start' | 'end';
/**
* Use this prop if you need to render Cell with only title,
* but with height of Cell with title and description
*/
doubledecker?: boolean;
// TODO: audit codebase for the places with overflowing descriptions
// and add opposite prop in https://wallet-bot.atlassian.net/browse/WAL-1191
multilineDescription?: boolean;
};
type CellTextProps =
| (CellTextBaseProps & {
title: ReactNode;
description?: ReactNode;
descriptionAppearance?: 'default' | 'success' | 'danger' | 'disabled';
inverted?: boolean;
bold?: boolean;
titleAppearance?:
| 'default'
| 'success'
| 'primary'
| 'danger'
| 'muted'
| 'disabled';
})
| (CellTextBaseProps & {
skeleton?: boolean;
description?: boolean;
inverted?: boolean;
});
export const CellText: FC<CellTextProps> = ({
className,
titleClassName,
style,
align = 'start',
doubledecker,
multilineDescription = false,
...props
}) => {
const { themeClassName } = useTheme(styles);
return (
<div
className={classNames(
themeClassName('root'),
'inverted' in props && props.inverted && styles.inverted,
doubledecker && styles.doubledecker,
'skeleton' in props && props.skeleton && styles.skeleton,
styles[align],
className,
)}
data-testid={props['data-testid']}
style={style}
>
<div
className={classNames(
themeClassName('title'),
'bold' in props && props.bold && styles.bold,
'titleAppearance' in props &&
styles[props.titleAppearance || 'default'],
titleClassName,
)}
>
{'title' in props && props.title}
</div>
{props.description && (
<div
className={classNames(
themeClassName('description'),
'descriptionAppearance' in props &&
styles[props.descriptionAppearance || 'default'],
multilineDescription && styles.multilineDescription,
)}
>
{props.description}
</div>
)}
</div>
);
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"JRPK","root__apple":"ynA5","root__material":"TyOw"};

View file

@ -0,0 +1,26 @@
import classNames from 'classnames';
import { FC } from 'react';
import { Cell } from 'components/Cells';
import { CellProps } from 'components/Cells/Cell/Cell';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './CellCard.module.scss';
export const CellCard: FC<CellProps> = ({
className,
children,
...restProps
}) => {
const { themeClassName } = useTheme(styles);
return (
<Cell
className={classNames(themeClassName('root'), className)}
{...restProps}
>
{children}
</Cell>
);
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"header":"hSYA","header__apple":"HdJm","header__material":"ki4Y","children__apple":"dvDs","children__material":"rAJT","root":"WV8R","root__apple":"Qk8w","root__material":"YRwW","container":"FFUf","skeleton":"hQcE","container__apple":"esX8","container__material":"qUpJ","children":"VO_z","before":"iJYE","after":"Iw6i","before__apple":"b3U4","after__apple":"vHX6","before__material":"PvZ_","after__material":"IEwn","allowScroll":"a4Ku","pseudoPadding":"izTr","content":"gvCa"};

View file

@ -0,0 +1,102 @@
import cn from 'classnames';
import { MouseEventHandler, ReactNode, createElement, forwardRef } from 'react';
import DetailCellSkeleton from 'components/Cells/DetailCell/DetailCellSkeleton';
import Skeleton from 'components/Skeleton/Skeleton';
import Tappable from 'components/Tappable/Tappable';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './DetailCell.module.scss';
interface DetailCellProps {
header?: ReactNode;
before?: ReactNode;
beforeClassName?: string;
after?: ReactNode;
fetching?: boolean;
onClick?: MouseEventHandler;
children?: ReactNode;
allowScroll?: boolean;
containerClassName?: string;
afterClassName?: string;
}
const DetailCell = forwardRef<
JSX.Element,
React.PropsWithChildren<DetailCellProps>
>(
(
{
fetching,
onClick,
header,
children,
after,
before,
beforeClassName,
allowScroll,
containerClassName,
afterClassName,
},
ref,
) => {
const { themeClassName } = useTheme(styles);
const childrenComponent = (
<Skeleton
skeletonShown={fetching}
skeleton={
<DetailCellSkeleton after={after} header={header} before={before} />
}
>
<div
className={cn(
themeClassName('container'),
allowScroll && styles.allowScroll,
containerClassName,
)}
>
{before && (
<div className={cn(themeClassName('before'), beforeClassName)}>
{before}
</div>
)}
<div className={themeClassName('content')}>
{header && <div className={themeClassName('header')}>{header}</div>}
<div className={themeClassName('children')}>{children}</div>
</div>
{after && (
<div className={cn(themeClassName('after'), afterClassName)}>
{after}
</div>
)}
{/* It's a hack that helps to preserve padding when the width of the content in the flex container */}
{/* is more than the screen width */}
{allowScroll && <div className={styles.pseudoPadding}></div>}
</div>
</Skeleton>
);
if (onClick) {
return createElement(
Tappable,
{
rootClassName: themeClassName('root'),
onClick,
Component: 'div',
ref,
},
childrenComponent,
);
} else {
return createElement(
'div',
{ className: themeClassName('root'), ref },
childrenComponent,
);
}
},
);
export default DetailCell;

View file

@ -0,0 +1,33 @@
import classNames from 'classnames';
import { FC, ReactNode } from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './DetailCell.module.scss';
interface DetailCellSkeletonProps {
after?: ReactNode;
header?: ReactNode;
before?: ReactNode;
}
const DetailCellSkeleton: FC<DetailCellSkeletonProps> = ({
after,
before,
header,
}) => {
const { themeClassName } = useTheme(styles);
return (
<div className={classNames(themeClassName('container'), styles.skeleton)}>
{before && <div className={themeClassName('before')} />}
<div className={themeClassName('content')}>
{header && <div className={themeClassName('header')} />}
<div className={themeClassName('children')} />
</div>
{after && <div className={themeClassName('after')} />}
</div>
);
};
export default DetailCellSkeleton;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"aQoq","root__apple":"Rjxa","root__material":"fMq0","withOutIcon__material":"MGLi","wrapper":"NIBU","container":"rk_O","container__apple":"GMjV","container__material":"gLvX","content":"AHGr","header":"n2t8","headerSecondary":"QJFz","headerSecondary__apple":"V48_","headerSecondary__material":"oLph","chevron":"pear","after":"SVZl"};

View file

@ -0,0 +1,122 @@
import classNames from 'classnames';
import { MouseEventHandler, ReactNode, createElement, forwardRef } from 'react';
import * as React from 'react';
import Tappable from 'components/Tappable/Tappable';
import { useTheme } from 'hooks/utils/useTheme';
import { ReactComponent as ChevronSVG } from 'images/chevron.svg';
import styles from './ListItemCell.module.scss';
interface ListItemCellProps {
header?: ReactNode;
after?: ReactNode;
onClick?: MouseEventHandler;
children?: ReactNode;
icon?: ReactNode;
chevron?: boolean;
// TODO: убрать и сделать по нормальному опцию шефрона когда он нужен и в material и apple
perenniallyСhevron?: boolean;
className?: string;
contentClassName?: string;
containerClassName?: string;
afterClassName?: string;
headerTheme?: 'primary' | 'secondary';
'data-testid'?: string;
}
const HEADER_THEME_TO_CLASSNAME = {
primary: 'headerPrimary',
secondary: 'headerSecondary',
};
export const ListItemCell = forwardRef<
JSX.Element,
React.PropsWithChildren<ListItemCellProps>
>(
(
{
onClick,
header,
children,
perenniallyСhevron = false,
after,
icon,
chevron,
className,
contentClassName,
containerClassName,
afterClassName,
headerTheme = 'primary',
'data-testid': dataTestId,
},
ref,
) => {
const { theme, themeClassName } = useTheme(styles);
const childrenComponent = (
<div
className={classNames(
themeClassName('root'),
!icon && themeClassName('withOutIcon'),
)}
>
{icon}
<div
className={classNames(
themeClassName('container'),
containerClassName,
)}
>
<div
className={classNames(themeClassName('content'), contentClassName)}
>
{header && (
<div
className={classNames(
themeClassName('header'),
themeClassName(HEADER_THEME_TO_CLASSNAME[headerTheme]),
)}
>
{header}
</div>
)}
<div className={themeClassName('children')}>{children}</div>
</div>
{after && (
<div
className={classNames(themeClassName('after'), afterClassName)}
>
{after}
</div>
)}
{((theme === 'apple' && chevron) || perenniallyСhevron) && (
<ChevronSVG className={styles.chevron} />
)}
</div>
</div>
);
if (onClick) {
return createElement(
Tappable,
{
rootClassName: classNames(styles.wrapper, className),
onClick,
Component: 'div',
ref,
'data-testid': dataTestId,
},
childrenComponent,
);
} else {
return createElement(
'div',
{ className: classNames(styles.wrapper, className), ref },
childrenComponent,
);
}
},
);

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"ytZQ","base":"CvIY","icon__apple":"wEx7","icon__material":"gs0a","iconWithBg__apple":"zQ2y","iconWithBg__material":"CrmC"};

View file

@ -0,0 +1,47 @@
import classNames from 'classnames';
import { FC } from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './ListItemIcon.module.scss';
type IconProps = {
type: 'icon' | 'iconWithBg';
className?: string;
minWidth?: number;
} & React.HTMLAttributes<HTMLDivElement>;
const rootWidthApple = {
icon: 28,
iconWithBg: 32,
};
const rootWidthMaterial = {
icon: 29,
iconWithBg: 32,
};
export const ListItemIcon: FC<IconProps> = ({
children,
type,
className,
minWidth,
...props
}) => {
const { theme, themeClassName } = useTheme(styles);
const rootWidth =
theme === 'apple' ? rootWidthApple[type] : rootWidthMaterial[type];
return (
<div
className={classNames(themeClassName('root'), themeClassName(type))}
style={{
minWidth: minWidth ?? rootWidth,
}}
>
<div className={classNames(styles.base, className)} {...props}>
{children}
</div>
</div>
);
};

View file

@ -0,0 +1,43 @@
import { FC, MouseEventHandler, ReactNode } from 'react';
import { Cell } from 'components/Cells';
import Skeleton from 'components/Skeleton/Skeleton';
interface NewDetailCellProps {
header: ReactNode | true;
before?: ReactNode;
after?: ReactNode;
fetching?: boolean;
onClick?: MouseEventHandler;
children?: ReactNode;
chevron?: boolean;
bold?: boolean;
}
const NewDetailCell: FC<NewDetailCellProps> = ({
fetching,
onClick,
header,
children,
after,
before,
chevron,
bold,
}) => {
return (
<Skeleton
skeletonShown={fetching}
skeleton={
<Cell start={before} end={after}>
<Cell.Text skeleton description inverted />
</Cell>
}
>
<Cell onClick={onClick} start={before} end={after} chevron={chevron}>
<Cell.Text bold={bold} description={header} title={children} inverted />
</Cell>
</Skeleton>
);
};
export default NewDetailCell;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"HWoY","input":"X98M"};

View file

@ -0,0 +1,95 @@
import classnames from 'classnames/bind';
import { CSSProperties, ChangeEvent, ReactNode } from 'react';
import { Cell } from 'components/Cells';
import { Checkmark } from 'components/Checkmark/Checkmark';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './SelectionCell.module.scss';
interface SelectionCellProps<T> {
value: T;
description?: ReactNode;
onChange: (value: T, e: ChangeEvent) => void;
checked: boolean;
name: string;
children?: ReactNode;
mode?: 'checkbox' | 'radio';
checkmarkPlacement?: 'start' | 'end';
start?: ReactNode;
end?: ReactNode;
className?: string;
'data-testid'?: string;
style?: CSSProperties;
}
function SelectionCell<T extends string>({
value,
children,
description,
onChange,
checked,
mode = 'radio',
start,
end,
name,
className,
style,
checkmarkPlacement,
...restProps
}: SelectionCellProps<T>): JSX.Element {
const theme = useTheme();
let resolvedCheckmarkPlacement;
if (checkmarkPlacement) {
resolvedCheckmarkPlacement = checkmarkPlacement;
} else if (theme === 'material' || mode === 'checkbox') {
resolvedCheckmarkPlacement = 'start';
} else {
resolvedCheckmarkPlacement = 'end';
}
return (
<label
className={classnames(styles.root, className)}
style={style}
{...restProps}
>
<input
type={mode}
name={name}
value={value}
onChange={(e) => onChange(value, e)}
checked={checked}
className={styles.input}
/>
<Cell
tappable
start={
resolvedCheckmarkPlacement === 'start' ? (
<Cell.Part type={mode}>
<Checkmark mode={mode} checked={checked} />
</Cell.Part>
) : (
start
)
}
end={
resolvedCheckmarkPlacement === 'end' ? (
<Cell.Part type={mode}>
<Checkmark mode={mode} checked={checked} />
</Cell.Part>
) : (
end
)
}
>
<Cell.Text title={children} description={description} />
</Cell>
</label>
);
}
export default SelectionCell;

View file

@ -0,0 +1,65 @@
import { FC, ReactNode } from 'react';
import { Cell } from 'components/Cells';
import { Checkmark } from 'components/Checkmark/Checkmark';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './SelectionCell.module.scss';
interface SelectionCellSkeletonProps {
description?: boolean;
mode?: 'checkbox' | 'radio';
start?: ReactNode;
end?: ReactNode;
checkmarkPlacement?: 'start' | 'end';
}
const SelectionCellSkeleton: FC<SelectionCellSkeletonProps> = ({
mode = 'radio',
start,
end,
description,
checkmarkPlacement,
}) => {
const theme = useTheme();
let resolvedCheckmarkPlacement;
if (checkmarkPlacement) {
resolvedCheckmarkPlacement = checkmarkPlacement;
} else if (theme === 'material' || mode === 'checkbox') {
resolvedCheckmarkPlacement = 'start';
} else {
resolvedCheckmarkPlacement = 'end';
}
return (
<label className={styles.root}>
<Cell
start={
resolvedCheckmarkPlacement === 'start' ? (
<Cell.Part type={mode}>
<Checkmark mode={mode} />
</Cell.Part>
) : (
start
)
}
end={
resolvedCheckmarkPlacement === 'end' ? (
<Cell.Part type={mode}>
<Checkmark mode={mode} />
</Cell.Part>
) : (
end
)
}
>
<Cell.Text description={description} skeleton />
</Cell>
</label>
);
};
export default SelectionCellSkeleton;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"MKKc","root__apple":"F1Tk","radio":"vc2p","checkbox":"X6mg","root__material":"TKvX","checked":"sJpg"};

View file

@ -0,0 +1,19 @@
import { Suspense, lazy } from 'react';
import CheckmarkFallback from './CheckmarkFallback';
const CheckmarkLottie = lazy(() => import('./CheckmarkLottie'));
export const Checkmark = ({
checked,
mode = 'radio',
}: {
checked?: boolean;
mode?: 'radio' | 'checkbox';
}) => {
return (
<Suspense fallback={<CheckmarkFallback checked={checked} mode={mode} />}>
<CheckmarkLottie checked={checked} mode={mode} />
</Suspense>
);
};

View file

@ -0,0 +1,59 @@
import classNames from 'classnames';
import { FC } from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './Checkmark.module.scss';
import { ReactComponent as CheckboxAndroid } from './checkbox_android.svg';
import { ReactComponent as CheckboxCheckedAndroid } from './checkbox_checked_android.svg';
import { ReactComponent as CheckboxCheckedIos } from './checkbox_checked_ios.svg';
import { ReactComponent as CheckboxIos } from './checkbox_ios.svg';
import { ReactComponent as RadioAndroid } from './radio_android.svg';
import { ReactComponent as RadioCheckedAndroid } from './radio_checked_android.svg';
import { ReactComponent as RadioCheckedIos } from './radio_checked_ios.svg';
import { ReactComponent as RadioIos } from './radio_ios.svg';
const CheckmarkFallback: FC<{
checked?: boolean;
mode?: 'radio' | 'checkbox';
}> = ({ checked, mode = 'radio' }) => {
const { theme, themeClassName } = useTheme(styles);
const className = classNames(
themeClassName('root'),
styles[mode],
checked && styles.checked,
);
if (theme === 'apple') {
if (mode === 'radio') {
return checked ? (
<RadioCheckedIos className={className} />
) : (
<RadioIos className={className} />
);
} else {
return checked ? (
<CheckboxCheckedIos className={className} />
) : (
<CheckboxIos className={className} />
);
}
} else {
if (mode === 'radio') {
return checked ? (
<RadioCheckedAndroid className={className} />
) : (
<RadioAndroid className={className} />
);
} else {
return checked ? (
<CheckboxCheckedAndroid className={className} />
) : (
<CheckboxAndroid className={className} />
);
}
}
};
export default CheckmarkFallback;

View file

@ -0,0 +1,22 @@
var _rect;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgCheckboxAndroid = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 18,
height: 18,
viewBox: "0 0 18 18",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
x: 1,
y: 1,
width: 16,
height: 16,
rx: 2,
stroke: "currentColor",
strokeWidth: 2
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgCheckboxAndroid);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,25 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgCheckboxCheckedAndroid = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 18,
height: 18,
viewBox: "0 0 18 18",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 18,
height: 18,
rx: 3,
fill: "currentColor"
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "m4.25 10 3 3 7-7",
stroke: "#fff",
strokeWidth: 1.75,
strokeLinecap: "round",
strokeLinejoin: "round"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgCheckboxCheckedAndroid);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,25 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgCheckboxCheckedIos = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 22,
height: 22,
viewBox: "0 0 22 22",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 22,
height: 22,
rx: 11,
fill: "currentColor"
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "m6.75 12 3 3.5 5.5-8",
stroke: "#fff",
strokeWidth: 1.8,
strokeLinecap: "round",
strokeLinejoin: "round"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgCheckboxCheckedIos);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,22 @@
var _rect;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgCheckboxIos = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 22,
height: 22,
viewBox: "0 0 22 22",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
x: 0.75,
y: 0.75,
width: 20.5,
height: 20.5,
rx: 10.25,
stroke: "currentColor",
strokeWidth: 1.5
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgCheckboxIos);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,24 @@
var _g;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgRadioAndroid = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 20,
height: 20,
viewBox: "0 0 20 20",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
opacity: 0.5
}, /*#__PURE__*/React.createElement("rect", {
x: 1,
y: 1,
width: 18,
height: 18,
rx: 9,
stroke: "currentColor",
strokeWidth: 2
}))));
const ForwardRef = /*#__PURE__*/forwardRef(SvgRadioAndroid);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,26 @@
var _rect, _circle;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgRadioCheckedAndroid = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 20,
height: 20,
viewBox: "0 0 20 20",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 20,
height: 20,
rx: 10,
fill: "var(--tg-theme-button-color)"
})), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
cx: 10,
cy: 10,
r: 6.5,
fill: "var(--tg-theme-button-color)",
stroke: "var(--tg-theme-bg-color)",
strokeWidth: 3
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgRadioCheckedAndroid);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,20 @@
var _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgRadioCheckedIos = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 30,
height: 30,
viewBox: "0 0 30 30",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "m8.5 15.5 4.332 5.294c.083.102.24.093.311-.018L21 8.5",
stroke: "currentColor",
strokeWidth: 2.33,
strokeLinecap: "round",
strokeLinejoin: "round"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgRadioCheckedIos);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,13 @@
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgRadioIos = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 30,
height: 30,
viewBox: "0 0 30 30",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props));
const ForwardRef = /*#__PURE__*/forwardRef(SvgRadioIos);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"flagFallback":"N0cF"};

View file

@ -0,0 +1,22 @@
import { Suspense, forwardRef, lazy } from 'react';
import { FiatCurrency } from 'api/wallet/generated';
import styles from './CurrencyFlagIcon.module.scss';
const FlagIcon = lazy(() => import('./FlagIcon'));
const CurrencyFlagIcon = forwardRef<
SVGSVGElement,
{
currency: FiatCurrency;
}
>((props, ref) => {
return (
<Suspense fallback={<div className={styles.flagFallback} />}>
<FlagIcon ref={ref} {...props} />
</Suspense>
);
});
export default CurrencyFlagIcon;

View file

@ -0,0 +1,72 @@
import { FC, SVGProps, forwardRef } from 'react';
import { FrontendCryptoCurrencyEnum } from 'api/wallet/generated';
import { ReactComponent as DollarsGrayLogo } from 'components/CurrencyLogo/icons/dollars-gray.svg';
import { ReactComponent as DollarsLogo } from 'components/CurrencyLogo/icons/dollars.svg';
import { ReactComponent as BtcGrayLogo } from './icons/bitcoin-gray.svg';
import { ReactComponent as BtcLogo } from './icons/bitcoin.svg';
import { ReactComponent as TonGrayLogo } from './icons/ton-gray.svg';
import { ReactComponent as TonLogo } from './icons/ton.svg';
import { ReactComponent as UsdtGrayLogo } from './icons/usdt-gray.svg';
import { ReactComponent as UsdtLogo } from './icons/usdt.svg';
const componentsMap: Record<
FrontendCryptoCurrencyEnum | 'dollars',
Record<'default' | 'gray', FC<SVGProps<SVGSVGElement>>>
> = {
[FrontendCryptoCurrencyEnum.Ton]: {
default: TonLogo,
gray: TonGrayLogo,
},
dollars: {
default: DollarsLogo,
gray: DollarsGrayLogo,
},
[FrontendCryptoCurrencyEnum.Usdt]: {
default: UsdtLogo,
gray: UsdtGrayLogo,
},
[FrontendCryptoCurrencyEnum.Btc]: {
default: BtcLogo,
gray: BtcGrayLogo,
},
} as const;
interface CurrencyLogoProps extends React.HTMLAttributes<SVGElement> {
currency: FrontendCryptoCurrencyEnum;
color?: 'default' | 'gray';
variant?: 'simple' | 'complex';
size?: number;
}
const CurrencyLogo = forwardRef<SVGSVGElement, CurrencyLogoProps>(
(
{
currency,
className,
color = 'default',
variant = 'simple',
size = 40,
...props
},
ref,
) => {
const resolvedCurrency =
currency === 'USDT' && variant === 'simple' ? 'dollars' : currency;
const Component = componentsMap[resolvedCurrency][color];
return (
<Component
width={size}
height={size}
className={className}
ref={ref}
{...props}
/>
);
},
);
export default CurrencyLogo;

View file

@ -0,0 +1,50 @@
import { FC, Suspense, lazy } from 'react';
import { FrontendCryptoCurrencyEnum } from 'api/wallet/generated';
import { ReactComponent as DollarsLogo } from 'components/CurrencyLogo/icons/dollars.svg';
const BtcAppearance = lazy(() => import('./Appearance/BtcAppearance'));
const UsdtAppearance = lazy(() => import('./Appearance/UsdtAppearance'));
const TonAppearance = lazy(() => import('./Appearance/TonAppearance'));
type CurrencyLogoProps = React.ComponentProps<typeof TonAppearance> & {
currency: FrontendCryptoCurrencyEnum;
variant?: 'simple' | 'complex';
};
const CurrencyLogoWithAppearance: FC<CurrencyLogoProps> = ({
currency,
variant = 'simple',
...props
}) => {
return (
<>
{currency === FrontendCryptoCurrencyEnum.Btc && (
<Suspense fallback={<div className={props.className} />}>
<BtcAppearance {...props} />
</Suspense>
)}
{currency === FrontendCryptoCurrencyEnum.Usdt && (
<Suspense
fallback={
variant === 'simple' ? (
<DollarsLogo className={props.className} />
) : (
<div className={props.className} />
)
}
>
<UsdtAppearance {...props} variant={variant} />
</Suspense>
)}
{currency === FrontendCryptoCurrencyEnum.Ton && (
<Suspense fallback={<div className={props.className} />}>
<TonAppearance {...props} />
</Suspense>
)}
</>
);
};
export default CurrencyLogoWithAppearance;

View file

@ -0,0 +1,21 @@
var _path, _path2;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgBitcoinGray = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
viewBox: "0 0 40 40",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M39.397 24.838c-2.671 10.715-13.523 17.235-24.239 14.563C4.448 36.731-2.073 25.877.6 15.164 3.269 4.448 14.121-2.073 24.833.598c10.715 2.672 17.235 13.525 14.564 24.24Z",
fill: "#8E8E92",
fillOpacity: 0.4
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
d: "M28.817 17.155c.398-2.661-1.628-4.092-4.4-5.046l.9-3.606-2.195-.546-.875 3.51c-.577-.144-1.17-.28-1.759-.414l.882-3.533-2.194-.547-.899 3.604a72.497 72.497 0 0 1-1.401-.33l.002-.01-3.026-.757-.584 2.344s1.628.374 1.594.397c.889.221 1.05.81 1.023 1.276l-1.024 4.107c.061.016.14.038.228.074l-.232-.058-1.435 5.754c-.109.27-.385.675-1.006.521.022.032-1.595-.398-1.595-.398l-1.09 2.512 2.857.712c.53.134 1.051.273 1.564.404l-.908 3.647 2.192.547.9-3.608c.598.162 1.18.312 1.748.454l-.896 3.59 2.195.547.908-3.64c3.742.709 6.556.423 7.74-2.962.955-2.725-.047-4.297-2.016-5.322 1.434-.33 2.515-1.274 2.803-3.222h-.001Zm-5.015 7.032c-.678 2.725-5.266 1.252-6.754.882l1.205-4.83c1.488.37 6.258 1.106 5.55 3.948Zm.68-7.071c-.62 2.479-4.439 1.22-5.677.91l1.092-4.381c1.239.309 5.229.885 4.584 3.47Z",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgBitcoinGray);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,20 @@
var _path, _path2;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgBitcoin = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
viewBox: "0 0 40 40",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M39.397 24.838c-2.671 10.715-13.523 17.235-24.239 14.563C4.448 36.731-2.073 25.877.6 15.164 3.269 4.448 14.121-2.073 24.833.598c10.715 2.672 17.235 13.525 14.564 24.24Z",
fill: "#F7931A"
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
d: "M28.817 17.155c.398-2.661-1.628-4.092-4.4-5.046l.9-3.606-2.195-.546-.875 3.51c-.577-.144-1.17-.28-1.759-.414l.882-3.533-2.194-.547-.899 3.604a72.497 72.497 0 0 1-1.401-.33l.002-.01-3.026-.757-.584 2.344s1.628.374 1.594.397c.889.221 1.05.81 1.023 1.276l-1.024 4.107c.061.016.14.038.228.074l-.232-.058-1.435 5.754c-.109.27-.385.675-1.006.521.022.032-1.595-.398-1.595-.398l-1.09 2.512 2.857.712c.53.134 1.051.273 1.564.404l-.908 3.647 2.192.547.9-3.608c.598.162 1.18.312 1.748.454l-.896 3.59 2.195.547.908-3.64c3.742.709 6.556.423 7.74-2.962.955-2.725-.047-4.297-2.016-5.322 1.434-.33 2.515-1.274 2.803-3.222h-.001Zm-5.015 7.032c-.678 2.725-5.266 1.252-6.754.882l1.205-4.83c1.488.37 6.258 1.106 5.55 3.948Zm.68-7.071c-.62 2.479-4.439 1.22-5.677.91l1.092-4.381c1.239.309 5.229.885 4.584 3.47Z",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgBitcoin);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,23 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgDollarsGray = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
viewBox: "0 0 40 40",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 40,
height: 40,
rx: 20,
fill: "#8E8E92",
fillOpacity: 0.4
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M20.014 32.05c-.739 0-1.217-.464-1.217-1.243v-1.381c-2.899-.342-4.908-1.832-5.496-3.733a2.194 2.194 0 0 1-.137-.752c0-.86.588-1.435 1.531-1.435.793 0 1.245.465 1.532 1.107.546 1.395 1.832 2.16 3.91 2.16 2.2 0 3.61-.875 3.61-2.502 0-1.38-1.259-2.091-3.35-2.584l-1.86-.437c-3.117-.71-5.181-2.488-5.181-5.072 0-3.09 2.378-4.95 5.44-5.332V9.45c0-.78.48-1.244 1.218-1.244s1.216.465 1.216 1.244v1.395c2.68.328 4.622 1.777 5.223 3.787.069.26.123.506.123.765 0 .793-.601 1.272-1.476 1.272-.793 0-1.217-.383-1.559-1.04-.615-1.435-1.682-2.132-3.514-2.132-2.091 0-3.35.93-3.35 2.393 0 1.257 1.231 2.037 3.05 2.447l1.777.41c3.514.807 5.51 2.516 5.51 5.195 0 3.364-2.68 5.168-5.784 5.51v1.354c0 .779-.478 1.244-1.216 1.244Z",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgDollarsGray);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,22 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgDollars = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
viewBox: "0 0 40 40",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 40,
height: 40,
rx: 20,
fill: "#28C281"
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M20.014 32.05c-.739 0-1.217-.464-1.217-1.243v-1.381c-2.899-.342-4.908-1.832-5.496-3.733a2.194 2.194 0 0 1-.137-.752c0-.86.588-1.435 1.531-1.435.793 0 1.245.465 1.532 1.107.546 1.395 1.832 2.16 3.91 2.16 2.2 0 3.61-.875 3.61-2.502 0-1.38-1.259-2.091-3.35-2.584l-1.86-.437c-3.117-.71-5.181-2.488-5.181-5.072 0-3.09 2.378-4.95 5.44-5.332V9.45c0-.78.48-1.244 1.218-1.244s1.216.465 1.216 1.244v1.395c2.68.328 4.622 1.777 5.223 3.787.069.26.123.506.123.765 0 .793-.601 1.272-1.476 1.272-.793 0-1.217-.383-1.559-1.04-.615-1.435-1.682-2.132-3.514-2.132-2.091 0-3.35.93-3.35 2.393 0 1.257 1.231 2.037 3.05 2.447l1.777.41c3.514.807 5.51 2.516 5.51 5.195 0 3.364-2.68 5.168-5.784 5.51v1.354c0 .779-.478 1.244-1.216 1.244Z",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgDollars);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,23 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgTonGray = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
fill: "none",
viewBox: "0 0 40 40",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 40,
height: 40,
rx: 20,
fill: "#8E8E92",
fillOpacity: 0.4
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M26.831 11H13.173c-2.512 0-4.103 2.709-2.84 4.899l8.43 14.61a1.43 1.43 0 0 0 2.478 0l8.431-14.61c1.262-2.187-.33-4.899-2.84-4.899h-.001zm-8.075 15.128-1.836-3.553-4.43-7.922a.774.774 0 0 1 .68-1.157h5.584V26.13l.002-.002zm8.754-11.477-4.428 7.926-1.836 3.551V13.494h5.583c.612 0 .973.65.68 1.157z",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgTonGray);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,22 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgTon = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
fill: "none",
viewBox: "0 0 40 40",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 40,
height: 40,
rx: 20,
fill: "#0098EA"
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M26.831 11H13.173c-2.512 0-4.103 2.709-2.84 4.899l8.43 14.61a1.43 1.43 0 0 0 2.478 0l8.431-14.61c1.262-2.187-.33-4.899-2.84-4.899h-.001zm-8.075 15.128-1.836-3.553-4.43-7.922a.774.774 0 0 1 .68-1.157h5.584V26.13l.002-.002zm8.754-11.477-4.428 7.926-1.836 3.551V13.494h5.583c.612 0 .973.65.68 1.157z",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgTon);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,23 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgUsdtGray = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
viewBox: "0 0 40 40",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 40,
height: 40,
rx: 20,
fill: "#8E8E92",
fillOpacity: 0.4
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M22.03 21.741v-.002c-.114.008-.702.042-2.011.042-1.047 0-1.781-.03-2.041-.042v.002c-4.026-.177-7.03-.877-7.03-1.717 0-.838 3.006-1.54 7.03-1.718v2.738c.262.019 1.017.064 2.06.064 1.25 0 1.876-.053 1.992-.064V18.31c4.018.18 7.013.88 7.013 1.717 0 .838-2.997 1.538-7.013 1.718m0-3.719v-2.448h5.606v-3.735H12.375v3.734h5.605v2.45c-4.556.209-7.98 1.11-7.98 2.191 0 1.082 3.427 1.983 7.98 2.195v7.85h4.053v-7.85C26.58 22.202 30 21.302 30 20.22c0-1.079-3.419-1.982-7.967-2.192",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgUsdtGray);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,22 @@
var _rect, _path;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from "react";
import { forwardRef } from "react";
const SvgUsdt = (props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
width: 40,
height: 40,
viewBox: "0 0 40 40",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
ref: ref
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
width: 40,
height: 40,
rx: 20,
fill: "#2AAF86"
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M22.03 21.741v-.002c-.114.008-.702.042-2.011.042-1.047 0-1.781-.03-2.041-.042v.002c-4.026-.177-7.03-.877-7.03-1.717 0-.838 3.006-1.54 7.03-1.718v2.738c.262.019 1.017.064 2.06.064 1.25 0 1.876-.053 1.992-.064V18.31c4.018.18 7.013.88 7.013 1.717 0 .838-2.997 1.538-7.013 1.718m0-3.719v-2.448h5.606v-3.735H12.375v3.734h5.605v2.45c-4.556.209-7.98 1.11-7.98 2.191 0 1.082 3.427 1.983 7.98 2.195v7.85h4.053v-7.85C26.58 22.202 30 21.302 30 20.22c0-1.079-3.419-1.982-7.967-2.192",
fill: "#fff"
})));
const ForwardRef = /*#__PURE__*/forwardRef(SvgUsdt);
export { ForwardRef as ReactComponent };

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"wrapper":"hECr","header__material":"D2VR","header__apple":"a1Ni","text":"w_wZ","text__material":"bLy8","text__apple":"zyZe"};

View file

@ -0,0 +1,23 @@
import { FC, ReactNode } from 'react';
import { useTheme } from 'hooks/utils/useTheme';
import styles from './Error.module.scss';
const Error: FC<{ header?: ReactNode; text?: ReactNode }> = ({
text,
header,
}) => {
const { themeClassName } = useTheme(styles);
return (
<div className="container">
<div className={styles.wrapper}>
{header && <h1 className={themeClassName('header')}>{header}</h1>}
{text && <p className={themeClassName('text')}>{text}</p>}
</div>
</div>
);
};
export default Error;

View file

@ -0,0 +1,74 @@
import { FC, useLayoutEffect, useRef, useState } from 'react';
import { isRtl } from 'utils/common/common';
import { useLanguage } from 'hooks/utils/useLanguage';
interface FitTextRowProps {
className?: string;
align?: 'flex-start' | 'flex-end' | 'center' | 'space-between';
}
const FitTextRow: FC<FitTextRowProps> = ({
children,
className,
align = 'flex-start',
}) => {
const stretchedRef = useRef<HTMLDivElement>(null);
const rootRef = useRef<HTMLDivElement>(null);
const [scale, setScale] = useState<number>();
const languageCode = useLanguage();
let transformOrigin;
switch (align) {
case 'flex-start':
case 'space-between':
transformOrigin = isRtl(languageCode) ? 'right' : 'left';
break;
case 'flex-end':
transformOrigin = isRtl(languageCode) ? 'left' : 'right';
break;
case 'center':
transformOrigin = 'center';
}
useLayoutEffect(() => {
if (stretchedRef?.current && rootRef?.current) {
const diff =
rootRef.current.offsetWidth / stretchedRef.current.offsetWidth;
if (diff <= 1) {
setScale(diff);
} else {
setScale(1);
}
}
}, [children]);
return (
<div className={className}>
<div
style={{
maxWidth: '100%',
whiteSpace: 'nowrap',
display: 'flex',
justifyContent: align,
}}
ref={rootRef}
>
<div
ref={stretchedRef}
style={{
transform: `scale(${scale})`,
transformOrigin,
flexGrow: align === 'space-between' ? 1 : 'initial',
}}
>
{children}
</div>
</div>
</div>
);
};
export default FitTextRow;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"nY8p","ready":"Vr6w","slides":"ULY2","freeze":"LJDd","slide":"x1Ds"};

View file

@ -0,0 +1,149 @@
import classNames from 'classnames';
import {
Children,
FC,
ReactElement,
useCallback,
useEffect,
useRef,
useState,
} from 'react';
import {
PageControl,
TPageControl,
} from 'components/Gallery/components/PageControl/PageControl';
import { useTimeout } from 'hooks/utils/useTimeout';
import styles from './Gallery.module.scss';
type GalleryProps = {
initialSlideIndex?: number;
onChange?: (slideIndex: number) => void;
className?: string;
renderPageControl?: (props: TPageControl) => ReactElement<TPageControl>;
autoplay?: boolean;
autoplayDuration?: number;
freeze?: boolean;
};
export const Gallery: FC<GalleryProps> & {
PageControl: typeof PageControl;
} = ({
children,
onChange,
initialSlideIndex = 0,
className,
renderPageControl,
autoplay = false,
autoplayDuration = 2000,
freeze,
}) => {
const slidesRef = useRef<HTMLDivElement>(null);
const intervalRef = useRef<NodeJS.Timer | null>(null);
const [activeSlideIndex, setActiveSlideIndex] = useState(0);
const [ready, setReady] = useState(initialSlideIndex === 0);
const [setScrollHandler] = useTimeout();
const slidesCount = Children.count(children);
const slideTo = useCallback(
(slideIndex: number, behavior: ScrollBehavior = 'auto') => {
if (
slidesRef.current &&
slideIndex >= 0 &&
slideIndex < slidesCount &&
slideIndex !== activeSlideIndex
) {
slidesRef.current.scrollTo({
left: slidesRef.current.offsetWidth * slideIndex,
behavior,
});
}
},
[activeSlideIndex, slidesCount],
);
const nextSlide = useCallback(() => {
if (activeSlideIndex === slidesCount - 1) {
slideTo(0, 'smooth');
return;
}
slideTo(activeSlideIndex + 1, 'smooth');
}, [activeSlideIndex, slideTo, slidesCount]);
const scrollHandler = () => {
if (slidesRef.current) {
const arrOfLefts = Array.from(slidesRef.current.children).map((item) =>
Math.abs(item.getBoundingClientRect().left),
);
const activeSlideIndex = arrOfLefts.indexOf(Math.min(...arrOfLefts));
onChange && onChange(activeSlideIndex);
setActiveSlideIndex(activeSlideIndex);
}
};
const debouncedScrollHandler = useCallback(
() => setScrollHandler(scrollHandler, 50),
[onChange],
);
useEffect(() => {
slideTo(initialSlideIndex);
requestAnimationFrame(() => setReady(true));
}, []);
useEffect(() => {
if (intervalRef.current) {
clearInterval(intervalRef.current);
}
if (autoplay) {
intervalRef.current = setInterval(nextSlide, autoplayDuration);
return () => {
if (intervalRef.current) {
clearInterval(intervalRef.current);
}
};
}
}, [autoplay, autoplayDuration, nextSlide]);
return (
<>
<div
className={classNames(
styles.root,
ready && styles.ready,
freeze && styles.freeze,
className,
)}
>
<div
className={styles.slides}
onScroll={debouncedScrollHandler}
ref={slidesRef}
>
{Children.map(children, (child, index) => {
return (
<div key={index} className={styles.slide}>
{child}
</div>
);
})}
</div>
</div>
{renderPageControl &&
!freeze &&
renderPageControl({
activeIndex: activeSlideIndex,
count: slidesCount,
type: autoplay ? 'progress' : 'regular',
durationTime: autoplayDuration,
})}
</>
);
};
Gallery.PageControl = PageControl;

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"eDj5","platter":"yosA","container":"f4ED","active":"vVVX","back":"QCqV","dot":"NKbd","progress":"GJZv","resize":"ZCVO"};

View file

@ -0,0 +1,56 @@
import classNames from 'classnames';
import { CSSProperties } from 'react';
import styles from './PageControl.module.scss';
export type TPageControl = {
activeIndex?: number;
count?: number;
platter?: boolean;
type?: 'regular' | 'progress';
durationTime?: number;
};
export const PageControl: React.FC<TPageControl> = ({
activeIndex,
count = 0,
type = 'regular',
platter = false,
durationTime = 2000,
}) => {
return (
<>
{count && (
<div
className={classNames(styles.root, platter && styles.platter)}
style={
{
['--page-control-duration-time']: `${durationTime + 1000}ms`,
} as CSSProperties
}
>
{[...Array(count)].map((_, index) => {
return (
<div
key={index}
className={classNames(
styles.container,
activeIndex === index && type === 'progress' && styles.active,
)}
>
<div className={styles.back} />
<div
className={classNames(
styles.dot,
styles[type],
activeIndex === index && styles.active,
)}
/>
</div>
);
})}
</div>
)}
</>
);
};

View file

@ -0,0 +1,2 @@
// extracted by mini-css-extract-plugin
export default {"root":"qQ7G","loaded":"vKsn"};

Some files were not shown because too many files have changed in this diff Show more