---
title: "@supertokens-plugins/tenant-discovery-react"
description: "Public root exports for @supertokens-plugins/tenant-discovery-react 0.1.0."
---

**Package version:** `0.1.0`

Generated from the packed release's root declaration, `./dist/index.d.ts`. Only exports reachable from that root are
listed. See the [immutable release source](https://github.com/supertokens/supertokens-plugins/blob/8cc15ce39767b9c82604ab8ee8979080af3a86c4/packages/tenant-discovery-react/src/index.ts).

:::caution
This release's declaration graph imports unpublished workspace modules (`@shared/js`, `@shared/react`). The generator detected these imports from the packed declaration graph and strict compiler diagnostics. This upstream packaging defect cannot be fixed by the reference generator; do not enable `skipLibCheck` to hide it.
:::

## Public root exports

| Export | Kind |
| --- | --- |
| `default` | Constant |
| `init` | Constant |
| `PLUGIN_ID` | Constant |
| `usePluginContext` | Constant |

## `default`

Published from the emitted `_default` declaration.

Root export:

```ts check=false reason="Generated API signature"
export default _default;
```

Resolved declaration:

```ts check=false reason="Generated API signature"
declare const _default: {
    init: (config?: (import('./types').SuperTokensPluginTenantDiscoveryPluginConfig & {
        override?: ((oI: import('@shared/js').OverridableFunctions<import('./types').OverrideableTenantFunctionImplementation>) => import('@shared/js').OverridableFunctions<import('./types').OverrideableTenantFunctionImplementation>) | undefined;
    }) | undefined) => import('supertokens-auth-react').SuperTokensPlugin;
};
```

## `init`

Root export:

```ts check=false reason="Generated API signature"
import { init, usePluginContext } from './plugin';
import { PLUGIN_ID } from './constants';
export { init, PLUGIN_ID, usePluginContext };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
import { OverrideableTenantFunctionImplementation, SuperTokensPluginTenantDiscoveryPluginConfig, SuperTokensPluginTenantDiscoveryPluginNormalisedConfig, TranslationKeys } from './types';
import { SuperTokensPlugin, SuperTokensPublicConfig, SuperTokensPublicPlugin } from 'supertokens-auth-react';
export declare const init: (config?: (SuperTokensPluginTenantDiscoveryPluginConfig & {
    override?: ((oI: import('@shared/js').OverridableFunctions<OverrideableTenantFunctionImplementation>) => import('@shared/js').OverridableFunctions<OverrideableTenantFunctionImplementation>) | undefined;
}) | undefined) => SuperTokensPlugin;
```

## `PLUGIN_ID`

Root export:

```ts check=false reason="Generated API signature"
import { init, usePluginContext } from './plugin';
import { PLUGIN_ID } from './constants';
export { init, PLUGIN_ID, usePluginContext };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
export declare const PLUGIN_ID = "supertokens-plugin-tenant-discovery";
```

## `usePluginContext`

Root export:

```ts check=false reason="Generated API signature"
import { init, usePluginContext } from './plugin';
import { PLUGIN_ID } from './constants';
export { init, PLUGIN_ID, usePluginContext };
```

Resolved declaration:

```ts check=false reason="Generated API signature"
import { SuperTokensPlugin, SuperTokensPublicConfig, SuperTokensPublicPlugin } from 'supertokens-auth-react';
import { OverrideableTenantFunctionImplementation, SuperTokensPluginTenantDiscoveryPluginConfig, SuperTokensPluginTenantDiscoveryPluginNormalisedConfig, TranslationKeys } from './types';
import { getQuerier } from '@shared/react';
import { getApi } from './api';
declare const usePluginContext: () => {
    plugins: SuperTokensPublicPlugin[];
    sdkVersion: string;
    appConfig: SuperTokensPublicConfig;
    pluginConfig: SuperTokensPluginTenantDiscoveryPluginNormalisedConfig;
    querier: ReturnType<typeof getQuerier>;
    api: ReturnType<typeof getApi>;
    t: (key: TranslationKeys) => string;
    functions: OverrideableTenantFunctionImplementation;
};
```

## Required signature types

These declarations are not additional package-root exports. They are included because the public signatures above depend on them.

### `defaultTranslationsTenantDiscovery`

```ts check=false reason="Generated API signature"
export declare const defaultTranslationsTenantDiscovery: {
    readonly en: {
        readonly PL_TD_EMAIL_DISCOVERY_CONTINUE_BUTTON: "CONTINUE";
        readonly PL_TD_LOADING: "Loading...";
        readonly PL_TD_SELECT_TENANT_HEADING: "Select Tenant";
        readonly PL_TD_SELECT_TENANT_SUBHEADING: "Choose a tenant to continue";
        readonly PL_TD_AVAILABLE_TENANTS: "Available Tenants";
        readonly PL_TD_NO_TENANT_AVAILABLE: "No tenants available";
        readonly PL_TD_DEFAULT_OPTION: "-- Select a tenant --";
        readonly PL_TD_EMAIL_DISCOVERY_HEADER_TEXT: "Enter email to continue";
    };
};
```

### `FromEmailReturnType`

```ts check=false reason="Generated API signature"
export type FromEmailReturnType = {
    status: "OK";
    tenant: string;
} | {
    status: "NOT_ALLOWED";
    message: string;
} | {
    status: "ERROR";
    message: string;
};
```

### `getApi`

```ts check=false reason="Generated API signature"
import { getQuerier } from '@shared/react';
import { FromEmailReturnType, TenantList } from './types';
export declare const getApi: (querier: ReturnType<typeof getQuerier>) => {
    fetchTenants: () => Promise<({
        status: "OK";
    } & TenantList) | {
        status: "ERROR";
        message: string;
    }>;
    tenantIdFromEmail: (email: string) => Promise<FromEmailReturnType>;
};
```

### `OverrideableTenantFunctionImplementation`

```ts check=false reason="Generated API signature"
export type OverrideableTenantFunctionImplementation = {
    setTenantId: (tenantId: string) => void;
    determineTenantFromURL: () => Promise<string | undefined>;
    determineTenantFromSubdomain: () => string | undefined;
    parseTenantId: () => ParseTenantIdReturnType;
    setEmailId: (emailId: string) => void;
    getEmailId: () => string | undefined;
    removeEmailId: () => void;
    getTenantIdFromQuery: () => string | undefined;
};
```

### `ParseTenantIdReturnType`

```ts check=false reason="Generated API signature"
export type ParseTenantIdReturnType = {
    tenantId: string;
    doTenantDiscovery: false;
} | {
    tenantId: null;
    doTenantDiscovery: true;
};
```

### `SuperTokensPluginTenantDiscoveryPluginConfig`

```ts check=false reason="Generated API signature"
export type SuperTokensPluginTenantDiscoveryPluginConfig = {
    showTenantSelector?: boolean;
    extractTenantIdFromDomain?: boolean;
};
```

### `SuperTokensPluginTenantDiscoveryPluginNormalisedConfig`

```ts check=false reason="Generated API signature"
export type SuperTokensPluginTenantDiscoveryPluginNormalisedConfig = {
    showTenantSelector?: boolean;
    extractTenantIdFromDomain?: boolean;
};
```

### `TenantDetails`

```ts check=false reason="Generated API signature"
export interface TenantDetails {
    tenantId: string;
    displayName: string;
}
```

### `TenantList`

```ts check=false reason="Generated API signature"
export interface TenantList {
    tenants: TenantDetails[];
}
```

### `TranslationKeys`

```ts check=false reason="Generated API signature"
import { defaultTranslationsTenantDiscovery } from './translations';
export type TranslationKeys = keyof (typeof defaultTranslationsTenantDiscovery)["en"];
```
