@agentforge-io/sdk-server 4.77.0 → 4.79.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 +2 -2
- package/dist/resources/cases.js +2 -0
- package/dist/resources/contacts.d.ts +80 -2
- package/dist/resources/contacts.js +32 -3
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { BillingResource } from './resources/billing';
|
|
|
6
6
|
export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
|
|
7
7
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
8
8
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
9
|
-
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, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, 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, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
9
|
+
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, 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, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
10
10
|
export { AgentsResource } from './resources/agents';
|
|
11
11
|
export { AnalyticsResource } from './resources/analytics';
|
|
12
12
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -26,7 +26,7 @@ export type { ListMarketplaceCategoriesInput } from './resources/marketplace';
|
|
|
26
26
|
export { TenantConfigResource } from './resources/config';
|
|
27
27
|
export { PlacesResource } from './resources/places';
|
|
28
28
|
export { ContactsResource, ContactVerificationResource, ContactAddressesResource, ContactTagsResource, ContactListsResource, } from './resources/contacts';
|
|
29
|
-
export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, AppContact, ContactAvatarUploadTarget, ClaimContactInput, ClaimContactResult, StartVerificationInput, StartVerificationResult, ConfirmVerificationInput, ConfirmVerificationResult, ContactDocumentType, ContactDocumentInput, ContactDocument, ContactMatchedBy, ContactSummary, BusinessContact, ContactPage, SearchContactsInput, CreateBusinessContactInput, UpdateBusinessContactInput, ContactAddress, ContactAddressInput, ContactTag, ContactList, } from './resources/contacts';
|
|
29
|
+
export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, AppContact, ContactAvatarUploadTarget, ClaimContactInput, ClaimContactResult, StartVerificationInput, StartVerificationResult, ConfirmVerificationInput, ConfirmVerificationResult, ContactDocumentType, ContactDocumentInput, ContactDocument, ContactMatchedBy, ContactSummary, ContactSegment, ContactSort, ContactStats, ContactNote, BusinessContact, ContactPage, SearchContactsInput, CreateBusinessContactInput, UpdateBusinessContactInput, ContactAddress, ContactAddressInput, ContactTag, ContactList, } from './resources/contacts';
|
|
30
30
|
export { FilesResource } from './resources/files';
|
|
31
31
|
export type { AppFileKind, SignAppFileInput, AppFileUploadTarget } from './resources/files';
|
|
32
32
|
export { DeliveryResource } from './resources/delivery';
|
package/dist/resources/cases.js
CHANGED
|
@@ -29,6 +29,8 @@ class CasesResource {
|
|
|
29
29
|
qs.set('slotTo', at(input.slotTo));
|
|
30
30
|
if (input.assignee)
|
|
31
31
|
qs.set('assignee', input.assignee);
|
|
32
|
+
if (input.contactId)
|
|
33
|
+
qs.set('contactId', input.contactId);
|
|
32
34
|
const q = qs.toString();
|
|
33
35
|
return (await this.client.request('GET', `/api/v1/cases${q ? `?${q}` : ''}`)).items;
|
|
34
36
|
}
|
|
@@ -150,6 +150,58 @@ export interface ContactSummary {
|
|
|
150
150
|
lastSeenAt: string | null;
|
|
151
151
|
/** Why it matched `q`; `null` without a query. */
|
|
152
152
|
matchedBy: ContactMatchedBy | null;
|
|
153
|
+
/**
|
|
154
|
+
* PDK-LOYALTY-CRM L1 — orders that count (sent and not cancelled / rejected / abandoned / no-show; drafts
|
|
155
|
+
* excluded). Absent on a platform older than L1.
|
|
156
|
+
*/
|
|
157
|
+
ordersCount?: number;
|
|
158
|
+
/** ISO instant the latest counted order was sent, or `null`. Absent on an older platform. */
|
|
159
|
+
lastOrderAt?: string | null;
|
|
160
|
+
/**
|
|
161
|
+
* Receipt total in cents (delivery included) of the latest counted order — `null` when there is none or it is
|
|
162
|
+
* unpriced. Absent on an older platform.
|
|
163
|
+
*/
|
|
164
|
+
lastOrderTotalCents?: number | null;
|
|
165
|
+
/** Currency of that receipt, or `null`. Absent on an older platform. */
|
|
166
|
+
lastOrderCurrency?: string | null;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* PDK-LOYALTY-CRM L1 — behaviour segments of `search({ segment })`:
|
|
170
|
+
* `frequent` ≥ 3 orders in the last 90 days · `new` first order ≤ 30 days ago ·
|
|
171
|
+
* `inactive30|60|90` has orders and none in the last N days · `marketing` accepts promotions
|
|
172
|
+
* (`marketingConsent`). Orders count as in `ContactStats`.
|
|
173
|
+
*/
|
|
174
|
+
export type ContactSegment = 'frequent' | 'new' | 'inactive30' | 'inactive60' | 'inactive90' | 'marketing';
|
|
175
|
+
/** `recent` (default: last seen) · `recent_order` (latest order first, never-ordered last) · `name`. */
|
|
176
|
+
export type ContactSort = 'recent' | 'recent_order' | 'name';
|
|
177
|
+
/**
|
|
178
|
+
* PDK-LOYALTY-CRM L1 — `contacts.stats(id)`. An order counts when the customer sent it and it is not lost:
|
|
179
|
+
* completed and in-progress states count; `cancelled`, `rejected`, `abandoned`, `no_show` and unsent drafts
|
|
180
|
+
* (`open`, `review`) never do. Orders of contacts merged into this one are included.
|
|
181
|
+
*/
|
|
182
|
+
export interface ContactStats {
|
|
183
|
+
ordersCount: number;
|
|
184
|
+
/** Sum of the receipt totals (delivery included) of the counted orders that have a price. */
|
|
185
|
+
totalCents: number;
|
|
186
|
+
/** `totalCents` over the priced counted orders; 0 when none. */
|
|
187
|
+
avgTicketCents: number;
|
|
188
|
+
/** Currency of the latest priced order; `null` without orders. */
|
|
189
|
+
currency: string | null;
|
|
190
|
+
/** ISO instants a counted order was sent; `null` without orders. */
|
|
191
|
+
firstOrderAt: string | null;
|
|
192
|
+
lastOrderAt: string | null;
|
|
193
|
+
/** The latest counted order (`cases.get`). */
|
|
194
|
+
lastCaseId: string | null;
|
|
195
|
+
}
|
|
196
|
+
/** A timeline note on a contact, as an App sees it (`source: 'system'` for notes written through the SDK). */
|
|
197
|
+
export interface ContactNote {
|
|
198
|
+
id: string;
|
|
199
|
+
contactId: string;
|
|
200
|
+
body: string;
|
|
201
|
+
source: 'operator' | 'agent' | 'system';
|
|
202
|
+
pinned: boolean;
|
|
203
|
+
createdAt: string;
|
|
204
|
+
updatedAt: string;
|
|
153
205
|
}
|
|
154
206
|
export interface BusinessContact extends ContactSummary {
|
|
155
207
|
marketingConsent: boolean;
|
|
@@ -171,6 +223,10 @@ export interface SearchContactsInput {
|
|
|
171
223
|
tag?: string;
|
|
172
224
|
/** List id. */
|
|
173
225
|
list?: string;
|
|
226
|
+
/** PDK-LOYALTY-CRM L1 — behaviour segment (400 `invalid_segment` otherwise). */
|
|
227
|
+
segment?: ContactSegment;
|
|
228
|
+
/** PDK-LOYALTY-CRM L1 — default `recent` (400 `invalid_sort` otherwise). */
|
|
229
|
+
sort?: ContactSort;
|
|
174
230
|
cursor?: string;
|
|
175
231
|
/** 1-100, default 25. */
|
|
176
232
|
limit?: number;
|
|
@@ -265,6 +321,20 @@ export declare class ContactAddressesResource {
|
|
|
265
321
|
/** `DELETE …/addresses/:addressId`. */
|
|
266
322
|
remove(contactId: string, addressId: string): Promise<void>;
|
|
267
323
|
}
|
|
324
|
+
/** `contacts.notes` — timeline notes on a contact (PDK-LOYALTY-CRM L1). */
|
|
325
|
+
export declare class ContactNotesResource {
|
|
326
|
+
private readonly client;
|
|
327
|
+
constructor(client: AgentForgeClient);
|
|
328
|
+
/** `GET /api/v1/contacts/:id/notes` — pinned first, then newest first. 404 when not a contact of the business. */
|
|
329
|
+
list(contactId: string): Promise<ContactNote[]>;
|
|
330
|
+
/** `POST …/notes` — 1 to 5000 characters (400 `invalid_note`). Written as `source: 'system'` (the App). */
|
|
331
|
+
add(contactId: string, input: {
|
|
332
|
+
body: string;
|
|
333
|
+
pinned?: boolean;
|
|
334
|
+
}): Promise<ContactNote>;
|
|
335
|
+
/** `DELETE …/notes/:noteId` — soft delete; 404 `note_not_found` for a note of another contact. */
|
|
336
|
+
remove(contactId: string, noteId: string): Promise<void>;
|
|
337
|
+
}
|
|
268
338
|
/** `contacts.tags` — the business's tag catalog (contacts keep the tag names). */
|
|
269
339
|
export declare class ContactTagsResource {
|
|
270
340
|
private readonly client;
|
|
@@ -324,15 +394,23 @@ export declare class ContactsResource {
|
|
|
324
394
|
readonly addresses: ContactAddressesResource;
|
|
325
395
|
readonly tags: ContactTagsResource;
|
|
326
396
|
readonly lists: ContactListsResource;
|
|
397
|
+
readonly notes: ContactNotesResource;
|
|
327
398
|
constructor(client: AgentForgeClient);
|
|
328
399
|
/**
|
|
329
|
-
* `GET /api/v1/contacts?q&tag&list&cursor&limit` — search the business's
|
|
400
|
+
* `GET /api/v1/contacts?q&tag&list&segment&sort&cursor&limit` — search the business's
|
|
330
401
|
* contacts (excludes merged and deleted ones). With `q`: best match first
|
|
331
|
-
* (exact phone/document, then name prefix, …)
|
|
402
|
+
* (exact phone/document, then name prefix, …), then `sort`; without: `sort`
|
|
403
|
+
* (default most recently seen first). Rows carry `ordersCount` / `lastOrderAt`.
|
|
332
404
|
*/
|
|
333
405
|
search(input?: SearchContactsInput): Promise<ContactPage>;
|
|
334
406
|
/** Alias of `search` without `q` (the Contactos tab). */
|
|
335
407
|
list(input?: Omit<SearchContactsInput, 'q'>): Promise<ContactPage>;
|
|
408
|
+
/**
|
|
409
|
+
* PDK-LOYALTY-CRM L1 — `GET /api/v1/contacts/:id/stats`: orders count, total, average ticket, first / last
|
|
410
|
+
* order and the last case. The contact's orders themselves: `cases.list({ contactId })`.
|
|
411
|
+
* Rejects with a 404 `AgentForgeNotFoundError` when it is not a contact of this business.
|
|
412
|
+
*/
|
|
413
|
+
stats(contactId: string): Promise<ContactStats>;
|
|
336
414
|
/**
|
|
337
415
|
* `POST /api/v1/contacts`. Needs a name, a phone or a document. A phone or
|
|
338
416
|
* document the business already has throws `AgentForgeDuplicateContactError`
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
// - `getById(id)` · `update({ contactId, ... })` (documents, tags, consent).
|
|
28
28
|
// - `addresses.*` · `tags.*` (per-business catalog) · `lists.*` (static lists).
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.ContactsResource = exports.ContactListsResource = exports.ContactTagsResource = exports.ContactAddressesResource = exports.ContactVerificationResource = void 0;
|
|
30
|
+
exports.ContactsResource = exports.ContactListsResource = exports.ContactTagsResource = exports.ContactNotesResource = exports.ContactAddressesResource = exports.ContactVerificationResource = void 0;
|
|
31
31
|
const errors_1 = require("../errors");
|
|
32
32
|
class ContactVerificationResource {
|
|
33
33
|
constructor(client) {
|
|
@@ -107,6 +107,25 @@ class ContactAddressesResource {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
exports.ContactAddressesResource = ContactAddressesResource;
|
|
110
|
+
/** `contacts.notes` — timeline notes on a contact (PDK-LOYALTY-CRM L1). */
|
|
111
|
+
class ContactNotesResource {
|
|
112
|
+
constructor(client) {
|
|
113
|
+
this.client = client;
|
|
114
|
+
}
|
|
115
|
+
/** `GET /api/v1/contacts/:id/notes` — pinned first, then newest first. 404 when not a contact of the business. */
|
|
116
|
+
async list(contactId) {
|
|
117
|
+
return (await this.client.request('GET', `/api/v1/contacts/${q(contactId)}/notes`)).items;
|
|
118
|
+
}
|
|
119
|
+
/** `POST …/notes` — 1 to 5000 characters (400 `invalid_note`). Written as `source: 'system'` (the App). */
|
|
120
|
+
async add(contactId, input) {
|
|
121
|
+
return this.client.request('POST', `/api/v1/contacts/${q(contactId)}/notes`, input);
|
|
122
|
+
}
|
|
123
|
+
/** `DELETE …/notes/:noteId` — soft delete; 404 `note_not_found` for a note of another contact. */
|
|
124
|
+
async remove(contactId, noteId) {
|
|
125
|
+
await this.client.request('DELETE', `/api/v1/contacts/${q(contactId)}/notes/${q(noteId)}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.ContactNotesResource = ContactNotesResource;
|
|
110
129
|
/** `contacts.tags` — the business's tag catalog (contacts keep the tag names). */
|
|
111
130
|
class ContactTagsResource {
|
|
112
131
|
constructor(client) {
|
|
@@ -173,11 +192,13 @@ class ContactsResource {
|
|
|
173
192
|
this.addresses = new ContactAddressesResource(client);
|
|
174
193
|
this.tags = new ContactTagsResource(client);
|
|
175
194
|
this.lists = new ContactListsResource(client);
|
|
195
|
+
this.notes = new ContactNotesResource(client);
|
|
176
196
|
}
|
|
177
197
|
/**
|
|
178
|
-
* `GET /api/v1/contacts?q&tag&list&cursor&limit` — search the business's
|
|
198
|
+
* `GET /api/v1/contacts?q&tag&list&segment&sort&cursor&limit` — search the business's
|
|
179
199
|
* contacts (excludes merged and deleted ones). With `q`: best match first
|
|
180
|
-
* (exact phone/document, then name prefix, …)
|
|
200
|
+
* (exact phone/document, then name prefix, …), then `sort`; without: `sort`
|
|
201
|
+
* (default most recently seen first). Rows carry `ordersCount` / `lastOrderAt`.
|
|
181
202
|
*/
|
|
182
203
|
async search(input = {}) {
|
|
183
204
|
return this.client.request('GET', `/api/v1/contacts${query({ ...input })}`);
|
|
@@ -186,6 +207,14 @@ class ContactsResource {
|
|
|
186
207
|
async list(input = {}) {
|
|
187
208
|
return this.search(input);
|
|
188
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* PDK-LOYALTY-CRM L1 — `GET /api/v1/contacts/:id/stats`: orders count, total, average ticket, first / last
|
|
212
|
+
* order and the last case. The contact's orders themselves: `cases.list({ contactId })`.
|
|
213
|
+
* Rejects with a 404 `AgentForgeNotFoundError` when it is not a contact of this business.
|
|
214
|
+
*/
|
|
215
|
+
async stats(contactId) {
|
|
216
|
+
return this.client.request('GET', `/api/v1/contacts/${q(contactId)}/stats`);
|
|
217
|
+
}
|
|
189
218
|
/**
|
|
190
219
|
* `POST /api/v1/contacts`. Needs a name, a phone or a document. A phone or
|
|
191
220
|
* document the business already has throws `AgentForgeDuplicateContactError`
|
package/dist/types.d.ts
CHANGED
|
@@ -2385,6 +2385,8 @@ export interface CaseDestination {
|
|
|
2385
2385
|
currency: string;
|
|
2386
2386
|
};
|
|
2387
2387
|
}
|
|
2388
|
+
/** PDK-LOYALTY S1c — how a case's contact was linked. */
|
|
2389
|
+
export type CaseContactLink = 'explicit' | 'app_user' | 'phone' | 'created';
|
|
2388
2390
|
export interface CaseView {
|
|
2389
2391
|
id: string;
|
|
2390
2392
|
/** Per workspace, sequential (ordering). People read `code`. */
|
|
@@ -2407,6 +2409,14 @@ export interface CaseView {
|
|
|
2407
2409
|
note: string | null;
|
|
2408
2410
|
/** The conversation's user (app user id, phone…), when known. */
|
|
2409
2411
|
customerRef: string | null;
|
|
2412
|
+
/** PDK-LOYALTY-CRM L1 — the business contact (`contacts.getById`) this case belongs to; `null` when none resolved (absent on an older platform). */
|
|
2413
|
+
contactId?: string | null;
|
|
2414
|
+
/**
|
|
2415
|
+
* How `contactId` was linked: `explicit` (the App sent `customer.contactId` with its secret key and vouches for it),
|
|
2416
|
+
* `app_user` (the signed-in end user's linked contact), `phone` (a unique phone match) or `created` (made from the
|
|
2417
|
+
* order itself). `null` with no contact and for cases from before this field; absent on an older platform.
|
|
2418
|
+
*/
|
|
2419
|
+
contactLink?: CaseContactLink | null;
|
|
2410
2420
|
/** States the business can move it to now, each with what the customer is
|
|
2411
2421
|
* told when it moves there (AGF-CASES C3; absent when nothing is said). */
|
|
2412
2422
|
nextStates: Array<{
|
|
@@ -2779,6 +2789,7 @@ export interface CreateDirectOrderInput {
|
|
|
2779
2789
|
ref: string;
|
|
2780
2790
|
name?: string;
|
|
2781
2791
|
phone?: string;
|
|
2792
|
+
contactId?: string;
|
|
2782
2793
|
};
|
|
2783
2794
|
/** AGF-ORDER-ORIGIN-POS — where it comes from; default `{ channel: 'page' }`. A `pos` sale needs `place` and `by`. */
|
|
2784
2795
|
origin?: CaseOrigin;
|
|
@@ -2869,6 +2880,7 @@ export interface CreateOpenOrderInput {
|
|
|
2869
2880
|
ref?: string;
|
|
2870
2881
|
name?: string;
|
|
2871
2882
|
phone?: string;
|
|
2883
|
+
contactId?: string;
|
|
2872
2884
|
};
|
|
2873
2885
|
origin: {
|
|
2874
2886
|
channel: 'link';
|
|
@@ -3052,6 +3064,8 @@ export interface ListCasesInput {
|
|
|
3052
3064
|
slotTo?: string | Date;
|
|
3053
3065
|
/** AGF-AGENDA — one member's requests (your reference), or `none` for unassigned ones. */
|
|
3054
3066
|
assignee?: string;
|
|
3067
|
+
/** PDK-LOYALTY-CRM L1 — one business contact's cases (also those of contacts merged into it). */
|
|
3068
|
+
contactId?: string;
|
|
3055
3069
|
}
|
|
3056
3070
|
/** The time a booking holds (a snapshot: your App's agenda decides what is free). */
|
|
3057
3071
|
export interface CaseSlot {
|
|
@@ -3076,6 +3090,7 @@ export interface CreateDirectBookingInput {
|
|
|
3076
3090
|
ref: string;
|
|
3077
3091
|
name: string;
|
|
3078
3092
|
phone: string;
|
|
3093
|
+
contactId?: string;
|
|
3079
3094
|
};
|
|
3080
3095
|
/** A catalog service of the business with a `booking` rule. */
|
|
3081
3096
|
serviceId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.79.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",
|