adyou 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,11 @@ export declare class GoogleConnector implements Connector {
14
14
  private search;
15
15
  listAccessible(): Promise<string[]>;
16
16
  account(): Promise<AccountInfo>;
17
+ /** 이 커넥터의 customerId(= MCC · loginCustomerId 도 MCC) 아래 하위 광고 계정 만들기 — 대행 모드 고객당 계정. 실측(2026-09-25): SA 가 MCC 에서 ADMIN 이어야 함(STANDARD 면 ACTION_NOT_PERMITTED) ·
18
+ * 계정은 삭제 불가(화면에서 해지만) · 🔴 결제 연결은 API 불가(billingSetups → NO_SIGNUP_PERMISSION · SA 는 결제 프로필 사용자가 될 수 없음) → 운영자가 화면에서 결제 프로필을 붙인다. */
19
+ createClientAccount(name: string, currency?: string, timeZone?: string): Promise<string>;
20
+ /** 결제가 연결돼 광고가 나갈 수 있는 계정인지(billing_setup APPROVED) */
21
+ billingApproved(): Promise<boolean>;
17
22
  check(): Promise<CheckItem[]>;
18
23
  inventory(): Promise<InventoryRow[]>;
19
24
  private uploadImage;
@@ -34,7 +34,8 @@ export class GoogleConnector {
34
34
  const headers = { authorization: `Bearer ${await this.accessToken()}`, 'content-type': 'application/json' };
35
35
  if (this.c.loginCustomerId)
36
36
  headers['login-customer-id'] = this.c.loginCustomerId;
37
- const res = await fetch(`${API}/customers/${cid}/${path}`, { method: 'POST', headers, body: JSON.stringify(body), signal: AbortSignal.timeout(120_000) });
37
+ // `:createCustomerClient` 처럼 콜론으로 시작하는 메서드는 고객 경로에 바로 붙는다(슬래시 없음)
38
+ const res = await fetch(`${API}/customers/${cid}${path.startsWith(':') ? '' : '/'}${path}`, { method: 'POST', headers, body: JSON.stringify(body), signal: AbortSignal.timeout(120_000) });
38
39
  const data = (await res.json().catch(() => ({})));
39
40
  if (!res.ok || data.error)
40
41
  throw this.wrap(data.error, path);
@@ -82,6 +83,20 @@ export class GoogleConnector {
82
83
  throw new MediumError('google', '고객 정보를 읽지 못했어요');
83
84
  return { id: c.id, name: c.descriptiveName || c.id, currency: c.currencyCode, timezone: c.timeZone, status: c.status, extra: { manager: c.manager } };
84
85
  }
86
+ /** 이 커넥터의 customerId(= MCC · loginCustomerId 도 MCC) 아래 하위 광고 계정 만들기 — 대행 모드 고객당 계정. 실측(2026-09-25): SA 가 MCC 에서 ADMIN 이어야 함(STANDARD 면 ACTION_NOT_PERMITTED) ·
87
+ * 계정은 삭제 불가(화면에서 해지만) · 🔴 결제 연결은 API 불가(billingSetups → NO_SIGNUP_PERMISSION · SA 는 결제 프로필 사용자가 될 수 없음) → 운영자가 화면에서 결제 프로필을 붙인다. */
88
+ async createClientAccount(name, currency = 'KRW', timeZone = 'Asia/Seoul') {
89
+ const d = await this.call(':createCustomerClient', { customerClient: { descriptiveName: name.slice(0, 100), currencyCode: currency, timeZone } });
90
+ const id = d.resourceName?.split('/')[1];
91
+ if (!id)
92
+ throw new MediumError('google', '하위 계정 ID 를 받지 못했어요');
93
+ return id;
94
+ }
95
+ /** 결제가 연결돼 광고가 나갈 수 있는 계정인지(billing_setup APPROVED) */
96
+ async billingApproved() {
97
+ const rows = await this.search('SELECT billing_setup.status FROM billing_setup');
98
+ return rows.some((r) => r.billingSetup.status === 'APPROVED');
99
+ }
85
100
  async check() {
86
101
  const items = [];
87
102
  let accessible = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adyou",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "ADYou — 대행사 없이, 당신이 직접. 사이트 주소 하나로 광고 소재·매체 등록·자동 운영·보고까지: AI 광고 자율주행 CLI + MCP 서버(Meta·Google · 생성은 항상 PAUSED · 승인 뒤 시작)",
5
5
  "type": "module",
6
6
  "license": "MIT",