agentref 1.0.5 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -3
- package/dist/index.cjs +91 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +163 -29
- package/dist/index.d.ts +163 -29
- package/dist/index.mjs +91 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -20,52 +20,81 @@ interface AgentRefConfig {
|
|
|
20
20
|
interface MutationOptions {
|
|
21
21
|
idempotencyKey?: string;
|
|
22
22
|
}
|
|
23
|
+
type BillingRequirementStatus = 'not_required' | 'required' | 'grace_period' | 'restricted' | 'active';
|
|
23
24
|
interface Merchant {
|
|
24
25
|
id: string;
|
|
25
|
-
|
|
26
|
-
companyName: string
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
userId: string;
|
|
27
|
+
companyName: string;
|
|
28
|
+
logoUrl: string | null;
|
|
29
|
+
billingTier: string;
|
|
30
|
+
billingRequirementStatus: BillingRequirementStatus;
|
|
31
|
+
paymentStatus: string;
|
|
32
|
+
lastPaymentFailedAt: string | null;
|
|
33
|
+
defaultCookieDuration: number;
|
|
34
|
+
defaultPayoutThreshold: number;
|
|
35
|
+
timezone: string;
|
|
36
|
+
trackingRequiresConsent: boolean;
|
|
37
|
+
trackingParamAliases: string[];
|
|
38
|
+
trackingLegacyMetadataFallbackEnabled: boolean;
|
|
39
|
+
notificationPreferences: NotificationPreferences | null;
|
|
40
|
+
onboardingCompleted: boolean;
|
|
41
|
+
onboardingStep: number;
|
|
31
42
|
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
32
44
|
}
|
|
33
45
|
interface UpdateMerchantParams {
|
|
34
46
|
companyName?: string;
|
|
35
|
-
website?: string;
|
|
36
47
|
logoUrl?: string;
|
|
37
48
|
timezone?: string;
|
|
38
49
|
defaultCookieDuration?: number;
|
|
39
50
|
defaultPayoutThreshold?: number;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
verified: boolean;
|
|
44
|
-
txtRecord: string | null;
|
|
45
|
-
}
|
|
46
|
-
interface StripeConnectSession {
|
|
47
|
-
url: string;
|
|
51
|
+
trackingRequiresConsent?: boolean;
|
|
52
|
+
trackingParamAliases?: string[];
|
|
53
|
+
trackingLegacyMetadataFallbackEnabled?: boolean;
|
|
48
54
|
}
|
|
49
55
|
type CommissionType = 'one_time' | 'recurring' | 'recurring_limited';
|
|
50
56
|
type ProgramStatus = 'active' | 'paused' | 'archived';
|
|
57
|
+
type ProgramMarketplaceStatus = 'private' | 'pending' | 'public';
|
|
51
58
|
type ProgramMarketplaceVisibility = 'private' | 'public';
|
|
59
|
+
type ProgramReadiness = 'setup' | 'partial' | 'ready';
|
|
60
|
+
type StripeConnectMethod = 'oauth_url' | 'restricted_key' | 'fallback_url';
|
|
52
61
|
interface Program {
|
|
53
62
|
id: string;
|
|
63
|
+
merchantId: string;
|
|
54
64
|
name: string;
|
|
55
65
|
description: string | null;
|
|
66
|
+
slug: string;
|
|
67
|
+
website: string | null;
|
|
56
68
|
landingPageUrl: string | null;
|
|
69
|
+
portalSlug: string | null;
|
|
70
|
+
status: ProgramStatus;
|
|
71
|
+
marketplaceStatus: ProgramMarketplaceStatus;
|
|
72
|
+
marketplaceCategory: string | null;
|
|
73
|
+
marketplaceDescription: string | null;
|
|
74
|
+
marketplaceLogoUrl: string | null;
|
|
57
75
|
commissionType: CommissionType;
|
|
58
76
|
commissionPercent: number;
|
|
59
77
|
commissionLimitMonths: number | null;
|
|
78
|
+
commissionHoldDays: number;
|
|
60
79
|
cookieDuration: number;
|
|
80
|
+
trackingRequiresConsent: boolean | null;
|
|
81
|
+
trackingParamAliases: string[] | null;
|
|
82
|
+
trackingLegacyMetadataFallbackEnabled: boolean | null;
|
|
61
83
|
payoutThreshold: number;
|
|
84
|
+
currency: string;
|
|
62
85
|
autoApproveAffiliates: boolean;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
termsUrl: string | null;
|
|
87
|
+
stripeAccountId: string | null;
|
|
88
|
+
stripeConnectedAt: string | null;
|
|
89
|
+
verifiedDomain: string | null;
|
|
90
|
+
domainVerificationToken: string | null;
|
|
91
|
+
domainVerifiedAt: string | null;
|
|
66
92
|
createdAt: string;
|
|
67
93
|
updatedAt: string;
|
|
68
94
|
}
|
|
95
|
+
interface ProgramDetail extends Program {
|
|
96
|
+
readiness: ProgramReadiness;
|
|
97
|
+
}
|
|
69
98
|
interface UpdateProgramMarketplaceParams {
|
|
70
99
|
status?: ProgramMarketplaceVisibility;
|
|
71
100
|
category?: string;
|
|
@@ -82,6 +111,8 @@ interface CreateProgramParams {
|
|
|
82
111
|
description?: string;
|
|
83
112
|
landingPageUrl?: string;
|
|
84
113
|
commissionLimitMonths?: number;
|
|
114
|
+
portalSlug?: string;
|
|
115
|
+
currency?: string;
|
|
85
116
|
}
|
|
86
117
|
interface UpdateProgramParams {
|
|
87
118
|
name?: string;
|
|
@@ -93,7 +124,45 @@ interface UpdateProgramParams {
|
|
|
93
124
|
description?: string;
|
|
94
125
|
landingPageUrl?: string;
|
|
95
126
|
status?: ProgramStatus;
|
|
96
|
-
|
|
127
|
+
portalSlug?: string | null;
|
|
128
|
+
currency?: string;
|
|
129
|
+
commissionLimitMonths?: number | null;
|
|
130
|
+
}
|
|
131
|
+
interface ConnectProgramStripeParams {
|
|
132
|
+
method?: StripeConnectMethod;
|
|
133
|
+
stripeAccountId?: string;
|
|
134
|
+
}
|
|
135
|
+
interface ConnectProgramStripeResponse {
|
|
136
|
+
connected: boolean;
|
|
137
|
+
method: StripeConnectMethod;
|
|
138
|
+
programId: string;
|
|
139
|
+
programReadiness?: ProgramReadiness;
|
|
140
|
+
stripeAccountId?: string;
|
|
141
|
+
authUrl?: string;
|
|
142
|
+
message: string;
|
|
143
|
+
}
|
|
144
|
+
interface DisconnectProgramStripeResponse {
|
|
145
|
+
success: boolean;
|
|
146
|
+
programId: string;
|
|
147
|
+
}
|
|
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
|
+
interface SuccessResponse {
|
|
165
|
+
success: boolean;
|
|
97
166
|
}
|
|
98
167
|
interface CreateCouponParams {
|
|
99
168
|
affiliateId: string;
|
|
@@ -101,11 +170,20 @@ interface CreateCouponParams {
|
|
|
101
170
|
expiresAt?: string;
|
|
102
171
|
}
|
|
103
172
|
interface ProgramStats {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
173
|
+
programId: string;
|
|
174
|
+
programName: string;
|
|
175
|
+
status: ProgramStatus;
|
|
176
|
+
totalRevenue: number;
|
|
177
|
+
totalConversions: number;
|
|
178
|
+
totalCommissions: number;
|
|
179
|
+
pendingCommissions: number;
|
|
180
|
+
activeAffiliates: number;
|
|
181
|
+
conversionsByStatus: {
|
|
182
|
+
pending: number;
|
|
183
|
+
approved: number;
|
|
184
|
+
rejected: number;
|
|
185
|
+
refunded: number;
|
|
186
|
+
};
|
|
109
187
|
}
|
|
110
188
|
type AffiliateStatus = 'pending' | 'approved' | 'blocked';
|
|
111
189
|
interface Affiliate {
|
|
@@ -243,7 +321,9 @@ interface CreateInviteParams {
|
|
|
243
321
|
interface PayoutInfo {
|
|
244
322
|
payoutMethod: 'paypal' | 'bank_transfer' | null;
|
|
245
323
|
paypalEmail: string | null;
|
|
324
|
+
bankAccountHolder: string | null;
|
|
246
325
|
bankIban: string | null;
|
|
326
|
+
bankBic: string | null;
|
|
247
327
|
firstName: string | null;
|
|
248
328
|
lastName: string | null;
|
|
249
329
|
addressLine1: string | null;
|
|
@@ -256,7 +336,9 @@ interface PayoutInfo {
|
|
|
256
336
|
interface UpdatePayoutInfoParams {
|
|
257
337
|
payoutMethod?: 'paypal' | 'bank_transfer';
|
|
258
338
|
paypalEmail?: string;
|
|
339
|
+
bankAccountHolder?: string;
|
|
259
340
|
bankIban?: string;
|
|
341
|
+
bankBic?: string;
|
|
260
342
|
firstName?: string;
|
|
261
343
|
lastName?: string;
|
|
262
344
|
addressLine1?: string;
|
|
@@ -280,6 +362,39 @@ interface UpdateNotificationPreferencesParams {
|
|
|
280
362
|
payoutProcessed?: boolean;
|
|
281
363
|
weeklyDigest?: boolean;
|
|
282
364
|
}
|
|
365
|
+
type WebhookEventType = 'program.created' | 'program.updated' | 'affiliate.joined' | 'affiliate.approved' | 'affiliate.blocked' | 'affiliate.unblocked' | 'conversion.created' | 'conversion.refunded' | 'payout.created' | 'payout.processing' | 'payout.completed' | 'payout.failed' | 'flag.resolved';
|
|
366
|
+
type WebhookEndpointStatus = 'active' | 'disabled';
|
|
367
|
+
interface WebhookEndpoint {
|
|
368
|
+
id: string;
|
|
369
|
+
name: string;
|
|
370
|
+
url: string;
|
|
371
|
+
status: WebhookEndpointStatus;
|
|
372
|
+
programId: string | null;
|
|
373
|
+
schemaVersion: 2;
|
|
374
|
+
subscribedEvents: WebhookEventType[];
|
|
375
|
+
secretLastFour: string | null;
|
|
376
|
+
createdAt: string;
|
|
377
|
+
updatedAt: string;
|
|
378
|
+
disabledAt: string | null;
|
|
379
|
+
}
|
|
380
|
+
interface CreateWebhookEndpointParams {
|
|
381
|
+
name: string;
|
|
382
|
+
url: string;
|
|
383
|
+
programId?: string;
|
|
384
|
+
schemaVersion?: 2;
|
|
385
|
+
subscribedEvents: WebhookEventType[];
|
|
386
|
+
}
|
|
387
|
+
interface UpdateWebhookEndpointParams {
|
|
388
|
+
name?: string;
|
|
389
|
+
url?: string;
|
|
390
|
+
programId?: string | null;
|
|
391
|
+
schemaVersion?: 2;
|
|
392
|
+
subscribedEvents?: WebhookEventType[];
|
|
393
|
+
}
|
|
394
|
+
interface WebhookSecretResponse {
|
|
395
|
+
endpoint: WebhookEndpoint;
|
|
396
|
+
signingSecret: string;
|
|
397
|
+
}
|
|
283
398
|
|
|
284
399
|
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
285
400
|
interface RequestOptions {
|
|
@@ -389,8 +504,6 @@ declare class MerchantResource {
|
|
|
389
504
|
constructor(http: HttpClient);
|
|
390
505
|
get(): Promise<Merchant>;
|
|
391
506
|
update(data: UpdateMerchantParams): Promise<Merchant>;
|
|
392
|
-
connectStripe(): Promise<StripeConnectSession>;
|
|
393
|
-
domainStatus(): Promise<MerchantDomainStatus>;
|
|
394
507
|
getPayoutInfo(): Promise<PayoutInfo>;
|
|
395
508
|
updatePayoutInfo(data: UpdatePayoutInfoParams): Promise<PayoutInfo>;
|
|
396
509
|
getNotifications(): Promise<NotificationPreferences>;
|
|
@@ -438,12 +551,12 @@ declare class ProgramsResource {
|
|
|
438
551
|
page?: number;
|
|
439
552
|
pageSize?: number;
|
|
440
553
|
offset?: number;
|
|
441
|
-
status?:
|
|
554
|
+
status?: ProgramStatus;
|
|
442
555
|
}): Promise<PaginatedResponse<Program>>;
|
|
443
556
|
listAll(params?: {
|
|
444
557
|
pageSize?: number;
|
|
445
558
|
}): AsyncGenerator<Program>;
|
|
446
|
-
get(id: string): Promise<
|
|
559
|
+
get(id: string): Promise<ProgramDetail>;
|
|
447
560
|
create(data: CreateProgramParams, options?: MutationOptions): Promise<Program>;
|
|
448
561
|
update(id: string, data: UpdateProgramParams): Promise<Program>;
|
|
449
562
|
delete(id: string): Promise<Program>;
|
|
@@ -464,6 +577,26 @@ declare class ProgramsResource {
|
|
|
464
577
|
listInvites(id: string): Promise<Invite[]>;
|
|
465
578
|
deleteCoupon(couponId: string): Promise<Coupon>;
|
|
466
579
|
updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>>;
|
|
580
|
+
connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse>;
|
|
581
|
+
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
|
+
}
|
|
588
|
+
|
|
589
|
+
declare class WebhooksResource {
|
|
590
|
+
private readonly http;
|
|
591
|
+
constructor(http: HttpClient);
|
|
592
|
+
list(params?: {
|
|
593
|
+
programId?: string;
|
|
594
|
+
}): Promise<WebhookEndpoint[]>;
|
|
595
|
+
create(data: CreateWebhookEndpointParams): Promise<WebhookSecretResponse>;
|
|
596
|
+
get(id: string): Promise<WebhookEndpoint>;
|
|
597
|
+
update(id: string, data: UpdateWebhookEndpointParams): Promise<WebhookEndpoint>;
|
|
598
|
+
delete(id: string): Promise<SuccessResponse>;
|
|
599
|
+
rotateSecret(id: string): Promise<WebhookSecretResponse>;
|
|
467
600
|
}
|
|
468
601
|
|
|
469
602
|
declare class AgentRef {
|
|
@@ -474,6 +607,7 @@ declare class AgentRef {
|
|
|
474
607
|
readonly flags: FlagsResource;
|
|
475
608
|
readonly billing: BillingResource;
|
|
476
609
|
readonly merchant: MerchantResource;
|
|
610
|
+
readonly webhooks: WebhooksResource;
|
|
477
611
|
constructor(config?: AgentRefConfig);
|
|
478
612
|
}
|
|
479
613
|
|
|
@@ -507,4 +641,4 @@ declare class ServerError extends AgentRefError {
|
|
|
507
641
|
constructor(message: string, code: string, status: number, requestId: string);
|
|
508
642
|
}
|
|
509
643
|
|
|
510
|
-
export { type Affiliate, type AffiliateSortBy, type AffiliateStatus, AgentRef, type AgentRefConfig, AgentRefError, AuthError, type BillingStatus, type BillingTier, type BillingTierId, type CommissionType, ConflictError, type Conversion, type ConversionStats, type ConversionStatus, type Coupon, type CreateCouponParams, type CreateInviteParams, type CreatePayoutParams, type CreateProgramParams, type Flag, type FlagStats, type FlagStatus, type FlagType, ForbiddenError, type Invite, type Merchant, type
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -20,52 +20,81 @@ interface AgentRefConfig {
|
|
|
20
20
|
interface MutationOptions {
|
|
21
21
|
idempotencyKey?: string;
|
|
22
22
|
}
|
|
23
|
+
type BillingRequirementStatus = 'not_required' | 'required' | 'grace_period' | 'restricted' | 'active';
|
|
23
24
|
interface Merchant {
|
|
24
25
|
id: string;
|
|
25
|
-
|
|
26
|
-
companyName: string
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
userId: string;
|
|
27
|
+
companyName: string;
|
|
28
|
+
logoUrl: string | null;
|
|
29
|
+
billingTier: string;
|
|
30
|
+
billingRequirementStatus: BillingRequirementStatus;
|
|
31
|
+
paymentStatus: string;
|
|
32
|
+
lastPaymentFailedAt: string | null;
|
|
33
|
+
defaultCookieDuration: number;
|
|
34
|
+
defaultPayoutThreshold: number;
|
|
35
|
+
timezone: string;
|
|
36
|
+
trackingRequiresConsent: boolean;
|
|
37
|
+
trackingParamAliases: string[];
|
|
38
|
+
trackingLegacyMetadataFallbackEnabled: boolean;
|
|
39
|
+
notificationPreferences: NotificationPreferences | null;
|
|
40
|
+
onboardingCompleted: boolean;
|
|
41
|
+
onboardingStep: number;
|
|
31
42
|
createdAt: string;
|
|
43
|
+
updatedAt: string;
|
|
32
44
|
}
|
|
33
45
|
interface UpdateMerchantParams {
|
|
34
46
|
companyName?: string;
|
|
35
|
-
website?: string;
|
|
36
47
|
logoUrl?: string;
|
|
37
48
|
timezone?: string;
|
|
38
49
|
defaultCookieDuration?: number;
|
|
39
50
|
defaultPayoutThreshold?: number;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
verified: boolean;
|
|
44
|
-
txtRecord: string | null;
|
|
45
|
-
}
|
|
46
|
-
interface StripeConnectSession {
|
|
47
|
-
url: string;
|
|
51
|
+
trackingRequiresConsent?: boolean;
|
|
52
|
+
trackingParamAliases?: string[];
|
|
53
|
+
trackingLegacyMetadataFallbackEnabled?: boolean;
|
|
48
54
|
}
|
|
49
55
|
type CommissionType = 'one_time' | 'recurring' | 'recurring_limited';
|
|
50
56
|
type ProgramStatus = 'active' | 'paused' | 'archived';
|
|
57
|
+
type ProgramMarketplaceStatus = 'private' | 'pending' | 'public';
|
|
51
58
|
type ProgramMarketplaceVisibility = 'private' | 'public';
|
|
59
|
+
type ProgramReadiness = 'setup' | 'partial' | 'ready';
|
|
60
|
+
type StripeConnectMethod = 'oauth_url' | 'restricted_key' | 'fallback_url';
|
|
52
61
|
interface Program {
|
|
53
62
|
id: string;
|
|
63
|
+
merchantId: string;
|
|
54
64
|
name: string;
|
|
55
65
|
description: string | null;
|
|
66
|
+
slug: string;
|
|
67
|
+
website: string | null;
|
|
56
68
|
landingPageUrl: string | null;
|
|
69
|
+
portalSlug: string | null;
|
|
70
|
+
status: ProgramStatus;
|
|
71
|
+
marketplaceStatus: ProgramMarketplaceStatus;
|
|
72
|
+
marketplaceCategory: string | null;
|
|
73
|
+
marketplaceDescription: string | null;
|
|
74
|
+
marketplaceLogoUrl: string | null;
|
|
57
75
|
commissionType: CommissionType;
|
|
58
76
|
commissionPercent: number;
|
|
59
77
|
commissionLimitMonths: number | null;
|
|
78
|
+
commissionHoldDays: number;
|
|
60
79
|
cookieDuration: number;
|
|
80
|
+
trackingRequiresConsent: boolean | null;
|
|
81
|
+
trackingParamAliases: string[] | null;
|
|
82
|
+
trackingLegacyMetadataFallbackEnabled: boolean | null;
|
|
61
83
|
payoutThreshold: number;
|
|
84
|
+
currency: string;
|
|
62
85
|
autoApproveAffiliates: boolean;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
termsUrl: string | null;
|
|
87
|
+
stripeAccountId: string | null;
|
|
88
|
+
stripeConnectedAt: string | null;
|
|
89
|
+
verifiedDomain: string | null;
|
|
90
|
+
domainVerificationToken: string | null;
|
|
91
|
+
domainVerifiedAt: string | null;
|
|
66
92
|
createdAt: string;
|
|
67
93
|
updatedAt: string;
|
|
68
94
|
}
|
|
95
|
+
interface ProgramDetail extends Program {
|
|
96
|
+
readiness: ProgramReadiness;
|
|
97
|
+
}
|
|
69
98
|
interface UpdateProgramMarketplaceParams {
|
|
70
99
|
status?: ProgramMarketplaceVisibility;
|
|
71
100
|
category?: string;
|
|
@@ -82,6 +111,8 @@ interface CreateProgramParams {
|
|
|
82
111
|
description?: string;
|
|
83
112
|
landingPageUrl?: string;
|
|
84
113
|
commissionLimitMonths?: number;
|
|
114
|
+
portalSlug?: string;
|
|
115
|
+
currency?: string;
|
|
85
116
|
}
|
|
86
117
|
interface UpdateProgramParams {
|
|
87
118
|
name?: string;
|
|
@@ -93,7 +124,45 @@ interface UpdateProgramParams {
|
|
|
93
124
|
description?: string;
|
|
94
125
|
landingPageUrl?: string;
|
|
95
126
|
status?: ProgramStatus;
|
|
96
|
-
|
|
127
|
+
portalSlug?: string | null;
|
|
128
|
+
currency?: string;
|
|
129
|
+
commissionLimitMonths?: number | null;
|
|
130
|
+
}
|
|
131
|
+
interface ConnectProgramStripeParams {
|
|
132
|
+
method?: StripeConnectMethod;
|
|
133
|
+
stripeAccountId?: string;
|
|
134
|
+
}
|
|
135
|
+
interface ConnectProgramStripeResponse {
|
|
136
|
+
connected: boolean;
|
|
137
|
+
method: StripeConnectMethod;
|
|
138
|
+
programId: string;
|
|
139
|
+
programReadiness?: ProgramReadiness;
|
|
140
|
+
stripeAccountId?: string;
|
|
141
|
+
authUrl?: string;
|
|
142
|
+
message: string;
|
|
143
|
+
}
|
|
144
|
+
interface DisconnectProgramStripeResponse {
|
|
145
|
+
success: boolean;
|
|
146
|
+
programId: string;
|
|
147
|
+
}
|
|
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
|
+
interface SuccessResponse {
|
|
165
|
+
success: boolean;
|
|
97
166
|
}
|
|
98
167
|
interface CreateCouponParams {
|
|
99
168
|
affiliateId: string;
|
|
@@ -101,11 +170,20 @@ interface CreateCouponParams {
|
|
|
101
170
|
expiresAt?: string;
|
|
102
171
|
}
|
|
103
172
|
interface ProgramStats {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
173
|
+
programId: string;
|
|
174
|
+
programName: string;
|
|
175
|
+
status: ProgramStatus;
|
|
176
|
+
totalRevenue: number;
|
|
177
|
+
totalConversions: number;
|
|
178
|
+
totalCommissions: number;
|
|
179
|
+
pendingCommissions: number;
|
|
180
|
+
activeAffiliates: number;
|
|
181
|
+
conversionsByStatus: {
|
|
182
|
+
pending: number;
|
|
183
|
+
approved: number;
|
|
184
|
+
rejected: number;
|
|
185
|
+
refunded: number;
|
|
186
|
+
};
|
|
109
187
|
}
|
|
110
188
|
type AffiliateStatus = 'pending' | 'approved' | 'blocked';
|
|
111
189
|
interface Affiliate {
|
|
@@ -243,7 +321,9 @@ interface CreateInviteParams {
|
|
|
243
321
|
interface PayoutInfo {
|
|
244
322
|
payoutMethod: 'paypal' | 'bank_transfer' | null;
|
|
245
323
|
paypalEmail: string | null;
|
|
324
|
+
bankAccountHolder: string | null;
|
|
246
325
|
bankIban: string | null;
|
|
326
|
+
bankBic: string | null;
|
|
247
327
|
firstName: string | null;
|
|
248
328
|
lastName: string | null;
|
|
249
329
|
addressLine1: string | null;
|
|
@@ -256,7 +336,9 @@ interface PayoutInfo {
|
|
|
256
336
|
interface UpdatePayoutInfoParams {
|
|
257
337
|
payoutMethod?: 'paypal' | 'bank_transfer';
|
|
258
338
|
paypalEmail?: string;
|
|
339
|
+
bankAccountHolder?: string;
|
|
259
340
|
bankIban?: string;
|
|
341
|
+
bankBic?: string;
|
|
260
342
|
firstName?: string;
|
|
261
343
|
lastName?: string;
|
|
262
344
|
addressLine1?: string;
|
|
@@ -280,6 +362,39 @@ interface UpdateNotificationPreferencesParams {
|
|
|
280
362
|
payoutProcessed?: boolean;
|
|
281
363
|
weeklyDigest?: boolean;
|
|
282
364
|
}
|
|
365
|
+
type WebhookEventType = 'program.created' | 'program.updated' | 'affiliate.joined' | 'affiliate.approved' | 'affiliate.blocked' | 'affiliate.unblocked' | 'conversion.created' | 'conversion.refunded' | 'payout.created' | 'payout.processing' | 'payout.completed' | 'payout.failed' | 'flag.resolved';
|
|
366
|
+
type WebhookEndpointStatus = 'active' | 'disabled';
|
|
367
|
+
interface WebhookEndpoint {
|
|
368
|
+
id: string;
|
|
369
|
+
name: string;
|
|
370
|
+
url: string;
|
|
371
|
+
status: WebhookEndpointStatus;
|
|
372
|
+
programId: string | null;
|
|
373
|
+
schemaVersion: 2;
|
|
374
|
+
subscribedEvents: WebhookEventType[];
|
|
375
|
+
secretLastFour: string | null;
|
|
376
|
+
createdAt: string;
|
|
377
|
+
updatedAt: string;
|
|
378
|
+
disabledAt: string | null;
|
|
379
|
+
}
|
|
380
|
+
interface CreateWebhookEndpointParams {
|
|
381
|
+
name: string;
|
|
382
|
+
url: string;
|
|
383
|
+
programId?: string;
|
|
384
|
+
schemaVersion?: 2;
|
|
385
|
+
subscribedEvents: WebhookEventType[];
|
|
386
|
+
}
|
|
387
|
+
interface UpdateWebhookEndpointParams {
|
|
388
|
+
name?: string;
|
|
389
|
+
url?: string;
|
|
390
|
+
programId?: string | null;
|
|
391
|
+
schemaVersion?: 2;
|
|
392
|
+
subscribedEvents?: WebhookEventType[];
|
|
393
|
+
}
|
|
394
|
+
interface WebhookSecretResponse {
|
|
395
|
+
endpoint: WebhookEndpoint;
|
|
396
|
+
signingSecret: string;
|
|
397
|
+
}
|
|
283
398
|
|
|
284
399
|
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
285
400
|
interface RequestOptions {
|
|
@@ -389,8 +504,6 @@ declare class MerchantResource {
|
|
|
389
504
|
constructor(http: HttpClient);
|
|
390
505
|
get(): Promise<Merchant>;
|
|
391
506
|
update(data: UpdateMerchantParams): Promise<Merchant>;
|
|
392
|
-
connectStripe(): Promise<StripeConnectSession>;
|
|
393
|
-
domainStatus(): Promise<MerchantDomainStatus>;
|
|
394
507
|
getPayoutInfo(): Promise<PayoutInfo>;
|
|
395
508
|
updatePayoutInfo(data: UpdatePayoutInfoParams): Promise<PayoutInfo>;
|
|
396
509
|
getNotifications(): Promise<NotificationPreferences>;
|
|
@@ -438,12 +551,12 @@ declare class ProgramsResource {
|
|
|
438
551
|
page?: number;
|
|
439
552
|
pageSize?: number;
|
|
440
553
|
offset?: number;
|
|
441
|
-
status?:
|
|
554
|
+
status?: ProgramStatus;
|
|
442
555
|
}): Promise<PaginatedResponse<Program>>;
|
|
443
556
|
listAll(params?: {
|
|
444
557
|
pageSize?: number;
|
|
445
558
|
}): AsyncGenerator<Program>;
|
|
446
|
-
get(id: string): Promise<
|
|
559
|
+
get(id: string): Promise<ProgramDetail>;
|
|
447
560
|
create(data: CreateProgramParams, options?: MutationOptions): Promise<Program>;
|
|
448
561
|
update(id: string, data: UpdateProgramParams): Promise<Program>;
|
|
449
562
|
delete(id: string): Promise<Program>;
|
|
@@ -464,6 +577,26 @@ declare class ProgramsResource {
|
|
|
464
577
|
listInvites(id: string): Promise<Invite[]>;
|
|
465
578
|
deleteCoupon(couponId: string): Promise<Coupon>;
|
|
466
579
|
updateMarketplace(id: string, data: UpdateProgramMarketplaceParams): Promise<Record<string, unknown>>;
|
|
580
|
+
connectStripe(id: string, data?: ConnectProgramStripeParams): Promise<ConnectProgramStripeResponse>;
|
|
581
|
+
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
|
+
}
|
|
588
|
+
|
|
589
|
+
declare class WebhooksResource {
|
|
590
|
+
private readonly http;
|
|
591
|
+
constructor(http: HttpClient);
|
|
592
|
+
list(params?: {
|
|
593
|
+
programId?: string;
|
|
594
|
+
}): Promise<WebhookEndpoint[]>;
|
|
595
|
+
create(data: CreateWebhookEndpointParams): Promise<WebhookSecretResponse>;
|
|
596
|
+
get(id: string): Promise<WebhookEndpoint>;
|
|
597
|
+
update(id: string, data: UpdateWebhookEndpointParams): Promise<WebhookEndpoint>;
|
|
598
|
+
delete(id: string): Promise<SuccessResponse>;
|
|
599
|
+
rotateSecret(id: string): Promise<WebhookSecretResponse>;
|
|
467
600
|
}
|
|
468
601
|
|
|
469
602
|
declare class AgentRef {
|
|
@@ -474,6 +607,7 @@ declare class AgentRef {
|
|
|
474
607
|
readonly flags: FlagsResource;
|
|
475
608
|
readonly billing: BillingResource;
|
|
476
609
|
readonly merchant: MerchantResource;
|
|
610
|
+
readonly webhooks: WebhooksResource;
|
|
477
611
|
constructor(config?: AgentRefConfig);
|
|
478
612
|
}
|
|
479
613
|
|
|
@@ -507,4 +641,4 @@ declare class ServerError extends AgentRefError {
|
|
|
507
641
|
constructor(message: string, code: string, status: number, requestId: string);
|
|
508
642
|
}
|
|
509
643
|
|
|
510
|
-
export { type Affiliate, type AffiliateSortBy, type AffiliateStatus, AgentRef, type AgentRefConfig, AgentRefError, AuthError, type BillingStatus, type BillingTier, type BillingTierId, type CommissionType, ConflictError, type Conversion, type ConversionStats, type ConversionStatus, type Coupon, type CreateCouponParams, type CreateInviteParams, type CreatePayoutParams, type CreateProgramParams, type Flag, type FlagStats, type FlagStatus, type FlagType, ForbiddenError, type Invite, type Merchant, type
|
|
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 };
|