@agentforge-io/sdk-server 4.88.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 +63 -1
- package/dist/resources/cases.js +69 -0
- package/dist/types.d.ts +188 -2
- 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, 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, 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);
|
|
@@ -52,6 +52,25 @@ export declare class CasesResource {
|
|
|
52
52
|
* Returns the updated case.
|
|
53
53
|
*/
|
|
54
54
|
confirmLine(caseId: string, input: ConfirmCaseLineInput): Promise<CaseView>;
|
|
55
|
+
/**
|
|
56
|
+
* `POST /api/v1/cases/:id/lines/price` — PDK-SERVICE-CHANGES: the business sets the price of ONE line of THIS request
|
|
57
|
+
* (a service «a consultar» / «desde» / hourly rate, a booking, a rental, a product), by its receipt `key`.
|
|
58
|
+
*
|
|
59
|
+
* - `answer: 'required'` — a quote: the customer gets a `price` proposal (`proposal.linePrice`, `requiresAnswer`, never
|
|
60
|
+
* auto-accepted) and answers it on the receipt (`receiptAnswerProposal`) or you record it (`answerProposal`). The price
|
|
61
|
+
* applies only when they accept (receipt re-issued, revision + 1); a rejection leaves the line as it was and the case's
|
|
62
|
+
* `linePrices[line].history` notes it. Several lines may be quoted in a row: they join one proposal.
|
|
63
|
+
* - `answer: 'notify'` — applied now: the receipt is re-issued (revision + 1) with the line's `priceSet` («Precio
|
|
64
|
+
* actualizado») and the customer is told.
|
|
65
|
+
*
|
|
66
|
+
* `unitCents` is the price of ONE unit (0 = «gratis», distinct from no price). It wins over the catalog, «desde», a rate and
|
|
67
|
+
* a rental's `periodRates` (on a rented line it is one unit over the whole range). The same price again is a no-op.
|
|
68
|
+
* Until every line has a price the platform refuses to charge (`total_pending`; `receipt.pricePending`).
|
|
69
|
+
* 400 closed / still edited / free `off#n` line (use `confirmLine`) / value line / invalid body, 404 unknown line,
|
|
70
|
+
* 409 another proposal waiting, the line already has a different quote waiting, or the payment was already reported or made.
|
|
71
|
+
* Returns the updated case.
|
|
72
|
+
*/
|
|
73
|
+
setLinePrice(caseId: string, input: SetCaseLinePriceInput): Promise<CaseView>;
|
|
55
74
|
/**
|
|
56
75
|
* `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
|
|
57
76
|
* («$3.000 de queso») really weighed, in the product's unit (`line` = the
|
|
@@ -111,6 +130,49 @@ export declare class CasesResource {
|
|
|
111
130
|
*/
|
|
112
131
|
receiptReopen(token: string): Promise<CaseReceipt>;
|
|
113
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>;
|
|
114
176
|
/**
|
|
115
177
|
* `POST /api/v1/cases/receipts/:token/cancel` — «Cancelar pedido»: the customer cancels from
|
|
116
178
|
* the receipt while the order is a draft (sent, accepted, being prepared or redone, changes
|
package/dist/resources/cases.js
CHANGED
|
@@ -95,6 +95,27 @@ class CasesResource {
|
|
|
95
95
|
async confirmLine(caseId, input) {
|
|
96
96
|
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/lines/confirm`, input);
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* `POST /api/v1/cases/:id/lines/price` — PDK-SERVICE-CHANGES: the business sets the price of ONE line of THIS request
|
|
100
|
+
* (a service «a consultar» / «desde» / hourly rate, a booking, a rental, a product), by its receipt `key`.
|
|
101
|
+
*
|
|
102
|
+
* - `answer: 'required'` — a quote: the customer gets a `price` proposal (`proposal.linePrice`, `requiresAnswer`, never
|
|
103
|
+
* auto-accepted) and answers it on the receipt (`receiptAnswerProposal`) or you record it (`answerProposal`). The price
|
|
104
|
+
* applies only when they accept (receipt re-issued, revision + 1); a rejection leaves the line as it was and the case's
|
|
105
|
+
* `linePrices[line].history` notes it. Several lines may be quoted in a row: they join one proposal.
|
|
106
|
+
* - `answer: 'notify'` — applied now: the receipt is re-issued (revision + 1) with the line's `priceSet` («Precio
|
|
107
|
+
* actualizado») and the customer is told.
|
|
108
|
+
*
|
|
109
|
+
* `unitCents` is the price of ONE unit (0 = «gratis», distinct from no price). It wins over the catalog, «desde», a rate and
|
|
110
|
+
* a rental's `periodRates` (on a rented line it is one unit over the whole range). The same price again is a no-op.
|
|
111
|
+
* Until every line has a price the platform refuses to charge (`total_pending`; `receipt.pricePending`).
|
|
112
|
+
* 400 closed / still edited / free `off#n` line (use `confirmLine`) / value line / invalid body, 404 unknown line,
|
|
113
|
+
* 409 another proposal waiting, the line already has a different quote waiting, or the payment was already reported or made.
|
|
114
|
+
* Returns the updated case.
|
|
115
|
+
*/
|
|
116
|
+
async setLinePrice(caseId, input) {
|
|
117
|
+
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/lines/price`, input);
|
|
118
|
+
}
|
|
98
119
|
/**
|
|
99
120
|
* `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
|
|
100
121
|
* («$3.000 de queso») really weighed, in the product's unit (`line` = the
|
|
@@ -167,6 +188,54 @@ class CasesResource {
|
|
|
167
188
|
async receiptRedoProposal(token) {
|
|
168
189
|
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/proposal/redo`, {});
|
|
169
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
|
+
}
|
|
170
239
|
/**
|
|
171
240
|
* `POST /api/v1/cases/receipts/:token/cancel` — «Cancelar pedido»: the customer cancels from
|
|
172
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. */
|
|
@@ -2441,7 +2446,8 @@ export interface CaseType {
|
|
|
2441
2446
|
* (the courier section, dispatch) read the type, never the label.
|
|
2442
2447
|
*/
|
|
2443
2448
|
/** `confirmed` (AGF-PDK-DISPATCH-PROPOSAL): an order's definitive version, after its preparation; from it on, a change is a new order. */
|
|
2444
|
-
|
|
2449
|
+
/** `in_progress` (a service being worked on) was missing here while the platform already sent it. */
|
|
2450
|
+
export type CaseStateType = 'draft' | 'received' | 'preparing' | 'confirmed' | 'ready' | 'out_for_delivery' | 'in_progress' | 'completed' | 'canceled';
|
|
2445
2451
|
/** `no_show`: a booking whose customer did not come (AGF-AGENDA-LIFECYCLE). */
|
|
2446
2452
|
export type CaseState = 'open' | 'review' | 'submitted' | 'accepted' | 'completed' | 'cancelled' | 'rejected' | 'abandoned' | 'no_show' | (string & {});
|
|
2447
2453
|
/** One state a case reached (AGF-CASE-TRACKING). */
|
|
@@ -2546,7 +2552,24 @@ export interface CaseView {
|
|
|
2546
2552
|
confirmedSubtotalCents?: number;
|
|
2547
2553
|
/** PDK-OFF-CATALOG — how many free lines still wait for the business; the total is null while it is above 0. */
|
|
2548
2554
|
pendingLines?: number;
|
|
2555
|
+
/**
|
|
2556
|
+
* PDK-SERVICE-CHANGES — a line has no price yet (a service «a consultar», a «desde», a rate, a free line to confirm): the
|
|
2557
|
+
* total is unknown and the platform refuses to charge (`total_pending`) until the business prices it with
|
|
2558
|
+
* `cases.setLinePrice`. Hide payment prompts while true. Absent on an older platform.
|
|
2559
|
+
*/
|
|
2560
|
+
pricePending?: boolean;
|
|
2549
2561
|
} | null;
|
|
2562
|
+
/** PDK-SERVICE-CHANGES — the prices the business set for lines of this request, by receipt line `key`, with their history; null/absent: none. */
|
|
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;
|
|
2550
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. */
|
|
2551
2574
|
offCatalog?: CaseOffCatalogView | null;
|
|
2552
2575
|
/** What the customer asked after the business took the case (change, cancel), until the business moves it. */
|
|
@@ -2701,6 +2724,11 @@ export interface CasePayment {
|
|
|
2701
2724
|
chosenAt?: 'checkout' | 'chat' | 'receipt';
|
|
2702
2725
|
/** The order ended undone after the customer reported (or the business confirmed) the payment: check it and refund. */
|
|
2703
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;
|
|
2704
2732
|
/**
|
|
2705
2733
|
* PDK-STORE-CREDIT — `paid` because the customer account's abonos covered the order's fiado (money counted abono by
|
|
2706
2734
|
* abono, never on the order). Absent otherwise and on an older platform; cleared when it goes back on account.
|
|
@@ -2742,6 +2770,8 @@ export interface CaseReceiptPayment {
|
|
|
2742
2770
|
changeCents?: number | null;
|
|
2743
2771
|
/** The order ended undone after the customer reported or paid: the business gives the money back. */
|
|
2744
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;
|
|
2745
2775
|
}
|
|
2746
2776
|
/** AGF-CASE-RECEIPT — one product line, with the price it had when the receipt was issued. */
|
|
2747
2777
|
export interface CaseReceiptLine {
|
|
@@ -2806,6 +2836,137 @@ export interface CaseReceiptLine {
|
|
|
2806
2836
|
askedPriceCents?: number;
|
|
2807
2837
|
confirmedBy?: string;
|
|
2808
2838
|
confirmedAt?: string;
|
|
2839
|
+
/**
|
|
2840
|
+
* PDK-SERVICE-CHANGES — the business set this line's price for THIS request (`cases.setLinePrice`); `unitCents` is then
|
|
2841
|
+
* that price and `priceKind` is `fixed`. `answer`: `accepted` (the customer accepted the quote) or `notify` (the business
|
|
2842
|
+
* told them); `updated: true` = show the «Precio actualizado» marker. Absent: the price is the catalog's (or the rental's rate).
|
|
2843
|
+
*/
|
|
2844
|
+
priceSet?: CaseLinePriceSet;
|
|
2845
|
+
}
|
|
2846
|
+
/** PDK-SERVICE-CHANGES — who set a line price. */
|
|
2847
|
+
export interface CaseLinePriceActor {
|
|
2848
|
+
id: string;
|
|
2849
|
+
name?: string;
|
|
2850
|
+
role?: string;
|
|
2851
|
+
}
|
|
2852
|
+
/** PDK-SERVICE-CHANGES — one part of a line price («Visita», «Mano de obra», «Repuestos»); the parts add up to `unitCents`. */
|
|
2853
|
+
export interface CaseLinePriceBreakdownItem {
|
|
2854
|
+
label: string;
|
|
2855
|
+
cents: number;
|
|
2856
|
+
}
|
|
2857
|
+
/** PDK-SERVICE-CHANGES — what a receipt line says of the price the business set (`CaseReceiptLine.priceSet`). */
|
|
2858
|
+
export interface CaseLinePriceSet {
|
|
2859
|
+
by: CaseLinePriceActor;
|
|
2860
|
+
at: string;
|
|
2861
|
+
note?: string;
|
|
2862
|
+
breakdown?: CaseLinePriceBreakdownItem[];
|
|
2863
|
+
answer: 'notify' | 'accepted';
|
|
2864
|
+
updated?: true;
|
|
2865
|
+
}
|
|
2866
|
+
/** PDK-SERVICE-CHANGES — one move of a line's price. A refused quote has `outcome: 'rejected'` and changed nothing. */
|
|
2867
|
+
export interface CaseLinePriceHistoryEntry {
|
|
2868
|
+
/** The price in force before this move (cents); null: the line had none. */
|
|
2869
|
+
before: number | null;
|
|
2870
|
+
/** The price this move set (a rejected quote: the one that was proposed). */
|
|
2871
|
+
after: number;
|
|
2872
|
+
by: CaseLinePriceActor;
|
|
2873
|
+
at: string;
|
|
2874
|
+
note?: string;
|
|
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';
|
|
2877
|
+
answer?: 'notify' | 'accepted';
|
|
2878
|
+
}
|
|
2879
|
+
/** PDK-SERVICE-CHANGES — one line's price override with its history (oldest first). */
|
|
2880
|
+
export interface CaseLinePriceEntry {
|
|
2881
|
+
/** The price of ONE unit of the line (cents; 0 = «gratis»). null: it was never priced (only rejected quotes in `history`). */
|
|
2882
|
+
unitCents: number | null;
|
|
2883
|
+
note?: string;
|
|
2884
|
+
breakdown?: CaseLinePriceBreakdownItem[];
|
|
2885
|
+
by: CaseLinePriceActor;
|
|
2886
|
+
at: string;
|
|
2887
|
+
history: CaseLinePriceHistoryEntry[];
|
|
2888
|
+
}
|
|
2889
|
+
/** PDK-SERVICE-CHANGES — `CaseView.linePrices`: the line prices by receipt line `key`. */
|
|
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
|
+
}
|
|
2956
|
+
/** PDK-SERVICE-CHANGES — what `cases.setLinePrice` sends. */
|
|
2957
|
+
export interface SetCaseLinePriceInput {
|
|
2958
|
+
/** The receipt line's `key` (a line of the order: product, service, booking or rental; not a free `off#n` line). */
|
|
2959
|
+
line: string;
|
|
2960
|
+
/** Price of ONE unit, whole cents, 0..2147483647 (0 = «gratis»). On a rented line: one unit over the whole range. */
|
|
2961
|
+
unitCents: number;
|
|
2962
|
+
/** `required`: a quote — the customer must accept or reject it; it applies only when they accept. `notify`: applied now and the customer is told. */
|
|
2963
|
+
answer: 'required' | 'notify';
|
|
2964
|
+
/** Words for the customer (≤ 500). */
|
|
2965
|
+
note?: string;
|
|
2966
|
+
/** What the price is made of; must add up to `unitCents` (≤ 10 items, label ≤ 80). */
|
|
2967
|
+
breakdown?: CaseLinePriceBreakdownItem[];
|
|
2968
|
+
/** Who of the business set it; default `{ id: 'business' }`. */
|
|
2969
|
+
by?: CaseLinePriceActor;
|
|
2809
2970
|
}
|
|
2810
2971
|
/** One option group's choice on a proposed alternative: the group and what was picked in it (ids, or names). */
|
|
2811
2972
|
export interface CaseProposalSwapOption {
|
|
@@ -2826,6 +2987,13 @@ export interface CaseProposalChange {
|
|
|
2826
2987
|
newAmountCents?: number;
|
|
2827
2988
|
/** PDK-OFF-CATALOG — what the customer said the whole line costs. */
|
|
2828
2989
|
askedAmountCents?: number;
|
|
2990
|
+
/** PDK-SERVICE-CHANGES — a quote of a line price (`cases.setLinePrice` with `answer: 'required'`): the unit price (and why) that applies only if the customer accepts (`answer: 'keep'`). */
|
|
2991
|
+
linePrice?: {
|
|
2992
|
+
unitCents: number;
|
|
2993
|
+
note?: string;
|
|
2994
|
+
breakdown?: CaseLinePriceBreakdownItem[];
|
|
2995
|
+
by: CaseLinePriceActor;
|
|
2996
|
+
};
|
|
2829
2997
|
swap?: {
|
|
2830
2998
|
/** '' for a free line's alternative (`free: true`): it is text, not a catalog product, unless the business linked one. */
|
|
2831
2999
|
productId: string;
|
|
@@ -2867,6 +3035,8 @@ export interface CaseProposal {
|
|
|
2867
3035
|
currency: string | null;
|
|
2868
3036
|
/** PDK-OFF-CATALOG — made by the business confirming free lines (`cases.confirmLine`), not proposed by hand. */
|
|
2869
3037
|
offCatalog?: true;
|
|
3038
|
+
/** PDK-SERVICE-CHANGES — a quote of line prices (`cases.setLinePrice`, `answer: 'required'`): the customer must accept or reject (`requiresAnswer` is true, never auto-accepted); each accepted price becomes the line's price and the receipt is re-issued; a rejected one leaves the line as it was. */
|
|
3039
|
+
linePrice?: true;
|
|
2870
3040
|
/** 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. */
|
|
2871
3041
|
requiresAnswer?: boolean;
|
|
2872
3042
|
/**
|
|
@@ -2928,6 +3098,8 @@ export interface CaseReceipt {
|
|
|
2928
3098
|
confirmedSubtotalCents?: number;
|
|
2929
3099
|
/** PDK-OFF-CATALOG — free lines still waiting for the business (`totalCents` is null while it is above 0). */
|
|
2930
3100
|
pendingLines?: number;
|
|
3101
|
+
/** PDK-SERVICE-CHANGES — a line has no price yet: `totalCents` is null and nothing can be charged until the business prices it. Hide payment prompts while true (absent on an older platform). */
|
|
3102
|
+
pricePending?: boolean;
|
|
2931
3103
|
fields: Array<{
|
|
2932
3104
|
label: string;
|
|
2933
3105
|
value: string;
|
|
@@ -2956,6 +3128,15 @@ export interface CaseReceipt {
|
|
|
2956
3128
|
} | null;
|
|
2957
3129
|
/** AGF-PDK-DISPATCH-PROPOSAL — the business's latest proposed changes and their answer (absent on an older platform). */
|
|
2958
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;
|
|
2959
3140
|
business: {
|
|
2960
3141
|
name: string;
|
|
2961
3142
|
description: string | null;
|
|
@@ -3536,7 +3717,7 @@ export interface MoveCaseSlotInput {
|
|
|
3536
3717
|
}
|
|
3537
3718
|
import type { AppBillingWebhookEvent } from './resources/billing';
|
|
3538
3719
|
import type { ContactPropertiesPatch } from './resources/contacts';
|
|
3539
|
-
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';
|
|
3540
3721
|
export type AppWebhookEventName = AppCaseWebhookEventName | 'conversation.message' | 'channel.status_changed' | 'billing.plan_changed' | 'billing.trial_ended';
|
|
3541
3722
|
export interface AppWebhook {
|
|
3542
3723
|
url: string;
|
|
@@ -3606,6 +3787,11 @@ export interface AppCaseWebhookEvent extends AppWebhookEventBase {
|
|
|
3606
3787
|
previousPaymentStatus?: CasePaymentStatus;
|
|
3607
3788
|
/** `case.proposal` (AGF-PDK-DISPATCH-PROPOSAL): the business sent or withdrew changes, or they were answered. */
|
|
3608
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';
|
|
3609
3795
|
/** AGF-ORDER-ORIGIN-POS — where the case came from (cases from before carry none). */
|
|
3610
3796
|
origin?: CaseOrigin;
|
|
3611
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",
|