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

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# CampaignCreatorElement

> 광고 캠페인 빌더입니다. 목표와 예산, 타겟팅과 일정이 포함된 광고 그룹, 크리에이티브가 포함된 광고 자체까지 시작에 이르는 전체 흐름을 다룹니다. 새 캠페인을 만들 때는 빈 상태로 열리고, `campaignId`를 전달하면 기존 캠페인으로 열립니다. 픽셀 검사기도 실행합니다. 광고 그룹의 전환 이벤트가 대상 URL에서 활성화되어 있어야 시작할 수 있으며, 누락된 설치를 수정할 수 있도록 이 엘리먼트 안에서 `pixel-setup` 마법사가 열립니다. 또한 계정이 Whop Ads 계약에 서명해야 시작할 수 있습니다. 서명하지 않은 경우 핸들이 빌더 위에 `ads-agreement`를 열고, 서명이 완료되면 시작이 계속 진행됩니다. 예산은 계정의 `ads_reporting_currency`(보고서에서 이미 사용하는 통화)로 입력 및 표시되며, 현재 환율에 따라 USD로 환산되어 청구됩니다. `ads` 핸들에 설정하는 하나의 토큰에는 엘리먼트마다 별도의 토큰을 사용하는 대신 캠페인 스코프와 함께 픽셀 스코프(`ad_campaign:create` 및 `company:basic:read`)가 포함되어야 합니다.

> [!NOTE]
>
> 이 페이지는 `@whop/elements@1.10.0` 및 `@whop/elements-react@1.10.0`을 다룹니다.

*`v1.0.0`부터 사용 가능.*

[`Ads`](https://docs.whop.com/ko/elements/latest/ads/overview)에서 모달로 열립니다: `ads.createOverlay('campaign-creator')`. props와 콜백은 create 옵션으로 전달하세요.

> [!NOTE]
>
> 이 엘리먼트는 **모달 전용**입니다. `createOverlay`로 여세요. 인라인 마운트는 지원하지 않습니다.

```tsx React theme={null}
import { WhopElements, Ads, CampaignCreatorElement } from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

function Example() {
  return (
    <WhopElements elements={loadWhop()}>
      <Ads /* options */>
        <CampaignCreatorElement onExited={(e) => console.log(e)} onLaunched={(e) => console.log(e)} />
      </Ads>
    </WhopElements>
  );
}
```

```html JavaScript theme={null}
<script src="https://cdn.whop.com/elements/amber/elements.js" data-whop-elements></script>
<script type="module">
  const ads = window.WhopElements().ads.create({ /* options */ });
  ads.createOverlay('campaign-creator', {
    onExited: (e) => console.log(e),
    onLaunched: (e) => console.log(e)
  }).open();
</script>
```

예시 데이터입니다. [플레이그라운드 열기](https://docs.whop.com/ko/elements/latest/ads/overview#playground).

## 속성(Props)

**campaignId** `string`

열 캠페인(`adcamp_…`)입니다. 비어 있으면 새 캠페인을 빌드합니다. 초안은 마지막으로 작업한 곳에서 열리고, 시작된 캠페인은 편집 모드로 열립니다. 기본값은 `""`입니다.

**adGroupId** `string`

`campaignId` 안에서 포커스해 열 광고 그룹(`adgrp_…`)입니다. 캠페인에 해당 그룹이 없거나 `campaignId`가 비어 있으면 무시됩니다. 기본값은 `""`입니다.

**adId** `string`

`adGroupId` 안에서 포커스해 열 광고(`ad_…`)입니다. 해당 그룹에 그런 광고가 없거나 `adGroupId`가 비어 있으면 무시됩니다. 기본값은 `""`입니다.

**initialStep** `"ads" | "ad-groups" | "campaign-settings"`

처음 열 단계입니다: `campaign-settings`, `ad-groups` 또는 `ads`. 대시보드는 자체 URL에서 이 값으로 딥 링크합니다. 계정 소유자가 변경하려는 부분으로 바로 이동시키려면 이 값을 전달하세요. 마운트 시 한 번만 읽으므로, 나중에 값을 바꿔도 단계 사이를 이동하지 않습니다. 기본값은 `"campaign-settings"`입니다.

**externalMediaIds** `string[]`

앱이 `POST /api/v1/files`로 업로드한 파일 ID(`file_…`)로, 빌더의 크리에이티브 라이브러리에 제공됩니다. 라이브러리 목록에 이 순서대로 먼저 표시되며, 하나라도 설정되어 있으면 미디어 선택기가 업로드 드롭 영역 대신 라이브러리로 열립니다. `ads` 핸들의 `accessToken`을 발급하는 것과 같은 API 키로 파일을 만드세요. 빌더는 파일을 한 번의 배치(`GET /api/v1/files`)로 다시 읽으며, 파일 읽기는 해당 파일을 만든 자격 증명에만 응답합니다. 배치 읽기 제한인 최대 250개의 ID를 전달하세요. 파일은 업로드 처리가 완료되면 표시됩니다. 처리가 끝나지 않거나 이미지나 동영상이 아닌 대상을 가리키는 ID는 제외됩니다. 이미 열려 있는 빌더에 미디어를 추가하려면 `update({ externalMediaIds })`로 새 ID를 전달하세요. 기본값은 `[]`입니다.

## 이벤트

콜백은 create 옵션 또는 React props로 전달하세요.

### `onExited`

계정 소유자가 시작하지 않고 빌더에서 나갔습니다. 버려진 것은 없습니다. 초안 캠페인을 시작했다면 이미 저장되어 있습니다. 이 이벤트가 발생할 때쯤 오버레이는 이미 스스로 닫혀 있습니다. 페이지에서 필요하면 이에 대응하세요.

### `onLaunched`

캠페인이 라이브 상태가 되었습니다. `firstLaunch`는 계정이 처음으로 시작한 캠페인임을 나타내며, 대시보드는 이를 사용해 환영 상태를 표시합니다. 오버레이는 이미 스스로 닫혀 있으므로, 여기서 다음 화면으로 이동하세요.

**payload** `object`

**properties**

**campaignId** `string` *required*

**firstLaunch** `boolean` *required*

### `onLoaderStart`

로딩 스켈레톤이 처음 그려진 후, `onReady` 전에 실행됩니다.

### `onReady`

엘리먼트가 처음으로 완전히 그려진 후 실행됩니다.

### `onError`

엘리먼트가 로드에 실패하거나 충돌할 때 실행됩니다. 대체 화면은 계속 표시됩니다. 프로그래밍 방식 처리에는 `code`를 사용하세요. `sourceKey`는 실패한 호스트 상태 소스를 식별합니다.

**e** `object`

**properties**

**message** `string` *required*

**code** `string`

**sourceKey** `string`

## 메서드

`create`가 반환한 핸들에서 또는 React `ref`를 통해 호출하세요.

### `mount`

엘리먼트를 `target`에 마운트하고 로딩을 시작합니다. React 컴포넌트는 스스로 마운트됩니다.

**매개변수**

**target** `string | HTMLElement` *required*

### `destroy`

엘리먼트를 제거하고 프레임과 구독을 해제합니다. 여러 번 호출해도 됩니다. React는 엘리먼트를 자동으로 제거합니다.

### `update`

마운트된 엘리먼트에 새 props를 병합합니다. React에서는 대신 컴포넌트 props를 변경하세요.

**매개변수**

**options** `Partial\<CampaignCreatorElementProps\>` *required*

## 스타일링

다음 파트는 `appearance.classes`로 스타일을 지정하세요. 속성 이름에는 camel case 또는 kebab case를 사용하고 단위를 포함하세요. 페이지 스타일시트는 엘리먼트의 프레임에 닿을 수 없습니다. 프레임워크는 주입하기 전에 각 선언을 검증합니다.

| 클래스 | 대상 |
| - | - |
| `.whop-PixelSetupSurface` | 픽셀 설정 마법사 루트. 한 번에 한 단계씩 |

```ts theme={null}
const ads = whop.ads.create({
  appearance: {
    classes: {
      'whop-PixelSetupSurface': { borderRadius: '8px', fontWeight: '600' }
    }
  }
});

ads.update({
  appearance: {
    classes: { 'whop-PixelSetupSurface': { fontWeight: '700' } }
  }
});
```

React에서는 `<Ads>`에 `appearance`를 전달하세요. 전역으로 설정하려면 `WhopElements({ appearance })`를 사용하세요.


## Related topics

- [광고](https://docs.whop.com/ko/elements/latest/ads/overview.md)
- [AdsAgreementElement](https://docs.whop.com/ko/elements/latest/ads/ads-agreement.md)
- [Ad campaign updated](https://docs.whop.com/ko/api-reference/ad-campaigns/ad-campaign-updated.md)
