@stackbe/sdk 0.15.0 → 0.15.3
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/dist/index.d.mts +69 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.js +33 -0
- package/dist/index.mjs +33 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -292,6 +292,17 @@ interface SwitchOrganizationResponse {
|
|
|
292
292
|
/** Customer's role in the organization */
|
|
293
293
|
orgRole: 'owner' | 'admin' | 'member';
|
|
294
294
|
}
|
|
295
|
+
/** Lightweight org membership returned in session responses */
|
|
296
|
+
interface OrganizationMembership {
|
|
297
|
+
/** Organization ID */
|
|
298
|
+
id: string;
|
|
299
|
+
/** Organization name */
|
|
300
|
+
name: string;
|
|
301
|
+
/** Organization slug */
|
|
302
|
+
slug: string;
|
|
303
|
+
/** Customer's role in this organization */
|
|
304
|
+
role: 'owner' | 'admin' | 'member';
|
|
305
|
+
}
|
|
295
306
|
interface SessionResponse {
|
|
296
307
|
valid: boolean;
|
|
297
308
|
/** Customer ID */
|
|
@@ -306,6 +317,12 @@ interface SessionResponse {
|
|
|
306
317
|
organizationId?: string;
|
|
307
318
|
/** Role in the organization */
|
|
308
319
|
orgRole?: 'owner' | 'admin' | 'member';
|
|
320
|
+
/**
|
|
321
|
+
* All org memberships for this customer.
|
|
322
|
+
* Included when the app has `enableOrganizations: true`, null otherwise.
|
|
323
|
+
* Use this to build an org-switcher UI without an extra API call.
|
|
324
|
+
*/
|
|
325
|
+
organizations?: OrganizationMembership[] | null;
|
|
309
326
|
/** Customer details (if included) */
|
|
310
327
|
customer?: Customer;
|
|
311
328
|
/** Current subscription (if any) */
|
|
@@ -2381,6 +2398,23 @@ interface TrackReferralResponse {
|
|
|
2381
2398
|
token: string;
|
|
2382
2399
|
expiresInDays: number;
|
|
2383
2400
|
}
|
|
2401
|
+
interface PartnerApplicationOptions {
|
|
2402
|
+
/** Applicant email address */
|
|
2403
|
+
email: string;
|
|
2404
|
+
/** Applicant name */
|
|
2405
|
+
name: string;
|
|
2406
|
+
/** Company or business name */
|
|
2407
|
+
company?: string;
|
|
2408
|
+
/** Website URL */
|
|
2409
|
+
website?: string;
|
|
2410
|
+
/** Why they want to become a partner */
|
|
2411
|
+
reason?: string;
|
|
2412
|
+
}
|
|
2413
|
+
interface PartnerApplicationResponse {
|
|
2414
|
+
id: string;
|
|
2415
|
+
status: 'pending';
|
|
2416
|
+
message: string;
|
|
2417
|
+
}
|
|
2384
2418
|
interface EnrollOptions {
|
|
2385
2419
|
/** Preferred referral code (auto-generated if not provided) */
|
|
2386
2420
|
code?: string;
|
|
@@ -2401,6 +2435,12 @@ interface DealListResponse {
|
|
|
2401
2435
|
deals: DealRegistration[];
|
|
2402
2436
|
total: number;
|
|
2403
2437
|
}
|
|
2438
|
+
interface PortalLinkResponse {
|
|
2439
|
+
/** URL to the hosted partner portal page */
|
|
2440
|
+
url: string;
|
|
2441
|
+
/** Token expiration time (e.g. "24h") */
|
|
2442
|
+
expiresIn: string;
|
|
2443
|
+
}
|
|
2404
2444
|
declare class AffiliatesClient {
|
|
2405
2445
|
private http;
|
|
2406
2446
|
constructor(http: HttpClient);
|
|
@@ -2430,11 +2470,39 @@ declare class AffiliatesClient {
|
|
|
2430
2470
|
* Requires customer session token.
|
|
2431
2471
|
*/
|
|
2432
2472
|
getCommissions(): Promise<AffiliateCommissionsResponse>;
|
|
2473
|
+
/**
|
|
2474
|
+
* Apply to become a partner. No account required — just an API key.
|
|
2475
|
+
* The application will be reviewed by the app admin.
|
|
2476
|
+
*
|
|
2477
|
+
* @example
|
|
2478
|
+
* ```typescript
|
|
2479
|
+
* const result = await stackbe.affiliates.apply({
|
|
2480
|
+
* email: 'partner@example.com',
|
|
2481
|
+
* name: 'Jane Smith',
|
|
2482
|
+
* company: 'Acme Inc',
|
|
2483
|
+
* website: 'https://acme.com',
|
|
2484
|
+
* reason: 'I have a large audience in the SaaS space',
|
|
2485
|
+
* });
|
|
2486
|
+
* console.log(result.status); // 'pending'
|
|
2487
|
+
* ```
|
|
2488
|
+
*/
|
|
2489
|
+
apply(options: PartnerApplicationOptions): Promise<PartnerApplicationResponse>;
|
|
2433
2490
|
/**
|
|
2434
2491
|
* Track a referral click (store token for attribution).
|
|
2435
2492
|
* Requires API key.
|
|
2436
2493
|
*/
|
|
2437
2494
|
trackReferral(code: string, referralUrl?: string): Promise<TrackReferralResponse>;
|
|
2495
|
+
/**
|
|
2496
|
+
* Get a link to the hosted partner portal (valid 24 hours).
|
|
2497
|
+
* Requires customer session token and active partner enrollment.
|
|
2498
|
+
*
|
|
2499
|
+
* @example
|
|
2500
|
+
* ```typescript
|
|
2501
|
+
* const { url } = await stackbe.affiliates.getPortalLink();
|
|
2502
|
+
* // Redirect partner to `url` or display in UI
|
|
2503
|
+
* ```
|
|
2504
|
+
*/
|
|
2505
|
+
getPortalLink(): Promise<PortalLinkResponse>;
|
|
2438
2506
|
/**
|
|
2439
2507
|
* Get the full partner dashboard with stats, earnings by source, deals, and coupons.
|
|
2440
2508
|
* Requires customer session token.
|
|
@@ -3049,4 +3117,4 @@ declare class StackBE {
|
|
|
3049
3117
|
}): (req: any, res: any, next: any) => Promise<any>;
|
|
3050
3118
|
}
|
|
3051
3119
|
|
|
3052
|
-
export { type AddMemberOptions, type AffiliateCommission, type AffiliateCommissionsResponse, type AffiliateEnrollment, type AffiliateInfo, type AffiliateStats, AffiliatesClient, AnalyticsClient, type AnalyticsFilterOptions, type AnyWebhookEvent, type AttachPaymentMethodOptions, AuthClient, type BillingPortalSession, type CancelSubscriptionOptions, type CancelSubscriptionResponse, type ChargeResult, type CheckEntitlementResponse, type CheckUsageResponse, CheckoutClient, type CheckoutSessionResponse, type Coupon, type CouponDiscountType, type CouponDuration, CouponsClient, type CreateCheckoutOptions, type CreateCouponOptions, type CreateCustomerOptions, type CreateEarlyAccessSignupOptions, type CreateFeatureRequestOptions, type CreateOrganizationOptions, type CreateSetupSessionOptions, type Customer, type CustomerCreatedEvent, type CustomerFeatureActivity, type CustomerInvoice, type CustomerInvoicesResponse, type CustomerPaymentMethod, type CustomerSubscriptionHistory, type CustomerSubscriptionHistoryResponse, type CustomerUpdatedEvent, type CustomerUsageResponse, type CustomerWebhookPayload, type CustomerWithSubscription, CustomersClient, type DashboardMetrics, type DunningStatus, EarlyAccessClient, type EarlyAccessSignup, type EarlyAccessSignupListResponse, type EnrollOptions, EntitlementsClient, type EntitlementsResponse, type FeatureRequest, type FeatureRequestComment, type FeatureRequestImage, type FeatureRequestListResponse, FeatureRequestsClient, type FeatureUsagePoint, type GetSubscriptionOptions, type GrowthChartPoint, type GrowthMetrics, type InterestedCustomer, type InterestedCustomersResponse, type InviteMemberOptions, type ListEarlyAccessOptions, type ListFeatureRequestsOptions, type ListPlansOptions, type ListProductsOptions, type MRRHistoryPoint, type MagicLinkOptions, type MagicLinkResponse, type MigrateToStackbeManagedResult, type Organization, type OrganizationInvite, type OrganizationMember, OrganizationsClient, type PaymentFailedEvent, type PaymentMethod, PaymentMethodsClient, type PaymentSucceededEvent, type PaymentWebhookPayload, type PerformanceMetrics, type Plan, type PlanMetrics, PlansClient, type PopularEndpoint, type Product, ProductsClient, type RequestCountPoint, type RevenueByPlan, type SessionResponse, type SetupSessionResponse, StackBE, type StackBEConfig, StackBEError, type StackBEErrorCode, type StackBEErrorResponse, type Subscription, type SubscriptionCancelledEvent, type SubscriptionCreatedEvent, type SubscriptionPlan, type SubscriptionRenewedEvent, type SubscriptionUpdatedEvent, type SubscriptionWebhookPayload, type SubscriptionWithPlan, SubscriptionsClient, type SwitchOrganizationResponse, type TimeRangeOptions, type TrackReferralResponse, type TrackUsageOptions, type TrackUsageResponse, type TrialEndedEvent, type TrialMetrics, type TrialStartedEvent, type TrialStatus, type UpcomingInvoice, type UpdateCouponOptions, type UpdateCustomerOptions, type UpdateOrganizationOptions, type UpdateSubscriptionOptions, UsageClient, type UsageMetric, type ValidateCouponResult, type VerifyTokenResponse, type WebhookEvent, type WebhookEventType };
|
|
3120
|
+
export { type AddMemberOptions, type AffiliateCommission, type AffiliateCommissionsResponse, type AffiliateEnrollment, type AffiliateInfo, type AffiliateStats, AffiliatesClient, AnalyticsClient, type AnalyticsFilterOptions, type AnyWebhookEvent, type AttachPaymentMethodOptions, AuthClient, type BillingPortalSession, type CancelSubscriptionOptions, type CancelSubscriptionResponse, type ChargeResult, type CheckEntitlementResponse, type CheckUsageResponse, CheckoutClient, type CheckoutSessionResponse, type Coupon, type CouponDiscountType, type CouponDuration, CouponsClient, type CreateCheckoutOptions, type CreateCouponOptions, type CreateCustomerOptions, type CreateEarlyAccessSignupOptions, type CreateFeatureRequestOptions, type CreateOrganizationOptions, type CreateSetupSessionOptions, type Customer, type CustomerCreatedEvent, type CustomerFeatureActivity, type CustomerInvoice, type CustomerInvoicesResponse, type CustomerPaymentMethod, type CustomerSubscriptionHistory, type CustomerSubscriptionHistoryResponse, type CustomerUpdatedEvent, type CustomerUsageResponse, type CustomerWebhookPayload, type CustomerWithSubscription, CustomersClient, type DashboardMetrics, type DunningStatus, EarlyAccessClient, type EarlyAccessSignup, type EarlyAccessSignupListResponse, type EnrollOptions, EntitlementsClient, type EntitlementsResponse, type FeatureRequest, type FeatureRequestComment, type FeatureRequestImage, type FeatureRequestListResponse, FeatureRequestsClient, type FeatureUsagePoint, type GetSubscriptionOptions, type GrowthChartPoint, type GrowthMetrics, type InterestedCustomer, type InterestedCustomersResponse, type InviteMemberOptions, type ListEarlyAccessOptions, type ListFeatureRequestsOptions, type ListPlansOptions, type ListProductsOptions, type MRRHistoryPoint, type MagicLinkOptions, type MagicLinkResponse, type MigrateToStackbeManagedResult, type Organization, type OrganizationInvite, type OrganizationMember, type OrganizationMembership, OrganizationsClient, type PaymentFailedEvent, type PaymentMethod, PaymentMethodsClient, type PaymentSucceededEvent, type PaymentWebhookPayload, type PerformanceMetrics, type Plan, type PlanMetrics, PlansClient, type PopularEndpoint, type PortalLinkResponse, type Product, ProductsClient, type RequestCountPoint, type RevenueByPlan, type SessionResponse, type SetupSessionResponse, StackBE, type StackBEConfig, StackBEError, type StackBEErrorCode, type StackBEErrorResponse, type Subscription, type SubscriptionCancelledEvent, type SubscriptionCreatedEvent, type SubscriptionPlan, type SubscriptionRenewedEvent, type SubscriptionUpdatedEvent, type SubscriptionWebhookPayload, type SubscriptionWithPlan, SubscriptionsClient, type SwitchOrganizationResponse, type TimeRangeOptions, type TrackReferralResponse, type TrackUsageOptions, type TrackUsageResponse, type TrialEndedEvent, type TrialMetrics, type TrialStartedEvent, type TrialStatus, type UpcomingInvoice, type UpdateCouponOptions, type UpdateCustomerOptions, type UpdateOrganizationOptions, type UpdateSubscriptionOptions, UsageClient, type UsageMetric, type ValidateCouponResult, type VerifyTokenResponse, type WebhookEvent, type WebhookEventType };
|
package/dist/index.d.ts
CHANGED
|
@@ -292,6 +292,17 @@ interface SwitchOrganizationResponse {
|
|
|
292
292
|
/** Customer's role in the organization */
|
|
293
293
|
orgRole: 'owner' | 'admin' | 'member';
|
|
294
294
|
}
|
|
295
|
+
/** Lightweight org membership returned in session responses */
|
|
296
|
+
interface OrganizationMembership {
|
|
297
|
+
/** Organization ID */
|
|
298
|
+
id: string;
|
|
299
|
+
/** Organization name */
|
|
300
|
+
name: string;
|
|
301
|
+
/** Organization slug */
|
|
302
|
+
slug: string;
|
|
303
|
+
/** Customer's role in this organization */
|
|
304
|
+
role: 'owner' | 'admin' | 'member';
|
|
305
|
+
}
|
|
295
306
|
interface SessionResponse {
|
|
296
307
|
valid: boolean;
|
|
297
308
|
/** Customer ID */
|
|
@@ -306,6 +317,12 @@ interface SessionResponse {
|
|
|
306
317
|
organizationId?: string;
|
|
307
318
|
/** Role in the organization */
|
|
308
319
|
orgRole?: 'owner' | 'admin' | 'member';
|
|
320
|
+
/**
|
|
321
|
+
* All org memberships for this customer.
|
|
322
|
+
* Included when the app has `enableOrganizations: true`, null otherwise.
|
|
323
|
+
* Use this to build an org-switcher UI without an extra API call.
|
|
324
|
+
*/
|
|
325
|
+
organizations?: OrganizationMembership[] | null;
|
|
309
326
|
/** Customer details (if included) */
|
|
310
327
|
customer?: Customer;
|
|
311
328
|
/** Current subscription (if any) */
|
|
@@ -2381,6 +2398,23 @@ interface TrackReferralResponse {
|
|
|
2381
2398
|
token: string;
|
|
2382
2399
|
expiresInDays: number;
|
|
2383
2400
|
}
|
|
2401
|
+
interface PartnerApplicationOptions {
|
|
2402
|
+
/** Applicant email address */
|
|
2403
|
+
email: string;
|
|
2404
|
+
/** Applicant name */
|
|
2405
|
+
name: string;
|
|
2406
|
+
/** Company or business name */
|
|
2407
|
+
company?: string;
|
|
2408
|
+
/** Website URL */
|
|
2409
|
+
website?: string;
|
|
2410
|
+
/** Why they want to become a partner */
|
|
2411
|
+
reason?: string;
|
|
2412
|
+
}
|
|
2413
|
+
interface PartnerApplicationResponse {
|
|
2414
|
+
id: string;
|
|
2415
|
+
status: 'pending';
|
|
2416
|
+
message: string;
|
|
2417
|
+
}
|
|
2384
2418
|
interface EnrollOptions {
|
|
2385
2419
|
/** Preferred referral code (auto-generated if not provided) */
|
|
2386
2420
|
code?: string;
|
|
@@ -2401,6 +2435,12 @@ interface DealListResponse {
|
|
|
2401
2435
|
deals: DealRegistration[];
|
|
2402
2436
|
total: number;
|
|
2403
2437
|
}
|
|
2438
|
+
interface PortalLinkResponse {
|
|
2439
|
+
/** URL to the hosted partner portal page */
|
|
2440
|
+
url: string;
|
|
2441
|
+
/** Token expiration time (e.g. "24h") */
|
|
2442
|
+
expiresIn: string;
|
|
2443
|
+
}
|
|
2404
2444
|
declare class AffiliatesClient {
|
|
2405
2445
|
private http;
|
|
2406
2446
|
constructor(http: HttpClient);
|
|
@@ -2430,11 +2470,39 @@ declare class AffiliatesClient {
|
|
|
2430
2470
|
* Requires customer session token.
|
|
2431
2471
|
*/
|
|
2432
2472
|
getCommissions(): Promise<AffiliateCommissionsResponse>;
|
|
2473
|
+
/**
|
|
2474
|
+
* Apply to become a partner. No account required — just an API key.
|
|
2475
|
+
* The application will be reviewed by the app admin.
|
|
2476
|
+
*
|
|
2477
|
+
* @example
|
|
2478
|
+
* ```typescript
|
|
2479
|
+
* const result = await stackbe.affiliates.apply({
|
|
2480
|
+
* email: 'partner@example.com',
|
|
2481
|
+
* name: 'Jane Smith',
|
|
2482
|
+
* company: 'Acme Inc',
|
|
2483
|
+
* website: 'https://acme.com',
|
|
2484
|
+
* reason: 'I have a large audience in the SaaS space',
|
|
2485
|
+
* });
|
|
2486
|
+
* console.log(result.status); // 'pending'
|
|
2487
|
+
* ```
|
|
2488
|
+
*/
|
|
2489
|
+
apply(options: PartnerApplicationOptions): Promise<PartnerApplicationResponse>;
|
|
2433
2490
|
/**
|
|
2434
2491
|
* Track a referral click (store token for attribution).
|
|
2435
2492
|
* Requires API key.
|
|
2436
2493
|
*/
|
|
2437
2494
|
trackReferral(code: string, referralUrl?: string): Promise<TrackReferralResponse>;
|
|
2495
|
+
/**
|
|
2496
|
+
* Get a link to the hosted partner portal (valid 24 hours).
|
|
2497
|
+
* Requires customer session token and active partner enrollment.
|
|
2498
|
+
*
|
|
2499
|
+
* @example
|
|
2500
|
+
* ```typescript
|
|
2501
|
+
* const { url } = await stackbe.affiliates.getPortalLink();
|
|
2502
|
+
* // Redirect partner to `url` or display in UI
|
|
2503
|
+
* ```
|
|
2504
|
+
*/
|
|
2505
|
+
getPortalLink(): Promise<PortalLinkResponse>;
|
|
2438
2506
|
/**
|
|
2439
2507
|
* Get the full partner dashboard with stats, earnings by source, deals, and coupons.
|
|
2440
2508
|
* Requires customer session token.
|
|
@@ -3049,4 +3117,4 @@ declare class StackBE {
|
|
|
3049
3117
|
}): (req: any, res: any, next: any) => Promise<any>;
|
|
3050
3118
|
}
|
|
3051
3119
|
|
|
3052
|
-
export { type AddMemberOptions, type AffiliateCommission, type AffiliateCommissionsResponse, type AffiliateEnrollment, type AffiliateInfo, type AffiliateStats, AffiliatesClient, AnalyticsClient, type AnalyticsFilterOptions, type AnyWebhookEvent, type AttachPaymentMethodOptions, AuthClient, type BillingPortalSession, type CancelSubscriptionOptions, type CancelSubscriptionResponse, type ChargeResult, type CheckEntitlementResponse, type CheckUsageResponse, CheckoutClient, type CheckoutSessionResponse, type Coupon, type CouponDiscountType, type CouponDuration, CouponsClient, type CreateCheckoutOptions, type CreateCouponOptions, type CreateCustomerOptions, type CreateEarlyAccessSignupOptions, type CreateFeatureRequestOptions, type CreateOrganizationOptions, type CreateSetupSessionOptions, type Customer, type CustomerCreatedEvent, type CustomerFeatureActivity, type CustomerInvoice, type CustomerInvoicesResponse, type CustomerPaymentMethod, type CustomerSubscriptionHistory, type CustomerSubscriptionHistoryResponse, type CustomerUpdatedEvent, type CustomerUsageResponse, type CustomerWebhookPayload, type CustomerWithSubscription, CustomersClient, type DashboardMetrics, type DunningStatus, EarlyAccessClient, type EarlyAccessSignup, type EarlyAccessSignupListResponse, type EnrollOptions, EntitlementsClient, type EntitlementsResponse, type FeatureRequest, type FeatureRequestComment, type FeatureRequestImage, type FeatureRequestListResponse, FeatureRequestsClient, type FeatureUsagePoint, type GetSubscriptionOptions, type GrowthChartPoint, type GrowthMetrics, type InterestedCustomer, type InterestedCustomersResponse, type InviteMemberOptions, type ListEarlyAccessOptions, type ListFeatureRequestsOptions, type ListPlansOptions, type ListProductsOptions, type MRRHistoryPoint, type MagicLinkOptions, type MagicLinkResponse, type MigrateToStackbeManagedResult, type Organization, type OrganizationInvite, type OrganizationMember, OrganizationsClient, type PaymentFailedEvent, type PaymentMethod, PaymentMethodsClient, type PaymentSucceededEvent, type PaymentWebhookPayload, type PerformanceMetrics, type Plan, type PlanMetrics, PlansClient, type PopularEndpoint, type Product, ProductsClient, type RequestCountPoint, type RevenueByPlan, type SessionResponse, type SetupSessionResponse, StackBE, type StackBEConfig, StackBEError, type StackBEErrorCode, type StackBEErrorResponse, type Subscription, type SubscriptionCancelledEvent, type SubscriptionCreatedEvent, type SubscriptionPlan, type SubscriptionRenewedEvent, type SubscriptionUpdatedEvent, type SubscriptionWebhookPayload, type SubscriptionWithPlan, SubscriptionsClient, type SwitchOrganizationResponse, type TimeRangeOptions, type TrackReferralResponse, type TrackUsageOptions, type TrackUsageResponse, type TrialEndedEvent, type TrialMetrics, type TrialStartedEvent, type TrialStatus, type UpcomingInvoice, type UpdateCouponOptions, type UpdateCustomerOptions, type UpdateOrganizationOptions, type UpdateSubscriptionOptions, UsageClient, type UsageMetric, type ValidateCouponResult, type VerifyTokenResponse, type WebhookEvent, type WebhookEventType };
|
|
3120
|
+
export { type AddMemberOptions, type AffiliateCommission, type AffiliateCommissionsResponse, type AffiliateEnrollment, type AffiliateInfo, type AffiliateStats, AffiliatesClient, AnalyticsClient, type AnalyticsFilterOptions, type AnyWebhookEvent, type AttachPaymentMethodOptions, AuthClient, type BillingPortalSession, type CancelSubscriptionOptions, type CancelSubscriptionResponse, type ChargeResult, type CheckEntitlementResponse, type CheckUsageResponse, CheckoutClient, type CheckoutSessionResponse, type Coupon, type CouponDiscountType, type CouponDuration, CouponsClient, type CreateCheckoutOptions, type CreateCouponOptions, type CreateCustomerOptions, type CreateEarlyAccessSignupOptions, type CreateFeatureRequestOptions, type CreateOrganizationOptions, type CreateSetupSessionOptions, type Customer, type CustomerCreatedEvent, type CustomerFeatureActivity, type CustomerInvoice, type CustomerInvoicesResponse, type CustomerPaymentMethod, type CustomerSubscriptionHistory, type CustomerSubscriptionHistoryResponse, type CustomerUpdatedEvent, type CustomerUsageResponse, type CustomerWebhookPayload, type CustomerWithSubscription, CustomersClient, type DashboardMetrics, type DunningStatus, EarlyAccessClient, type EarlyAccessSignup, type EarlyAccessSignupListResponse, type EnrollOptions, EntitlementsClient, type EntitlementsResponse, type FeatureRequest, type FeatureRequestComment, type FeatureRequestImage, type FeatureRequestListResponse, FeatureRequestsClient, type FeatureUsagePoint, type GetSubscriptionOptions, type GrowthChartPoint, type GrowthMetrics, type InterestedCustomer, type InterestedCustomersResponse, type InviteMemberOptions, type ListEarlyAccessOptions, type ListFeatureRequestsOptions, type ListPlansOptions, type ListProductsOptions, type MRRHistoryPoint, type MagicLinkOptions, type MagicLinkResponse, type MigrateToStackbeManagedResult, type Organization, type OrganizationInvite, type OrganizationMember, type OrganizationMembership, OrganizationsClient, type PaymentFailedEvent, type PaymentMethod, PaymentMethodsClient, type PaymentSucceededEvent, type PaymentWebhookPayload, type PerformanceMetrics, type Plan, type PlanMetrics, PlansClient, type PopularEndpoint, type PortalLinkResponse, type Product, ProductsClient, type RequestCountPoint, type RevenueByPlan, type SessionResponse, type SetupSessionResponse, StackBE, type StackBEConfig, StackBEError, type StackBEErrorCode, type StackBEErrorResponse, type Subscription, type SubscriptionCancelledEvent, type SubscriptionCreatedEvent, type SubscriptionPlan, type SubscriptionRenewedEvent, type SubscriptionUpdatedEvent, type SubscriptionWebhookPayload, type SubscriptionWithPlan, SubscriptionsClient, type SwitchOrganizationResponse, type TimeRangeOptions, type TrackReferralResponse, type TrackUsageOptions, type TrackUsageResponse, type TrialEndedEvent, type TrialMetrics, type TrialStartedEvent, type TrialStatus, type UpcomingInvoice, type UpdateCouponOptions, type UpdateCustomerOptions, type UpdateOrganizationOptions, type UpdateSubscriptionOptions, UsageClient, type UsageMetric, type ValidateCouponResult, type VerifyTokenResponse, type WebhookEvent, type WebhookEventType };
|
package/dist/index.js
CHANGED
|
@@ -1593,6 +1593,7 @@ var AuthClient = class {
|
|
|
1593
1593
|
tenantId: tenantId ?? data.tenantId,
|
|
1594
1594
|
organizationId: data.organizationId ?? organizationId,
|
|
1595
1595
|
orgRole: data.orgRole ?? orgRole,
|
|
1596
|
+
organizations: data.organizations,
|
|
1596
1597
|
customer: data.customer,
|
|
1597
1598
|
subscription: data.subscription,
|
|
1598
1599
|
entitlements: data.entitlements
|
|
@@ -2290,6 +2291,25 @@ var AffiliatesClient = class {
|
|
|
2290
2291
|
async getCommissions() {
|
|
2291
2292
|
return this.http.get("/v1/affiliate/commissions");
|
|
2292
2293
|
}
|
|
2294
|
+
/**
|
|
2295
|
+
* Apply to become a partner. No account required — just an API key.
|
|
2296
|
+
* The application will be reviewed by the app admin.
|
|
2297
|
+
*
|
|
2298
|
+
* @example
|
|
2299
|
+
* ```typescript
|
|
2300
|
+
* const result = await stackbe.affiliates.apply({
|
|
2301
|
+
* email: 'partner@example.com',
|
|
2302
|
+
* name: 'Jane Smith',
|
|
2303
|
+
* company: 'Acme Inc',
|
|
2304
|
+
* website: 'https://acme.com',
|
|
2305
|
+
* reason: 'I have a large audience in the SaaS space',
|
|
2306
|
+
* });
|
|
2307
|
+
* console.log(result.status); // 'pending'
|
|
2308
|
+
* ```
|
|
2309
|
+
*/
|
|
2310
|
+
async apply(options) {
|
|
2311
|
+
return this.http.post("/v1/affiliate/apply", options);
|
|
2312
|
+
}
|
|
2293
2313
|
/**
|
|
2294
2314
|
* Track a referral click (store token for attribution).
|
|
2295
2315
|
* Requires API key.
|
|
@@ -2300,6 +2320,19 @@ var AffiliatesClient = class {
|
|
|
2300
2320
|
referralUrl
|
|
2301
2321
|
});
|
|
2302
2322
|
}
|
|
2323
|
+
/**
|
|
2324
|
+
* Get a link to the hosted partner portal (valid 24 hours).
|
|
2325
|
+
* Requires customer session token and active partner enrollment.
|
|
2326
|
+
*
|
|
2327
|
+
* @example
|
|
2328
|
+
* ```typescript
|
|
2329
|
+
* const { url } = await stackbe.affiliates.getPortalLink();
|
|
2330
|
+
* // Redirect partner to `url` or display in UI
|
|
2331
|
+
* ```
|
|
2332
|
+
*/
|
|
2333
|
+
async getPortalLink() {
|
|
2334
|
+
return this.http.get("/v1/affiliate/portal-link");
|
|
2335
|
+
}
|
|
2303
2336
|
/**
|
|
2304
2337
|
* Get the full partner dashboard with stats, earnings by source, deals, and coupons.
|
|
2305
2338
|
* Requires customer session token.
|
package/dist/index.mjs
CHANGED
|
@@ -1551,6 +1551,7 @@ var AuthClient = class {
|
|
|
1551
1551
|
tenantId: tenantId ?? data.tenantId,
|
|
1552
1552
|
organizationId: data.organizationId ?? organizationId,
|
|
1553
1553
|
orgRole: data.orgRole ?? orgRole,
|
|
1554
|
+
organizations: data.organizations,
|
|
1554
1555
|
customer: data.customer,
|
|
1555
1556
|
subscription: data.subscription,
|
|
1556
1557
|
entitlements: data.entitlements
|
|
@@ -2248,6 +2249,25 @@ var AffiliatesClient = class {
|
|
|
2248
2249
|
async getCommissions() {
|
|
2249
2250
|
return this.http.get("/v1/affiliate/commissions");
|
|
2250
2251
|
}
|
|
2252
|
+
/**
|
|
2253
|
+
* Apply to become a partner. No account required — just an API key.
|
|
2254
|
+
* The application will be reviewed by the app admin.
|
|
2255
|
+
*
|
|
2256
|
+
* @example
|
|
2257
|
+
* ```typescript
|
|
2258
|
+
* const result = await stackbe.affiliates.apply({
|
|
2259
|
+
* email: 'partner@example.com',
|
|
2260
|
+
* name: 'Jane Smith',
|
|
2261
|
+
* company: 'Acme Inc',
|
|
2262
|
+
* website: 'https://acme.com',
|
|
2263
|
+
* reason: 'I have a large audience in the SaaS space',
|
|
2264
|
+
* });
|
|
2265
|
+
* console.log(result.status); // 'pending'
|
|
2266
|
+
* ```
|
|
2267
|
+
*/
|
|
2268
|
+
async apply(options) {
|
|
2269
|
+
return this.http.post("/v1/affiliate/apply", options);
|
|
2270
|
+
}
|
|
2251
2271
|
/**
|
|
2252
2272
|
* Track a referral click (store token for attribution).
|
|
2253
2273
|
* Requires API key.
|
|
@@ -2258,6 +2278,19 @@ var AffiliatesClient = class {
|
|
|
2258
2278
|
referralUrl
|
|
2259
2279
|
});
|
|
2260
2280
|
}
|
|
2281
|
+
/**
|
|
2282
|
+
* Get a link to the hosted partner portal (valid 24 hours).
|
|
2283
|
+
* Requires customer session token and active partner enrollment.
|
|
2284
|
+
*
|
|
2285
|
+
* @example
|
|
2286
|
+
* ```typescript
|
|
2287
|
+
* const { url } = await stackbe.affiliates.getPortalLink();
|
|
2288
|
+
* // Redirect partner to `url` or display in UI
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2291
|
+
async getPortalLink() {
|
|
2292
|
+
return this.http.get("/v1/affiliate/portal-link");
|
|
2293
|
+
}
|
|
2261
2294
|
/**
|
|
2262
2295
|
* Get the full partner dashboard with stats, earnings by source, deals, and coupons.
|
|
2263
2296
|
* Requires customer session token.
|
package/package.json
CHANGED