123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- import type {FocusTrap} from 'focus-trap';
- import type exportGlobals from 'sentry/bootstrap/exportGlobals';
- import {Theme} from 'sentry/utils/theme';
- import type {User} from './user';
- export enum SentryInitRenderReactComponent {
- INDICATORS = 'Indicators',
- SETUP_WIZARD = 'SetupWizard',
- SYSTEM_ALERTS = 'SystemAlerts',
- U2F_SIGN = 'U2fSign',
- SU_ACCESS_FORM = 'SuperuserAccessForm',
- }
- export type OnSentryInitConfiguration =
- | {
- element: string;
- input: string;
- name: 'passwordStrength';
- }
- | {
- component: SentryInitRenderReactComponent;
- container: string;
- name: 'renderReact';
- props?: Record<string, any>;
- }
- | {
- name: 'onReady';
- onReady: (globals: typeof exportGlobals) => void;
- };
- declare global {
- interface Window {
- /**
- * Primary entrypoint for rendering the sentry app. This is typically
- * called in the django templates, or in the case of the EXPERIMENTAL_SPA,
- * after config hydration.
- */
- SentryRenderApp: () => void;
- /**
- * Used to close tooltips for testing purposes.
- */
- __closeAllTooltips: () => void;
- /**
- * The config object provided by the backend.
- */
- __initialData: Config;
- /**
- * This allows our server-rendered templates to push configuration that should be
- * run after we render our main application.
- *
- * An example of this is dynamically importing the `passwordStrength` module only
- * on the organization login page.
- */
- __onSentryInit:
- | OnSentryInitConfiguration[]
- | {
- push: (config: OnSentryInitConfiguration) => void;
- };
- /**
- * Used to open tooltips for testing purposes.
- */
- __openAllTooltips: () => void;
- /**
- * Pipeline
- */
- __pipelineInitialData: PipelineInitialData;
- /**
- * Assets public location
- */
- __sentryGlobalStaticPrefix: string;
- /**
- * This is used for testing purposes as an interem while we translate tests
- * to React Testing Library.
- *
- * See the useLegacyStore hook for more unformation about this.
- */
- _legacyStoreHookUpdate: (update: () => void) => void;
- // typing currently used for demo add on
- // TODO: improve typing
- SentryApp?: {
- ConfigStore: any;
- HookStore: any;
- Modal: any;
- getModalPortal: () => HTMLElement;
- modalFocusTrap?: {
- current?: FocusTrap;
- };
- };
- /**
- * Sentrys version string
- */
- __SENTRY__VERSION?: string;
- /**
- * Set to true if adblock could be installed.
- * See sentry/js/ads.js for how this global is disabled.
- */
- adblockSuspected?: boolean;
- /**
- * The CSRF cookie ised on the backend
- */
- csrfCookieName?: string;
- sentryEmbedCallback?: ((embed: any) => void) | null;
- }
- }
- export interface Config {
- apmSampling: number;
- csrfCookieName: string;
- demoMode: boolean;
- distPrefix: string;
- dsn: string;
- enableAnalytics: boolean;
- features: Set<string>;
- gravatarBaseUrl: string;
- invitesEnabled: boolean;
- isAuthenticated: boolean;
- // Maintain isOnPremise key for backcompat (plugins?).
- isOnPremise: boolean;
- isSelfHosted: boolean;
- languageCode: string;
- lastOrganization: string | null;
- /**
- * This comes from django (django.contrib.messages)
- */
- messages: {level: keyof Theme['alert']; message: string}[];
- needsUpgrade: boolean;
- organizationUrl: string | undefined;
- privacyUrl: string | null;
- sentryConfig: {
- dsn: string;
- release: string;
- whitelistUrls: string[];
- };
- sentryUrl: string;
- singleOrganization: boolean;
- supportEmail: string;
- termsUrl: string | null;
- theme: 'light' | 'dark';
- urlPrefix: string;
- user: User;
- userIdentity: {
- email: string;
- id: string;
- ip_address: string;
- isStaff: boolean;
- };
- validateSUForm: boolean;
- version: {
- build: string;
- current: string;
- latest: string;
- upgradeAvailable: boolean;
- };
- statuspage?: {
- api_host: string;
- id: string;
- };
- }
- export type PipelineInitialData = {
- name: string;
- props: Record<string, any>;
- };
- export type Broadcast = {
- cta: string;
- dateCreated: string;
- dateExpires: string;
- hasSeen: boolean;
- id: string;
- isActive: boolean;
- link: string;
- message: string;
- title: string;
- };
- export type SentryServiceIncident = {
- affectedComponents: Array<{
- name: string;
- status: 'degraded_performance' | 'partial_outage' | 'major_outage' | 'operational';
- updatedAt: string;
- }>;
- createdAt: string;
- id: string;
- name: string;
- status: string;
- updates: Array<{
- body: string;
- status: string;
- updatedAt: string;
- }>;
- url: string;
- };
- export type SentryServiceStatus = {
- incidents: SentryServiceIncident[];
- indicator: 'major' | 'minor' | 'none';
- url: string;
- };
- export type PromptActivity = {
- dismissedTime?: number;
- snoozedTime?: number;
- };
|