2021-07-23 20:03:52 +02:00
|
|
|
import { Observable } from "rxjs";
|
|
|
|
|
|
|
|
export type Urls = {
|
|
|
|
base?: string;
|
|
|
|
webVault?: string;
|
|
|
|
api?: string;
|
|
|
|
identity?: string;
|
|
|
|
icons?: string;
|
|
|
|
notifications?: string;
|
|
|
|
events?: string;
|
2021-11-09 17:01:22 +01:00
|
|
|
keyConnector?: string;
|
2022-07-15 15:35:30 +02:00
|
|
|
scim?: string;
|
2021-07-23 20:03:52 +02:00
|
|
|
};
|
|
|
|
|
2021-09-08 21:34:23 +02:00
|
|
|
export type PayPalConfig = {
|
|
|
|
businessId?: string;
|
|
|
|
buttonAction?: string;
|
|
|
|
};
|
|
|
|
|
2023-06-16 15:09:16 +02:00
|
|
|
export enum Region {
|
|
|
|
US = "US",
|
|
|
|
EU = "EU",
|
|
|
|
SelfHosted = "Self-hosted",
|
|
|
|
}
|
|
|
|
|
2023-06-30 17:50:00 +02:00
|
|
|
export enum RegionDomain {
|
|
|
|
US = "bitwarden.com",
|
|
|
|
EU = "bitwarden.eu",
|
|
|
|
USQA = "bitwarden.pw",
|
|
|
|
}
|
|
|
|
|
2018-01-23 23:29:15 +01:00
|
|
|
export abstract class EnvironmentService {
|
2023-06-14 14:10:39 +02:00
|
|
|
urls: Observable<void>;
|
2023-06-16 15:09:16 +02:00
|
|
|
usUrls: Urls;
|
|
|
|
euUrls: Urls;
|
|
|
|
selectedRegion?: Region;
|
2023-06-20 21:44:46 +02:00
|
|
|
initialized = true;
|
2018-01-10 02:20:54 +01:00
|
|
|
|
2021-07-23 20:03:52 +02:00
|
|
|
hasBaseUrl: () => boolean;
|
|
|
|
getNotificationsUrl: () => string;
|
2018-06-25 14:06:19 +02:00
|
|
|
getWebVaultUrl: () => string;
|
2023-07-03 22:43:22 +02:00
|
|
|
/**
|
|
|
|
* Retrieves the URL of the cloud web vault app.
|
|
|
|
*
|
|
|
|
* @returns {string} The URL of the cloud web vault app.
|
|
|
|
* @remarks Use this method only in views exclusive to self-host instances.
|
|
|
|
*/
|
|
|
|
getCloudWebVaultUrl: () => string;
|
|
|
|
/**
|
|
|
|
* Sets the URL of the cloud web vault app based on the region parameter.
|
|
|
|
*
|
|
|
|
* @param {Region} region - The region of the cloud web vault app.
|
|
|
|
*/
|
|
|
|
setCloudWebVaultUrl: (region: Region) => void;
|
2021-07-23 20:03:52 +02:00
|
|
|
getSendUrl: () => string;
|
|
|
|
getIconsUrl: () => string;
|
|
|
|
getApiUrl: () => string;
|
|
|
|
getIdentityUrl: () => string;
|
|
|
|
getEventsUrl: () => string;
|
2021-11-09 17:01:22 +01:00
|
|
|
getKeyConnectorUrl: () => string;
|
2022-07-15 15:35:30 +02:00
|
|
|
getScimUrl: () => string;
|
2018-01-24 15:27:08 +01:00
|
|
|
setUrlsFromStorage: () => Promise<void>;
|
2022-01-28 14:15:02 +01:00
|
|
|
setUrls: (urls: Urls) => Promise<Urls>;
|
2023-06-16 15:09:16 +02:00
|
|
|
setRegion: (region: Region) => Promise<void>;
|
2021-07-23 20:03:52 +02:00
|
|
|
getUrls: () => Urls;
|
2022-09-08 14:27:19 +02:00
|
|
|
isCloud: () => boolean;
|
2023-06-16 15:09:16 +02:00
|
|
|
isEmpty: () => boolean;
|
2018-01-10 02:20:54 +01:00
|
|
|
}
|