@agentforge-io/sdk-server 4.33.0 → 4.35.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/client.d.ts +3 -0
- package/dist/client.js +2 -0
- package/dist/errors.js +4 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -1
- package/dist/resources/catalog.d.ts +42 -1
- package/dist/resources/catalog.js +66 -1
- package/dist/resources/contacts.d.ts +161 -0
- package/dist/resources/contacts.js +103 -0
- package/dist/types.d.ts +154 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ChatResource } from './resources/chat';
|
|
|
5
5
|
import { ConnectorsResource } from './resources/connectors';
|
|
6
6
|
import { InboxResource } from './resources/inbox';
|
|
7
7
|
import { InstallationsResource } from './resources/installations';
|
|
8
|
+
import { ContactsResource } from './resources/contacts';
|
|
8
9
|
import { WebhookResource } from './resources/webhook';
|
|
9
10
|
import { ProvisioningResource } from './resources/provisioning';
|
|
10
11
|
import { SecretsResource } from './resources/secrets';
|
|
@@ -91,6 +92,8 @@ export declare class AgentForgeClient {
|
|
|
91
92
|
readonly connectors: ConnectorsResource;
|
|
92
93
|
readonly inbox: InboxResource;
|
|
93
94
|
readonly installations: InstallationsResource;
|
|
95
|
+
/** AGF-CUSTOMER-ACCOUNTS — the business's contacts for the App's end users. */
|
|
96
|
+
readonly contacts: ContactsResource;
|
|
94
97
|
/** Where the platform sends this App its events (AGF-APP-WEBHOOKS). */
|
|
95
98
|
readonly webhook: WebhookResource;
|
|
96
99
|
readonly provisioning: ProvisioningResource;
|
package/dist/client.js
CHANGED
|
@@ -27,6 +27,7 @@ const chat_1 = require("./resources/chat");
|
|
|
27
27
|
const connectors_1 = require("./resources/connectors");
|
|
28
28
|
const inbox_1 = require("./resources/inbox");
|
|
29
29
|
const installations_1 = require("./resources/installations");
|
|
30
|
+
const contacts_1 = require("./resources/contacts");
|
|
30
31
|
const webhook_1 = require("./resources/webhook");
|
|
31
32
|
const provisioning_1 = require("./resources/provisioning");
|
|
32
33
|
const secrets_1 = require("./resources/secrets");
|
|
@@ -73,6 +74,7 @@ class AgentForgeClient {
|
|
|
73
74
|
this.connectors = new connectors_1.ConnectorsResource(this);
|
|
74
75
|
this.inbox = new inbox_1.InboxResource(this);
|
|
75
76
|
this.installations = new installations_1.InstallationsResource(this);
|
|
77
|
+
this.contacts = new contacts_1.ContactsResource(this);
|
|
76
78
|
this.webhook = new webhook_1.WebhookResource(this);
|
|
77
79
|
this.provisioning = new provisioning_1.ProvisioningResource(this);
|
|
78
80
|
this.secrets = new secrets_1.SecretsResource(this);
|
package/dist/errors.js
CHANGED
|
@@ -13,7 +13,10 @@ class AgentForgeError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.AgentForgeError = AgentForgeError;
|
|
16
|
-
|
|
16
|
+
// `CASE_NOT_FOUND`-style codes, and the lowercase snake_case codes of the
|
|
17
|
+
// contacts / verification routes (`rate_limited`, `invalid_code`). Nest's
|
|
18
|
+
// status text ("Bad Request") matches neither.
|
|
19
|
+
const ERROR_CODE = /^(?:[A-Z][A-Z0-9_]+|[a-z][a-z0-9]*(?:_[a-z0-9]+)+)$/;
|
|
17
20
|
function parseErrorCode(body) {
|
|
18
21
|
if (!body)
|
|
19
22
|
return undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
|
|
|
3
3
|
export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
|
|
4
4
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
5
5
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
6
|
-
export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
6
|
+
export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, 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, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CreateDirectOrderInput, DirectOrderForm, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
7
7
|
export { AgentsResource } from './resources/agents';
|
|
8
8
|
export { AnalyticsResource } from './resources/analytics';
|
|
9
9
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -21,10 +21,12 @@ export { MarketplaceResource } from './resources/marketplace';
|
|
|
21
21
|
export type { ListMarketplaceCategoriesInput } from './resources/marketplace';
|
|
22
22
|
export { TenantConfigResource } from './resources/config';
|
|
23
23
|
export { PlacesResource } from './resources/places';
|
|
24
|
+
export { ContactsResource, ContactVerificationResource } from './resources/contacts';
|
|
25
|
+
export type { ContactVerificationChannel, LinkContactInput, LinkContactResult, AppContact, ContactAvatarUploadTarget, ClaimContactInput, ClaimContactResult, StartVerificationInput, StartVerificationResult, ConfirmVerificationInput, ConfirmVerificationResult, } from './resources/contacts';
|
|
24
26
|
export { DeliveryResource } from './resources/delivery';
|
|
25
27
|
export { CasesResource } from './resources/cases';
|
|
26
28
|
export { BusinessRolesResource } from './resources/business-roles';
|
|
27
|
-
export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
|
|
29
|
+
export { CatalogResource, CatalogCategoriesResource, CatalogProductsResource, CatalogPhotosResource, CatalogImportResource, CatalogFileImportResource, CatalogMenuImportResource, CatalogOptionGroupsResource, CatalogSourcesResource, AgentForgeCatalogImportLimitError, CATALOG_IMPORT_MAX_ITEMS, } from './resources/catalog';
|
|
28
30
|
export type { ListThreadsOptions, SendMessageInput, AssignThreadInput, UnassignThreadInput, SetThreadModeInput, CloseThreadInput, } from './resources/inbox';
|
|
29
31
|
export { ProvisioningResource } from './resources/provisioning';
|
|
30
32
|
export type { ProvisionedTenant, ProvisionedApp, ProvisionedTeam, } from './resources/provisioning';
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
// const payload = af.tools.verifyCallback({ rawBody, signatureHeader, secretPlaintext });
|
|
29
29
|
// await af.tools.respondToCallback({ resultUrl: payload.resultUrl, tenantId: payload.tenantId, secret, result });
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.CasesResource = exports.DeliveryResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
|
|
31
|
+
exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogOptionGroupsResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = exports.CasesResource = exports.DeliveryResource = exports.ContactVerificationResource = exports.ContactsResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_HEADERS = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
|
|
32
32
|
var client_1 = require("./client");
|
|
33
33
|
Object.defineProperty(exports, "AgentForgeClient", { enumerable: true, get: function () { return client_1.AgentForgeClient; } });
|
|
34
34
|
Object.defineProperty(exports, "INSTALLED_TENANT_HEADER", { enumerable: true, get: function () { return client_1.INSTALLED_TENANT_HEADER; } });
|
|
@@ -69,6 +69,9 @@ var config_1 = require("./resources/config");
|
|
|
69
69
|
Object.defineProperty(exports, "TenantConfigResource", { enumerable: true, get: function () { return config_1.TenantConfigResource; } });
|
|
70
70
|
var places_1 = require("./resources/places");
|
|
71
71
|
Object.defineProperty(exports, "PlacesResource", { enumerable: true, get: function () { return places_1.PlacesResource; } });
|
|
72
|
+
var contacts_1 = require("./resources/contacts");
|
|
73
|
+
Object.defineProperty(exports, "ContactsResource", { enumerable: true, get: function () { return contacts_1.ContactsResource; } });
|
|
74
|
+
Object.defineProperty(exports, "ContactVerificationResource", { enumerable: true, get: function () { return contacts_1.ContactVerificationResource; } });
|
|
72
75
|
var delivery_1 = require("./resources/delivery");
|
|
73
76
|
Object.defineProperty(exports, "DeliveryResource", { enumerable: true, get: function () { return delivery_1.DeliveryResource; } });
|
|
74
77
|
var cases_1 = require("./resources/cases");
|
|
@@ -82,6 +85,8 @@ Object.defineProperty(exports, "CatalogProductsResource", { enumerable: true, ge
|
|
|
82
85
|
Object.defineProperty(exports, "CatalogPhotosResource", { enumerable: true, get: function () { return catalog_1.CatalogPhotosResource; } });
|
|
83
86
|
Object.defineProperty(exports, "CatalogImportResource", { enumerable: true, get: function () { return catalog_1.CatalogImportResource; } });
|
|
84
87
|
Object.defineProperty(exports, "CatalogFileImportResource", { enumerable: true, get: function () { return catalog_1.CatalogFileImportResource; } });
|
|
88
|
+
Object.defineProperty(exports, "CatalogMenuImportResource", { enumerable: true, get: function () { return catalog_1.CatalogMenuImportResource; } });
|
|
89
|
+
Object.defineProperty(exports, "CatalogOptionGroupsResource", { enumerable: true, get: function () { return catalog_1.CatalogOptionGroupsResource; } });
|
|
85
90
|
Object.defineProperty(exports, "CatalogSourcesResource", { enumerable: true, get: function () { return catalog_1.CatalogSourcesResource; } });
|
|
86
91
|
Object.defineProperty(exports, "AgentForgeCatalogImportLimitError", { enumerable: true, get: function () { return catalog_1.AgentForgeCatalogImportLimitError; } });
|
|
87
92
|
Object.defineProperty(exports, "CATALOG_IMPORT_MAX_ITEMS", { enumerable: true, get: function () { return catalog_1.CATALOG_IMPORT_MAX_ITEMS; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
2
|
import { AgentForgeError } from '../errors';
|
|
3
|
-
import type { AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
|
|
3
|
+
import type { AttachCatalogPhotoInput, Catalog, CatalogCategory, CatalogFileApplyInput, CatalogFileApplyResult, CatalogOptionChange, CatalogOptionChangesPlan, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogFilePreview, CatalogFilePreviewInput, CatalogImportApplyResult, CatalogImportItem, CatalogImportPreview, CatalogImportSource, CatalogImportSourcePreview, CatalogImportRunResult, CatalogPhotoUploadTarget, CatalogProduct, CatalogProductPage, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, CreateCatalogCategoryInput, CreateCatalogImportSourceInput, CreateCatalogProductInput, ListCatalogProductsInput, PreviewCatalogImportSourceInput, SignCatalogPhotoUploadInput, UpdateCatalogCategoryInput, UpdateCatalogImportSourceInput, UpdateCatalogProductInput, UpsertCatalogInput } from '../types';
|
|
4
4
|
/** Max structured items per `import.preview/apply` call (platform cap). */
|
|
5
5
|
export declare const CATALOG_IMPORT_MAX_ITEMS = 200;
|
|
6
6
|
/** Thrown client-side, before any request, when `items` exceeds the cap. */
|
|
@@ -38,6 +38,29 @@ export declare class CatalogPhotosResource {
|
|
|
38
38
|
/** `PATCH …/photos/cover` */
|
|
39
39
|
setCover(productId: string, url: string): Promise<CatalogProduct>;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* AGF-MENU-OPTIONS M2 — the catalog's option groups library (sauces, sizes,
|
|
43
|
+
* sides, «sin cebolla»), reused by products through `optionGroupIds`.
|
|
44
|
+
*/
|
|
45
|
+
export declare class CatalogOptionGroupsResource {
|
|
46
|
+
private readonly client;
|
|
47
|
+
constructor(client: AgentForgeClient);
|
|
48
|
+
/** `GET /option-groups` */
|
|
49
|
+
list(): Promise<CatalogOptionGroup[]>;
|
|
50
|
+
/** `POST /option-groups` — create, or replace the group with the same `id`. 400 `INVALID_OPTION_GROUP`. */
|
|
51
|
+
save(input: SaveCatalogOptionGroupInput): Promise<CatalogOptionGroup>;
|
|
52
|
+
/** `DELETE /option-groups/:id` — also takes it off every product. */
|
|
53
|
+
delete(groupId: string): Promise<{
|
|
54
|
+
removed: boolean;
|
|
55
|
+
products: number;
|
|
56
|
+
}>;
|
|
57
|
+
/** `POST /option-groups/changes/preview` — plan of changes (writes nothing). 400 with the reason. */
|
|
58
|
+
previewChanges(changes: CatalogOptionChange[]): Promise<CatalogOptionChangesPlan>;
|
|
59
|
+
/** `POST /option-groups/changes/apply` — applies the changes the owner confirmed. */
|
|
60
|
+
applyChanges(changes: CatalogOptionChange[]): Promise<CatalogOptionChangesPlan>;
|
|
61
|
+
/** `PATCH /option-groups/:id/availability` — one option on or off («hoy no hay BBQ»). */
|
|
62
|
+
setAvailability(groupId: string, option: string, isAvailable: boolean): Promise<CatalogOptionGroup>;
|
|
63
|
+
}
|
|
41
64
|
export declare class CatalogProductsResource {
|
|
42
65
|
private readonly client;
|
|
43
66
|
readonly photos: CatalogPhotosResource;
|
|
@@ -72,9 +95,26 @@ export declare class CatalogFileImportResource {
|
|
|
72
95
|
* (field → exact header). Needs a catalog. */
|
|
73
96
|
apply(input: CatalogFileApplyInput): Promise<CatalogFileApplyResult>;
|
|
74
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* AGF-MENU-OPTIONS M1 — a catalog read by AI from what the business has: pasted
|
|
100
|
+
* text, a photo of the menu, a PDF, a Word (.docx), an Excel/CSV. `read` writes
|
|
101
|
+
* nothing (items + what importing them would do); the owner confirms (maybe
|
|
102
|
+
* edits) and `apply` imports them — same name = update. Never quantities.
|
|
103
|
+
*/
|
|
104
|
+
export declare class CatalogMenuImportResource {
|
|
105
|
+
private readonly client;
|
|
106
|
+
constructor(client: AgentForgeClient);
|
|
107
|
+
/** `POST /import/menu/read` (multipart) — `text` and/or a `file` (≤10 MB). Can take a minute. */
|
|
108
|
+
read(input: CatalogMenuReadInput): Promise<CatalogMenuRead>;
|
|
109
|
+
/** `POST /import/menu/apply` — the confirmed items (max 200). */
|
|
110
|
+
apply(items: CatalogMenuItem[], opts?: {
|
|
111
|
+
kind?: 'product' | 'service';
|
|
112
|
+
}): Promise<CatalogFileApplyResult>;
|
|
113
|
+
}
|
|
75
114
|
export declare class CatalogImportResource {
|
|
76
115
|
private readonly client;
|
|
77
116
|
readonly file: CatalogFileImportResource;
|
|
117
|
+
readonly menu: CatalogMenuImportResource;
|
|
78
118
|
constructor(client: AgentForgeClient);
|
|
79
119
|
/** `POST /import/preview` — validate structured items WITHOUT writing. Max 200
|
|
80
120
|
* (throws `AgentForgeCatalogImportLimitError` above that, before any request). */
|
|
@@ -134,6 +174,7 @@ export declare class CatalogResource {
|
|
|
134
174
|
readonly products: CatalogProductsResource;
|
|
135
175
|
readonly import: CatalogImportResource;
|
|
136
176
|
readonly sources: CatalogSourcesResource;
|
|
177
|
+
readonly optionGroups: CatalogOptionGroupsResource;
|
|
137
178
|
constructor(client: AgentForgeClient);
|
|
138
179
|
/** `GET /api/v1/catalog` — the tenant's catalog, or `null` when it has none yet
|
|
139
180
|
* (404 `CATALOG_NOT_FOUND`). Other 404s still throw. */
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// machine-readable code (`CATALOG_NOT_FOUND`, `FILE_EMPTY_FILE`,
|
|
17
17
|
// `INVALID_MAPPING`, `TOO_MANY_ITEMS`, …).
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
|
|
19
|
+
exports.CatalogResource = exports.CatalogSourcesResource = exports.CatalogImportResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogProductsResource = exports.CatalogOptionGroupsResource = exports.CatalogPhotosResource = exports.CatalogCategoriesResource = exports.AgentForgeCatalogImportLimitError = exports.CATALOG_IMPORT_MAX_ITEMS = void 0;
|
|
20
20
|
const errors_1 = require("../errors");
|
|
21
21
|
const BASE = '/api/v1/catalog';
|
|
22
22
|
const TENANT_AUTH = { forceApiKey: true };
|
|
@@ -110,6 +110,40 @@ class CatalogPhotosResource {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
exports.CatalogPhotosResource = CatalogPhotosResource;
|
|
113
|
+
/**
|
|
114
|
+
* AGF-MENU-OPTIONS M2 — the catalog's option groups library (sauces, sizes,
|
|
115
|
+
* sides, «sin cebolla»), reused by products through `optionGroupIds`.
|
|
116
|
+
*/
|
|
117
|
+
class CatalogOptionGroupsResource {
|
|
118
|
+
constructor(client) {
|
|
119
|
+
this.client = client;
|
|
120
|
+
}
|
|
121
|
+
/** `GET /option-groups` */
|
|
122
|
+
async list() {
|
|
123
|
+
return (await this.client.request('GET', `${BASE}/option-groups`, undefined, TENANT_AUTH)).items;
|
|
124
|
+
}
|
|
125
|
+
/** `POST /option-groups` — create, or replace the group with the same `id`. 400 `INVALID_OPTION_GROUP`. */
|
|
126
|
+
async save(input) {
|
|
127
|
+
return this.client.request('POST', `${BASE}/option-groups`, input, TENANT_AUTH);
|
|
128
|
+
}
|
|
129
|
+
/** `DELETE /option-groups/:id` — also takes it off every product. */
|
|
130
|
+
async delete(groupId) {
|
|
131
|
+
return this.client.request('DELETE', `${BASE}/option-groups/${seg(groupId)}`, undefined, TENANT_AUTH);
|
|
132
|
+
}
|
|
133
|
+
/** `POST /option-groups/changes/preview` — plan of changes (writes nothing). 400 with the reason. */
|
|
134
|
+
async previewChanges(changes) {
|
|
135
|
+
return this.client.request('POST', `${BASE}/option-groups/changes/preview`, { changes }, TENANT_AUTH);
|
|
136
|
+
}
|
|
137
|
+
/** `POST /option-groups/changes/apply` — applies the changes the owner confirmed. */
|
|
138
|
+
async applyChanges(changes) {
|
|
139
|
+
return this.client.request('POST', `${BASE}/option-groups/changes/apply`, { changes }, TENANT_AUTH);
|
|
140
|
+
}
|
|
141
|
+
/** `PATCH /option-groups/:id/availability` — one option on or off («hoy no hay BBQ»). */
|
|
142
|
+
async setAvailability(groupId, option, isAvailable) {
|
|
143
|
+
return this.client.request('PATCH', `${BASE}/option-groups/${seg(groupId)}/availability`, { option, isAvailable }, TENANT_AUTH);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.CatalogOptionGroupsResource = CatalogOptionGroupsResource;
|
|
113
147
|
class CatalogProductsResource {
|
|
114
148
|
constructor(client) {
|
|
115
149
|
this.client = client;
|
|
@@ -179,10 +213,40 @@ class CatalogFileImportResource {
|
|
|
179
213
|
}
|
|
180
214
|
}
|
|
181
215
|
exports.CatalogFileImportResource = CatalogFileImportResource;
|
|
216
|
+
/**
|
|
217
|
+
* AGF-MENU-OPTIONS M1 — a catalog read by AI from what the business has: pasted
|
|
218
|
+
* text, a photo of the menu, a PDF, a Word (.docx), an Excel/CSV. `read` writes
|
|
219
|
+
* nothing (items + what importing them would do); the owner confirms (maybe
|
|
220
|
+
* edits) and `apply` imports them — same name = update. Never quantities.
|
|
221
|
+
*/
|
|
222
|
+
class CatalogMenuImportResource {
|
|
223
|
+
constructor(client) {
|
|
224
|
+
this.client = client;
|
|
225
|
+
}
|
|
226
|
+
/** `POST /import/menu/read` (multipart) — `text` and/or a `file` (≤10 MB). Can take a minute. */
|
|
227
|
+
async read(input) {
|
|
228
|
+
const form = new FormData();
|
|
229
|
+
if (input.text !== undefined)
|
|
230
|
+
form.append('text', input.text);
|
|
231
|
+
if (input.file !== undefined) {
|
|
232
|
+
const raw = toBlob(input.file);
|
|
233
|
+
const blob = input.mimeType && !raw.type ? new Blob([raw], { type: input.mimeType }) : raw;
|
|
234
|
+
form.append('file', blob, input.filename ?? 'menu');
|
|
235
|
+
}
|
|
236
|
+
const res = await this.client.requestRaw('POST', `${BASE}/import/menu/read`, { ...TENANT_AUTH, formData: form, timeoutMs: 180000 });
|
|
237
|
+
return (await res.json());
|
|
238
|
+
}
|
|
239
|
+
/** `POST /import/menu/apply` — the confirmed items (max 200). */
|
|
240
|
+
async apply(items, opts = {}) {
|
|
241
|
+
return this.client.request('POST', `${BASE}/import/menu/apply`, { items, ...opts }, { ...TENANT_AUTH, timeoutMs: 120000 });
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
exports.CatalogMenuImportResource = CatalogMenuImportResource;
|
|
182
245
|
class CatalogImportResource {
|
|
183
246
|
constructor(client) {
|
|
184
247
|
this.client = client;
|
|
185
248
|
this.file = new CatalogFileImportResource(client);
|
|
249
|
+
this.menu = new CatalogMenuImportResource(client);
|
|
186
250
|
}
|
|
187
251
|
/** `POST /import/preview` — validate structured items WITHOUT writing. Max 200
|
|
188
252
|
* (throws `AgentForgeCatalogImportLimitError` above that, before any request). */
|
|
@@ -269,6 +333,7 @@ class CatalogResource {
|
|
|
269
333
|
this.categories = new CatalogCategoriesResource(client);
|
|
270
334
|
this.products = new CatalogProductsResource(client);
|
|
271
335
|
this.import = new CatalogImportResource(client);
|
|
336
|
+
this.optionGroups = new CatalogOptionGroupsResource(client);
|
|
272
337
|
this.sources = new CatalogSourcesResource(client);
|
|
273
338
|
}
|
|
274
339
|
/** `GET /api/v1/catalog` — the tenant's catalog, or `null` when it has none yet
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { AgentForgeClient } from '../client';
|
|
2
|
+
/**
|
|
3
|
+
* `whatsapp` / `sms`: a code sent to the person (Twilio Verify). `email`: a
|
|
4
|
+
* code by email. `whatsapp_reply` («WhatsApp inverso»): the person sends the
|
|
5
|
+
* code FROM their WhatsApp to the platform's verification number — no
|
|
6
|
+
* template, no Meta business verification; poll `confirm` until it arrives.
|
|
7
|
+
*/
|
|
8
|
+
export type ContactVerificationChannel = 'whatsapp' | 'sms' | 'email' | 'whatsapp_reply';
|
|
9
|
+
export interface LinkContactInput {
|
|
10
|
+
/** The App's id for its end user in THIS business (e.g. `cust:<handle>:<id>`). */
|
|
11
|
+
externalUserId: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
/** E.164 (`+57…`). Unverified unless `verificationToken` proves it. */
|
|
14
|
+
phone?: {
|
|
15
|
+
e164: string;
|
|
16
|
+
verificationToken?: string;
|
|
17
|
+
};
|
|
18
|
+
/** `verified: true` = the App verified it itself (e.g. a Google ID token). */
|
|
19
|
+
email?: {
|
|
20
|
+
value: string;
|
|
21
|
+
verified?: boolean;
|
|
22
|
+
verificationToken?: string;
|
|
23
|
+
};
|
|
24
|
+
/** The consent the person accepted for this business. */
|
|
25
|
+
consent?: {
|
|
26
|
+
version: string;
|
|
27
|
+
at?: string;
|
|
28
|
+
};
|
|
29
|
+
/** The person's photo: an https URL (their sign-in provider's picture, or `avatar.signUpload`'s `publicUrl`). */
|
|
30
|
+
avatarUrl?: string;
|
|
31
|
+
/** Opaque partition the App stamps on the link. */
|
|
32
|
+
ownerRef?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface LinkContactResult {
|
|
35
|
+
contactId: string;
|
|
36
|
+
created: boolean;
|
|
37
|
+
/** The link merged this person with an existing contact of the business. */
|
|
38
|
+
merged: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface AppContact {
|
|
41
|
+
contactId: string;
|
|
42
|
+
name: string | null;
|
|
43
|
+
phone: string | null;
|
|
44
|
+
phoneVerified: boolean;
|
|
45
|
+
email: string | null;
|
|
46
|
+
emailVerified: boolean;
|
|
47
|
+
consentVersion: string | null;
|
|
48
|
+
avatarUrl: string | null;
|
|
49
|
+
}
|
|
50
|
+
/** A signed PUT for an end user's photo: PUT the bytes to `uploadUrl`, then link/update with `avatarUrl: publicUrl`. */
|
|
51
|
+
export interface ContactAvatarUploadTarget {
|
|
52
|
+
uploadUrl: string;
|
|
53
|
+
publicUrl: string;
|
|
54
|
+
key: string;
|
|
55
|
+
expiresInSeconds: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ClaimContactInput {
|
|
58
|
+
/** The signed-in end user that receives the history. */
|
|
59
|
+
externalUserId: string;
|
|
60
|
+
/** Anonymous end users of the same person on this business (≤ 20). */
|
|
61
|
+
fromExternalUserIds: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface ClaimContactResult {
|
|
64
|
+
conversations: number;
|
|
65
|
+
messages: number;
|
|
66
|
+
approvals: number;
|
|
67
|
+
cases: number;
|
|
68
|
+
}
|
|
69
|
+
export interface StartVerificationInput {
|
|
70
|
+
channel: ContactVerificationChannel;
|
|
71
|
+
/** E.164 phone for whatsapp/sms, an email for email. */
|
|
72
|
+
to: string;
|
|
73
|
+
locale?: 'es' | 'en';
|
|
74
|
+
/** The name the person reads in the WhatsApp message / email («PoodleDeck»). */
|
|
75
|
+
brand?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface StartVerificationResult {
|
|
78
|
+
sent: true;
|
|
79
|
+
channel: ContactVerificationChannel;
|
|
80
|
+
resendAfterSec: number;
|
|
81
|
+
expiresInSec: number;
|
|
82
|
+
/** `whatsapp_reply` only: what the person sends, to which number, and a wa.me link with it written. */
|
|
83
|
+
reply?: {
|
|
84
|
+
code: string;
|
|
85
|
+
to: string;
|
|
86
|
+
message: string;
|
|
87
|
+
link: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface ConfirmVerificationInput {
|
|
91
|
+
channel: ContactVerificationChannel;
|
|
92
|
+
to: string;
|
|
93
|
+
code: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ConfirmVerificationResult {
|
|
96
|
+
verified: true;
|
|
97
|
+
kind: 'phone' | 'email';
|
|
98
|
+
/** Normalised value (E.164 / lowercase email). */
|
|
99
|
+
value: string;
|
|
100
|
+
channel: ContactVerificationChannel;
|
|
101
|
+
/** Proof for THIS App; send it on `contacts.link` in any business. */
|
|
102
|
+
verificationToken: string;
|
|
103
|
+
expiresAt: string;
|
|
104
|
+
}
|
|
105
|
+
export declare class ContactVerificationResource {
|
|
106
|
+
private readonly client;
|
|
107
|
+
constructor(client: AgentForgeClient);
|
|
108
|
+
/**
|
|
109
|
+
* `POST /api/v1/contacts/verification/start` — send a code. Errors carry
|
|
110
|
+
* `code`: `invalid_channel`, `invalid_phone`, `invalid_email`,
|
|
111
|
+
* `country_not_allowed`, `verification_failed` (channel not available for
|
|
112
|
+
* the number — offer SMS), `rate_limited` (body `retryAfterSec`),
|
|
113
|
+
* `verification_unavailable`.
|
|
114
|
+
*/
|
|
115
|
+
start(input: StartVerificationInput): Promise<StartVerificationResult>;
|
|
116
|
+
/**
|
|
117
|
+
* `POST /api/v1/contacts/verification/confirm`. Errors: `invalid_code`
|
|
118
|
+
* (email codes add `attemptsLeft`), `code_expired`, `too_many_attempts`;
|
|
119
|
+
* `whatsapp_reply`: 409 `verification_pending` until the message arrives
|
|
120
|
+
* (poll every ~2 s), 410 `code_expired` after 10 minutes.
|
|
121
|
+
*/
|
|
122
|
+
confirm(input: ConfirmVerificationInput): Promise<ConfirmVerificationResult>;
|
|
123
|
+
}
|
|
124
|
+
export declare class ContactsResource {
|
|
125
|
+
private readonly client;
|
|
126
|
+
readonly verification: ContactVerificationResource;
|
|
127
|
+
constructor(client: AgentForgeClient);
|
|
128
|
+
/**
|
|
129
|
+
* `POST /api/v1/contacts/avatar/sign-upload` — where to PUT an end user's
|
|
130
|
+
* photo (jpeg/png/webp/gif, 2 MB at most). App-wide: the same URL serves
|
|
131
|
+
* every business the App links the person to. Errors: `unsupported_type`,
|
|
132
|
+
* `too_large`, 501 `not_configured`.
|
|
133
|
+
*/
|
|
134
|
+
signAvatarUpload(input: {
|
|
135
|
+
contentType: string;
|
|
136
|
+
contentLength?: number;
|
|
137
|
+
}): Promise<ContactAvatarUploadTarget>;
|
|
138
|
+
/** `POST /api/v1/contacts/link`. A phone without a valid token → `phone_verification_required`. */
|
|
139
|
+
link(input: LinkContactInput): Promise<LinkContactResult>;
|
|
140
|
+
/** `POST /api/v1/contacts/claim`. */
|
|
141
|
+
claim(input: ClaimContactInput): Promise<ClaimContactResult>;
|
|
142
|
+
/** `GET /api/v1/contacts?externalUserId=` — `null` when there is no contact. */
|
|
143
|
+
get(externalUserId: string): Promise<AppContact | null>;
|
|
144
|
+
/** `PATCH /api/v1/contacts` — name / phone (phone verified only with a token) / photo. 404 when unknown. */
|
|
145
|
+
update(input: {
|
|
146
|
+
externalUserId: string;
|
|
147
|
+
name?: string;
|
|
148
|
+
phone?: {
|
|
149
|
+
e164: string;
|
|
150
|
+
verificationToken?: string;
|
|
151
|
+
};
|
|
152
|
+
avatarUrl?: string;
|
|
153
|
+
}): Promise<AppContact>;
|
|
154
|
+
/**
|
|
155
|
+
* `DELETE /api/v1/contacts?externalUserId=` — the person stops sharing
|
|
156
|
+
* their data with this business: personal fields and identifiers are
|
|
157
|
+
* cleared, orders keep their record as «cliente eliminado». `false` when
|
|
158
|
+
* there was no contact.
|
|
159
|
+
*/
|
|
160
|
+
remove(externalUserId: string): Promise<boolean>;
|
|
161
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// contacts resource — the business's contacts for an App's own end users
|
|
3
|
+
// (AGF-CUSTOMER-ACCOUNTS CA-1/CA-2). App secret only; on an installed tenant
|
|
4
|
+
// call it through `af.forTenant(tenantId)` (one tenant per business).
|
|
5
|
+
//
|
|
6
|
+
// - `link(input)` — `POST /api/v1/contacts/link`. Find-or-create the
|
|
7
|
+
// contact of an end user (`externalUserId`) and attach name, phone,
|
|
8
|
+
// email, consent. A phone or email is verified only with a
|
|
9
|
+
// `verificationToken` from `verification.confirm`; a verified email may
|
|
10
|
+
// merge with an older contact of the business; a phone verified over
|
|
11
|
+
// WhatsApp merges with the business's WhatsApp contact. Idempotent.
|
|
12
|
+
// - `claim({ externalUserId, fromExternalUserIds })` — move anonymous end
|
|
13
|
+
// users' conversations and orders to the signed-in one.
|
|
14
|
+
// - `get(externalUserId)` (null when unknown) · `update(...)` · `remove(...)`
|
|
15
|
+
// (Ley 1581 suppression for this business).
|
|
16
|
+
// - `verification.start / confirm` — WhatsApp / SMS code (Twilio Verify on
|
|
17
|
+
// the platform) or email code; `confirm` returns the `verificationToken`
|
|
18
|
+
// the App keeps with its customer account (180 days) and sends on every
|
|
19
|
+
// `link`, in any business.
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ContactsResource = exports.ContactVerificationResource = void 0;
|
|
22
|
+
const errors_1 = require("../errors");
|
|
23
|
+
class ContactVerificationResource {
|
|
24
|
+
constructor(client) {
|
|
25
|
+
this.client = client;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* `POST /api/v1/contacts/verification/start` — send a code. Errors carry
|
|
29
|
+
* `code`: `invalid_channel`, `invalid_phone`, `invalid_email`,
|
|
30
|
+
* `country_not_allowed`, `verification_failed` (channel not available for
|
|
31
|
+
* the number — offer SMS), `rate_limited` (body `retryAfterSec`),
|
|
32
|
+
* `verification_unavailable`.
|
|
33
|
+
*/
|
|
34
|
+
async start(input) {
|
|
35
|
+
return this.client.request('POST', '/api/v1/contacts/verification/start', input);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `POST /api/v1/contacts/verification/confirm`. Errors: `invalid_code`
|
|
39
|
+
* (email codes add `attemptsLeft`), `code_expired`, `too_many_attempts`;
|
|
40
|
+
* `whatsapp_reply`: 409 `verification_pending` until the message arrives
|
|
41
|
+
* (poll every ~2 s), 410 `code_expired` after 10 minutes.
|
|
42
|
+
*/
|
|
43
|
+
async confirm(input) {
|
|
44
|
+
return this.client.request('POST', '/api/v1/contacts/verification/confirm', input);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ContactVerificationResource = ContactVerificationResource;
|
|
48
|
+
class ContactsResource {
|
|
49
|
+
constructor(client) {
|
|
50
|
+
this.client = client;
|
|
51
|
+
this.verification = new ContactVerificationResource(client);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `POST /api/v1/contacts/avatar/sign-upload` — where to PUT an end user's
|
|
55
|
+
* photo (jpeg/png/webp/gif, 2 MB at most). App-wide: the same URL serves
|
|
56
|
+
* every business the App links the person to. Errors: `unsupported_type`,
|
|
57
|
+
* `too_large`, 501 `not_configured`.
|
|
58
|
+
*/
|
|
59
|
+
async signAvatarUpload(input) {
|
|
60
|
+
return this.client.request('POST', '/api/v1/contacts/avatar/sign-upload', input);
|
|
61
|
+
}
|
|
62
|
+
/** `POST /api/v1/contacts/link`. A phone without a valid token → `phone_verification_required`. */
|
|
63
|
+
async link(input) {
|
|
64
|
+
return this.client.request('POST', '/api/v1/contacts/link', input);
|
|
65
|
+
}
|
|
66
|
+
/** `POST /api/v1/contacts/claim`. */
|
|
67
|
+
async claim(input) {
|
|
68
|
+
return this.client.request('POST', '/api/v1/contacts/claim', input);
|
|
69
|
+
}
|
|
70
|
+
/** `GET /api/v1/contacts?externalUserId=` — `null` when there is no contact. */
|
|
71
|
+
async get(externalUserId) {
|
|
72
|
+
try {
|
|
73
|
+
return await this.client.request('GET', `/api/v1/contacts?externalUserId=${encodeURIComponent(externalUserId)}`);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
if (err instanceof errors_1.AgentForgeNotFoundError)
|
|
77
|
+
return null;
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** `PATCH /api/v1/contacts` — name / phone (phone verified only with a token) / photo. 404 when unknown. */
|
|
82
|
+
async update(input) {
|
|
83
|
+
return this.client.request('PATCH', '/api/v1/contacts', input);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `DELETE /api/v1/contacts?externalUserId=` — the person stops sharing
|
|
87
|
+
* their data with this business: personal fields and identifiers are
|
|
88
|
+
* cleared, orders keep their record as «cliente eliminado». `false` when
|
|
89
|
+
* there was no contact.
|
|
90
|
+
*/
|
|
91
|
+
async remove(externalUserId) {
|
|
92
|
+
try {
|
|
93
|
+
await this.client.request('DELETE', `/api/v1/contacts?externalUserId=${encodeURIComponent(externalUserId)}`);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (err instanceof errors_1.AgentForgeNotFoundError)
|
|
98
|
+
return false;
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.ContactsResource = ContactsResource;
|
package/dist/types.d.ts
CHANGED
|
@@ -1045,6 +1045,8 @@ export interface CatalogProduct {
|
|
|
1045
1045
|
at: string;
|
|
1046
1046
|
}>;
|
|
1047
1047
|
lockedFields: CatalogLockableField[];
|
|
1048
|
+
/** AGF-MENU-OPTIONS M2 — the catalog's option groups this product offers, in order. */
|
|
1049
|
+
optionGroupIds?: string[];
|
|
1048
1050
|
lastSoldAt?: string | null;
|
|
1049
1051
|
demandCount: number;
|
|
1050
1052
|
createdAt: string;
|
|
@@ -1073,6 +1075,95 @@ export interface CreateCatalogProductInput {
|
|
|
1073
1075
|
}
|
|
1074
1076
|
export interface UpdateCatalogProductInput extends Partial<CreateCatalogProductInput> {
|
|
1075
1077
|
sortOrder?: number;
|
|
1078
|
+
/** AGF-MENU-OPTIONS M2 — ids from `catalog.optionGroups.list()`, in order ([] removes them). */
|
|
1079
|
+
optionGroupIds?: string[];
|
|
1080
|
+
}
|
|
1081
|
+
/** AGF-MENU-OPTIONS M2 — one option of a group («BBQ», +1.000). */
|
|
1082
|
+
export interface CatalogOption {
|
|
1083
|
+
id: string;
|
|
1084
|
+
name: string;
|
|
1085
|
+
/** Added to the product's price per unit, in cents (0 = included). */
|
|
1086
|
+
priceDeltaCents: number;
|
|
1087
|
+
/** false: «hoy no hay», hidden from customers. */
|
|
1088
|
+
isAvailable: boolean;
|
|
1089
|
+
}
|
|
1090
|
+
/** AGF-MENU-OPTIONS M2 — a group of the catalog's library («Salsa», «Tamaño»), reused by products. */
|
|
1091
|
+
export interface CatalogOptionGroup {
|
|
1092
|
+
id: string;
|
|
1093
|
+
name: string;
|
|
1094
|
+
/** `single`: one option (a size); `multi`: several. */
|
|
1095
|
+
selection: 'single' | 'multi';
|
|
1096
|
+
required: boolean;
|
|
1097
|
+
min: number;
|
|
1098
|
+
max: number;
|
|
1099
|
+
options: CatalogOption[];
|
|
1100
|
+
}
|
|
1101
|
+
/** Create (no id) or replace (same id) a group. Ids of options kept when given. */
|
|
1102
|
+
export interface SaveCatalogOptionGroupInput {
|
|
1103
|
+
id?: string;
|
|
1104
|
+
name: string;
|
|
1105
|
+
selection: 'single' | 'multi';
|
|
1106
|
+
required?: boolean;
|
|
1107
|
+
min?: number;
|
|
1108
|
+
max?: number;
|
|
1109
|
+
options: Array<{
|
|
1110
|
+
id?: string;
|
|
1111
|
+
name: string;
|
|
1112
|
+
priceDeltaCents?: number;
|
|
1113
|
+
isAvailable?: boolean;
|
|
1114
|
+
}>;
|
|
1115
|
+
}
|
|
1116
|
+
/** AGF-MENU-OPTIONS M3 — one change to the option groups (the owner's chat proposes them). */
|
|
1117
|
+
export type CatalogOptionChange = {
|
|
1118
|
+
op: 'save_group';
|
|
1119
|
+
group: {
|
|
1120
|
+
name: string;
|
|
1121
|
+
selection?: 'single' | 'multi';
|
|
1122
|
+
required?: boolean;
|
|
1123
|
+
max?: number;
|
|
1124
|
+
options: Array<{
|
|
1125
|
+
name: string;
|
|
1126
|
+
priceDeltaCents?: number;
|
|
1127
|
+
isAvailable?: boolean;
|
|
1128
|
+
}>;
|
|
1129
|
+
};
|
|
1130
|
+
} | {
|
|
1131
|
+
op: 'attach' | 'detach';
|
|
1132
|
+
group: string;
|
|
1133
|
+
products: string[];
|
|
1134
|
+
} | {
|
|
1135
|
+
op: 'delete_group';
|
|
1136
|
+
group: string;
|
|
1137
|
+
};
|
|
1138
|
+
/** A plan of option changes as the confirmation card shows it. */
|
|
1139
|
+
export interface CatalogOptionChangesPlan {
|
|
1140
|
+
changes: CatalogOptionChange[];
|
|
1141
|
+
summary: Array<{
|
|
1142
|
+
kind: 'group_created' | 'group_updated';
|
|
1143
|
+
group: string;
|
|
1144
|
+
selection: 'single' | 'multi';
|
|
1145
|
+
required: boolean;
|
|
1146
|
+
max: number;
|
|
1147
|
+
options: Array<{
|
|
1148
|
+
name: string;
|
|
1149
|
+
priceDeltaCents: number;
|
|
1150
|
+
isAvailable: boolean;
|
|
1151
|
+
}>;
|
|
1152
|
+
} | {
|
|
1153
|
+
kind: 'attached' | 'detached';
|
|
1154
|
+
group: string;
|
|
1155
|
+
products: string[];
|
|
1156
|
+
} | {
|
|
1157
|
+
kind: 'group_deleted';
|
|
1158
|
+
group: string;
|
|
1159
|
+
products: number;
|
|
1160
|
+
}>;
|
|
1161
|
+
productsChanged: number;
|
|
1162
|
+
}
|
|
1163
|
+
/** A customer's choice for one group: its name or id and the options' names or ids. */
|
|
1164
|
+
export interface CatalogOptionChoice {
|
|
1165
|
+
group: string;
|
|
1166
|
+
options: string[];
|
|
1076
1167
|
}
|
|
1077
1168
|
export interface ListCatalogProductsInput {
|
|
1078
1169
|
/** Free-text search. */
|
|
@@ -1189,6 +1280,60 @@ export interface CatalogFileApplyResult {
|
|
|
1189
1280
|
photosImported: number;
|
|
1190
1281
|
warnings: string[];
|
|
1191
1282
|
}
|
|
1283
|
+
/** AGF-MENU-OPTIONS M1 — one item of a menu read (never a quantity). */
|
|
1284
|
+
export interface CatalogMenuItem {
|
|
1285
|
+
category?: string;
|
|
1286
|
+
title: string;
|
|
1287
|
+
description?: string;
|
|
1288
|
+
/** Integer cents; null = no price («a consultar»). */
|
|
1289
|
+
priceCents: number | null;
|
|
1290
|
+
/** The price as the menu wrote it. */
|
|
1291
|
+
priceText?: string;
|
|
1292
|
+
/** Look before importing: a price not found in the pasted text, no price, a repeated name. */
|
|
1293
|
+
flags?: Array<'price_not_in_source' | 'no_price' | 'duplicate'>;
|
|
1294
|
+
/** AGF-MENU-OPTIONS M3 — options the menu lists for it; created as library groups on import. */
|
|
1295
|
+
optionGroups?: Array<{
|
|
1296
|
+
name: string;
|
|
1297
|
+
selection: 'single' | 'multi';
|
|
1298
|
+
required: boolean;
|
|
1299
|
+
options: Array<{
|
|
1300
|
+
name: string;
|
|
1301
|
+
priceDeltaCents: number;
|
|
1302
|
+
}>;
|
|
1303
|
+
}>;
|
|
1304
|
+
}
|
|
1305
|
+
export interface CatalogMenuReadInput {
|
|
1306
|
+
/** The pasted menu, or a note to go with the file. */
|
|
1307
|
+
text?: string;
|
|
1308
|
+
/** A photo (JPG/PNG/WebP), PDF, .docx, .xlsx, .csv or .txt (≤10 MB). */
|
|
1309
|
+
file?: CatalogFileInput;
|
|
1310
|
+
filename?: string;
|
|
1311
|
+
mimeType?: string;
|
|
1312
|
+
}
|
|
1313
|
+
export interface CatalogMenuRead {
|
|
1314
|
+
items: CatalogMenuItem[];
|
|
1315
|
+
source: 'text' | 'image' | 'pdf' | 'document' | 'sheet';
|
|
1316
|
+
/** A photo / PDF: prices could not be checked against a text. */
|
|
1317
|
+
pricesUnchecked: boolean;
|
|
1318
|
+
dropped: number;
|
|
1319
|
+
truncated: boolean;
|
|
1320
|
+
note?: string;
|
|
1321
|
+
plan: {
|
|
1322
|
+
willCreate: number;
|
|
1323
|
+
willUpdate: number;
|
|
1324
|
+
unchanged: number;
|
|
1325
|
+
skipped: number;
|
|
1326
|
+
categoriesToCreate: string[];
|
|
1327
|
+
};
|
|
1328
|
+
/** Per item, in order: what importing does. */
|
|
1329
|
+
rows: Array<{
|
|
1330
|
+
title: string;
|
|
1331
|
+
action: 'create' | 'update' | 'unchanged';
|
|
1332
|
+
changes?: string[];
|
|
1333
|
+
}>;
|
|
1334
|
+
warnings: string[];
|
|
1335
|
+
currency: string;
|
|
1336
|
+
}
|
|
1192
1337
|
/** Binary file accepted by the file-import calls. */
|
|
1193
1338
|
export type CatalogFileInput = Blob | ArrayBuffer | Uint8Array;
|
|
1194
1339
|
export interface CatalogFilePreviewInput {
|
|
@@ -1847,6 +1992,12 @@ export interface CaseReceiptLine {
|
|
|
1847
1992
|
currency: string;
|
|
1848
1993
|
priceKind: 'fixed' | 'from' | 'per_unit' | 'on_request';
|
|
1849
1994
|
unit?: string;
|
|
1995
|
+
/** AGF-MENU-OPTIONS M2 — the options chosen; `unitCents` already includes them. */
|
|
1996
|
+
options?: Array<{
|
|
1997
|
+
group: string;
|
|
1998
|
+
name: string;
|
|
1999
|
+
deltaCents: number;
|
|
2000
|
+
}>;
|
|
1850
2001
|
}
|
|
1851
2002
|
/**
|
|
1852
2003
|
* AGF-CASE-RECEIPT — a case's receipt as its public link shows it: what the
|
|
@@ -1916,10 +2067,12 @@ export interface CreateDirectOrderInput {
|
|
|
1916
2067
|
name: string;
|
|
1917
2068
|
phone: string;
|
|
1918
2069
|
};
|
|
1919
|
-
/** Products of the business's catalog and how many of each.
|
|
2070
|
+
/** Products of the business's catalog and how many of each. `options`: the choice for a
|
|
2071
|
+
* product with option groups (AGF-MENU-OPTIONS M2; a required group left out → 400). */
|
|
1920
2072
|
lines: Array<{
|
|
1921
2073
|
productId: string;
|
|
1922
2074
|
quantity: number;
|
|
2075
|
+
options?: CatalogOptionChoice[];
|
|
1923
2076
|
}>;
|
|
1924
2077
|
/** The order type's other fields (entrega, direccion, notas…), by key. */
|
|
1925
2078
|
fields?: Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.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",
|