@agentforge-io/sdk-server 4.83.0 → 4.84.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 +134 -1
- 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, 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 {
|
|
@@ -2506,7 +2521,16 @@ export interface CaseView {
|
|
|
2506
2521
|
revision: number;
|
|
2507
2522
|
/** 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
2523
|
allTakeaway?: boolean;
|
|
2524
|
+
/** The receipt's total (null: a line is pending or has no fixed price). */
|
|
2525
|
+
totalCents?: number | null;
|
|
2526
|
+
currency?: string | null;
|
|
2527
|
+
/** 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). */
|
|
2528
|
+
confirmedSubtotalCents?: number;
|
|
2529
|
+
/** PDK-OFF-CATALOG — how many free lines still wait for the business; the total is null while it is above 0. */
|
|
2530
|
+
pendingLines?: number;
|
|
2509
2531
|
} | null;
|
|
2532
|
+
/** 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. */
|
|
2533
|
+
offCatalog?: CaseOffCatalogView | null;
|
|
2510
2534
|
/** What the customer asked after the business took the case (change, cancel), until the business moves it. */
|
|
2511
2535
|
customerRequest: {
|
|
2512
2536
|
kind: 'change' | 'cancel';
|
|
@@ -2537,6 +2561,70 @@ export interface CaseView {
|
|
|
2537
2561
|
*/
|
|
2538
2562
|
history?: CaseStateStep[];
|
|
2539
2563
|
}
|
|
2564
|
+
/**
|
|
2565
|
+
* PDK-OFF-CATALOG — one product the customer asked for by name that is not in the catalog. It is `pending` until the
|
|
2566
|
+
* business confirms it (`cases.confirmLine`): then it has a price and unit, or it is `out`, or `swap`ped.
|
|
2567
|
+
*/
|
|
2568
|
+
export interface CaseOffCatalogLine {
|
|
2569
|
+
/** The receipt line's key (`off#1`, `off#2`…): what `cases.confirmLine` names. */
|
|
2570
|
+
key: string;
|
|
2571
|
+
title: string;
|
|
2572
|
+
qty: number;
|
|
2573
|
+
unit?: string;
|
|
2574
|
+
note?: string;
|
|
2575
|
+
/** What the CUSTOMER said the whole line costs (cents) — never a price the assistant set. */
|
|
2576
|
+
askedPriceCents?: number;
|
|
2577
|
+
by: 'assistant' | 'checkout';
|
|
2578
|
+
addedAt: string;
|
|
2579
|
+
pending: boolean;
|
|
2580
|
+
mark?: 'ready' | 'out' | 'swap';
|
|
2581
|
+
/** Price of one `unit`, set by the business. */
|
|
2582
|
+
unitPriceCents?: number;
|
|
2583
|
+
swapText?: string;
|
|
2584
|
+
/** The catalog product this line became (set by the business), when it has been linked. */
|
|
2585
|
+
productId?: string;
|
|
2586
|
+
/** A strong catalog match found when the assistant added it. */
|
|
2587
|
+
suggestedProductId?: string;
|
|
2588
|
+
confirmedBy?: string;
|
|
2589
|
+
confirmedAt?: string;
|
|
2590
|
+
}
|
|
2591
|
+
/** PDK-OFF-CATALOG — the free lines of an order as `CaseView.offCatalog` reads them. */
|
|
2592
|
+
export interface CaseOffCatalogView {
|
|
2593
|
+
maxLines: number;
|
|
2594
|
+
/** Free lines still waiting for the business; the order's total is null while it is above 0. */
|
|
2595
|
+
pendingCount: number;
|
|
2596
|
+
/** Every free line the customer did not drop. */
|
|
2597
|
+
lines: CaseOffCatalogLine[];
|
|
2598
|
+
}
|
|
2599
|
+
/** PDK-OFF-CATALOG — what `cases.confirmLine` sends: the business answers ONE free line. */
|
|
2600
|
+
export interface ConfirmCaseLineInput {
|
|
2601
|
+
/** The free line's key (`CaseOffCatalogLine.key`, e.g. `off#1`). */
|
|
2602
|
+
key: string;
|
|
2603
|
+
/** `ready`: it has it, at `unitPriceCents`; `swap`: it delivers `swapText` instead, at `unitPriceCents`; `out`: it does not have it. */
|
|
2604
|
+
mark: 'ready' | 'out' | 'swap';
|
|
2605
|
+
/** Price of ONE `unit`, whole cents, 0..1e9. Required for `ready` and `swap`; refused for `out`. */
|
|
2606
|
+
unitPriceCents?: number;
|
|
2607
|
+
/** What `qty` and `unitPriceCents` are in («lb», «unidad»); default: the unit the customer used. <= 20 chars. */
|
|
2608
|
+
unit?: string;
|
|
2609
|
+
/** Required with `swap` (<= 120 chars), refused otherwise. */
|
|
2610
|
+
swapText?: string;
|
|
2611
|
+
/** The catalog product this line is, when the business already added it to its inventory (an active product of this business). */
|
|
2612
|
+
productId?: string;
|
|
2613
|
+
/** Who of the business confirmed it (a member reference or name); default `business`. */
|
|
2614
|
+
confirmedBy?: string;
|
|
2615
|
+
}
|
|
2616
|
+
/** PDK-OFF-CATALOG — one free line of `CreateDirectOrderInput.offCatalogLines`. */
|
|
2617
|
+
export interface CreateOffCatalogLineInput {
|
|
2618
|
+
title: string;
|
|
2619
|
+
/** > 0, at most 3 decimals, <= 100000. */
|
|
2620
|
+
qty: number;
|
|
2621
|
+
unit?: string;
|
|
2622
|
+
note?: string;
|
|
2623
|
+
/** What the customer says the whole line costs (cents): the business sees it when it confirms the price. */
|
|
2624
|
+
askedPriceCents?: number;
|
|
2625
|
+
/** 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». */
|
|
2626
|
+
unitPriceCents?: number;
|
|
2627
|
+
}
|
|
2540
2628
|
/**
|
|
2541
2629
|
* The payment's own lifecycle, apart from the case's states: `unpaid` →
|
|
2542
2630
|
* `awaiting_payment` (method chosen) → `pending_confirmation` (the customer
|
|
@@ -2675,6 +2763,17 @@ export interface CaseReceiptLine {
|
|
|
2675
2763
|
out?: true;
|
|
2676
2764
|
swapText?: string;
|
|
2677
2765
|
note?: string;
|
|
2766
|
+
/**
|
|
2767
|
+
* PDK-OFF-CATALOG — a «comodín» line: asked for by name, not in the catalog (no `productId` until the business
|
|
2768
|
+
* links one). `pending`: the business has not confirmed its price or availability (`unitCents` is null and the
|
|
2769
|
+
* receipt's `totalCents` stays null: show «por confirmar»). `askedPriceCents`: what the customer said the whole line
|
|
2770
|
+
* costs. `confirmedBy` / `confirmedAt`: who of the business set its price, and when. Absent on an older platform.
|
|
2771
|
+
*/
|
|
2772
|
+
offCatalog?: true;
|
|
2773
|
+
pending?: true;
|
|
2774
|
+
askedPriceCents?: number;
|
|
2775
|
+
confirmedBy?: string;
|
|
2776
|
+
confirmedAt?: string;
|
|
2678
2777
|
}
|
|
2679
2778
|
/** One option group's choice on a proposed alternative: the group and what was picked in it (ids, or names). */
|
|
2680
2779
|
export interface CaseProposalSwapOption {
|
|
@@ -2689,8 +2788,14 @@ export interface CaseProposalChange {
|
|
|
2689
2788
|
qty: number;
|
|
2690
2789
|
/** What the line costs now; null when it has no fixed price. */
|
|
2691
2790
|
amountCents: number | null;
|
|
2692
|
-
|
|
2791
|
+
/** `price` (PDK-OFF-CATALOG): the business confirmed the price of a free line (`newAmountCents`). */
|
|
2792
|
+
kind: 'out' | 'swap' | 'price';
|
|
2793
|
+
/** PDK-OFF-CATALOG — what a confirmed free line costs (`price`). */
|
|
2794
|
+
newAmountCents?: number;
|
|
2795
|
+
/** PDK-OFF-CATALOG — what the customer said the whole line costs. */
|
|
2796
|
+
askedAmountCents?: number;
|
|
2693
2797
|
swap?: {
|
|
2798
|
+
/** '' for a free line's alternative (`free: true`): it is text, not a catalog product, unless the business linked one. */
|
|
2694
2799
|
productId: string;
|
|
2695
2800
|
title: string;
|
|
2696
2801
|
/** One unit, in cents; null when its price is not fixed. */
|
|
@@ -2703,6 +2808,8 @@ export interface CaseProposalChange {
|
|
|
2703
2808
|
options?: CaseProposalSwapOption[];
|
|
2704
2809
|
/** The choice as the customer reads it («Arroz, Sin cebolla»). */
|
|
2705
2810
|
optionsLabel?: string;
|
|
2811
|
+
/** PDK-OFF-CATALOG — the alternative of a free line: text (`title`), not a catalog product. */
|
|
2812
|
+
free?: true;
|
|
2706
2813
|
};
|
|
2707
2814
|
/** The answer to an alternative (an out-of-stock line is always `drop`); absent while pending. */
|
|
2708
2815
|
answer?: 'keep' | 'drop';
|
|
@@ -2726,6 +2833,15 @@ export interface CaseProposal {
|
|
|
2726
2833
|
/** The total if every alternative is kept (once answered: with what was kept); null when it cannot be said. */
|
|
2727
2834
|
totalAfterCents: number | null;
|
|
2728
2835
|
currency: string | null;
|
|
2836
|
+
/** PDK-OFF-CATALOG — made by the business confirming free lines (`cases.confirmLine`), not proposed by hand. */
|
|
2837
|
+
offCatalog?: true;
|
|
2838
|
+
/** 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. */
|
|
2839
|
+
requiresAnswer?: boolean;
|
|
2840
|
+
/**
|
|
2841
|
+
* PDK-OFF-CATALOG — without `requiresAnswer`: silence accepts the confirmation from this instant (ISO, 10 minutes after
|
|
2842
|
+
* it was sent). The platform does not run a timer: the host App answers `cases.answerProposal(id, 'all')` when it passes.
|
|
2843
|
+
*/
|
|
2844
|
+
autoAcceptAt?: string;
|
|
2729
2845
|
}
|
|
2730
2846
|
/** What `cases.propose` sends: each change names a receipt line by its `key`. */
|
|
2731
2847
|
export interface CaseProposalInput {
|
|
@@ -2776,6 +2892,10 @@ export interface CaseReceipt {
|
|
|
2776
2892
|
/** 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
2893
|
totalManual?: true;
|
|
2778
2894
|
currency: string | null;
|
|
2895
|
+
/** 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. */
|
|
2896
|
+
confirmedSubtotalCents?: number;
|
|
2897
|
+
/** PDK-OFF-CATALOG — free lines still waiting for the business (`totalCents` is null while it is above 0). */
|
|
2898
|
+
pendingLines?: number;
|
|
2779
2899
|
fields: Array<{
|
|
2780
2900
|
label: string;
|
|
2781
2901
|
value: string;
|
|
@@ -2855,6 +2975,19 @@ export interface CreateDirectOrderInput {
|
|
|
2855
2975
|
};
|
|
2856
2976
|
/** AGF-ORDER-ORIGIN-POS — where it comes from; default `{ channel: 'page' }`. A `pos` sale needs `place` and `by`. */
|
|
2857
2977
|
origin?: CaseOrigin;
|
|
2978
|
+
/**
|
|
2979
|
+
* PDK-OFF-CATALOG — explicit opt-in (per business, decided by your App): the order may carry products that are not in
|
|
2980
|
+
* the catalog (`offCatalogLines`) for ANY origin. Without it `offCatalogLines` is a 400 and nothing changes.
|
|
2981
|
+
*/
|
|
2982
|
+
allowOffCatalog?: true;
|
|
2983
|
+
/** PDK-OFF-CATALOG — the most free lines this order takes (1–50, default 15). Needs `allowOffCatalog`. */
|
|
2984
|
+
maxOffCatalogLines?: number;
|
|
2985
|
+
/**
|
|
2986
|
+
* PDK-OFF-CATALOG — products asked for by name that are not in the catalog («comodín» lines). They are `pending`
|
|
2987
|
+
* («por confirmar») until the business confirms each one with `cases.confirmLine`; the receipt's `totalCents` is null
|
|
2988
|
+
* until then and nothing can be paid. `lines` may be `[]` when this has items. Needs `allowOffCatalog`.
|
|
2989
|
+
*/
|
|
2990
|
+
offCatalogLines?: CreateOffCatalogLineInput[];
|
|
2858
2991
|
/** Products of the business's catalog and how many of each. `options`: the choice for a
|
|
2859
2992
|
* product with option groups (AGF-MENU-OPTIONS M2; a required group left out → 400). */
|
|
2860
2993
|
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.84.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",
|