@agentforge-io/sdk-server 4.89.0 → 4.90.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 +44 -1
- package/dist/resources/cases.js +48 -0
- package/dist/types.d.ts +103 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { BillingResource } from './resources/billing';
|
|
|
9
9
|
export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
|
|
10
10
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
11
11
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
12
|
-
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, SetSystemAppProfileResult, SystemAppProfileView, 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, SetCaseLinePriceInput, CaseLinePrices, CaseLinePriceEntry, CaseLinePriceHistoryEntry, CaseLinePriceSet, CaseLinePriceActor, CaseLinePriceBreakdownItem, 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
|
+
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, SetSystemAppProfileResult, SystemAppProfileView, 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, SetCaseLinePriceInput, CaseLinePrices, CaseChangeInput, CaseChangeKind, CaseChangeLine, CaseChangeReason, CasePendingChange, CaseLinePriceEntry, CaseLinePriceHistoryEntry, CaseLinePriceSet, CaseLinePriceActor, CaseLinePriceBreakdownItem, 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';
|
|
13
13
|
export { AgentsResource } from './resources/agents';
|
|
14
14
|
export { AnalyticsResource } from './resources/analytics';
|
|
15
15
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateDirectRentalInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetCaseLinePriceInput, SetOnAccountInput, SetOnAccountResult, UpdateCaseRentalInput } from '../types';
|
|
2
|
+
import type { CaseAccount, CaseChangeInput, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateDirectRentalInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetCaseLinePriceInput, SetOnAccountInput, SetOnAccountResult, UpdateCaseRentalInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -130,6 +130,49 @@ export declare class CasesResource {
|
|
|
130
130
|
*/
|
|
131
131
|
receiptReopen(token: string): Promise<CaseReceipt>;
|
|
132
132
|
receiptRedoProposal(token: string): Promise<CaseReceipt>;
|
|
133
|
+
/**
|
|
134
|
+
* `POST /api/v1/cases/receipts/:token/change` — PDK-SERVICE-CHANGES S3: the customer asks to change their request
|
|
135
|
+
* (replaces `receiptReopen` for the new flow). The change is kept APART (`pendingChange`): the case keeps its state, holds,
|
|
136
|
+
* payment and progress until the business answers (`answerChange`); nothing is held or charged before. It is validated like a
|
|
137
|
+
* direct order (products exist and are sellable, options, the booking's/rental's shape) and priced — `pendingChange.previewTotalCents`
|
|
138
|
+
* (line prices, rental rates, delivery) — so you can show the new total. One at a time: a new request replaces the pending one.
|
|
139
|
+
*
|
|
140
|
+
* Read `receipt.changeAllowed` / `changeReason` / `changeKind` / `changeUntil` / `pendingChange` first to render the right form:
|
|
141
|
+
* `items` (the cart: send the FULL new `lines`), `service` (answers + address), `booking` (`slot`), `rental` (`rental`, and `lines`
|
|
142
|
+
* for the units), `mixed`. Rules per kind (409 with `code`): `change_window_closed` — products until confirmed, a quote until the
|
|
143
|
+
* customer accepted a price, a service until it is in progress, a booking/rental until `changeWindowHours` (type setting, default 24)
|
|
144
|
+
* before it starts —; `case_closed`; `case_not_sent`; `change_pending` (a change from the business waits); `not_enough_stock`.
|
|
145
|
+
* 400 on a bad body (`code: 'invalid_change' | 'empty_change' | 'product_not_available' | 'not_a_booking' | 'not_a_rental' …`).
|
|
146
|
+
* You own availability of a booking's time / a rental's range: check it before sending. Returns the receipt.
|
|
147
|
+
*/
|
|
148
|
+
receiptRequestChange(token: string, input: CaseChangeInput): Promise<CaseReceipt>;
|
|
149
|
+
/**
|
|
150
|
+
* `DELETE /api/v1/cases/receipts/:token/change` — the customer takes their pending change back (or leaves without sending: the
|
|
151
|
+
* case was never touched, so nothing needs undoing). 409 `no_pending_change`, or `change_pending` when the change is the business's.
|
|
152
|
+
*/
|
|
153
|
+
receiptWithdrawChange(token: string): Promise<CaseReceipt>;
|
|
154
|
+
/**
|
|
155
|
+
* `POST /api/v1/cases/:id/change` — PDK-SERVICE-CHANGES S3: the App asks a change on behalf of the customer (the same body as
|
|
156
|
+
* `receiptRequestChange`). It is kept apart (`pendingChange.by: 'business'`) until `answerChange`; the business is not held to
|
|
157
|
+
* the customer's window (a closed case still answers 409). Returns the case.
|
|
158
|
+
*/
|
|
159
|
+
requestChange(caseId: string, input: CaseChangeInput): Promise<CaseView>;
|
|
160
|
+
/**
|
|
161
|
+
* `POST /api/v1/cases/:id/change/answer` — the business answers the pending change.
|
|
162
|
+
*
|
|
163
|
+
* `accept: true` applies it in one go: the lines' holds are swapped (old released, new taken, discounted too when the business
|
|
164
|
+
* already took the order — a stock failure answers 409 `not_enough_stock` and leaves the case exactly as it was, still pending),
|
|
165
|
+
* the answers/address/time/range are replaced, line prices follow the lines that survive (a removed line's price is unset, its
|
|
166
|
+
* history kept as `outcome: 'removed'`), and the receipt is re-issued (revision + 1). The payment is kept; when the total moved
|
|
167
|
+
* after it was reported or made, `payment.differenceCents` says what is still owed (+) or given back (−) until the business
|
|
168
|
+
* settles it. The case state is NOT reset (no `submitted` again) and its progress stays. A price quote waiting is withdrawn.
|
|
169
|
+
* `accept: false` discards it and tells the customer (`note` goes with it). Emits `case.change` (`accepted` / `rejected`).
|
|
170
|
+
* 409 `no_pending_change`. Returns the case.
|
|
171
|
+
*/
|
|
172
|
+
answerChange(caseId: string, input: {
|
|
173
|
+
accept: boolean;
|
|
174
|
+
note?: string;
|
|
175
|
+
}): Promise<CaseView>;
|
|
133
176
|
/**
|
|
134
177
|
* `POST /api/v1/cases/receipts/:token/cancel` — «Cancelar pedido»: the customer cancels from
|
|
135
178
|
* the receipt while the order is a draft (sent, accepted, being prepared or redone, changes
|
package/dist/resources/cases.js
CHANGED
|
@@ -188,6 +188,54 @@ class CasesResource {
|
|
|
188
188
|
async receiptRedoProposal(token) {
|
|
189
189
|
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/proposal/redo`, {});
|
|
190
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* `POST /api/v1/cases/receipts/:token/change` — PDK-SERVICE-CHANGES S3: the customer asks to change their request
|
|
193
|
+
* (replaces `receiptReopen` for the new flow). The change is kept APART (`pendingChange`): the case keeps its state, holds,
|
|
194
|
+
* payment and progress until the business answers (`answerChange`); nothing is held or charged before. It is validated like a
|
|
195
|
+
* direct order (products exist and are sellable, options, the booking's/rental's shape) and priced — `pendingChange.previewTotalCents`
|
|
196
|
+
* (line prices, rental rates, delivery) — so you can show the new total. One at a time: a new request replaces the pending one.
|
|
197
|
+
*
|
|
198
|
+
* Read `receipt.changeAllowed` / `changeReason` / `changeKind` / `changeUntil` / `pendingChange` first to render the right form:
|
|
199
|
+
* `items` (the cart: send the FULL new `lines`), `service` (answers + address), `booking` (`slot`), `rental` (`rental`, and `lines`
|
|
200
|
+
* for the units), `mixed`. Rules per kind (409 with `code`): `change_window_closed` — products until confirmed, a quote until the
|
|
201
|
+
* customer accepted a price, a service until it is in progress, a booking/rental until `changeWindowHours` (type setting, default 24)
|
|
202
|
+
* before it starts —; `case_closed`; `case_not_sent`; `change_pending` (a change from the business waits); `not_enough_stock`.
|
|
203
|
+
* 400 on a bad body (`code: 'invalid_change' | 'empty_change' | 'product_not_available' | 'not_a_booking' | 'not_a_rental' …`).
|
|
204
|
+
* You own availability of a booking's time / a rental's range: check it before sending. Returns the receipt.
|
|
205
|
+
*/
|
|
206
|
+
async receiptRequestChange(token, input) {
|
|
207
|
+
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/change`, input);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* `DELETE /api/v1/cases/receipts/:token/change` — the customer takes their pending change back (or leaves without sending: the
|
|
211
|
+
* case was never touched, so nothing needs undoing). 409 `no_pending_change`, or `change_pending` when the change is the business's.
|
|
212
|
+
*/
|
|
213
|
+
async receiptWithdrawChange(token) {
|
|
214
|
+
return this.client.request('DELETE', `/api/v1/cases/receipts/${encodeURIComponent(token)}/change`);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* `POST /api/v1/cases/:id/change` — PDK-SERVICE-CHANGES S3: the App asks a change on behalf of the customer (the same body as
|
|
218
|
+
* `receiptRequestChange`). It is kept apart (`pendingChange.by: 'business'`) until `answerChange`; the business is not held to
|
|
219
|
+
* the customer's window (a closed case still answers 409). Returns the case.
|
|
220
|
+
*/
|
|
221
|
+
async requestChange(caseId, input) {
|
|
222
|
+
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/change`, input);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* `POST /api/v1/cases/:id/change/answer` — the business answers the pending change.
|
|
226
|
+
*
|
|
227
|
+
* `accept: true` applies it in one go: the lines' holds are swapped (old released, new taken, discounted too when the business
|
|
228
|
+
* already took the order — a stock failure answers 409 `not_enough_stock` and leaves the case exactly as it was, still pending),
|
|
229
|
+
* the answers/address/time/range are replaced, line prices follow the lines that survive (a removed line's price is unset, its
|
|
230
|
+
* history kept as `outcome: 'removed'`), and the receipt is re-issued (revision + 1). The payment is kept; when the total moved
|
|
231
|
+
* after it was reported or made, `payment.differenceCents` says what is still owed (+) or given back (−) until the business
|
|
232
|
+
* settles it. The case state is NOT reset (no `submitted` again) and its progress stays. A price quote waiting is withdrawn.
|
|
233
|
+
* `accept: false` discards it and tells the customer (`note` goes with it). Emits `case.change` (`accepted` / `rejected`).
|
|
234
|
+
* 409 `no_pending_change`. Returns the case.
|
|
235
|
+
*/
|
|
236
|
+
async answerChange(caseId, input) {
|
|
237
|
+
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/change/answer`, { accept: input.accept, ...(input.note ? { note: input.note } : {}) });
|
|
238
|
+
}
|
|
191
239
|
/**
|
|
192
240
|
* `POST /api/v1/cases/receipts/:token/cancel` — «Cancelar pedido»: the customer cancels from
|
|
193
241
|
* the receipt while the order is a draft (sent, accepted, being prepared or redone, changes
|
package/dist/types.d.ts
CHANGED
|
@@ -2426,6 +2426,11 @@ export interface CaseType {
|
|
|
2426
2426
|
tools?: string[];
|
|
2427
2427
|
/** Business states after `accepted`, in order. */
|
|
2428
2428
|
states?: CaseBusinessState[];
|
|
2429
|
+
/**
|
|
2430
|
+
* PDK-SERVICE-CHANGES S3 — a booking or a rental can be changed by the customer (`cases.receiptRequestChange`) until this many
|
|
2431
|
+
* hours before it starts. Absent: 24. 0 = until it starts. A whole number 0–720.
|
|
2432
|
+
*/
|
|
2433
|
+
changeWindowHours?: number;
|
|
2429
2434
|
/** false: the case completes when the customer confirms (nothing for the business to act on). Default true. */
|
|
2430
2435
|
needsBusiness?: boolean;
|
|
2431
2436
|
/** Minutes without a customer message before an unfinished case is abandoned. Default 120. */
|
|
@@ -2556,6 +2561,15 @@ export interface CaseView {
|
|
|
2556
2561
|
} | null;
|
|
2557
2562
|
/** PDK-SERVICE-CHANGES — the prices the business set for lines of this request, by receipt line `key`, with their history; null/absent: none. */
|
|
2558
2563
|
linePrices?: CaseLinePrices | null;
|
|
2564
|
+
/** PDK-SERVICE-CHANGES S3 — the customer may ask a change now (`cases.receiptRequestChange`); `changeReason` says why not. Absent on an older platform. */
|
|
2565
|
+
changeAllowed?: boolean;
|
|
2566
|
+
changeReason?: CaseChangeReason;
|
|
2567
|
+
/** Which form the change needs: products (`items`), a `service`, a `booking`'s time, a `rental`'s range, or `mixed` (products and services). */
|
|
2568
|
+
changeKind?: CaseChangeKind;
|
|
2569
|
+
/** A booking or a rental: the last instant a change can still be asked (ISO). */
|
|
2570
|
+
changeUntil?: string;
|
|
2571
|
+
/** The change asked and waiting for the business (`cases.answerChange`); null/absent: none. */
|
|
2572
|
+
pendingChange?: CasePendingChange | null;
|
|
2559
2573
|
/** 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. */
|
|
2560
2574
|
offCatalog?: CaseOffCatalogView | null;
|
|
2561
2575
|
/** What the customer asked after the business took the case (change, cancel), until the business moves it. */
|
|
@@ -2710,6 +2724,11 @@ export interface CasePayment {
|
|
|
2710
2724
|
chosenAt?: 'checkout' | 'chat' | 'receipt';
|
|
2711
2725
|
/** The order ended undone after the customer reported (or the business confirmed) the payment: check it and refund. */
|
|
2712
2726
|
refundDue?: boolean;
|
|
2727
|
+
/**
|
|
2728
|
+
* PDK-SERVICE-CHANGES S3 — an accepted change request moved the total AFTER the payment was reported or made: what the customer still
|
|
2729
|
+
* owes (positive) or the business owes back (negative), in cents, summed over every such change. Settling the payment (any business move) clears it.
|
|
2730
|
+
*/
|
|
2731
|
+
differenceCents?: number;
|
|
2713
2732
|
/**
|
|
2714
2733
|
* PDK-STORE-CREDIT — `paid` because the customer account's abonos covered the order's fiado (money counted abono by
|
|
2715
2734
|
* abono, never on the order). Absent otherwise and on an older platform; cleared when it goes back on account.
|
|
@@ -2751,6 +2770,8 @@ export interface CaseReceiptPayment {
|
|
|
2751
2770
|
changeCents?: number | null;
|
|
2752
2771
|
/** The order ended undone after the customer reported or paid: the business gives the money back. */
|
|
2753
2772
|
refundDue?: boolean;
|
|
2773
|
+
/** PDK-SERVICE-CHANGES S3 — what is still owed (+) or given back (−) after an accepted change moved the total; null/absent: nothing. */
|
|
2774
|
+
differenceCents?: number | null;
|
|
2754
2775
|
}
|
|
2755
2776
|
/** AGF-CASE-RECEIPT — one product line, with the price it had when the receipt was issued. */
|
|
2756
2777
|
export interface CaseReceiptLine {
|
|
@@ -2851,8 +2872,8 @@ export interface CaseLinePriceHistoryEntry {
|
|
|
2851
2872
|
by: CaseLinePriceActor;
|
|
2852
2873
|
at: string;
|
|
2853
2874
|
note?: string;
|
|
2854
|
-
/** `applied` (default) or `
|
|
2855
|
-
outcome?: 'applied' | 'rejected';
|
|
2875
|
+
/** `applied` (default), `rejected`, or `removed` (an accepted change request took the line off the request: its price is unset, this history stays). */
|
|
2876
|
+
outcome?: 'applied' | 'rejected' | 'removed';
|
|
2856
2877
|
answer?: 'notify' | 'accepted';
|
|
2857
2878
|
}
|
|
2858
2879
|
/** PDK-SERVICE-CHANGES — one line's price override with its history (oldest first). */
|
|
@@ -2867,6 +2888,71 @@ export interface CaseLinePriceEntry {
|
|
|
2867
2888
|
}
|
|
2868
2889
|
/** PDK-SERVICE-CHANGES — `CaseView.linePrices`: the line prices by receipt line `key`. */
|
|
2869
2890
|
export type CaseLinePrices = Record<string, CaseLinePriceEntry>;
|
|
2891
|
+
/** PDK-SERVICE-CHANGES S3 — which form a change needs, from the request's time (booking, rental) or the kinds of its lines. */
|
|
2892
|
+
export type CaseChangeKind = 'items' | 'service' | 'booking' | 'rental' | 'mixed';
|
|
2893
|
+
/**
|
|
2894
|
+
* PDK-SERVICE-CHANGES S3 — why the customer cannot ask a change now (`CaseView.changeReason`, and the `code` of the 409 on
|
|
2895
|
+
* `cases.receiptRequestChange`): `case_closed`; `case_not_sent` (still being put together: edit it); `change_window_closed`
|
|
2896
|
+
* (the rule of its kind: products — confirmed; quote — the customer accepted a price; service — in progress; booking/rental —
|
|
2897
|
+
* fewer than `changeWindowHours`, default 24, before it starts); `change_pending` (the business has a change waiting).
|
|
2898
|
+
*/
|
|
2899
|
+
export type CaseChangeReason = 'case_closed' | 'case_not_sent' | 'change_window_closed' | 'change_pending';
|
|
2900
|
+
/** One line of a change request: the FULL new line set replaces the case's catalog lines (units for a rental). */
|
|
2901
|
+
export interface CaseChangeLine {
|
|
2902
|
+
productId: string;
|
|
2903
|
+
/** In the product's unit; or `amountCents` for a product sold by value. */
|
|
2904
|
+
quantity?: number;
|
|
2905
|
+
amountCents?: number;
|
|
2906
|
+
options?: unknown[];
|
|
2907
|
+
takeaway?: boolean;
|
|
2908
|
+
}
|
|
2909
|
+
/**
|
|
2910
|
+
* PDK-SERVICE-CHANGES S3 — what `cases.receiptRequestChange` / `cases.requestChange` send. At least one of `lines`, `data`,
|
|
2911
|
+
* `destination`, `slot` or `rental`. Nothing is held or charged until the business accepts.
|
|
2912
|
+
*/
|
|
2913
|
+
export interface CaseChangeInput {
|
|
2914
|
+
/** Why / what for (≤ 500 characters), shown to the business. */
|
|
2915
|
+
note?: string;
|
|
2916
|
+
/** The FULL new set of products/services (units for a rental). Not for a booking (change its `slot`). */
|
|
2917
|
+
lines?: CaseChangeLine[];
|
|
2918
|
+
/** Field answers to change, by the case type's field keys (`null` clears one). */
|
|
2919
|
+
data?: Record<string, unknown>;
|
|
2920
|
+
/** The new address/delivery (`null`: no delivery any more). Its `quote` goes on the receipt's total, as on a direct order. */
|
|
2921
|
+
destination?: CaseDestination | null;
|
|
2922
|
+
/** A booking's new time (you already checked it is free: the platform keeps what was booked, you own availability). */
|
|
2923
|
+
slot?: {
|
|
2924
|
+
startsAt: string;
|
|
2925
|
+
endsAt: string;
|
|
2926
|
+
timezone?: string;
|
|
2927
|
+
resourceId?: string | null;
|
|
2928
|
+
resourceName?: string;
|
|
2929
|
+
};
|
|
2930
|
+
/** A rental's new range (you already hold it); `lines[].periodRateCents` needs an App sk_ key, as on `updateRental`. */
|
|
2931
|
+
rental?: {
|
|
2932
|
+
startsAt: string;
|
|
2933
|
+
endsAt: string;
|
|
2934
|
+
timezone?: string;
|
|
2935
|
+
periods?: {
|
|
2936
|
+
unit?: RentalPeriodUnit;
|
|
2937
|
+
count?: number;
|
|
2938
|
+
};
|
|
2939
|
+
lines?: Array<{
|
|
2940
|
+
productId: string;
|
|
2941
|
+
periodRateCents: number;
|
|
2942
|
+
}>;
|
|
2943
|
+
};
|
|
2944
|
+
}
|
|
2945
|
+
/** PDK-SERVICE-CHANGES S3 — the change waiting for the business (`CaseView.pendingChange`, `CaseReceipt.pendingChange`). */
|
|
2946
|
+
export interface CasePendingChange extends CaseChangeInput {
|
|
2947
|
+
id: string;
|
|
2948
|
+
/** Who asked: the customer (receipt) or the App on their behalf. */
|
|
2949
|
+
by: 'customer' | 'business';
|
|
2950
|
+
at: string;
|
|
2951
|
+
status: 'pending';
|
|
2952
|
+
/** What the receipt would add up to if it were accepted now (line prices, rental rates and delivery included); null: a line still has no price. */
|
|
2953
|
+
previewTotalCents?: number | null;
|
|
2954
|
+
previewCurrency?: string | null;
|
|
2955
|
+
}
|
|
2870
2956
|
/** PDK-SERVICE-CHANGES — what `cases.setLinePrice` sends. */
|
|
2871
2957
|
export interface SetCaseLinePriceInput {
|
|
2872
2958
|
/** The receipt line's `key` (a line of the order: product, service, booking or rental; not a free `off#n` line). */
|
|
@@ -3042,6 +3128,15 @@ export interface CaseReceipt {
|
|
|
3042
3128
|
} | null;
|
|
3043
3129
|
/** AGF-PDK-DISPATCH-PROPOSAL — the business's latest proposed changes and their answer (absent on an older platform). */
|
|
3044
3130
|
proposal?: CaseProposal | null;
|
|
3131
|
+
/** PDK-SERVICE-CHANGES S3 — the customer may ask a change now (`cases.receiptRequestChange`); `changeReason` says why not. Absent on an older platform. */
|
|
3132
|
+
changeAllowed?: boolean;
|
|
3133
|
+
changeReason?: CaseChangeReason;
|
|
3134
|
+
/** Which form the change needs: `items` (the cart), `service`, `booking` (time), `rental` (range) or `mixed`. */
|
|
3135
|
+
changeKind?: CaseChangeKind;
|
|
3136
|
+
/** A booking or a rental: the last instant a change can still be asked (ISO). */
|
|
3137
|
+
changeUntil?: string;
|
|
3138
|
+
/** The change asked and waiting for the business; null/absent: none. */
|
|
3139
|
+
pendingChange?: CasePendingChange | null;
|
|
3045
3140
|
business: {
|
|
3046
3141
|
name: string;
|
|
3047
3142
|
description: string | null;
|
|
@@ -3622,7 +3717,7 @@ export interface MoveCaseSlotInput {
|
|
|
3622
3717
|
}
|
|
3623
3718
|
import type { AppBillingWebhookEvent } from './resources/billing';
|
|
3624
3719
|
import type { ContactPropertiesPatch } from './resources/contacts';
|
|
3625
|
-
export type AppCaseWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed' | 'case.proposal';
|
|
3720
|
+
export type AppCaseWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed' | 'case.proposal' | 'case.change';
|
|
3626
3721
|
export type AppWebhookEventName = AppCaseWebhookEventName | 'conversation.message' | 'channel.status_changed' | 'billing.plan_changed' | 'billing.trial_ended';
|
|
3627
3722
|
export interface AppWebhook {
|
|
3628
3723
|
url: string;
|
|
@@ -3692,6 +3787,11 @@ export interface AppCaseWebhookEvent extends AppWebhookEventBase {
|
|
|
3692
3787
|
previousPaymentStatus?: CasePaymentStatus;
|
|
3693
3788
|
/** `case.proposal` (AGF-PDK-DISPATCH-PROPOSAL): the business sent or withdrew changes, or they were answered. */
|
|
3694
3789
|
proposal?: 'sent' | 'accepted' | 'withdrawn' | 'redone';
|
|
3790
|
+
/**
|
|
3791
|
+
* `case.change` (PDK-SERVICE-CHANGES S3): a change request was `requested` (by the customer or the App), `accepted` or `rejected`
|
|
3792
|
+
* by the business, or `withdrawn` by the customer. `by` is who did this move; the case keeps its state while a change waits.
|
|
3793
|
+
*/
|
|
3794
|
+
change?: 'requested' | 'accepted' | 'rejected' | 'withdrawn';
|
|
3695
3795
|
/** AGF-ORDER-ORIGIN-POS — where the case came from (cases from before carry none). */
|
|
3696
3796
|
origin?: CaseOrigin;
|
|
3697
3797
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.90.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",
|