@agentforge-io/sdk-server 4.27.0 → 4.29.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, } from './errors';
4
4
  export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
5
5
  export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
6
- export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, SearchPlacesInput, CaseField, CaseBusinessState, CaseType, CaseState, CaseView, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
6
+ export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, SearchPlacesInput, CaseField, CaseBusinessState, CaseType, CaseState, CaseView, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
7
7
  export { AgentsResource } from './resources/agents';
8
8
  export { AnalyticsResource } from './resources/analytics';
9
9
  export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
@@ -1,5 +1,5 @@
1
1
  import type { AgentForgeClient } from '../client';
2
- import type { StructuredConfigEntry, StructuredConfigInput, TenantConfigEntry } from '../types';
2
+ import type { PaymentCountry, PaymentMethodDef, StructuredConfigEntry, StructuredConfigInput, TenantConfigEntry } from '../types';
3
3
  export declare class TenantConfigResource {
4
4
  private readonly client;
5
5
  constructor(client: AgentForgeClient);
@@ -12,6 +12,15 @@ export declare class TenantConfigResource {
12
12
  * AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
13
13
  * `payments`). The variable of the same key holds their readable text.
14
14
  */
15
+ /**
16
+ * `GET /api/v1/payment-methods?country=CO` — AGF-PAYMENT-ACCOUNTS: the payment
17
+ * methods of a country, each with the fields its accounts ask for (what an
18
+ * accounts editor draws).
19
+ */
20
+ paymentMethods(country?: PaymentCountry): Promise<{
21
+ country: PaymentCountry;
22
+ methods: PaymentMethodDef[];
23
+ }>;
15
24
  readonly structured: {
16
25
  /** `GET /api/v1/config/:key/structured` — null when not set. */
17
26
  get: (key: string) => Promise<StructuredConfigEntry | null>;
@@ -8,10 +8,6 @@ exports.TenantConfigResource = void 0;
8
8
  class TenantConfigResource {
9
9
  constructor(client) {
10
10
  this.client = client;
11
- /**
12
- * AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
13
- * `payments`). The variable of the same key holds their readable text.
14
- */
15
11
  this.structured = {
16
12
  /** `GET /api/v1/config/:key/structured` — null when not set. */
17
13
  get: async (key) => {
@@ -38,5 +34,17 @@ class TenantConfigResource {
38
34
  async set(key, value) {
39
35
  return this.client.request('PUT', `/api/v1/config/${encodeURIComponent(key)}`, { value });
40
36
  }
37
+ /**
38
+ * AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
39
+ * `payments`). The variable of the same key holds their readable text.
40
+ */
41
+ /**
42
+ * `GET /api/v1/payment-methods?country=CO` — AGF-PAYMENT-ACCOUNTS: the payment
43
+ * methods of a country, each with the fields its accounts ask for (what an
44
+ * accounts editor draws).
45
+ */
46
+ async paymentMethods(country = 'CO') {
47
+ return this.client.request('GET', `/api/v1/payment-methods?country=${encodeURIComponent(country)}`);
48
+ }
41
49
  }
42
50
  exports.TenantConfigResource = TenantConfigResource;
@@ -6,6 +6,12 @@ export interface SetAppWebhookInput {
6
6
  events: AppWebhookEventName[];
7
7
  /** 32–256 characters; the App keeps it to verify deliveries. */
8
8
  secret: string;
9
+ /**
10
+ * Where the App shows a receipt: a URL template with `{token}` and optionally
11
+ * `{team}` (the team's public address), e.g. `https://app.example.com/{team}/r/{token}`.
12
+ * Omit (or null) for none.
13
+ */
14
+ receiptLink?: string | null;
9
15
  }
10
16
  export declare class WebhookResource {
11
17
  private readonly client;
@@ -3,9 +3,11 @@
3
3
  // (AGF-APP-WEBHOOKS). One webhook per App; it receives the events of every
4
4
  // tenant the App is installed in, and of its home tenant.
5
5
  //
6
- // - `set({ url, events, secret })` — `PUT /api/v1/webhook`. The App brings
7
- // its own secret (32–256 chars) and keeps it: the platform never returns
8
- // it. Idempotent: calling it on every boot is fine.
6
+ // - `set({ url, events, secret, receiptLink? })` — `PUT /api/v1/webhook`. The
7
+ // App brings its own secret (32–256 chars) and keeps it: the platform never
8
+ // returns it. Idempotent: calling it on every boot is fine. `receiptLink`
9
+ // (AGF-CASE-RECEIPT R5) is where the App shows a receipt; the platform puts
10
+ // it under case notices on channels without the receipt card (WhatsApp…).
9
11
  // - `get()` — the current webhook (url, events, active), or null.
10
12
  // - `remove()` — stop receiving events.
11
13
  //
package/dist/types.d.ts CHANGED
@@ -1470,16 +1470,68 @@ export interface DeliverySettings {
1470
1470
  etaText?: string;
1471
1471
  };
1472
1472
  }
1473
+ /** The legacy payment kinds (before payment accounts); read only, in `PaymentSettings.legacy`. */
1473
1474
  export type PaymentMethodKind = 'cash' | 'bank_transfer' | 'card_on_delivery' | 'payment_link' | 'card_in_store' | 'other';
1475
+ /** AGF-PAYMENT-ACCOUNTS — countries with a payment catalog. */
1476
+ export type PaymentCountry = 'CO';
1477
+ /** A field an account of a method asks for. */
1478
+ export interface PaymentFieldDef {
1479
+ key: string;
1480
+ label: string;
1481
+ kind: 'text' | 'phone' | 'digits' | 'select' | 'bank';
1482
+ required: boolean;
1483
+ /** `select` / `bank`: the options. */
1484
+ options?: Array<{
1485
+ value: string;
1486
+ label: string;
1487
+ }>;
1488
+ placeholder?: string;
1489
+ /** Shown masked in lists (an account or phone number). */
1490
+ secretish?: boolean;
1491
+ }
1492
+ /** One payment method of a country's catalog (Nequi, Bre-B, Transferencia…). */
1493
+ export interface PaymentMethodDef {
1494
+ key: string;
1495
+ name: string;
1496
+ description: string;
1497
+ /** When the customer pays: before it is sent, or when they get it. */
1498
+ when: 'before' | 'on_delivery';
1499
+ fields: PaymentFieldDef[];
1500
+ }
1501
+ /** One way to pay into the business, with the data a customer needs. Several per method allowed. */
1502
+ export interface PaymentAccount {
1503
+ /** Stable (orders point to it); omit it when adding — the platform assigns one. */
1504
+ id: string;
1505
+ method: string;
1506
+ /** "Nequi principal". */
1507
+ label?: string;
1508
+ /** The method's fields, by key (see `PaymentMethodDef.fields`). */
1509
+ fields: Record<string, string>;
1510
+ /** Set from the method. */
1511
+ when: 'before' | 'on_delivery';
1512
+ /** Paused without deleting. */
1513
+ active: boolean;
1514
+ }
1474
1515
  export interface PaymentSettings {
1475
1516
  locale?: 'es' | 'en';
1476
- methods: Array<{
1477
- kind: PaymentMethodKind;
1517
+ country: PaymentCountry;
1518
+ accounts: PaymentAccount[];
1519
+ notes?: string;
1520
+ /** Methods of the old shape the catalog no longer has, kept as said until the owner edits. */
1521
+ legacy?: Array<{
1522
+ kind: string;
1478
1523
  label?: string;
1479
1524
  notes?: string;
1480
1525
  }>;
1481
- notes?: string;
1482
1526
  }
1527
+ /** What `PUT … structured` takes for payments: account ids may be omitted (new accounts). */
1528
+ export type PaymentSettingsInput = Omit<PaymentSettings, 'accounts' | 'country'> & {
1529
+ country?: PaymentCountry;
1530
+ accounts: Array<Omit<PaymentAccount, 'id' | 'when' | 'active'> & {
1531
+ id?: string;
1532
+ active?: boolean;
1533
+ }>;
1534
+ };
1483
1535
  export type StructuredConfigInput = {
1484
1536
  type: 'address';
1485
1537
  value: AddressValue;
@@ -1488,9 +1540,18 @@ export type StructuredConfigInput = {
1488
1540
  value: DeliverySettings;
1489
1541
  } | {
1490
1542
  type: 'payments';
1491
- value: PaymentSettings;
1543
+ value: PaymentSettingsInput;
1492
1544
  };
1493
- export type StructuredConfigEntry = StructuredConfigInput & {
1545
+ export type StructuredConfigEntry = ({
1546
+ type: 'address';
1547
+ value: AddressValue;
1548
+ } | {
1549
+ type: 'delivery';
1550
+ value: DeliverySettings;
1551
+ } | {
1552
+ type: 'payments';
1553
+ value: PaymentSettings;
1554
+ }) & {
1494
1555
  key: string;
1495
1556
  /** The readable text the `{{config:KEY}}` variable now holds. */
1496
1557
  text: string;
@@ -1699,6 +1760,8 @@ export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'cas
1699
1760
  export interface AppWebhook {
1700
1761
  url: string;
1701
1762
  events: AppWebhookEventName[];
1763
+ /** Where the App shows a receipt (`{team}`, `{token}`), when it set one (AGF-CASE-RECEIPT R5). */
1764
+ receiptLink?: string | null;
1702
1765
  active: boolean;
1703
1766
  createdAt: string;
1704
1767
  updatedAt: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.27.0",
3
+ "version": "4.29.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",