mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add eslint linter
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {request} from "./index";
|
||||
import {request} from './index'
|
||||
import {ConnectorElement} from '../../components/tracking/connector/ConnectorsList'
|
||||
|
||||
export enum ConnectorProvider {
|
||||
OVH = 'ovh',
|
||||
@@ -7,13 +8,18 @@ export enum ConnectorProvider {
|
||||
NAMECHEAP = 'namecheap'
|
||||
}
|
||||
|
||||
export type Connector = {
|
||||
export interface Connector {
|
||||
provider: ConnectorProvider
|
||||
authData: object
|
||||
}
|
||||
|
||||
export async function getConnectors() {
|
||||
const response = await request({
|
||||
interface ConnectorResponse {
|
||||
'hydra:totalItems': number
|
||||
'hydra:member': ConnectorElement[]
|
||||
}
|
||||
|
||||
export async function getConnectors(): Promise<ConnectorResponse> {
|
||||
const response = await request<ConnectorResponse>({
|
||||
url: 'connectors'
|
||||
})
|
||||
return response.data
|
||||
@@ -25,7 +31,7 @@ export async function postConnector(connector: Connector) {
|
||||
url: 'connectors',
|
||||
data: connector,
|
||||
headers: {
|
||||
"Content-Type": 'application/json'
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
return response.data
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {Domain, request} from ".";
|
||||
|
||||
import {Domain, request} from '.'
|
||||
|
||||
export async function getDomain(ldhName: string): Promise<Domain> {
|
||||
const response = await request<Domain>({
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import axios, {AxiosRequestConfig, AxiosResponse} from "axios";
|
||||
|
||||
import axios, {AxiosRequestConfig, AxiosResponse} from 'axios'
|
||||
|
||||
export type EventAction =
|
||||
'registration'
|
||||
@@ -26,7 +25,12 @@ export interface Event {
|
||||
|
||||
export interface Entity {
|
||||
handle: string
|
||||
jCard: any
|
||||
jCard: ['vcard', Array<[
|
||||
string,
|
||||
{ [key: string]: string | string[] },
|
||||
string,
|
||||
string | string[],
|
||||
]>] | []
|
||||
}
|
||||
|
||||
export interface Nameserver {
|
||||
@@ -50,12 +54,12 @@ export interface Domain {
|
||||
handle: string
|
||||
status: string[]
|
||||
events: Event[]
|
||||
entities: {
|
||||
entities: Array<{
|
||||
entity: Entity
|
||||
events: Event[]
|
||||
roles: string[]
|
||||
deleted: boolean
|
||||
}[]
|
||||
}>
|
||||
nameservers: Nameserver[]
|
||||
tld: Tld
|
||||
deleted: boolean
|
||||
@@ -70,20 +74,24 @@ export interface User {
|
||||
|
||||
export interface WatchlistRequest {
|
||||
name?: string
|
||||
domains: string[],
|
||||
triggers: { event: EventAction, action: TriggerAction }[],
|
||||
domains: string[]
|
||||
triggers: Array<{ event: EventAction, action: TriggerAction }>
|
||||
connector?: string
|
||||
dsn?: string[]
|
||||
}
|
||||
|
||||
export interface Watchlist {
|
||||
token: string
|
||||
name?: string
|
||||
domains: Domain[],
|
||||
triggers: { event: EventAction, action: TriggerAction }[],
|
||||
connector?: string
|
||||
createdAt: string
|
||||
token: string
|
||||
domains: Domain[]
|
||||
triggers?: Array<{ event: EventAction, action: string }>
|
||||
dsn?: string[]
|
||||
connector?: {
|
||||
id: string
|
||||
provider: string
|
||||
createdAt: string
|
||||
}
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export interface InstanceConfig {
|
||||
@@ -97,28 +105,30 @@ export interface Statistics {
|
||||
alertSent: number
|
||||
domainPurchased: number
|
||||
domainPurchaseFailed: number
|
||||
domainCount: {tld: string, domain: number}[]
|
||||
domainCount: Array<{ tld: string, domain: number }>
|
||||
domainCountTotal: number
|
||||
domainTracked: number
|
||||
}
|
||||
|
||||
export async function request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig): Promise<R> {
|
||||
export interface TrackedDomains {
|
||||
'hydra:totalItems': number
|
||||
'hydra:member': Domain[]
|
||||
}
|
||||
|
||||
export async function request<T = object, R = AxiosResponse<T>, D = object>(config: AxiosRequestConfig): Promise<R> {
|
||||
const axiosConfig: AxiosRequestConfig = {
|
||||
...config,
|
||||
baseURL: '/api',
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
Accept: 'application/ld+json',
|
||||
...config.headers,
|
||||
...config.headers
|
||||
}
|
||||
}
|
||||
return await axios.request<T, R, D>(axiosConfig)
|
||||
}
|
||||
|
||||
|
||||
export * from './domain'
|
||||
export * from './tld'
|
||||
export * from './user'
|
||||
export * from './watchlist'
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import {request} from "./index";
|
||||
import {request, Tld} from './index'
|
||||
|
||||
interface Tld {
|
||||
tld: string
|
||||
contractTerminated: boolean
|
||||
registryOperator: string
|
||||
specification13: boolean
|
||||
interface TldList {
|
||||
'hydra:totalItems': number
|
||||
'hydra:member': Tld[]
|
||||
}
|
||||
|
||||
export async function getTldList(params: object): Promise<any> {
|
||||
return (await request<Tld[]>({
|
||||
export async function getTldList(params: object): Promise<TldList> {
|
||||
return (await request<TldList>({
|
||||
url: 'tld',
|
||||
params,
|
||||
params
|
||||
})).data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {InstanceConfig, request, Statistics, User} from "./index";
|
||||
|
||||
import {InstanceConfig, request, Statistics, User} from './index'
|
||||
|
||||
export async function login(email: string, password: string): Promise<boolean> {
|
||||
const response = await request({
|
||||
@@ -19,7 +18,6 @@ export async function register(email: string, password: string): Promise<boolean
|
||||
return response.status === 201
|
||||
}
|
||||
|
||||
|
||||
export async function getUser(): Promise<User> {
|
||||
const response = await request<User>({
|
||||
url: 'me'
|
||||
@@ -39,4 +37,4 @@ export async function getStatistics(): Promise<Statistics> {
|
||||
url: 'stats'
|
||||
})
|
||||
return response.data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import {Domain, request, Watchlist, WatchlistRequest} from "./index";
|
||||
import {request, TrackedDomains, Watchlist, WatchlistRequest} from './index'
|
||||
|
||||
export async function getWatchlists() {
|
||||
const response = await request({
|
||||
interface WatchlistList {
|
||||
'hydra:totalItems': number
|
||||
'hydra:member': Watchlist[]
|
||||
}
|
||||
|
||||
export async function getWatchlists(): Promise<WatchlistList> {
|
||||
const response = await request<WatchlistList>({
|
||||
url: 'watchlists'
|
||||
})
|
||||
return response.data
|
||||
@@ -20,7 +25,7 @@ export async function postWatchlist(watchlist: WatchlistRequest) {
|
||||
url: 'watchlists',
|
||||
data: watchlist,
|
||||
headers: {
|
||||
"Content-Type": 'application/json'
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
return response.data
|
||||
@@ -37,17 +42,16 @@ export async function putWatchlist(watchlist: Partial<WatchlistRequest> & { toke
|
||||
const response = await request<WatchlistRequest>({
|
||||
method: 'PUT',
|
||||
url: 'watchlists/' + watchlist.token,
|
||||
data: watchlist,
|
||||
data: watchlist
|
||||
})
|
||||
return response.data
|
||||
}
|
||||
|
||||
export async function getTrackedDomainList(params: { page: number, itemsPerPage: number }): Promise<any> {
|
||||
const response = await request({
|
||||
export async function getTrackedDomainList(params: { page: number, itemsPerPage: number }): Promise<TrackedDomains> {
|
||||
const response = await request<TrackedDomains>({
|
||||
method: 'GET',
|
||||
url: 'tracked',
|
||||
params
|
||||
})
|
||||
return response.data
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
import {EventAction} from "../api";
|
||||
import {EventAction} from '../api'
|
||||
|
||||
export const actionToColor = (a: EventAction) => a === 'registration' ? 'green' :
|
||||
a === 'reregistration' ? 'cyan' :
|
||||
a === 'expiration' ? 'red' :
|
||||
a === 'deletion' ? 'magenta' :
|
||||
a === 'transfer' ? 'orange' :
|
||||
a === 'last changed' ? 'blue' :
|
||||
a === 'registrar expiration' ? 'red' :
|
||||
a === 'reinstantiation' ? 'purple' :
|
||||
a === 'enum validation expiration' ? 'red' : 'default'
|
||||
export const actionToColor = (a: EventAction) => a === 'registration'
|
||||
? 'green'
|
||||
: a === 'reregistration'
|
||||
? 'cyan'
|
||||
: a === 'expiration'
|
||||
? 'red'
|
||||
: a === 'deletion'
|
||||
? 'magenta'
|
||||
: a === 'transfer'
|
||||
? 'orange'
|
||||
: a === 'last changed'
|
||||
? 'blue'
|
||||
: a === 'registrar expiration'
|
||||
? 'red'
|
||||
: a === 'reinstantiation'
|
||||
? 'purple'
|
||||
: a === 'enum validation expiration' ? 'red' : 'default'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {EventAction} from "../api";
|
||||
import {EventAction} from '../api'
|
||||
import {
|
||||
ClockCircleOutlined,
|
||||
DeleteOutlined,
|
||||
@@ -9,20 +9,31 @@ import {
|
||||
SignatureOutlined,
|
||||
SyncOutlined,
|
||||
UnlockOutlined
|
||||
} from "@ant-design/icons";
|
||||
import React from "react";
|
||||
} from '@ant-design/icons'
|
||||
import React from 'react'
|
||||
|
||||
export const actionToIcon = (a: EventAction) => a === 'registration' ?
|
||||
<SignatureOutlined style={{fontSize: '16px'}}/> : a === 'expiration' ?
|
||||
<ClockCircleOutlined style={{fontSize: '16px'}}/> : a === 'transfer' ?
|
||||
<ShareAltOutlined style={{fontSize: '16px'}}/> : a === 'last changed' ?
|
||||
<SyncOutlined style={{fontSize: '16px'}}/> : a === 'deletion' ?
|
||||
<DeleteOutlined style={{fontSize: '16px'}}/> : a === 'reregistration' ?
|
||||
<ReloadOutlined style={{fontSize: '16px'}}/> : a === 'locked' ?
|
||||
<LockOutlined style={{fontSize: '16px'}}/> : a === 'unlocked' ?
|
||||
<UnlockOutlined style={{fontSize: '16px'}}/> : a === 'registrar expiration' ?
|
||||
<ClockCircleOutlined
|
||||
style={{fontSize: '16px'}}/> : a === 'enum validation expiration' ?
|
||||
<ClockCircleOutlined style={{fontSize: '16px'}}/> : a === 'reinstantiation' ?
|
||||
<ReloadOutlined style={{fontSize: '16px'}}/> :
|
||||
<PushpinOutlined style={{fontSize: '16px'}}/>
|
||||
export const actionToIcon = (a: EventAction) => a === 'registration'
|
||||
? <SignatureOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'expiration'
|
||||
? <ClockCircleOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'transfer'
|
||||
? <ShareAltOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'last changed'
|
||||
? <SyncOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'deletion'
|
||||
? <DeleteOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'reregistration'
|
||||
? <ReloadOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'locked'
|
||||
? <LockOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'unlocked'
|
||||
? <UnlockOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'registrar expiration'
|
||||
? <ClockCircleOutlined
|
||||
style={{fontSize: '16px'}}
|
||||
/>
|
||||
: a === 'enum validation expiration'
|
||||
? <ClockCircleOutlined style={{fontSize: '16px'}}/>
|
||||
: a === 'reinstantiation'
|
||||
? <ReloadOutlined style={{fontSize: '16px'}}/>
|
||||
: <PushpinOutlined style={{fontSize: '16px'}}/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Entity} from "../api";
|
||||
import vCard from "vcf";
|
||||
import {Entity} from '../api'
|
||||
import vCard from 'vcf'
|
||||
|
||||
export const entityToName = (e: { entity: Entity }): string => {
|
||||
if (e.entity.jCard.length === 0) return e.entity.handle
|
||||
@@ -10,4 +10,4 @@ export const entityToName = (e: { entity: Entity }): string => {
|
||||
if (jCard.data.fn && !Array.isArray(jCard.data.fn) && jCard.data.fn.valueOf() !== '') name = jCard.data.fn.valueOf()
|
||||
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
export const eppStatusCodeToColor = (s: string) =>
|
||||
['active', 'ok'].includes(s) ? 'green' :
|
||||
['pending delete', 'redemption period'].includes(s) ? 'red' :
|
||||
s.startsWith('client') ? 'purple' :
|
||||
s.startsWith('server') ? 'geekblue' : 'blue'
|
||||
['active', 'ok'].includes(s)
|
||||
? 'green'
|
||||
: ['pending delete', 'redemption period'].includes(s)
|
||||
? 'red'
|
||||
: s.startsWith('client')
|
||||
? 'purple'
|
||||
: s.startsWith('server') ? 'geekblue' : 'blue'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import vCard from "vcf";
|
||||
import {Entity} from "../api";
|
||||
import vCard from 'vcf'
|
||||
import {Entity} from '../api'
|
||||
|
||||
export const extractDetailsFromJCard = (e: { entity: Entity }): {
|
||||
fn?: string
|
||||
organization?: string;
|
||||
organization?: string
|
||||
} => {
|
||||
if (e.entity.jCard.length === 0) return {fn: e.entity.handle}
|
||||
const jCard = vCard.fromJSON(e.entity.jCard)
|
||||
@@ -11,4 +11,4 @@ export const extractDetailsFromJCard = (e: { entity: Entity }): {
|
||||
const organization = jCard.data.org && !Array.isArray(jCard.data.org) ? jCard.data.org.valueOf() : undefined
|
||||
|
||||
return {fn, organization}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ export const getCountryCode = (tld: string): string => {
|
||||
const exceptions = {uk: 'gb', su: 'ru', tp: 'tl'}
|
||||
if (tld in exceptions) return exceptions[tld as keyof typeof exceptions]
|
||||
return tld.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {t} from "ttag";
|
||||
import {t} from 'ttag'
|
||||
|
||||
/**
|
||||
* @see https://www.iana.org/assignments/rdap-json-values/rdap-json-values.xhtml
|
||||
@@ -17,7 +17,6 @@ export const rdapRoleTranslation = () => ({
|
||||
noc: t`Noc`
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* @see https://www.iana.org/assignments/rdap-json-values/rdap-json-values.xhtml
|
||||
*/
|
||||
@@ -35,7 +34,6 @@ export const rdapRoleDetailTranslation = () => ({
|
||||
noc: t`The entity object instance handles communications related to a network operations center (NOC).`
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* @see https://www.iana.org/assignments/rdap-json-values/rdap-json-values.xhtml
|
||||
*/
|
||||
@@ -75,20 +73,20 @@ export const rdapEventDetailTranslation = () => ({
|
||||
* @see https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en
|
||||
*/
|
||||
export const rdapStatusCodeDetailTranslation = () => ({
|
||||
'validated': t`Signifies that the data of the object instance has been found to be accurate.`,
|
||||
validated: t`Signifies that the data of the object instance has been found to be accurate.`,
|
||||
'renew prohibited': t`Renewal or reregistration of the object instance is forbidden.`,
|
||||
'update prohibited': t`Updates to the object instance are forbidden.`,
|
||||
'transfer prohibited': t`Transfers of the registration from one registrar to another are forbidden.`,
|
||||
'delete prohibited': t`Deletion of the registration of the object instance is forbidden.`,
|
||||
'proxy': t`The registration of the object instance has been performed by a third party.`,
|
||||
'private': t`The information of the object instance is not designated for public consumption.`,
|
||||
'removed': t`Some of the information of the object instance has not been made available and has been removed.`,
|
||||
'obscured': t`Some of the information of the object instance has been altered for the purposes of not readily revealing the actual information of the object instance.`,
|
||||
'associated': t`The object instance is associated with other object instances in the registry.`,
|
||||
'locked': t`Changes to the object instance cannot be made, including the association of other object instances.`,
|
||||
proxy: t`The registration of the object instance has been performed by a third party.`,
|
||||
private: t`The information of the object instance is not designated for public consumption.`,
|
||||
removed: t`Some of the information of the object instance has not been made available and has been removed.`,
|
||||
obscured: t`Some of the information of the object instance has been altered for the purposes of not readily revealing the actual information of the object instance.`,
|
||||
associated: t`The object instance is associated with other object instances in the registry.`,
|
||||
locked: t`Changes to the object instance cannot be made, including the association of other object instances.`,
|
||||
|
||||
'active': t`This is the standard status for a domain, meaning it has no pending operations or prohibitions.`,
|
||||
'inactive': t`This status code indicates that delegation information (name servers) has not been associated with your domain. Your domain is not activated in the DNS and will not resolve.`,
|
||||
active: t`This is the standard status for a domain, meaning it has no pending operations or prohibitions.`,
|
||||
inactive: t`This status code indicates that delegation information (name servers) has not been associated with your domain. Your domain is not activated in the DNS and will not resolve.`,
|
||||
'pending create': t`This status code indicates that a request to create your domain has been received and is being processed.`,
|
||||
'pending renew': t`This status code indicates that a request to renew your domain has been received and is being processed.`,
|
||||
'pending transfer': t`This status code indicates that a request to transfer your domain to a new registrar has been received and is being processed.`,
|
||||
@@ -96,7 +94,7 @@ export const rdapStatusCodeDetailTranslation = () => ({
|
||||
'pending delete': t`This status code may be mixed with redemptionPeriod or pendingRestore. In such case, depending on the status (i.e. redemptionPeriod or pendingRestore) set in the domain name, the corresponding description presented above applies. If this status is not combined with the redemptionPeriod or pendingRestore status, the pendingDelete status code indicates that your domain has been in redemptionPeriod status for 30 days and you have not restored it within that 30-day period. Your domain will remain in this status for several days, after which time your domain will be purged and dropped from the registry database. Once deletion occurs, the domain is available for re-registration in accordance with the registry's policies.`,
|
||||
'add period': t`This grace period is provided after the initial registration of a domain name. If the registrar deletes the domain name during this period, the registry may provide credit to the registrar for the cost of the registration.`,
|
||||
'auto renew period': t`This grace period is provided after a domain name registration period expires and is extended (renewed) automatically by the registry. If the registrar deletes the domain name during this period, the registry provides a credit to the registrar for the cost of the renewal.`,
|
||||
'ok': t`This is the standard status for a domain, meaning it has no pending operations or prohibitions.`,
|
||||
ok: t`This is the standard status for a domain, meaning it has no pending operations or prohibitions.`,
|
||||
'client delete prohibited': t`This status code tells your domain's registry to reject requests to delete the domain.`,
|
||||
'client hold': t`This status code tells your domain's registry to not activate your domain in the DNS and as a consequence, it will not resolve. It is an uncommon status that is usually enacted during legal disputes, non-payment, or when your domain is subject to deletion.`,
|
||||
'client renew prohibited': t`This status code tells your domain's registry to reject requests to renew your domain. It is an uncommon status that is usually enacted during legal disputes or when your domain is subject to deletion.`,
|
||||
@@ -112,6 +110,6 @@ export const rdapStatusCodeDetailTranslation = () => ({
|
||||
'server hold': t`This status code is set by your domain's Registry Operator. Your domain is not activated in the DNS.`,
|
||||
'transfer period': t`This grace period is provided after the successful transfer of a domain name from one registrar to another. If the new registrar deletes the domain name during this period, the registry provides a credit to the registrar for the cost of the transfer.`,
|
||||
|
||||
'administrative': t`The object instance has been allocated administratively (i.e., not for use by the recipient in their own right in operational networks).`,
|
||||
'reserved': t`The object instance has been allocated to an IANA special-purpose address registry.`,
|
||||
administrative: t`The object instance has been allocated administratively (i.e., not for use by the recipient in their own right in operational networks).`,
|
||||
reserved: t`The object instance has been allocated to an IANA special-purpose address registry.`
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Avatar} from "antd";
|
||||
import {Avatar} from 'antd'
|
||||
import {
|
||||
BankOutlined,
|
||||
DollarOutlined,
|
||||
@@ -6,20 +6,22 @@ import {
|
||||
SignatureOutlined,
|
||||
ToolOutlined,
|
||||
UserOutlined
|
||||
} from "@ant-design/icons";
|
||||
import React from "react";
|
||||
} from '@ant-design/icons'
|
||||
import React from 'react'
|
||||
|
||||
import {rolesToColor} from "./rolesToColor";
|
||||
import {rolesToColor} from './rolesToColor'
|
||||
|
||||
export const roleToAvatar = (e: { roles: string[] }) => <Avatar style={{backgroundColor: rolesToColor(e.roles)}}
|
||||
icon={e.roles.includes('registrant') ?
|
||||
<SignatureOutlined/> :
|
||||
e.roles.includes('registrar') ?
|
||||
<BankOutlined/> :
|
||||
e.roles.includes('administrative') ?
|
||||
<IdcardOutlined/> :
|
||||
e.roles.includes('technical') ?
|
||||
<ToolOutlined/> :
|
||||
e.roles.includes('billing') ?
|
||||
<DollarOutlined/> :
|
||||
<UserOutlined/>}/>
|
||||
export const roleToAvatar = (e: { roles: string[] }) => <Avatar
|
||||
style={{backgroundColor: rolesToColor(e.roles)}}
|
||||
icon={e.roles.includes('registrant')
|
||||
? <SignatureOutlined/>
|
||||
: e.roles.includes('registrar')
|
||||
? <BankOutlined/>
|
||||
: e.roles.includes('administrative')
|
||||
? <IdcardOutlined/>
|
||||
: e.roles.includes('technical')
|
||||
? <ToolOutlined/>
|
||||
: e.roles.includes('billing')
|
||||
? <DollarOutlined/>
|
||||
: <UserOutlined/>}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
export const rolesToColor = (roles: string[]) => roles.includes('registrant') ? 'green' :
|
||||
roles.includes('registrar') ? 'purple' :
|
||||
roles.includes('administrative') ? 'blue' :
|
||||
roles.includes('technical') ? 'orange' :
|
||||
roles.includes('sponsor') ? 'magenta' :
|
||||
roles.includes('billing') ? 'cyan' : 'default'
|
||||
export const rolesToColor = (roles: string[]) => roles.includes('registrant')
|
||||
? 'green'
|
||||
: roles.includes('registrar')
|
||||
? 'purple'
|
||||
: roles.includes('administrative')
|
||||
? 'blue'
|
||||
: roles.includes('technical')
|
||||
? 'orange'
|
||||
: roles.includes('sponsor')
|
||||
? 'magenta'
|
||||
: roles.includes('billing') ? 'cyan' : 'default'
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import {AxiosError, AxiosResponse} from "axios";
|
||||
import {MessageInstance, MessageType} from "antd/lib/message/interface";
|
||||
import {t} from "ttag";
|
||||
import {AxiosError, AxiosResponse} from 'axios'
|
||||
import {MessageInstance, MessageType} from 'antd/lib/message/interface'
|
||||
import {t} from 'ttag'
|
||||
|
||||
export function showErrorAPI(e: AxiosError, messageApi: MessageInstance): MessageType | undefined {
|
||||
|
||||
const response = e.response as AxiosResponse
|
||||
const data = response.data
|
||||
|
||||
@@ -24,4 +23,4 @@ export function showErrorAPI(e: AxiosError, messageApi: MessageInstance): Messag
|
||||
}
|
||||
|
||||
return messageApi.error(detail !== '' ? detail : t`An error occurred`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import {Domain} from "../api";
|
||||
import {Domain} from '../api'
|
||||
|
||||
export const sortDomainEntities = (domain: Domain) => domain.entities
|
||||
.filter(e => !e.deleted)
|
||||
.sort((e1, e2) => {
|
||||
const p = (r: string[]) => r.includes('registrant') ? 5 :
|
||||
r.includes('administrative') ? 4 :
|
||||
r.includes('billing') ? 3 :
|
||||
r.includes('registrar') ? 2 : 1
|
||||
const p = (r: string[]) => r.includes('registrant')
|
||||
? 5
|
||||
: r.includes('administrative')
|
||||
? 4
|
||||
: r.includes('billing')
|
||||
? 3
|
||||
: r.includes('registrar') ? 2 : 1
|
||||
return p(e2.roles) - p(e1.roles)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {getCountryCode} from "./getCountryCode";
|
||||
import {getCountryCode} from './getCountryCode'
|
||||
|
||||
export const tldToEmoji = (tld: string) => {
|
||||
if (tld.startsWith('xn--')) return '-'
|
||||
@@ -9,4 +9,4 @@ export const tldToEmoji = (tld: string) => {
|
||||
.split('')
|
||||
.map((char) => 127397 + char.charCodeAt(0))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,40 @@
|
||||
import {ConnectorProvider} from "../api/connectors";
|
||||
import {Typography} from "antd";
|
||||
import {t} from "ttag";
|
||||
import React from "react";
|
||||
import {ConnectorProvider} from '../api/connectors'
|
||||
import {Typography} from 'antd'
|
||||
import {t} from 'ttag'
|
||||
import React from 'react'
|
||||
|
||||
export const helpGetTokenLink = (provider?: string) => {
|
||||
switch (provider) {
|
||||
case ConnectorProvider.OVH:
|
||||
return <Typography.Link target='_blank'
|
||||
href="https://api.ovh.com/createToken/?GET=/order/cart&GET=/order/cart/*&POST=/order/cart&POST=/order/cart/*&DELETE=/order/cart/*&GET=/domain/extensions">
|
||||
{t`Retrieve a set of tokens from your customer account on the Provider's website`}
|
||||
</Typography.Link>
|
||||
return (
|
||||
<Typography.Link
|
||||
target='_blank'
|
||||
href='https://api.ovh.com/createToken/?GET=/order/cart&GET=/order/cart/*&POST=/order/cart&POST=/order/cart/*&DELETE=/order/cart/*&GET=/domain/extensions'
|
||||
>
|
||||
{t`Retrieve a set of tokens from your customer account on the Provider's website`}
|
||||
</Typography.Link>
|
||||
)
|
||||
|
||||
case ConnectorProvider.GANDI:
|
||||
return <Typography.Link target='_blank' href="https://admin.gandi.net/organizations/account/pat">
|
||||
{t`Retrieve a Personal Access Token from your customer account on the Provider's website`}
|
||||
</Typography.Link>
|
||||
return (
|
||||
<Typography.Link target='_blank' href='https://admin.gandi.net/organizations/account/pat'>
|
||||
{t`Retrieve a Personal Access Token from your customer account on the Provider's website`}
|
||||
</Typography.Link>
|
||||
)
|
||||
case ConnectorProvider.NAMECHEAP:
|
||||
return <Typography.Link target='_blank' href="https://ap.www.namecheap.com/settings/tools/apiaccess/">
|
||||
{t`Retreive an API key and whitelist this instance's IP address on Namecheap's website`}
|
||||
</Typography.Link>
|
||||
return (
|
||||
<Typography.Link target='_blank' href='https://ap.www.namecheap.com/settings/tools/apiaccess/'>
|
||||
{t`Retreive an API key and whitelist this instance's IP address on Namecheap's website`}
|
||||
</Typography.Link>
|
||||
)
|
||||
case ConnectorProvider.AUTODNS:
|
||||
return <Typography.Link target='_blank' href="https://en.autodns.com/domain-robot-api/">
|
||||
{t`Because of some limitations in API of AutoDNS, we suggest to create an dedicated user for API with limited rights`}
|
||||
</Typography.Link>
|
||||
return (
|
||||
<Typography.Link target='_blank' href='https://en.autodns.com/domain-robot-api/'>
|
||||
{t`Because of some limitations in API of AutoDNS, we suggest to create an dedicated user for API with limited rights`}
|
||||
</Typography.Link>
|
||||
)
|
||||
default:
|
||||
return <></>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +51,4 @@ export const tosHyperlink = (provider?: string) => {
|
||||
default:
|
||||
return ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {t} from "ttag";
|
||||
import {regionNames} from "../../i18n";
|
||||
import {t} from 'ttag'
|
||||
import {regionNames} from '../../i18n'
|
||||
|
||||
export const ovhFields = () => ({
|
||||
appKey: t`Application key`,
|
||||
@@ -24,4 +24,4 @@ export const ovhPricingMode = () => [
|
||||
value: 'create-premium',
|
||||
label: t`The domain is free but can be premium. Its price varies from one domain to another`
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user