mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2025-12-19 05:37:43 +00:00
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ declare global {
|
|||||||
*/
|
*/
|
||||||
mountTestProvider(
|
mountTestProvider(
|
||||||
component: React.ReactNode,
|
component: React.ReactNode,
|
||||||
options?: MountOptions & { authProps?: TestProviderProps["authProps"] }
|
options?: MountOptions & { authProps?: TestProviderProps["authProps"] },
|
||||||
): Cypress.Chainable<MountReturn>;
|
): Cypress.Chainable<MountReturn>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export const postAccount = (payload: Partial<Account>) => {
|
|||||||
export const putAccount = (sid: string, payload: Partial<Account>) => {
|
export const putAccount = (sid: string, payload: Partial<Account>) => {
|
||||||
return putFetch<EmptyResponse, Partial<Account>>(
|
return putFetch<EmptyResponse, Partial<Account>>(
|
||||||
`${API_ACCOUNTS}/${sid}`,
|
`${API_ACCOUNTS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
|||||||
11039
package-lock.json
generated
11039
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
62
package.json
62
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jambonz-webapp",
|
"name": "jambonz-webapp",
|
||||||
"description": "A simple provisioning web app for jambonz",
|
"description": "A simple provisioning web app for jambonz",
|
||||||
"version": "0.8.5",
|
"version": "0.9.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -42,45 +42,45 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jambonz/ui-kit": "^0.0.21",
|
"@jambonz/ui-kit": "^0.0.21",
|
||||||
"@stripe/react-stripe-js": "^2.1.1",
|
"@stripe/react-stripe-js": "^2.6.2",
|
||||||
"@stripe/stripe-js": "^1.54.1",
|
"@stripe/stripe-js": "^3.2.0",
|
||||||
"dayjs": "^1.11.5",
|
"dayjs": "^1.11.10",
|
||||||
"immutability-helper": "^3.1.1",
|
"immutability-helper": "^3.1.1",
|
||||||
"react": "^18.0.0",
|
"react": "^18.2.0",
|
||||||
"react-dnd": "16.0.1",
|
"react-dnd": "16.0.1",
|
||||||
"react-dnd-html5-backend": "16.0.1",
|
"react-dnd-html5-backend": "16.0.1",
|
||||||
"react-dom": "^18.0.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-feather": "^2.0.10",
|
"react-feather": "^2.0.10",
|
||||||
"react-router-dom": "^6.3.0",
|
"react-router-dom": "^6.22.3",
|
||||||
"wavesurfer.js": "^7.3.4"
|
"wavesurfer.js": "^7.7.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/cors": "^2.8.12",
|
"@types/cors": "^2.8.17",
|
||||||
"@types/express": "^4.17.13",
|
"@types/express": "^4.17.21",
|
||||||
"@types/node": "^18.6.1",
|
"@types/node": "^20.12.5",
|
||||||
"@types/react": "^18.0.0",
|
"@types/react": "^18.2.74",
|
||||||
"@types/react-dom": "^18.0.0",
|
"@types/react-dom": "^18.2.24",
|
||||||
"@types/uuid": "^9.0.1",
|
"@types/uuid": "^9.0.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||||
"@typescript-eslint/parser": "^5.30.6",
|
"@typescript-eslint/parser": "^7.5.0",
|
||||||
"@vitejs/plugin-react": "^1.3.0",
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"cypress": "^10.8.0",
|
"cypress": "^13.7.2",
|
||||||
"eslint": "^8.19.0",
|
"eslint": "^8.19.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.6.0",
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||||
"eslint-plugin-react": "^7.30.1",
|
"eslint-plugin-react": "^7.34.1",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"express": "^4.18.1",
|
"express": "^4.19.2",
|
||||||
"husky": "^8.0.1",
|
"husky": "^9.0.11",
|
||||||
"lint-staged": "^13.0.3",
|
"lint-staged": "^15.2.2",
|
||||||
"nanoid": "^4.0.0",
|
"nanoid": "^5.0.7",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^3.2.5",
|
||||||
"sass": "^1.53.0",
|
"sass": "^1.74.1",
|
||||||
"serve": "^14.0.1",
|
"serve": "^14.2.1",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^5.4.4",
|
||||||
"vite": "^3.0.0"
|
"vite": "^5.2.8"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,tsx}": "eslint --max-warnings=0",
|
"*.{ts,tsx}": "eslint --max-warnings=0",
|
||||||
|
|||||||
@@ -111,14 +111,14 @@ app.get(
|
|||||||
page: query.page,
|
page: query.page,
|
||||||
data: paged,
|
data: paged,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get(
|
app.get(
|
||||||
"/api/Accounts/:account_sid/RecentCalls/:call_sid",
|
"/api/Accounts/:account_sid/RecentCalls/:call_sid",
|
||||||
(req: Request, res: Response) => {
|
(req: Request, res: Response) => {
|
||||||
res.status(200).json({ total: Math.random() > 0.5 ? 1 : 0 });
|
res.status(200).json({ total: Math.random() > 0.5 ? 1 : 0 });
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get(
|
app.get(
|
||||||
@@ -126,7 +126,7 @@ app.get(
|
|||||||
(req: Request, res: Response) => {
|
(req: Request, res: Response) => {
|
||||||
/** Sample pcap file from: https://wiki.wireshark.org/SampleCaptures#sip-and-rtp */
|
/** Sample pcap file from: https://wiki.wireshark.org/SampleCaptures#sip-and-rtp */
|
||||||
const pcap: Buffer = fs.readFileSync(
|
const pcap: Buffer = fs.readFileSync(
|
||||||
path.resolve(process.cwd(), "server", "sample-sip-rtp-traffic.pcap")
|
path.resolve(process.cwd(), "server", "sample-sip-rtp-traffic.pcap"),
|
||||||
);
|
);
|
||||||
|
|
||||||
res
|
res
|
||||||
@@ -136,7 +136,7 @@ app.get(
|
|||||||
"Content-Disposition": "attachment",
|
"Content-Disposition": "attachment",
|
||||||
})
|
})
|
||||||
.send(pcap); // server: Buffer => client: Blob
|
.send(pcap); // server: Buffer => client: Blob
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get(
|
app.get(
|
||||||
@@ -144,7 +144,7 @@ app.get(
|
|||||||
(req: Request, res: Response) => {
|
(req: Request, res: Response) => {
|
||||||
/** Sample pcap file from: https://wiki.wireshark.org/SampleCaptures#sip-and-rtp */
|
/** Sample pcap file from: https://wiki.wireshark.org/SampleCaptures#sip-and-rtp */
|
||||||
const wav: Buffer = fs.readFileSync(
|
const wav: Buffer = fs.readFileSync(
|
||||||
path.resolve(process.cwd(), "server", "example.mp3")
|
path.resolve(process.cwd(), "server", "example.mp3"),
|
||||||
);
|
);
|
||||||
|
|
||||||
res
|
res
|
||||||
@@ -154,7 +154,7 @@ app.get(
|
|||||||
"Content-Disposition": "attachment",
|
"Content-Disposition": "attachment",
|
||||||
})
|
})
|
||||||
.send(wav); // server: Buffer => client: Blob
|
.send(wav); // server: Buffer => client: Blob
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get(
|
app.get(
|
||||||
@@ -162,10 +162,10 @@ app.get(
|
|||||||
(req: Request, res: Response) => {
|
(req: Request, res: Response) => {
|
||||||
const json = fs.readFileSync(
|
const json = fs.readFileSync(
|
||||||
path.resolve(process.cwd(), "server", "sample-jaeger.json"),
|
path.resolve(process.cwd(), "server", "sample-jaeger.json"),
|
||||||
{ encoding: "utf8" }
|
{ encoding: "utf8" },
|
||||||
);
|
);
|
||||||
res.status(200).json(JSON.parse(json));
|
res.status(200).json(JSON.parse(json));
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Alerts mock API responses for local dev */
|
/** Alerts mock API responses for local dev */
|
||||||
|
|||||||
146
src/api/index.ts
146
src/api/index.ts
@@ -101,7 +101,7 @@ import { JaegerRoot } from "./jaeger-types";
|
|||||||
/** Wrap all requests to normalize response handling */
|
/** Wrap all requests to normalize response handling */
|
||||||
const fetchTransport = <Type>(
|
const fetchTransport = <Type>(
|
||||||
url: string,
|
url: string,
|
||||||
options: RequestInit
|
options: RequestInit,
|
||||||
): Promise<FetchTransport<Type>> => {
|
): Promise<FetchTransport<Type>> => {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
@@ -189,7 +189,7 @@ const getAuthHeaders = () => {
|
|||||||
|
|
||||||
const getQuery = <Type>(query: Type) => {
|
const getQuery = <Type>(query: Type) => {
|
||||||
return decodeURIComponent(
|
return decodeURIComponent(
|
||||||
new URLSearchParams(query as unknown as Record<string, string>).toString()
|
new URLSearchParams(query as unknown as Record<string, string>).toString(),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ export const getFetch = <Type>(url: string) => {
|
|||||||
|
|
||||||
export const postFetch = <Type, Payload = undefined>(
|
export const postFetch = <Type, Payload = undefined>(
|
||||||
url: string,
|
url: string,
|
||||||
payload?: Payload
|
payload?: Payload,
|
||||||
) => {
|
) => {
|
||||||
return fetchTransport<Type>(url, {
|
return fetchTransport<Type>(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -261,7 +261,7 @@ export const deleteFetch = <Type>(url: string) => {
|
|||||||
|
|
||||||
export const deleteFetchWithPayload = <Type, Payload>(
|
export const deleteFetchWithPayload = <Type, Payload>(
|
||||||
url: string,
|
url: string,
|
||||||
payload: Payload
|
payload: Payload,
|
||||||
) => {
|
) => {
|
||||||
return fetchTransport<Type>(url, {
|
return fetchTransport<Type>(url, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
@@ -291,7 +291,7 @@ export const postLogout = () => {
|
|||||||
export const postServiceProviders = (payload: Partial<ServiceProvider>) => {
|
export const postServiceProviders = (payload: Partial<ServiceProvider>) => {
|
||||||
return postFetch<SidResponse, Partial<ServiceProvider>>(
|
return postFetch<SidResponse, Partial<ServiceProvider>>(
|
||||||
API_SERVICE_PROVIDERS,
|
API_SERVICE_PROVIDERS,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -305,24 +305,24 @@ export const postAccount = (payload: Partial<Account>) => {
|
|||||||
|
|
||||||
export const postAccountBucketCredentialTest = (
|
export const postAccountBucketCredentialTest = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<BucketCredential>
|
payload: Partial<BucketCredential>,
|
||||||
) => {
|
) => {
|
||||||
return postFetch<BucketCredentialTestResult, Partial<BucketCredential>>(
|
return postFetch<BucketCredentialTestResult, Partial<BucketCredential>>(
|
||||||
`${API_ACCOUNTS}/${sid}/BucketCredentialTest`,
|
`${API_ACCOUNTS}/${sid}/BucketCredentialTest`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postApplication = (payload: Partial<Application>) => {
|
export const postApplication = (payload: Partial<Application>) => {
|
||||||
return postFetch<SidResponse, Partial<Application>>(
|
return postFetch<SidResponse, Partial<Application>>(
|
||||||
API_APPLICATIONS,
|
API_APPLICATIONS,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postSpeechService = (
|
export const postSpeechService = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<SpeechCredential>
|
payload: Partial<SpeechCredential>,
|
||||||
) => {
|
) => {
|
||||||
const userData = parseJwt(getToken());
|
const userData = parseJwt(getToken());
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
@@ -336,14 +336,14 @@ export const postSpeechService = (
|
|||||||
export const postMsTeamsTentant = (payload: Partial<MSTeamsTenant>) => {
|
export const postMsTeamsTentant = (payload: Partial<MSTeamsTenant>) => {
|
||||||
return postFetch<SidResponse, Partial<MSTeamsTenant>>(
|
return postFetch<SidResponse, Partial<MSTeamsTenant>>(
|
||||||
API_MS_TEAMS_TENANTS,
|
API_MS_TEAMS_TENANTS,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postPhoneNumber = (payload: Partial<PhoneNumber>) => {
|
export const postPhoneNumber = (payload: Partial<PhoneNumber>) => {
|
||||||
return postFetch<SidResponse, Partial<PhoneNumber>>(
|
return postFetch<SidResponse, Partial<PhoneNumber>>(
|
||||||
API_PHONE_NUMBERS,
|
API_PHONE_NUMBERS,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -359,19 +359,19 @@ export const postCarrier = (sid: string, payload: Partial<Carrier>) => {
|
|||||||
|
|
||||||
export const postPredefinedCarrierTemplate = (
|
export const postPredefinedCarrierTemplate = (
|
||||||
currentServiceProviderSid: string,
|
currentServiceProviderSid: string,
|
||||||
predefinedCarrierSid: string
|
predefinedCarrierSid: string,
|
||||||
) => {
|
) => {
|
||||||
return postFetch<SidResponse>(
|
return postFetch<SidResponse>(
|
||||||
`${API_BASE_URL}/ServiceProviders/${currentServiceProviderSid}/PredefinedCarriers/${predefinedCarrierSid}`
|
`${API_BASE_URL}/ServiceProviders/${currentServiceProviderSid}/PredefinedCarriers/${predefinedCarrierSid}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postPredefinedCarrierTemplateAccount = (
|
export const postPredefinedCarrierTemplateAccount = (
|
||||||
accountSid: string,
|
accountSid: string,
|
||||||
predefinedCarrierSid: string
|
predefinedCarrierSid: string,
|
||||||
) => {
|
) => {
|
||||||
return postFetch<SidResponse>(
|
return postFetch<SidResponse>(
|
||||||
`${API_BASE_URL}/Accounts/${accountSid}/PredefinedCarriers/${predefinedCarrierSid}`
|
`${API_BASE_URL}/Accounts/${accountSid}/PredefinedCarriers/${predefinedCarrierSid}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -382,45 +382,45 @@ export const postSipGateway = (payload: Partial<SipGateway>) => {
|
|||||||
export const postSmppGateway = (payload: Partial<SmppGateway>) => {
|
export const postSmppGateway = (payload: Partial<SmppGateway>) => {
|
||||||
return postFetch<SidResponse, Partial<SmppGateway>>(
|
return postFetch<SidResponse, Partial<SmppGateway>>(
|
||||||
API_SMPP_GATEWAY,
|
API_SMPP_GATEWAY,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postServiceProviderLimit = (
|
export const postServiceProviderLimit = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<Limit>
|
payload: Partial<Limit>,
|
||||||
) => {
|
) => {
|
||||||
return postFetch<SidResponse, Partial<Limit>>(
|
return postFetch<SidResponse, Partial<Limit>>(
|
||||||
`${API_SERVICE_PROVIDERS}/${sid}/Limits`,
|
`${API_SERVICE_PROVIDERS}/${sid}/Limits`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postAccountLimit = (sid: string, payload: Partial<Limit>) => {
|
export const postAccountLimit = (sid: string, payload: Partial<Limit>) => {
|
||||||
return postFetch<SidResponse, Partial<Limit>>(
|
return postFetch<SidResponse, Partial<Limit>>(
|
||||||
`${API_ACCOUNTS}/${sid}/Limits`,
|
`${API_ACCOUNTS}/${sid}/Limits`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postPasswordSettings = (payload: Partial<PasswordSettings>) => {
|
export const postPasswordSettings = (payload: Partial<PasswordSettings>) => {
|
||||||
return postFetch<EmptyResponse, Partial<PasswordSettings>>(
|
return postFetch<EmptyResponse, Partial<PasswordSettings>>(
|
||||||
API_PASSWORD_SETTINGS,
|
API_PASSWORD_SETTINGS,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postForgotPassword = (payload: Partial<ForgotPassword>) => {
|
export const postForgotPassword = (payload: Partial<ForgotPassword>) => {
|
||||||
return postFetch<EmptyResponse, Partial<ForgotPassword>>(
|
return postFetch<EmptyResponse, Partial<ForgotPassword>>(
|
||||||
API_FORGOT_PASSWORD,
|
API_FORGOT_PASSWORD,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postSystemInformation = (payload: Partial<SystemInformation>) => {
|
export const postSystemInformation = (payload: Partial<SystemInformation>) => {
|
||||||
return postFetch<SystemInformation, Partial<SystemInformation>>(
|
return postFetch<SystemInformation, Partial<SystemInformation>>(
|
||||||
API_SYSTEM_INFORMATION,
|
API_SYSTEM_INFORMATION,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -430,11 +430,11 @@ export const postLcr = (payload: Partial<Lcr>) => {
|
|||||||
|
|
||||||
export const postLcrCreateRoutes = (
|
export const postLcrCreateRoutes = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<LcrRoute[]>
|
payload: Partial<LcrRoute[]>,
|
||||||
) => {
|
) => {
|
||||||
return postFetch<EmptyResponse, Partial<LcrRoute[]>>(
|
return postFetch<EmptyResponse, Partial<LcrRoute[]>>(
|
||||||
`${API_LCRS}/${sid}/Routes`,
|
`${API_LCRS}/${sid}/Routes`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -443,11 +443,11 @@ export const postLcrRoute = (payload: Partial<LcrRoute>) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const postLcrCarrierSetEntry = (
|
export const postLcrCarrierSetEntry = (
|
||||||
payload: Partial<LcrCarrierSetEntry>
|
payload: Partial<LcrCarrierSetEntry>,
|
||||||
) => {
|
) => {
|
||||||
return postFetch<SidResponse, Partial<LcrCarrierSetEntry>>(
|
return postFetch<SidResponse, Partial<LcrCarrierSetEntry>>(
|
||||||
API_LCR_CARRIER_SET_ENTRIES,
|
API_LCR_CARRIER_SET_ENTRIES,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -458,27 +458,27 @@ export const postClient = (payload: Partial<Client>) => {
|
|||||||
export const postRegister = (payload: Partial<RegisterRequest>) => {
|
export const postRegister = (payload: Partial<RegisterRequest>) => {
|
||||||
return postFetch<RegisterResponse, Partial<RegisterRequest>>(
|
return postFetch<RegisterResponse, Partial<RegisterRequest>>(
|
||||||
API_REGISTER,
|
API_REGISTER,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postSipRealms = (accountSid: string, domain: string) => {
|
export const postSipRealms = (accountSid: string, domain: string) => {
|
||||||
return postFetch<EmptyResponse>(
|
return postFetch<EmptyResponse>(
|
||||||
`${API_ACCOUNTS}/${accountSid}/SipRealms/${domain}`
|
`${API_ACCOUNTS}/${accountSid}/SipRealms/${domain}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postSubscriptions = (payload: Partial<Subscription>) => {
|
export const postSubscriptions = (payload: Partial<Subscription>) => {
|
||||||
return postFetch<Subscription, Partial<Subscription>>(
|
return postFetch<Subscription, Partial<Subscription>>(
|
||||||
API_SUBSCRIPTIONS,
|
API_SUBSCRIPTIONS,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const postChangepassword = (payload: Partial<ChangePassword>) => {
|
export const postChangepassword = (payload: Partial<ChangePassword>) => {
|
||||||
return postFetch<EmptyResponse, Partial<ChangePassword>>(
|
return postFetch<EmptyResponse, Partial<ChangePassword>>(
|
||||||
API_CHANGE_PASSWORD,
|
API_CHANGE_PASSWORD,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ export const postSignIn = (payload: Partial<SignIn>) => {
|
|||||||
export const postGoogleCustomVoice = (payload: Partial<GoogleCustomVoice>) => {
|
export const postGoogleCustomVoice = (payload: Partial<GoogleCustomVoice>) => {
|
||||||
return postFetch<SidResponse, Partial<GoogleCustomVoice>>(
|
return postFetch<SidResponse, Partial<GoogleCustomVoice>>(
|
||||||
API_GOOGLE_CUSTOM_VOICES,
|
API_GOOGLE_CUSTOM_VOICES,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/** Named wrappers for `putFetch` */
|
/** Named wrappers for `putFetch` */
|
||||||
@@ -497,38 +497,38 @@ export const postGoogleCustomVoice = (payload: Partial<GoogleCustomVoice>) => {
|
|||||||
export const putUser = (sid: string, payload: Partial<UserUpdatePayload>) => {
|
export const putUser = (sid: string, payload: Partial<UserUpdatePayload>) => {
|
||||||
return putFetch<EmptyResponse, Partial<UserUpdatePayload>>(
|
return putFetch<EmptyResponse, Partial<UserUpdatePayload>>(
|
||||||
`${API_USERS}/${sid}`,
|
`${API_USERS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putServiceProvider = (
|
export const putServiceProvider = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<ServiceProvider>
|
payload: Partial<ServiceProvider>,
|
||||||
) => {
|
) => {
|
||||||
return putFetch<EmptyResponse, Partial<ServiceProvider>>(
|
return putFetch<EmptyResponse, Partial<ServiceProvider>>(
|
||||||
`${API_SERVICE_PROVIDERS}/${sid}`,
|
`${API_SERVICE_PROVIDERS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putAccount = (sid: string, payload: Partial<Account>) => {
|
export const putAccount = (sid: string, payload: Partial<Account>) => {
|
||||||
return putFetch<EmptyResponse, Partial<Account>>(
|
return putFetch<EmptyResponse, Partial<Account>>(
|
||||||
`${API_ACCOUNTS}/${sid}`,
|
`${API_ACCOUNTS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putApplication = (sid: string, payload: Partial<Application>) => {
|
export const putApplication = (sid: string, payload: Partial<Application>) => {
|
||||||
return putFetch<EmptyResponse, Partial<Application>>(
|
return putFetch<EmptyResponse, Partial<Application>>(
|
||||||
`${API_APPLICATIONS}/${sid}`,
|
`${API_APPLICATIONS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putSpeechService = (
|
export const putSpeechService = (
|
||||||
sid1: string,
|
sid1: string,
|
||||||
sid2: string,
|
sid2: string,
|
||||||
payload: Partial<SpeechCredential>
|
payload: Partial<SpeechCredential>,
|
||||||
) => {
|
) => {
|
||||||
const userData = parseJwt(getToken());
|
const userData = parseJwt(getToken());
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
@@ -541,25 +541,25 @@ export const putSpeechService = (
|
|||||||
|
|
||||||
export const putMsTeamsTenant = (
|
export const putMsTeamsTenant = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<MSTeamsTenant>
|
payload: Partial<MSTeamsTenant>,
|
||||||
) => {
|
) => {
|
||||||
return putFetch<EmptyResponse, Partial<MSTeamsTenant>>(
|
return putFetch<EmptyResponse, Partial<MSTeamsTenant>>(
|
||||||
`${API_MS_TEAMS_TENANTS}/${sid}`,
|
`${API_MS_TEAMS_TENANTS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putPhoneNumber = (sid: string, payload: Partial<PhoneNumber>) => {
|
export const putPhoneNumber = (sid: string, payload: Partial<PhoneNumber>) => {
|
||||||
return putFetch<EmptyResponse, Partial<PhoneNumber>>(
|
return putFetch<EmptyResponse, Partial<PhoneNumber>>(
|
||||||
`${API_PHONE_NUMBERS}/${sid}`,
|
`${API_PHONE_NUMBERS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putCarrier = (
|
export const putCarrier = (
|
||||||
sid1: string,
|
sid1: string,
|
||||||
sid2: string,
|
sid2: string,
|
||||||
payload: Partial<Carrier>
|
payload: Partial<Carrier>,
|
||||||
) => {
|
) => {
|
||||||
const userData = parseJwt(getToken());
|
const userData = parseJwt(getToken());
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
@@ -573,14 +573,14 @@ export const putCarrier = (
|
|||||||
export const putSipGateway = (sid: string, payload: Partial<SipGateway>) => {
|
export const putSipGateway = (sid: string, payload: Partial<SipGateway>) => {
|
||||||
return putFetch<EmptyResponse, Partial<SipGateway>>(
|
return putFetch<EmptyResponse, Partial<SipGateway>>(
|
||||||
`${API_SIP_GATEWAY}/${sid}`,
|
`${API_SIP_GATEWAY}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putSmppGateway = (sid: string, payload: Partial<SmppGateway>) => {
|
export const putSmppGateway = (sid: string, payload: Partial<SmppGateway>) => {
|
||||||
return putFetch<EmptyResponse, Partial<SmppGateway>>(
|
return putFetch<EmptyResponse, Partial<SmppGateway>>(
|
||||||
`${API_SMPP_GATEWAY}/${sid}`,
|
`${API_SMPP_GATEWAY}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -590,55 +590,55 @@ export const putLcr = (sid: string, payload: Partial<Lcr>) => {
|
|||||||
|
|
||||||
export const putLcrUpdateRoutes = (
|
export const putLcrUpdateRoutes = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<LcrRoute[]>
|
payload: Partial<LcrRoute[]>,
|
||||||
) => {
|
) => {
|
||||||
return putFetch<EmptyResponse, Partial<LcrRoute[]>>(
|
return putFetch<EmptyResponse, Partial<LcrRoute[]>>(
|
||||||
`${API_LCRS}/${sid}/Routes`,
|
`${API_LCRS}/${sid}/Routes`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putLcrRoutes = (sid: string, payload: Partial<LcrRoute>) => {
|
export const putLcrRoutes = (sid: string, payload: Partial<LcrRoute>) => {
|
||||||
return putFetch<EmptyResponse, Partial<LcrRoute>>(
|
return putFetch<EmptyResponse, Partial<LcrRoute>>(
|
||||||
`${API_LCR_ROUTES}/${sid}`,
|
`${API_LCR_ROUTES}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putLcrCarrierSetEntries = (
|
export const putLcrCarrierSetEntries = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<LcrCarrierSetEntry>
|
payload: Partial<LcrCarrierSetEntry>,
|
||||||
) => {
|
) => {
|
||||||
return putFetch<EmptyResponse, Partial<LcrCarrierSetEntry>>(
|
return putFetch<EmptyResponse, Partial<LcrCarrierSetEntry>>(
|
||||||
`${API_LCR_CARRIER_SET_ENTRIES}/${sid}`,
|
`${API_LCR_CARRIER_SET_ENTRIES}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putClient = (sid: string, payload: Partial<Client>) => {
|
export const putClient = (sid: string, payload: Partial<Client>) => {
|
||||||
return putFetch<EmptyResponse, Partial<Client>>(
|
return putFetch<EmptyResponse, Partial<Client>>(
|
||||||
`${API_CLIENTS}/${sid}`,
|
`${API_CLIENTS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putActivationCode = (
|
export const putActivationCode = (
|
||||||
code: string,
|
code: string,
|
||||||
payload: Partial<ActivationCode>
|
payload: Partial<ActivationCode>,
|
||||||
) => {
|
) => {
|
||||||
return putFetch<EmptyResponse, Partial<ActivationCode>>(
|
return putFetch<EmptyResponse, Partial<ActivationCode>>(
|
||||||
`${API_ACTIVATION_CODE}/${code}`,
|
`${API_ACTIVATION_CODE}/${code}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const putGoogleCustomVoice = (
|
export const putGoogleCustomVoice = (
|
||||||
sid: string,
|
sid: string,
|
||||||
payload: Partial<GoogleCustomVoice>
|
payload: Partial<GoogleCustomVoice>,
|
||||||
) => {
|
) => {
|
||||||
return putFetch<EmptyResponse, Partial<GoogleCustomVoice>>(
|
return putFetch<EmptyResponse, Partial<GoogleCustomVoice>>(
|
||||||
`${API_GOOGLE_CUSTOM_VOICES}/${sid}`,
|
`${API_GOOGLE_CUSTOM_VOICES}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -659,7 +659,7 @@ export const deleteApiKey = (sid: string) => {
|
|||||||
export const deleteAccount = (sid: string, payload: Partial<DeleteAccount>) => {
|
export const deleteAccount = (sid: string, payload: Partial<DeleteAccount>) => {
|
||||||
return deleteFetchWithPayload<EmptyResponse, Partial<DeleteAccount>>(
|
return deleteFetchWithPayload<EmptyResponse, Partial<DeleteAccount>>(
|
||||||
`${API_ACCOUNTS}/${sid}`,
|
`${API_ACCOUNTS}/${sid}`,
|
||||||
payload
|
payload,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -669,7 +669,7 @@ export const deleteApplication = (sid: string) => {
|
|||||||
|
|
||||||
export const deleteSpeechService = (sid1: string, sid2: string) => {
|
export const deleteSpeechService = (sid1: string, sid2: string) => {
|
||||||
return deleteFetch<EmptyResponse>(
|
return deleteFetch<EmptyResponse>(
|
||||||
`${API_SERVICE_PROVIDERS}/${sid1}/SpeechCredentials/${sid2}`
|
`${API_SERVICE_PROVIDERS}/${sid1}/SpeechCredentials/${sid2}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -695,16 +695,16 @@ export const deleteSmppGateway = (sid: string) => {
|
|||||||
|
|
||||||
export const deleteServiceProviderLimit = (
|
export const deleteServiceProviderLimit = (
|
||||||
sid: string,
|
sid: string,
|
||||||
cat: LimitCategories
|
cat: LimitCategories,
|
||||||
) => {
|
) => {
|
||||||
return deleteFetch<EmptyResponse>(
|
return deleteFetch<EmptyResponse>(
|
||||||
`${API_SERVICE_PROVIDERS}/${sid}/Limits?category=${cat}`
|
`${API_SERVICE_PROVIDERS}/${sid}/Limits?category=${cat}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteAccountLimit = (sid: string, cat: LimitCategories) => {
|
export const deleteAccountLimit = (sid: string, cat: LimitCategories) => {
|
||||||
return deleteFetch<EmptyResponse>(
|
return deleteFetch<EmptyResponse>(
|
||||||
`${API_ACCOUNTS}/${sid}/Limits?category=${cat}`
|
`${API_ACCOUNTS}/${sid}/Limits?category=${cat}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -747,7 +747,7 @@ export const getServiceProviders = () => {
|
|||||||
|
|
||||||
export const getAccountWebhook = (sid: string) => {
|
export const getAccountWebhook = (sid: string) => {
|
||||||
return getFetch<SecretResponse>(
|
return getFetch<SecretResponse>(
|
||||||
`${API_ACCOUNTS}/${sid}/WebhookSecret?regenerate=true`
|
`${API_ACCOUNTS}/${sid}/WebhookSecret?regenerate=true`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ export const getLcrRoute = (sid: string) => {
|
|||||||
|
|
||||||
export const getLcrCarrierSetEtries = (sid: string) => {
|
export const getLcrCarrierSetEtries = (sid: string) => {
|
||||||
return getFetch<LcrCarrierSetEntry[]>(
|
return getFetch<LcrCarrierSetEntry[]>(
|
||||||
`${API_LCR_CARRIER_SET_ENTRIES}?lcr_route_sid=${sid}`
|
`${API_LCR_CARRIER_SET_ENTRIES}?lcr_route_sid=${sid}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -783,12 +783,12 @@ export const getClient = (sid: string) => {
|
|||||||
|
|
||||||
export const getAvailability = (domain: string) => {
|
export const getAvailability = (domain: string) => {
|
||||||
return getFetch<Availability>(
|
return getFetch<Availability>(
|
||||||
`${API_AVAILABILITY}?type=subdomain&value=${domain}`
|
`${API_AVAILABILITY}?type=subdomain&value=${domain}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGoogleCustomVoices = (
|
export const getGoogleCustomVoices = (
|
||||||
query: Partial<GoogleCustomVoicesQuery>
|
query: Partial<GoogleCustomVoicesQuery>,
|
||||||
) => {
|
) => {
|
||||||
const qryStr = getQuery<Partial<GoogleCustomVoicesQuery>>(query);
|
const qryStr = getQuery<Partial<GoogleCustomVoicesQuery>>(query);
|
||||||
return getFetch<GoogleCustomVoice[]>(`${API_GOOGLE_CUSTOM_VOICES}?${qryStr}`);
|
return getFetch<GoogleCustomVoice[]>(`${API_GOOGLE_CUSTOM_VOICES}?${qryStr}`);
|
||||||
@@ -806,7 +806,7 @@ export const getRecentCalls = (sid: string, query: Partial<CallQuery>) => {
|
|||||||
return getFetch<PagedResponse<RecentCall>>(
|
return getFetch<PagedResponse<RecentCall>>(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls?${qryStr}`
|
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls?${qryStr}`
|
||||||
: `${API_ACCOUNTS}/${sid}/RecentCalls?${qryStr}`
|
: `${API_ACCOUNTS}/${sid}/RecentCalls?${qryStr}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -814,7 +814,7 @@ export const getRecentCall = (sid: string, sipCallId: string) => {
|
|||||||
return getFetch<TotalResponse>(
|
return getFetch<TotalResponse>(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}`
|
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}`
|
||||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}`
|
: `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -822,7 +822,7 @@ export const getPcap = (sid: string, sipCallId: string, method: string) => {
|
|||||||
return getBlob(
|
return getBlob(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}/${method}/pcap`
|
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/${sipCallId}/${method}/pcap`
|
||||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}/${method}/pcap`
|
: `${API_ACCOUNTS}/${sid}/RecentCalls/${sipCallId}/${method}/pcap`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -830,30 +830,30 @@ export const getJaegerTrace = (sid: string, traceId: string) => {
|
|||||||
return getFetch<JaegerRoot>(
|
return getFetch<JaegerRoot>(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/trace/${traceId}`
|
? `${DEV_BASE_URL}/Accounts/${sid}/RecentCalls/trace/${traceId}`
|
||||||
: `${API_ACCOUNTS}/${sid}/RecentCalls/trace/${traceId}`
|
: `${API_ACCOUNTS}/${sid}/RecentCalls/trace/${traceId}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServiceProviderRecentCall = (
|
export const getServiceProviderRecentCall = (
|
||||||
sid: string,
|
sid: string,
|
||||||
sipCallId: string
|
sipCallId: string,
|
||||||
) => {
|
) => {
|
||||||
return getFetch<TotalResponse>(
|
return getFetch<TotalResponse>(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/ServiceProviders/${sid}/RecentCalls/${sipCallId}`
|
? `${DEV_BASE_URL}/ServiceProviders/${sid}/RecentCalls/${sipCallId}`
|
||||||
: `${API_SERVICE_PROVIDERS}/${sid}/RecentCalls/${sipCallId}`
|
: `${API_SERVICE_PROVIDERS}/${sid}/RecentCalls/${sipCallId}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getServiceProviderPcap = (
|
export const getServiceProviderPcap = (
|
||||||
sid: string,
|
sid: string,
|
||||||
sipCallId: string,
|
sipCallId: string,
|
||||||
method: string
|
method: string,
|
||||||
) => {
|
) => {
|
||||||
return getBlob(
|
return getBlob(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/ServiceProviders/${sid}/RecentCalls/${sipCallId}/${method}/pcap`
|
? `${DEV_BASE_URL}/ServiceProviders/${sid}/RecentCalls/${sipCallId}/${method}/pcap`
|
||||||
: `${API_SERVICE_PROVIDERS}/${sid}/RecentCalls/${sipCallId}/${method}/pcap`
|
: `${API_SERVICE_PROVIDERS}/${sid}/RecentCalls/${sipCallId}/${method}/pcap`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -863,7 +863,7 @@ export const getAlerts = (sid: string, query: Partial<PageQuery>) => {
|
|||||||
return getFetch<PagedResponse<Alert>>(
|
return getFetch<PagedResponse<Alert>>(
|
||||||
import.meta.env.DEV
|
import.meta.env.DEV
|
||||||
? `${DEV_BASE_URL}/Accounts/${sid}/Alerts?${qryStr}`
|
? `${DEV_BASE_URL}/Accounts/${sid}/Alerts?${qryStr}`
|
||||||
: `${API_ACCOUNTS}/${sid}/Alerts?${qryStr}`
|
: `${API_ACCOUNTS}/${sid}/Alerts?${qryStr}`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -874,7 +874,7 @@ export const getPrice = () => {
|
|||||||
export const getSpeechSupportedLanguagesAndVoices = (
|
export const getSpeechSupportedLanguagesAndVoices = (
|
||||||
sid: string | undefined,
|
sid: string | undefined,
|
||||||
vendor: string,
|
vendor: string,
|
||||||
label: string
|
label: string,
|
||||||
) => {
|
) => {
|
||||||
const userData = parseJwt(getToken());
|
const userData = parseJwt(getToken());
|
||||||
const apiUrl =
|
const apiUrl =
|
||||||
@@ -946,7 +946,7 @@ export const useServiceProviderData: UseApiData = <Type>(apiPath: string) => {
|
|||||||
|
|
||||||
if (currentServiceProvider) {
|
if (currentServiceProvider) {
|
||||||
getFetch<Type>(
|
getFetch<Type>(
|
||||||
`${API_SERVICE_PROVIDERS}/${currentServiceProvider.service_provider_sid}/${apiPath}`
|
`${API_SERVICE_PROVIDERS}/${currentServiceProvider.service_provider_sid}/${apiPath}`,
|
||||||
)
|
)
|
||||||
.then(({ json }) => {
|
.then(({ json }) => {
|
||||||
if (!ignore) {
|
if (!ignore) {
|
||||||
|
|||||||
@@ -63,11 +63,9 @@ export interface FetchError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface UseApiData {
|
export interface UseApiData {
|
||||||
<Type>(apiPath: string): [
|
<Type>(
|
||||||
Type | undefined,
|
apiPath: string,
|
||||||
() => void,
|
): [Type | undefined, () => void, FetchError | undefined];
|
||||||
FetchError | undefined
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** API related interfaces */
|
/** API related interfaces */
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import applications from "../../cypress/fixtures/applications.json";
|
|||||||
|
|
||||||
/** Wrapper to perform React state setup */
|
/** Wrapper to perform React state setup */
|
||||||
const ApplicationFilterTestWrapper = (
|
const ApplicationFilterTestWrapper = (
|
||||||
props: Partial<ApplicationFilterProps>
|
props: Partial<ApplicationFilterProps>,
|
||||||
) => {
|
) => {
|
||||||
const [application, setApplication] = useState("");
|
const [application, setApplication] = useState("");
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ describe("<ApplicationFilter>", () => {
|
|||||||
/** Default value is properly set to first option */
|
/** Default value is properly set to first option */
|
||||||
cy.get("select").should(
|
cy.get("select").should(
|
||||||
"have.value",
|
"have.value",
|
||||||
applicationsSorted[0].application_sid
|
applicationsSorted[0].application_sid,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ describe("<ApplicationFilter>", () => {
|
|||||||
cy.get("select").select(applicationsSorted[1].application_sid);
|
cy.get("select").select(applicationsSorted[1].application_sid);
|
||||||
cy.get("select").should(
|
cy.get("select").should(
|
||||||
"have.value",
|
"have.value",
|
||||||
applicationsSorted[1].application_sid
|
applicationsSorted[1].application_sid,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ describe("<ApplicationFilter>", () => {
|
|||||||
it("renders default option", () => {
|
it("renders default option", () => {
|
||||||
/** Test with the `defaultOption` prop */
|
/** Test with the `defaultOption` prop */
|
||||||
cy.mount(
|
cy.mount(
|
||||||
<ApplicationFilterTestWrapper defaultOption="Choose Application" />
|
<ApplicationFilterTestWrapper defaultOption="Choose Application" />,
|
||||||
);
|
);
|
||||||
|
|
||||||
/** No default value is set when this prop is present */
|
/** No default value is set when this prop is present */
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const ClipBoard = ({ text, id = "", name = "" }: ClipBoardProps) => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
<strong>{text}</strong> copied to clipboard
|
<strong>{text}</strong> copied to clipboard
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -28,7 +28,7 @@ export const ClipBoard = ({ text, id = "", name = "" }: ClipBoardProps) => {
|
|||||||
<>
|
<>
|
||||||
Unable to copy <strong>{text}</strong>, please select the text and
|
Unable to copy <strong>{text}</strong>, please select the text and
|
||||||
right click to copy
|
right click to copy
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const AccountSelect = forwardRef<SelectorRef, AccountSelectProps>(
|
|||||||
defaultOption,
|
defaultOption,
|
||||||
...restProps
|
...restProps
|
||||||
}: AccountSelectProps,
|
}: AccountSelectProps,
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hasLength(accounts) && !accountSid && !defaultOption) {
|
if (hasLength(accounts) && !accountSid && !defaultOption) {
|
||||||
@@ -56,14 +56,14 @@ export const AccountSelect = forwardRef<SelectorRef, AccountSelectProps>(
|
|||||||
name: account.name,
|
name: account.name,
|
||||||
value: account.account_sid,
|
value: account.account_sid,
|
||||||
}))
|
}))
|
||||||
: []
|
: [],
|
||||||
)}
|
)}
|
||||||
onChange={(e) => setAccountSid(e.target.value)}
|
onChange={(e) => setAccountSid(e.target.value)}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
AccountSelect.displayName = "AccountSelect";
|
AccountSelect.displayName = "AccountSelect";
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export const ApplicationSelect = forwardRef<
|
|||||||
defaultOption,
|
defaultOption,
|
||||||
...restProps
|
...restProps
|
||||||
}: ApplicationSelectProps,
|
}: ApplicationSelectProps,
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hasLength(applications) && !applicationSid && !defaultOption) {
|
if (hasLength(applications) && !applicationSid && !defaultOption) {
|
||||||
@@ -62,14 +62,14 @@ export const ApplicationSelect = forwardRef<
|
|||||||
name: application.name,
|
name: application.name,
|
||||||
value: application.application_sid,
|
value: application.application_sid,
|
||||||
}))
|
}))
|
||||||
: []
|
: [],
|
||||||
)}
|
)}
|
||||||
onChange={(e) => setApplicationSid(e.target.value)}
|
onChange={(e) => setApplicationSid(e.target.value)}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
ApplicationSelect.displayName = "ApplicationSelect";
|
ApplicationSelect.displayName = "ApplicationSelect";
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const Checkzone = forwardRef<CheckzoneRef, CheckzoneProps>(
|
|||||||
handleChecked,
|
handleChecked,
|
||||||
disabled = false,
|
disabled = false,
|
||||||
}: CheckzoneProps,
|
}: CheckzoneProps,
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [checked, setChecked] = useState(false);
|
const [checked, setChecked] = useState(false);
|
||||||
const classesTop = classNames({
|
const classesTop = classNames({
|
||||||
@@ -74,7 +74,7 @@ export const Checkzone = forwardRef<CheckzoneRef, CheckzoneProps>(
|
|||||||
{checked && <div className={classesIn}>{children}</div>}
|
{checked && <div className={classesIn}>{children}</div>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Checkzone.displayName = "Checkzone";
|
Checkzone.displayName = "Checkzone";
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const FileUpload = forwardRef<FileRef, FileProps>(
|
|||||||
disabled,
|
disabled,
|
||||||
...restProps
|
...restProps
|
||||||
}: FileProps,
|
}: FileProps,
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [fileName, setFileName] = useState("");
|
const [fileName, setFileName] = useState("");
|
||||||
const [focus, setFocus] = useState(false);
|
const [focus, setFocus] = useState(false);
|
||||||
@@ -73,7 +73,7 @@ export const FileUpload = forwardRef<FileRef, FileProps>(
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
FileUpload.displayName = "FileUpload";
|
FileUpload.displayName = "FileUpload";
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ export const LocalLimits = ({
|
|||||||
? LIMITS.filter((limit) =>
|
? LIMITS.filter((limit) =>
|
||||||
unit === LIMIT_SESS
|
unit === LIMIT_SESS
|
||||||
? !limit.category.includes(LIMIT_MIN)
|
? !limit.category.includes(LIMIT_MIN)
|
||||||
: limit.category.includes(LIMIT_MIN)
|
: limit.category.includes(LIMIT_MIN),
|
||||||
)
|
)
|
||||||
: LIMITS.filter(
|
: LIMITS.filter(
|
||||||
(limit) =>
|
(limit) =>
|
||||||
!limit.category.includes("license") &&
|
!limit.category.includes("license") &&
|
||||||
!limit.category.includes(LIMIT_MIN)
|
!limit.category.includes(LIMIT_MIN),
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -130,7 +130,7 @@ export const LocalLimits = ({
|
|||||||
}
|
}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const limit = localLimits.find(
|
const limit = localLimits.find(
|
||||||
(l) => l.category === category
|
(l) => l.category === category,
|
||||||
);
|
);
|
||||||
const value = e.target.value ? Number(e.target.value) : "";
|
const value = e.target.value ? Number(e.target.value) : "";
|
||||||
|
|
||||||
@@ -139,8 +139,8 @@ export const LocalLimits = ({
|
|||||||
localLimits.map((l) =>
|
localLimits.map((l) =>
|
||||||
l.category === category
|
l.category === category
|
||||||
? { ...l, quantity: value }
|
? { ...l, quantity: value }
|
||||||
: l
|
: l,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setLocalLimits([
|
setLocalLimits([
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const Passwd = forwardRef<PasswdRef, PasswdProps>(
|
|||||||
locked = false,
|
locked = false,
|
||||||
...restProps
|
...restProps
|
||||||
}: PasswdProps,
|
}: PasswdProps,
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [reveal, setReveal] = useState(false);
|
const [reveal, setReveal] = useState(false);
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ export const Passwd = forwardRef<PasswdRef, PasswdProps>(
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Passwd.displayName = "Passwd";
|
Passwd.displayName = "Passwd";
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ type SelectorRef = HTMLSelectElement;
|
|||||||
export const Selector = forwardRef<SelectorRef, SelectorProps>(
|
export const Selector = forwardRef<SelectorRef, SelectorProps>(
|
||||||
(
|
(
|
||||||
{ id, name, value, options, disabled, ...restProps }: SelectorProps,
|
{ id, name, value, options, disabled, ...restProps }: SelectorProps,
|
||||||
ref
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [focus, setFocus] = useState(false);
|
const [focus, setFocus] = useState(false);
|
||||||
const classes = {
|
const classes = {
|
||||||
@@ -53,7 +53,7 @@ export const Selector = forwardRef<SelectorRef, SelectorProps>(
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Selector.displayName = "Selector";
|
Selector.displayName = "Selector";
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const Modal = ({
|
|||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
portal
|
portal,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ export const ModalForm = ({
|
|||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</form>
|
</form>
|
||||||
</div>,
|
</div>,
|
||||||
portal
|
portal,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ export const ModalClose = ({ children, handleClose }: CloseProps) => {
|
|||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
portal
|
portal,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -147,6 +147,6 @@ export const ModalLoader = ({ children }: LoaderProps) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
portal
|
portal,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const Pagination = ({
|
|||||||
(num: number) => {
|
(num: number) => {
|
||||||
setPageNumber(Math.max(1, Math.min(maxPageNumber, num)));
|
setPageNumber(Math.max(1, Math.min(maxPageNumber, num)));
|
||||||
},
|
},
|
||||||
[maxPageNumber, setPageNumber]
|
[maxPageNumber, setPageNumber],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleNumberMapping = useCallback(
|
const handleNumberMapping = useCallback(
|
||||||
@@ -100,7 +100,7 @@ export const Pagination = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[maxPageNumber, pageNumber]
|
[maxPageNumber, pageNumber],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe("<ScopedAccess>", () => {
|
|||||||
cy.mountTestProvider(
|
cy.mountTestProvider(
|
||||||
<ScopedAccessTestWrapper scope={Scope.admin} user={user}>
|
<ScopedAccessTestWrapper scope={Scope.admin} user={user}>
|
||||||
<H1>ScopedAccess: admin</H1>
|
<H1>ScopedAccess: admin</H1>
|
||||||
</ScopedAccessTestWrapper>
|
</ScopedAccessTestWrapper>,
|
||||||
);
|
);
|
||||||
cy.get(".scope-div").should("exist");
|
cy.get(".scope-div").should("exist");
|
||||||
});
|
});
|
||||||
@@ -44,7 +44,7 @@ describe("<ScopedAccess>", () => {
|
|||||||
cy.mountTestProvider(
|
cy.mountTestProvider(
|
||||||
<ScopedAccessTestWrapper scope={Scope.admin} user={user}>
|
<ScopedAccessTestWrapper scope={Scope.admin} user={user}>
|
||||||
<H1>ScopedAccess: service_provider</H1>
|
<H1>ScopedAccess: service_provider</H1>
|
||||||
</ScopedAccessTestWrapper>
|
</ScopedAccessTestWrapper>,
|
||||||
);
|
);
|
||||||
cy.get(".scope-div").should("not.exist");
|
cy.get(".scope-div").should("not.exist");
|
||||||
});
|
});
|
||||||
@@ -59,7 +59,7 @@ describe("<ScopedAccess>", () => {
|
|||||||
cy.mountTestProvider(
|
cy.mountTestProvider(
|
||||||
<ScopedAccessTestWrapper scope={Scope.admin} user={user}>
|
<ScopedAccessTestWrapper scope={Scope.admin} user={user}>
|
||||||
<H1>ScopedAccess: account</H1>
|
<H1>ScopedAccess: account</H1>
|
||||||
</ScopedAccessTestWrapper>
|
</ScopedAccessTestWrapper>,
|
||||||
);
|
);
|
||||||
cy.get(".scope-div").should("not.exist");
|
cy.get(".scope-div").should("not.exist");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const SearchFilter = ({
|
|||||||
setAppearance(false);
|
setAppearance(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[setFilterValue]
|
[setFilterValue],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleActive = useCallback(() => {
|
const handleActive = useCallback(() => {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export const SelectFilter = ({
|
|||||||
setFilterValue(e.target.value);
|
setFilterValue(e.target.value);
|
||||||
const queryFilter = createFilterString(
|
const queryFilter = createFilterString(
|
||||||
e.target.value,
|
e.target.value,
|
||||||
label as string
|
label as string,
|
||||||
);
|
);
|
||||||
setQueryFilter(queryFilter);
|
setQueryFilter(queryFilter);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ export const Toast = ({ type, message }: ToastProps) => {
|
|||||||
{message}
|
{message}
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
portal
|
portal,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export const Navi = ({
|
|||||||
|
|
||||||
const naviByoFiltered = useMemo(() => {
|
const naviByoFiltered = useMemo(() => {
|
||||||
return naviByo.filter(
|
return naviByo.filter(
|
||||||
(item) => !item.acl || (item.acl && accessControl[item.acl])
|
(item) => !item.acl || (item.acl && accessControl[item.acl]),
|
||||||
);
|
);
|
||||||
}, [accessControl, currentServiceProvider]);
|
}, [accessControl, currentServiceProvider]);
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ export const Navi = ({
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Added new service provider <strong>{name}</strong>
|
Added new service provider <strong>{name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
dispatch({ type: "serviceProviders" });
|
dispatch({ type: "serviceProviders" });
|
||||||
setSid(json.sid);
|
setSid(json.sid);
|
||||||
@@ -123,7 +123,7 @@ export const Navi = ({
|
|||||||
setSid(getActiveSP());
|
setSid(getActiveSP());
|
||||||
if (sid) {
|
if (sid) {
|
||||||
const serviceProvider = serviceProviders.find(
|
const serviceProvider = serviceProviders.find(
|
||||||
(sp) => sp.service_provider_sid === sid
|
(sp) => sp.service_provider_sid === sid,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (serviceProvider) {
|
if (serviceProvider) {
|
||||||
|
|||||||
@@ -75,19 +75,19 @@ export const DeleteAccount = ({
|
|||||||
getFetch<PhoneNumber[]>(API_PHONE_NUMBERS),
|
getFetch<PhoneNumber[]>(API_PHONE_NUMBERS),
|
||||||
getFetch<MSTeamsTenant[]>(API_MS_TEAMS_TENANTS),
|
getFetch<MSTeamsTenant[]>(API_MS_TEAMS_TENANTS),
|
||||||
getFetch<ApiKey[]>(
|
getFetch<ApiKey[]>(
|
||||||
`${API_BASE_URL}/Accounts/${account.account_sid}/ApiKeys`
|
`${API_BASE_URL}/Accounts/${account.account_sid}/ApiKeys`,
|
||||||
),
|
),
|
||||||
]).then(([appsRes, phonesRes, teamsRes, apiKeysRes]) => {
|
]).then(([appsRes, phonesRes, teamsRes, apiKeysRes]) => {
|
||||||
if (!ignore) {
|
if (!ignore) {
|
||||||
const used = {
|
const used = {
|
||||||
apps: appsRes.json.filter(
|
apps: appsRes.json.filter(
|
||||||
(app) => app.account_sid === account.account_sid
|
(app) => app.account_sid === account.account_sid,
|
||||||
),
|
),
|
||||||
phones: phonesRes.json.filter(
|
phones: phonesRes.json.filter(
|
||||||
(phone) => phone.account_sid === account.account_sid
|
(phone) => phone.account_sid === account.account_sid,
|
||||||
),
|
),
|
||||||
teams: teamsRes.json.filter(
|
teams: teamsRes.json.filter(
|
||||||
(team) => team.account_sid === account.account_sid
|
(team) => team.account_sid === account.account_sid,
|
||||||
),
|
),
|
||||||
apiKeys: apiKeysRes.json,
|
apiKeys: apiKeysRes.json,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ export const EditSipRealm = () => {
|
|||||||
getAvailability(`${name}.${userData?.account?.root_domain}`)
|
getAvailability(`${name}.${userData?.account?.root_domain}`)
|
||||||
.then(({ json }) =>
|
.then(({ json }) =>
|
||||||
setIsValidDomain(
|
setIsValidDomain(
|
||||||
Boolean(json.available) && hasValue(name) && name.length != 0
|
Boolean(json.available) && hasValue(name) && name.length != 0,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setErrorMessage(error.msg);
|
setErrorMessage(error.msg);
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ export const EditAccount = () => {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const user = useSelectState("user");
|
const user = useSelectState("user");
|
||||||
const [data, refetch, error] = useApiData<Account>(
|
const [data, refetch, error] = useApiData<Account>(
|
||||||
`Accounts/${params.account_sid}`
|
`Accounts/${params.account_sid}`,
|
||||||
);
|
);
|
||||||
const [limitsData, refetchLimits] = useApiData<Limit[]>(
|
const [limitsData, refetchLimits] = useApiData<Limit[]>(
|
||||||
`Accounts/${params.account_sid}/Limits`
|
`Accounts/${params.account_sid}/Limits`,
|
||||||
);
|
);
|
||||||
const [apps] = useApiData<Application[]>("Applications");
|
const [apps] = useApiData<Application[]>("Applications");
|
||||||
const [ttsCache, ttsCacheFetcher] = useApiData<TtsCache>(
|
const [ttsCache, ttsCacheFetcher] = useApiData<TtsCache>(
|
||||||
`Accounts/${params.account_sid}/TtsCache`
|
`Accounts/${params.account_sid}/TtsCache`,
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedRedirect(
|
useScopedRedirect(
|
||||||
@@ -36,7 +36,7 @@ export const EditAccount = () => {
|
|||||||
: ROUTE_INTERNAL_APPLICATIONS,
|
: ROUTE_INTERNAL_APPLICATIONS,
|
||||||
user,
|
user,
|
||||||
"You do not have access to this resource",
|
"You do not have access to this resource",
|
||||||
data
|
data,
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Handle error toast at top level... */
|
/** Handle error toast at top level... */
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export const AccountForm = ({
|
|||||||
const [userData] = useApiData<CurrentUserData>("Users/me");
|
const [userData] = useApiData<CurrentUserData>("Users/me");
|
||||||
const [userCarriers] = useApiData<Carrier[]>(`VoipCarriers`);
|
const [userCarriers] = useApiData<Carrier[]>(`VoipCarriers`);
|
||||||
const [userSpeechs] = useApiData<SpeechCredential[]>(
|
const [userSpeechs] = useApiData<SpeechCredential[]>(
|
||||||
`/Accounts/${params.account_sid}/SpeechCredentials`
|
`/Accounts/${params.account_sid}/SpeechCredentials`,
|
||||||
);
|
);
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [realm, setRealm] = useState("");
|
const [realm, setRealm] = useState("");
|
||||||
@@ -187,7 +187,7 @@ export const AccountForm = ({
|
|||||||
|
|
||||||
if (deleteMessage !== "delete my account") {
|
if (deleteMessage !== "delete my account") {
|
||||||
toastError(
|
toastError(
|
||||||
"You must type the delete message correctly in order to delete your account."
|
"You must type the delete message correctly in order to delete your account.",
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
deleteMessageRef.current &&
|
deleteMessageRef.current &&
|
||||||
@@ -285,7 +285,7 @@ export const AccountForm = ({
|
|||||||
} else {
|
} else {
|
||||||
toastError(json.reason);
|
toastError(json.reason);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ export const AccountForm = ({
|
|||||||
return limit.quantity === ""
|
return limit.quantity === ""
|
||||||
? deleteAccountLimit(sid, limit.category)
|
? deleteAccountLimit(sid, limit.category)
|
||||||
: postAccountLimit(sid, limit);
|
: postAccountLimit(sid, limit);
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (limits) {
|
if (limits) {
|
||||||
@@ -361,18 +361,18 @@ export const AccountForm = ({
|
|||||||
filtered.find(
|
filtered.find(
|
||||||
(a) =>
|
(a) =>
|
||||||
a.service_provider_sid !== account.data!.service_provider_sid &&
|
a.service_provider_sid !== account.data!.service_provider_sid &&
|
||||||
a.name === name
|
a.name === name,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
setMessage(
|
setMessage(
|
||||||
"The name you have entered is already in use on another one of your accounts."
|
"The name you have entered is already in use on another one of your accounts.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filtered.find((a) => a.sip_realm === realm)) {
|
if (filtered.find((a) => a.sip_realm === realm)) {
|
||||||
setMessage(
|
setMessage(
|
||||||
"The SIP Realm you have entered is already in use on another one of your accounts."
|
"The SIP Realm you have entered is already in use on another one of your accounts.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -522,7 +522,7 @@ export const AccountForm = ({
|
|||||||
}
|
}
|
||||||
if (account.data.bucket_credential?.secret_access_key) {
|
if (account.data.bucket_credential?.secret_access_key) {
|
||||||
setBucketSecretAccessKey(
|
setBucketSecretAccessKey(
|
||||||
account.data.bucket_credential?.secret_access_key
|
account.data.bucket_credential?.secret_access_key,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (account.data.bucket_credential?.region) {
|
if (account.data.bucket_credential?.region) {
|
||||||
@@ -530,7 +530,7 @@ export const AccountForm = ({
|
|||||||
}
|
}
|
||||||
if (account.data.bucket_credential?.connection_string) {
|
if (account.data.bucket_credential?.connection_string) {
|
||||||
setAzureConnectionString(
|
setAzureConnectionString(
|
||||||
account.data.bucket_credential.connection_string
|
account.data.bucket_credential.connection_string,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (account.data.bucket_credential?.endpoint) {
|
if (account.data.bucket_credential?.endpoint) {
|
||||||
@@ -540,7 +540,7 @@ export const AccountForm = ({
|
|||||||
setRecordAllCalls(account.data.record_all_calls ? true : false);
|
setRecordAllCalls(account.data.record_all_calls ? true : false);
|
||||||
}
|
}
|
||||||
setBucketCredentialChecked(
|
setBucketCredentialChecked(
|
||||||
hasValue(bucketVendor) && bucketVendor.length !== 0
|
hasValue(bucketVendor) && bucketVendor.length !== 0,
|
||||||
);
|
);
|
||||||
if (account.data.bucket_credential?.tags) {
|
if (account.data.bucket_credential?.tags) {
|
||||||
setBucketTags(account.data.bucket_credential?.tags);
|
setBucketTags(account.data.bucket_credential?.tags);
|
||||||
@@ -552,11 +552,11 @@ export const AccountForm = ({
|
|||||||
setBucketGoogleServiceKey(tmpBucketGoogleServiceKey);
|
setBucketGoogleServiceKey(tmpBucketGoogleServiceKey);
|
||||||
} else if (account.data.bucket_credential?.service_key) {
|
} else if (account.data.bucket_credential?.service_key) {
|
||||||
setBucketGoogleServiceKey(
|
setBucketGoogleServiceKey(
|
||||||
JSON.parse(account.data.bucket_credential?.service_key)
|
JSON.parse(account.data.bucket_credential?.service_key),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setInitialCheckRecordAllCall(
|
setInitialCheckRecordAllCall(
|
||||||
hasValue(bucketVendor) && bucketVendor.length !== 0
|
hasValue(bucketVendor) && bucketVendor.length !== 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [account]);
|
}, [account]);
|
||||||
@@ -576,7 +576,7 @@ export const AccountForm = ({
|
|||||||
: { quantity: 0 };
|
: { quantity: 0 };
|
||||||
const callSessionRecord = products
|
const callSessionRecord = products
|
||||||
? products.find(
|
? products.find(
|
||||||
(item) => item.name === "concurrent call session"
|
(item) => item.name === "concurrent call session",
|
||||||
) || { quantity: 0 }
|
) || { quantity: 0 }
|
||||||
: { quantity: 0 };
|
: { quantity: 0 };
|
||||||
const quantity =
|
const quantity =
|
||||||
@@ -592,10 +592,10 @@ export const AccountForm = ({
|
|||||||
} simultaneous calls and ${quantity} registered devices.${
|
} simultaneous calls and ${quantity} registered devices.${
|
||||||
trial_end_date
|
trial_end_date
|
||||||
? ` Your free trial will end on ${dayjs(
|
? ` Your free trial will end on ${dayjs(
|
||||||
trial_end_date
|
trial_end_date,
|
||||||
).format("MMM DD, YYYY")}.`
|
).format("MMM DD, YYYY")}.`
|
||||||
: ""
|
: ""
|
||||||
}`
|
}`,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case PlanType.PAID:
|
case PlanType.PAID:
|
||||||
@@ -607,7 +607,7 @@ export const AccountForm = ({
|
|||||||
CurrencySymbol[invoice.currency || "usd"]
|
CurrencySymbol[invoice.currency || "usd"]
|
||||||
}${(invoice.total || 0) / 100} on ${dayjs
|
}${(invoice.total || 0) / 100} on ${dayjs
|
||||||
.unix(Number(invoice.next_payment_attempt))
|
.unix(Number(invoice.next_payment_attempt))
|
||||||
.format("MMM DD, YYYY")}.`
|
.format("MMM DD, YYYY")}.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,11 +615,11 @@ export const AccountForm = ({
|
|||||||
case PlanType.FREE:
|
case PlanType.FREE:
|
||||||
if (is_active) {
|
if (is_active) {
|
||||||
setSubscriptionDescription(
|
setSubscriptionDescription(
|
||||||
`You are currently on the Free plan (trial period expired). You are limited to ${callSessionRecord.quantity} simultaneous calls and ${quantity} registered devices`
|
`You are currently on the Free plan (trial period expired). You are limited to ${callSessionRecord.quantity} simultaneous calls and ${quantity} registered devices`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setSubscriptionDescription(
|
setSubscriptionDescription(
|
||||||
"Your free trial has expired. Please upgrade your subscription to a paid plan to continue service"
|
"Your free trial has expired. Please upgrade your subscription to a paid plan to continue service",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -633,10 +633,10 @@ export const AccountForm = ({
|
|||||||
const updateBucketTags = (
|
const updateBucketTags = (
|
||||||
index: number,
|
index: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: typeof bucketTags[number][keyof AwsTag]
|
value: (typeof bucketTags)[number][keyof AwsTag],
|
||||||
) => {
|
) => {
|
||||||
setBucketTags(
|
setBucketTags(
|
||||||
bucketTags.map((b, i) => (i === index ? { ...b, [key]: value } : b))
|
bucketTags.map((b, i) => (i === index ? { ...b, [key]: value } : b)),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -910,7 +910,7 @@ export const AccountForm = ({
|
|||||||
defaultOption="None"
|
defaultOption="None"
|
||||||
application={[application.stateVal, application.stateSet]}
|
application={[application.stateVal, application.stateSet]}
|
||||||
applications={apps.filter(
|
applications={apps.filter(
|
||||||
(app) => app.account_sid === account.data!.account_sid
|
(app) => app.account_sid === account.data!.account_sid,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -918,7 +918,7 @@ export const AccountForm = ({
|
|||||||
})}
|
})}
|
||||||
{webhooks.map((webhook) => {
|
{webhooks.map((webhook) => {
|
||||||
const selectOptions = WEBHOOK_METHODS.filter((wm) =>
|
const selectOptions = WEBHOOK_METHODS.filter((wm) =>
|
||||||
webhook.prefix === "queue_event_hook" ? wm.name !== "GET" : true
|
webhook.prefix === "queue_event_hook" ? wm.name !== "GET" : true,
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -1175,10 +1175,10 @@ export const AccountForm = ({
|
|||||||
<code>
|
<code>
|
||||||
{JSON.stringify(
|
{JSON.stringify(
|
||||||
getObscuredGoogleServiceKey(
|
getObscuredGoogleServiceKey(
|
||||||
bucketGoogleServiceKey
|
bucketGoogleServiceKey,
|
||||||
),
|
),
|
||||||
null,
|
null,
|
||||||
2
|
2,
|
||||||
)}
|
)}
|
||||||
</code>
|
</code>
|
||||||
</pre>
|
</pre>
|
||||||
@@ -1208,10 +1208,10 @@ export const AccountForm = ({
|
|||||||
bucketVendor === BUCKET_VENDOR_S3_COMPATIBLE
|
bucketVendor === BUCKET_VENDOR_S3_COMPATIBLE
|
||||||
? "S3"
|
? "S3"
|
||||||
: bucketVendor === BUCKET_VENDOR_GOOGLE
|
: bucketVendor === BUCKET_VENDOR_GOOGLE
|
||||||
? "Google Cloud Storage"
|
? "Google Cloud Storage"
|
||||||
: bucketVendor === BUCKET_VENDOR_AZURE
|
: bucketVendor === BUCKET_VENDOR_AZURE
|
||||||
? "Azure Cloud Storage"
|
? "Azure Cloud Storage"
|
||||||
: ""}{" "}
|
: ""}{" "}
|
||||||
Tags
|
Tags
|
||||||
</label>
|
</label>
|
||||||
{hasLength(bucketTags) &&
|
{hasLength(bucketTags) &&
|
||||||
@@ -1251,7 +1251,7 @@ export const AccountForm = ({
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setBucketTags(
|
setBucketTags(
|
||||||
bucketTags.filter((g2, i2) => i2 !== i)
|
bucketTags.filter((g2, i2) => i2 !== i),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const Accounts = () => {
|
|||||||
Scope.service_provider,
|
Scope.service_provider,
|
||||||
`${ROUTE_INTERNAL_ACCOUNTS}/${user?.account_sid}/edit`,
|
`${ROUTE_INTERNAL_ACCOUNTS}/${user?.account_sid}/edit`,
|
||||||
user,
|
user,
|
||||||
"You do not have permissions to manage all accounts"
|
"You do not have permissions to manage all accounts",
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
@@ -40,7 +40,7 @@ export const Accounts = () => {
|
|||||||
user.account_sid !== account.account_sid
|
user.account_sid !== account.account_sid
|
||||||
) {
|
) {
|
||||||
toastError(
|
toastError(
|
||||||
"You do not have permissions to make changes to this Account"
|
"You do not have permissions to make changes to this Account",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ export const Accounts = () => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted account <strong>{account.name}</strong>
|
Deleted account <strong>{account.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const ManagePaymentForm = () => {
|
|||||||
if (json.status === "success") {
|
if (json.status === "success") {
|
||||||
toastSuccess("Payment completed successfully");
|
toastSuccess("Payment completed successfully");
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`
|
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`,
|
||||||
);
|
);
|
||||||
} else if (json.status === "action required") {
|
} else if (json.status === "action required") {
|
||||||
if (stripe) {
|
if (stripe) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const SubscriptionForm = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isModifySubscription = location.pathname.includes(
|
const isModifySubscription = location.pathname.includes(
|
||||||
"modify-subscription"
|
"modify-subscription",
|
||||||
);
|
);
|
||||||
const [billingCharge, setBillingCharge] = useState<Subscription | null>(null);
|
const [billingCharge, setBillingCharge] = useState<Subscription | null>(null);
|
||||||
const [isShowModalLoader, setIsShowModalLoader] = useState(false);
|
const [isShowModalLoader, setIsShowModalLoader] = useState(false);
|
||||||
@@ -69,7 +69,7 @@ const SubscriptionForm = () => {
|
|||||||
if (json.status === "success") {
|
if (json.status === "success") {
|
||||||
toastSuccess("Payment completed successfully");
|
toastSuccess("Payment completed successfully");
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`
|
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`,
|
||||||
);
|
);
|
||||||
} else if (json.status === "action required") {
|
} else if (json.status === "action required") {
|
||||||
if (stripe) {
|
if (stripe) {
|
||||||
@@ -176,7 +176,7 @@ const SubscriptionForm = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
toastSuccess("Downgrade to free plan completed successfully");
|
toastSuccess("Downgrade to free plan completed successfully");
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`
|
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -201,16 +201,16 @@ const SubscriptionForm = () => {
|
|||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toastSuccess(
|
toastSuccess(
|
||||||
"Your subscription capacity has been successfully modified."
|
"Your subscription capacity has been successfully modified.",
|
||||||
);
|
);
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`
|
`${ROUTE_INTERNAL_ACCOUNTS}/${userData?.account?.account_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toastError(
|
toastError(
|
||||||
`The additional capacity you that you requested could not be granted due to a failure processing payment.
|
`The additional capacity you that you requested could not be granted due to a failure processing payment.
|
||||||
Please configure a valid credit card for your account and the upgrade will be automatically processed`
|
Please configure a valid credit card for your account and the upgrade will be automatically processed`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@@ -254,18 +254,18 @@ const SubscriptionForm = () => {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const [originalServiceData, setOriginalServiceData] = useState<ServiceData[]>(
|
const [originalServiceData, setOriginalServiceData] = useState<ServiceData[]>(
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const initFeesAndCost = (priceData: PriceInfo[]) => {
|
const initFeesAndCost = (priceData: PriceInfo[]) => {
|
||||||
serviceData.forEach((service) => {
|
serviceData.forEach((service) => {
|
||||||
const record = priceData.find(
|
const record = priceData.find(
|
||||||
(item) => item.category === service.category
|
(item) => item.category === service.category,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (record) {
|
if (record) {
|
||||||
const price = record.prices.find(
|
const price = record.prices.find(
|
||||||
(item) => item.currency === service.currency
|
(item) => item.currency === service.currency,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (price) {
|
if (price) {
|
||||||
@@ -299,7 +299,7 @@ const SubscriptionForm = () => {
|
|||||||
|
|
||||||
const getServicePrice = (
|
const getServicePrice = (
|
||||||
service: ServiceData,
|
service: ServiceData,
|
||||||
capacity: number
|
capacity: number,
|
||||||
): [number, string, number] => {
|
): [number, string, number] => {
|
||||||
let fees = 0;
|
let fees = 0;
|
||||||
let feesLabel = "";
|
let feesLabel = "";
|
||||||
@@ -311,7 +311,7 @@ const SubscriptionForm = () => {
|
|||||||
} else if (service.billing_scheme === "tiered") {
|
} else if (service.billing_scheme === "tiered") {
|
||||||
const filteredTiers = service.tiers
|
const filteredTiers = service.tiers
|
||||||
? service.tiers.filter(
|
? service.tiers.filter(
|
||||||
(item) => !item.up_to || item.up_to >= capacityNum
|
(item) => !item.up_to || item.up_to >= capacityNum,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
if (filteredTiers.length) {
|
if (filteredTiers.length) {
|
||||||
@@ -360,7 +360,7 @@ const SubscriptionForm = () => {
|
|||||||
const updateServiceData = (
|
const updateServiceData = (
|
||||||
index: number,
|
index: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: typeof serviceData[number][keyof ServiceData]
|
value: (typeof serviceData)[number][keyof ServiceData],
|
||||||
) => {
|
) => {
|
||||||
setServiceData(
|
setServiceData(
|
||||||
serviceData.map((g, i) =>
|
serviceData.map((g, i) =>
|
||||||
@@ -370,8 +370,8 @@ const SubscriptionForm = () => {
|
|||||||
[key]: value,
|
[key]: value,
|
||||||
...(key === "capacity" && { cost: Number(value) * g.fees }),
|
...(key === "capacity" && { cost: Number(value) * g.fees }),
|
||||||
}
|
}
|
||||||
: g
|
: g,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ const SubscriptionForm = () => {
|
|||||||
if (isModifySubscription && originalServiceData.length > 0) {
|
if (isModifySubscription && originalServiceData.length > 0) {
|
||||||
setIsDisableSubmitButton(
|
setIsDisableSubmitButton(
|
||||||
serviceData[0].capacity === originalServiceData[0].capacity &&
|
serviceData[0].capacity === originalServiceData[0].capacity &&
|
||||||
serviceData[1].capacity === originalServiceData[1].capacity
|
serviceData[1].capacity === originalServiceData[1].capacity,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setTotal(serviceData.reduce((res, service) => res + service.cost || 0, 0));
|
setTotal(serviceData.reduce((res, service) => res + service.cost || 0, 0));
|
||||||
@@ -506,7 +506,7 @@ const SubscriptionForm = () => {
|
|||||||
updateServiceData(
|
updateServiceData(
|
||||||
idx,
|
idx,
|
||||||
"capacity",
|
"capacity",
|
||||||
e.target.value ? Number(e.target.value) : ""
|
e.target.value ? Number(e.target.value) : "",
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -66,10 +66,10 @@ export const DeleteApplication = ({
|
|||||||
(account) =>
|
(account) =>
|
||||||
account.device_calling_application_sid ===
|
account.device_calling_application_sid ===
|
||||||
application.application_sid ||
|
application.application_sid ||
|
||||||
account.siprec_hook_sid === application.application_sid
|
account.siprec_hook_sid === application.application_sid,
|
||||||
),
|
),
|
||||||
teams: msteamRes.json.filter(
|
teams: msteamRes.json.filter(
|
||||||
(team) => team.application_sid === application.application_sid
|
(team) => team.application_sid === application.application_sid,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
const deletable =
|
const deletable =
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const EditApplication = () => {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const user = useSelectState("user");
|
const user = useSelectState("user");
|
||||||
const [data, refetch, error] = useApiData<Application>(
|
const [data, refetch, error] = useApiData<Application>(
|
||||||
`Applications/${params.application_sid}`
|
`Applications/${params.application_sid}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedRedirect(
|
useScopedRedirect(
|
||||||
@@ -23,7 +23,7 @@ export const EditApplication = () => {
|
|||||||
ROUTE_INTERNAL_APPLICATIONS,
|
ROUTE_INTERNAL_APPLICATIONS,
|
||||||
user,
|
user,
|
||||||
"You do not have access to this resource",
|
"You do not have access to this resource",
|
||||||
data
|
data,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
useRedirect<Account>(
|
useRedirect<Account>(
|
||||||
accounts,
|
accounts,
|
||||||
ROUTE_INTERNAL_ACCOUNTS,
|
ROUTE_INTERNAL_ACCOUNTS,
|
||||||
"You must create an account before you can create an application."
|
"You must create an account before you can create an application.",
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -173,7 +173,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
|
|
||||||
if (isUserAccountScope(accountSid, user)) {
|
if (isUserAccountScope(accountSid, user)) {
|
||||||
toastError(
|
toastError(
|
||||||
"You do not have permissions to make changes to these Speech Credentials"
|
"You do not have permissions to make changes to these Speech Credentials",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -187,11 +187,11 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
a.name === applicationName &&
|
a.name === applicationName &&
|
||||||
(!application ||
|
(!application ||
|
||||||
!application.data ||
|
!application.data ||
|
||||||
a.application_sid !== application.data.application_sid)
|
a.application_sid !== application.data.application_sid),
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
setMessage(
|
setMessage(
|
||||||
"The name you have entered is already in use on another one of your applications."
|
"The name you have entered is already in use on another one of your applications.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
application.refetch();
|
application.refetch();
|
||||||
toastSuccess("Application updated successfully");
|
toastSuccess("Application updated successfully");
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_APPLICATIONS}/${application.data?.application_sid}/edit`
|
`${ROUTE_INTERNAL_APPLICATIONS}/${application.data?.application_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -271,7 +271,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
tv.vendor.substring(VENDOR_CUSTOM.length + 1) +
|
tv.vendor.substring(VENDOR_CUSTOM.length + 1) +
|
||||||
` (${VENDOR_CUSTOM})`,
|
` (${VENDOR_CUSTOM})`,
|
||||||
value: tv.vendor,
|
value: tv.vendor,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
setttsVendorOptions(vendors.concat(v));
|
setttsVendorOptions(vendors.concat(v));
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
tv.vendor.substring(VENDOR_CUSTOM.length + 1) +
|
tv.vendor.substring(VENDOR_CUSTOM.length + 1) +
|
||||||
` (${VENDOR_CUSTOM})`,
|
` (${VENDOR_CUSTOM})`,
|
||||||
value: tv.vendor,
|
value: tv.vendor,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
setSttVendorOptions(vendors.concat(v2));
|
setSttVendorOptions(vendors.concat(v2));
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
(c) =>
|
(c) =>
|
||||||
c.vendor === synthVendor &&
|
c.vendor === synthVendor &&
|
||||||
(!c.account_sid || c.account_sid === accountSid) &&
|
(!c.account_sid || c.account_sid === accountSid) &&
|
||||||
c.use_for_tts
|
c.use_for_tts,
|
||||||
);
|
);
|
||||||
let c2 = c1
|
let c2 = c1
|
||||||
.filter((c) => c.label)
|
.filter((c) => c.label)
|
||||||
@@ -304,11 +304,11 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
Object.assign({
|
Object.assign({
|
||||||
name: c.label,
|
name: c.label,
|
||||||
value: c.label,
|
value: c.label,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
setTtsLabelOptions(
|
setTtsLabelOptions(
|
||||||
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2
|
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2,
|
||||||
);
|
);
|
||||||
|
|
||||||
c1 = fallbackSpeechSynthsisVendor
|
c1 = fallbackSpeechSynthsisVendor
|
||||||
@@ -316,7 +316,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
(c) =>
|
(c) =>
|
||||||
c.vendor === fallbackSpeechSynthsisVendor &&
|
c.vendor === fallbackSpeechSynthsisVendor &&
|
||||||
(!c.account_sid || c.account_sid === accountSid) &&
|
(!c.account_sid || c.account_sid === accountSid) &&
|
||||||
c.use_for_tts
|
c.use_for_tts,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -326,17 +326,17 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
Object.assign({
|
Object.assign({
|
||||||
name: c.label,
|
name: c.label,
|
||||||
value: c.label,
|
value: c.label,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
setFallbackTtsLabelOptions(
|
setFallbackTtsLabelOptions(
|
||||||
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2
|
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2,
|
||||||
);
|
);
|
||||||
|
|
||||||
c1 = credentials.filter(
|
c1 = credentials.filter(
|
||||||
(c) =>
|
(c) =>
|
||||||
c.vendor === recogVendor &&
|
c.vendor === recogVendor &&
|
||||||
(!c.account_sid || c.account_sid === accountSid) &&
|
(!c.account_sid || c.account_sid === accountSid) &&
|
||||||
c.use_for_stt
|
c.use_for_stt,
|
||||||
);
|
);
|
||||||
c2 = c1
|
c2 = c1
|
||||||
.filter((c) => c.label)
|
.filter((c) => c.label)
|
||||||
@@ -344,11 +344,11 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
Object.assign({
|
Object.assign({
|
||||||
name: c.label,
|
name: c.label,
|
||||||
value: c.label,
|
value: c.label,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
setSttLabelOptions(
|
setSttLabelOptions(
|
||||||
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2
|
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2,
|
||||||
);
|
);
|
||||||
|
|
||||||
c1 = fallbackSpeechRecognizerVendor
|
c1 = fallbackSpeechRecognizerVendor
|
||||||
@@ -356,7 +356,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
(c) =>
|
(c) =>
|
||||||
c.vendor === fallbackSpeechRecognizerVendor &&
|
c.vendor === fallbackSpeechRecognizerVendor &&
|
||||||
(!c.account_sid || c.account_sid === accountSid) &&
|
(!c.account_sid || c.account_sid === accountSid) &&
|
||||||
c.use_for_stt
|
c.use_for_stt,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
c2 = c1
|
c2 = c1
|
||||||
@@ -365,11 +365,11 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
Object.assign({
|
Object.assign({
|
||||||
name: c.label,
|
name: c.label,
|
||||||
value: c.label,
|
value: c.label,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
setFallbackSttLabelOptions(
|
setFallbackSttLabelOptions(
|
||||||
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2
|
c1.length !== c2.length ? [noneLabelObject, ...c2] : c2,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@@ -444,7 +444,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
setTmpApplicationJson(applicationJson);
|
setTmpApplicationJson(applicationJson);
|
||||||
setInitialApplicationJson(
|
setInitialApplicationJson(
|
||||||
application.data.app_json != undefined &&
|
application.data.app_json != undefined &&
|
||||||
application.data.app_json.length !== 0
|
application.data.app_json.length !== 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (application.data.call_hook) {
|
if (application.data.call_hook) {
|
||||||
@@ -491,12 +491,12 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
|
|
||||||
if (application.data.speech_synthesis_vendor)
|
if (application.data.speech_synthesis_vendor)
|
||||||
setSynthVendor(
|
setSynthVendor(
|
||||||
application.data.speech_synthesis_vendor as keyof SynthesisVendors
|
application.data.speech_synthesis_vendor as keyof SynthesisVendors,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (application.data.speech_synthesis_language)
|
if (application.data.speech_synthesis_language)
|
||||||
setSynthLang(
|
setSynthLang(
|
||||||
application.data.speech_synthesis_language as keyof RecognizerVendors
|
application.data.speech_synthesis_language as keyof RecognizerVendors,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (application.data.speech_synthesis_voice)
|
if (application.data.speech_synthesis_voice)
|
||||||
@@ -504,7 +504,7 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
|
|
||||||
if (application.data.speech_recognizer_vendor)
|
if (application.data.speech_recognizer_vendor)
|
||||||
setRecogVendor(
|
setRecogVendor(
|
||||||
application.data.speech_recognizer_vendor as keyof RecognizerVendors
|
application.data.speech_recognizer_vendor as keyof RecognizerVendors,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (application.data.speech_recognizer_language)
|
if (application.data.speech_recognizer_language)
|
||||||
@@ -513,35 +513,35 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
|
|||||||
if (application.data.use_for_fallback_speech) {
|
if (application.data.use_for_fallback_speech) {
|
||||||
setUseForFallbackSpeech(application.data.use_for_fallback_speech > 0);
|
setUseForFallbackSpeech(application.data.use_for_fallback_speech > 0);
|
||||||
setInitalCheckFallbackSpeech(
|
setInitalCheckFallbackSpeech(
|
||||||
application.data.use_for_fallback_speech > 0
|
application.data.use_for_fallback_speech > 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (application.data.fallback_speech_recognizer_vendor) {
|
if (application.data.fallback_speech_recognizer_vendor) {
|
||||||
setFallbackSpeechRecognizerVendor(
|
setFallbackSpeechRecognizerVendor(
|
||||||
application.data
|
application.data
|
||||||
.fallback_speech_recognizer_vendor as keyof RecognizerVendors
|
.fallback_speech_recognizer_vendor as keyof RecognizerVendors,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (application.data.fallback_speech_recognizer_language) {
|
if (application.data.fallback_speech_recognizer_language) {
|
||||||
setFallbackSpeechRecognizerLanguage(
|
setFallbackSpeechRecognizerLanguage(
|
||||||
application.data.fallback_speech_recognizer_language
|
application.data.fallback_speech_recognizer_language,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (application.data.fallback_speech_synthesis_vendor) {
|
if (application.data.fallback_speech_synthesis_vendor) {
|
||||||
setFallbackSpeechSynthsisVendor(
|
setFallbackSpeechSynthsisVendor(
|
||||||
application.data
|
application.data
|
||||||
.fallback_speech_synthesis_vendor as keyof SynthesisVendors
|
.fallback_speech_synthesis_vendor as keyof SynthesisVendors,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (application.data.fallback_speech_synthesis_language) {
|
if (application.data.fallback_speech_synthesis_language) {
|
||||||
setFallbackSpeechSynthsisLanguage(
|
setFallbackSpeechSynthsisLanguage(
|
||||||
application.data.fallback_speech_synthesis_language
|
application.data.fallback_speech_synthesis_language,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (application.data.fallback_speech_synthesis_voice) {
|
if (application.data.fallback_speech_synthesis_voice) {
|
||||||
setFallbackSpeechSynthsisVoice(
|
setFallbackSpeechSynthsisVoice(
|
||||||
application.data.fallback_speech_synthesis_voice
|
application.data.fallback_speech_synthesis_voice,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ export const Applications = () => {
|
|||||||
|
|
||||||
const filteredApplications = useFilteredResults<Application>(
|
const filteredApplications = useFilteredResults<Application>(
|
||||||
filter,
|
filter,
|
||||||
applications
|
applications,
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
if (application) {
|
if (application) {
|
||||||
if (isUserAccountScope(accountSid, user)) {
|
if (isUserAccountScope(accountSid, user)) {
|
||||||
toastError(
|
toastError(
|
||||||
"You do not have permissions to make changes to this Application"
|
"You do not have permissions to make changes to this Application",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ export const Applications = () => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted application <strong>{application.name}</strong>
|
Deleted application <strong>{application.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -139,7 +139,7 @@ export const Applications = () => {
|
|||||||
{
|
{
|
||||||
accounts?.find(
|
accounts?.find(
|
||||||
(acct) =>
|
(acct) =>
|
||||||
acct.account_sid === application.account_sid
|
acct.account_sid === application.account_sid,
|
||||||
)?.name
|
)?.name
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ type SpeechProviderSelectionProbs = {
|
|||||||
credentials: SpeechCredential[] | undefined;
|
credentials: SpeechCredential[] | undefined;
|
||||||
ttsVendor: [
|
ttsVendor: [
|
||||||
keyof SynthesisVendors,
|
keyof SynthesisVendors,
|
||||||
React.Dispatch<React.SetStateAction<keyof SynthesisVendors>>
|
React.Dispatch<React.SetStateAction<keyof SynthesisVendors>>,
|
||||||
];
|
];
|
||||||
ttsVendorOptions: VendorOptions[];
|
ttsVendorOptions: VendorOptions[];
|
||||||
ttsVoice: [string, React.Dispatch<React.SetStateAction<string>>];
|
ttsVoice: [string, React.Dispatch<React.SetStateAction<string>>];
|
||||||
@@ -50,7 +50,7 @@ type SpeechProviderSelectionProbs = {
|
|||||||
ttsLabel: [string, React.Dispatch<React.SetStateAction<string>>];
|
ttsLabel: [string, React.Dispatch<React.SetStateAction<string>>];
|
||||||
sttVendor: [
|
sttVendor: [
|
||||||
keyof RecognizerVendors,
|
keyof RecognizerVendors,
|
||||||
React.Dispatch<React.SetStateAction<keyof RecognizerVendors>>
|
React.Dispatch<React.SetStateAction<keyof RecognizerVendors>>,
|
||||||
];
|
];
|
||||||
sttVendorOptions: VendorOptions[];
|
sttVendorOptions: VendorOptions[];
|
||||||
sttLang: [string, React.Dispatch<React.SetStateAction<string>>];
|
sttLang: [string, React.Dispatch<React.SetStateAction<string>>];
|
||||||
@@ -160,8 +160,8 @@ export const SpeechProviderSelection = ({
|
|||||||
if (credentials) {
|
if (credentials) {
|
||||||
setSelectedCredential(
|
setSelectedCredential(
|
||||||
credentials.find(
|
credentials.find(
|
||||||
(c) => c.vendor === synthVendor && (c.label || "") === synthLabel
|
(c) => c.vendor === synthVendor && (c.label || "") === synthLabel,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [synthVendor, synthLabel, credentials]);
|
}, [synthVendor, synthLabel, credentials]);
|
||||||
@@ -212,7 +212,7 @@ export const SpeechProviderSelection = ({
|
|||||||
getSpeechSupportedLanguagesAndVoices(
|
getSpeechSupportedLanguagesAndVoices(
|
||||||
serviceProviderSid,
|
serviceProviderSid,
|
||||||
synthVendor,
|
synthVendor,
|
||||||
synthLabel
|
synthLabel,
|
||||||
)
|
)
|
||||||
.then(({ json }) => {
|
.then(({ json }) => {
|
||||||
// while fetching data, user might change the vendor
|
// while fetching data, user might change the vendor
|
||||||
@@ -310,7 +310,7 @@ export const SpeechProviderSelection = ({
|
|||||||
getSpeechSupportedLanguagesAndVoices(
|
getSpeechSupportedLanguagesAndVoices(
|
||||||
serviceProviderSid,
|
serviceProviderSid,
|
||||||
recogVendor,
|
recogVendor,
|
||||||
recogLabel
|
recogLabel,
|
||||||
)
|
)
|
||||||
.then(({ json }) => {
|
.then(({ json }) => {
|
||||||
// while fetching data, the user might change the vendor
|
// while fetching data, the user might change the vendor
|
||||||
@@ -363,7 +363,7 @@ export const SpeechProviderSelection = ({
|
|||||||
vendor.value != VENDOR_ASSEMBLYAI &&
|
vendor.value != VENDOR_ASSEMBLYAI &&
|
||||||
vendor.value != VENDOR_SONIOX &&
|
vendor.value != VENDOR_SONIOX &&
|
||||||
vendor.value !== VENDOR_CUSTOM &&
|
vendor.value !== VENDOR_CUSTOM &&
|
||||||
vendor.value !== VENDOR_COBALT
|
vendor.value !== VENDOR_COBALT,
|
||||||
)}
|
)}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const vendor = e.target.value as keyof SynthesisVendors;
|
const vendor = e.target.value as keyof SynthesisVendors;
|
||||||
@@ -427,7 +427,7 @@ export const SpeechProviderSelection = ({
|
|||||||
|
|
||||||
const voices =
|
const voices =
|
||||||
synthesisSupportedLanguagesAndVoices?.tts.find(
|
synthesisSupportedLanguagesAndVoices?.tts.find(
|
||||||
(lang) => lang.value === language
|
(lang) => lang.value === language,
|
||||||
)?.voices || [];
|
)?.voices || [];
|
||||||
if (
|
if (
|
||||||
synthVendor === VENDOR_GOOGLE &&
|
synthVendor === VENDOR_GOOGLE &&
|
||||||
@@ -512,7 +512,7 @@ export const SpeechProviderSelection = ({
|
|||||||
vendor.value != VENDOR_WELLSAID &&
|
vendor.value != VENDOR_WELLSAID &&
|
||||||
vendor.value != VENDOR_ELEVENLABS &&
|
vendor.value != VENDOR_ELEVENLABS &&
|
||||||
vendor.value != VENDOR_WHISPER &&
|
vendor.value != VENDOR_WHISPER &&
|
||||||
vendor.value !== VENDOR_CUSTOM
|
vendor.value !== VENDOR_CUSTOM,
|
||||||
)}
|
)}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const vendor = e.target.value as keyof RecognizerVendors;
|
const vendor = e.target.value as keyof RecognizerVendors;
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ export const DeleteCarrier = ({
|
|||||||
if (!ignore) {
|
if (!ignore) {
|
||||||
setPhoneNumbers(
|
setPhoneNumbers(
|
||||||
json.filter(
|
json.filter(
|
||||||
(phone) => phone.voip_carrier_sid === carrier.voip_carrier_sid
|
(phone) => phone.voip_carrier_sid === carrier.voip_carrier_sid,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ export const EditCarrier = () => {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const user = useSelectState("user");
|
const user = useSelectState("user");
|
||||||
const [data, refetch, error] = useApiData<Carrier>(
|
const [data, refetch, error] = useApiData<Carrier>(
|
||||||
`VoipCarriers/${params.voip_carrier_sid}`
|
`VoipCarriers/${params.voip_carrier_sid}`,
|
||||||
);
|
);
|
||||||
const [sipGateways, sipGatewaysRefetch] = useApiData<SipGateway[]>(
|
const [sipGateways, sipGatewaysRefetch] = useApiData<SipGateway[]>(
|
||||||
`SipGateways?voip_carrier_sid=${params.voip_carrier_sid}`
|
`SipGateways?voip_carrier_sid=${params.voip_carrier_sid}`,
|
||||||
);
|
);
|
||||||
const [smppGateways, smppGatewaysRefetch] = useApiData<SmppGateway[]>(
|
const [smppGateways, smppGatewaysRefetch] = useApiData<SmppGateway[]>(
|
||||||
`SmppGateways?voip_carrier_sid=${params.voip_carrier_sid}`
|
`SmppGateways?voip_carrier_sid=${params.voip_carrier_sid}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedRedirect(
|
useScopedRedirect(
|
||||||
@@ -29,7 +29,7 @@ export const EditCarrier = () => {
|
|||||||
ROUTE_INTERNAL_CARRIERS,
|
ROUTE_INTERNAL_CARRIERS,
|
||||||
user,
|
user,
|
||||||
"You do not have access to this resource",
|
"You do not have access to this resource",
|
||||||
data
|
data,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ export const CarrierForm = ({
|
|||||||
const updateSipGateways = (
|
const updateSipGateways = (
|
||||||
index: number,
|
index: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: typeof sipGateways[number][keyof SipGateway]
|
value: (typeof sipGateways)[number][keyof SipGateway],
|
||||||
) => {
|
) => {
|
||||||
setSipGateways(
|
setSipGateways(
|
||||||
sipGateways.map((g, i) =>
|
sipGateways.map((g, i) =>
|
||||||
@@ -251,18 +251,18 @@ export const CarrierForm = ({
|
|||||||
getIpValidationType(value) === IP &&
|
getIpValidationType(value) === IP &&
|
||||||
g.port === null && { port: 5060 }),
|
g.port === null && { port: 5060 }),
|
||||||
}
|
}
|
||||||
: g
|
: g,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateSmppGateways = (
|
const updateSmppGateways = (
|
||||||
index: number,
|
index: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: typeof smppGateways[number][keyof SmppGateway]
|
value: (typeof smppGateways)[number][keyof SmppGateway],
|
||||||
) => {
|
) => {
|
||||||
setSmppGateways(
|
setSmppGateways(
|
||||||
smppGateways.map((g, i) => (i === index ? { ...g, [key]: value } : g))
|
smppGateways.map((g, i) => (i === index ? { ...g, [key]: value } : g)),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -271,8 +271,8 @@ export const CarrierForm = ({
|
|||||||
sipGateways.map(({ sip_gateway_sid, ...g }: SipGateway) =>
|
sipGateways.map(({ sip_gateway_sid, ...g }: SipGateway) =>
|
||||||
sip_gateway_sid
|
sip_gateway_sid
|
||||||
? putSipGateway(sip_gateway_sid, g)
|
? putSipGateway(sip_gateway_sid, g)
|
||||||
: postSipGateway({ ...g, voip_carrier_sid })
|
: postSipGateway({ ...g, voip_carrier_sid }),
|
||||||
)
|
),
|
||||||
).then(() => {
|
).then(() => {
|
||||||
if (carrierSipGateways) {
|
if (carrierSipGateways) {
|
||||||
carrierSipGateways.refetch();
|
carrierSipGateways.refetch();
|
||||||
@@ -289,7 +289,7 @@ export const CarrierForm = ({
|
|||||||
smpp_gateway_sid
|
smpp_gateway_sid
|
||||||
? putSmppGateway(smpp_gateway_sid, g)
|
? putSmppGateway(smpp_gateway_sid, g)
|
||||||
: postSmppGateway({ ...g, voip_carrier_sid });
|
: postSmppGateway({ ...g, voip_carrier_sid });
|
||||||
})
|
}),
|
||||||
).then(() => {
|
).then(() => {
|
||||||
if (carrierSmppGateways) {
|
if (carrierSmppGateways) {
|
||||||
carrierSmppGateways.refetch();
|
carrierSmppGateways.refetch();
|
||||||
@@ -300,7 +300,7 @@ export const CarrierForm = ({
|
|||||||
const handleSipGatewayDelete = (g?: SipGateway) => {
|
const handleSipGatewayDelete = (g?: SipGateway) => {
|
||||||
if (g && g.sip_gateway_sid) {
|
if (g && g.sip_gateway_sid) {
|
||||||
deleteSipGateway(g.sip_gateway_sid).then(() =>
|
deleteSipGateway(g.sip_gateway_sid).then(() =>
|
||||||
toastSuccess("SIP gateway successfully deleted")
|
toastSuccess("SIP gateway successfully deleted"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -311,8 +311,8 @@ export const CarrierForm = ({
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
`SMPP ${
|
`SMPP ${
|
||||||
g.outbound ? "outbound" : "inbound"
|
g.outbound ? "outbound" : "inbound"
|
||||||
} gateway successfully deleted`
|
} gateway successfully deleted`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -429,7 +429,7 @@ export const CarrierForm = ({
|
|||||||
|
|
||||||
const emptySipIp = sipGateways.find((g) => g.ipv4.trim() === "");
|
const emptySipIp = sipGateways.find((g) => g.ipv4.trim() === "");
|
||||||
const invalidSipPort = sipGateways.find(
|
const invalidSipPort = sipGateways.find(
|
||||||
(g) => hasValue(g.port) && !isValidPort(g.port)
|
(g) => hasValue(g.port) && !isValidPort(g.port),
|
||||||
);
|
);
|
||||||
const sipGatewayValidation = getSipValidation();
|
const sipGatewayValidation = getSipValidation();
|
||||||
|
|
||||||
@@ -530,7 +530,7 @@ export const CarrierForm = ({
|
|||||||
putCarrier(
|
putCarrier(
|
||||||
currentServiceProvider.service_provider_sid,
|
currentServiceProvider.service_provider_sid,
|
||||||
carrier.data.voip_carrier_sid,
|
carrier.data.voip_carrier_sid,
|
||||||
carrierPayload
|
carrierPayload,
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (carrier.data?.voip_carrier_sid) {
|
if (carrier.data?.voip_carrier_sid) {
|
||||||
@@ -541,7 +541,7 @@ export const CarrierForm = ({
|
|||||||
toastSuccess("Carrier updated successfully");
|
toastSuccess("Carrier updated successfully");
|
||||||
carrier.refetch();
|
carrier.refetch();
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_CARRIERS}/${carrier.data?.voip_carrier_sid}/edit`
|
`${ROUTE_INTERNAL_CARRIERS}/${carrier.data?.voip_carrier_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -571,7 +571,7 @@ export const CarrierForm = ({
|
|||||||
setLocation();
|
setLocation();
|
||||||
if (predefinedName && hasLength(predefinedCarriers)) {
|
if (predefinedName && hasLength(predefinedCarriers)) {
|
||||||
const predefinedCarrierSid = predefinedCarriers.find(
|
const predefinedCarrierSid = predefinedCarriers.find(
|
||||||
(a) => a.name === predefinedName
|
(a) => a.name === predefinedName,
|
||||||
)?.predefined_carrier_sid;
|
)?.predefined_carrier_sid;
|
||||||
|
|
||||||
if (currentServiceProvider && predefinedCarrierSid) {
|
if (currentServiceProvider && predefinedCarrierSid) {
|
||||||
@@ -579,11 +579,11 @@ export const CarrierForm = ({
|
|||||||
user?.scope === USER_ACCOUNT
|
user?.scope === USER_ACCOUNT
|
||||||
? postPredefinedCarrierTemplateAccount(
|
? postPredefinedCarrierTemplateAccount(
|
||||||
accountSid,
|
accountSid,
|
||||||
predefinedCarrierSid
|
predefinedCarrierSid,
|
||||||
)
|
)
|
||||||
: postPredefinedCarrierTemplate(
|
: postPredefinedCarrierTemplate(
|
||||||
currentServiceProvider.service_provider_sid,
|
currentServiceProvider.service_provider_sid,
|
||||||
predefinedCarrierSid
|
predefinedCarrierSid,
|
||||||
);
|
);
|
||||||
|
|
||||||
postPredefinedCarrier
|
postPredefinedCarrier
|
||||||
@@ -693,9 +693,9 @@ export const CarrierForm = ({
|
|||||||
(carrier: PredefinedCarrier) => ({
|
(carrier: PredefinedCarrier) => ({
|
||||||
name: carrier.name,
|
name: carrier.name,
|
||||||
value: carrier.name,
|
value: carrier.name,
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
: []
|
: [],
|
||||||
)}
|
)}
|
||||||
onChange={(e) => setPredefinedName(e.target.value)}
|
onChange={(e) => setPredefinedName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
@@ -748,7 +748,7 @@ export const CarrierForm = ({
|
|||||||
accounts={
|
accounts={
|
||||||
user?.scope === USER_ACCOUNT
|
user?.scope === USER_ACCOUNT
|
||||||
? accounts?.filter(
|
? accounts?.filter(
|
||||||
(acct) => user.account_sid === acct.account_sid
|
(acct) => user.account_sid === acct.account_sid,
|
||||||
)
|
)
|
||||||
: accounts
|
: accounts
|
||||||
}
|
}
|
||||||
@@ -760,8 +760,8 @@ export const CarrierForm = ({
|
|||||||
user?.scope !== USER_ACCOUNT
|
user?.scope !== USER_ACCOUNT
|
||||||
? false
|
? false
|
||||||
: user.account_sid !== accountSid
|
: user.account_sid !== accountSid
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{user &&
|
{user &&
|
||||||
@@ -774,7 +774,7 @@ export const CarrierForm = ({
|
|||||||
defaultOption="None"
|
defaultOption="None"
|
||||||
application={[applicationSid, setApplicationSid]}
|
application={[applicationSid, setApplicationSid]}
|
||||||
applications={applications.filter(
|
applications={applications.filter(
|
||||||
(application) => application.account_sid === accountSid
|
(application) => application.account_sid === accountSid,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
@@ -1002,7 +1002,7 @@ export const CarrierForm = ({
|
|||||||
!isNotBlank(e.target.value) &&
|
!isNotBlank(e.target.value) &&
|
||||||
getIpValidationType(g.ipv4) !== IP
|
getIpValidationType(g.ipv4) !== IP
|
||||||
? null
|
? null
|
||||||
: Number(e.target.value)
|
: Number(e.target.value),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
ref={(ref: HTMLInputElement) =>
|
ref={(ref: HTMLInputElement) =>
|
||||||
@@ -1015,7 +1015,6 @@ export const CarrierForm = ({
|
|||||||
<Selector
|
<Selector
|
||||||
id={`sip_protocol_${i}`}
|
id={`sip_protocol_${i}`}
|
||||||
name={`sip_protocol${i}`}
|
name={`sip_protocol${i}`}
|
||||||
placeholder=""
|
|
||||||
value={g.protocol}
|
value={g.protocol}
|
||||||
options={SIP_GATEWAY_PROTOCOL_OPTIONS}
|
options={SIP_GATEWAY_PROTOCOL_OPTIONS}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
@@ -1028,7 +1027,6 @@ export const CarrierForm = ({
|
|||||||
<Selector
|
<Selector
|
||||||
id={`sip_netmask_${i}`}
|
id={`sip_netmask_${i}`}
|
||||||
name={`sip_netmask${i}`}
|
name={`sip_netmask${i}`}
|
||||||
placeholder="32"
|
|
||||||
value={g.netmask}
|
value={g.netmask}
|
||||||
options={NETMASK_OPTIONS}
|
options={NETMASK_OPTIONS}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
@@ -1053,7 +1051,7 @@ export const CarrierForm = ({
|
|||||||
updateSipGateways(
|
updateSipGateways(
|
||||||
i,
|
i,
|
||||||
"is_active",
|
"is_active",
|
||||||
e.target.checked ? 1 : 0
|
e.target.checked ? 1 : 0,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -1072,7 +1070,7 @@ export const CarrierForm = ({
|
|||||||
updateSipGateways(
|
updateSipGateways(
|
||||||
i,
|
i,
|
||||||
"inbound",
|
"inbound",
|
||||||
e.target.checked ? 1 : 0
|
e.target.checked ? 1 : 0,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -1091,7 +1089,7 @@ export const CarrierForm = ({
|
|||||||
updateSipGateways(
|
updateSipGateways(
|
||||||
i,
|
i,
|
||||||
"outbound",
|
"outbound",
|
||||||
e.target.checked
|
e.target.checked,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -1113,7 +1111,7 @@ export const CarrierForm = ({
|
|||||||
updateSipGateways(
|
updateSipGateways(
|
||||||
i,
|
i,
|
||||||
"pad_crypto",
|
"pad_crypto",
|
||||||
e.target.checked
|
e.target.checked,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -1132,15 +1130,15 @@ export const CarrierForm = ({
|
|||||||
|
|
||||||
if (sipGateways.length === 1) {
|
if (sipGateways.length === 1) {
|
||||||
setSipMessage(
|
setSipMessage(
|
||||||
"You must provide at least one SIP Gateway."
|
"You must provide at least one SIP Gateway.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
handleSipGatewayDelete(
|
handleSipGatewayDelete(
|
||||||
sipGateways.find((g2, i2) => i2 === i)
|
sipGateways.find((g2, i2) => i2 === i),
|
||||||
);
|
);
|
||||||
|
|
||||||
setSipGateways(
|
setSipGateways(
|
||||||
sipGateways.filter((g2, i2) => i2 !== i)
|
sipGateways.filter((g2, i2) => i2 !== i),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -1254,7 +1252,7 @@ export const CarrierForm = ({
|
|||||||
updateSmppGateways(
|
updateSmppGateways(
|
||||||
i,
|
i,
|
||||||
"port",
|
"port",
|
||||||
Number(e.target.value)
|
Number(e.target.value),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ref={(ref: HTMLInputElement) =>
|
ref={(ref: HTMLInputElement) =>
|
||||||
@@ -1273,7 +1271,7 @@ export const CarrierForm = ({
|
|||||||
updateSmppGateways(
|
updateSmppGateways(
|
||||||
i,
|
i,
|
||||||
"use_tls",
|
"use_tls",
|
||||||
e.target.checked
|
e.target.checked,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -1295,15 +1293,15 @@ export const CarrierForm = ({
|
|||||||
(smppSystemId || smppPass)
|
(smppSystemId || smppPass)
|
||||||
) {
|
) {
|
||||||
setSmppOutboundMessage(
|
setSmppOutboundMessage(
|
||||||
"You must provide at least one Outbound Gateway."
|
"You must provide at least one Outbound Gateway.",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
handleSmppGatewayDelete(
|
handleSmppGatewayDelete(
|
||||||
smppGateways.find((g2, i2) => i2 === i)
|
smppGateways.find((g2, i2) => i2 === i),
|
||||||
);
|
);
|
||||||
|
|
||||||
setSmppGateways(
|
setSmppGateways(
|
||||||
smppGateways.filter((g2, i2) => i2 !== i)
|
smppGateways.filter((g2, i2) => i2 !== i),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -1397,7 +1395,6 @@ export const CarrierForm = ({
|
|||||||
<Selector
|
<Selector
|
||||||
id={`smpp_netmask_${i}`}
|
id={`smpp_netmask_${i}`}
|
||||||
name={`smpp_netmask_${i}`}
|
name={`smpp_netmask_${i}`}
|
||||||
placeholder="32"
|
|
||||||
options={NETMASK_OPTIONS}
|
options={NETMASK_OPTIONS}
|
||||||
value={g.netmask}
|
value={g.netmask}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
@@ -1412,11 +1409,11 @@ export const CarrierForm = ({
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleSmppGatewayDelete(
|
handleSmppGatewayDelete(
|
||||||
smppGateways.find((g2, i2) => i2 === i)
|
smppGateways.find((g2, i2) => i2 === i),
|
||||||
);
|
);
|
||||||
|
|
||||||
setSmppGateways(
|
setSmppGateways(
|
||||||
smppGateways.filter((g2, i2) => i2 !== i)
|
smppGateways.filter((g2, i2) => i2 !== i),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type GatewaysProps = {
|
|||||||
|
|
||||||
export const Gateways = ({ carrier }: GatewaysProps) => {
|
export const Gateways = ({ carrier }: GatewaysProps) => {
|
||||||
const [gateways, , error] = useApiData<SipGateway[]>(
|
const [gateways, , error] = useApiData<SipGateway[]>(
|
||||||
`SipGateways?voip_carrier_sid=${carrier.voip_carrier_sid}`
|
`SipGateways?voip_carrier_sid=${carrier.voip_carrier_sid}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderGateways = () => {
|
const renderGateways = () => {
|
||||||
|
|||||||
@@ -66,14 +66,14 @@ export const Carriers = () => {
|
|||||||
? carriers.filter((carrier) =>
|
? carriers.filter((carrier) =>
|
||||||
accountSid
|
accountSid
|
||||||
? carrier.account_sid === accountSid
|
? carrier.account_sid === accountSid
|
||||||
: carrier.account_sid === null
|
: carrier.account_sid === null,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
}, [accountSid, carrier, carriers]);
|
}, [accountSid, carrier, carriers]);
|
||||||
|
|
||||||
const filteredCarriers = useFilteredResults<Carrier>(
|
const filteredCarriers = useFilteredResults<Carrier>(
|
||||||
filter,
|
filter,
|
||||||
carriersFiltered
|
carriersFiltered,
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
@@ -87,10 +87,10 @@ export const Carriers = () => {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
getFetch<SipGateway[]>(
|
getFetch<SipGateway[]>(
|
||||||
`${API_SIP_GATEWAY}?voip_carrier_sid=${carrier.voip_carrier_sid}`
|
`${API_SIP_GATEWAY}?voip_carrier_sid=${carrier.voip_carrier_sid}`,
|
||||||
),
|
),
|
||||||
getFetch<SmppGateway[]>(
|
getFetch<SmppGateway[]>(
|
||||||
`${API_SMPP_GATEWAY}?voip_carrier_sid=${carrier.voip_carrier_sid}`
|
`${API_SMPP_GATEWAY}?voip_carrier_sid=${carrier.voip_carrier_sid}`,
|
||||||
),
|
),
|
||||||
]).then(([sipGatewaysRes, smppGatewaysRes]) => {
|
]).then(([sipGatewaysRes, smppGatewaysRes]) => {
|
||||||
hasLength(sipGatewaysRes.json) &&
|
hasLength(sipGatewaysRes.json) &&
|
||||||
@@ -99,8 +99,8 @@ export const Carriers = () => {
|
|||||||
g &&
|
g &&
|
||||||
g.sip_gateway_sid &&
|
g.sip_gateway_sid &&
|
||||||
deleteSipGateway(g.sip_gateway_sid).catch((error) =>
|
deleteSipGateway(g.sip_gateway_sid).catch((error) =>
|
||||||
toastError(error.msg)
|
toastError(error.msg),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
hasLength(smppGatewaysRes.json) &&
|
hasLength(smppGatewaysRes.json) &&
|
||||||
smppGatewaysRes.json.forEach(
|
smppGatewaysRes.json.forEach(
|
||||||
@@ -108,8 +108,8 @@ export const Carriers = () => {
|
|||||||
g &&
|
g &&
|
||||||
g.smpp_gateway_sid &&
|
g.smpp_gateway_sid &&
|
||||||
deleteSmppGateway(g.smpp_gateway_sid).catch((error) =>
|
deleteSmppGateway(g.smpp_gateway_sid).catch((error) =>
|
||||||
toastError(error.msg)
|
toastError(error.msg),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
setCarrier(null);
|
setCarrier(null);
|
||||||
@@ -117,7 +117,7 @@ export const Carriers = () => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted Carrier <strong>{carrier.name}</strong>
|
Deleted Carrier <strong>{carrier.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -130,7 +130,7 @@ export const Carriers = () => {
|
|||||||
setLocation();
|
setLocation();
|
||||||
if (currentServiceProvider) {
|
if (currentServiceProvider) {
|
||||||
setApiUrl(
|
setApiUrl(
|
||||||
`ServiceProviders/${currentServiceProvider.service_provider_sid}/VoipCarriers`
|
`ServiceProviders/${currentServiceProvider.service_provider_sid}/VoipCarriers`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [user, currentServiceProvider, accountSid]);
|
}, [user, currentServiceProvider, accountSid]);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const ClientsEdit = () => {
|
|||||||
const params = useParams();
|
const params = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [data, refetch, error] = useApiData<Client>(
|
const [data, refetch, error] = useApiData<Client>(
|
||||||
`Clients/${params.client_sid}`
|
`Clients/${params.client_sid}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Handle error toast at top level... */
|
/** Handle error toast at top level... */
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const ClientsForm = ({ client }: ClientsFormProps) => {
|
|||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [isActive, setIsActive] = useState(
|
const [isActive, setIsActive] = useState(
|
||||||
client ? client.data?.is_active : true
|
client ? client.data?.is_active : true,
|
||||||
);
|
);
|
||||||
const [allowDirectAppCalling, setAllowDirectAppCalling] = useState(true);
|
const [allowDirectAppCalling, setAllowDirectAppCalling] = useState(true);
|
||||||
const [allowDirectQueueCalling, setAllowDirectQueueCalling] = useState(true);
|
const [allowDirectQueueCalling, setAllowDirectQueueCalling] = useState(true);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const Clients = () => {
|
|||||||
setSelectedAccount(
|
setSelectedAccount(
|
||||||
accountSid
|
accountSid
|
||||||
? accounts?.find((a: Account) => a.account_sid === accountSid)
|
? accounts?.find((a: Account) => a.account_sid === accountSid)
|
||||||
: null
|
: null,
|
||||||
);
|
);
|
||||||
|
|
||||||
return clients
|
return clients
|
||||||
@@ -48,8 +48,8 @@ export const Clients = () => {
|
|||||||
return accountSid
|
return accountSid
|
||||||
? c.account_sid === accountSid
|
? c.account_sid === accountSid
|
||||||
: accounts
|
: accounts
|
||||||
? accounts.map((a) => a.account_sid).includes(c.account_sid || "")
|
? accounts.map((a) => a.account_sid).includes(c.account_sid || "")
|
||||||
: false;
|
: false;
|
||||||
})
|
})
|
||||||
: [];
|
: [];
|
||||||
}, [accountSid, clients, accounts]);
|
}, [accountSid, clients, accounts]);
|
||||||
@@ -63,7 +63,7 @@ export const Clients = () => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted sip client <strong>{client.username}</strong>
|
Deleted sip client <strong>{client.username}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
setClient(null);
|
setClient(null);
|
||||||
refetch();
|
refetch();
|
||||||
@@ -179,7 +179,7 @@ export const Clients = () => {
|
|||||||
<span>
|
<span>
|
||||||
{
|
{
|
||||||
accounts?.find(
|
accounts?.find(
|
||||||
(acct) => acct.account_sid === c.account_sid
|
(acct) => acct.account_sid === c.account_sid,
|
||||||
)?.name
|
)?.name
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type CardProps = {
|
|||||||
index1: number,
|
index1: number,
|
||||||
index2: number,
|
index2: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: unknown
|
value: unknown,
|
||||||
) => void;
|
) => void;
|
||||||
handleRouteDelete: (lr: LcrRoute, index: number) => void;
|
handleRouteDelete: (lr: LcrRoute, index: number) => void;
|
||||||
carrierSelectorOptions: SelectorOption[];
|
carrierSelectorOptions: SelectorOption[];
|
||||||
@@ -141,7 +141,6 @@ export const Card = ({
|
|||||||
<Selector
|
<Selector
|
||||||
id={`lcr_carrier_set_entry_carrier_${index}`}
|
id={`lcr_carrier_set_entry_carrier_${index}`}
|
||||||
name={`lcr_carrier_set_entry_carrier_${index}`}
|
name={`lcr_carrier_set_entry_carrier_${index}`}
|
||||||
placeholder="Carrier"
|
|
||||||
value={
|
value={
|
||||||
lr.lcr_carrier_set_entries && lr.lcr_carrier_set_entries.length > 0
|
lr.lcr_carrier_set_entries && lr.lcr_carrier_set_entries.length > 0
|
||||||
? lr.lcr_carrier_set_entries[0].voip_carrier_sid
|
? lr.lcr_carrier_set_entries[0].voip_carrier_sid
|
||||||
@@ -156,7 +155,7 @@ export const Card = ({
|
|||||||
index,
|
index,
|
||||||
0,
|
0,
|
||||||
"voip_carrier_sid",
|
"voip_carrier_sid",
|
||||||
e.target.value
|
e.target.value,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ export const Container = ({
|
|||||||
[dragIndex, 1],
|
[dragIndex, 1],
|
||||||
[hoverIndex, 0, prevCards[dragIndex]],
|
[hoverIndex, 0, prevCards[dragIndex]],
|
||||||
],
|
],
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateLcrRoute = (index: number, key: string, value: unknown) => {
|
const updateLcrRoute = (index: number, key: string, value: unknown) => {
|
||||||
setLcrRoutes(
|
setLcrRoutes(
|
||||||
lcrRoutes.map((lr, i) => (i === index ? { ...lr, [key]: value } : lr))
|
lcrRoutes.map((lr, i) => (i === index ? { ...lr, [key]: value } : lr)),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ export const Container = ({
|
|||||||
index1: number,
|
index1: number,
|
||||||
index2: number,
|
index2: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: unknown
|
value: unknown,
|
||||||
) => {
|
) => {
|
||||||
setLcrRoutes(
|
setLcrRoutes(
|
||||||
lcrRoutes.map((lr, i) =>
|
lcrRoutes.map((lr, i) =>
|
||||||
@@ -51,11 +51,11 @@ export const Container = ({
|
|||||||
...entry,
|
...entry,
|
||||||
[key]: value,
|
[key]: value,
|
||||||
}
|
}
|
||||||
: entry
|
: entry,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
: lr
|
: lr,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import { useParams } from "react-router-dom";
|
|||||||
export const EditLcr = () => {
|
export const EditLcr = () => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const [lcrData, lcrRefect, lcrError] = useApiData<Lcr>(
|
const [lcrData, lcrRefect, lcrError] = useApiData<Lcr>(
|
||||||
`Lcrs/${params.lcr_sid}`
|
`Lcrs/${params.lcr_sid}`,
|
||||||
);
|
);
|
||||||
const [lcrRouteData, lcrRouteRefect, lcrRouteError] = useApiData<LcrRoute[]>(
|
const [lcrRouteData, lcrRouteRefect, lcrRouteError] = useApiData<LcrRoute[]>(
|
||||||
`LcrRoutes?lcr_sid=${params.lcr_sid}`
|
`LcrRoutes?lcr_sid=${params.lcr_sid}`,
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
setLocation();
|
setLocation();
|
||||||
if (currentServiceProvider) {
|
if (currentServiceProvider) {
|
||||||
setApiUrl(
|
setApiUrl(
|
||||||
`ServiceProviders/${currentServiceProvider.service_provider_sid}/VoipCarriers`
|
`ServiceProviders/${currentServiceProvider.service_provider_sid}/VoipCarriers`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [user, currentServiceProvider, accountSid]);
|
}, [user, currentServiceProvider, accountSid]);
|
||||||
@@ -99,7 +99,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
? carriers.filter((carrier) =>
|
? carriers.filter((carrier) =>
|
||||||
accountSid
|
accountSid
|
||||||
? carrier.account_sid === accountSid
|
? carrier.account_sid === accountSid
|
||||||
: carrier.account_sid === null
|
: carrier.account_sid === null,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
setErrorMessage(
|
setErrorMessage(
|
||||||
accountSid
|
accountSid
|
||||||
? "There are no available carriers defined for this account"
|
? "There are no available carriers defined for this account"
|
||||||
: "There are no available carriers"
|
: "There are no available carriers",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setErrorMessage("");
|
setErrorMessage("");
|
||||||
@@ -149,7 +149,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
) {
|
) {
|
||||||
setDefaultLcrCarrier(entry.voip_carrier_sid || defaultCarrier);
|
setDefaultLcrCarrier(entry.voip_carrier_sid || defaultCarrier);
|
||||||
setDefaultLcrCarrierSetEntrySid(
|
setDefaultLcrCarrierSetEntrySid(
|
||||||
entry.lcr_carrier_set_entry_sid || null
|
entry.lcr_carrier_set_entry_sid || null,
|
||||||
);
|
);
|
||||||
default_lcr_route_sid = entry.lcr_route_sid || "";
|
default_lcr_route_sid = entry.lcr_route_sid || "";
|
||||||
setDefaultLcrRoute(lr);
|
setDefaultLcrRoute(lr);
|
||||||
@@ -161,8 +161,8 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
if (lcrRouteDataMap && lcrRouteDataMap.data)
|
if (lcrRouteDataMap && lcrRouteDataMap.data)
|
||||||
setLcrRoutes(
|
setLcrRoutes(
|
||||||
lcrRouteDataMap.data.filter(
|
lcrRouteDataMap.data.filter(
|
||||||
(route) => route.lcr_route_sid !== default_lcr_route_sid
|
(route) => route.lcr_route_sid !== default_lcr_route_sid,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}, [lcrRouteDataMap?.data]);
|
}, [lcrRouteDataMap?.data]);
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
(r) => ({
|
(r) => ({
|
||||||
...r,
|
...r,
|
||||||
voip_carrier_sid: defaultCarrier || carrierSelectorOptions[0].value,
|
voip_carrier_sid: defaultCarrier || carrierSelectorOptions[0].value,
|
||||||
})
|
}),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -235,7 +235,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
navigate(ROUTE_INTERNAL_LEST_COST_ROUTING);
|
navigate(ROUTE_INTERNAL_LEST_COST_ROUTING);
|
||||||
} else {
|
} else {
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_LEST_COST_ROUTING}/${json.sid}/edit`
|
`${ROUTE_INTERNAL_LEST_COST_ROUTING}/${json.sid}/edit`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Update global state
|
// Update global state
|
||||||
@@ -301,7 +301,7 @@ export const LcrForm = ({ lcrDataMap, lcrRouteDataMap }: LcrFormProps) => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted least cost routing <strong>{lcrForDelete?.name}</strong>
|
Deleted least cost routing <strong>{lcrForDelete?.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
setLcrForDelete(null);
|
setLcrForDelete(null);
|
||||||
if (user?.access === Scope.admin) {
|
if (user?.access === Scope.admin) {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const Lcrs = () => {
|
|||||||
Scope.admin,
|
Scope.admin,
|
||||||
`${ROUTE_INTERNAL_LEST_COST_ROUTING}/add`,
|
`${ROUTE_INTERNAL_LEST_COST_ROUTING}/add`,
|
||||||
user,
|
user,
|
||||||
"You do not have permissions to manage all outbound call routes"
|
"You do not have permissions to manage all outbound call routes",
|
||||||
);
|
);
|
||||||
const [lcrs, refetch] = useApiData<Lcr[]>("Lcrs");
|
const [lcrs, refetch] = useApiData<Lcr[]>("Lcrs");
|
||||||
const [filter, setFilter] = useState("");
|
const [filter, setFilter] = useState("");
|
||||||
@@ -53,9 +53,9 @@ export const Lcrs = () => {
|
|||||||
accountSid
|
accountSid
|
||||||
? lcr.account_sid === accountSid
|
? lcr.account_sid === accountSid
|
||||||
: currentServiceProvider?.service_provider_sid
|
: currentServiceProvider?.service_provider_sid
|
||||||
? lcr.service_provider_sid ==
|
? lcr.service_provider_sid ==
|
||||||
currentServiceProvider.service_provider_sid
|
currentServiceProvider.service_provider_sid
|
||||||
: lcr.account_sid === null
|
: lcr.account_sid === null,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
}, [accountSid, lcrs]);
|
}, [accountSid, lcrs]);
|
||||||
@@ -68,7 +68,7 @@ export const Lcrs = () => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted outbound call route <strong>{lcr?.name}</strong>
|
Deleted outbound call route <strong>{lcr?.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
setLcr(null);
|
setLcr(null);
|
||||||
refetch();
|
refetch();
|
||||||
@@ -156,7 +156,7 @@ export const Lcrs = () => {
|
|||||||
<span>
|
<span>
|
||||||
{lcr.account_sid
|
{lcr.account_sid
|
||||||
? accounts?.find(
|
? accounts?.find(
|
||||||
(acct) => acct.account_sid === lcr.account_sid
|
(acct) => acct.account_sid === lcr.account_sid,
|
||||||
)?.name
|
)?.name
|
||||||
: currentServiceProvider?.name}
|
: currentServiceProvider?.name}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.lcr-card:hover {
|
.lcr-card:hover {
|
||||||
box-shadow: -7px 7px 5px #d5d7db, -5px -5px 10px #ffffff;
|
box-shadow:
|
||||||
|
-7px 7px 5px #d5d7db,
|
||||||
|
-5px -5px 10px #ffffff;
|
||||||
transform: translateY(-3px) translateX(-3px);
|
transform: translateY(-3px) translateX(-3px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import type { MSTeamsTenant } from "src/api/types";
|
|||||||
export const EditMsTeamsTenant = () => {
|
export const EditMsTeamsTenant = () => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const [data, refetch, error] = useApiData<MSTeamsTenant>(
|
const [data, refetch, error] = useApiData<MSTeamsTenant>(
|
||||||
`MicrosoftTeamsTenants/${params.ms_teams_tenant_sid}`
|
`MicrosoftTeamsTenants/${params.ms_teams_tenant_sid}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export const MsTeamsTenantForm = ({
|
|||||||
useRedirect<Account>(
|
useRedirect<Account>(
|
||||||
accounts,
|
accounts,
|
||||||
ROUTE_INTERNAL_ACCOUNTS,
|
ROUTE_INTERNAL_ACCOUNTS,
|
||||||
"You must create an account before you can create an Microsoft Teams Tenant."
|
"You must create an account before you can create an Microsoft Teams Tenant.",
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -63,7 +63,7 @@ export const MsTeamsTenantForm = ({
|
|||||||
? msTeamsTenants.filter(
|
? msTeamsTenants.filter(
|
||||||
(a) =>
|
(a) =>
|
||||||
a.ms_teams_tenant_sid !==
|
a.ms_teams_tenant_sid !==
|
||||||
msTeamsTenant.data!.ms_teams_tenant_sid
|
msTeamsTenant.data!.ms_teams_tenant_sid,
|
||||||
)
|
)
|
||||||
: msTeamsTenants;
|
: msTeamsTenants;
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ export const MsTeamsTenantForm = ({
|
|||||||
applications={
|
applications={
|
||||||
applications
|
applications
|
||||||
? applications.filter(
|
? applications.filter(
|
||||||
(application) => application.account_sid === accountSid
|
(application) => application.account_sid === accountSid,
|
||||||
)
|
)
|
||||||
: []
|
: []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ import type { ACLGetIMessage } from "src/utils/with-access-control";
|
|||||||
|
|
||||||
export const MSTeamsTenants = () => {
|
export const MSTeamsTenants = () => {
|
||||||
const [msTeamsTenant, setMsTeamsTenant] = useState<MSTeamsTenant | null>(
|
const [msTeamsTenant, setMsTeamsTenant] = useState<MSTeamsTenant | null>(
|
||||||
null
|
null,
|
||||||
);
|
);
|
||||||
const [msTeamsTenants, refetch] = useApiData<MSTeamsTenant[]>(
|
const [msTeamsTenants, refetch] = useApiData<MSTeamsTenant[]>(
|
||||||
"MicrosoftTeamsTenants"
|
"MicrosoftTeamsTenants",
|
||||||
);
|
);
|
||||||
const [accounts] = useServiceProviderData<Account[]>("Accounts");
|
const [accounts] = useServiceProviderData<Account[]>("Accounts");
|
||||||
const [applications] = useServiceProviderData<Application[]>("Applications");
|
const [applications] = useServiceProviderData<Application[]>("Applications");
|
||||||
@@ -45,14 +45,14 @@ export const MSTeamsTenants = () => {
|
|||||||
const msTeamsTenantsFiltered = useMemo(() => {
|
const msTeamsTenantsFiltered = useMemo(() => {
|
||||||
return msTeamsTenants
|
return msTeamsTenants
|
||||||
? msTeamsTenants.filter(
|
? msTeamsTenants.filter(
|
||||||
(mst) => !accountSid || mst.account_sid === accountSid
|
(mst) => !accountSid || mst.account_sid === accountSid,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
}, [accountSid, msTeamsTenants]);
|
}, [accountSid, msTeamsTenants]);
|
||||||
|
|
||||||
const filteredMsTeamsTenants = useFilteredResults<MSTeamsTenant>(
|
const filteredMsTeamsTenants = useFilteredResults<MSTeamsTenant>(
|
||||||
filter,
|
filter,
|
||||||
msTeamsTenantsFiltered
|
msTeamsTenantsFiltered,
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
@@ -65,7 +65,7 @@ export const MSTeamsTenants = () => {
|
|||||||
<>
|
<>
|
||||||
Deleted Microsoft Teams Tenant{" "}
|
Deleted Microsoft Teams Tenant{" "}
|
||||||
<strong>{msTeamsTenant.tenant_fqdn}</strong>
|
<strong>{msTeamsTenant.tenant_fqdn}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -131,7 +131,8 @@ export const MSTeamsTenants = () => {
|
|||||||
{
|
{
|
||||||
accounts?.find(
|
accounts?.find(
|
||||||
(acct) =>
|
(acct) =>
|
||||||
acct.account_sid === msTeamsTenant.account_sid
|
acct.account_sid ===
|
||||||
|
msTeamsTenant.account_sid,
|
||||||
)?.name
|
)?.name
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
@@ -148,7 +149,7 @@ export const MSTeamsTenants = () => {
|
|||||||
{applications?.find(
|
{applications?.find(
|
||||||
(app) =>
|
(app) =>
|
||||||
app.application_sid ===
|
app.application_sid ===
|
||||||
msTeamsTenant.application_sid
|
msTeamsTenant.application_sid,
|
||||||
)?.name || "None"}
|
)?.name || "None"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -217,5 +218,5 @@ const getAclIMessage: ACLGetIMessage = (currentServiceProvider) => {
|
|||||||
|
|
||||||
export default withAccessControl(
|
export default withAccessControl(
|
||||||
"hasMSTeamsFqdn",
|
"hasMSTeamsFqdn",
|
||||||
getAclIMessage
|
getAclIMessage,
|
||||||
)(MSTeamsTenants);
|
)(MSTeamsTenants);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import type { PhoneNumber } from "src/api/types";
|
|||||||
export const EditPhoneNumber = () => {
|
export const EditPhoneNumber = () => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const [data, refetch, error] = useApiData<PhoneNumber>(
|
const [data, refetch, error] = useApiData<PhoneNumber>(
|
||||||
`PhoneNumbers/${params.phone_number_sid}`
|
`PhoneNumbers/${params.phone_number_sid}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ export const PhoneNumberForm = ({ phoneNumber }: PhoneNumberFormProps) => {
|
|||||||
useRedirect<Account>(
|
useRedirect<Account>(
|
||||||
accounts,
|
accounts,
|
||||||
ROUTE_INTERNAL_ACCOUNTS,
|
ROUTE_INTERNAL_ACCOUNTS,
|
||||||
"You must create an account before you can create a phone number."
|
"You must create an account before you can create a phone number.",
|
||||||
);
|
);
|
||||||
|
|
||||||
useRedirect<Carrier>(
|
useRedirect<Carrier>(
|
||||||
carriers,
|
carriers,
|
||||||
ROUTE_INTERNAL_CARRIERS,
|
ROUTE_INTERNAL_CARRIERS,
|
||||||
"You must create a SIP trunk before you can create a phone number."
|
"You must create a SIP trunk before you can create a phone number.",
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSubmit = (e: React.FormEvent) => {
|
const handleSubmit = (e: React.FormEvent) => {
|
||||||
@@ -69,7 +69,7 @@ export const PhoneNumberForm = ({ phoneNumber }: PhoneNumberFormProps) => {
|
|||||||
const filtered =
|
const filtered =
|
||||||
phoneNumber && phoneNumber.data
|
phoneNumber && phoneNumber.data
|
||||||
? phoneNumbers.filter(
|
? phoneNumbers.filter(
|
||||||
(a) => a.phone_number_sid !== phoneNumber.data!.phone_number_sid
|
(a) => a.phone_number_sid !== phoneNumber.data!.phone_number_sid,
|
||||||
)
|
)
|
||||||
: phoneNumbers;
|
: phoneNumbers;
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ export const PhoneNumberForm = ({ phoneNumber }: PhoneNumberFormProps) => {
|
|||||||
phoneNumber.refetch();
|
phoneNumber.refetch();
|
||||||
toastSuccess("Phone number updated successfully");
|
toastSuccess("Phone number updated successfully");
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_PHONE_NUMBERS}/${phoneNumber.data?.phone_number_sid}/edit`
|
`${ROUTE_INTERNAL_PHONE_NUMBERS}/${phoneNumber.data?.phone_number_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -201,7 +201,7 @@ export const PhoneNumberForm = ({ phoneNumber }: PhoneNumberFormProps) => {
|
|||||||
applications={
|
applications={
|
||||||
applications
|
applications
|
||||||
? applications.filter(
|
? applications.filter(
|
||||||
(application) => application.account_sid === accountSid
|
(application) => application.account_sid === accountSid,
|
||||||
)
|
)
|
||||||
: []
|
: []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,14 +56,14 @@ export const PhoneNumbers = () => {
|
|||||||
setAccountSid(getAccountFilter());
|
setAccountSid(getAccountFilter());
|
||||||
return phoneNumbers
|
return phoneNumbers
|
||||||
? phoneNumbers.filter(
|
? phoneNumbers.filter(
|
||||||
(phn) => !accountSid || phn.account_sid === accountSid
|
(phn) => !accountSid || phn.account_sid === accountSid,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
}, [accountSid, phoneNumbers]);
|
}, [accountSid, phoneNumbers]);
|
||||||
|
|
||||||
const filteredPhoneNumbers = useFilteredResults<PhoneNumber>(
|
const filteredPhoneNumbers = useFilteredResults<PhoneNumber>(
|
||||||
filter,
|
filter,
|
||||||
phoneNumbersFiltered
|
phoneNumbersFiltered,
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleMassEdit = () => {
|
const handleMassEdit = () => {
|
||||||
@@ -74,7 +74,7 @@ export const PhoneNumbers = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return putPhoneNumber(phoneNumber.phone_number_sid, payload);
|
return putPhoneNumber(phoneNumber.phone_number_sid, payload);
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
refetch();
|
refetch();
|
||||||
@@ -98,7 +98,7 @@ export const PhoneNumbers = () => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted phone number <strong>{phoneNumber.number}</strong>
|
Deleted phone number <strong>{phoneNumber.number}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -177,7 +177,7 @@ export const PhoneNumbers = () => {
|
|||||||
application={[applicationSid, setApplicationSid]}
|
application={[applicationSid, setApplicationSid]}
|
||||||
applications={applications?.filter(
|
applications={applications?.filter(
|
||||||
(application) =>
|
(application) =>
|
||||||
application.account_sid === accountSid
|
application.account_sid === accountSid,
|
||||||
)}
|
)}
|
||||||
defaultOption="None"
|
defaultOption="None"
|
||||||
/>
|
/>
|
||||||
@@ -224,7 +224,7 @@ export const PhoneNumbers = () => {
|
|||||||
selectedPhoneNumbers.find(
|
selectedPhoneNumbers.find(
|
||||||
(phone) =>
|
(phone) =>
|
||||||
phone.phone_number_sid ===
|
phone.phone_number_sid ===
|
||||||
phoneNumber.phone_number_sid
|
phoneNumber.phone_number_sid,
|
||||||
)
|
)
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
@@ -240,8 +240,8 @@ export const PhoneNumbers = () => {
|
|||||||
curr.filter(
|
curr.filter(
|
||||||
(phone) =>
|
(phone) =>
|
||||||
phone.phone_number_sid !==
|
phone.phone_number_sid !==
|
||||||
phoneNumber.phone_number_sid
|
phoneNumber.phone_number_sid,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -270,7 +270,8 @@ export const PhoneNumbers = () => {
|
|||||||
{
|
{
|
||||||
accounts?.find(
|
accounts?.find(
|
||||||
(acct) =>
|
(acct) =>
|
||||||
acct.account_sid === phoneNumber.account_sid
|
acct.account_sid ===
|
||||||
|
phoneNumber.account_sid,
|
||||||
)?.name
|
)?.name
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
@@ -287,7 +288,7 @@ export const PhoneNumbers = () => {
|
|||||||
{applications?.find(
|
{applications?.find(
|
||||||
(app) =>
|
(app) =>
|
||||||
app.application_sid ===
|
app.application_sid ===
|
||||||
phoneNumber.application_sid
|
phoneNumber.application_sid,
|
||||||
)?.name || "None"}
|
)?.name || "None"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export const CallTracing = ({ call }: CallTracingProps) => {
|
|||||||
rootGroup.children = buildChildren(
|
rootGroup.children = buildChildren(
|
||||||
rootGroup.level + 1,
|
rootGroup.level + 1,
|
||||||
rootGroup,
|
rootGroup,
|
||||||
groups
|
groups,
|
||||||
);
|
);
|
||||||
setJaegerGroup(rootGroup);
|
setJaegerGroup(rootGroup);
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ export const CallTracing = ({ call }: CallTracingProps) => {
|
|||||||
const buildChildren = (
|
const buildChildren = (
|
||||||
level: number,
|
level: number,
|
||||||
rootGroup: JaegerGroup,
|
rootGroup: JaegerGroup,
|
||||||
groups: JaegerGroup[]
|
groups: JaegerGroup[],
|
||||||
): JaegerGroup[] => {
|
): JaegerGroup[] => {
|
||||||
return getGroupsByParent(rootGroup.spanId, groups).map((group) => {
|
return getGroupsByParent(rootGroup.spanId, groups).map((group) => {
|
||||||
group.level = level;
|
group.level = level;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
const [dtmfValue] = getSpanAttributeByName(s.attributes, "dtmf");
|
const [dtmfValue] = getSpanAttributeByName(s.attributes, "dtmf");
|
||||||
const [durationValue] = getSpanAttributeByName(
|
const [durationValue] = getSpanAttributeByName(
|
||||||
s.attributes,
|
s.attributes,
|
||||||
"duration"
|
"duration",
|
||||||
);
|
);
|
||||||
if (dtmfValue && durationValue) {
|
if (dtmfValue && durationValue) {
|
||||||
const start =
|
const start =
|
||||||
@@ -127,7 +127,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
const getSilenceStartTime = (
|
const getSilenceStartTime = (
|
||||||
start: number,
|
start: number,
|
||||||
end: number,
|
end: number,
|
||||||
channel: number
|
channel: number,
|
||||||
): number => {
|
): number => {
|
||||||
if (waveSurferRef.current) {
|
if (waveSurferRef.current) {
|
||||||
const duration = waveSurferRef.current.getDecodedData()?.duration;
|
const duration = waveSurferRef.current.getDecodedData()?.duration;
|
||||||
@@ -161,7 +161,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
const drawSttRegionForSpan = (
|
const drawSttRegionForSpan = (
|
||||||
s: JaegerSpan,
|
s: JaegerSpan,
|
||||||
startPoint: JaegerSpan,
|
startPoint: JaegerSpan,
|
||||||
channel = 0
|
channel = 0,
|
||||||
) => {
|
) => {
|
||||||
if (waveSurferRegionsPluginRef.current) {
|
if (waveSurferRegionsPluginRef.current) {
|
||||||
const r = waveSurferRegionsPluginRef.current
|
const r = waveSurferRegionsPluginRef.current
|
||||||
@@ -191,7 +191,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
|
|
||||||
const [sttResolve] = getSpanAttributeByName(
|
const [sttResolve] = getSpanAttributeByName(
|
||||||
s.attributes,
|
s.attributes,
|
||||||
"stt.resolve"
|
"stt.resolve",
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
endSpeechTime > 0 &&
|
endSpeechTime > 0 &&
|
||||||
@@ -213,7 +213,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
} else {
|
} else {
|
||||||
const [sttResolve] = getSpanAttributeByName(
|
const [sttResolve] = getSpanAttributeByName(
|
||||||
s.attributes,
|
s.attributes,
|
||||||
"stt.resolve"
|
"stt.resolve",
|
||||||
);
|
);
|
||||||
if (sttResolve && sttResolve.value.stringValue === "timeout") {
|
if (sttResolve && sttResolve.value.stringValue === "timeout") {
|
||||||
att = {
|
att = {
|
||||||
@@ -266,7 +266,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
const [ttsCache] = getSpanAttributeByName(s.attributes, "tts.cached");
|
const [ttsCache] = getSpanAttributeByName(s.attributes, "tts.cached");
|
||||||
const [streamLatency] = getSpanAttributeByName(
|
const [streamLatency] = getSpanAttributeByName(
|
||||||
s.attributes,
|
s.attributes,
|
||||||
"time_to_first_byte_ms"
|
"time_to_first_byte_ms",
|
||||||
);
|
);
|
||||||
if (streamLatency && streamLatency.value.stringValue) {
|
if (streamLatency && streamLatency.value.stringValue) {
|
||||||
end = start + Number(streamLatency.value.stringValue) / 1_000;
|
end = start + Number(streamLatency.value.stringValue) / 1_000;
|
||||||
@@ -320,7 +320,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
});
|
});
|
||||||
const [statusCode] = getSpanAttributeByName(
|
const [statusCode] = getSpanAttributeByName(
|
||||||
s.attributes,
|
s.attributes,
|
||||||
"http.statusCode"
|
"http.statusCode",
|
||||||
);
|
);
|
||||||
changeRegionMouseStyle(latencyRegion, 0);
|
changeRegionMouseStyle(latencyRegion, 0);
|
||||||
latencyRegion.on("click", () => {
|
latencyRegion.on("click", () => {
|
||||||
@@ -363,7 +363,7 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
drawSttRegionForSpan(
|
drawSttRegionForSpan(
|
||||||
cs,
|
cs,
|
||||||
startPoint,
|
startPoint,
|
||||||
channel > 0 ? channel - 1 : channel
|
channel > 0 ? channel - 1 : channel,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// DTMF
|
// DTMF
|
||||||
@@ -383,11 +383,11 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
.filter((s) => {
|
.filter((s) => {
|
||||||
const [httpBody] = getSpanAttributeByName(
|
const [httpBody] = getSpanAttributeByName(
|
||||||
s.attributes,
|
s.attributes,
|
||||||
"http.body"
|
"http.body",
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
httpBody.value.stringValue.includes(
|
httpBody.value.stringValue.includes(
|
||||||
'"reason":"speechDetected"'
|
'"reason":"speechDetected"',
|
||||||
) ||
|
) ||
|
||||||
httpBody.value.stringValue.includes('"reason":"dtmfDetected"')
|
httpBody.value.stringValue.includes('"reason":"dtmfDetected"')
|
||||||
);
|
);
|
||||||
@@ -515,8 +515,8 @@ export const Player = ({ call }: PlayerProps) => {
|
|||||||
idx <= 0
|
idx <= 0
|
||||||
? 0
|
? 0
|
||||||
: idx >= waveSurferRef.current.getDuration()
|
: idx >= waveSurferRef.current.getDuration()
|
||||||
? waveSurferRef.current.getDuration() - 1
|
? waveSurferRef.current.getDuration() - 1
|
||||||
: idx;
|
: idx;
|
||||||
waveSurferRef.current.setTime(value);
|
waveSurferRef.current.setTime(value);
|
||||||
setPlayBackTime(formatTime(value));
|
setPlayBackTime(formatTime(value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ export const getSpansFromJaegerRoot = (trace: JaegerRoot) => {
|
|||||||
!(
|
!(
|
||||||
attr.key.startsWith("telemetry") ||
|
attr.key.startsWith("telemetry") ||
|
||||||
attr.key.startsWith("internal")
|
attr.key.startsWith("internal")
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
value.attributes = attrs;
|
value.attributes = attrs;
|
||||||
spans.push(value);
|
spans.push(value);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
spans.sort((a, b) => a.startTimeUnixNano - b.startTimeUnixNano);
|
spans.sort((a, b) => a.startTimeUnixNano - b.startTimeUnixNano);
|
||||||
@@ -25,14 +25,14 @@ export const getSpansFromJaegerRoot = (trace: JaegerRoot) => {
|
|||||||
|
|
||||||
export const getSpansByName = (
|
export const getSpansByName = (
|
||||||
spans: JaegerSpan[],
|
spans: JaegerSpan[],
|
||||||
name: string
|
name: string,
|
||||||
): JaegerSpan[] => {
|
): JaegerSpan[] => {
|
||||||
return spans.filter((s) => s.name === name);
|
return spans.filter((s) => s.name === name);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSpansByNameRegex = (
|
export const getSpansByNameRegex = (
|
||||||
spans: JaegerSpan[],
|
spans: JaegerSpan[],
|
||||||
pattern: RegExp
|
pattern: RegExp,
|
||||||
): JaegerSpan[] => {
|
): JaegerSpan[] => {
|
||||||
const matcher = new RegExp(pattern);
|
const matcher = new RegExp(pattern);
|
||||||
return spans.filter((s) => matcher.test(s.name));
|
return spans.filter((s) => matcher.test(s.name));
|
||||||
@@ -40,7 +40,7 @@ export const getSpansByNameRegex = (
|
|||||||
|
|
||||||
export const getSpanAttributeByName = (
|
export const getSpanAttributeByName = (
|
||||||
attr: JaegerAttribute[],
|
attr: JaegerAttribute[],
|
||||||
name: string
|
name: string,
|
||||||
): JaegerAttribute[] => {
|
): JaegerAttribute[] => {
|
||||||
return attr.filter((a) => a.key === name);
|
return attr.filter((a) => a.key === name);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export const AdminSettings = () => {
|
|||||||
if (hasValue(passwordSettings)) {
|
if (hasValue(passwordSettings)) {
|
||||||
setRequireDigit(passwordSettings.require_digit > 0 ? true : false);
|
setRequireDigit(passwordSettings.require_digit > 0 ? true : false);
|
||||||
setRequireSpecialCharacter(
|
setRequireSpecialCharacter(
|
||||||
passwordSettings.require_special_character > 0 ? true : false
|
passwordSettings.require_special_character > 0 ? true : false,
|
||||||
);
|
);
|
||||||
if (passwordSettings.min_password_length) {
|
if (passwordSettings.min_password_length) {
|
||||||
setMinPasswordLength(passwordSettings.min_password_length);
|
setMinPasswordLength(passwordSettings.min_password_length);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const Settings = ({ currentServiceProvider }: SettingsProps) => {
|
|||||||
Scope.service_provider,
|
Scope.service_provider,
|
||||||
`${ROUTE_INTERNAL_ACCOUNTS}/${user?.account_sid}/edit`,
|
`${ROUTE_INTERNAL_ACCOUNTS}/${user?.account_sid}/edit`,
|
||||||
user,
|
user,
|
||||||
"You do not have permissions to manage Settings"
|
"You do not have permissions to manage Settings",
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ export const ServiceProviderSettings = ({
|
|||||||
return limit.quantity === ""
|
return limit.quantity === ""
|
||||||
? deleteServiceProviderLimit(
|
? deleteServiceProviderLimit(
|
||||||
currentServiceProvider.service_provider_sid,
|
currentServiceProvider.service_provider_sid,
|
||||||
limit.category
|
limit.category,
|
||||||
)
|
)
|
||||||
: postServiceProviderLimit(
|
: postServiceProviderLimit(
|
||||||
currentServiceProvider.service_provider_sid,
|
currentServiceProvider.service_provider_sid,
|
||||||
limit
|
limit,
|
||||||
);
|
);
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
refetchLimits();
|
refetchLimits();
|
||||||
@@ -93,7 +93,7 @@ export const ServiceProviderSettings = ({
|
|||||||
<>
|
<>
|
||||||
Deleted service provider{" "}
|
Deleted service provider{" "}
|
||||||
<strong>{currentServiceProvider.name}</strong>
|
<strong>{currentServiceProvider.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
removeActiveSP();
|
removeActiveSP();
|
||||||
})
|
})
|
||||||
@@ -193,5 +193,5 @@ export const ServiceProviderSettings = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default withSelectState(["serviceProviders", "currentServiceProvider"])(
|
export default withSelectState(["serviceProviders", "currentServiceProvider"])(
|
||||||
ServiceProviderSettings
|
ServiceProviderSettings,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ export const EditSpeechService = () => {
|
|||||||
ROUTE_INTERNAL_SPEECH,
|
ROUTE_INTERNAL_SPEECH,
|
||||||
user,
|
user,
|
||||||
"You do not have access to this resource",
|
"You do not have access to this resource",
|
||||||
data
|
data,
|
||||||
);
|
);
|
||||||
|
|
||||||
const getUrlForSpeech = () => {
|
const getUrlForSpeech = () => {
|
||||||
if (user && user?.scope === USER_ACCOUNT) {
|
if (user && user?.scope === USER_ACCOUNT) {
|
||||||
setUrl(
|
setUrl(
|
||||||
`Accounts/${user?.account_sid}/SpeechCredentials/${params.speech_credential_sid}`
|
`Accounts/${user?.account_sid}/SpeechCredentials/${params.speech_credential_sid}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setUrl(
|
setUrl(
|
||||||
`ServiceProviders/${currentServiceProvider?.service_provider_sid}/SpeechCredentials/${params.speech_credential_sid}`
|
`ServiceProviders/${currentServiceProvider?.service_provider_sid}/SpeechCredentials/${params.speech_credential_sid}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
const [initialSttCheck, setInitialSttCheck] = useState(false);
|
const [initialSttCheck, setInitialSttCheck] = useState(false);
|
||||||
const [sttCheck, setSttCheck] = useState(false);
|
const [sttCheck, setSttCheck] = useState(false);
|
||||||
const [vendor, setVendor] = useState<Lowercase<Vendor>>(
|
const [vendor, setVendor] = useState<Lowercase<Vendor>>(
|
||||||
"" as Lowercase<Vendor>
|
"" as Lowercase<Vendor>,
|
||||||
);
|
);
|
||||||
const [region, setRegion] = useState("");
|
const [region, setRegion] = useState("");
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
@@ -196,13 +196,13 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
speech_credential_sid: credential.data?.speech_credential_sid,
|
speech_credential_sid: credential.data?.speech_credential_sid,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toastSuccess("Speech credential updated successfully");
|
toastSuccess("Speech credential updated successfully");
|
||||||
credential.refetch();
|
credential.refetch();
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_SPEECH}/${credential?.data?.speech_credential_sid}/edit`
|
`${ROUTE_INTERNAL_SPEECH}/${credential?.data?.speech_credential_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -214,13 +214,13 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
if (v.google_custom_voice_sid) {
|
if (v.google_custom_voice_sid) {
|
||||||
return deleteGoogleCustomVoice(v.google_custom_voice_sid);
|
return deleteGoogleCustomVoice(v.google_custom_voice_sid);
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
toastSuccess("Speech credential updated successfully");
|
toastSuccess("Speech credential updated successfully");
|
||||||
credential.refetch();
|
credential.refetch();
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_SPEECH}/${credential?.data?.speech_credential_sid}/edit`
|
`${ROUTE_INTERNAL_SPEECH}/${credential?.data?.speech_credential_sid}/edit`,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -230,7 +230,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
toastSuccess("Speech credential updated successfully");
|
toastSuccess("Speech credential updated successfully");
|
||||||
credential.refetch();
|
credential.refetch();
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_SPEECH}/${credential.data.speech_credential_sid}/edit`
|
`${ROUTE_INTERNAL_SPEECH}/${credential.data.speech_credential_sid}/edit`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -240,7 +240,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
|
|
||||||
if (isUserAccountScope(accountSid, user)) {
|
if (isUserAccountScope(accountSid, user)) {
|
||||||
toastError(
|
toastError(
|
||||||
"You do not have permissions to make changes to these Speech Credentials"
|
"You do not have permissions to make changes to these Speech Credentials",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
putSpeechService(
|
putSpeechService(
|
||||||
currentServiceProvider.service_provider_sid,
|
currentServiceProvider.service_provider_sid,
|
||||||
credential.data.speech_credential_sid,
|
credential.data.speech_credential_sid,
|
||||||
payload
|
payload,
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (credential && credential.data) {
|
if (credential && credential.data) {
|
||||||
@@ -322,7 +322,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
toastSuccess("Speech credential updated successfully");
|
toastSuccess("Speech credential updated successfully");
|
||||||
credential.refetch();
|
credential.refetch();
|
||||||
navigate(
|
navigate(
|
||||||
`${ROUTE_INTERNAL_SPEECH}/${credential.data.speech_credential_sid}/edit`
|
`${ROUTE_INTERNAL_SPEECH}/${credential.data.speech_credential_sid}/edit`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,8 +358,8 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
postGoogleCustomVoice({
|
postGoogleCustomVoice({
|
||||||
...v,
|
...v,
|
||||||
speech_credential_sid: json.sid,
|
speech_credential_sid: json.sid,
|
||||||
})
|
}),
|
||||||
)
|
),
|
||||||
).then(() => {
|
).then(() => {
|
||||||
toastSuccess("Speech credential created successfully");
|
toastSuccess("Speech credential created successfully");
|
||||||
navigate(ROUTE_INTERNAL_SPEECH);
|
navigate(ROUTE_INTERNAL_SPEECH);
|
||||||
@@ -383,7 +383,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
getSpeechSupportedLanguagesAndVoices(
|
getSpeechSupportedLanguagesAndVoices(
|
||||||
currentServiceProvider?.service_provider_sid,
|
currentServiceProvider?.service_provider_sid,
|
||||||
vendor,
|
vendor,
|
||||||
""
|
"",
|
||||||
).then(({ json }) => {
|
).then(({ json }) => {
|
||||||
if (json.models) {
|
if (json.models) {
|
||||||
setTtsModels(json.models);
|
setTtsModels(json.models);
|
||||||
@@ -520,13 +520,13 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
setInitialCheckCustomStt(isNotBlank(credential.data.custom_stt_endpoint));
|
setInitialCheckCustomStt(isNotBlank(credential.data.custom_stt_endpoint));
|
||||||
setInitialCheckOnpremAzureService(
|
setInitialCheckOnpremAzureService(
|
||||||
isNotBlank(credential.data.custom_tts_endpoint_url) ||
|
isNotBlank(credential.data.custom_tts_endpoint_url) ||
|
||||||
isNotBlank(credential.data.custom_stt_endpoint_url)
|
isNotBlank(credential.data.custom_stt_endpoint_url),
|
||||||
);
|
);
|
||||||
|
|
||||||
setCustomVendorName(
|
setCustomVendorName(
|
||||||
credential.data.vendor.startsWith(VENDOR_CUSTOM)
|
credential.data.vendor.startsWith(VENDOR_CUSTOM)
|
||||||
? credential.data.vendor.substring(VENDOR_CUSTOM.length + 1)
|
? credential.data.vendor.substring(VENDOR_CUSTOM.length + 1)
|
||||||
: credential.data.vendor
|
: credential.data.vendor,
|
||||||
);
|
);
|
||||||
setCustomVendorAuthToken(credential.data.auth_token || "");
|
setCustomVendorAuthToken(credential.data.auth_token || "");
|
||||||
setCustomVendorSttUrl(credential.data.custom_stt_url || "");
|
setCustomVendorSttUrl(credential.data.custom_stt_url || "");
|
||||||
@@ -561,7 +561,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
}
|
}
|
||||||
if (credential?.data?.deepgram_stt_use_tls) {
|
if (credential?.data?.deepgram_stt_use_tls) {
|
||||||
setDeepgramSttUseTls(
|
setDeepgramSttUseTls(
|
||||||
credential?.data?.deepgram_stt_use_tls > 0 ? true : false
|
credential?.data?.deepgram_stt_use_tls > 0 ? true : false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setInitialDeepgramOnpremCheck(hasValue(credential?.data?.deepgram_stt_uri));
|
setInitialDeepgramOnpremCheck(hasValue(credential?.data?.deepgram_stt_uri));
|
||||||
@@ -571,7 +571,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
const updateCustomVoices = (
|
const updateCustomVoices = (
|
||||||
index: number,
|
index: number,
|
||||||
key: string,
|
key: string,
|
||||||
value: typeof customVoices[number][keyof GoogleCustomVoice]
|
value: (typeof customVoices)[number][keyof GoogleCustomVoice],
|
||||||
) => {
|
) => {
|
||||||
setCustomVoices((prev) =>
|
setCustomVoices((prev) =>
|
||||||
prev.map((g, i) =>
|
prev.map((g, i) =>
|
||||||
@@ -580,8 +580,8 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
...g,
|
...g,
|
||||||
[key]: value,
|
[key]: value,
|
||||||
}
|
}
|
||||||
: g
|
: g,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -618,7 +618,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
]
|
]
|
||||||
.concat(vendors)
|
.concat(vendors)
|
||||||
.filter(
|
.filter(
|
||||||
(v) => !DISABLE_CUSTOM_SPEECH || v.value !== VENDOR_CUSTOM
|
(v) => !DISABLE_CUSTOM_SPEECH || v.value !== VENDOR_CUSTOM,
|
||||||
)}
|
)}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setVendor(e.target.value as Lowercase<Vendor>);
|
setVendor(e.target.value as Lowercase<Vendor>);
|
||||||
@@ -828,7 +828,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
{JSON.stringify(
|
{JSON.stringify(
|
||||||
getObscuredGoogleServiceKey(googleServiceKey),
|
getObscuredGoogleServiceKey(googleServiceKey),
|
||||||
null,
|
null,
|
||||||
2
|
2,
|
||||||
)}
|
)}
|
||||||
</code>
|
</code>
|
||||||
</pre>
|
</pre>
|
||||||
@@ -903,7 +903,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
updateCustomVoices(
|
updateCustomVoices(
|
||||||
i,
|
i,
|
||||||
"reported_usage",
|
"reported_usage",
|
||||||
e.target.value
|
e.target.value,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -930,7 +930,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
updateCustomVoices(
|
updateCustomVoices(
|
||||||
i,
|
i,
|
||||||
"model",
|
"model",
|
||||||
e.target.value
|
e.target.value,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -945,19 +945,19 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
setCustomVoicesMessage("");
|
setCustomVoicesMessage("");
|
||||||
if (customVoices.length === 1) {
|
if (customVoices.length === 1) {
|
||||||
setCustomVoicesMessage(
|
setCustomVoicesMessage(
|
||||||
"You must provide at least one custom voice."
|
"You must provide at least one custom voice.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (v.google_custom_voice_sid) {
|
if (v.google_custom_voice_sid) {
|
||||||
deleteGoogleCustomVoice(
|
deleteGoogleCustomVoice(
|
||||||
v.google_custom_voice_sid
|
v.google_custom_voice_sid,
|
||||||
).finally(() => {
|
).finally(() => {
|
||||||
credential?.refetch();
|
credential?.refetch();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setCustomVoices((prev) =>
|
setCustomVoices((prev) =>
|
||||||
prev.filter((_, idx) => idx !== i)
|
prev.filter((_, idx) => idx !== i),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -1196,7 +1196,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
|||||||
setOptions(
|
setOptions(
|
||||||
tmpOptions
|
tmpOptions
|
||||||
? tmpOptions
|
? tmpOptions
|
||||||
: JSON.stringify(DEFAULT_ELEVENLABS_OPTIONS, null, 2)
|
: JSON.stringify(DEFAULT_ELEVENLABS_OPTIONS, null, 2),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!e.target.checked) {
|
if (!e.target.checked) {
|
||||||
|
|||||||
@@ -49,27 +49,27 @@ export const SpeechServices = () => {
|
|||||||
? credentials.filter((credential) =>
|
? credentials.filter((credential) =>
|
||||||
accountSid
|
accountSid
|
||||||
? credential.account_sid === accountSid
|
? credential.account_sid === accountSid
|
||||||
: credential.account_sid === null
|
: credential.account_sid === null,
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
}, [accountSid, accounts, credentials]);
|
}, [accountSid, accounts, credentials]);
|
||||||
|
|
||||||
const filteredCredentials = useFilteredResults<SpeechCredential>(
|
const filteredCredentials = useFilteredResults<SpeechCredential>(
|
||||||
filter,
|
filter,
|
||||||
credentialsFiltered
|
credentialsFiltered,
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
if (credential && currentServiceProvider) {
|
if (credential && currentServiceProvider) {
|
||||||
if (isUserAccountScope(accountSid, user)) {
|
if (isUserAccountScope(accountSid, user)) {
|
||||||
toastError(
|
toastError(
|
||||||
"You do not have permissions to delete these Speech Credentials"
|
"You do not have permissions to delete these Speech Credentials",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
deleteSpeechService(
|
deleteSpeechService(
|
||||||
currentServiceProvider.service_provider_sid,
|
currentServiceProvider.service_provider_sid,
|
||||||
credential.speech_credential_sid
|
credential.speech_credential_sid,
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setCredential(null);
|
setCredential(null);
|
||||||
@@ -81,7 +81,7 @@ export const SpeechServices = () => {
|
|||||||
{credential.vendor}
|
{credential.vendor}
|
||||||
{credential.label ? ` (${credential.label})` : ""}
|
{credential.label ? ` (${credential.label})` : ""}
|
||||||
</strong>{" "}
|
</strong>{" "}
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -97,7 +97,7 @@ export const SpeechServices = () => {
|
|||||||
setApiUrl(`Accounts/${accountSid}/SpeechCredentials`);
|
setApiUrl(`Accounts/${accountSid}/SpeechCredentials`);
|
||||||
} else {
|
} else {
|
||||||
setApiUrl(
|
setApiUrl(
|
||||||
`ServiceProviders/${currentServiceProvider?.service_provider_sid}/SpeechCredentials`
|
`ServiceProviders/${currentServiceProvider?.service_provider_sid}/SpeechCredentials`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [currentServiceProvider, accountSid]);
|
}, [currentServiceProvider, accountSid]);
|
||||||
@@ -149,7 +149,7 @@ export const SpeechServices = () => {
|
|||||||
Vendor:{" "}
|
Vendor:{" "}
|
||||||
{credential.vendor.startsWith(VENDOR_CUSTOM)
|
{credential.vendor.startsWith(VENDOR_CUSTOM)
|
||||||
? credential.vendor.substring(
|
? credential.vendor.substring(
|
||||||
VENDOR_CUSTOM.length + 1
|
VENDOR_CUSTOM.length + 1,
|
||||||
)
|
)
|
||||||
: credential.vendor}
|
: credential.vendor}
|
||||||
</strong>
|
</strong>
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ export const CredentialStatus = ({
|
|||||||
status === CRED_OK
|
status === CRED_OK
|
||||||
? "teal"
|
? "teal"
|
||||||
: status === CRED_NOT_TESTED
|
: status === CRED_NOT_TESTED
|
||||||
? "jean"
|
? "jean"
|
||||||
: "jam"
|
: "jam"
|
||||||
}`}
|
}`}
|
||||||
title={status === CRED_NOT_TESTED ? notTestedTxt : reason}
|
title={status === CRED_NOT_TESTED ? notTestedTxt : reason}
|
||||||
>
|
>
|
||||||
@@ -61,11 +61,11 @@ export const CredentialStatus = ({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (user && user.scope === USER_ACCOUNT) {
|
if (user && user.scope === USER_ACCOUNT) {
|
||||||
setApiUrl(
|
setApiUrl(
|
||||||
`Accounts/${user.account_sid}/SpeechCredentials/${cred.speech_credential_sid}/test`
|
`Accounts/${user.account_sid}/SpeechCredentials/${cred.speech_credential_sid}/test`,
|
||||||
);
|
);
|
||||||
} else if (currentServiceProvider) {
|
} else if (currentServiceProvider) {
|
||||||
setApiUrl(
|
setApiUrl(
|
||||||
`ServiceProviders/${currentServiceProvider.service_provider_sid}/SpeechCredentials/${cred.speech_credential_sid}/test`
|
`ServiceProviders/${currentServiceProvider.service_provider_sid}/SpeechCredentials/${cred.speech_credential_sid}/test`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [user, cred, currentServiceProvider]);
|
}, [user, cred, currentServiceProvider]);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export const getObscuredGoogleServiceKey = (key: GoogleServiceKey) => {
|
|||||||
return {
|
return {
|
||||||
...key,
|
...key,
|
||||||
private_key: `${keyHeader}${getObscuredSecret(
|
private_key: `${keyHeader}${getObscuredSecret(
|
||||||
key.private_key.slice(keyHeader.length, key.private_key.length)
|
key.private_key.slice(keyHeader.length, key.private_key.length),
|
||||||
)}`,
|
)}`,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -23,15 +23,15 @@ export const getUsage = (cred: SpeechCredential) => {
|
|||||||
return cred.use_for_tts && cred.use_for_stt
|
return cred.use_for_tts && cred.use_for_stt
|
||||||
? "TTS/STT"
|
? "TTS/STT"
|
||||||
: cred.use_for_tts
|
: cred.use_for_tts
|
||||||
? "TTS"
|
? "TTS"
|
||||||
: cred.use_for_stt
|
: cred.use_for_stt
|
||||||
? "STT"
|
? "STT"
|
||||||
: "Not in use";
|
: "Not in use";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getStatus = (
|
export const getStatus = (
|
||||||
cred: SpeechCredential,
|
cred: SpeechCredential,
|
||||||
testResult: CredentialTestResult
|
testResult: CredentialTestResult,
|
||||||
): CredentialStatus => {
|
): CredentialStatus => {
|
||||||
if (
|
if (
|
||||||
(cred.use_for_tts &&
|
(cred.use_for_tts &&
|
||||||
@@ -60,7 +60,7 @@ export const getStatus = (
|
|||||||
|
|
||||||
export const getReason = (
|
export const getReason = (
|
||||||
cred: SpeechCredential,
|
cred: SpeechCredential,
|
||||||
testResult: CredentialTestResult
|
testResult: CredentialTestResult,
|
||||||
) => {
|
) => {
|
||||||
const ok = "Connection test successful";
|
const ok = "Connection test successful";
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export const UserForm = ({ user }: UserFormProps) => {
|
|||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [initialPassword, setInitialPassword] = useState("");
|
const [initialPassword, setInitialPassword] = useState("");
|
||||||
const [scope, setScope] = useState<UserScopes | null>(
|
const [scope, setScope] = useState<UserScopes | null>(
|
||||||
currentUser?.scope || null
|
currentUser?.scope || null,
|
||||||
);
|
);
|
||||||
const [isActive, setIsActive] = useState(true);
|
const [isActive, setIsActive] = useState(true);
|
||||||
const [forceChange, setForceChange] = useState(true);
|
const [forceChange, setForceChange] = useState(true);
|
||||||
@@ -80,7 +80,7 @@ export const UserForm = ({ user }: UserFormProps) => {
|
|||||||
toastSuccess(
|
toastSuccess(
|
||||||
<>
|
<>
|
||||||
Deleted user <strong>{user?.data?.name}</strong>
|
Deleted user <strong>{user?.data?.name}</strong>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
handleSelfDetete();
|
handleSelfDetete();
|
||||||
})
|
})
|
||||||
@@ -202,7 +202,8 @@ export const UserForm = ({ user }: UserFormProps) => {
|
|||||||
options={
|
options={
|
||||||
currentUser?.scope === USER_SP
|
currentUser?.scope === USER_SP
|
||||||
? USER_SCOPE_SELECTION.filter(
|
? USER_SCOPE_SELECTION.filter(
|
||||||
(opt) => opt.value !== USER_ADMIN && opt.value !== "all"
|
(opt) =>
|
||||||
|
opt.value !== USER_ADMIN && opt.value !== "all",
|
||||||
)
|
)
|
||||||
: USER_SCOPE_SELECTION.filter((e) => e.value !== "all")
|
: USER_SCOPE_SELECTION.filter((e) => e.value !== "all")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const Users = () => {
|
|||||||
|
|
||||||
if (scopeFilter !== "all" && accountSid) {
|
if (scopeFilter !== "all" && accountSid) {
|
||||||
return serviceProviderUsers?.filter(
|
return serviceProviderUsers?.filter(
|
||||||
(e) => e.scope === scopeFilter && accountSid === e.account_sid
|
(e) => e.scope === scopeFilter && accountSid === e.account_sid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ export const Users = () => {
|
|||||||
}, [accountSid, scopeFilter, users, accounts, currentServiceProvider]);
|
}, [accountSid, scopeFilter, users, accounts, currentServiceProvider]);
|
||||||
|
|
||||||
const filteredUsers = useFilteredResults<User>(filter, usersFiltered)?.sort(
|
const filteredUsers = useFilteredResults<User>(filter, usersFiltered)?.sort(
|
||||||
sortUsersAlpha
|
sortUsersAlpha,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -137,8 +137,8 @@ export const Users = () => {
|
|||||||
{user.scope === USER_ADMIN
|
{user.scope === USER_ADMIN
|
||||||
? "All"
|
? "All"
|
||||||
: user.account_name
|
: user.account_name
|
||||||
? `Account: ${user.account_name}`
|
? `Account: ${user.account_name}`
|
||||||
: `Service Provider: ${user.service_provider_name}`}
|
: `Service Provider: ${user.service_provider_name}`}
|
||||||
</div>
|
</div>
|
||||||
<div className="item__actions">
|
<div className="item__actions">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ export const CreatePassword = () => {
|
|||||||
<li>Contain at least one special character</li>
|
<li>Contain at least one special character</li>
|
||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</>
|
</>,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ export const CreatePassword = () => {
|
|||||||
navigate(
|
navigate(
|
||||||
userData.scope !== USER_ACCOUNT
|
userData.scope !== USER_ACCOUNT
|
||||||
? ROUTE_INTERNAL_ACCOUNTS
|
? ROUTE_INTERNAL_ACCOUNTS
|
||||||
: ROUTE_INTERNAL_APPLICATIONS
|
: ROUTE_INTERNAL_APPLICATIONS,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setMessage(MSG_SOMETHING_WRONG);
|
setMessage(MSG_SOMETHING_WRONG);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const ForgotPassword = () => {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status === StatusCodes.NO_CONTENT) {
|
if (response.status === StatusCodes.NO_CONTENT) {
|
||||||
toastSuccess(
|
toastSuccess(
|
||||||
"A password reset email has been sent to your email. Please check your inbox (and, possibly, spam folder) and follow the instructions to reset your password."
|
"A password reset email has been sent to your email. Please check your inbox (and, possibly, spam folder) and follow the instructions to reset your password.",
|
||||||
);
|
);
|
||||||
navigate(ROUTE_LOGIN);
|
navigate(ROUTE_LOGIN);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const ResetPassword = () => {
|
|||||||
setMessage("");
|
setMessage("");
|
||||||
if (newPassword !== confirmNewPassword) {
|
if (newPassword !== confirmNewPassword) {
|
||||||
setMessage(
|
setMessage(
|
||||||
"The confirmation password does not match the new password. Please ensure both passwords are identical."
|
"The confirmation password does not match the new password. Please ensure both passwords are identical.",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ export const RegisterChooseSubdomain = () => {
|
|||||||
getAvailability(`${name}.${rootDomain}`)
|
getAvailability(`${name}.${rootDomain}`)
|
||||||
.then(({ json }) =>
|
.then(({ json }) =>
|
||||||
setIsValidDomain(
|
setIsValidDomain(
|
||||||
Boolean(json.available) && hasValue(name) && name.length != 0
|
Boolean(json.available) && hasValue(name) && name.length != 0,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setErrorMessage(error.msg);
|
setErrorMessage(error.msg);
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ createRoot(root).render(
|
|||||||
</AuthProvider>
|
</AuthProvider>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</StateProvider>
|
</StateProvider>
|
||||||
</React.StrictMode>
|
</React.StrictMode>,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export const parseJwt = (token: string) => {
|
|||||||
.map((c) => {
|
.map((c) => {
|
||||||
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
||||||
})
|
})
|
||||||
.join("")
|
.join(""),
|
||||||
);
|
);
|
||||||
|
|
||||||
return JSON.parse(jsonPayload);
|
return JSON.parse(jsonPayload);
|
||||||
@@ -117,7 +117,7 @@ export const useProvideAuth = (): AuthStateContext => {
|
|||||||
navigate(
|
navigate(
|
||||||
userData.scope !== USER_ACCOUNT
|
userData.scope !== USER_ACCOUNT
|
||||||
? ROUTE_INTERNAL_ACCOUNTS
|
? ROUTE_INTERNAL_ACCOUNTS
|
||||||
: `${ROUTE_INTERNAL_ACCOUNTS}/${userData.account_sid}/edit`
|
: `${ROUTE_INTERNAL_ACCOUNTS}/${userData.account_sid}/edit`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -132,7 +132,7 @@ export const useProvideAuth = (): AuthStateContext => {
|
|||||||
navigate(
|
navigate(
|
||||||
userData.scope !== USER_ACCOUNT
|
userData.scope !== USER_ACCOUNT
|
||||||
? ROUTE_INTERNAL_ACCOUNTS
|
? ROUTE_INTERNAL_ACCOUNTS
|
||||||
: `${ROUTE_INTERNAL_ACCOUNTS}/${userData.account_sid}/edit`
|
: `${ROUTE_INTERNAL_ACCOUNTS}/${userData.account_sid}/edit`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const genericAction = (state: State, action: Action<keyof State>) => {
|
|||||||
|
|
||||||
export const serviceProvidersAction = (
|
export const serviceProvidersAction = (
|
||||||
state: State,
|
state: State,
|
||||||
action: Action<keyof State>
|
action: Action<keyof State>,
|
||||||
) => {
|
) => {
|
||||||
// Sorts for consistent list view
|
// Sorts for consistent list view
|
||||||
action.payload = (<ServiceProvider[]>action.payload).sort(sortLocaleName);
|
action.payload = (<ServiceProvider[]>action.payload).sort(sortLocaleName);
|
||||||
@@ -33,7 +33,7 @@ export const serviceProvidersAction = (
|
|||||||
const serviceProvider = action.payload.find(
|
const serviceProvider = action.payload.find(
|
||||||
(sp: ServiceProvider) =>
|
(sp: ServiceProvider) =>
|
||||||
sp.service_provider_sid ===
|
sp.service_provider_sid ===
|
||||||
state.currentServiceProvider?.service_provider_sid
|
state.currentServiceProvider?.service_provider_sid,
|
||||||
);
|
);
|
||||||
// The `serviceProvider` will be undefined if this is after a DELETE
|
// The `serviceProvider` will be undefined if this is after a DELETE
|
||||||
// For this case we want to just reset to the first provider in the list
|
// For this case we want to just reset to the first provider in the list
|
||||||
@@ -51,7 +51,7 @@ export const serviceProvidersAction = (
|
|||||||
|
|
||||||
export const currentServiceProviderAction = (
|
export const currentServiceProviderAction = (
|
||||||
state: State,
|
state: State,
|
||||||
action: Action<keyof State>
|
action: Action<keyof State>,
|
||||||
) => {
|
) => {
|
||||||
// Set MS Teams Tenants ACL condition
|
// Set MS Teams Tenants ACL condition
|
||||||
state.accessControl.hasMSTeamsFqdn = (<ServiceProvider>action.payload)
|
state.accessControl.hasMSTeamsFqdn = (<ServiceProvider>action.payload)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const storeLocation = "location";
|
|||||||
export const setLocation = () => {
|
export const setLocation = () => {
|
||||||
return localStorage.setItem(
|
return localStorage.setItem(
|
||||||
storeLocation,
|
storeLocation,
|
||||||
window.location.pathname.split("/")[2]
|
window.location.pathname.split("/")[2],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ import type { UserData } from "src/store/types";
|
|||||||
import { getQueryFilter } from "src/store/localStore";
|
import { getQueryFilter } from "src/store/localStore";
|
||||||
|
|
||||||
export const hasValue = <Type>(
|
export const hasValue = <Type>(
|
||||||
variable: Type | null | undefined
|
variable: Type | null | undefined,
|
||||||
): variable is NonNullable<Type> => {
|
): variable is NonNullable<Type> => {
|
||||||
return variable !== null && variable !== undefined;
|
return variable !== null && variable !== undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const hasLength = <Type>(
|
export const hasLength = <Type>(
|
||||||
variable: Type[] | null | undefined,
|
variable: Type[] | null | undefined,
|
||||||
minlength = 0
|
minlength = 0,
|
||||||
): variable is NonNullable<Type[]> => {
|
): variable is NonNullable<Type[]> => {
|
||||||
return hasValue(variable) && variable.length > minlength;
|
return hasValue(variable) && variable.length > minlength;
|
||||||
};
|
};
|
||||||
@@ -52,7 +52,7 @@ export const isObject = (obj: unknown) => {
|
|||||||
|
|
||||||
export const isValidPasswd = (
|
export const isValidPasswd = (
|
||||||
password: string,
|
password: string,
|
||||||
passwordSettings: PasswordSettings
|
passwordSettings: PasswordSettings,
|
||||||
) => {
|
) => {
|
||||||
if (passwordSettings) {
|
if (passwordSettings) {
|
||||||
return (
|
return (
|
||||||
@@ -78,14 +78,14 @@ export const isValidPort = (port: number) => {
|
|||||||
export const getIpValidationType = (ipv4: string): IpType => {
|
export const getIpValidationType = (ipv4: string): IpType => {
|
||||||
const type =
|
const type =
|
||||||
/^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])$/.test(
|
/^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])$/.test(
|
||||||
ipv4.trim()
|
ipv4.trim(),
|
||||||
)
|
)
|
||||||
? IP
|
? IP
|
||||||
: /^([a-zA-Z0-9][^.]*)(\.[^.]+){2,}$/.test(ipv4.trim())
|
: /^([a-zA-Z0-9][^.]*)(\.[^.]+){2,}$/.test(ipv4.trim())
|
||||||
? FQDN
|
? FQDN
|
||||||
: /^([a-zA-Z][^.]*)(\.[^.]+)$/.test(ipv4.trim())
|
: /^([a-zA-Z][^.]*)(\.[^.]+)$/.test(ipv4.trim())
|
||||||
? FQDN_TOP_LEVEL
|
? FQDN_TOP_LEVEL
|
||||||
: INVALID;
|
: INVALID;
|
||||||
return type;
|
return type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,16 +114,16 @@ export const getHumanDateTime = (date: string, fallbackText = "Never used") => {
|
|||||||
currDate.setHours(0, 0, 0, 0);
|
currDate.setHours(0, 0, 0, 0);
|
||||||
argDate.setHours(0, 0, 0, 0);
|
argDate.setHours(0, 0, 0, 0);
|
||||||
const daysDiff = Math.round(
|
const daysDiff = Math.round(
|
||||||
(currDate.getTime() - argDate.getTime()) / 1000 / 60 / 60 / 24
|
(currDate.getTime() - argDate.getTime()) / 1000 / 60 / 60 / 24,
|
||||||
);
|
);
|
||||||
|
|
||||||
return daysDiff > 1
|
return daysDiff > 1
|
||||||
? `${daysDiff} days ago`
|
? `${daysDiff} days ago`
|
||||||
: daysDiff === 1
|
: daysDiff === 1
|
||||||
? "Yesterday"
|
? "Yesterday"
|
||||||
: daysDiff === 0
|
: daysDiff === 0
|
||||||
? "Today"
|
? "Today"
|
||||||
: fallbackText;
|
: fallbackText;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formatPhoneNumber = (number: string) => {
|
export const formatPhoneNumber = (number: string) => {
|
||||||
@@ -150,7 +150,7 @@ export const formatTime = (seconds: number) => {
|
|||||||
|
|
||||||
export const sortLocaleName = (
|
export const sortLocaleName = (
|
||||||
a: Required<{ name: string }>,
|
a: Required<{ name: string }>,
|
||||||
b: Required<{ name: string }>
|
b: Required<{ name: string }>,
|
||||||
) => a.name.localeCompare(b.name);
|
) => a.name.localeCompare(b.name);
|
||||||
|
|
||||||
export const getUserScope = (user: User): UserScopes => {
|
export const getUserScope = (user: User): UserScopes => {
|
||||||
@@ -172,7 +172,7 @@ export const isUserAccountScope = (accountSid: string, user?: UserData) => {
|
|||||||
|
|
||||||
export const checkSelectOptions = (
|
export const checkSelectOptions = (
|
||||||
user?: UserData,
|
user?: UserData,
|
||||||
resource?: SpeechCredential | Carrier
|
resource?: SpeechCredential | Carrier,
|
||||||
) => {
|
) => {
|
||||||
if (user?.scope === USER_ACCOUNT) {
|
if (user?.scope === USER_ACCOUNT) {
|
||||||
if (!resource) {
|
if (!resource) {
|
||||||
@@ -203,7 +203,7 @@ export const sortUsersAlpha = (a: User, b: User) => {
|
|||||||
|
|
||||||
export const filterScopeOptions = (
|
export const filterScopeOptions = (
|
||||||
optionArray: SelectorOptions[],
|
optionArray: SelectorOptions[],
|
||||||
user: UserData
|
user: UserData,
|
||||||
) => {
|
) => {
|
||||||
if (user.scope === USER_SP) {
|
if (user.scope === USER_SP) {
|
||||||
return optionArray.filter((option) => option.value !== USER_ADMIN);
|
return optionArray.filter((option) => option.value !== USER_ADMIN);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const fuzzyMatch = (patterns: string[], items: string[]) => {
|
|||||||
|
|
||||||
export const useFilteredResults = <Type>(
|
export const useFilteredResults = <Type>(
|
||||||
rawFilter: string,
|
rawFilter: string,
|
||||||
rawCollection: Type[] | undefined
|
rawCollection: Type[] | undefined,
|
||||||
) => {
|
) => {
|
||||||
const splitFilter = useMemo(() => rawFilter.split(" "), [rawFilter]);
|
const splitFilter = useMemo(() => rawFilter.split(" "), [rawFilter]);
|
||||||
const filteredCollection = useMemo(() => {
|
const filteredCollection = useMemo(() => {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const useMobileMedia = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const mql = window.matchMedia(
|
const mql = window.matchMedia(
|
||||||
`(max-width: ${getCssVar("--mobile-media")})`
|
`(max-width: ${getCssVar("--mobile-media")})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
mql.addEventListener("change", handleMedia);
|
mql.addEventListener("change", handleMedia);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import type { IMessage } from "src/store/types";
|
|||||||
export const useRedirect = <Type>(
|
export const useRedirect = <Type>(
|
||||||
collection: Type[] | undefined,
|
collection: Type[] | undefined,
|
||||||
redirect: string,
|
redirect: string,
|
||||||
message: IMessage
|
message: IMessage,
|
||||||
) => {
|
) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const useScopedRedirect = (
|
|||||||
redirect: string,
|
redirect: string,
|
||||||
user?: UserData,
|
user?: UserData,
|
||||||
message?: IMessage,
|
message?: IMessage,
|
||||||
data?: Account | User | Application | Carrier | SpeechCredential
|
data?: Account | User | Application | Carrier | SpeechCredential,
|
||||||
) => {
|
) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const currentServiceProvider = useSelectState("currentServiceProvider");
|
const currentServiceProvider = useSelectState("currentServiceProvider");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export interface ACLGetIMessage {
|
|||||||
|
|
||||||
export const withAccessControl = (
|
export const withAccessControl = (
|
||||||
acl: keyof ACL,
|
acl: keyof ACL,
|
||||||
getMessage: ACLGetIMessage
|
getMessage: ACLGetIMessage,
|
||||||
) => {
|
) => {
|
||||||
return function WithAccessControl(Component: React.ComponentType) {
|
return function WithAccessControl(Component: React.ComponentType) {
|
||||||
return function ComponentWithAccessControl(props: PassthroughProps) {
|
return function ComponentWithAccessControl(props: PassthroughProps) {
|
||||||
|
|||||||
2
src/vendor/index.tsx
vendored
2
src/vendor/index.tsx
vendored
@@ -103,7 +103,7 @@ export const useRegionVendors = () => {
|
|||||||
ibm: ibmRegions,
|
ibm: ibmRegions,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return function cleanup() {
|
return function cleanup() {
|
||||||
|
|||||||
Reference in New Issue
Block a user