> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PendingConsent

> ユニバーサルログインの`pending-consent`スクリーンをカスタマイズするために使用できるすべてのHooksとメソッドについて説明します。

`pending-consent`スクリーンは、リッチ認可リクエスト (RAR) フローで`customized-consent`プロンプトが構成されていない場合に表示される待機画面です。ユーザーはMy Accountエクスペリエンスを使って、ブラウザー外でリクエストを承認または拒否します。その間、このスクリーンは結果をポーリングします。同意の可否が確定したらフローを続行すると、Auth0がその結果を適用します。

![ACUL Pending Consent](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/docs/images/acul/pending-consent.png)

## インポート

各スクリーンには、それぞれ独自のHooksとメソッドが用意されています。SDKでは、スクリーンごとに**partial import**と**root import**のどちらも利用できます。

* partial importを使用すると、ユースケースに必要なコードだけを取り込めます。
* root importを使用すると、単一のバンドルからすべてのスクリーンを読み込めます。想定されるすべてのスクリーンを1つのビルドでまとめて処理したい場合に便利です。

```jsx Import Example theme={null}
// root import
import { usePendingConsent } from '@auth0/auth0-acul-react';

// partial import
import {
  usePendingConsent,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  useExperiment,
  // 共通Hooks
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  useMfaPolling,
  // ユーティリティHooks
  useChangeLanguage,
  // メソッド
  continueMethod,
} from '@auth0/auth0-acul-react/pending-consent';

function PendingConsentScreen() {
  const { continue: continueFlow } = usePendingConsent();
  useMfaPolling({
    intervalMs: 5000,
    onCompleted: () => continueFlow(),
  });
  return <p>Waiting for your approval…</p>;
}
```

## コンテキストフック

`pending-consent`スクリーンでAuth0のコンテキストデータへの読み取り専用アクセスを提供する、スクリーン単位のHooksです。`@auth0/auth0-acul-react/pending-consent`からインポートして使用します。

**useBranding** `() => [BrandingMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/BrandingMembers)`

このHookは、`pending-consent`スクリーンに表示されるロゴ、色、Theme設定などのブランディング設定を提供します。

```jsx Example theme={null}
import { useBranding } from '@auth0/auth0-acul-react/pending-consent';
function CustomTheme() {
  const branding = useBranding();
}
```

**useClient** `() => [ClientMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ClientMembers)`

このHookは、`pending-consent`スクリーンで使用する`id`、`name`、`logoUrl`などのクライアント関連の設定を提供します。

```jsx Example theme={null}
import { useClient } from '@auth0/auth0-acul-react/pending-consent';
function AppInfo() {
  const client = useClient();
}
```

**useExperiment** `() => [ExperimentMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ExperimentMembers)`

このHookは、`pending-consent`スクリーンで現在アクティブな[Experiment Center](https://docs-dev.mintlify.site/docs/ja-jp/customize/experiment-center)のエクスペリメントを提供します。アクティブなエクスペリメントがない場合 (またはスクリーンが`context_configuration`でオプトインしていない場合) は`null`を返します。

```jsx Example theme={null}
import { useExperiment } from '@auth0/auth0-acul-react/pending-consent';
function ExperimentBranch() {
  const experiment = useExperiment();
  if (!experiment) return null;
  return experiment.isControl ? <ControlUI /> : <TreatmentUI />;
}
```

**useOrganization** `() => [OrganizationMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/OrganizationMembers)`

このHookは、`id`や`name`など、ユーザーが所属するOrganizationの情報を提供します。Organizationのコンテキストが存在しない場合は`null`を返します。

```jsx Example theme={null}
import { useOrganization } from '@auth0/auth0-acul-react/pending-consent';
function OrgSelector() {
  const organization = useOrganization();
  if (!organization) {
    return <p>No Organization context</p>;
  }
}
```

**usePrompt** `() => [PromptMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/PromptMembers)`

このHookには、認証フローにおける現在のプロンプトに関するデータが含まれます。

```jsx Example theme={null}
import { usePrompt } from '@auth0/auth0-acul-react/pending-consent';
function FlowInfo() {
  const prompt = usePrompt();
}
```

**useScreen** `() => [ScreenMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ScreenMembers)`

このHookには、設定やコンテキストなど、`pending-consent`スクリーン固有の詳細情報が含まれます。

```jsx Example theme={null}
import { useScreen } from '@auth0/auth0-acul-react/pending-consent';
function ScreenDebug() {
  const screen = useScreen();
}
```

**useTenant** `() => [TenantMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/TenantMembers)`

このHookには、`id`や関連するメタデータなど、テナントに関するデータが含まれます。

```jsx Example theme={null}
import { useTenant } from '@auth0/auth0-acul-react/pending-consent';
function TenantInfo() {
  const tenant = useTenant();
}
```

**useTransaction** `() => [TransactionMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/TransactionMembers)`

このHookは、トランザクションの`state`やエラーなど、`pending-consent`スクリーンのトランザクション固有のデータを提供します。

```jsx Example theme={null}
import { useTransaction } from '@auth0/auth0-acul-react/pending-consent';
function TransactionInfo() {
  const transaction = useTransaction();
}
```

**useUntrustedData** `() => [UntrustedDataMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/UntrustedDataMembers)`

このHooksは、URLのクエリー文字列から事前入力されたパラメーターなど、スクリーンに渡された信頼できないデータを処理します。

```jsx Example theme={null}
import { useUntrustedData } from '@auth0/auth0-acul-react/pending-consent';
function PrefilledForm() {
  const untrustedData = useUntrustedData();
}
```

**useUser** `() => [UserMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/UserMembers)`

このHooksは、`username`や`email`、利用可能な認証方法など、アクティブなユーザーの詳細情報を提供します。

```jsx Example theme={null}
import { useUser } from '@auth0/auth0-acul-react/pending-consent';
function UserProfile() {
  const user = useUser();
}
```

**usePendingConsent** `[PendingConsentMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/PendingConsentMembers)`

このHooksは、`pending-consent`スクリーンで利用できるすべてのメソッドとコンテキストを返します。

## メソッド

**continueMethod** `Promise\<void\>`

ユーザーがブラウザー外で同意を承認または拒否した後に、フローを続行します。結果はAuth0が適用するため、承認用・拒否用の個別のメソッドはありません。同意がまだ保留中の場合、Auth0はこのスクリーンを再度レンダリングします。

```jsx Example theme={null}
import { usePendingConsent } from '@auth0/auth0-acul-react/pending-consent';

function ContinueButton() {
  const { continue: continueFlow } = usePendingConsent();
  return (
    <button onClick={() => continueFlow()}>
      Try again
    </button>
  );
}
```

## 共通/ユーティリティHooks

**[useMfaPolling](https://docs-dev.mintlify.site/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useMfaPolling.md)** `Hooks`

帯域外での判断を待つスクリーンのポーリング状態を管理します。このスクリーンでは、ユーザーが同意を承認または拒否すると`onCompleted`が実行されます。その中で`continue()`を呼び出してフローを進めてください。

```jsx Example theme={null}
import { useMfaPolling, usePendingConsent } from '@auth0/auth0-acul-react/pending-consent';

function ConsentStatus() {
  const { continue: continueFlow } = usePendingConsent();
  const { isRunning, startPolling, stopPolling } = useMfaPolling({
    intervalMs: 5000,
    onCompleted: () => continueFlow(),
    onError: (error) => console.error('Polling error:', error),
  });

  useEffect(() => {
    startPolling();
    return () => stopPolling();
  }, []);

  return isRunning ? <p>Waiting for your approval…</p> : null;
}
```

エラーが発生するとポーリングは停止します。`continue()`を呼び出す「再試行」ボタンなど、手動で操作できる代替手段を用意し、ポーリングの実行中はそのボタンを非表示にしてください。

**[useAuth0Themes](https://docs-dev.mintlify.site/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useAuth0Themes.md)** `Hooks`

このHooksは、ブランディングコンテキストから、フラット化された設定を含む現在のThemeオプションを取得します。

**[useChangeLanguage](https://docs-dev.mintlify.site/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useChangeLanguage)** `Hooks`

このHooksは、現在のACULスクリーンの表示言語を変更する関数を返します。

**[useCurrentScreen](https://docs-dev.mintlify.site/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useCurrentScreen.md)** `Hooks`

このHooksは、現在のスクリーンのコンテキストと状態を取得します。

**[useErrors](https://docs-dev.mintlify.site/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useErrors.md)** `Hooks`

このHooksは、スクリーン上のサーバーエラー、クライアントエラー、開発者エラーを読み取り、管理します。
