@agentforge-io/sdk-server 4.46.0 → 4.48.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/client.d.ts CHANGED
@@ -16,6 +16,7 @@ import { MarketplaceResource } from './resources/marketplace';
16
16
  import { TenantConfigResource } from './resources/config';
17
17
  import { PlacesResource } from './resources/places';
18
18
  import { DeliveryResource } from './resources/delivery';
19
+ import { BusinessReviewsResource } from './resources/reviews';
19
20
  import { CasesResource } from './resources/cases';
20
21
  import { CatalogResource } from './resources/catalog';
21
22
  import { BusinessRolesResource } from './resources/business-roles';
@@ -110,6 +111,8 @@ export declare class AgentForgeClient {
110
111
  readonly delivery: DeliveryResource;
111
112
  /** AGF-CASES — what customers came for in conversations (orders, bookings…). */
112
113
  readonly cases: CasesResource;
114
+ /** AGF-BUSINESS-REVIEWS — customers' reviews of this business. */
115
+ readonly reviews: BusinessReviewsResource;
113
116
  readonly businessRoles: BusinessRolesResource;
114
117
  readonly catalog: CatalogResource;
115
118
  constructor(opts: AgentForgeClientOptions);
package/dist/client.js CHANGED
@@ -38,6 +38,7 @@ const marketplace_1 = require("./resources/marketplace");
38
38
  const config_1 = require("./resources/config");
39
39
  const places_1 = require("./resources/places");
40
40
  const delivery_1 = require("./resources/delivery");
41
+ const reviews_1 = require("./resources/reviews");
41
42
  const cases_1 = require("./resources/cases");
42
43
  const catalog_1 = require("./resources/catalog");
43
44
  const business_roles_1 = require("./resources/business-roles");
@@ -88,6 +89,7 @@ class AgentForgeClient {
88
89
  this.places = new places_1.PlacesResource(this);
89
90
  this.delivery = new delivery_1.DeliveryResource(this);
90
91
  this.cases = new cases_1.CasesResource(this);
92
+ this.reviews = new reviews_1.BusinessReviewsResource(this);
91
93
  this.businessRoles = new business_roles_1.BusinessRolesResource(this);
92
94
  this.catalog = new catalog_1.CatalogResource(this);
93
95
  }
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, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogBookingRule, DirectOrderForm, DirectPaymentOption, 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, 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, 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, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CaseStateStep, CreateDirectOrderInput, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, 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, 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, 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';
@@ -0,0 +1,14 @@
1
+ import type { AgentForgeClient } from '../client';
2
+ import type { BusinessReview, BusinessReviewsPage, ListTemplateReviewsInput, SaveTemplateReviewInput } from '../types';
3
+ export declare class BusinessReviewsResource {
4
+ private readonly client;
5
+ constructor(client: AgentForgeClient);
6
+ /** `GET /api/v1/reviews` — visible reviews + summary; with `externalUserId`, `mine` and `canReview`. */
7
+ list(input?: ListTemplateReviewsInput): Promise<BusinessReviewsPage>;
8
+ /** `PUT /api/v1/reviews/mine` — create or edit. 403 `no_order` before a received order, 400 on bad input. */
9
+ save(input: SaveTemplateReviewInput): Promise<BusinessReview>;
10
+ /** `DELETE /api/v1/reviews/mine` — no error when there was none. */
11
+ remove(input: {
12
+ externalUserId: string;
13
+ }): Promise<void>;
14
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // reviews resource (AGF-BUSINESS-REVIEWS) — customers' reviews of the
3
+ // credential's business (its tenant). Anyone the App shows them to reads them;
4
+ // a customer (`externalUserId`) writes one, once they received an order from it.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.BusinessReviewsResource = void 0;
7
+ class BusinessReviewsResource {
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /** `GET /api/v1/reviews` — visible reviews + summary; with `externalUserId`, `mine` and `canReview`. */
12
+ async list(input = {}) {
13
+ const qs = new URLSearchParams();
14
+ if (input.externalUserId)
15
+ qs.set('externalUserId', input.externalUserId);
16
+ if (input.cursor)
17
+ qs.set('cursor', input.cursor);
18
+ if (input.limit !== undefined)
19
+ qs.set('limit', String(input.limit));
20
+ const query = qs.toString();
21
+ return this.client.request('GET', `/api/v1/reviews${query ? `?${query}` : ''}`);
22
+ }
23
+ /** `PUT /api/v1/reviews/mine` — create or edit. 403 `no_order` before a received order, 400 on bad input. */
24
+ async save(input) {
25
+ return this.client.request('PUT', '/api/v1/reviews/mine', input);
26
+ }
27
+ /** `DELETE /api/v1/reviews/mine` — no error when there was none. */
28
+ async remove(input) {
29
+ await this.client.request('DELETE', `/api/v1/reviews/mine?externalUserId=${encodeURIComponent(input.externalUserId)}`);
30
+ }
31
+ }
32
+ exports.BusinessReviewsResource = BusinessReviewsResource;
package/dist/types.d.ts CHANGED
@@ -961,6 +961,19 @@ export interface SaveTemplateReviewInput {
961
961
  /** https photo. */
962
962
  reviewerAvatarUrl?: string | null;
963
963
  }
964
+ /** AGF-BUSINESS-REVIEWS. A customer's review of a business (one per customer, editable). */
965
+ export type BusinessReview = Omit<TemplateReview, 'version'>;
966
+ /** `GET /api/v1/reviews`. */
967
+ export interface BusinessReviewsPage {
968
+ /** Visible reviews, newest first. */
969
+ items: BusinessReview[];
970
+ /** The `externalUserId`'s own review (also when hidden), or null. */
971
+ mine: BusinessReview | null;
972
+ /** With `externalUserId`: they received an order from the business, so they may write one. */
973
+ canReview?: boolean;
974
+ summary: TemplateRatingSummary;
975
+ nextCursor: string | null;
976
+ }
964
977
  /** AGF-PDK-TEMPLATE-PAGE. What kind of problem a report is about. */
965
978
  export type TemplateReportKind = 'bug' | 'inappropriate' | 'misleading' | 'other';
966
979
  /** `POST /api/v1/templates/:id/reports` — private to the author and admins. 429 past 10 a day. */
@@ -2064,6 +2077,10 @@ export interface CaseView {
2064
2077
  customerPhone: string | null;
2065
2078
  /** Where in the business the customer ordered from («Mesa 2», a scanned code). */
2066
2079
  customerPlace?: string | null;
2080
+ /** AGF-ORDER-ORIGIN-POS — where it came from, with its tag («Mesa 2 · QR»); null for cases from before. */
2081
+ origin: (CaseOrigin & {
2082
+ label: string;
2083
+ }) | null;
2067
2084
  /** The road the business walks it: sent, accepted, the type's own phases, completed. */
2068
2085
  path: Array<{
2069
2086
  key: string;
@@ -2254,6 +2271,12 @@ export interface CaseReceipt {
2254
2271
  updatedAt: string;
2255
2272
  /** AGF-PAYMENT-ACCOUNTS — how it is paid; null before the business took it (unless chosen in the checkout). */
2256
2273
  payment: CaseReceiptPayment | null;
2274
+ /** AGF-ORDER-ORIGIN-POS — where it was ordered from, as the customer reads it (no team member); null when unknown. */
2275
+ origin: {
2276
+ channel: CaseOriginChannel;
2277
+ place: string | null;
2278
+ label: string;
2279
+ } | null;
2257
2280
  business: {
2258
2281
  name: string;
2259
2282
  description: string | null;
@@ -2263,23 +2286,47 @@ export interface CaseReceipt {
2263
2286
  timeZone: string | null;
2264
2287
  };
2265
2288
  }
2289
+ /** AGF-ORDER-ORIGIN-POS — the channel an order came by (`pos`: a sale the team registered in the App). */
2290
+ export type CaseOriginChannel = 'qr' | 'nfc' | 'link' | 'page' | 'chat' | 'whatsapp' | 'pos';
2291
+ /** Where an order comes from, frozen when it is created. */
2292
+ export interface CaseOrigin {
2293
+ channel: CaseOriginChannel;
2294
+ /** The code or place it came from; `label` is what people read («Mesa 2», «Sede Norte»). */
2295
+ place?: {
2296
+ linkId?: string;
2297
+ code?: string;
2298
+ ref?: string;
2299
+ label: string;
2300
+ };
2301
+ /** `pos`: the team member who registered the sale. */
2302
+ by?: {
2303
+ accountId: string;
2304
+ name: string;
2305
+ };
2306
+ }
2266
2307
  /**
2267
2308
  * AGF-ORDER-WITHOUT-AI — an order placed without the assistant: a cart and a
2268
2309
  * checkout on the host App. Created already sent (holds, receipt, `case.submitted`).
2269
2310
  */
2270
2311
  export interface CreateDirectOrderInput {
2271
- /** Who orders: the App's visitor id, and the name and phone they gave (both required unless `place`). */
2272
2312
  /**
2273
2313
  * AGF-CUSTOMER-WHERE: where in the business the customer is («Mesa 2»),
2274
2314
  * from a code your server resolved — never text the customer typed. With
2275
2315
  * it, `customer.name` and `customer.phone` may be '' (optional at a table).
2276
2316
  */
2277
2317
  place?: string;
2318
+ /**
2319
+ * Who orders: the App's visitor id, and the name and phone they gave (both required
2320
+ * unless `place`). A sale the team registers (`origin.channel` `pos`) may leave both
2321
+ * out: it is then named after its place («Mostrador», «Mesa 2») and has no phone.
2322
+ */
2278
2323
  customer: {
2279
2324
  ref: string;
2280
- name: string;
2281
- phone: string;
2325
+ name?: string;
2326
+ phone?: string;
2282
2327
  };
2328
+ /** AGF-ORDER-ORIGIN-POS — where it comes from; default `{ channel: 'page' }`. A `pos` sale needs `place` and `by`. */
2329
+ origin?: CaseOrigin;
2283
2330
  /** Products of the business's catalog and how many of each. `options`: the choice for a
2284
2331
  * product with option groups (AGF-MENU-OPTIONS M2; a required group left out → 400). */
2285
2332
  lines: Array<{
@@ -2441,6 +2488,8 @@ export interface AppWebhookEvent {
2441
2488
  /** `case.payment_changed`: where the payment is now, and where it was. */
2442
2489
  paymentStatus?: CasePaymentStatus;
2443
2490
  previousPaymentStatus?: CasePaymentStatus;
2491
+ /** AGF-ORDER-ORIGIN-POS — where the case came from (cases from before carry none). */
2492
+ origin?: CaseOrigin;
2444
2493
  };
2445
2494
  }
2446
2495
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge-io/sdk-server",
3
- "version": "4.46.0",
3
+ "version": "4.48.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",