@agentforge-io/sdk-server 4.29.0 → 4.31.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 +1 -1
- package/dist/resources/cases.d.ts +43 -1
- package/dist/resources/cases.js +45 -0
- package/dist/resources/chat.d.ts +10 -0
- package/dist/resources/chat.js +9 -0
- package/dist/types.d.ts +129 -2
- package/package.json +1 -1
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, 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';
|
|
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, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, 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 { CaseReceipt, CaseState, CaseView, ListCasesInput } from '../types';
|
|
2
|
+
import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectOrderInput, DirectOrderForm, ListCasesInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -27,6 +27,48 @@ export declare class CasesResource {
|
|
|
27
27
|
* it was accepted or once closed. Returns the receipt as it is now.
|
|
28
28
|
*/
|
|
29
29
|
receiptReceived(token: string): Promise<CaseReceipt>;
|
|
30
|
+
/**
|
|
31
|
+
* `GET /api/v1/cases/direct/form` — what a checkout asks besides the cart, the name
|
|
32
|
+
* and the phone: the order type and its other fields (chips for a closed choice).
|
|
33
|
+
*/
|
|
34
|
+
directForm(opts?: {
|
|
35
|
+
type?: string;
|
|
36
|
+
}): Promise<DirectOrderForm>;
|
|
37
|
+
/**
|
|
38
|
+
* `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
|
|
39
|
+
* assistant (the business's chat is off, or the customer chose the checkout, or the
|
|
40
|
+
* assistant cannot answer). Created already sent: units held, receipt issued,
|
|
41
|
+
* `case.submitted` fired — the business sees it in its requests like any other.
|
|
42
|
+
* 400 for a bad order or missing fields, 409 when a product lacks stock.
|
|
43
|
+
*/
|
|
44
|
+
createDirect(input: CreateDirectOrderInput): Promise<CaseView>;
|
|
45
|
+
/**
|
|
46
|
+
* `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
|
|
47
|
+
* payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
|
|
48
|
+
* `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
|
|
49
|
+
* The customer is told of paid, rejected and refunds.
|
|
50
|
+
*/
|
|
51
|
+
setPayment(caseId: string, status: CasePaymentStatus, opts?: {
|
|
52
|
+
note?: string;
|
|
53
|
+
amountCents?: number;
|
|
54
|
+
}): Promise<CaseView>;
|
|
55
|
+
/**
|
|
56
|
+
* `POST /api/v1/cases/receipts/:token/payment/choose` — the customer chooses how
|
|
57
|
+
* to pay on the receipt (an `accountId` from `payment.options`).
|
|
58
|
+
*/
|
|
59
|
+
receiptChoosePayment(token: string, accountId: string): Promise<CaseReceipt>;
|
|
60
|
+
/**
|
|
61
|
+
* `POST /api/v1/cases/receipts/:token/payment/report` — the customer says they
|
|
62
|
+
* paid: the transfer `reference` and/or the `proof` image (jpeg/png/webp, base64,
|
|
63
|
+
* ≤ 700 KB). The payment waits for the business to confirm it.
|
|
64
|
+
*/
|
|
65
|
+
receiptReportPayment(token: string, input: {
|
|
66
|
+
reference?: string;
|
|
67
|
+
proof?: {
|
|
68
|
+
contentType: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
69
|
+
dataBase64: string;
|
|
70
|
+
};
|
|
71
|
+
}): Promise<CaseReceipt>;
|
|
30
72
|
/**
|
|
31
73
|
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
32
74
|
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|
package/dist/resources/cases.js
CHANGED
|
@@ -56,6 +56,51 @@ class CasesResource {
|
|
|
56
56
|
async receiptReceived(token) {
|
|
57
57
|
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/received`, {});
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* `GET /api/v1/cases/direct/form` — what a checkout asks besides the cart, the name
|
|
61
|
+
* and the phone: the order type and its other fields (chips for a closed choice).
|
|
62
|
+
*/
|
|
63
|
+
async directForm(opts = {}) {
|
|
64
|
+
return this.client.request('GET', `/api/v1/cases/direct/form${opts.type ? `?type=${encodeURIComponent(opts.type)}` : ''}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* `POST /api/v1/cases/direct` — AGF-ORDER-WITHOUT-AI: an order placed without the
|
|
68
|
+
* assistant (the business's chat is off, or the customer chose the checkout, or the
|
|
69
|
+
* assistant cannot answer). Created already sent: units held, receipt issued,
|
|
70
|
+
* `case.submitted` fired — the business sees it in its requests like any other.
|
|
71
|
+
* 400 for a bad order or missing fields, 409 when a product lacks stock.
|
|
72
|
+
*/
|
|
73
|
+
async createDirect(input) {
|
|
74
|
+
return this.client.request('POST', '/api/v1/cases/direct', input);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
|
|
78
|
+
* payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
|
|
79
|
+
* `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
|
|
80
|
+
* The customer is told of paid, rejected and refunds.
|
|
81
|
+
*/
|
|
82
|
+
async setPayment(caseId, status, opts = {}) {
|
|
83
|
+
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/payment`, {
|
|
84
|
+
status,
|
|
85
|
+
...(opts.note ? { note: opts.note } : {}),
|
|
86
|
+
...(opts.amountCents ? { amountCents: opts.amountCents } : {}),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* `POST /api/v1/cases/receipts/:token/payment/choose` — the customer chooses how
|
|
91
|
+
* to pay on the receipt (an `accountId` from `payment.options`).
|
|
92
|
+
*/
|
|
93
|
+
async receiptChoosePayment(token, accountId) {
|
|
94
|
+
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/payment/choose`, { accountId });
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `POST /api/v1/cases/receipts/:token/payment/report` — the customer says they
|
|
98
|
+
* paid: the transfer `reference` and/or the `proof` image (jpeg/png/webp, base64,
|
|
99
|
+
* ≤ 700 KB). The payment waits for the business to confirm it.
|
|
100
|
+
*/
|
|
101
|
+
async receiptReportPayment(token, input) {
|
|
102
|
+
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/payment/report`, input);
|
|
103
|
+
}
|
|
59
104
|
/**
|
|
60
105
|
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
61
106
|
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|
package/dist/resources/chat.d.ts
CHANGED
|
@@ -107,6 +107,16 @@ export declare class ChatResource {
|
|
|
107
107
|
* }
|
|
108
108
|
*/
|
|
109
109
|
streamMessage(input: StreamMessageInput): AsyncGenerator<ChatStreamEvent>;
|
|
110
|
+
/**
|
|
111
|
+
* `GET /api/v1/assistant/status` — AGF-ORDER-WITHOUT-AI: can the workspace's
|
|
112
|
+
* assistant answer now? `available: false, reason: 'plan_exceeded'` when its plan
|
|
113
|
+
* quota is used up (the chat would answer 402): a host App takes orders without
|
|
114
|
+
* the chat instead. Unknown reads as available.
|
|
115
|
+
*/
|
|
116
|
+
assistantStatus(): Promise<{
|
|
117
|
+
available: boolean;
|
|
118
|
+
reason?: 'plan_exceeded';
|
|
119
|
+
}>;
|
|
110
120
|
/**
|
|
111
121
|
* Historial completo de una conversación — `GET
|
|
112
122
|
* /api/v1/chat/conversations/:id/messages`. Útil para "resumir" un chat
|
package/dist/resources/chat.js
CHANGED
|
@@ -101,6 +101,15 @@ class ChatResource {
|
|
|
101
101
|
reader.releaseLock();
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* `GET /api/v1/assistant/status` — AGF-ORDER-WITHOUT-AI: can the workspace's
|
|
106
|
+
* assistant answer now? `available: false, reason: 'plan_exceeded'` when its plan
|
|
107
|
+
* quota is used up (the chat would answer 402): a host App takes orders without
|
|
108
|
+
* the chat instead. Unknown reads as available.
|
|
109
|
+
*/
|
|
110
|
+
async assistantStatus() {
|
|
111
|
+
return this.client.request('GET', '/api/v1/assistant/status');
|
|
112
|
+
}
|
|
104
113
|
/**
|
|
105
114
|
* Historial completo de una conversación — `GET
|
|
106
115
|
* /api/v1/chat/conversations/:id/messages`. Útil para "resumir" un chat
|
package/dist/types.d.ts
CHANGED
|
@@ -1497,6 +1497,10 @@ export interface PaymentMethodDef {
|
|
|
1497
1497
|
/** When the customer pays: before it is sent, or when they get it. */
|
|
1498
1498
|
when: 'before' | 'on_delivery';
|
|
1499
1499
|
fields: PaymentFieldDef[];
|
|
1500
|
+
/** One per business (cash): no name to tell accounts apart, a second one is refused. */
|
|
1501
|
+
single?: boolean;
|
|
1502
|
+
/** The country's most used methods (CO: Efectivo, Nequi, Daviplata, Bre-B): editors show them first. */
|
|
1503
|
+
popular?: boolean;
|
|
1500
1504
|
}
|
|
1501
1505
|
/** One way to pay into the business, with the data a customer needs. Several per method allowed. */
|
|
1502
1506
|
export interface PaymentAccount {
|
|
@@ -1662,8 +1666,10 @@ export interface CaseView {
|
|
|
1662
1666
|
}>;
|
|
1663
1667
|
/** The inbox thread that carries the conversation (open the chat with it), when there is one. */
|
|
1664
1668
|
threadId: string | null;
|
|
1665
|
-
/** The customer's name on that thread,
|
|
1669
|
+
/** The customer's name on that thread, or the one given at checkout (an order without the chat). */
|
|
1666
1670
|
customerName: string | null;
|
|
1671
|
+
/** AGF-ORDER-WITHOUT-AI — the phone given at checkout (orders placed without the chat). */
|
|
1672
|
+
customerPhone: string | null;
|
|
1667
1673
|
/** The road the business walks it: sent, accepted, the type's own phases, completed. */
|
|
1668
1674
|
path: Array<{
|
|
1669
1675
|
key: string;
|
|
@@ -1682,12 +1688,88 @@ export interface CaseView {
|
|
|
1682
1688
|
text: string;
|
|
1683
1689
|
at: string;
|
|
1684
1690
|
} | null;
|
|
1691
|
+
/** AGF-PAYMENT-ACCOUNTS — how it is paid: null before the business took it (or closed undone with nothing chosen). */
|
|
1692
|
+
payment: CasePayment | null;
|
|
1685
1693
|
openedAt: string;
|
|
1686
1694
|
reviewedAt: string | null;
|
|
1687
1695
|
submittedAt: string | null;
|
|
1688
1696
|
closedAt: string | null;
|
|
1689
1697
|
lastActivityAt: string;
|
|
1690
1698
|
}
|
|
1699
|
+
/**
|
|
1700
|
+
* The payment's own lifecycle, apart from the case's states: `unpaid` →
|
|
1701
|
+
* `awaiting_payment` (method chosen) → `pending_confirmation` (the customer
|
|
1702
|
+
* reported it) → `paid` | `rejected`; then `refunded`, `partially_refunded`,
|
|
1703
|
+
* `reversed`; `voided` when the order ended unpaid. Completing never marks it paid.
|
|
1704
|
+
*/
|
|
1705
|
+
export type CasePaymentStatus = 'unpaid' | 'awaiting_payment' | 'pending_confirmation' | 'paid' | 'rejected' | 'refunded' | 'partially_refunded' | 'reversed' | 'voided';
|
|
1706
|
+
/** The account the customer chose, as it was then (a later edit never rewrites a sale). */
|
|
1707
|
+
export interface CasePaymentAccount {
|
|
1708
|
+
id: string;
|
|
1709
|
+
method: string;
|
|
1710
|
+
methodName: string;
|
|
1711
|
+
label?: string;
|
|
1712
|
+
when: 'before' | 'on_delivery';
|
|
1713
|
+
/** "Nequi (Principal): 3001234567 a nombre de Ana Pérez". */
|
|
1714
|
+
line: string;
|
|
1715
|
+
/** What to copy to pay (empty for cash / card terminal). */
|
|
1716
|
+
copy: Array<{
|
|
1717
|
+
label: string;
|
|
1718
|
+
value: string;
|
|
1719
|
+
}>;
|
|
1720
|
+
notes?: string;
|
|
1721
|
+
}
|
|
1722
|
+
export interface CasePayment {
|
|
1723
|
+
status: CasePaymentStatus;
|
|
1724
|
+
statusLabel: string;
|
|
1725
|
+
account?: CasePaymentAccount;
|
|
1726
|
+
reference?: string;
|
|
1727
|
+
/** The proof image the customer sent (for the business). */
|
|
1728
|
+
proofUrl?: string;
|
|
1729
|
+
reportedAt?: string;
|
|
1730
|
+
confirmedAt?: string;
|
|
1731
|
+
refundedCents?: number;
|
|
1732
|
+
/** The business's note on its last move of the payment. */
|
|
1733
|
+
note?: string;
|
|
1734
|
+
/** The receipt's total, when every line has a price. */
|
|
1735
|
+
amountCents: number | null;
|
|
1736
|
+
currency: string | null;
|
|
1737
|
+
/** Where the business may move it now. */
|
|
1738
|
+
nextStatuses: Array<{
|
|
1739
|
+
key: CasePaymentStatus;
|
|
1740
|
+
label: string;
|
|
1741
|
+
}>;
|
|
1742
|
+
history: Array<{
|
|
1743
|
+
status: CasePaymentStatus;
|
|
1744
|
+
by: 'assistant' | 'customer' | 'business' | 'system';
|
|
1745
|
+
at: string;
|
|
1746
|
+
note?: string;
|
|
1747
|
+
amountCents?: number;
|
|
1748
|
+
}>;
|
|
1749
|
+
}
|
|
1750
|
+
/** The payment as a receipt's public link shows it (no proof image, only that one was sent). */
|
|
1751
|
+
export interface CaseReceiptPayment {
|
|
1752
|
+
status: CasePaymentStatus;
|
|
1753
|
+
statusLabel: string;
|
|
1754
|
+
account: CasePaymentAccount | null;
|
|
1755
|
+
amountCents: number | null;
|
|
1756
|
+
currency: string | null;
|
|
1757
|
+
reference: string | null;
|
|
1758
|
+
proofSent: boolean;
|
|
1759
|
+
reportedAt: string | null;
|
|
1760
|
+
confirmedAt: string | null;
|
|
1761
|
+
note: string | null;
|
|
1762
|
+
/** Methods the customer may choose now (`cases.receiptChoosePayment`). */
|
|
1763
|
+
options: Array<{
|
|
1764
|
+
accountId: string;
|
|
1765
|
+
method: string;
|
|
1766
|
+
methodName: string;
|
|
1767
|
+
label?: string;
|
|
1768
|
+
when: 'before' | 'on_delivery';
|
|
1769
|
+
}>;
|
|
1770
|
+
/** The customer may say they paid now (`cases.receiptReportPayment`). */
|
|
1771
|
+
canReport: boolean;
|
|
1772
|
+
}
|
|
1691
1773
|
/** AGF-CASE-RECEIPT — one product line, with the price it had when the receipt was issued. */
|
|
1692
1774
|
export interface CaseReceiptLine {
|
|
1693
1775
|
title: string;
|
|
@@ -1738,6 +1820,8 @@ export interface CaseReceipt {
|
|
|
1738
1820
|
/** Closed without being done (rejected, cancelled, abandoned). */
|
|
1739
1821
|
stopped: boolean;
|
|
1740
1822
|
updatedAt: string;
|
|
1823
|
+
/** AGF-PAYMENT-ACCOUNTS — how it is paid; null before the business took it. */
|
|
1824
|
+
payment: CaseReceiptPayment | null;
|
|
1741
1825
|
business: {
|
|
1742
1826
|
name: string;
|
|
1743
1827
|
description: string | null;
|
|
@@ -1747,6 +1831,46 @@ export interface CaseReceipt {
|
|
|
1747
1831
|
timeZone: string | null;
|
|
1748
1832
|
};
|
|
1749
1833
|
}
|
|
1834
|
+
/**
|
|
1835
|
+
* AGF-ORDER-WITHOUT-AI — an order placed without the assistant: a cart and a
|
|
1836
|
+
* checkout on the host App. Created already sent (holds, receipt, `case.submitted`).
|
|
1837
|
+
*/
|
|
1838
|
+
export interface CreateDirectOrderInput {
|
|
1839
|
+
/** Who orders: the App's visitor id, and the name and phone they gave (both required). */
|
|
1840
|
+
customer: {
|
|
1841
|
+
ref: string;
|
|
1842
|
+
name: string;
|
|
1843
|
+
phone: string;
|
|
1844
|
+
};
|
|
1845
|
+
/** Products of the business's catalog and how many of each. */
|
|
1846
|
+
lines: Array<{
|
|
1847
|
+
productId: string;
|
|
1848
|
+
quantity: number;
|
|
1849
|
+
}>;
|
|
1850
|
+
/** The order type's other fields (entrega, direccion, notas…), by key. */
|
|
1851
|
+
fields?: Record<string, unknown>;
|
|
1852
|
+
/** The team's order type; default: its first type with a products field, else the built-in «pedido». */
|
|
1853
|
+
type?: string;
|
|
1854
|
+
/** The visitor's chat conversation, when the chat is on (notices then land there too). */
|
|
1855
|
+
conversationId?: string;
|
|
1856
|
+
/** Same key → same order: a retried submit never makes two. 8–80 of [A-Za-z0-9_.:-]. */
|
|
1857
|
+
idempotencyKey: string;
|
|
1858
|
+
}
|
|
1859
|
+
/** What a checkout asks besides the cart, the name and the phone (AGF-ORDER-WITHOUT-AI). */
|
|
1860
|
+
export interface DirectOrderForm {
|
|
1861
|
+
type: {
|
|
1862
|
+
key: string;
|
|
1863
|
+
label: string;
|
|
1864
|
+
};
|
|
1865
|
+
/** The order type's other fields, in order; `options`: a closed choice (show chips). */
|
|
1866
|
+
fields: Array<{
|
|
1867
|
+
key: string;
|
|
1868
|
+
label: string;
|
|
1869
|
+
required: boolean;
|
|
1870
|
+
hint?: string;
|
|
1871
|
+
options?: string[];
|
|
1872
|
+
}>;
|
|
1873
|
+
}
|
|
1750
1874
|
export interface ListCasesInput {
|
|
1751
1875
|
state?: CaseState[];
|
|
1752
1876
|
type?: string;
|
|
@@ -1756,7 +1880,7 @@ export interface ListCasesInput {
|
|
|
1756
1880
|
/** 1–200, default 50. */
|
|
1757
1881
|
limit?: number;
|
|
1758
1882
|
}
|
|
1759
|
-
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request';
|
|
1883
|
+
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed';
|
|
1760
1884
|
export interface AppWebhook {
|
|
1761
1885
|
url: string;
|
|
1762
1886
|
events: AppWebhookEventName[];
|
|
@@ -1786,6 +1910,9 @@ export interface AppWebhookEvent {
|
|
|
1786
1910
|
/** What people read it by ("K7Q2XM"). */
|
|
1787
1911
|
caseCode?: string;
|
|
1788
1912
|
conversationId: string;
|
|
1913
|
+
/** `case.payment_changed`: where the payment is now, and where it was. */
|
|
1914
|
+
paymentStatus?: CasePaymentStatus;
|
|
1915
|
+
previousPaymentStatus?: CasePaymentStatus;
|
|
1789
1916
|
};
|
|
1790
1917
|
}
|
|
1791
1918
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.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",
|