agentref 5.0.1 → 5.0.2

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.
package/CHANGELOG.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- - Removed obsolete merchant-scoped integration methods from the active SDK surface.
6
- - Aligned `merchant.get()` / `merchant.update()` types with the final merchant profile contract.
7
- - Added program-scoped integration methods on `programs`: Stripe connect/disconnect and domain verification/status/removal.
8
- - Added `webhooks` resource with list/create/get/update/delete/rotate-secret support.
5
+ ## 5.0.2
6
+
7
+ - Switched the default API host to `https://www.agentref.co/api/v1`.
8
+ - Removed stale domain-verification exports and legacy tracking fallback fields from the public SDK contract.
9
+ - Updated tests and README to match the active API surface and supported key prefixes.
9
10
 
10
11
  ## 1.0.5
11
12
 
package/README.md CHANGED
@@ -21,14 +21,14 @@ console.log(programs.meta.requestId)
21
21
  ## Authentication
22
22
 
23
23
  - API key is sent as `Authorization: Bearer <key>`.
24
- - Supported key prefixes: `ak_live_*`, `ak_aff_*`.
24
+ - Supported key prefixes: `ak_onb_*`, `ak_live_*`, `ak_aff_*`.
25
25
  - You can pass `apiKey` directly or use `AGENTREF_API_KEY`.
26
26
  - Default behavior hard-fails in browser contexts to prevent API key exposure.
27
27
 
28
28
  ## Resources
29
29
 
30
30
  - `client.programs`
31
- - `list`, `listAll`, `get`, `create`, `update`, `delete`, `stats`, `listAffiliates`, `listCoupons`, `createCoupon`, `deleteCoupon`, `listInvites`, `createInvite`, `updateMarketplace`, `connectStripe`, `disconnectStripe`, `verifyDomain`, `removeDomainVerification`, `getDomainStatus`
31
+ - `list`, `listAll`, `get`, `create`, `update`, `delete`, `stats`, `listAffiliates`, `listCoupons`, `createCoupon`, `deleteCoupon`, `listInvites`, `createInvite`, `updateMarketplace`, `connectStripe`, `disconnectStripe`
32
32
  - `client.affiliates`
33
33
  - `list`, `get`, `approve`, `block`, `unblock`
34
34
  - `client.conversions`
@@ -94,7 +94,7 @@ try {
94
94
  | Option | Default | Description |
95
95
  |---|---|---|
96
96
  | `apiKey` | `process.env.AGENTREF_API_KEY` | API key |
97
- | `baseUrl` | `https://www.agentref.dev/api/v1` | Base API URL |
97
+ | `baseUrl` | `https://www.agentref.co/api/v1` | Base API URL |
98
98
  | `timeout` | `30000` | Request timeout in ms |
99
99
  | `maxRetries` | `2` | Retry count for GET/HEAD and POST+idempotencyKey |
100
100
  | `dangerouslyAllowBrowser` | `false` | Allows browser initialization (unsafe) |
package/dist/index.cjs CHANGED
@@ -90,10 +90,10 @@ var ServerError = class extends AgentRefError {
90
90
 
91
91
  // src/http.ts
92
92
  var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
93
- var DEFAULT_BASE_URL = "https://www.agentref.dev/api/v1";
93
+ var DEFAULT_BASE_URL = "https://www.agentref.co/api/v1";
94
94
  var DEFAULT_TIMEOUT = 3e4;
95
95
  var DEFAULT_MAX_RETRIES = 2;
96
- var VERSION = true ? "5.0.1" : "0.0.0";
96
+ var VERSION = true ? "5.0.2" : "0.0.0";
97
97
  function hasUsableIdempotencyKey(idempotencyKey) {
98
98
  return typeof idempotencyKey === "string" && idempotencyKey.trim().length > 0;
99
99
  }
@@ -550,28 +550,6 @@ var ProgramsResource = class {
550
550
  });
551
551
  return envelope.data;
552
552
  }
553
- async verifyDomain(id, data) {
554
- const envelope = await this.http.request({
555
- method: "POST",
556
- path: `/programs/${id}/verify-domain`,
557
- body: data
558
- });
559
- return envelope.data;
560
- }
561
- async removeDomainVerification(id) {
562
- const envelope = await this.http.request({
563
- method: "DELETE",
564
- path: `/programs/${id}/verify-domain`
565
- });
566
- return envelope.data;
567
- }
568
- async getDomainStatus(id) {
569
- const envelope = await this.http.request({
570
- method: "GET",
571
- path: `/programs/${id}/verify-domain/status`
572
- });
573
- return envelope.data;
574
- }
575
553
  };
576
554
 
577
555
  // src/resources/webhooks.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/http.ts","../src/resources/affiliates.ts","../src/resources/billing.ts","../src/resources/conversions.ts","../src/resources/flags.ts","../src/resources/merchant.ts","../src/resources/payouts.ts","../src/resources/programs.ts","../src/resources/webhooks.ts","../src/client.ts"],"sourcesContent":["export { AgentRef } from './client.js'\nexport {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nexport type {\n AgentRefConfig,\n Affiliate,\n AffiliateSortBy,\n AffiliateStatus,\n BillingStatus,\n BillingTier,\n BillingTierId,\n CommissionType,\n CreateInviteParams,\n CreatePayoutParams,\n Conversion,\n ConversionStats,\n ConversionStatus,\n Coupon,\n CreateCouponParams,\n CreateProgramParams,\n Flag,\n FlagStats,\n FlagStatus,\n FlagType,\n Invite,\n Merchant,\n MutationOptions,\n NotificationPreferences,\n PaginatedResponse,\n PaginationMeta,\n PayoutInfo,\n PendingAffiliate,\n Payout,\n ProgramMarketplaceVisibility,\n ProgramMarketplaceStatus,\n ProgramReadiness,\n ProgramDetail,\n PayoutStats,\n PayoutStatus,\n Program,\n ProgramStats,\n ProgramStatus,\n SortOrder,\n UpdateMerchantParams,\n UpdateNotificationPreferencesParams,\n UpdatePayoutInfoParams,\n UpdateProgramMarketplaceParams,\n ResolveFlagParams,\n UpdateProgramParams,\n BillingRequirementStatus,\n ConnectProgramStripeParams,\n ConnectProgramStripeResponse,\n DisconnectProgramStripeResponse,\n ProgramDomainVerificationInitResponse,\n ProgramDomainVerificationStatusResponse,\n StripeConnectMethod,\n SuccessResponse,\n WebhookEventType,\n WebhookEndpoint,\n WebhookEndpointStatus,\n CreateWebhookEndpointParams,\n UpdateWebhookEndpointParams,\n WebhookSecretResponse,\n} from './types/index.js'\n","export class AgentRefError extends Error {\n readonly code: string\n readonly status: number\n readonly requestId: string\n\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message)\n this.name = 'AgentRefError'\n this.code = code\n this.status = status\n this.requestId = requestId\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\nexport class AuthError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 401, requestId)\n this.name = 'AuthError'\n }\n}\n\nexport class ForbiddenError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 403, requestId)\n this.name = 'ForbiddenError'\n }\n}\n\nexport class ValidationError extends AgentRefError {\n readonly details: unknown\n\n constructor(message: string, code: string, requestId: string, details?: unknown) {\n super(message, code, 400, requestId)\n this.name = 'ValidationError'\n this.details = details\n }\n}\n\nexport class NotFoundError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 404, requestId)\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 409, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends AgentRefError {\n readonly retryAfter: number\n\n constructor(message: string, code: string, requestId: string, retryAfter: number) {\n super(message, code, 429, requestId)\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class ServerError extends AgentRefError {\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message, code, status, requestId)\n this.name = 'ServerError'\n }\n}\n","import {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nimport type { AgentRefConfig } from './types/index.js'\n\nexport type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n\nconst SAFE_METHODS: ReadonlySet<HttpMethod> = new Set(['GET', 'HEAD'])\n\nexport interface RequestOptions {\n method: HttpMethod\n path: string\n body?: unknown\n query?: Record<string, string | number | boolean | undefined>\n idempotencyKey?: string\n}\n\nconst DEFAULT_BASE_URL = 'https://www.agentref.dev/api/v1'\nconst DEFAULT_TIMEOUT = 30_000\nconst DEFAULT_MAX_RETRIES = 2\n\ndeclare const __SDK_VERSION__: string\nconst VERSION = typeof __SDK_VERSION__ === 'string' ? __SDK_VERSION__ : '0.0.0'\n\nfunction hasUsableIdempotencyKey(idempotencyKey: string | undefined): boolean {\n return typeof idempotencyKey === 'string' && idempotencyKey.trim().length > 0\n}\n\nexport class HttpClient {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n private readonly maxRetries: number\n\n constructor(config: AgentRefConfig = {}) {\n if (typeof window !== 'undefined' && !config.dangerouslyAllowBrowser) {\n throw new Error(\n '[AgentRef] Refusing to initialize in browser context. API keys must not be exposed client-side. Use a server-side proxy to call the AgentRef API instead. To override: set dangerouslyAllowBrowser: true (understand the security implications first).'\n )\n }\n\n const apiKey = config.apiKey ?? process.env['AGENTREF_API_KEY']\n if (!apiKey) {\n throw new Error(\n '[AgentRef] API key is required. Pass it as apiKey or set the AGENTREF_API_KEY environment variable.'\n )\n }\n\n this.apiKey = apiKey\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '')\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT\n this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES\n }\n\n async request<T>(options: RequestOptions): Promise<T> {\n const url = this.buildUrl(options.path, options.query)\n const isSafe = SAFE_METHODS.has(options.method)\n const hasIdempotency = options.method === 'POST' && hasUsableIdempotencyKey(options.idempotencyKey)\n const canRetry = isSafe || hasIdempotency\n const maxAttempts = canRetry ? this.maxRetries + 1 : 1\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n let response: Response\n\n try {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `agentref-node/${VERSION}`,\n }\n\n if (hasIdempotency) {\n headers['Idempotency-Key'] = options.idempotencyKey!.trim()\n }\n\n response = await fetch(url, {\n method: options.method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal: AbortSignal.timeout(this.timeout),\n })\n } catch (error) {\n if (canRetry && attempt < maxAttempts - 1) {\n await this.wait(this.backoff(attempt))\n continue\n }\n throw error\n }\n\n if (!response.ok) {\n const parsedError = await this.parseError(response)\n\n if (canRetry && this.isRetryable(response.status) && attempt < maxAttempts - 1) {\n const delay =\n response.status === 429\n ? this.retryAfterToMs(response.headers.get('Retry-After'))\n : this.backoff(attempt)\n await this.wait(delay)\n continue\n }\n\n throw parsedError\n }\n\n return response.json() as Promise<T>\n }\n\n throw new ServerError('Request failed after retries', 'REQUEST_RETRY_EXHAUSTED', 500, '')\n }\n\n private buildUrl(path: string, query?: Record<string, string | number | boolean | undefined>): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const url = new URL(`${this.baseUrl}${normalizedPath}`)\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value))\n }\n }\n }\n\n return url.toString()\n }\n\n private async parseError(response: Response): Promise<AgentRefError> {\n const json = (await response.json().catch(() => ({}))) as {\n error?: { code?: string; message?: string; details?: unknown }\n meta?: { requestId?: string }\n }\n\n const code = json.error?.code ?? 'UNKNOWN_ERROR'\n const message = json.error?.message ?? response.statusText\n const requestId = json.meta?.requestId ?? ''\n const details = json.error?.details\n\n if (response.status === 400) return new ValidationError(message, code, requestId, details)\n if (response.status === 401) return new AuthError(message, code, requestId)\n if (response.status === 403) return new ForbiddenError(message, code, requestId)\n if (response.status === 404) return new NotFoundError(message, code, requestId)\n if (response.status === 409) return new ConflictError(message, code, requestId)\n if (response.status === 429) {\n return new RateLimitError(message, code, requestId, this.retryAfterToSeconds(response.headers.get('Retry-After')))\n }\n\n return new ServerError(message, code, response.status, requestId)\n }\n\n private isRetryable(status: number): boolean {\n return status === 429 || status >= 500\n }\n\n private retryAfterToSeconds(headerValue: string | null): number {\n if (!headerValue) return 60\n\n const numericSeconds = Number(headerValue)\n if (!Number.isNaN(numericSeconds) && numericSeconds >= 0) {\n return Math.ceil(numericSeconds)\n }\n\n const asDate = Date.parse(headerValue)\n if (!Number.isNaN(asDate)) {\n const deltaMs = asDate - Date.now()\n return Math.max(0, Math.ceil(deltaMs / 1000))\n }\n\n return 60\n }\n\n private retryAfterToMs(headerValue: string | null): number {\n return this.retryAfterToSeconds(headerValue) * 1000\n }\n\n private wait(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms)\n })\n }\n\n private backoff(attempt: number): number {\n return 500 * Math.pow(2, attempt)\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Affiliate, AffiliateSortBy, AffiliateStatus, MutationOptions, PaginatedResponse, SortOrder } from '../types/index.js'\n\nexport class AffiliatesResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n includeBlocked?: boolean\n search?: string\n sortBy?: AffiliateSortBy\n sortOrder?: SortOrder\n status?: AffiliateStatus\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({ method: 'GET', path: '/affiliates', query: params })\n }\n\n async get(id: string, options?: { include?: 'stats' }): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'GET',\n path: `/affiliates/${id}`,\n query: options?.include ? { include: options.include } : undefined,\n })\n return envelope.data\n }\n\n async approve(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/approve`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async block(id: string, data?: { reason?: string }, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/block`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async unblock(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/unblock`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { BillingStatus, BillingTier, MutationOptions } from '../types/index.js'\n\nexport class BillingResource {\n constructor(private readonly http: HttpClient) {}\n\n async current(): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'GET',\n path: '/billing',\n })\n return envelope.data\n }\n\n async tiers(): Promise<BillingTier[]> {\n const envelope = await this.http.request<{ data: BillingTier[]; meta: unknown }>({\n method: 'GET',\n path: '/billing/tiers',\n })\n return envelope.data\n }\n\n async subscribe(data: { tier: 'starter' | 'growth' | 'pro' | 'scale' }, options?: MutationOptions): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'POST',\n path: '/billing/subscribe',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Conversion, ConversionStats, PaginatedResponse } from '../types/index.js'\n\nexport class ConversionsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: string\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Conversion>> {\n return this.http.request({ method: 'GET', path: '/conversions', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<ConversionStats> {\n const envelope = await this.http.request<{ data: ConversionStats; meta: unknown }>({\n method: 'GET',\n path: '/conversions/stats',\n query: params,\n })\n return envelope.data\n }\n\n async recent(params?: { limit?: number }): Promise<Conversion[]> {\n const envelope = await this.http.request<{ data: Conversion[]; meta: unknown }>({\n method: 'GET',\n path: '/conversions/recent',\n query: params,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Flag, FlagStats, MutationOptions, PaginatedResponse, ResolveFlagParams } from '../types/index.js'\n\nexport class FlagsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n status?: string\n type?: string\n affiliateId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Flag>> {\n return this.http.request({ method: 'GET', path: '/flags', query: params })\n }\n\n async stats(): Promise<FlagStats> {\n const envelope = await this.http.request<{ data: FlagStats; meta: unknown }>({\n method: 'GET',\n path: '/flags/stats',\n })\n return envelope.data\n }\n\n async resolve(id: string, data: ResolveFlagParams, options?: MutationOptions): Promise<Flag> {\n const envelope = await this.http.request<{ data: Flag; meta: unknown }>({\n method: 'POST',\n path: `/flags/${id}/resolve`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Merchant,\n NotificationPreferences,\n PayoutInfo,\n UpdateMerchantParams,\n UpdateNotificationPreferencesParams,\n UpdatePayoutInfoParams,\n} from '../types/index.js'\n\nexport class MerchantResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'GET',\n path: '/merchant',\n })\n return envelope.data\n }\n\n async update(data: UpdateMerchantParams): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'PATCH',\n path: '/merchant',\n body: data,\n })\n return envelope.data\n }\n\n async getPayoutInfo(): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'GET',\n path: '/me/payout-info',\n })\n return envelope.data\n }\n\n async updatePayoutInfo(data: UpdatePayoutInfoParams): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'PATCH',\n path: '/me/payout-info',\n body: data,\n })\n return envelope.data\n }\n\n async getNotifications(): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'GET',\n path: '/merchant/notifications',\n })\n return envelope.data\n }\n\n async updateNotifications(data: UpdateNotificationPreferencesParams): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'PUT',\n path: '/merchant/notifications',\n body: data,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { CreatePayoutParams, MutationOptions, PaginatedResponse, PendingAffiliate, Payout, PayoutStats, PayoutStatus } from '../types/index.js'\n\nexport class PayoutsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: PayoutStatus\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Payout>> {\n return this.http.request({ method: 'GET', path: '/payouts', query: params })\n }\n\n listPending(params?: {\n programId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<PendingAffiliate>> {\n return this.http.request({ method: 'GET', path: '/payouts/pending', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<PayoutStats> {\n const envelope = await this.http.request<{ data: PayoutStats; meta: unknown }>({\n method: 'GET',\n path: '/payouts/stats',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreatePayoutParams, options?: MutationOptions): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'POST',\n path: '/payouts',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Affiliate,\n Coupon,\n ConnectProgramStripeParams,\n ConnectProgramStripeResponse,\n CreateCouponParams,\n CreateInviteParams,\n CreateProgramParams,\n DisconnectProgramStripeResponse,\n Invite,\n MutationOptions,\n PaginatedResponse,\n Program,\n ProgramDetail,\n ProgramDomainVerificationInitResponse,\n ProgramDomainVerificationStatusResponse,\n ProgramStats,\n SuccessResponse,\n ProgramStatus,\n UpdateProgramMarketplaceParams,\n UpdateProgramParams,\n} from '../types/index.js'\n\nexport class ProgramsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n status?: ProgramStatus\n }): Promise<PaginatedResponse<Program>> {\n return this.http.request({ method: 'GET', path: '/programs', query: params })\n }\n\n async *listAll(params?: {\n pageSize?: number\n }): AsyncGenerator<Program> {\n let page = 1\n const pageSize = params?.pageSize ?? 100\n\n while (true) {\n const response = await this.list({ page, limit: pageSize })\n yield* response.data\n\n if (!response.meta.hasMore) {\n break\n }\n\n page += 1\n }\n }\n\n async get(id: string): Promise<ProgramDetail> {\n const envelope = await this.http.request<{ data: ProgramDetail; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async create(data: CreateProgramParams, options?: MutationOptions): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'POST',\n path: '/programs',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateProgramParams): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async stats(id: string, params?: { period?: string }): Promise<ProgramStats> {\n const envelope = await this.http.request<{ data: ProgramStats; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/stats`,\n query: params,\n })\n return envelope.data\n }\n\n listAffiliates(\n id: string,\n params?: { includeBlocked?: boolean; cursor?: string; limit?: number; page?: number; pageSize?: number; offset?: number }\n ): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({\n method: 'GET',\n path: `/programs/${id}/affiliates`,\n query: params,\n })\n }\n\n async listCoupons(id: string): Promise<Coupon[]> {\n const envelope = await this.http.request<{ data: Coupon[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/coupons`,\n })\n return envelope.data\n }\n\n async createCoupon(id: string, data: CreateCouponParams, options?: MutationOptions): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/coupons`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async createInvite(\n id: string,\n data: CreateInviteParams,\n options?: MutationOptions\n ): Promise<Invite> {\n const envelope = await this.http.request<{ data: Invite; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/invites`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async listInvites(id: string): Promise<Invite[]> {\n const envelope = await this.http.request<{ data: Invite[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/invites`,\n })\n return envelope.data\n }\n\n async deleteCoupon(couponId: string): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'DELETE',\n path: `/coupons/${couponId}`,\n })\n return envelope.data\n }\n\n async updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}/marketplace`,\n body: data,\n })\n return envelope.data\n }\n\n async connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: ConnectProgramStripeResponse; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/connect-stripe`,\n body: data,\n })\n return envelope.data\n }\n\n async disconnectStripe(id: string): Promise<DisconnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: DisconnectProgramStripeResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}/connect-stripe`,\n })\n return envelope.data\n }\n\n async verifyDomain(id: string, data: { domain: string }): Promise<ProgramDomainVerificationInitResponse> {\n const envelope = await this.http.request<{ data: ProgramDomainVerificationInitResponse; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/verify-domain`,\n body: data,\n })\n return envelope.data\n }\n\n async removeDomainVerification(id: string): Promise<SuccessResponse> {\n const envelope = await this.http.request<{ data: SuccessResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}/verify-domain`,\n })\n return envelope.data\n }\n\n async getDomainStatus(id: string): Promise<ProgramDomainVerificationStatusResponse> {\n const envelope = await this.http.request<{ data: ProgramDomainVerificationStatusResponse; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/verify-domain/status`,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n CreateWebhookEndpointParams,\n SuccessResponse,\n UpdateWebhookEndpointParams,\n WebhookEndpoint,\n WebhookSecretResponse,\n} from '../types/index.js'\n\nexport class WebhooksResource {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: { programId?: string }): Promise<WebhookEndpoint[]> {\n const envelope = await this.http.request<{ data: WebhookEndpoint[]; meta: unknown }>({\n method: 'GET',\n path: '/webhooks',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreateWebhookEndpointParams): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: '/webhooks',\n body: data,\n })\n return envelope.data\n }\n\n async get(id: string): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'GET',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateWebhookEndpointParams): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'PATCH',\n path: `/webhooks/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<SuccessResponse> {\n const envelope = await this.http.request<{ data: SuccessResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async rotateSecret(id: string): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: `/webhooks/${id}/rotate-secret`,\n })\n return envelope.data\n }\n}\n","import { HttpClient } from './http.js'\nimport type { AgentRefConfig } from './types/index.js'\nimport { AffiliatesResource } from './resources/affiliates.js'\nimport { BillingResource } from './resources/billing.js'\nimport { ConversionsResource } from './resources/conversions.js'\nimport { FlagsResource } from './resources/flags.js'\nimport { MerchantResource } from './resources/merchant.js'\nimport { PayoutsResource } from './resources/payouts.js'\nimport { ProgramsResource } from './resources/programs.js'\nimport { WebhooksResource } from './resources/webhooks.js'\n\nexport class AgentRef {\n readonly programs: ProgramsResource\n readonly affiliates: AffiliatesResource\n readonly conversions: ConversionsResource\n readonly payouts: PayoutsResource\n readonly flags: FlagsResource\n readonly billing: BillingResource\n readonly merchant: MerchantResource\n readonly webhooks: WebhooksResource\n\n constructor(config?: AgentRefConfig) {\n const http = new HttpClient(config)\n\n this.programs = new ProgramsResource(http)\n this.affiliates = new AffiliatesResource(http)\n this.conversions = new ConversionsResource(http)\n this.payouts = new PayoutsResource(http)\n this.flags = new FlagsResource(http)\n this.billing = new BillingResource(http)\n this.merchant = new MerchantResource(http)\n this.webhooks = new WebhooksResource(http)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAKvC,YAAY,SAAiB,MAAc,QAAgB,WAAmB;AAC5E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAEO,IAAM,YAAN,cAAwB,cAAc;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ts","../src/resources/affiliates.ts","../src/resources/billing.ts","../src/resources/conversions.ts","../src/resources/flags.ts","../src/resources/merchant.ts","../src/resources/payouts.ts","../src/resources/programs.ts","../src/resources/webhooks.ts","../src/client.ts"],"sourcesContent":["export { AgentRef } from './client.js'\nexport {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nexport type {\n AgentRefConfig,\n Affiliate,\n AffiliateSortBy,\n AffiliateStatus,\n BillingStatus,\n BillingTier,\n BillingTierId,\n CommissionType,\n CreateInviteParams,\n CreatePayoutParams,\n Conversion,\n ConversionStats,\n ConversionStatus,\n Coupon,\n CreateCouponParams,\n CreateProgramParams,\n Flag,\n FlagStats,\n FlagStatus,\n FlagType,\n Invite,\n Merchant,\n MutationOptions,\n NotificationPreferences,\n PaginatedResponse,\n PaginationMeta,\n PayoutInfo,\n PendingAffiliate,\n Payout,\n ProgramMarketplaceVisibility,\n ProgramMarketplaceStatus,\n ProgramReadiness,\n ProgramDetail,\n PayoutStats,\n PayoutStatus,\n Program,\n ProgramStats,\n ProgramStatus,\n SortOrder,\n UpdateMerchantParams,\n UpdateNotificationPreferencesParams,\n UpdatePayoutInfoParams,\n UpdateProgramMarketplaceParams,\n ResolveFlagParams,\n UpdateProgramParams,\n BillingRequirementStatus,\n ConnectProgramStripeParams,\n ConnectProgramStripeResponse,\n DisconnectProgramStripeResponse,\n StripeConnectMethod,\n SuccessResponse,\n WebhookEventType,\n WebhookEndpoint,\n WebhookEndpointStatus,\n CreateWebhookEndpointParams,\n UpdateWebhookEndpointParams,\n WebhookSecretResponse,\n} from './types/index.js'\n","export class AgentRefError extends Error {\n readonly code: string\n readonly status: number\n readonly requestId: string\n\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message)\n this.name = 'AgentRefError'\n this.code = code\n this.status = status\n this.requestId = requestId\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\nexport class AuthError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 401, requestId)\n this.name = 'AuthError'\n }\n}\n\nexport class ForbiddenError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 403, requestId)\n this.name = 'ForbiddenError'\n }\n}\n\nexport class ValidationError extends AgentRefError {\n readonly details: unknown\n\n constructor(message: string, code: string, requestId: string, details?: unknown) {\n super(message, code, 400, requestId)\n this.name = 'ValidationError'\n this.details = details\n }\n}\n\nexport class NotFoundError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 404, requestId)\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 409, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends AgentRefError {\n readonly retryAfter: number\n\n constructor(message: string, code: string, requestId: string, retryAfter: number) {\n super(message, code, 429, requestId)\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class ServerError extends AgentRefError {\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message, code, status, requestId)\n this.name = 'ServerError'\n }\n}\n","import {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nimport type { AgentRefConfig } from './types/index.js'\n\nexport type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n\nconst SAFE_METHODS: ReadonlySet<HttpMethod> = new Set(['GET', 'HEAD'])\n\nexport interface RequestOptions {\n method: HttpMethod\n path: string\n body?: unknown\n query?: Record<string, string | number | boolean | undefined>\n idempotencyKey?: string\n}\n\nconst DEFAULT_BASE_URL = 'https://www.agentref.co/api/v1'\nconst DEFAULT_TIMEOUT = 30_000\nconst DEFAULT_MAX_RETRIES = 2\n\ndeclare const __SDK_VERSION__: string\nconst VERSION = typeof __SDK_VERSION__ === 'string' ? __SDK_VERSION__ : '0.0.0'\n\nfunction hasUsableIdempotencyKey(idempotencyKey: string | undefined): boolean {\n return typeof idempotencyKey === 'string' && idempotencyKey.trim().length > 0\n}\n\nexport class HttpClient {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n private readonly maxRetries: number\n\n constructor(config: AgentRefConfig = {}) {\n if (typeof window !== 'undefined' && !config.dangerouslyAllowBrowser) {\n throw new Error(\n '[AgentRef] Refusing to initialize in browser context. API keys must not be exposed client-side. Use a server-side proxy to call the AgentRef API instead. To override: set dangerouslyAllowBrowser: true (understand the security implications first).'\n )\n }\n\n const apiKey = config.apiKey ?? process.env['AGENTREF_API_KEY']\n if (!apiKey) {\n throw new Error(\n '[AgentRef] API key is required. Pass it as apiKey or set the AGENTREF_API_KEY environment variable.'\n )\n }\n\n this.apiKey = apiKey\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '')\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT\n this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES\n }\n\n async request<T>(options: RequestOptions): Promise<T> {\n const url = this.buildUrl(options.path, options.query)\n const isSafe = SAFE_METHODS.has(options.method)\n const hasIdempotency = options.method === 'POST' && hasUsableIdempotencyKey(options.idempotencyKey)\n const canRetry = isSafe || hasIdempotency\n const maxAttempts = canRetry ? this.maxRetries + 1 : 1\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n let response: Response\n\n try {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `agentref-node/${VERSION}`,\n }\n\n if (hasIdempotency) {\n headers['Idempotency-Key'] = options.idempotencyKey!.trim()\n }\n\n response = await fetch(url, {\n method: options.method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal: AbortSignal.timeout(this.timeout),\n })\n } catch (error) {\n if (canRetry && attempt < maxAttempts - 1) {\n await this.wait(this.backoff(attempt))\n continue\n }\n throw error\n }\n\n if (!response.ok) {\n const parsedError = await this.parseError(response)\n\n if (canRetry && this.isRetryable(response.status) && attempt < maxAttempts - 1) {\n const delay =\n response.status === 429\n ? this.retryAfterToMs(response.headers.get('Retry-After'))\n : this.backoff(attempt)\n await this.wait(delay)\n continue\n }\n\n throw parsedError\n }\n\n return response.json() as Promise<T>\n }\n\n throw new ServerError('Request failed after retries', 'REQUEST_RETRY_EXHAUSTED', 500, '')\n }\n\n private buildUrl(path: string, query?: Record<string, string | number | boolean | undefined>): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const url = new URL(`${this.baseUrl}${normalizedPath}`)\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value))\n }\n }\n }\n\n return url.toString()\n }\n\n private async parseError(response: Response): Promise<AgentRefError> {\n const json = (await response.json().catch(() => ({}))) as {\n error?: { code?: string; message?: string; details?: unknown }\n meta?: { requestId?: string }\n }\n\n const code = json.error?.code ?? 'UNKNOWN_ERROR'\n const message = json.error?.message ?? response.statusText\n const requestId = json.meta?.requestId ?? ''\n const details = json.error?.details\n\n if (response.status === 400) return new ValidationError(message, code, requestId, details)\n if (response.status === 401) return new AuthError(message, code, requestId)\n if (response.status === 403) return new ForbiddenError(message, code, requestId)\n if (response.status === 404) return new NotFoundError(message, code, requestId)\n if (response.status === 409) return new ConflictError(message, code, requestId)\n if (response.status === 429) {\n return new RateLimitError(message, code, requestId, this.retryAfterToSeconds(response.headers.get('Retry-After')))\n }\n\n return new ServerError(message, code, response.status, requestId)\n }\n\n private isRetryable(status: number): boolean {\n return status === 429 || status >= 500\n }\n\n private retryAfterToSeconds(headerValue: string | null): number {\n if (!headerValue) return 60\n\n const numericSeconds = Number(headerValue)\n if (!Number.isNaN(numericSeconds) && numericSeconds >= 0) {\n return Math.ceil(numericSeconds)\n }\n\n const asDate = Date.parse(headerValue)\n if (!Number.isNaN(asDate)) {\n const deltaMs = asDate - Date.now()\n return Math.max(0, Math.ceil(deltaMs / 1000))\n }\n\n return 60\n }\n\n private retryAfterToMs(headerValue: string | null): number {\n return this.retryAfterToSeconds(headerValue) * 1000\n }\n\n private wait(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms)\n })\n }\n\n private backoff(attempt: number): number {\n return 500 * Math.pow(2, attempt)\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Affiliate, AffiliateSortBy, AffiliateStatus, MutationOptions, PaginatedResponse, SortOrder } from '../types/index.js'\n\nexport class AffiliatesResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n includeBlocked?: boolean\n search?: string\n sortBy?: AffiliateSortBy\n sortOrder?: SortOrder\n status?: AffiliateStatus\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({ method: 'GET', path: '/affiliates', query: params })\n }\n\n async get(id: string, options?: { include?: 'stats' }): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'GET',\n path: `/affiliates/${id}`,\n query: options?.include ? { include: options.include } : undefined,\n })\n return envelope.data\n }\n\n async approve(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/approve`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async block(id: string, data?: { reason?: string }, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/block`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async unblock(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/unblock`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { BillingStatus, BillingTier, MutationOptions } from '../types/index.js'\n\nexport class BillingResource {\n constructor(private readonly http: HttpClient) {}\n\n async current(): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'GET',\n path: '/billing',\n })\n return envelope.data\n }\n\n async tiers(): Promise<BillingTier[]> {\n const envelope = await this.http.request<{ data: BillingTier[]; meta: unknown }>({\n method: 'GET',\n path: '/billing/tiers',\n })\n return envelope.data\n }\n\n async subscribe(data: { tier: 'starter' | 'growth' | 'pro' | 'scale' }, options?: MutationOptions): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'POST',\n path: '/billing/subscribe',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Conversion, ConversionStats, PaginatedResponse } from '../types/index.js'\n\nexport class ConversionsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: string\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Conversion>> {\n return this.http.request({ method: 'GET', path: '/conversions', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<ConversionStats> {\n const envelope = await this.http.request<{ data: ConversionStats; meta: unknown }>({\n method: 'GET',\n path: '/conversions/stats',\n query: params,\n })\n return envelope.data\n }\n\n async recent(params?: { limit?: number }): Promise<Conversion[]> {\n const envelope = await this.http.request<{ data: Conversion[]; meta: unknown }>({\n method: 'GET',\n path: '/conversions/recent',\n query: params,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Flag, FlagStats, MutationOptions, PaginatedResponse, ResolveFlagParams } from '../types/index.js'\n\nexport class FlagsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n status?: string\n type?: string\n affiliateId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Flag>> {\n return this.http.request({ method: 'GET', path: '/flags', query: params })\n }\n\n async stats(): Promise<FlagStats> {\n const envelope = await this.http.request<{ data: FlagStats; meta: unknown }>({\n method: 'GET',\n path: '/flags/stats',\n })\n return envelope.data\n }\n\n async resolve(id: string, data: ResolveFlagParams, options?: MutationOptions): Promise<Flag> {\n const envelope = await this.http.request<{ data: Flag; meta: unknown }>({\n method: 'POST',\n path: `/flags/${id}/resolve`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Merchant,\n NotificationPreferences,\n PayoutInfo,\n UpdateMerchantParams,\n UpdateNotificationPreferencesParams,\n UpdatePayoutInfoParams,\n} from '../types/index.js'\n\nexport class MerchantResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'GET',\n path: '/merchant',\n })\n return envelope.data\n }\n\n async update(data: UpdateMerchantParams): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'PATCH',\n path: '/merchant',\n body: data,\n })\n return envelope.data\n }\n\n async getPayoutInfo(): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'GET',\n path: '/me/payout-info',\n })\n return envelope.data\n }\n\n async updatePayoutInfo(data: UpdatePayoutInfoParams): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'PATCH',\n path: '/me/payout-info',\n body: data,\n })\n return envelope.data\n }\n\n async getNotifications(): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'GET',\n path: '/merchant/notifications',\n })\n return envelope.data\n }\n\n async updateNotifications(data: UpdateNotificationPreferencesParams): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'PUT',\n path: '/merchant/notifications',\n body: data,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { CreatePayoutParams, MutationOptions, PaginatedResponse, PendingAffiliate, Payout, PayoutStats, PayoutStatus } from '../types/index.js'\n\nexport class PayoutsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: PayoutStatus\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Payout>> {\n return this.http.request({ method: 'GET', path: '/payouts', query: params })\n }\n\n listPending(params?: {\n programId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<PendingAffiliate>> {\n return this.http.request({ method: 'GET', path: '/payouts/pending', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<PayoutStats> {\n const envelope = await this.http.request<{ data: PayoutStats; meta: unknown }>({\n method: 'GET',\n path: '/payouts/stats',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreatePayoutParams, options?: MutationOptions): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'POST',\n path: '/payouts',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Affiliate,\n Coupon,\n ConnectProgramStripeParams,\n ConnectProgramStripeResponse,\n CreateCouponParams,\n CreateInviteParams,\n CreateProgramParams,\n DisconnectProgramStripeResponse,\n Invite,\n MutationOptions,\n PaginatedResponse,\n Program,\n ProgramDetail,\n ProgramStats,\n ProgramStatus,\n UpdateProgramMarketplaceParams,\n UpdateProgramParams,\n} from '../types/index.js'\n\nexport class ProgramsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n status?: ProgramStatus\n }): Promise<PaginatedResponse<Program>> {\n return this.http.request({ method: 'GET', path: '/programs', query: params })\n }\n\n async *listAll(params?: {\n pageSize?: number\n }): AsyncGenerator<Program> {\n let page = 1\n const pageSize = params?.pageSize ?? 100\n\n while (true) {\n const response = await this.list({ page, limit: pageSize })\n yield* response.data\n\n if (!response.meta.hasMore) {\n break\n }\n\n page += 1\n }\n }\n\n async get(id: string): Promise<ProgramDetail> {\n const envelope = await this.http.request<{ data: ProgramDetail; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async create(data: CreateProgramParams, options?: MutationOptions): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'POST',\n path: '/programs',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateProgramParams): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async stats(id: string, params?: { period?: string }): Promise<ProgramStats> {\n const envelope = await this.http.request<{ data: ProgramStats; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/stats`,\n query: params,\n })\n return envelope.data\n }\n\n listAffiliates(\n id: string,\n params?: { includeBlocked?: boolean; cursor?: string; limit?: number; page?: number; pageSize?: number; offset?: number }\n ): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({\n method: 'GET',\n path: `/programs/${id}/affiliates`,\n query: params,\n })\n }\n\n async listCoupons(id: string): Promise<Coupon[]> {\n const envelope = await this.http.request<{ data: Coupon[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/coupons`,\n })\n return envelope.data\n }\n\n async createCoupon(id: string, data: CreateCouponParams, options?: MutationOptions): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/coupons`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async createInvite(\n id: string,\n data: CreateInviteParams,\n options?: MutationOptions\n ): Promise<Invite> {\n const envelope = await this.http.request<{ data: Invite; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/invites`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async listInvites(id: string): Promise<Invite[]> {\n const envelope = await this.http.request<{ data: Invite[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/invites`,\n })\n return envelope.data\n }\n\n async deleteCoupon(couponId: string): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'DELETE',\n path: `/coupons/${couponId}`,\n })\n return envelope.data\n }\n\n async updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}/marketplace`,\n body: data,\n })\n return envelope.data\n }\n\n async connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: ConnectProgramStripeResponse; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/connect-stripe`,\n body: data,\n })\n return envelope.data\n }\n\n async disconnectStripe(id: string): Promise<DisconnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: DisconnectProgramStripeResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}/connect-stripe`,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n CreateWebhookEndpointParams,\n SuccessResponse,\n UpdateWebhookEndpointParams,\n WebhookEndpoint,\n WebhookSecretResponse,\n} from '../types/index.js'\n\nexport class WebhooksResource {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: { programId?: string }): Promise<WebhookEndpoint[]> {\n const envelope = await this.http.request<{ data: WebhookEndpoint[]; meta: unknown }>({\n method: 'GET',\n path: '/webhooks',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreateWebhookEndpointParams): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: '/webhooks',\n body: data,\n })\n return envelope.data\n }\n\n async get(id: string): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'GET',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateWebhookEndpointParams): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'PATCH',\n path: `/webhooks/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<SuccessResponse> {\n const envelope = await this.http.request<{ data: SuccessResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async rotateSecret(id: string): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: `/webhooks/${id}/rotate-secret`,\n })\n return envelope.data\n }\n}\n","import { HttpClient } from './http.js'\nimport type { AgentRefConfig } from './types/index.js'\nimport { AffiliatesResource } from './resources/affiliates.js'\nimport { BillingResource } from './resources/billing.js'\nimport { ConversionsResource } from './resources/conversions.js'\nimport { FlagsResource } from './resources/flags.js'\nimport { MerchantResource } from './resources/merchant.js'\nimport { PayoutsResource } from './resources/payouts.js'\nimport { ProgramsResource } from './resources/programs.js'\nimport { WebhooksResource } from './resources/webhooks.js'\n\nexport class AgentRef {\n readonly programs: ProgramsResource\n readonly affiliates: AffiliatesResource\n readonly conversions: ConversionsResource\n readonly payouts: PayoutsResource\n readonly flags: FlagsResource\n readonly billing: BillingResource\n readonly merchant: MerchantResource\n readonly webhooks: WebhooksResource\n\n constructor(config?: AgentRefConfig) {\n const http = new HttpClient(config)\n\n this.programs = new ProgramsResource(http)\n this.affiliates = new AffiliatesResource(http)\n this.conversions = new ConversionsResource(http)\n this.payouts = new PayoutsResource(http)\n this.flags = new FlagsResource(http)\n this.billing = new BillingResource(http)\n this.merchant = new MerchantResource(http)\n this.webhooks = new WebhooksResource(http)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAKvC,YAAY,SAAiB,MAAc,QAAgB,WAAmB;AAC5E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAEO,IAAM,YAAN,cAAwB,cAAc;AAAA,EAC3C,YAAY,SAAiB,MAAc,WAAmB;AAC5D,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAChD,YAAY,SAAiB,MAAc,WAAmB;AAC5D,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAA8B,cAAc;AAAA,EAGjD,YAAY,SAAiB,MAAc,WAAmB,SAAmB;AAC/E,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AACZ,SAAK,UAAU;AAAA,EACjB;AACF;AAEO,IAAM,gBAAN,cAA4B,cAAc;AAAA,EAC/C,YAAY,SAAiB,MAAc,WAAmB;AAC5D,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAA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AI;AACzC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AAAA,EAC3C;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -35,7 +35,6 @@ interface Merchant {
35
35
  timezone: string;
36
36
  trackingRequiresConsent: boolean;
37
37
  trackingParamAliases: string[];
38
- trackingLegacyMetadataFallbackEnabled: boolean;
39
38
  notificationPreferences: NotificationPreferences | null;
40
39
  onboardingCompleted: boolean;
41
40
  onboardingStep: number;
@@ -50,14 +49,13 @@ interface UpdateMerchantParams {
50
49
  defaultPayoutThreshold?: number;
51
50
  trackingRequiresConsent?: boolean;
52
51
  trackingParamAliases?: string[];
53
- trackingLegacyMetadataFallbackEnabled?: boolean;
54
52
  }
55
53
  type CommissionType = 'one_time' | 'recurring' | 'recurring_limited';
56
54
  type ProgramStatus = 'active' | 'paused' | 'archived';
57
55
  type ProgramMarketplaceStatus = 'private' | 'pending' | 'public';
58
56
  type ProgramMarketplaceVisibility = 'private' | 'public';
59
57
  type ProgramReadiness = 'setup' | 'partial' | 'ready';
60
- type StripeConnectMethod = 'oauth_url' | 'restricted_key' | 'fallback_url';
58
+ type StripeConnectMethod = 'oauth_url';
61
59
  interface Program {
62
60
  id: string;
63
61
  merchantId: string;
@@ -79,16 +77,12 @@ interface Program {
79
77
  cookieDuration: number;
80
78
  trackingRequiresConsent: boolean | null;
81
79
  trackingParamAliases: string[] | null;
82
- trackingLegacyMetadataFallbackEnabled: boolean | null;
83
80
  payoutThreshold: number;
84
81
  currency: string;
85
82
  autoApproveAffiliates: boolean;
86
83
  termsUrl: string | null;
87
84
  stripeAccountId: string | null;
88
85
  stripeConnectedAt: string | null;
89
- verifiedDomain: string | null;
90
- domainVerificationToken: string | null;
91
- domainVerifiedAt: string | null;
92
86
  createdAt: string;
93
87
  updatedAt: string;
94
88
  }
@@ -105,6 +99,7 @@ interface CreateProgramParams {
105
99
  name: string;
106
100
  commissionType: CommissionType;
107
101
  commissionPercent: number;
102
+ website?: string;
108
103
  cookieDuration?: number;
109
104
  payoutThreshold?: number;
110
105
  autoApproveAffiliates?: boolean;
@@ -118,6 +113,7 @@ interface UpdateProgramParams {
118
113
  name?: string;
119
114
  commissionType?: CommissionType;
120
115
  commissionPercent?: number;
116
+ website?: string;
121
117
  cookieDuration?: number;
122
118
  payoutThreshold?: number;
123
119
  autoApproveAffiliates?: boolean;
@@ -130,14 +126,12 @@ interface UpdateProgramParams {
130
126
  }
131
127
  interface ConnectProgramStripeParams {
132
128
  method?: StripeConnectMethod;
133
- stripeAccountId?: string;
134
129
  }
135
130
  interface ConnectProgramStripeResponse {
136
131
  connected: boolean;
137
132
  method: StripeConnectMethod;
138
133
  programId: string;
139
134
  programReadiness?: ProgramReadiness;
140
- stripeAccountId?: string;
141
135
  authUrl?: string;
142
136
  message: string;
143
137
  }
@@ -145,22 +139,6 @@ interface DisconnectProgramStripeResponse {
145
139
  success: boolean;
146
140
  programId: string;
147
141
  }
148
- interface ProgramDomainVerificationInitResponse {
149
- programId: string;
150
- domain: string;
151
- token: string;
152
- txtRecord: string;
153
- txtRecordName: string;
154
- message: string;
155
- }
156
- interface ProgramDomainVerificationStatusResponse {
157
- verified: boolean;
158
- domain: string | null;
159
- verifiedAt: string | null;
160
- programId: string;
161
- programReadiness: ProgramReadiness;
162
- message: string;
163
- }
164
142
  interface SuccessResponse {
165
143
  success: boolean;
166
144
  }
@@ -579,11 +557,6 @@ declare class ProgramsResource {
579
557
  updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>>;
580
558
  connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse>;
581
559
  disconnectStripe(id: string): Promise<DisconnectProgramStripeResponse>;
582
- verifyDomain(id: string, data: {
583
- domain: string;
584
- }): Promise<ProgramDomainVerificationInitResponse>;
585
- removeDomainVerification(id: string): Promise<SuccessResponse>;
586
- getDomainStatus(id: string): Promise<ProgramDomainVerificationStatusResponse>;
587
560
  }
588
561
 
589
562
  declare class WebhooksResource {
@@ -641,4 +614,4 @@ declare class ServerError extends AgentRefError {
641
614
  constructor(message: string, code: string, status: number, requestId: string);
642
615
  }
643
616
 
644
- export { type Affiliate, type AffiliateSortBy, type AffiliateStatus, AgentRef, type AgentRefConfig, AgentRefError, AuthError, type BillingRequirementStatus, type BillingStatus, type BillingTier, type BillingTierId, type CommissionType, ConflictError, type ConnectProgramStripeParams, type ConnectProgramStripeResponse, type Conversion, type ConversionStats, type ConversionStatus, type Coupon, type CreateCouponParams, type CreateInviteParams, type CreatePayoutParams, type CreateProgramParams, type CreateWebhookEndpointParams, type DisconnectProgramStripeResponse, type Flag, type FlagStats, type FlagStatus, type FlagType, ForbiddenError, type Invite, type Merchant, type MutationOptions, NotFoundError, type NotificationPreferences, type PaginatedResponse, type PaginationMeta, type Payout, type PayoutInfo, type PayoutStats, type PayoutStatus, type PendingAffiliate, type Program, type ProgramDetail, type ProgramDomainVerificationInitResponse, type ProgramDomainVerificationStatusResponse, type ProgramMarketplaceStatus, type ProgramMarketplaceVisibility, type ProgramReadiness, type ProgramStats, type ProgramStatus, RateLimitError, type ResolveFlagParams, ServerError, type SortOrder, type StripeConnectMethod, type SuccessResponse, type UpdateMerchantParams, type UpdateNotificationPreferencesParams, type UpdatePayoutInfoParams, type UpdateProgramMarketplaceParams, type UpdateProgramParams, type UpdateWebhookEndpointParams, ValidationError, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventType, type WebhookSecretResponse };
617
+ export { type Affiliate, type AffiliateSortBy, type AffiliateStatus, AgentRef, type AgentRefConfig, AgentRefError, AuthError, type BillingRequirementStatus, type BillingStatus, type BillingTier, type BillingTierId, type CommissionType, ConflictError, type ConnectProgramStripeParams, type ConnectProgramStripeResponse, type Conversion, type ConversionStats, type ConversionStatus, type Coupon, type CreateCouponParams, type CreateInviteParams, type CreatePayoutParams, type CreateProgramParams, type CreateWebhookEndpointParams, type DisconnectProgramStripeResponse, type Flag, type FlagStats, type FlagStatus, type FlagType, ForbiddenError, type Invite, type Merchant, type MutationOptions, NotFoundError, type NotificationPreferences, type PaginatedResponse, type PaginationMeta, type Payout, type PayoutInfo, type PayoutStats, type PayoutStatus, type PendingAffiliate, type Program, type ProgramDetail, type ProgramMarketplaceStatus, type ProgramMarketplaceVisibility, type ProgramReadiness, type ProgramStats, type ProgramStatus, RateLimitError, type ResolveFlagParams, ServerError, type SortOrder, type StripeConnectMethod, type SuccessResponse, type UpdateMerchantParams, type UpdateNotificationPreferencesParams, type UpdatePayoutInfoParams, type UpdateProgramMarketplaceParams, type UpdateProgramParams, type UpdateWebhookEndpointParams, ValidationError, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventType, type WebhookSecretResponse };
package/dist/index.d.ts CHANGED
@@ -35,7 +35,6 @@ interface Merchant {
35
35
  timezone: string;
36
36
  trackingRequiresConsent: boolean;
37
37
  trackingParamAliases: string[];
38
- trackingLegacyMetadataFallbackEnabled: boolean;
39
38
  notificationPreferences: NotificationPreferences | null;
40
39
  onboardingCompleted: boolean;
41
40
  onboardingStep: number;
@@ -50,14 +49,13 @@ interface UpdateMerchantParams {
50
49
  defaultPayoutThreshold?: number;
51
50
  trackingRequiresConsent?: boolean;
52
51
  trackingParamAliases?: string[];
53
- trackingLegacyMetadataFallbackEnabled?: boolean;
54
52
  }
55
53
  type CommissionType = 'one_time' | 'recurring' | 'recurring_limited';
56
54
  type ProgramStatus = 'active' | 'paused' | 'archived';
57
55
  type ProgramMarketplaceStatus = 'private' | 'pending' | 'public';
58
56
  type ProgramMarketplaceVisibility = 'private' | 'public';
59
57
  type ProgramReadiness = 'setup' | 'partial' | 'ready';
60
- type StripeConnectMethod = 'oauth_url' | 'restricted_key' | 'fallback_url';
58
+ type StripeConnectMethod = 'oauth_url';
61
59
  interface Program {
62
60
  id: string;
63
61
  merchantId: string;
@@ -79,16 +77,12 @@ interface Program {
79
77
  cookieDuration: number;
80
78
  trackingRequiresConsent: boolean | null;
81
79
  trackingParamAliases: string[] | null;
82
- trackingLegacyMetadataFallbackEnabled: boolean | null;
83
80
  payoutThreshold: number;
84
81
  currency: string;
85
82
  autoApproveAffiliates: boolean;
86
83
  termsUrl: string | null;
87
84
  stripeAccountId: string | null;
88
85
  stripeConnectedAt: string | null;
89
- verifiedDomain: string | null;
90
- domainVerificationToken: string | null;
91
- domainVerifiedAt: string | null;
92
86
  createdAt: string;
93
87
  updatedAt: string;
94
88
  }
@@ -105,6 +99,7 @@ interface CreateProgramParams {
105
99
  name: string;
106
100
  commissionType: CommissionType;
107
101
  commissionPercent: number;
102
+ website?: string;
108
103
  cookieDuration?: number;
109
104
  payoutThreshold?: number;
110
105
  autoApproveAffiliates?: boolean;
@@ -118,6 +113,7 @@ interface UpdateProgramParams {
118
113
  name?: string;
119
114
  commissionType?: CommissionType;
120
115
  commissionPercent?: number;
116
+ website?: string;
121
117
  cookieDuration?: number;
122
118
  payoutThreshold?: number;
123
119
  autoApproveAffiliates?: boolean;
@@ -130,14 +126,12 @@ interface UpdateProgramParams {
130
126
  }
131
127
  interface ConnectProgramStripeParams {
132
128
  method?: StripeConnectMethod;
133
- stripeAccountId?: string;
134
129
  }
135
130
  interface ConnectProgramStripeResponse {
136
131
  connected: boolean;
137
132
  method: StripeConnectMethod;
138
133
  programId: string;
139
134
  programReadiness?: ProgramReadiness;
140
- stripeAccountId?: string;
141
135
  authUrl?: string;
142
136
  message: string;
143
137
  }
@@ -145,22 +139,6 @@ interface DisconnectProgramStripeResponse {
145
139
  success: boolean;
146
140
  programId: string;
147
141
  }
148
- interface ProgramDomainVerificationInitResponse {
149
- programId: string;
150
- domain: string;
151
- token: string;
152
- txtRecord: string;
153
- txtRecordName: string;
154
- message: string;
155
- }
156
- interface ProgramDomainVerificationStatusResponse {
157
- verified: boolean;
158
- domain: string | null;
159
- verifiedAt: string | null;
160
- programId: string;
161
- programReadiness: ProgramReadiness;
162
- message: string;
163
- }
164
142
  interface SuccessResponse {
165
143
  success: boolean;
166
144
  }
@@ -579,11 +557,6 @@ declare class ProgramsResource {
579
557
  updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>>;
580
558
  connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse>;
581
559
  disconnectStripe(id: string): Promise<DisconnectProgramStripeResponse>;
582
- verifyDomain(id: string, data: {
583
- domain: string;
584
- }): Promise<ProgramDomainVerificationInitResponse>;
585
- removeDomainVerification(id: string): Promise<SuccessResponse>;
586
- getDomainStatus(id: string): Promise<ProgramDomainVerificationStatusResponse>;
587
560
  }
588
561
 
589
562
  declare class WebhooksResource {
@@ -641,4 +614,4 @@ declare class ServerError extends AgentRefError {
641
614
  constructor(message: string, code: string, status: number, requestId: string);
642
615
  }
643
616
 
644
- export { type Affiliate, type AffiliateSortBy, type AffiliateStatus, AgentRef, type AgentRefConfig, AgentRefError, AuthError, type BillingRequirementStatus, type BillingStatus, type BillingTier, type BillingTierId, type CommissionType, ConflictError, type ConnectProgramStripeParams, type ConnectProgramStripeResponse, type Conversion, type ConversionStats, type ConversionStatus, type Coupon, type CreateCouponParams, type CreateInviteParams, type CreatePayoutParams, type CreateProgramParams, type CreateWebhookEndpointParams, type DisconnectProgramStripeResponse, type Flag, type FlagStats, type FlagStatus, type FlagType, ForbiddenError, type Invite, type Merchant, type MutationOptions, NotFoundError, type NotificationPreferences, type PaginatedResponse, type PaginationMeta, type Payout, type PayoutInfo, type PayoutStats, type PayoutStatus, type PendingAffiliate, type Program, type ProgramDetail, type ProgramDomainVerificationInitResponse, type ProgramDomainVerificationStatusResponse, type ProgramMarketplaceStatus, type ProgramMarketplaceVisibility, type ProgramReadiness, type ProgramStats, type ProgramStatus, RateLimitError, type ResolveFlagParams, ServerError, type SortOrder, type StripeConnectMethod, type SuccessResponse, type UpdateMerchantParams, type UpdateNotificationPreferencesParams, type UpdatePayoutInfoParams, type UpdateProgramMarketplaceParams, type UpdateProgramParams, type UpdateWebhookEndpointParams, ValidationError, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventType, type WebhookSecretResponse };
617
+ export { type Affiliate, type AffiliateSortBy, type AffiliateStatus, AgentRef, type AgentRefConfig, AgentRefError, AuthError, type BillingRequirementStatus, type BillingStatus, type BillingTier, type BillingTierId, type CommissionType, ConflictError, type ConnectProgramStripeParams, type ConnectProgramStripeResponse, type Conversion, type ConversionStats, type ConversionStatus, type Coupon, type CreateCouponParams, type CreateInviteParams, type CreatePayoutParams, type CreateProgramParams, type CreateWebhookEndpointParams, type DisconnectProgramStripeResponse, type Flag, type FlagStats, type FlagStatus, type FlagType, ForbiddenError, type Invite, type Merchant, type MutationOptions, NotFoundError, type NotificationPreferences, type PaginatedResponse, type PaginationMeta, type Payout, type PayoutInfo, type PayoutStats, type PayoutStatus, type PendingAffiliate, type Program, type ProgramDetail, type ProgramMarketplaceStatus, type ProgramMarketplaceVisibility, type ProgramReadiness, type ProgramStats, type ProgramStatus, RateLimitError, type ResolveFlagParams, ServerError, type SortOrder, type StripeConnectMethod, type SuccessResponse, type UpdateMerchantParams, type UpdateNotificationPreferencesParams, type UpdatePayoutInfoParams, type UpdateProgramMarketplaceParams, type UpdateProgramParams, type UpdateWebhookEndpointParams, ValidationError, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventType, type WebhookSecretResponse };
package/dist/index.mjs CHANGED
@@ -56,10 +56,10 @@ var ServerError = class extends AgentRefError {
56
56
 
57
57
  // src/http.ts
58
58
  var SAFE_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
59
- var DEFAULT_BASE_URL = "https://www.agentref.dev/api/v1";
59
+ var DEFAULT_BASE_URL = "https://www.agentref.co/api/v1";
60
60
  var DEFAULT_TIMEOUT = 3e4;
61
61
  var DEFAULT_MAX_RETRIES = 2;
62
- var VERSION = true ? "5.0.1" : "0.0.0";
62
+ var VERSION = true ? "5.0.2" : "0.0.0";
63
63
  function hasUsableIdempotencyKey(idempotencyKey) {
64
64
  return typeof idempotencyKey === "string" && idempotencyKey.trim().length > 0;
65
65
  }
@@ -516,28 +516,6 @@ var ProgramsResource = class {
516
516
  });
517
517
  return envelope.data;
518
518
  }
519
- async verifyDomain(id, data) {
520
- const envelope = await this.http.request({
521
- method: "POST",
522
- path: `/programs/${id}/verify-domain`,
523
- body: data
524
- });
525
- return envelope.data;
526
- }
527
- async removeDomainVerification(id) {
528
- const envelope = await this.http.request({
529
- method: "DELETE",
530
- path: `/programs/${id}/verify-domain`
531
- });
532
- return envelope.data;
533
- }
534
- async getDomainStatus(id) {
535
- const envelope = await this.http.request({
536
- method: "GET",
537
- path: `/programs/${id}/verify-domain/status`
538
- });
539
- return envelope.data;
540
- }
541
519
  };
542
520
 
543
521
  // src/resources/webhooks.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/affiliates.ts","../src/resources/billing.ts","../src/resources/conversions.ts","../src/resources/flags.ts","../src/resources/merchant.ts","../src/resources/payouts.ts","../src/resources/programs.ts","../src/resources/webhooks.ts","../src/client.ts"],"sourcesContent":["export class AgentRefError extends Error {\n readonly code: string\n readonly status: number\n readonly requestId: string\n\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message)\n this.name = 'AgentRefError'\n this.code = code\n this.status = status\n this.requestId = requestId\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\nexport class AuthError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 401, requestId)\n this.name = 'AuthError'\n }\n}\n\nexport class ForbiddenError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 403, requestId)\n this.name = 'ForbiddenError'\n }\n}\n\nexport class ValidationError extends AgentRefError {\n readonly details: unknown\n\n constructor(message: string, code: string, requestId: string, details?: unknown) {\n super(message, code, 400, requestId)\n this.name = 'ValidationError'\n this.details = details\n }\n}\n\nexport class NotFoundError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 404, requestId)\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 409, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends AgentRefError {\n readonly retryAfter: number\n\n constructor(message: string, code: string, requestId: string, retryAfter: number) {\n super(message, code, 429, requestId)\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class ServerError extends AgentRefError {\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message, code, status, requestId)\n this.name = 'ServerError'\n }\n}\n","import {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nimport type { AgentRefConfig } from './types/index.js'\n\nexport type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n\nconst SAFE_METHODS: ReadonlySet<HttpMethod> = new Set(['GET', 'HEAD'])\n\nexport interface RequestOptions {\n method: HttpMethod\n path: string\n body?: unknown\n query?: Record<string, string | number | boolean | undefined>\n idempotencyKey?: string\n}\n\nconst DEFAULT_BASE_URL = 'https://www.agentref.dev/api/v1'\nconst DEFAULT_TIMEOUT = 30_000\nconst DEFAULT_MAX_RETRIES = 2\n\ndeclare const __SDK_VERSION__: string\nconst VERSION = typeof __SDK_VERSION__ === 'string' ? __SDK_VERSION__ : '0.0.0'\n\nfunction hasUsableIdempotencyKey(idempotencyKey: string | undefined): boolean {\n return typeof idempotencyKey === 'string' && idempotencyKey.trim().length > 0\n}\n\nexport class HttpClient {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n private readonly maxRetries: number\n\n constructor(config: AgentRefConfig = {}) {\n if (typeof window !== 'undefined' && !config.dangerouslyAllowBrowser) {\n throw new Error(\n '[AgentRef] Refusing to initialize in browser context. API keys must not be exposed client-side. Use a server-side proxy to call the AgentRef API instead. To override: set dangerouslyAllowBrowser: true (understand the security implications first).'\n )\n }\n\n const apiKey = config.apiKey ?? process.env['AGENTREF_API_KEY']\n if (!apiKey) {\n throw new Error(\n '[AgentRef] API key is required. Pass it as apiKey or set the AGENTREF_API_KEY environment variable.'\n )\n }\n\n this.apiKey = apiKey\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '')\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT\n this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES\n }\n\n async request<T>(options: RequestOptions): Promise<T> {\n const url = this.buildUrl(options.path, options.query)\n const isSafe = SAFE_METHODS.has(options.method)\n const hasIdempotency = options.method === 'POST' && hasUsableIdempotencyKey(options.idempotencyKey)\n const canRetry = isSafe || hasIdempotency\n const maxAttempts = canRetry ? this.maxRetries + 1 : 1\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n let response: Response\n\n try {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `agentref-node/${VERSION}`,\n }\n\n if (hasIdempotency) {\n headers['Idempotency-Key'] = options.idempotencyKey!.trim()\n }\n\n response = await fetch(url, {\n method: options.method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal: AbortSignal.timeout(this.timeout),\n })\n } catch (error) {\n if (canRetry && attempt < maxAttempts - 1) {\n await this.wait(this.backoff(attempt))\n continue\n }\n throw error\n }\n\n if (!response.ok) {\n const parsedError = await this.parseError(response)\n\n if (canRetry && this.isRetryable(response.status) && attempt < maxAttempts - 1) {\n const delay =\n response.status === 429\n ? this.retryAfterToMs(response.headers.get('Retry-After'))\n : this.backoff(attempt)\n await this.wait(delay)\n continue\n }\n\n throw parsedError\n }\n\n return response.json() as Promise<T>\n }\n\n throw new ServerError('Request failed after retries', 'REQUEST_RETRY_EXHAUSTED', 500, '')\n }\n\n private buildUrl(path: string, query?: Record<string, string | number | boolean | undefined>): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const url = new URL(`${this.baseUrl}${normalizedPath}`)\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value))\n }\n }\n }\n\n return url.toString()\n }\n\n private async parseError(response: Response): Promise<AgentRefError> {\n const json = (await response.json().catch(() => ({}))) as {\n error?: { code?: string; message?: string; details?: unknown }\n meta?: { requestId?: string }\n }\n\n const code = json.error?.code ?? 'UNKNOWN_ERROR'\n const message = json.error?.message ?? response.statusText\n const requestId = json.meta?.requestId ?? ''\n const details = json.error?.details\n\n if (response.status === 400) return new ValidationError(message, code, requestId, details)\n if (response.status === 401) return new AuthError(message, code, requestId)\n if (response.status === 403) return new ForbiddenError(message, code, requestId)\n if (response.status === 404) return new NotFoundError(message, code, requestId)\n if (response.status === 409) return new ConflictError(message, code, requestId)\n if (response.status === 429) {\n return new RateLimitError(message, code, requestId, this.retryAfterToSeconds(response.headers.get('Retry-After')))\n }\n\n return new ServerError(message, code, response.status, requestId)\n }\n\n private isRetryable(status: number): boolean {\n return status === 429 || status >= 500\n }\n\n private retryAfterToSeconds(headerValue: string | null): number {\n if (!headerValue) return 60\n\n const numericSeconds = Number(headerValue)\n if (!Number.isNaN(numericSeconds) && numericSeconds >= 0) {\n return Math.ceil(numericSeconds)\n }\n\n const asDate = Date.parse(headerValue)\n if (!Number.isNaN(asDate)) {\n const deltaMs = asDate - Date.now()\n return Math.max(0, Math.ceil(deltaMs / 1000))\n }\n\n return 60\n }\n\n private retryAfterToMs(headerValue: string | null): number {\n return this.retryAfterToSeconds(headerValue) * 1000\n }\n\n private wait(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms)\n })\n }\n\n private backoff(attempt: number): number {\n return 500 * Math.pow(2, attempt)\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Affiliate, AffiliateSortBy, AffiliateStatus, MutationOptions, PaginatedResponse, SortOrder } from '../types/index.js'\n\nexport class AffiliatesResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n includeBlocked?: boolean\n search?: string\n sortBy?: AffiliateSortBy\n sortOrder?: SortOrder\n status?: AffiliateStatus\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({ method: 'GET', path: '/affiliates', query: params })\n }\n\n async get(id: string, options?: { include?: 'stats' }): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'GET',\n path: `/affiliates/${id}`,\n query: options?.include ? { include: options.include } : undefined,\n })\n return envelope.data\n }\n\n async approve(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/approve`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async block(id: string, data?: { reason?: string }, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/block`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async unblock(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/unblock`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { BillingStatus, BillingTier, MutationOptions } from '../types/index.js'\n\nexport class BillingResource {\n constructor(private readonly http: HttpClient) {}\n\n async current(): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'GET',\n path: '/billing',\n })\n return envelope.data\n }\n\n async tiers(): Promise<BillingTier[]> {\n const envelope = await this.http.request<{ data: BillingTier[]; meta: unknown }>({\n method: 'GET',\n path: '/billing/tiers',\n })\n return envelope.data\n }\n\n async subscribe(data: { tier: 'starter' | 'growth' | 'pro' | 'scale' }, options?: MutationOptions): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'POST',\n path: '/billing/subscribe',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Conversion, ConversionStats, PaginatedResponse } from '../types/index.js'\n\nexport class ConversionsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: string\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Conversion>> {\n return this.http.request({ method: 'GET', path: '/conversions', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<ConversionStats> {\n const envelope = await this.http.request<{ data: ConversionStats; meta: unknown }>({\n method: 'GET',\n path: '/conversions/stats',\n query: params,\n })\n return envelope.data\n }\n\n async recent(params?: { limit?: number }): Promise<Conversion[]> {\n const envelope = await this.http.request<{ data: Conversion[]; meta: unknown }>({\n method: 'GET',\n path: '/conversions/recent',\n query: params,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Flag, FlagStats, MutationOptions, PaginatedResponse, ResolveFlagParams } from '../types/index.js'\n\nexport class FlagsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n status?: string\n type?: string\n affiliateId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Flag>> {\n return this.http.request({ method: 'GET', path: '/flags', query: params })\n }\n\n async stats(): Promise<FlagStats> {\n const envelope = await this.http.request<{ data: FlagStats; meta: unknown }>({\n method: 'GET',\n path: '/flags/stats',\n })\n return envelope.data\n }\n\n async resolve(id: string, data: ResolveFlagParams, options?: MutationOptions): Promise<Flag> {\n const envelope = await this.http.request<{ data: Flag; meta: unknown }>({\n method: 'POST',\n path: `/flags/${id}/resolve`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Merchant,\n NotificationPreferences,\n PayoutInfo,\n UpdateMerchantParams,\n UpdateNotificationPreferencesParams,\n UpdatePayoutInfoParams,\n} from '../types/index.js'\n\nexport class MerchantResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'GET',\n path: '/merchant',\n })\n return envelope.data\n }\n\n async update(data: UpdateMerchantParams): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'PATCH',\n path: '/merchant',\n body: data,\n })\n return envelope.data\n }\n\n async getPayoutInfo(): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'GET',\n path: '/me/payout-info',\n })\n return envelope.data\n }\n\n async updatePayoutInfo(data: UpdatePayoutInfoParams): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'PATCH',\n path: '/me/payout-info',\n body: data,\n })\n return envelope.data\n }\n\n async getNotifications(): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'GET',\n path: '/merchant/notifications',\n })\n return envelope.data\n }\n\n async updateNotifications(data: UpdateNotificationPreferencesParams): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'PUT',\n path: '/merchant/notifications',\n body: data,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { CreatePayoutParams, MutationOptions, PaginatedResponse, PendingAffiliate, Payout, PayoutStats, PayoutStatus } from '../types/index.js'\n\nexport class PayoutsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: PayoutStatus\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Payout>> {\n return this.http.request({ method: 'GET', path: '/payouts', query: params })\n }\n\n listPending(params?: {\n programId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<PendingAffiliate>> {\n return this.http.request({ method: 'GET', path: '/payouts/pending', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<PayoutStats> {\n const envelope = await this.http.request<{ data: PayoutStats; meta: unknown }>({\n method: 'GET',\n path: '/payouts/stats',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreatePayoutParams, options?: MutationOptions): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'POST',\n path: '/payouts',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Affiliate,\n Coupon,\n ConnectProgramStripeParams,\n ConnectProgramStripeResponse,\n CreateCouponParams,\n CreateInviteParams,\n CreateProgramParams,\n DisconnectProgramStripeResponse,\n Invite,\n MutationOptions,\n PaginatedResponse,\n Program,\n ProgramDetail,\n ProgramDomainVerificationInitResponse,\n ProgramDomainVerificationStatusResponse,\n ProgramStats,\n SuccessResponse,\n ProgramStatus,\n UpdateProgramMarketplaceParams,\n UpdateProgramParams,\n} from '../types/index.js'\n\nexport class ProgramsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n status?: ProgramStatus\n }): Promise<PaginatedResponse<Program>> {\n return this.http.request({ method: 'GET', path: '/programs', query: params })\n }\n\n async *listAll(params?: {\n pageSize?: number\n }): AsyncGenerator<Program> {\n let page = 1\n const pageSize = params?.pageSize ?? 100\n\n while (true) {\n const response = await this.list({ page, limit: pageSize })\n yield* response.data\n\n if (!response.meta.hasMore) {\n break\n }\n\n page += 1\n }\n }\n\n async get(id: string): Promise<ProgramDetail> {\n const envelope = await this.http.request<{ data: ProgramDetail; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async create(data: CreateProgramParams, options?: MutationOptions): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'POST',\n path: '/programs',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateProgramParams): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async stats(id: string, params?: { period?: string }): Promise<ProgramStats> {\n const envelope = await this.http.request<{ data: ProgramStats; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/stats`,\n query: params,\n })\n return envelope.data\n }\n\n listAffiliates(\n id: string,\n params?: { includeBlocked?: boolean; cursor?: string; limit?: number; page?: number; pageSize?: number; offset?: number }\n ): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({\n method: 'GET',\n path: `/programs/${id}/affiliates`,\n query: params,\n })\n }\n\n async listCoupons(id: string): Promise<Coupon[]> {\n const envelope = await this.http.request<{ data: Coupon[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/coupons`,\n })\n return envelope.data\n }\n\n async createCoupon(id: string, data: CreateCouponParams, options?: MutationOptions): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/coupons`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async createInvite(\n id: string,\n data: CreateInviteParams,\n options?: MutationOptions\n ): Promise<Invite> {\n const envelope = await this.http.request<{ data: Invite; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/invites`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async listInvites(id: string): Promise<Invite[]> {\n const envelope = await this.http.request<{ data: Invite[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/invites`,\n })\n return envelope.data\n }\n\n async deleteCoupon(couponId: string): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'DELETE',\n path: `/coupons/${couponId}`,\n })\n return envelope.data\n }\n\n async updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}/marketplace`,\n body: data,\n })\n return envelope.data\n }\n\n async connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: ConnectProgramStripeResponse; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/connect-stripe`,\n body: data,\n })\n return envelope.data\n }\n\n async disconnectStripe(id: string): Promise<DisconnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: DisconnectProgramStripeResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}/connect-stripe`,\n })\n return envelope.data\n }\n\n async verifyDomain(id: string, data: { domain: string }): Promise<ProgramDomainVerificationInitResponse> {\n const envelope = await this.http.request<{ data: ProgramDomainVerificationInitResponse; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/verify-domain`,\n body: data,\n })\n return envelope.data\n }\n\n async removeDomainVerification(id: string): Promise<SuccessResponse> {\n const envelope = await this.http.request<{ data: SuccessResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}/verify-domain`,\n })\n return envelope.data\n }\n\n async getDomainStatus(id: string): Promise<ProgramDomainVerificationStatusResponse> {\n const envelope = await this.http.request<{ data: ProgramDomainVerificationStatusResponse; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/verify-domain/status`,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n CreateWebhookEndpointParams,\n SuccessResponse,\n UpdateWebhookEndpointParams,\n WebhookEndpoint,\n WebhookSecretResponse,\n} from '../types/index.js'\n\nexport class WebhooksResource {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: { programId?: string }): Promise<WebhookEndpoint[]> {\n const envelope = await this.http.request<{ data: WebhookEndpoint[]; meta: unknown }>({\n method: 'GET',\n path: '/webhooks',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreateWebhookEndpointParams): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: '/webhooks',\n body: data,\n })\n return envelope.data\n }\n\n async get(id: string): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'GET',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateWebhookEndpointParams): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'PATCH',\n path: `/webhooks/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<SuccessResponse> {\n const envelope = await this.http.request<{ data: SuccessResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async rotateSecret(id: string): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: `/webhooks/${id}/rotate-secret`,\n })\n return envelope.data\n }\n}\n","import { HttpClient } from './http.js'\nimport type { AgentRefConfig } from './types/index.js'\nimport { AffiliatesResource } from './resources/affiliates.js'\nimport { BillingResource } from './resources/billing.js'\nimport { ConversionsResource } from './resources/conversions.js'\nimport { FlagsResource } from './resources/flags.js'\nimport { MerchantResource } from './resources/merchant.js'\nimport { PayoutsResource } from './resources/payouts.js'\nimport { ProgramsResource } from './resources/programs.js'\nimport { WebhooksResource } from './resources/webhooks.js'\n\nexport class AgentRef {\n readonly programs: ProgramsResource\n readonly affiliates: AffiliatesResource\n readonly conversions: ConversionsResource\n readonly payouts: PayoutsResource\n readonly flags: FlagsResource\n readonly billing: BillingResource\n readonly merchant: MerchantResource\n readonly webhooks: WebhooksResource\n\n constructor(config?: AgentRefConfig) {\n const http = new HttpClient(config)\n\n this.programs = new ProgramsResource(http)\n this.affiliates = new AffiliatesResource(http)\n this.conversions = new ConversionsResource(http)\n this.payouts = new PayoutsResource(http)\n this.flags = new FlagsResource(http)\n this.billing = new BillingResource(http)\n this.merchant = new MerchantResource(http)\n this.webhooks = new WebhooksResource(http)\n }\n}\n"],"mappings":";AAAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAKvC,YAAY,SAAiB,MAAc,QAAgB,WAAmB;AAC5E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAEO,IAAM,YAAN,cAAwB,cAAc;AAAA,EAC3C,YAAY,SAAiB,MAAc,WAAmB;AAC5D,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAChD,YAAY,SAAiB,MAAc,WAAmB;AAC5D,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAA8B,cAAc;AAAA,EAGjD,YAAY,SAAiB,MAAc,WAAmB,SAAmB;AAC/E,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AACZ,SAAK,UAAU;AAAA,EACjB;AACF;AAEO,IAAM,gBAAN,cAA4B,cAAc;AAAA,EAC/C,YAAY,SAAiB,MAAc,WAAmB;AAC5D,UAAM,SAAS,MAAM,KAAK,SAAS;AACnC,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,cAAc;AAAA,EAC/C,YAAY,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AAC7D,UAAM,WAAW,MAAM,KAAK,KAAK,QAAwD;AAAA,MACvF,QAAQ;AAAA,MACR,MAAM,aAAa,EAAE;AAAA,IACvB,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AACF;;;ACnDO,IAAM,WAAN,MAAe;AAAA,EAUpB,YAAY,QAAyB;AACnC,UAAM,OAAO,IAAI,WAAW,MAAM;AAElC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,SAAK,aAAa,IAAI,mBAAmB,IAAI;AAC7C,SAAK,cAAc,IAAI,oBAAoB,IAAI;AAC/C,SAAK,UAAU,IAAI,gBAAgB,IAAI;AACvC,SAAK,QAAQ,IAAI,cAAc,IAAI;AACnC,SAAK,UAAU,IAAI,gBAAgB,IAAI;AACvC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AAAA,EAC3C;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/affiliates.ts","../src/resources/billing.ts","../src/resources/conversions.ts","../src/resources/flags.ts","../src/resources/merchant.ts","../src/resources/payouts.ts","../src/resources/programs.ts","../src/resources/webhooks.ts","../src/client.ts"],"sourcesContent":["export class AgentRefError extends Error {\n readonly code: string\n readonly status: number\n readonly requestId: string\n\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message)\n this.name = 'AgentRefError'\n this.code = code\n this.status = status\n this.requestId = requestId\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\nexport class AuthError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 401, requestId)\n this.name = 'AuthError'\n }\n}\n\nexport class ForbiddenError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 403, requestId)\n this.name = 'ForbiddenError'\n }\n}\n\nexport class ValidationError extends AgentRefError {\n readonly details: unknown\n\n constructor(message: string, code: string, requestId: string, details?: unknown) {\n super(message, code, 400, requestId)\n this.name = 'ValidationError'\n this.details = details\n }\n}\n\nexport class NotFoundError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 404, requestId)\n this.name = 'NotFoundError'\n }\n}\n\nexport class ConflictError extends AgentRefError {\n constructor(message: string, code: string, requestId: string) {\n super(message, code, 409, requestId)\n this.name = 'ConflictError'\n }\n}\n\nexport class RateLimitError extends AgentRefError {\n readonly retryAfter: number\n\n constructor(message: string, code: string, requestId: string, retryAfter: number) {\n super(message, code, 429, requestId)\n this.name = 'RateLimitError'\n this.retryAfter = retryAfter\n }\n}\n\nexport class ServerError extends AgentRefError {\n constructor(message: string, code: string, status: number, requestId: string) {\n super(message, code, status, requestId)\n this.name = 'ServerError'\n }\n}\n","import {\n AgentRefError,\n AuthError,\n ConflictError,\n ForbiddenError,\n NotFoundError,\n RateLimitError,\n ServerError,\n ValidationError,\n} from './errors.js'\nimport type { AgentRefConfig } from './types/index.js'\n\nexport type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n\nconst SAFE_METHODS: ReadonlySet<HttpMethod> = new Set(['GET', 'HEAD'])\n\nexport interface RequestOptions {\n method: HttpMethod\n path: string\n body?: unknown\n query?: Record<string, string | number | boolean | undefined>\n idempotencyKey?: string\n}\n\nconst DEFAULT_BASE_URL = 'https://www.agentref.co/api/v1'\nconst DEFAULT_TIMEOUT = 30_000\nconst DEFAULT_MAX_RETRIES = 2\n\ndeclare const __SDK_VERSION__: string\nconst VERSION = typeof __SDK_VERSION__ === 'string' ? __SDK_VERSION__ : '0.0.0'\n\nfunction hasUsableIdempotencyKey(idempotencyKey: string | undefined): boolean {\n return typeof idempotencyKey === 'string' && idempotencyKey.trim().length > 0\n}\n\nexport class HttpClient {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n private readonly maxRetries: number\n\n constructor(config: AgentRefConfig = {}) {\n if (typeof window !== 'undefined' && !config.dangerouslyAllowBrowser) {\n throw new Error(\n '[AgentRef] Refusing to initialize in browser context. API keys must not be exposed client-side. Use a server-side proxy to call the AgentRef API instead. To override: set dangerouslyAllowBrowser: true (understand the security implications first).'\n )\n }\n\n const apiKey = config.apiKey ?? process.env['AGENTREF_API_KEY']\n if (!apiKey) {\n throw new Error(\n '[AgentRef] API key is required. Pass it as apiKey or set the AGENTREF_API_KEY environment variable.'\n )\n }\n\n this.apiKey = apiKey\n this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/$/, '')\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT\n this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES\n }\n\n async request<T>(options: RequestOptions): Promise<T> {\n const url = this.buildUrl(options.path, options.query)\n const isSafe = SAFE_METHODS.has(options.method)\n const hasIdempotency = options.method === 'POST' && hasUsableIdempotencyKey(options.idempotencyKey)\n const canRetry = isSafe || hasIdempotency\n const maxAttempts = canRetry ? this.maxRetries + 1 : 1\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n let response: Response\n\n try {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n 'Content-Type': 'application/json',\n 'User-Agent': `agentref-node/${VERSION}`,\n }\n\n if (hasIdempotency) {\n headers['Idempotency-Key'] = options.idempotencyKey!.trim()\n }\n\n response = await fetch(url, {\n method: options.method,\n headers,\n body: options.body !== undefined ? JSON.stringify(options.body) : undefined,\n signal: AbortSignal.timeout(this.timeout),\n })\n } catch (error) {\n if (canRetry && attempt < maxAttempts - 1) {\n await this.wait(this.backoff(attempt))\n continue\n }\n throw error\n }\n\n if (!response.ok) {\n const parsedError = await this.parseError(response)\n\n if (canRetry && this.isRetryable(response.status) && attempt < maxAttempts - 1) {\n const delay =\n response.status === 429\n ? this.retryAfterToMs(response.headers.get('Retry-After'))\n : this.backoff(attempt)\n await this.wait(delay)\n continue\n }\n\n throw parsedError\n }\n\n return response.json() as Promise<T>\n }\n\n throw new ServerError('Request failed after retries', 'REQUEST_RETRY_EXHAUSTED', 500, '')\n }\n\n private buildUrl(path: string, query?: Record<string, string | number | boolean | undefined>): string {\n const normalizedPath = path.startsWith('/') ? path : `/${path}`\n const url = new URL(`${this.baseUrl}${normalizedPath}`)\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, String(value))\n }\n }\n }\n\n return url.toString()\n }\n\n private async parseError(response: Response): Promise<AgentRefError> {\n const json = (await response.json().catch(() => ({}))) as {\n error?: { code?: string; message?: string; details?: unknown }\n meta?: { requestId?: string }\n }\n\n const code = json.error?.code ?? 'UNKNOWN_ERROR'\n const message = json.error?.message ?? response.statusText\n const requestId = json.meta?.requestId ?? ''\n const details = json.error?.details\n\n if (response.status === 400) return new ValidationError(message, code, requestId, details)\n if (response.status === 401) return new AuthError(message, code, requestId)\n if (response.status === 403) return new ForbiddenError(message, code, requestId)\n if (response.status === 404) return new NotFoundError(message, code, requestId)\n if (response.status === 409) return new ConflictError(message, code, requestId)\n if (response.status === 429) {\n return new RateLimitError(message, code, requestId, this.retryAfterToSeconds(response.headers.get('Retry-After')))\n }\n\n return new ServerError(message, code, response.status, requestId)\n }\n\n private isRetryable(status: number): boolean {\n return status === 429 || status >= 500\n }\n\n private retryAfterToSeconds(headerValue: string | null): number {\n if (!headerValue) return 60\n\n const numericSeconds = Number(headerValue)\n if (!Number.isNaN(numericSeconds) && numericSeconds >= 0) {\n return Math.ceil(numericSeconds)\n }\n\n const asDate = Date.parse(headerValue)\n if (!Number.isNaN(asDate)) {\n const deltaMs = asDate - Date.now()\n return Math.max(0, Math.ceil(deltaMs / 1000))\n }\n\n return 60\n }\n\n private retryAfterToMs(headerValue: string | null): number {\n return this.retryAfterToSeconds(headerValue) * 1000\n }\n\n private wait(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms)\n })\n }\n\n private backoff(attempt: number): number {\n return 500 * Math.pow(2, attempt)\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Affiliate, AffiliateSortBy, AffiliateStatus, MutationOptions, PaginatedResponse, SortOrder } from '../types/index.js'\n\nexport class AffiliatesResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n includeBlocked?: boolean\n search?: string\n sortBy?: AffiliateSortBy\n sortOrder?: SortOrder\n status?: AffiliateStatus\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({ method: 'GET', path: '/affiliates', query: params })\n }\n\n async get(id: string, options?: { include?: 'stats' }): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'GET',\n path: `/affiliates/${id}`,\n query: options?.include ? { include: options.include } : undefined,\n })\n return envelope.data\n }\n\n async approve(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/approve`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async block(id: string, data?: { reason?: string }, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/block`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async unblock(id: string, options?: MutationOptions): Promise<Affiliate> {\n const envelope = await this.http.request<{ data: Affiliate; meta: unknown }>({\n method: 'POST',\n path: `/affiliates/${id}/unblock`,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { BillingStatus, BillingTier, MutationOptions } from '../types/index.js'\n\nexport class BillingResource {\n constructor(private readonly http: HttpClient) {}\n\n async current(): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'GET',\n path: '/billing',\n })\n return envelope.data\n }\n\n async tiers(): Promise<BillingTier[]> {\n const envelope = await this.http.request<{ data: BillingTier[]; meta: unknown }>({\n method: 'GET',\n path: '/billing/tiers',\n })\n return envelope.data\n }\n\n async subscribe(data: { tier: 'starter' | 'growth' | 'pro' | 'scale' }, options?: MutationOptions): Promise<BillingStatus> {\n const envelope = await this.http.request<{ data: BillingStatus; meta: unknown }>({\n method: 'POST',\n path: '/billing/subscribe',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Conversion, ConversionStats, PaginatedResponse } from '../types/index.js'\n\nexport class ConversionsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: string\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Conversion>> {\n return this.http.request({ method: 'GET', path: '/conversions', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<ConversionStats> {\n const envelope = await this.http.request<{ data: ConversionStats; meta: unknown }>({\n method: 'GET',\n path: '/conversions/stats',\n query: params,\n })\n return envelope.data\n }\n\n async recent(params?: { limit?: number }): Promise<Conversion[]> {\n const envelope = await this.http.request<{ data: Conversion[]; meta: unknown }>({\n method: 'GET',\n path: '/conversions/recent',\n query: params,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { Flag, FlagStats, MutationOptions, PaginatedResponse, ResolveFlagParams } from '../types/index.js'\n\nexport class FlagsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n status?: string\n type?: string\n affiliateId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Flag>> {\n return this.http.request({ method: 'GET', path: '/flags', query: params })\n }\n\n async stats(): Promise<FlagStats> {\n const envelope = await this.http.request<{ data: FlagStats; meta: unknown }>({\n method: 'GET',\n path: '/flags/stats',\n })\n return envelope.data\n }\n\n async resolve(id: string, data: ResolveFlagParams, options?: MutationOptions): Promise<Flag> {\n const envelope = await this.http.request<{ data: Flag; meta: unknown }>({\n method: 'POST',\n path: `/flags/${id}/resolve`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Merchant,\n NotificationPreferences,\n PayoutInfo,\n UpdateMerchantParams,\n UpdateNotificationPreferencesParams,\n UpdatePayoutInfoParams,\n} from '../types/index.js'\n\nexport class MerchantResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'GET',\n path: '/merchant',\n })\n return envelope.data\n }\n\n async update(data: UpdateMerchantParams): Promise<Merchant> {\n const envelope = await this.http.request<{ data: Merchant; meta: unknown }>({\n method: 'PATCH',\n path: '/merchant',\n body: data,\n })\n return envelope.data\n }\n\n async getPayoutInfo(): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'GET',\n path: '/me/payout-info',\n })\n return envelope.data\n }\n\n async updatePayoutInfo(data: UpdatePayoutInfoParams): Promise<PayoutInfo> {\n const envelope = await this.http.request<{ data: PayoutInfo; meta: unknown }>({\n method: 'PATCH',\n path: '/me/payout-info',\n body: data,\n })\n return envelope.data\n }\n\n async getNotifications(): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'GET',\n path: '/merchant/notifications',\n })\n return envelope.data\n }\n\n async updateNotifications(data: UpdateNotificationPreferencesParams): Promise<NotificationPreferences> {\n const envelope = await this.http.request<{ data: NotificationPreferences; meta: unknown }>({\n method: 'PUT',\n path: '/merchant/notifications',\n body: data,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type { CreatePayoutParams, MutationOptions, PaginatedResponse, PendingAffiliate, Payout, PayoutStats, PayoutStatus } from '../types/index.js'\n\nexport class PayoutsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n programId?: string\n affiliateId?: string\n status?: PayoutStatus\n startDate?: string\n endDate?: string\n from?: string\n to?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<Payout>> {\n return this.http.request({ method: 'GET', path: '/payouts', query: params })\n }\n\n listPending(params?: {\n programId?: string\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n }): Promise<PaginatedResponse<PendingAffiliate>> {\n return this.http.request({ method: 'GET', path: '/payouts/pending', query: params })\n }\n\n async stats(params?: { programId?: string; period?: '7d' | '30d' | '90d' | 'all' }): Promise<PayoutStats> {\n const envelope = await this.http.request<{ data: PayoutStats; meta: unknown }>({\n method: 'GET',\n path: '/payouts/stats',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreatePayoutParams, options?: MutationOptions): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'POST',\n path: '/payouts',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n Affiliate,\n Coupon,\n ConnectProgramStripeParams,\n ConnectProgramStripeResponse,\n CreateCouponParams,\n CreateInviteParams,\n CreateProgramParams,\n DisconnectProgramStripeResponse,\n Invite,\n MutationOptions,\n PaginatedResponse,\n Program,\n ProgramDetail,\n ProgramStats,\n ProgramStatus,\n UpdateProgramMarketplaceParams,\n UpdateProgramParams,\n} from '../types/index.js'\n\nexport class ProgramsResource {\n constructor(private readonly http: HttpClient) {}\n\n list(params?: {\n cursor?: string\n limit?: number\n page?: number\n pageSize?: number\n offset?: number\n status?: ProgramStatus\n }): Promise<PaginatedResponse<Program>> {\n return this.http.request({ method: 'GET', path: '/programs', query: params })\n }\n\n async *listAll(params?: {\n pageSize?: number\n }): AsyncGenerator<Program> {\n let page = 1\n const pageSize = params?.pageSize ?? 100\n\n while (true) {\n const response = await this.list({ page, limit: pageSize })\n yield* response.data\n\n if (!response.meta.hasMore) {\n break\n }\n\n page += 1\n }\n }\n\n async get(id: string): Promise<ProgramDetail> {\n const envelope = await this.http.request<{ data: ProgramDetail; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async create(data: CreateProgramParams, options?: MutationOptions): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'POST',\n path: '/programs',\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateProgramParams): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<Program> {\n const envelope = await this.http.request<{ data: Program; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}`,\n })\n return envelope.data\n }\n\n async stats(id: string, params?: { period?: string }): Promise<ProgramStats> {\n const envelope = await this.http.request<{ data: ProgramStats; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/stats`,\n query: params,\n })\n return envelope.data\n }\n\n listAffiliates(\n id: string,\n params?: { includeBlocked?: boolean; cursor?: string; limit?: number; page?: number; pageSize?: number; offset?: number }\n ): Promise<PaginatedResponse<Affiliate>> {\n return this.http.request({\n method: 'GET',\n path: `/programs/${id}/affiliates`,\n query: params,\n })\n }\n\n async listCoupons(id: string): Promise<Coupon[]> {\n const envelope = await this.http.request<{ data: Coupon[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/coupons`,\n })\n return envelope.data\n }\n\n async createCoupon(id: string, data: CreateCouponParams, options?: MutationOptions): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/coupons`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async createInvite(\n id: string,\n data: CreateInviteParams,\n options?: MutationOptions\n ): Promise<Invite> {\n const envelope = await this.http.request<{ data: Invite; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/invites`,\n body: data,\n idempotencyKey: options?.idempotencyKey,\n })\n return envelope.data\n }\n\n async listInvites(id: string): Promise<Invite[]> {\n const envelope = await this.http.request<{ data: Invite[]; meta: unknown }>({\n method: 'GET',\n path: `/programs/${id}/invites`,\n })\n return envelope.data\n }\n\n async deleteCoupon(couponId: string): Promise<Coupon> {\n const envelope = await this.http.request<{ data: Coupon; meta: unknown }>({\n method: 'DELETE',\n path: `/coupons/${couponId}`,\n })\n return envelope.data\n }\n\n async updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>> {\n const envelope = await this.http.request<{ data: Record<string, unknown>; meta: unknown }>({\n method: 'PATCH',\n path: `/programs/${id}/marketplace`,\n body: data,\n })\n return envelope.data\n }\n\n async connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: ConnectProgramStripeResponse; meta: unknown }>({\n method: 'POST',\n path: `/programs/${id}/connect-stripe`,\n body: data,\n })\n return envelope.data\n }\n\n async disconnectStripe(id: string): Promise<DisconnectProgramStripeResponse> {\n const envelope = await this.http.request<{ data: DisconnectProgramStripeResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/programs/${id}/connect-stripe`,\n })\n return envelope.data\n }\n}\n","import type { HttpClient } from '../http.js'\nimport type {\n CreateWebhookEndpointParams,\n SuccessResponse,\n UpdateWebhookEndpointParams,\n WebhookEndpoint,\n WebhookSecretResponse,\n} from '../types/index.js'\n\nexport class WebhooksResource {\n constructor(private readonly http: HttpClient) {}\n\n async list(params?: { programId?: string }): Promise<WebhookEndpoint[]> {\n const envelope = await this.http.request<{ data: WebhookEndpoint[]; meta: unknown }>({\n method: 'GET',\n path: '/webhooks',\n query: params,\n })\n return envelope.data\n }\n\n async create(data: CreateWebhookEndpointParams): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: '/webhooks',\n body: data,\n })\n return envelope.data\n }\n\n async get(id: string): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'GET',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async update(id: string, data: UpdateWebhookEndpointParams): Promise<WebhookEndpoint> {\n const envelope = await this.http.request<{ data: WebhookEndpoint; meta: unknown }>({\n method: 'PATCH',\n path: `/webhooks/${id}`,\n body: data,\n })\n return envelope.data\n }\n\n async delete(id: string): Promise<SuccessResponse> {\n const envelope = await this.http.request<{ data: SuccessResponse; meta: unknown }>({\n method: 'DELETE',\n path: `/webhooks/${id}`,\n })\n return envelope.data\n }\n\n async rotateSecret(id: string): Promise<WebhookSecretResponse> {\n const envelope = await this.http.request<{ data: WebhookSecretResponse; meta: unknown }>({\n method: 'POST',\n path: `/webhooks/${id}/rotate-secret`,\n })\n return envelope.data\n }\n}\n","import { HttpClient } from './http.js'\nimport type { AgentRefConfig } from './types/index.js'\nimport { AffiliatesResource } from './resources/affiliates.js'\nimport { BillingResource } from './resources/billing.js'\nimport { ConversionsResource } from './resources/conversions.js'\nimport { FlagsResource } from './resources/flags.js'\nimport { MerchantResource } from './resources/merchant.js'\nimport { PayoutsResource } from './resources/payouts.js'\nimport { ProgramsResource } from './resources/programs.js'\nimport { WebhooksResource } from './resources/webhooks.js'\n\nexport class AgentRef {\n readonly programs: ProgramsResource\n readonly affiliates: AffiliatesResource\n readonly conversions: ConversionsResource\n readonly payouts: PayoutsResource\n readonly flags: FlagsResource\n readonly billing: BillingResource\n readonly merchant: MerchantResource\n readonly webhooks: WebhooksResource\n\n constructor(config?: AgentRefConfig) {\n const http = new HttpClient(config)\n\n this.programs = new ProgramsResource(http)\n this.affiliates = new AffiliatesResource(http)\n this.conversions = new ConversionsResource(http)\n this.payouts = new PayoutsResource(http)\n this.flags = new FlagsResource(http)\n this.billing = new BillingResource(http)\n this.merchant = new MerchantResource(http)\n this.webhooks = new WebhooksResource(http)\n }\n}\n"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AW,MAAM,KAAK,KAAK,QAAkD;AAAA,MACjF,QAAQ;AAAA,MACR,MAAM,aAAa,EAAE;AAAA,MACrB,MAAM;AAAA,IACR,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,OAAO,IAAsC;AACjD,UAAM,WAAW,MAAM,KAAK,KAAK,QAAkD;AAAA,MACjF,QAAQ;AAAA,MACR,MAAM,aAAa,EAAE;AAAA,IACvB,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,aAAa,IAA4C;AAC7D,UAAM,WAAW,MAAM,KAAK,KAAK,QAAwD;AAAA,MACvF,QAAQ;AAAA,MACR,MAAM,aAAa,EAAE;AAAA,IACvB,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AACF;;;ACnDO,IAAM,WAAN,MAAe;AAAA,EAUpB,YAAY,QAAyB;AACnC,UAAM,OAAO,IAAI,WAAW,MAAM;AAElC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,SAAK,aAAa,IAAI,mBAAmB,IAAI;AAC7C,SAAK,cAAc,IAAI,oBAAoB,IAAI;AAC/C,SAAK,UAAU,IAAI,gBAAgB,IAAI;AACvC,SAAK,QAAQ,IAAI,cAAc,IAAI;AACnC,SAAK,UAAU,IAAI,gBAAgB,IAAI;AACvC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AACzC,SAAK,WAAW,IAAI,iBAAiB,IAAI;AAAA,EAC3C;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentref",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Official TypeScript/JavaScript SDK for the AgentRef Affiliate API",
5
5
  "author": "AgentRef <hi@agentref.dev>",
6
6
  "license": "MIT",