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

# リファレンス

> React Native SDKの完全なAPIリファレンス。

## Adrop

Adrop SDKを初期化し、グローバル設定を管理するクラス。

### initialize

```typescript theme={null}
static initialize(
  production: boolean,
  targetCountries?: string[],
  useInAppBrowser?: boolean
): void
```

Adrop SDKを初期化します。

**パラメータ：**

* `production` (boolean)：本番モード（true：本番、false：開発）
* `targetCountries` (string\[], optional)：ターゲット国コード配列（デフォルト：\[]）
* `useInAppBrowser` (boolean, optional)：アプリ内ブラウザを使用するかどうか（デフォルト：false）

**例：**

```typescript theme={null}
import { Adrop } from 'adrop-ads-react-native'

Adrop.initialize(true, ['KR', 'US'], false)
```

### setUID

```typescript theme={null}
static setUID(uid: string): void
```

一意のユーザー識別子を設定します。

**パラメータ：**

* `uid` (string)：一意のユーザー識別子

**例：**

```typescript theme={null}
Adrop.setUID('user123')
```

### setTheme

```typescript theme={null}
static setTheme(theme: AdropTheme): void
```

アプリのテーマを設定します。

**パラメータ：**

* `theme` (AdropTheme)：テーマ値（'light', 'dark', 'auto'）

**例：**

```typescript theme={null}
import { Adrop, AdropTheme } from 'adrop-ads-react-native'

Adrop.setTheme(AdropTheme.dark)
```

### registerWebView

```typescript theme={null}
static registerWebView(viewTag: number): Promise<void>
```

バックフィル広告サポートのためにネイティブWebViewを登録します。WebViewがマウントされた後に呼び出してください。

**パラメータ：**

* `viewTag` (number): WebViewをラップする`View`から`findNodeHandle()`で取得したネイティブビュータグ

**例：**

```typescript theme={null}
import { useEffect, useRef } from 'react'
import { findNodeHandle, View } from 'react-native'
import { Adrop } from 'adrop-ads-react-native'

const containerRef = useRef<View>(null)

useEffect(() => {
  if (containerRef.current) {
    const tag = findNodeHandle(containerRef.current)
    if (tag != null) {
      Adrop.registerWebView(tag)
    }
  }
}, [])
```

<Warning>
  `adrop-ads-backfill`モジュールが必要です。未インストールの場合、この呼び出しは無視されます。
</Warning>

***

## AdropTheme

アプリのテーマを指定するための定数オブジェクト。

```typescript theme={null}
const AdropTheme = {
  light: 'light',
  dark: 'dark',
  auto: 'auto',
} as const

type AdropTheme = (typeof AdropTheme)[keyof typeof AdropTheme]
```

**値：**

* `light`：ライトテーマ
* `dark`：ダークテーマ
* `auto`：システム設定に従う

***

## BrowserTarget

広告のリンク先URLを開く方式を指定するenumです。

```typescript theme={null}
enum BrowserTarget {
  EXTERNAL = 0,
  INTERNAL = 1,
}
```

**値:**

* `EXTERNAL`: 外部ブラウザでURLを開く（デフォルト）
* `INTERNAL`: アプリ内ブラウザでURLを開く

***

## AdropErrorCode

広告のロードおよび表示中に発生する可能性のあるエラーコード。

```typescript theme={null}
enum AdropErrorCode {
  network = 'ERROR_CODE_NETWORK',
  internal = 'ERROR_CODE_INTERNAL',
  initialize = 'ERROR_CODE_INITIALIZE',
  invalidUnit = 'ERROR_CODE_INVALID_UNIT',
  notTargetCountry = 'ERROR_CODE_NOT_TARGET_COUNTRY',
  inactive = 'ERROR_CODE_AD_INACTIVE',
  adNoFill = 'ERROR_CODE_AD_NO_FILL',
  adDuplicated = 'ERROR_CODE_AD_LOAD_DUPLICATED',
  adLoading = 'ERROR_CODE_AD_LOADING',
  adEmpty = 'ERROR_CODE_AD_EMPTY',
  adShown = 'ERROR_CODE_AD_SHOWN',
  adHideForToday = 'ERROR_CODE_AD_HIDE_FOR_TODAY',
  adLandscapeUnsupported = 'ERROR_CODE_LANDSCAPE_UNSUPPORTED',
  backfillNoFill = 'ERROR_CODE_AD_BACKFILL_NO_FILL',
  undefined = 'UNDEFINED',
}
```

**エラーコード：**

* `network`：ネットワークエラー
* `internal`：内部エラー
* `initialize`：SDK初期化エラー
* `invalidUnit`：無効な広告ユニット
* `notTargetCountry`：ターゲット国ではない
* `inactive`：非アクティブな広告
* `adNoFill`：利用可能な広告がない
* `adDuplicated`：重複した広告ロードリクエスト
* `adLoading`：広告がロード中
* `adEmpty`：広告が空
* `adShown`：広告は既に表示済み
* `adHideForToday`：今日は広告を非表示
* `adLandscapeUnsupported`：横向きモードはサポートされていない
* `backfillNoFill`：バックフィル広告が利用できない
* `undefined`：未定義のエラー

***

## AdropAdChoicesPosition

バックフィルネイティブ広告のAdChoicesマーク表示位置を設定するenumです。

### Definition

```typescript theme={null}
enum AdropAdChoicesPosition {
  topLeft = 0,
  topRight = 1,
  bottomLeft = 2,
  bottomRight = 3,
}
```

### Values

| Value         | Integer | Description |
| ------------- | ------- | ----------- |
| `topLeft`     | 0       | 左上          |
| `topRight`    | 1       | 右上（デフォルト）   |
| `bottomLeft`  | 2       | 左下          |
| `bottomRight` | 3       | 右下          |

### Usage Example

```typescript theme={null}
import { AdropNativeAd, AdropAdChoicesPosition } from 'adrop-ads-react-native'

const nativeAd = new AdropNativeAd(
  'YOUR_UNIT_ID',
  false,
  AdropAdChoicesPosition.bottomRight
)
```

***

## AdropBanner

バナー広告を表示するReactコンポーネント。

### Props

```typescript theme={null}
type AdropBannerProp = {
  style: { height: number; width: number | string }
  unitId: string
  useCustomClick?: boolean
  adSize?: { width: number; height: number } | null
  autoLoad?: boolean
  onAdReceived?: (unitId: string, metadata?: AdropBannerMetadata) => void
  onAdImpression?: (unitId: string, metadata?: AdropBannerMetadata) => void
  onAdClicked?: (unitId: string, metadata?: AdropBannerMetadata) => void
  onAdFailedToReceive?: (unitId: string, errorCode?: any) => void
  onAdVideoStart?: (unitId: string) => void
  onAdVideoEnd?: (unitId: string) => void
}
```

**Props：**

* `style` (object, required)：バナースタイル（高さと幅を含む）
* `unitId` (string, required)：広告ユニットID
* `useCustomClick` (boolean, optional)：カスタムクリック処理（デフォルト：false）
* `adSize` (object, optional)：広告サイズ設定
* `autoLoad` (boolean, optional)：自動ロード（デフォルト：true）
* `onAdReceived` (function, optional)：広告受信時に呼び出し
* `onAdImpression` (function, optional)：広告インプレッション時に呼び出し
* `onAdClicked` (function, optional)：広告クリック時に呼び出し
* `onAdFailedToReceive` (function, optional)：広告受信失敗時に呼び出し
* `onAdVideoStart` (function, optional)：動画広告の再生開始時に呼び出し
* `onAdVideoEnd` (function, optional)：動画広告の再生終了時に呼び出し

### メソッド

**load()**

```typescript theme={null}
load(): void
```

広告をロードします。（refを介して呼び出し）

### AdropBannerMetadata

```typescript theme={null}
type AdropBannerMetadata = {
  creativeId: string
  txId: string
  campaignId: string
  destinationURL: string
  browserTarget: BrowserTarget
}
```

**例：**

```typescript theme={null}
import { AdropBanner } from 'adrop-ads-react-native'

<AdropBanner
  style={{ width: 320, height: 50 }}
  unitId="PUBLIC_TEST_UNIT_ID_320_50"
  onAdReceived={(unitId, metadata) => console.log('広告を受信', metadata)}
  onAdFailedToReceive={(unitId, errorCode) => console.log('広告失敗', errorCode)}
/>
```

***

## AdropNativeAd

ネイティブ広告を管理するクラス。

### コンストラクタ

```typescript theme={null}
new AdropNativeAd(
  unitId: string,
  useCustomClick?: boolean,
  preferredAdChoicesPosition?: AdropAdChoicesPosition
)
```

**パラメータ：**

| Parameter                    | Type                     | Description                                                             |
| ---------------------------- | ------------------------ | ----------------------------------------------------------------------- |
| `unitId`                     | `string`                 | 広告ユニットID                                                                |
| `useCustomClick`             | `boolean`                | カスタムクリック処理（デフォルト：`false`）                                               |
| `preferredAdChoicesPosition` | `AdropAdChoicesPosition` | バックフィルネイティブ広告のAdChoicesマーク表示位置（デフォルト：`AdropAdChoicesPosition.topRight`） |

### プロパティ

**isLoaded** (readonly)

```typescript theme={null}
get isLoaded(): boolean
```

広告がロードされているかどうかを返します。

**unitId** (readonly)

```typescript theme={null}
get unitId(): string
```

広告ユニットIDを返します。

**requestId** (readonly, deprecated)

```typescript theme={null}
get requestId(): string // deprecated - 常に '' を返す
```

*非推奨。* このプロパティは常に空文字列を返し、将来のバージョンで削除されます。

**creativeId** (readonly)

```typescript theme={null}
get creativeId(): string
```

クリエイティブIDを返します。

**txId** (readonly)

```typescript theme={null}
get txId(): string
```

トランザクションIDを返します。

**campaignId** (readonly)

```typescript theme={null}
get campaignId(): string
```

キャンペーンIDを返します。

**useCustomClick** (readonly)

```typescript theme={null}
get useCustomClick(): boolean
```

カスタムクリック処理が有効かどうかを返します。

**isBackfilled** (readonly)

```typescript theme={null}
get isBackfilled(): boolean
```

バックフィル広告かどうかを返します。

**isVideoAd** (readonly)

```typescript theme={null}
get isVideoAd(): boolean
```

動画広告かどうかを返します。

**browserTarget** (readonly)

```typescript theme={null}
get browserTarget(): BrowserTarget
```

ブラウザターゲット設定を返します。

**properties** (readonly)

```typescript theme={null}
get properties(): AdropNativeProperties
```

広告プロパティを返します。

**listener**

```typescript theme={null}
listener?: AdropNativeAdListener
```

広告イベントリスナーを設定します。

### メソッド

**load()**

```typescript theme={null}
load(): void
```

広告をロードします。

**destroy()**

```typescript theme={null}
destroy(): void
```

広告インスタンスを解放します。

### AdropNativeProperties

```typescript theme={null}
type AdropNativeProperties = {
  icon?: string
  cover?: string
  headline?: string
  body?: string
  creative?: string
  asset?: string
  destinationURL?: string
  advertiserURL?: string
  accountTag?: string
  creativeTag?: string
  advertiser?: string
  callToAction?: string
  profile?: AdropNativeProfile
  extra?: Record<string, string>
  isBackfilled?: boolean
}
```

### AdropNativeProfile

```typescript theme={null}
type AdropNativeProfile = {
  displayName: string
  displayLogo: string
}
```

### AdropNativeAdListener

```typescript theme={null}
interface AdropNativeAdListener {
  onAdReceived?: (ad: AdropNativeAd) => void
  onAdClicked?: (ad: AdropNativeAd) => void
  onAdImpression?: (ad: AdropNativeAd) => void
  onAdFailedToReceive?: (ad: AdropNativeAd, errorCode?: any) => void
  onAdVideoStart?: (ad: AdropNativeAd) => void
  onAdVideoEnd?: (ad: AdropNativeAd) => void
}
```

***

## AdropNativeAdView

ネイティブ広告を表示するコンテナコンポーネント。

### Props

```typescript theme={null}
type Props = ViewProps & {
  nativeAd?: AdropNativeAd
}
```

**Props：**

* `nativeAd` (AdropNativeAd, optional)：ネイティブ広告インスタンス
* ...ViewProps：React Native Viewのすべてのprops

**例：**

```typescript theme={null}
import { AdropNativeAdView } from 'adrop-ads-react-native'

<AdropNativeAdView nativeAd={nativeAd}>
  {/* ネイティブ広告ビュー */}
</AdropNativeAdView>
```

***

## ネイティブ広告ビューコンポーネント

ネイティブ広告の各要素を表示するコンポーネント。すべてのコンポーネントは`AdropNativeAdView`内で使用する必要があります。

### AdropIconView

広告アイコンを表示します。

```typescript theme={null}
interface IconViewProps extends Omit<ImageProps, 'source'> {
  source?: ImageSourcePropType | undefined
}
```

**例：**

```typescript theme={null}
import { AdropIconView } from 'adrop-ads-react-native'

<AdropIconView style={{ width: 50, height: 50 }} />
```

### AdropHeadLineView

広告ヘッドラインを表示します。

```typescript theme={null}
const AdropHeadLineView: React.FC<TextProps>
```

**例：**

```typescript theme={null}
import { AdropHeadLineView } from 'adrop-ads-react-native'

<AdropHeadLineView style={{ fontSize: 18, fontWeight: 'bold' }} />
```

### AdropBodyView

広告本文を表示します。

```typescript theme={null}
const AdropBodyView: React.FC<TextProps>
```

**例：**

```typescript theme={null}
import { AdropBodyView } from 'adrop-ads-react-native'

<AdropBodyView style={{ fontSize: 14 }} />
```

### AdropMediaView

広告メディア（画像/動画）を表示します。

```typescript theme={null}
const AdropMediaView: React.FC<ViewProps>
```

**例：**

```typescript theme={null}
import { AdropMediaView } from 'adrop-ads-react-native'

<AdropMediaView style={{ width: '100%', height: 200 }} />
```

### AdropCallToActionView

広告CTA（Call To Action）ボタンを表示します。

```typescript theme={null}
const AdropCallToActionView: React.FC<TextProps>
```

**例：**

```typescript theme={null}
import { AdropCallToActionView } from 'adrop-ads-react-native'

<AdropCallToActionView
  style={{
    backgroundColor: '#007AFF',
    color: 'white',
    padding: 10
  }}
/>
```

### AdropAdvertiserView

広告主情報を表示します。

```typescript theme={null}
const AdropAdvertiserView: React.FC<TextProps>
```

**例：**

```typescript theme={null}
import { AdropAdvertiserView } from 'adrop-ads-react-native'

<AdropAdvertiserView style={{ fontSize: 12, color: 'gray' }} />
```

### AdropProfileLogoView

プロフィールロゴを表示します。

```typescript theme={null}
interface IconViewProps extends Omit<ImageProps, 'source'> {
  source?: ImageSourcePropType | undefined
}
```

**例：**

```typescript theme={null}
import { AdropProfileLogoView } from 'adrop-ads-react-native'

<AdropProfileLogoView style={{ width: 30, height: 30, borderRadius: 15 }} />
```

### AdropProfileNameView

プロフィール名を表示します。

```typescript theme={null}
const AdropProfileNameView: React.FC<TextProps>
```

**例：**

```typescript theme={null}
import { AdropProfileNameView } from 'adrop-ads-react-native'

<AdropProfileNameView style={{ fontSize: 14, fontWeight: '600' }} />
```

***

## AdropInterstitialAd

インタースティシャル広告を管理するクラス。

### コンストラクタ

```typescript theme={null}
constructor(unitId: string)
```

**パラメータ：**

* `unitId` (string)：広告ユニットID

### プロパティ

**isLoaded** (readonly)

```typescript theme={null}
get isLoaded(): boolean
```

広告がロードされているかどうかを返します。

**unitId** (readonly)

```typescript theme={null}
get unitId(): string
```

広告ユニットIDを返します。

**creativeId** (readonly)

```typescript theme={null}
get creativeId(): string
```

クリエイティブIDを返します。

**txId** (readonly)

```typescript theme={null}
get txId(): string
```

トランザクションIDを返します。

**campaignId** (readonly)

```typescript theme={null}
get campaignId(): string
```

キャンペーンIDを返します。

**destinationURL** (readonly)

```typescript theme={null}
get destinationURL(): string
```

リンク先URLを返します。

**browserTarget** (readonly)

```typescript theme={null}
get browserTarget(): BrowserTarget
```

ブラウザターゲット設定を返します。

**listener**

```typescript theme={null}
listener?: AdropListener
```

広告イベントリスナーを設定します。

### メソッド

**load()**

```typescript theme={null}
load(): void
```

広告をロードします。

**show()**

```typescript theme={null}
show(): void
```

広告を表示します。

**close()**

```typescript theme={null}
close(): void
```

広告をプログラムで閉じます。

**destroy()**

```typescript theme={null}
destroy(): void
```

広告インスタンスを解放します。

**例：**

```typescript theme={null}
import { AdropInterstitialAd } from 'adrop-ads-react-native'

const interstitialAd = new AdropInterstitialAd('YOUR_UNIT_ID')

interstitialAd.listener = {
  onAdReceived: (ad) => {
    console.log('広告がロードされました')
    ad.show()
  },
  onAdFailedToReceive: (ad, errorCode) => {
    console.log('広告のロードに失敗しました', errorCode)
  },
}

interstitialAd.load()
```

***

## AdropRewardedAd

リワード広告を管理するクラス。

### コンストラクタ

```typescript theme={null}
constructor(unitId: string)
```

**パラメータ：**

* `unitId` (string)：広告ユニットID

### プロパティ

AdropInterstitialAdと同じプロパティ。

### メソッド

**load()**

```typescript theme={null}
load(): void
```

広告をロードします。

**show()**

```typescript theme={null}
show(): void
```

広告を表示します。

**close()**

```typescript theme={null}
close(): void
```

広告をプログラムで閉じます。

**destroy()**

```typescript theme={null}
destroy(): void
```

広告インスタンスを解放します。

**setServerSideVerificationOptions()**

```typescript theme={null}
setServerSideVerificationOptions(options: ServerSideVerificationOptions): void
```

サーバーサイド報酬検証のオプションを設定します。`load()`の前に呼び出してください。

* `options.userId` (string, optional): サーバーコールバックに送信されるユーザー識別子
* `options.customData` (string, optional): サーバーコールバックに送信されるカスタムデータ

**SSVの例：**

```typescript theme={null}
import { AdropRewardedAd } from 'adrop-ads-react-native'

const rewardedAd = new AdropRewardedAd('YOUR_UNIT_ID')

// サーバーサイド検証オプションを設定
rewardedAd.setServerSideVerificationOptions({
  userId: 'user_12345',
  customData: 'extra_info',
})

rewardedAd.listener = {
  onAdReceived: (ad) => {
    console.log('広告がロードされました')
    ad.show()
  },
  onAdEarnRewardHandler: (ad, type, amount) => {
    console.log(`リワード獲得: type=${type}, amount=${amount}`)
  },
  onAdFailedToReceive: (ad, errorCode) => {
    console.log('広告のロードに失敗しました', errorCode)
  },
}

rewardedAd.load()
```

***

## AdropPopupAd

ポップアップ広告を管理するクラス。

### コンストラクタ

```typescript theme={null}
constructor(
  unitId: string,
  colors?: AdropPopupAdColors,
  useCustomClick?: boolean
)
```

**パラメータ：**

* `unitId` (string)：広告ユニットID
* `colors` (AdropPopupAdColors, optional)：ポップアップ色カスタマイズ
* `useCustomClick` (boolean, optional)：カスタムクリック処理（デフォルト：false）

### プロパティ

**isLoaded** (readonly)

```typescript theme={null}
get isLoaded(): boolean
```

広告がロードされているかどうかを返します。

**unitId** (readonly)

```typescript theme={null}
get unitId(): string
```

広告ユニットIDを返します。

**creativeId** (readonly)

```typescript theme={null}
get creativeId(): string
```

クリエイティブIDを返します。

**txId** (readonly)

```typescript theme={null}
get txId(): string
```

トランザクションIDを返します。

**campaignId** (readonly)

```typescript theme={null}
get campaignId(): string
```

キャンペーンIDを返します。

**destinationURL** (readonly)

```typescript theme={null}
get destinationURL(): string
```

リンク先URLを返します。

**browserTarget** (readonly)

```typescript theme={null}
get browserTarget(): BrowserTarget
```

ブラウザターゲット設定を返します。

**listener**

```typescript theme={null}
listener?: AdropListener
```

広告イベントリスナーを設定します。

### メソッド

**load()**

```typescript theme={null}
load(): void
```

広告をロードします。

**show()**

```typescript theme={null}
show(): void
```

広告を表示します。

**close()**

```typescript theme={null}
close(): void
```

ポップアップ広告を閉じます。

**destroy()**

```typescript theme={null}
destroy(): void
```

広告インスタンスを解放します。

### AdropPopupAdColors

```typescript theme={null}
type AdropPopupAdColors = {
  closeTextColor?: string
  hideForTodayTextColor?: string
  backgroundColor?: string
}
```

**プロパティ：**

* `closeTextColor` (string, optional)：閉じるボタンのテキスト色
* `hideForTodayTextColor` (string, optional)：「今日は表示しない」のテキスト色
* `backgroundColor` (string, optional)：背景色

***

## AdropListener

広告イベントを受け取るリスナーインターフェース。

```typescript theme={null}
type AdropListener = {
  onAdReceived?: (ad: AdropAd) => void
  onAdClicked?: (ad: AdropAd) => void
  onAdImpression?: (ad: AdropAd) => void
  onAdFailedToReceive?: (ad: AdropAd, errorCode?: any) => void
  onAdDidPresentFullScreen?: (ad: AdropAd) => void
  onAdWillPresentFullScreen?: (ad: AdropAd) => void
  onAdDidDismissFullScreen?: (ad: AdropAd) => void
  onAdWillDismissFullScreen?: (ad: AdropAd) => void
  onAdFailedToShowFullScreen?: (ad: AdropAd, errorCode?: any) => void
  onAdEarnRewardHandler?: (ad: AdropAd, type: number, amount: number) => void
  onAdBackButtonPressed?: (ad: AdropAd) => void
  onAdVideoStart?: (ad: AdropAd) => void
  onAdVideoEnd?: (ad: AdropAd) => void
}
```

**イベント：**

* `onAdReceived`：広告受信完了
* `onAdClicked`：広告クリック
* `onAdImpression`：広告インプレッション
* `onAdFailedToReceive`：広告受信失敗
* `onAdDidPresentFullScreen`：フルスクリーン広告が表示された
* `onAdWillPresentFullScreen`：フルスクリーン広告が表示される
* `onAdDidDismissFullScreen`：フルスクリーン広告が閉じられた
* `onAdWillDismissFullScreen`：フルスクリーン広告が閉じられる
* `onAdFailedToShowFullScreen`：フルスクリーン広告の表示に失敗
* `onAdEarnRewardHandler`：リワード獲得（リワード広告のみ）
* `onAdBackButtonPressed`：戻るボタン押下（Androidのみ）
* `onAdVideoStart`：動画広告の再生開始
* `onAdVideoEnd`：動画広告の再生終了

***

## useAdropInterstitialAd

React Hookでインタースティシャル広告を管理します。

### シグネチャ

```typescript theme={null}
function useAdropInterstitialAd(unitId: string | null): AdHookReturns & AdStates
```

**パラメータ：**

* `unitId` (string | null)：広告ユニットID

**戻り値：**

* `load`：広告ロード関数
* `show`：広告表示関数
* `reset`：状態リセット関数
* `isBackPressed`：戻るボタン押下状態（Androidのみ）
* `isClicked`：クリック状態
* `isClosed`：閉じた状態
* `isEarnRewarded`：ユーザーがリワードを獲得したかどうか
* `isLoaded`：ロード状態
* `isOpened`：表示状態
* `isReady`：準備完了状態
* `errorCode`：エラーコード
* `reward`：リワード情報（`{ type: number, amount: number }` または `undefined`）
* `browserTarget`：ブラウザターゲット設定（`BrowserTarget` または `undefined`）

**例：**

```typescript theme={null}
import { useAdropInterstitialAd } from 'adrop-ads-react-native'

function MyComponent() {
  const { load, show, isLoaded, errorCode } = useAdropInterstitialAd('YOUR_UNIT_ID')

  useEffect(() => {
    load()
  }, [])

  useEffect(() => {
    if (isLoaded) {
      show()
    }
  }, [isLoaded])

  return <View />
}
```

***

## useAdropRewardedAd

React Hookでリワード広告を管理します。

### シグネチャ

```typescript theme={null}
function useAdropRewardedAd(unitId: string | null): AdHookReturns & AdStates
```

**パラメータ：**

* `unitId` (string | null)：広告ユニットID

**戻り値：**

* `load`：広告ロード関数
* `show`：広告表示関数
* `reset`：状態リセット関数
* `isBackPressed`：戻るボタン押下状態（Androidのみ）
* `isClicked`：クリック状態
* `isClosed`：閉じた状態
* `isEarnRewarded`：ユーザーがリワードを獲得したかどうか
* `isLoaded`：ロード状態
* `isOpened`：表示状態
* `isReady`：準備完了状態
* `errorCode`：エラーコード
* `reward`：リワード情報（`{ type: number, amount: number }` または `undefined`）
* `browserTarget`：ブラウザターゲット設定（`BrowserTarget` または `undefined`）

**例：**

```typescript theme={null}
import { useAdropRewardedAd } from 'adrop-ads-react-native'

function MyComponent() {
  const { load, show, isLoaded, isEarnRewarded, reward } = useAdropRewardedAd('YOUR_UNIT_ID')

  useEffect(() => {
    load()
  }, [])

  useEffect(() => {
    if (isLoaded) {
      show()
    }
  }, [isLoaded])

  useEffect(() => {
    if (isEarnRewarded && reward) {
      console.log(`リワード: type=${reward.type}, amount=${reward.amount}`)
    }
  }, [isEarnRewarded, reward])

  return <View />
}
```

***

## useAdropWebView

Adrop SDKにWebViewを登録するフックです。ビュータグの解決と登録を自動的に処理します。

### シグネチャ

```typescript theme={null}
function useAdropWebView(): {
  containerRef: React.RefObject<View>
  isReady: boolean
  onLayout: () => void
}
```

**戻り値：**

* `containerRef`: WebViewをラップする`View`に接続するref
* `isReady`: WebViewの登録完了状態
* `onLayout`: レイアウト時に登録をトリガーするコールバック

**例：**

```typescript theme={null}
import { View } from 'react-native'
import { WebView } from 'react-native-webview'
import { useAdropWebView } from 'adrop-ads-react-native'

function WebViewScreen() {
  const { containerRef, isReady, onLayout } = useAdropWebView()

  return (
    <View ref={containerRef} style={{ flex: 1 }} onLayout={onLayout}>
      <WebView
        source={isReady ? { uri: 'https://your-website.com' } : { html: '' }}
        javaScriptEnabled={true}
        thirdPartyCookiesEnabled={true}
        mediaPlaybackRequiresUserAction={false}
        allowsInlineMediaPlayback={true}
      />
    </View>
  )
}
```

***

## AdropMetrics

ユーザー属性とイベントを管理するクラス。

### setProperty

```typescript theme={null}
static setProperty(key: string, value: any): void
```

ユーザープロパティを設定します。

**パラメータ：**

* `key` (string)：プロパティキー
* `value` (any)：プロパティ値

**例：**

```typescript theme={null}
import { AdropMetrics, AdropProperties, AdropGender } from 'adrop-ads-react-native'

AdropMetrics.setProperty(AdropProperties.AGE, 25)
AdropMetrics.setProperty(AdropProperties.GENDER, AdropGender.MALE)
AdropMetrics.setProperty(AdropProperties.BIRTH, '1998-01-01')
```

### sendEvent

```typescript theme={null}
static sendEvent(name: string, params?: Record<string, any>): void
```

ユーザー行動イベントを送信します。マルチアイテムイベント用のネストされた`items`配列をサポートします。

**パラメータ：**

* `name` (string)：イベント名（1〜64文字）
* `params` (Record\<string, any>, optional)：イベントパラメータ

**例：**

```typescript theme={null}
import { AdropMetrics } from 'adrop-ads-react-native'

// シンプルイベント
AdropMetrics.sendEvent('app_open')

// パラメータ付きイベント
AdropMetrics.sendEvent('view_item', {
  item_id: 'SKU-123',
  item_name: 'Widget',
  price: 29900,
})

// マルチアイテムイベント
AdropMetrics.sendEvent('purchase', {
  tx_id: 'TXN-001',
  currency: 'KRW',
  items: [
    { item_id: 'SKU-001', item_name: 'Product A', price: 29900, quantity: 1 },
    { item_id: 'SKU-002', item_name: 'Product B', price: 15000, quantity: 2 },
  ],
})
```

### logEvent (deprecated)

```typescript theme={null}
/** @deprecated sendEventを使用してください */
static logEvent(name: string, params?: Record<string, any>): void
```

カスタムイベントを記録します。内部的に`sendEvent`を呼び出します。

**パラメータ：**

* `name` (string)：イベント名
* `params` (object, optional)：イベントパラメータ

### properties

```typescript theme={null}
static properties(): Promise<Record<string, any>>
```

設定されたすべてのプロパティを取得します。

**戻り値：**

* Promise\<Record\<string, any>>：プロパティオブジェクト

***

## AdropProperties

ユーザープロパティキーを定義する列挙型。

```typescript theme={null}
enum AdropProperties {
  AGE = 'AGE',
  BIRTH = 'BIRTH',
  GENDER = 'GDR',
}
```

**値：**

* `AGE`：年齢
* `BIRTH`：生年月日
* `GENDER`：性別

***

## AdropGender

性別を定義する列挙型。

```typescript theme={null}
enum AdropGender {
  MALE = 'M',
  FEMALE = 'F',
  OTHER = 'O',
  UNKNOWN = 'U',
}
```

**値：**

* `MALE`：男性
* `FEMALE`：女性
* `OTHER`：その他
* `UNKNOWN`：不明

***

## AdropConsent

ユーザー同意（GDPR、CCPAなど）を管理するクラス。

### requestConsentInfoUpdate

```typescript theme={null}
static requestConsentInfoUpdate(): Promise<AdropConsentResult>
```

同意情報を更新し、必要に応じて同意ポップアップを表示します。

**戻り値：**

* `Promise<AdropConsentResult>`：同意結果

**例：**

```typescript theme={null}
import { AdropConsent } from 'adrop-ads-react-native'

const result = await AdropConsent.requestConsentInfoUpdate()
console.log('Status:', result.status)
console.log('Can request ads:', result.canRequestAds)
console.log('Can show personalized ads:', result.canShowPersonalizedAds)
```

### getConsentStatus

```typescript theme={null}
static getConsentStatus(): Promise<AdropConsentStatus>
```

現在の同意ステータスを取得します。

**戻り値：**

* `Promise<AdropConsentStatus>`：現在の同意ステータス

**例：**

```typescript theme={null}
const status = await AdropConsent.getConsentStatus()
```

### canRequestAds

```typescript theme={null}
static canRequestAds(): Promise<boolean>
```

現在の同意に基づいて広告をリクエストできるかどうかを確認します。

**戻り値：**

* `Promise<boolean>`：広告をリクエストできるかどうか

**例：**

```typescript theme={null}
const canRequest = await AdropConsent.canRequestAds()
if (canRequest) {
  // 広告をロード
}
```

### reset

```typescript theme={null}
static reset(): void
```

同意設定をリセットします。テストおよびデバッグ目的で使用します。

**例：**

```typescript theme={null}
AdropConsent.reset()
```

### setDebugSettings

```typescript theme={null}
static setDebugSettings(geography: AdropConsentDebugGeography): void
```

同意フローテスト用のデバッグ地域を設定します。DEBUGビルドでのみ動作します。

**パラメータ：**

* `geography` (AdropConsentDebugGeography)：シミュレートする地域

**例：**

```typescript theme={null}
import { AdropConsent, AdropConsentDebugGeography } from 'adrop-ads-react-native'

AdropConsent.setDebugSettings(AdropConsentDebugGeography.EEA)
```

***

## AdropConsentStatus

ユーザー同意ステータスを表す列挙型。

```typescript theme={null}
enum AdropConsentStatus {
  UNKNOWN = 0,
  REQUIRED = 1,
  NOT_REQUIRED = 2,
  OBTAINED = 3,
}
```

**値：**

* `UNKNOWN`：未確定
* `REQUIRED`：同意が必要（ポップアップ表示が必要）
* `NOT_REQUIRED`：同意不要（該当しない地域）
* `OBTAINED`：同意取得済み

***

## AdropConsentResult

同意情報更新の結果を表すインターフェース。

```typescript theme={null}
interface AdropConsentResult {
  status: AdropConsentStatus
  canRequestAds: boolean
  canShowPersonalizedAds: boolean
  error?: string
}
```

**プロパティ：**

* `status` (AdropConsentStatus)：同意ステータス
* `canRequestAds` (boolean)：広告をリクエストできるかどうか
* `canShowPersonalizedAds` (boolean)：パーソナライズ広告を表示できるかどうか
* `error` (string, optional)：エラーメッセージ（ある場合）

***

## AdropConsentDebugGeography

同意テストでデバッグ地域を指定するための列挙型。

```typescript theme={null}
enum AdropConsentDebugGeography {
  DISABLED = 0,
  EEA = 1,
  NOT_EEA = 2, // deprecated - 代わりに OTHER を使用
  REGULATED_US_STATE = 3,
  OTHER = 4,
}
```

**値：**

* `DISABLED`：デバッグ設定なし（実際の場所を使用）
* `EEA`：欧州経済領域（GDPRが適用）
* `NOT_EEA`：*（非推奨 - 代わりに `OTHER` を使用）*
* `REGULATED_US_STATE`：規制対象の米国州（カリフォルニアなど、CCPAが適用）
* `OTHER`：規制対象外の地域

***

## 非推奨API

以下のAPIは非推奨であり、将来のバージョンで削除されます。推奨される代替APIに移行してください。

### AdropAd.destinationUrl

<Warning>
  `destinationUrl`は非推奨です。代わりに`destinationURL`を使用してください。
</Warning>

```typescript theme={null}
// 変更前（非推奨）
const url = ad.destinationUrl

// 変更後
const url = ad.destinationURL
```

### AdropPopupAd.createIds()

<Warning>
  `createIds()`は非推奨です。代わりに`creativeId`を使用してください。
</Warning>

```typescript theme={null}
// 変更前（非推奨）
const ids = popupAd.createIds()

// 変更後
const id = popupAd.creativeId
```

### AdropNativeAd.requestId

<Warning>
  `AdropNativeAd.requestId`は非推奨で、常に空文字列を返します。このプロパティは将来のバージョンで削除されます。
</Warning>

```typescript theme={null}
// 変更前（非推奨）
const reqId = nativeAd.requestId // 常に '' を返す

// 変更後 - requestId の使用を削除
```

### AdropMetrics.logEvent()

<Warning>
  `logEvent()`は非推奨です。代わりに`sendEvent()`を使用してください。
</Warning>

```typescript theme={null}
// 変更前（非推奨）
AdropMetrics.logEvent('purchase', { item_id: 'SKU-001' })

// 変更後
AdropMetrics.sendEvent('purchase', { item_id: 'SKU-001' })
```
