@agentforge-io/sdk-server 4.75.0 → 4.77.0

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.ts CHANGED
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
3
3
  export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, AgentForgeDuplicateContactError, AgentForgeBillingError, AGENTFORGE_BILLING_ERROR_CODES, } from './errors';
4
4
  export type { AgentForgeBillingErrorCode } from './errors';
5
5
  export { BillingResource } from './resources/billing';
6
- export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
6
+ export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
7
7
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
8
8
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
9
9
  export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, CheckSystemTemplateResult, TemplatePublishIssue, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, ReferenceMatchItemInput, ReferenceMatchDecisionKind, ReferenceMatchCandidate, ReferenceMatchDecision, ReferenceMatchInput, ReferenceMatchResult, ReferenceProductInput, ReferenceProductsBulkInput, ReferenceProductsBulkResult, ReferenceProduct, ListReferenceProductsInput, ReferenceProductPage, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
@@ -60,6 +60,19 @@ export interface BillingInvoice {
60
60
  currency: string;
61
61
  status: string;
62
62
  receiptUrl: string | null;
63
+ /** Direct link to the generated invoice PDF. `null` when the provider has none (older platforms never send it). */
64
+ pdfUrl?: string | null;
65
+ }
66
+ /** One page of invoices, newest first. `nextCursor` is opaque and `null` on the last page. */
67
+ export interface BillingInvoicePage {
68
+ items: BillingInvoice[];
69
+ nextCursor: string | null;
70
+ }
71
+ export interface BillingInvoicesQuery {
72
+ /** The previous page's `nextCursor`. */
73
+ cursor?: string | null;
74
+ /** 1–50, default 10. */
75
+ limit?: number;
63
76
  }
64
77
  export interface BillingPaymentMethod {
65
78
  /** Provider page where the customer updates the card. */
@@ -70,8 +83,14 @@ export interface BillingPaymentMethod {
70
83
  export interface BillingStartTrialInput {
71
84
  /** Slug of the plan to trial (not the default plan). */
72
85
  planId: string;
73
- /** 1 to 90. */
74
- days: number;
86
+ /** 1 to 90, from now. Send `days` OR `endsAt`, not both. */
87
+ days?: number;
88
+ /**
89
+ * Explicit end of the trial (ISO 8601 with offset/`Z`), to run it from an earlier date, e.g. the business's registration.
90
+ * Must be in the future and at most 90 days from now: the platform rejects an already-over trial with
91
+ * `invalid_request` (the App just does not start one). Send `days` OR `endsAt`, not both.
92
+ */
93
+ endsAt?: string;
75
94
  }
76
95
  export interface BillingCheckoutInput {
77
96
  planId: string;
@@ -109,7 +128,7 @@ export declare class BillingResource {
109
128
  private call;
110
129
  /** `GET /api/v1/billing/entitlements` — plan, status, trial, period, limits. Self-heals an expired trial. */
111
130
  entitlements(): Promise<BillingEntitlement>;
112
- /** `POST /api/v1/billing/trial/start` — a no-card trial, once per tenant. `trial_already_used` / `already_subscribed` (409). */
131
+ /** `POST /api/v1/billing/trial/start` — a no-card trial (`days` from now, or until `endsAt`), once per tenant. `trial_already_used` / `already_subscribed` (409). */
113
132
  startTrial(input: BillingStartTrialInput): Promise<BillingEntitlement>;
114
133
  /** `GET /api/v1/billing/plans` — the App's plans, without provider refs. */
115
134
  plans(): Promise<BillingPlan[]>;
@@ -129,8 +148,13 @@ export declare class BillingResource {
129
148
  portal(): Promise<{
130
149
  url: string;
131
150
  }>;
132
- /** `GET /api/v1/billing/invoices` — newest first; `[]` while on a trial or free. */
151
+ /**
152
+ * `GET /api/v1/billing/invoices` — newest first; empty while on a trial or free.
153
+ * Without arguments: the first page's items (the platform's default page size). With `{ cursor?, limit? }`:
154
+ * the page and its `nextCursor` (`null` on the last page; an older platform ignores paging and omits it).
155
+ */
133
156
  invoices(): Promise<BillingInvoice[]>;
157
+ invoices(page: BillingInvoicesQuery): Promise<BillingInvoicePage>;
134
158
  /** `GET /api/v1/billing/payment-method` — card summary and the update link. `no_subscription` (409) before the first purchase. */
135
159
  paymentMethod(): Promise<BillingPaymentMethod>;
136
160
  }
@@ -50,7 +50,7 @@ class BillingResource {
50
50
  entitlements() {
51
51
  return this.call('GET', '/entitlements');
52
52
  }
53
- /** `POST /api/v1/billing/trial/start` — a no-card trial, once per tenant. `trial_already_used` / `already_subscribed` (409). */
53
+ /** `POST /api/v1/billing/trial/start` — a no-card trial (`days` from now, or until `endsAt`), once per tenant. `trial_already_used` / `already_subscribed` (409). */
54
54
  startTrial(input) {
55
55
  return this.call('POST', '/trial/start', input);
56
56
  }
@@ -78,9 +78,15 @@ class BillingResource {
78
78
  portal() {
79
79
  return this.call('GET', '/portal');
80
80
  }
81
- /** `GET /api/v1/billing/invoices` — newest first; `[]` while on a trial or free. */
82
- async invoices() {
83
- return (await this.call('GET', '/invoices')).items;
81
+ async invoices(page) {
82
+ const q = new URLSearchParams();
83
+ if (page?.cursor)
84
+ q.set('cursor', page.cursor);
85
+ if (page?.limit)
86
+ q.set('limit', String(page.limit));
87
+ const qs = q.toString();
88
+ const res = await this.call('GET', `/invoices${qs ? `?${qs}` : ''}`);
89
+ return page ? { items: res.items, nextCursor: res.nextCursor ?? null } : res.items;
84
90
  }
85
91
  /** `GET /api/v1/billing/payment-method` — card summary and the update link. `no_subscription` (409) before the first purchase. */
86
92
  paymentMethod() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.75.0",
3
+ "version": "4.77.0",
4
4
  "description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",