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

# PhoneIdentifierEnrollment

> Universal Login の `phone-identifier-enrollment` 画面をカスタマイズするために使用できる、すべてのフックとメソッドについて説明します。

`phone-identifier-enrollment` 画面は、ユーザーが識別子として電話番号を登録する必要がある場合に表示されます。この画面では、ユーザーは希望する確認方法 (SMS または音声通話) を選択し、登録手続きを続行するか、前のステップに戻ることができます。

![ACUL 電話識別子の登録](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/images/cdy7uua7fh8z/7kuQwDVmt0NkHCbQObLj8d/b690fd899f7c8525532d6d640298f2cd/PhoneIdentifierEnrollment.png)

## インポート

各画面には、それぞれ固有のフックとメソッドがあります。SDK は、各画面で **partial import** と **root import** をサポートしています。

* partial import を使用すると、特定の用途に必要なコードだけを含めることができます。
* root import を使用すると、単一のバンドルからすべての画面を読み込めるため、想定されるあらゆる画面に対応する統一ビルドが必要な場合に便利です。

```jsx Import Example theme={null}
// rootインポート
import { usePhoneIdentifierEnrollment } from '@auth0/auth0-acul-react';

// partialインポート
import {
  usePhoneIdentifierEnrollment,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  useExperiment,
  // 共通フック
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // ユーティリティフック
  useChangeLanguage,
  // メソッド
  continuePhoneEnrollment,
  returnToPrevious,
} from '@auth0/auth0-acul-react/phone-identifier-enrollment';

function PhoneIdentifierEnrollmentScreen() {
  const { continuePhoneEnrollment } = usePhoneIdentifierEnrollment();
  return (
    <button onClick={() => continuePhoneEnrollment({ type: 'text' })}>Send Code via SMS</button>
  );
}
```

## コンテキストフック

`phone-identifier-enrollment` 画面で、Auth0 のコンテキストデータへの読み取り専用アクセスを提供する画面スコープのフックです。`@auth0/auth0-acul-react/phone-identifier-enrollment` からインポートします。

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

このフックは、`phone-identifier-enrollment` 画面に表示されるロゴ、色、テーマ設定などのブランディング設定を提供します。

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

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

このフックは、`phone-identifier-enrollment` 画面用の `id`、`name`、`logoUrl` など、クライアント関連の設定を提供します。

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

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

このフックは、`phone-identifier-enrollment` 画面で現在有効な [Experiment Center](/docs/docs/ja-jp/customize/experiment-center) のエクスペリメントを提供します。有効なエクスペリメントがない場合 (または画面が `context_configuration` でオプトインしていない場合) は `null` を返します。

```jsx Example theme={null}
import { useExperiment } from '@auth0/auth0-acul-react/phone-identifier-enrollment';
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)`

このフックは、電話の登録のスコープが組織に設定されている場合に、ユーザーの組織に関する情報を提供します。組織コンテキストが存在しない場合は `null` を返します。

```jsx Example theme={null}
import { useOrganization } from '@auth0/auth0-acul-react/phone-identifier-enrollment';
function OrgSelector() {
  const organization = useOrganization();
  if (!organization) {
    return <p>組織 コンテキストがありません</p>;
  }
}
```

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

このフックには、認証フロー内の現在の prompt に関するデータが含まれます。

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

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

このフックには、設定やコンテキストを含む `phone-identifier-enrollment` 画面固有の詳細が含まれます。

`screen.data` オブジェクトは、`phone`、`messageType`、`username` の3つのオプションフィールドを公開します。現在の登録セッションに関連付けられたユーザー名を表示するには、`screen.data?.username` を使用します。

```jsx Example theme={null}
import { useScreen } from '@auth0/auth0-acul-react/phone-identifier-enrollment';
function ScreenDebug() {
  const screen = useScreen();
  const username = screen.data?.username;
}
```

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

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

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

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

このフックは、アクティブな接続や現在のフローの状態など、`phone-identifier-enrollment` 画面のトランザクション固有のデータを提供します。

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

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

このフックは、URL のクエリ文字列で事前に設定されたパラメーターなど、画面に渡される信頼できないデータを処理します。

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

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

このフックは、`username`、`email`、利用可能な認証方法など、現在のユーザーの詳細を提供します。

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

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

このフックは、`phone-identifier-enrollment` 画面で利用できるすべてのメソッドとコンテキストを返します。

## メソッド

**continuePhoneEnrollment** `Promise\<void\>`

このメソッドは、ユーザーが希望する電話での確認方法を送信し、登録フローを続行します。

```jsx Example theme={null}
import { usePhoneIdentifierEnrollment } from '@auth0/auth0-acul-react/phone-identifier-enrollment';

function EnrollButton() {
  const { continuePhoneEnrollment } = usePhoneIdentifierEnrollment();
  return (
    <button onClick={() => continuePhoneEnrollment({ type: 'text' })}>
      Send Code via SMS
    </button>
  );
}
```

**メソッドのパラメーター**

**パラメーター**

**options**

[PhoneEnrollmentOptions](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/PhoneEnrollmentOptions).

**type** `"text" | "voice"` *required*

確認コードの配信方法です。SMS の場合は "text"、音声通話の場合は "voice" を使用します。

**returnToPrevious** `Promise\<void\>`

このメソッドは、ユーザーを認証フローの前のステップに戻します。

```jsx Example theme={null}
import { usePhoneIdentifierEnrollment } from '@auth0/auth0-acul-react/phone-identifier-enrollment';

function BackButton() {
  const { returnToPrevious } = usePhoneIdentifierEnrollment();
  return (
    <button onClick={() => returnToPrevious()}>
      Back
    </button>
  );
}
```

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

**[useAuth0Themes](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useAuth0Themes)** `Hooks`

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

**[useChangeLanguage](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useChangeLanguage)** `Hooks`

このフックは、現在の ACUL 画面で表示言語を変更するための関数を返します。

**[useCurrentScreen](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useCurrentScreen)** `Hooks`

このフックは、現在の画面のコンテキストと state を取得します。

**[useErrors](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useErrors)** `Hooks`

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