@agentforge-io/sdk-server 4.83.0 → 4.85.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 +29 -2
- package/dist/resources/cases.js +30 -1
- package/dist/types.d.ts +157 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { BillingResource } from './resources/billing';
|
|
|
8
8
|
export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
|
|
9
9
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
10
10
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
11
|
-
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, CaseContactLink, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseClosingReceivables, CaseAccount, SetOnAccountInput, SetOnAccountResult, 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, GoogleCalendarAccount, GoogleCalendarEventInput, GoogleCalendarUpsertResult, GoogleCalendarBusyInput, GoogleCalendarBusyResult, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
11
|
+
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, ThemedColor, 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, CaseContactLink, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, CaseOffCatalogLine, CaseOffCatalogView, ConfirmCaseLineInput, CreateOffCatalogLineInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseClosingReceivables, CaseAccount, SetOnAccountInput, SetOnAccountResult, 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, GoogleCalendarAccount, GoogleCalendarEventInput, GoogleCalendarUpsertResult, GoogleCalendarBusyInput, GoogleCalendarBusyResult, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
12
12
|
export { AgentsResource } from './resources/agents';
|
|
13
13
|
export { AnalyticsResource } from './resources/analytics';
|
|
14
14
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CaseAccount, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetOnAccountInput, SetOnAccountResult } from '../types';
|
|
2
|
+
import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetOnAccountInput, SetOnAccountResult } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -33,6 +33,25 @@ export declare class CasesResource {
|
|
|
33
33
|
}): Promise<CaseReportPage>;
|
|
34
34
|
/** `GET /api/v1/cases/:id` — 404 when it is not this workspace's. */
|
|
35
35
|
get(caseId: string): Promise<CaseView>;
|
|
36
|
+
/**
|
|
37
|
+
* `POST /api/v1/cases/:id/lines/confirm` — PDK-OFF-CATALOG: the business answers ONE product the customer asked for
|
|
38
|
+
* that is not in the catalog (a free line, `input.key` = `CaseView.offCatalog.lines[].key`, e.g. `off#1`): `ready` with
|
|
39
|
+
* the price of one `unit`, `swap` with another thing and its price, or `out`. While other free lines still wait, only
|
|
40
|
+
* that line changes (no notice to the customer, the receipt keeps its revision). The confirmation that leaves none
|
|
41
|
+
* pending sets the total: the receipt is re-issued (revision + 1) and the customer is told through a proposal
|
|
42
|
+
* (`CaseView.proposal`, `offCatalog: true`) whose changes are the free lines (`price`, `out`, `swap`):
|
|
43
|
+
*
|
|
44
|
+
* - `requiresAnswer: true` when a line is out or swapped, or a line's amount is over what the customer said × 1.2
|
|
45
|
+
* (`askedPriceCents`): nothing is accepted silently; the customer answers on the receipt / chat
|
|
46
|
+
* (`receiptAnswerProposal`) and payment waits for it. A dropped line leaves the order.
|
|
47
|
+
* - otherwise `autoAcceptAt` (10 minutes later): the platform keeps no timer — your App answers
|
|
48
|
+
* `answerProposal(caseId, 'all')` once it passes (or earlier, if the customer pays/taps accept).
|
|
49
|
+
*
|
|
50
|
+
* Every line out and nothing else on the order cancels it. 400 when the order is still being edited by the customer,
|
|
51
|
+
* closed or confirmed, or the input is wrong; 404 unknown line; 409 a proposal is waiting (answer or withdraw it first).
|
|
52
|
+
* Returns the updated case.
|
|
53
|
+
*/
|
|
54
|
+
confirmLine(caseId: string, input: ConfirmCaseLineInput): Promise<CaseView>;
|
|
36
55
|
/**
|
|
37
56
|
* `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
|
|
38
57
|
* («$3.000 de queso») really weighed, in the product's unit (`line` = the
|
|
@@ -61,7 +80,12 @@ export declare class CasesResource {
|
|
|
61
80
|
* the answer. Replaces a pending proposal. 400 with the reason when one cannot be made.
|
|
62
81
|
*/
|
|
63
82
|
propose(caseId: string, input: CaseProposalInput): Promise<CaseView>;
|
|
64
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* `POST /api/v1/cases/:id/proposal/withdraw` — takes the pending proposal back: the order can move again.
|
|
85
|
+
* PDK-OFF-CATALOG: withdrawing the confirmation of free lines (`proposal.offCatalog`) is «corregir» — the lines it
|
|
86
|
+
* changed go back to pending (price/mark/swap cleared), the receipt is re-issued with a null total and the business
|
|
87
|
+
* confirms them again with `confirmLine`; the lines are never left confirmed without the customer's answer.
|
|
88
|
+
*/
|
|
65
89
|
withdrawProposal(caseId: string): Promise<CaseView>;
|
|
66
90
|
/**
|
|
67
91
|
* `POST /api/v1/cases/:id/proposal/answer` — the business records the customer's answer
|
|
@@ -98,6 +122,9 @@ export declare class CasesResource {
|
|
|
98
122
|
* `POST /api/v1/cases/:id/transition` — the business moves a case:
|
|
99
123
|
* `accepted` / `rejected` from `submitted`, then the type's states,
|
|
100
124
|
* `completed` or `cancelled`. 400 (with the allowed states) otherwise.
|
|
125
|
+
* PDK-OFF-CATALOG: moving to a confirmed state (`confirmed`, ready, out for delivery, `completed`) is refused with
|
|
126
|
+
* 400 `code: 'lines_pending'` while a free line is still pending (`offCatalog.pendingCount > 0`): confirm them
|
|
127
|
+
* first. `cancelled` / `rejected` stay allowed.
|
|
101
128
|
*/
|
|
102
129
|
transition(caseId: string, state: CaseState, opts?: {
|
|
103
130
|
note?: string;
|
package/dist/resources/cases.js
CHANGED
|
@@ -70,6 +70,27 @@ class CasesResource {
|
|
|
70
70
|
async get(caseId) {
|
|
71
71
|
return this.client.request('GET', `/api/v1/cases/${encodeURIComponent(caseId)}`);
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* `POST /api/v1/cases/:id/lines/confirm` — PDK-OFF-CATALOG: the business answers ONE product the customer asked for
|
|
75
|
+
* that is not in the catalog (a free line, `input.key` = `CaseView.offCatalog.lines[].key`, e.g. `off#1`): `ready` with
|
|
76
|
+
* the price of one `unit`, `swap` with another thing and its price, or `out`. While other free lines still wait, only
|
|
77
|
+
* that line changes (no notice to the customer, the receipt keeps its revision). The confirmation that leaves none
|
|
78
|
+
* pending sets the total: the receipt is re-issued (revision + 1) and the customer is told through a proposal
|
|
79
|
+
* (`CaseView.proposal`, `offCatalog: true`) whose changes are the free lines (`price`, `out`, `swap`):
|
|
80
|
+
*
|
|
81
|
+
* - `requiresAnswer: true` when a line is out or swapped, or a line's amount is over what the customer said × 1.2
|
|
82
|
+
* (`askedPriceCents`): nothing is accepted silently; the customer answers on the receipt / chat
|
|
83
|
+
* (`receiptAnswerProposal`) and payment waits for it. A dropped line leaves the order.
|
|
84
|
+
* - otherwise `autoAcceptAt` (10 minutes later): the platform keeps no timer — your App answers
|
|
85
|
+
* `answerProposal(caseId, 'all')` once it passes (or earlier, if the customer pays/taps accept).
|
|
86
|
+
*
|
|
87
|
+
* Every line out and nothing else on the order cancels it. 400 when the order is still being edited by the customer,
|
|
88
|
+
* closed or confirmed, or the input is wrong; 404 unknown line; 409 a proposal is waiting (answer or withdraw it first).
|
|
89
|
+
* Returns the updated case.
|
|
90
|
+
*/
|
|
91
|
+
async confirmLine(caseId, input) {
|
|
92
|
+
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/lines/confirm`, input);
|
|
93
|
+
}
|
|
73
94
|
/**
|
|
74
95
|
* `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
|
|
75
96
|
* («$3.000 de queso») really weighed, in the product's unit (`line` = the
|
|
@@ -101,7 +122,12 @@ class CasesResource {
|
|
|
101
122
|
async propose(caseId, input) {
|
|
102
123
|
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/proposal`, input);
|
|
103
124
|
}
|
|
104
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* `POST /api/v1/cases/:id/proposal/withdraw` — takes the pending proposal back: the order can move again.
|
|
127
|
+
* PDK-OFF-CATALOG: withdrawing the confirmation of free lines (`proposal.offCatalog`) is «corregir» — the lines it
|
|
128
|
+
* changed go back to pending (price/mark/swap cleared), the receipt is re-issued with a null total and the business
|
|
129
|
+
* confirms them again with `confirmLine`; the lines are never left confirmed without the customer's answer.
|
|
130
|
+
*/
|
|
105
131
|
async withdrawProposal(caseId) {
|
|
106
132
|
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/proposal/withdraw`, {});
|
|
107
133
|
}
|
|
@@ -150,6 +176,9 @@ class CasesResource {
|
|
|
150
176
|
* `POST /api/v1/cases/:id/transition` — the business moves a case:
|
|
151
177
|
* `accepted` / `rejected` from `submitted`, then the type's states,
|
|
152
178
|
* `completed` or `cancelled`. 400 (with the allowed states) otherwise.
|
|
179
|
+
* PDK-OFF-CATALOG: moving to a confirmed state (`confirmed`, ready, out for delivery, `completed`) is refused with
|
|
180
|
+
* 400 `code: 'lines_pending'` while a free line is still pending (`offCatalog.pendingCount > 0`): confirm them
|
|
181
|
+
* first. `cancelled` / `rejected` stay allowed.
|
|
153
182
|
*/
|
|
154
183
|
async transition(caseId, state, opts = {}) {
|
|
155
184
|
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/transition`, {
|
package/dist/types.d.ts
CHANGED
|
@@ -727,6 +727,11 @@ export interface TeamSummary {
|
|
|
727
727
|
orchestrationMode: 'flat' | 'hierarchical';
|
|
728
728
|
/** AGF-CASES. What customers come for in the team's conversations. */
|
|
729
729
|
caseTypes?: CaseType[];
|
|
730
|
+
/** PDK-OFF-CATALOG — whether this business's assistant may add products that are not in the catalog to an order (`case_add_free_line`). Absent: no. */
|
|
731
|
+
offCatalog?: {
|
|
732
|
+
enabled: boolean;
|
|
733
|
+
maxLines: number;
|
|
734
|
+
};
|
|
730
735
|
[field: string]: unknown;
|
|
731
736
|
}
|
|
732
737
|
/** `PATCH /api/v1/teams/:id` body — only the fields sent change. */
|
|
@@ -758,6 +763,16 @@ export interface UpdateTeamInput {
|
|
|
758
763
|
* assistants open, fill and submit cases of these types. Validated by the
|
|
759
764
|
* platform; `null` or `[]` clears them (no cases). */
|
|
760
765
|
caseTypes?: CaseType[] | null;
|
|
766
|
+
/**
|
|
767
|
+
* PDK-OFF-CATALOG — the App's opt-in for this business: may its assistant add products that are not in the
|
|
768
|
+
* catalog to an order («comodín» lines)? `{ enabled: true, maxLines? }` (maxLines 1–50, default 15) turns on the
|
|
769
|
+
* `case_add_free_line` tool for the team's assistants; `{ enabled: false }` or `null` turns it off (the default).
|
|
770
|
+
* Orders already holding free lines keep them. A bad value is a 400.
|
|
771
|
+
*/
|
|
772
|
+
offCatalog?: {
|
|
773
|
+
enabled: boolean;
|
|
774
|
+
maxLines?: number;
|
|
775
|
+
} | null;
|
|
761
776
|
}
|
|
762
777
|
/** A team's weekly opening hours (AGF-HOURS). */
|
|
763
778
|
export interface TeamBusinessHours {
|
|
@@ -773,15 +788,24 @@ export interface TeamBusinessHours {
|
|
|
773
788
|
}>;
|
|
774
789
|
}
|
|
775
790
|
export type TeamWeekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
|
|
776
|
-
/**
|
|
791
|
+
/**
|
|
792
|
+
* A color that may differ per mode: a hex string (`#rgb` / `#rrggbb`, the same
|
|
793
|
+
* in light and dark) or `{ light?, dark? }` (each face hex). The server
|
|
794
|
+
* rejects an invalid face with 400 on the API-key path.
|
|
795
|
+
*/
|
|
796
|
+
export type ThemedColor = string | {
|
|
797
|
+
light?: string;
|
|
798
|
+
dark?: string;
|
|
799
|
+
};
|
|
800
|
+
/** A team's public-page theme (`af_teams.theme`). Colors are `ThemedColor`: hex, or per-mode `{ light, dark }`. */
|
|
777
801
|
export interface TeamTheme {
|
|
778
802
|
logoUrl?: string;
|
|
779
803
|
bannerUrl?: string;
|
|
780
|
-
primaryColor?:
|
|
781
|
-
accentColor?:
|
|
782
|
-
headerBg?:
|
|
783
|
-
surfaceBg?:
|
|
784
|
-
surfaceFg?:
|
|
804
|
+
primaryColor?: ThemedColor;
|
|
805
|
+
accentColor?: ThemedColor;
|
|
806
|
+
headerBg?: ThemedColor;
|
|
807
|
+
surfaceBg?: ThemedColor;
|
|
808
|
+
surfaceFg?: ThemedColor;
|
|
785
809
|
font?: 'inter' | 'geist' | 'dm-sans' | 'serif';
|
|
786
810
|
mode?: 'light' | 'dark' | 'auto';
|
|
787
811
|
personaName?: string;
|
|
@@ -789,14 +813,14 @@ export interface TeamTheme {
|
|
|
789
813
|
bio?: string;
|
|
790
814
|
greeting?: string;
|
|
791
815
|
shortcuts?: string[];
|
|
792
|
-
bubbleAgentBg?:
|
|
793
|
-
bubbleAgentFg?:
|
|
794
|
-
bubbleUserBg?:
|
|
795
|
-
bubbleUserFg?:
|
|
796
|
-
sendButtonBg?:
|
|
797
|
-
inputBg?:
|
|
798
|
-
inputFg?:
|
|
799
|
-
avatarBg?:
|
|
816
|
+
bubbleAgentBg?: ThemedColor;
|
|
817
|
+
bubbleAgentFg?: ThemedColor;
|
|
818
|
+
bubbleUserBg?: ThemedColor;
|
|
819
|
+
bubbleUserFg?: ThemedColor;
|
|
820
|
+
sendButtonBg?: ThemedColor;
|
|
821
|
+
inputBg?: ThemedColor;
|
|
822
|
+
inputFg?: ThemedColor;
|
|
823
|
+
avatarBg?: ThemedColor;
|
|
800
824
|
}
|
|
801
825
|
/**
|
|
802
826
|
* PDK-PAGE-BLOCKS — where a block is drawn. Absent = `inline` (every block saved before this existed).
|
|
@@ -2506,7 +2530,16 @@ export interface CaseView {
|
|
|
2506
2530
|
revision: number;
|
|
2507
2531
|
/** PDK-BUG-006 — every product line of the receipt is to go (`takeaway`). Absent/false on mixed or eat-here orders, older receipts and older platforms. */
|
|
2508
2532
|
allTakeaway?: boolean;
|
|
2533
|
+
/** The receipt's total (null: a line is pending or has no fixed price). */
|
|
2534
|
+
totalCents?: number | null;
|
|
2535
|
+
currency?: string | null;
|
|
2536
|
+
/** PDK-OFF-CATALOG — the lines that already have a price added up (delivery not included); present only on an order with free lines (absent on an older platform). */
|
|
2537
|
+
confirmedSubtotalCents?: number;
|
|
2538
|
+
/** PDK-OFF-CATALOG — how many free lines still wait for the business; the total is null while it is above 0. */
|
|
2539
|
+
pendingLines?: number;
|
|
2509
2540
|
} | null;
|
|
2541
|
+
/** PDK-OFF-CATALOG — the order's «comodín» lines (products asked for by name that are not in the catalog) and what is left to confirm; null/absent: none. */
|
|
2542
|
+
offCatalog?: CaseOffCatalogView | null;
|
|
2510
2543
|
/** What the customer asked after the business took the case (change, cancel), until the business moves it. */
|
|
2511
2544
|
customerRequest: {
|
|
2512
2545
|
kind: 'change' | 'cancel';
|
|
@@ -2537,6 +2570,70 @@ export interface CaseView {
|
|
|
2537
2570
|
*/
|
|
2538
2571
|
history?: CaseStateStep[];
|
|
2539
2572
|
}
|
|
2573
|
+
/**
|
|
2574
|
+
* PDK-OFF-CATALOG — one product the customer asked for by name that is not in the catalog. It is `pending` until the
|
|
2575
|
+
* business confirms it (`cases.confirmLine`): then it has a price and unit, or it is `out`, or `swap`ped.
|
|
2576
|
+
*/
|
|
2577
|
+
export interface CaseOffCatalogLine {
|
|
2578
|
+
/** The receipt line's key (`off#1`, `off#2`…): what `cases.confirmLine` names. */
|
|
2579
|
+
key: string;
|
|
2580
|
+
title: string;
|
|
2581
|
+
qty: number;
|
|
2582
|
+
unit?: string;
|
|
2583
|
+
note?: string;
|
|
2584
|
+
/** What the CUSTOMER said the whole line costs (cents) — never a price the assistant set. */
|
|
2585
|
+
askedPriceCents?: number;
|
|
2586
|
+
by: 'assistant' | 'checkout';
|
|
2587
|
+
addedAt: string;
|
|
2588
|
+
pending: boolean;
|
|
2589
|
+
mark?: 'ready' | 'out' | 'swap';
|
|
2590
|
+
/** Price of one `unit`, set by the business. */
|
|
2591
|
+
unitPriceCents?: number;
|
|
2592
|
+
swapText?: string;
|
|
2593
|
+
/** The catalog product this line became (set by the business), when it has been linked. */
|
|
2594
|
+
productId?: string;
|
|
2595
|
+
/** A strong catalog match found when the assistant added it. */
|
|
2596
|
+
suggestedProductId?: string;
|
|
2597
|
+
confirmedBy?: string;
|
|
2598
|
+
confirmedAt?: string;
|
|
2599
|
+
}
|
|
2600
|
+
/** PDK-OFF-CATALOG — the free lines of an order as `CaseView.offCatalog` reads them. */
|
|
2601
|
+
export interface CaseOffCatalogView {
|
|
2602
|
+
maxLines: number;
|
|
2603
|
+
/** Free lines still waiting for the business; the order's total is null while it is above 0. */
|
|
2604
|
+
pendingCount: number;
|
|
2605
|
+
/** Every free line the customer did not drop. */
|
|
2606
|
+
lines: CaseOffCatalogLine[];
|
|
2607
|
+
}
|
|
2608
|
+
/** PDK-OFF-CATALOG — what `cases.confirmLine` sends: the business answers ONE free line. */
|
|
2609
|
+
export interface ConfirmCaseLineInput {
|
|
2610
|
+
/** The free line's key (`CaseOffCatalogLine.key`, e.g. `off#1`). */
|
|
2611
|
+
key: string;
|
|
2612
|
+
/** `ready`: it has it, at `unitPriceCents`; `swap`: it delivers `swapText` instead, at `unitPriceCents`; `out`: it does not have it. */
|
|
2613
|
+
mark: 'ready' | 'out' | 'swap';
|
|
2614
|
+
/** Price of ONE `unit`, whole cents, 0..1e9. Required for `ready` and `swap`; refused for `out`. */
|
|
2615
|
+
unitPriceCents?: number;
|
|
2616
|
+
/** What `qty` and `unitPriceCents` are in («lb», «unidad»); default: the unit the customer used. <= 20 chars. */
|
|
2617
|
+
unit?: string;
|
|
2618
|
+
/** Required with `swap` (<= 120 chars), refused otherwise. */
|
|
2619
|
+
swapText?: string;
|
|
2620
|
+
/** The catalog product this line is, when the business already added it to its inventory (an active product of this business). */
|
|
2621
|
+
productId?: string;
|
|
2622
|
+
/** Who of the business confirmed it (a member reference or name); default `business`. */
|
|
2623
|
+
confirmedBy?: string;
|
|
2624
|
+
}
|
|
2625
|
+
/** PDK-OFF-CATALOG — one free line of `CreateDirectOrderInput.offCatalogLines`. */
|
|
2626
|
+
export interface CreateOffCatalogLineInput {
|
|
2627
|
+
title: string;
|
|
2628
|
+
/** > 0, at most 3 decimals, <= 100000. */
|
|
2629
|
+
qty: number;
|
|
2630
|
+
unit?: string;
|
|
2631
|
+
note?: string;
|
|
2632
|
+
/** What the customer says the whole line costs (cents): the business sees it when it confirms the price. */
|
|
2633
|
+
askedPriceCents?: number;
|
|
2634
|
+
/** A counter sale's «producto sin registrar»: the line is created already confirmed at this price of one `unit` (cents). Without it the line is «por confirmar». */
|
|
2635
|
+
unitPriceCents?: number;
|
|
2636
|
+
}
|
|
2540
2637
|
/**
|
|
2541
2638
|
* The payment's own lifecycle, apart from the case's states: `unpaid` →
|
|
2542
2639
|
* `awaiting_payment` (method chosen) → `pending_confirmation` (the customer
|
|
@@ -2675,6 +2772,17 @@ export interface CaseReceiptLine {
|
|
|
2675
2772
|
out?: true;
|
|
2676
2773
|
swapText?: string;
|
|
2677
2774
|
note?: string;
|
|
2775
|
+
/**
|
|
2776
|
+
* PDK-OFF-CATALOG — a «comodín» line: asked for by name, not in the catalog (no `productId` until the business
|
|
2777
|
+
* links one). `pending`: the business has not confirmed its price or availability (`unitCents` is null and the
|
|
2778
|
+
* receipt's `totalCents` stays null: show «por confirmar»). `askedPriceCents`: what the customer said the whole line
|
|
2779
|
+
* costs. `confirmedBy` / `confirmedAt`: who of the business set its price, and when. Absent on an older platform.
|
|
2780
|
+
*/
|
|
2781
|
+
offCatalog?: true;
|
|
2782
|
+
pending?: true;
|
|
2783
|
+
askedPriceCents?: number;
|
|
2784
|
+
confirmedBy?: string;
|
|
2785
|
+
confirmedAt?: string;
|
|
2678
2786
|
}
|
|
2679
2787
|
/** One option group's choice on a proposed alternative: the group and what was picked in it (ids, or names). */
|
|
2680
2788
|
export interface CaseProposalSwapOption {
|
|
@@ -2689,8 +2797,14 @@ export interface CaseProposalChange {
|
|
|
2689
2797
|
qty: number;
|
|
2690
2798
|
/** What the line costs now; null when it has no fixed price. */
|
|
2691
2799
|
amountCents: number | null;
|
|
2692
|
-
|
|
2800
|
+
/** `price` (PDK-OFF-CATALOG): the business confirmed the price of a free line (`newAmountCents`). */
|
|
2801
|
+
kind: 'out' | 'swap' | 'price';
|
|
2802
|
+
/** PDK-OFF-CATALOG — what a confirmed free line costs (`price`). */
|
|
2803
|
+
newAmountCents?: number;
|
|
2804
|
+
/** PDK-OFF-CATALOG — what the customer said the whole line costs. */
|
|
2805
|
+
askedAmountCents?: number;
|
|
2693
2806
|
swap?: {
|
|
2807
|
+
/** '' for a free line's alternative (`free: true`): it is text, not a catalog product, unless the business linked one. */
|
|
2694
2808
|
productId: string;
|
|
2695
2809
|
title: string;
|
|
2696
2810
|
/** One unit, in cents; null when its price is not fixed. */
|
|
@@ -2703,6 +2817,8 @@ export interface CaseProposalChange {
|
|
|
2703
2817
|
options?: CaseProposalSwapOption[];
|
|
2704
2818
|
/** The choice as the customer reads it («Arroz, Sin cebolla»). */
|
|
2705
2819
|
optionsLabel?: string;
|
|
2820
|
+
/** PDK-OFF-CATALOG — the alternative of a free line: text (`title`), not a catalog product. */
|
|
2821
|
+
free?: true;
|
|
2706
2822
|
};
|
|
2707
2823
|
/** The answer to an alternative (an out-of-stock line is always `drop`); absent while pending. */
|
|
2708
2824
|
answer?: 'keep' | 'drop';
|
|
@@ -2726,6 +2842,15 @@ export interface CaseProposal {
|
|
|
2726
2842
|
/** The total if every alternative is kept (once answered: with what was kept); null when it cannot be said. */
|
|
2727
2843
|
totalAfterCents: number | null;
|
|
2728
2844
|
currency: string | null;
|
|
2845
|
+
/** PDK-OFF-CATALOG — made by the business confirming free lines (`cases.confirmLine`), not proposed by hand. */
|
|
2846
|
+
offCatalog?: true;
|
|
2847
|
+
/** PDK-OFF-CATALOG — the customer MUST answer (a line is out or swapped, or its amount is over what they said × 1.2); payment waits for it. */
|
|
2848
|
+
requiresAnswer?: boolean;
|
|
2849
|
+
/**
|
|
2850
|
+
* PDK-OFF-CATALOG — without `requiresAnswer`: silence accepts the confirmation from this instant (ISO, 10 minutes after
|
|
2851
|
+
* it was sent). The platform does not run a timer: the host App answers `cases.answerProposal(id, 'all')` when it passes.
|
|
2852
|
+
*/
|
|
2853
|
+
autoAcceptAt?: string;
|
|
2729
2854
|
}
|
|
2730
2855
|
/** What `cases.propose` sends: each change names a receipt line by its `key`. */
|
|
2731
2856
|
export interface CaseProposalInput {
|
|
@@ -2776,6 +2901,10 @@ export interface CaseReceipt {
|
|
|
2776
2901
|
/** PDK-ORDER-INVITE — an open order's `totalCents` was typed by the business (some line had no price): it is final, delivery included. Absent when the total is the sum of fixed prices (PDK-ORDER-PRICES). */
|
|
2777
2902
|
totalManual?: true;
|
|
2778
2903
|
currency: string | null;
|
|
2904
|
+
/** PDK-OFF-CATALOG — the sum of the lines that already have a price (delivery not included): «$X + N por confirmar» while `totalCents` is null. Present only with free lines. */
|
|
2905
|
+
confirmedSubtotalCents?: number;
|
|
2906
|
+
/** PDK-OFF-CATALOG — free lines still waiting for the business (`totalCents` is null while it is above 0). */
|
|
2907
|
+
pendingLines?: number;
|
|
2779
2908
|
fields: Array<{
|
|
2780
2909
|
label: string;
|
|
2781
2910
|
value: string;
|
|
@@ -2855,6 +2984,19 @@ export interface CreateDirectOrderInput {
|
|
|
2855
2984
|
};
|
|
2856
2985
|
/** AGF-ORDER-ORIGIN-POS — where it comes from; default `{ channel: 'page' }`. A `pos` sale needs `place` and `by`. */
|
|
2857
2986
|
origin?: CaseOrigin;
|
|
2987
|
+
/**
|
|
2988
|
+
* PDK-OFF-CATALOG — explicit opt-in (per business, decided by your App): the order may carry products that are not in
|
|
2989
|
+
* the catalog (`offCatalogLines`) for ANY origin. Without it `offCatalogLines` is a 400 and nothing changes.
|
|
2990
|
+
*/
|
|
2991
|
+
allowOffCatalog?: true;
|
|
2992
|
+
/** PDK-OFF-CATALOG — the most free lines this order takes (1–50, default 15). Needs `allowOffCatalog`. */
|
|
2993
|
+
maxOffCatalogLines?: number;
|
|
2994
|
+
/**
|
|
2995
|
+
* PDK-OFF-CATALOG — products asked for by name that are not in the catalog («comodín» lines). They are `pending`
|
|
2996
|
+
* («por confirmar») until the business confirms each one with `cases.confirmLine`; the receipt's `totalCents` is null
|
|
2997
|
+
* until then and nothing can be paid. `lines` may be `[]` when this has items. Needs `allowOffCatalog`.
|
|
2998
|
+
*/
|
|
2999
|
+
offCatalogLines?: CreateOffCatalogLineInput[];
|
|
2858
3000
|
/** Products of the business's catalog and how many of each. `options`: the choice for a
|
|
2859
3001
|
* product with option groups (AGF-MENU-OPTIONS M2; a required group left out → 400). */
|
|
2860
3002
|
lines: Array<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.85.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",
|