@ecodrix/erix-api 4.1.0 → 4.2.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/cli.js +4 -4
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/esm/index.d.ts +96 -2
- package/dist/ts/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/ts/esm/index.d.ts
CHANGED
|
@@ -227,6 +227,10 @@ interface CustomAgent {
|
|
|
227
227
|
templateId: string | null;
|
|
228
228
|
channels: AgentChannel[];
|
|
229
229
|
isDefault: boolean;
|
|
230
|
+
/** Bookings run without a person's approval when its autonomy lets it act (default false). */
|
|
231
|
+
autoConfirmBookings: boolean;
|
|
232
|
+
/** Email replies may go out on their own, only in a thread the customer started (default false). */
|
|
233
|
+
autoSendEmail: boolean;
|
|
230
234
|
createdBy: string | null;
|
|
231
235
|
createdAt: string;
|
|
232
236
|
/** The tools switched on, described. */
|
|
@@ -325,6 +329,8 @@ type CustomAgentPatch = ModuleAgentPatch & {
|
|
|
325
329
|
description?: string;
|
|
326
330
|
instructions?: string;
|
|
327
331
|
channels?: AgentChannel[];
|
|
332
|
+
autoConfirmBookings?: boolean;
|
|
333
|
+
autoSendEmail?: boolean;
|
|
328
334
|
};
|
|
329
335
|
/** What "Try it" sends: one message, plus the builder's unsaved draft if any. */
|
|
330
336
|
interface TryAgentInput {
|
|
@@ -7453,6 +7459,14 @@ interface OrganizationUpdateInput {
|
|
|
7453
7459
|
grievanceName?: string | null;
|
|
7454
7460
|
/** Must be a valid email, max 254 characters. */
|
|
7455
7461
|
grievanceEmail?: string | null;
|
|
7462
|
+
/**
|
|
7463
|
+
* The words the workspace shows for its customers, deals, bookings… (keys
|
|
7464
|
+
* `customers`, `contact`, `deals`, `deal`, `bookings`, `booking`, `payments`,
|
|
7465
|
+
* `forms`, `feedback`, `hotLeads`, `campaigns`, `agent`). A string sets a
|
|
7466
|
+
* word (1–40 chars, no `< > { }`); `null` goes back to the business type's
|
|
7467
|
+
* word. `GET /me` returns the resolved `org.vocab` and `org.vocabDefaults`.
|
|
7468
|
+
*/
|
|
7469
|
+
vocab?: Partial<Record<string, string | null>>;
|
|
7456
7470
|
[key: string]: unknown;
|
|
7457
7471
|
}
|
|
7458
7472
|
/**
|
|
@@ -8863,7 +8877,8 @@ declare class Files extends APIResource {
|
|
|
8863
8877
|
* filename: "inv_1.pdf",
|
|
8864
8878
|
* contentType: "application/pdf"
|
|
8865
8879
|
* });
|
|
8866
|
-
* // Now PUT the file to data.uploadUrl
|
|
8880
|
+
* // Now PUT the file to data.uploadUrl with exactly data.headers (they are signed),
|
|
8881
|
+
* // then call confirmUpload({ key: data.key, sizeBytes })
|
|
8867
8882
|
* ```
|
|
8868
8883
|
*/
|
|
8869
8884
|
getUploadUrl<T = any>(params: {
|
|
@@ -8887,6 +8902,71 @@ declare class Files extends APIResource {
|
|
|
8887
8902
|
*/
|
|
8888
8903
|
delete(key: string): Promise<unknown>;
|
|
8889
8904
|
}
|
|
8905
|
+
/** One file of the workspace's Storage library. */
|
|
8906
|
+
interface LibraryFile {
|
|
8907
|
+
id: string;
|
|
8908
|
+
key: string;
|
|
8909
|
+
folder: string;
|
|
8910
|
+
/** The name the person gave the file. */
|
|
8911
|
+
name: string;
|
|
8912
|
+
kind: "image" | "video" | "audio" | "document";
|
|
8913
|
+
bytes: number;
|
|
8914
|
+
status: "ready" | "blocked";
|
|
8915
|
+
blockedReason: string | null;
|
|
8916
|
+
createdAt: string;
|
|
8917
|
+
/** A one-hour link to open it; null while blocked. */
|
|
8918
|
+
url: string | null;
|
|
8919
|
+
/** The lasting public link for files people manage; null for files ERIX uses and while blocked. */
|
|
8920
|
+
publicUrl: string | null;
|
|
8921
|
+
/** True for files ERIX uses (inbox media, call recordings, invoices): not deletable here. */
|
|
8922
|
+
readOnly: boolean;
|
|
8923
|
+
}
|
|
8924
|
+
interface LibraryFolder {
|
|
8925
|
+
folder: string;
|
|
8926
|
+
files: number;
|
|
8927
|
+
bytes: number;
|
|
8928
|
+
readOnly: boolean;
|
|
8929
|
+
}
|
|
8930
|
+
/**
|
|
8931
|
+
* The workspace's Storage library: every file it stores (uploads, inbox media,
|
|
8932
|
+
* call recordings, invoices…), searchable and paged, from the server's file index.
|
|
8933
|
+
*/
|
|
8934
|
+
declare class Library extends APIResource {
|
|
8935
|
+
/**
|
|
8936
|
+
* Newest first. Filter by folder, kind or part of the name; pass the previous
|
|
8937
|
+
* page's `nextCursor` for the next page.
|
|
8938
|
+
*
|
|
8939
|
+
* @example
|
|
8940
|
+
* ```typescript
|
|
8941
|
+
* const { data } = await ecod.infra.storage.library.list({ q: "menu", kind: "document" });
|
|
8942
|
+
* ```
|
|
8943
|
+
*/
|
|
8944
|
+
list(params?: {
|
|
8945
|
+
folder?: string;
|
|
8946
|
+
kind?: LibraryFile["kind"];
|
|
8947
|
+
q?: string;
|
|
8948
|
+
cursor?: string;
|
|
8949
|
+
limit?: number;
|
|
8950
|
+
}): Promise<{
|
|
8951
|
+
success: boolean;
|
|
8952
|
+
data: {
|
|
8953
|
+
files: LibraryFile[];
|
|
8954
|
+
nextCursor: string | null;
|
|
8955
|
+
};
|
|
8956
|
+
}>;
|
|
8957
|
+
/** Files and bytes per folder, biggest first. */
|
|
8958
|
+
folders(): Promise<{
|
|
8959
|
+
success: boolean;
|
|
8960
|
+
data: LibraryFolder[];
|
|
8961
|
+
}>;
|
|
8962
|
+
/** Delete a file. Files ERIX uses are refused (403 `READ_ONLY_FILE`). */
|
|
8963
|
+
remove(id: string): Promise<{
|
|
8964
|
+
success: boolean;
|
|
8965
|
+
data: {
|
|
8966
|
+
deleted: true;
|
|
8967
|
+
};
|
|
8968
|
+
}>;
|
|
8969
|
+
}
|
|
8890
8970
|
|
|
8891
8971
|
/**
|
|
8892
8972
|
* ERIX Voice: the AI phone agent (`/v1/api/infra/connect/voice/*`).
|
|
@@ -9448,6 +9528,8 @@ interface VoiceKycInput {
|
|
|
9448
9528
|
interface VoiceKycUpload {
|
|
9449
9529
|
uploadUrl: string;
|
|
9450
9530
|
key: string;
|
|
9531
|
+
/** Send exactly these headers with the PUT: they are part of the URL's signature. */
|
|
9532
|
+
headers?: Record<string, string>;
|
|
9451
9533
|
expiresAt: string;
|
|
9452
9534
|
}
|
|
9453
9535
|
declare class VoiceCampaigns extends APIResource {
|
|
@@ -9685,6 +9767,12 @@ interface Conversation {
|
|
|
9685
9767
|
accountId?: string | null;
|
|
9686
9768
|
/** That account's name in ERIX. */
|
|
9687
9769
|
accountLabel?: string | null;
|
|
9770
|
+
/**
|
|
9771
|
+
* On a `group: "person"` list: the person this thread belongs to (a contact
|
|
9772
|
+
* `l:<leadId>`, else a number across phone channels `p:<digits>`, else a
|
|
9773
|
+
* channel address `a:<channel>:<address>`). Threads of one person sit together.
|
|
9774
|
+
*/
|
|
9775
|
+
personKey?: string;
|
|
9688
9776
|
}
|
|
9689
9777
|
interface ListParams {
|
|
9690
9778
|
channel?: InboxChannel;
|
|
@@ -9694,6 +9782,8 @@ interface ListParams {
|
|
|
9694
9782
|
offset?: number;
|
|
9695
9783
|
/** Only threads of this Connect account (one WhatsApp number, Instagram account...). */
|
|
9696
9784
|
accountId?: string;
|
|
9785
|
+
/** `person`: a page is `limit` people with all their threads; `total` counts people. */
|
|
9786
|
+
group?: "person";
|
|
9697
9787
|
}
|
|
9698
9788
|
/**
|
|
9699
9789
|
* The unified inbox (WhatsApp, Instagram, Facebook, Telegram, email, webchat)
|
|
@@ -9719,6 +9809,8 @@ declare class Conversations extends APIResource {
|
|
|
9719
9809
|
limit?: number;
|
|
9720
9810
|
before?: string;
|
|
9721
9811
|
}): Promise<T>;
|
|
9812
|
+
/** Close a handled thread, or reopen it. */
|
|
9813
|
+
setStatus<T = any>(conversationId: string, status: "open" | "closed"): Promise<T>;
|
|
9722
9814
|
markRead<T = any>(conversationId: string): Promise<T>;
|
|
9723
9815
|
delete(conversationId: string): Promise<unknown>;
|
|
9724
9816
|
/** Delete 1–100 threads. */
|
|
@@ -10247,6 +10339,8 @@ declare class StorageInfra {
|
|
|
10247
10339
|
readonly files: Files;
|
|
10248
10340
|
readonly folders: Folders;
|
|
10249
10341
|
readonly media: Media;
|
|
10342
|
+
/** The Storage library: every file of the workspace, from the file index. */
|
|
10343
|
+
readonly library: Library;
|
|
10250
10344
|
constructor(client: AxiosInstance);
|
|
10251
10345
|
}
|
|
10252
10346
|
/** Search pages and the browser collector (`/v1/api/infra/serp/*`). */
|
|
@@ -10927,4 +11021,4 @@ interface CustomFieldFilter {
|
|
|
10927
11021
|
value?: unknown;
|
|
10928
11022
|
}
|
|
10929
11023
|
|
|
10930
|
-
export { type AIPersona, APIError, APIResource, type AddOnStatus, type AddOnView, type AgentAutomationTrigger, type AgentAutonomy, type AgentBudget, type AgentChannel, type AgentChatTurn, type AgentDraft, type AgentProposal, type AgentResults, type AgentTemplate, type AgentVersion, AiAgent, type AiAgentSettings, type AiAgentTool, type AiHumanTopics, type AiOutcomeChannel, type AiOutcomeCounts, type AiOutcomes, type AiReviewItem, type AiReviewStats, type AiReviewVerdict, type AiSuggestion, type AnswerFollowupBody, type AnswerOnboardingPayload, type AnswerOnboardingResponse, type AppSetup, type AppSetupStep, type AssignEventPayload, type AudienceChannel, type AudienceFieldRule, type AudienceInput, type AudienceLeftOut, type AudiencePerson, type AudiencePlainRule, type AudiencePreview, type AudienceRule, AuthenticationError, type AutomationCopilotChange, type AutomationCopilotDraft, type AutomationCopilotReach, type AutomationGraph, type AutomationLive, type AutomationLivePerson, type AutomationLiveStep, type AutomationStep, type AutomationTestData, type AutomationTestRunProgress, type AutomationTestRunStart, type AutomationTestRunState, type AutomationTestRunStep, type AutomationVersion, type AutomationVersionDetail, type AutomationVersions, type AutomationWeek, type BehaviorRules, type BuildAnswer, type BuildInput, type CampaignCheck, type CampaignChecks, type CampaignDetail, type CampaignGraph, type CampaignLaunchResult, type CampaignLaunchSummary, type CampaignListItem, type CampaignMode, type CampaignSettingsEdit, type CampaignState, type CampaignWaves, Campaigns, Catalog, type CatalogItem, type CheckboxConfig, type CheckoutAddress, type CheckoutAmounts, type CheckoutCartEditInput, type CheckoutCoupon, type CheckoutCouponInput, type CheckoutCouponPatch, type CheckoutItem, type CheckoutOrder, type CheckoutOrderAction, type CheckoutOrderList, type CheckoutOrderStatus, type CheckoutProduct, type CheckoutProductInput, type CheckoutProductLink, type CheckoutRazorpayVerifyInput, type CheckoutResponse, type CheckoutSession, type CheckoutSettings, type CheckoutVerifyInput, type CheckoutVerifyResult, Collector, type CollectorKind, type CollectorResult, type CollectorTask, type ColorRule, type ColumnConfig, type CompleteOnboardingPayload, type CompleteOnboardingResponse, type ConfidenceResponse, type ConnectAccount, type ConnectAccountPatch, type ConnectAccountRouting, ConnectAccounts, type ConnectAppAccess, ConnectInfra, type ConnectionHealth, type ConnectionView, type Conversation, type ConversationButton, type ConversationButtonTarget, type ConversationCheck, type ConversationCompare, type ConversationConfig, type ConversationDeployment, type ConversationDeploymentKind, type ConversationDeploymentStats, type ConversationField, type ListParams as ConversationListParams, type ConversationMode, type ConversationReplyMessage, type ConversationReplySource, type ConversationRollout, type ConversationSaved, type ConversationStep, type ConversationTest, type ConversationTestRun, type ConversationTopic, type ConversationTopicKind, type ConversationTryReply, type ConversationTurn, type ConversationUsage, type ConversationVersion, type ConversationVersionDetail, type Correction, type CreateAgentInput, type CreateCampaignParams, type CreateConversationDeploymentParams, type CreateConversationParams, type CreateLeadParams, type CreatePipelineParams, type CrmView, type CurrencyConfig, type CurrencyValue, type CustomAgent, type CustomAgentPatch, type CustomAgentView, type CustomFieldFilter, type DateConfig, type DateTimeConfig, type DropdownConfig, type DuplicateLead, ECODrIxAPI as ECODrIx, ECODrIxAPI, type ECODrIxAPIOptions, ERROR_RETRY_CONFIG, type EditOnboardingPayload, type EditOnboardingResponse, type EmailConfig, EmailConnect, ErixChat, ErixProduct, type EventDefinition, type FieldConfig, type FieldDefinition, type FieldManifest, type FieldType, type FileConfig, type FilterOperator, type FilterRule, type FlowAudience, FlowAudiences, FlowAutomations, type FlowBuildPlan, type FlowBuildTarget, type FlowConversation, FlowConversations, type FlowDraftKind, FlowDrafts, type FlowFirstRun, type FlowFirstRunInstall, FlowFirstRunResource, FlowHome, type FlowHomeCounts, type FlowHomeData, type FlowHomeNeed, type FlowHomeUsage, FlowProduct, type FormulaConfig, type GlobalOnboardingPayload, type GrievanceContact, HTTP_STATUS_ERROR_MAP, type ICP, type InboxChannel, InfraDomain, type InviteMemberInput, type InviteResult, KNOWLEDGE_FILE_TYPES, Knowledge, type KnowledgePassage, type KnowledgeSource, LAIE_EVENTS, LEAD_STATUS_VALUES, type LaieAsk, type LaieAssessment, LaieAudits, type LaieBulkResult, type LaieCampaign, type LaieCampaignInput, type LaieCampaignSettings, type LaieCampaignSettingsInput, type LaieCampaignSource, LaieCampaigns, type LaieCell, type LaieCollectInput, LaieCompliance, type LaieConfidence, type LaieCostClass, type LaieCrmImportResult, type LaieEmailCheck, type LaieEnvelope, type LaieFieldEvidence, type LaieFilters, type LaieFindResult, LaieFreshness, type LaieFreshnessStatus, LaieImport, type LaieImportComplete, type LaieLead, type LaieLeadDetail, type LaieLeadListQuery, type LaieLeadUpdate, LaieLeads, LaieLearning, type LaieListEnrichInput, type LaieListEnrichResult, type LaieListRow, LaieLists, type LaieLocality, LaieLookalikes, LaieMarket, type LaieNote, type LaiePack, type LaiePackCategory, type LaiePackId, LaiePacks, type LaiePage, type LaiePipeline, type LaiePipelineSummary, LaieProduct, type LaieRefusal, type LaieRun, type LaieRunChange, type LaieRunQuality, type LaieRunSummary, LaieRuns, type LaieSignalDef, type LaieSignalRow, LaieSignals, type LaieStageInput, type LaieStageName, type LaieStageResult, LaieTools, type LaieUseInput, type LaieUseResult, type LaieWebsiteLookup, type LaunchCampaignParams, type LayoutType, type Lead, type LeadFormView, type LeadFormsView, type LeadPattern, type LeadSource, type LeadStatus, type LearningMemory, type ListLeadsParams, type ManagementMode, type ManifestFieldType, type MappingField, type MappingPreviewResult, type MappingSources, type MappingValidationResult, type MerchantCheckoutSession, type MerchantCheckoutSessionInput, type Message, type ModuleAgent, type ModuleAgentPatch, type ModuleAgentSettings, type ModuleAgentTool, type NichePack, type NichePackResearchConfig, type NichePackStatus, type NormalizedFieldValue, type NumberConfig, Onboarding, type OnboardingCohortRange, type OnboardingConfig, type OnboardingExperiment, type OnboardingExperimentStatus, type OnboardingExperimentVariant, type OnboardingMemoryMapping, type OnboardingOption, type OnboardingSession, type OnboardingSessionStatus, type OnboardingStateResponse, type OnboardingStep, type OnboardingStepType, type OrganizationUpdateInput, type OutboundMedia, type OutreachEdit, type OverageSetting, type PaginatedResponse, type PausedRun, type PermissionKey, type PermissionModuleInfo, type PermissionQuickStart, Persona, type PersonaFollowupQuestion, type PersonaFollowupsResponse, type PersonaIdentity, type PersonaTimelineEntry, type PersonaTimelineOptions, type PersonaTimelineResponse, type PhoneConfig, type Pipeline, type PipelineStage, type PipelineStageParams, type PlaceCheckoutOrderInput, type PlacedCheckoutOrder, PlatformDomain, PlatformTenants, PlatformUsers, ProductDomain, type ProgressConfig, type ProposeAgentChangeInput, type PublicCheckoutOrder, type PublicCheckoutProduct, type PublicCheckoutProductResponse, type PublicMerchantCart, type PublicMerchantSession, type PublicMerchantSessionResponse, RateLimitError, type RatingConfig, type RazorpayCheckoutOptions, type ReinforceResponse, type ReinforcementEvent, type RelationConfig, type RelationValue, type RequestOptions, type ResourceManifest, type SendMessageParams, type SendTemplateParams, SeoAudits, type SeoBacklinkOverview, type SeoBacklinkSite, SeoBacklinks, type SeoBrief, type SeoBriefPage, type SeoBriefResult, SeoBriefs, type SeoCcRelease, type SeoCcReleaseRow, type SeoCompetitor, type SeoDifficulty, type SeoDirectory, type SeoDirectoryListing, type SeoDomainStrength, type SeoEnvelope, type SeoFormat, type SeoGap, type SeoGoogleFeatures, type SeoGridPoint, type SeoGscAccess, type SeoGscDenied, type SeoGscImportResult, type SeoGscRow, type SeoGscSummary, type SeoGscTop, SeoInsights, type SeoKeywordIdea, type SeoLabel, SeoLocal, type SeoLocalCheck, type SeoLocalGrid, type SeoLocalGridRow, type SeoLocalHistoryRow, type SeoMapsProfile, type SeoOwnerVerificationMethod, SeoPerformance, SeoProduct, type SeoProject, type SeoProjectInput, SeoProjects, type SeoRankAddResult, type SeoRankChange, type SeoRankCheckRow, type SeoRankDevice, type SeoRankKeyword, type SeoRankLang, type SeoRankMove, type SeoRankPosition, type SeoRankTargetOptions, SeoRanks, type SeoReferringChanges, type SeoReferringDomain, type SeoReferringDomains, type SeoReport, SeoReports, SeoResearch, type SeoRun, type SeoSchedule, type SeoScoreRule, SeoSearchConsole, type SeoSourced, type SeoTopThree, type SeoVisibility, type SeoVisibilityNow, type SeoVitalsCheck, type SeoVitalsField, type SeoVitalsLab, type SeoVitalsStrategy, type ServiceConfig, type ServiceConfigGlobal, type ServiceConfigPerProduct, type SortRule, type StartOnboardingPayload, type StartOnboardingResponse, type StarterKind, type StarterPack, StorageInfra, type StoredFieldValue, type SuggestionEvent, type TagsConfig, type TeamAccessCatalog, type TeamInvitation, type TeamMember, type Template, type TemplateApiResponse, type TemplateBinding, type TemplateBindingSource, type TemplateButton, type TemplateCheck, type TemplateComponent, type TemplateDraft, type TemplateEmptyPolicy, type TemplateFix, type TemplateMapping, type TemplateResubmitInput, type TemplateResubmitResult, type TextConfig, type TriggerPayload, type TriggerResponse, type TryAgentInput, type TryAgentResult, type TryAgentToolCall, type UnansweredQuestion, type UpdateCampaignParams, type UpdateConversationDeploymentParams, type UpdateConversationParams, type UpdateMemberAccessInput, type UpsertLeadParams, type UrlConfig, VOICE_EVENTS, VOICE_REFUSAL_REASONS, type ViewConfig, type Vocabulary, Voice, type VoiceActivity, type VoiceAfterHours, type VoiceAgent, type VoiceAgentInput, type VoiceAgentSummary, type VoiceAudiencePreview, type VoiceBusinessHours, type VoiceBusinessType, type VoiceCall, type VoiceCallAction, type VoiceCallChanged, type VoiceCallCheck, type VoiceCallDetail, type VoiceCallFilters, type VoiceCallQueued, type VoiceCampaignApproval, type VoiceCampaignCounters, VoiceCampaigns, type VoiceDay, type VoiceDirection, type VoiceDisposition, type VoiceErrorCode, type VoiceForwardSlot, type VoiceFreeNumbers, type VoiceKycDocumentType, type VoiceKycInput, type VoiceKycStatus, type VoiceKycUpload, type VoiceKycView, type VoiceLines, type VoiceLiveStatus, type VoiceNumber, type VoiceNumberPatch, type VoiceOption, type VoicePreviewInput, type VoicePronunciation, type VoicePurpose, type VoiceRefusalCode, type VoiceSetup, type VoiceSetupCurrent, type VoiceSetupStep, type VoiceSkill, type VoiceSkillMap, type VoiceSkillParam, type VoiceSpeakingStyle, type VoiceStatus, type VoiceStyle, type VoiceTool, type VoiceTranscriptTurn, WebchatOwnerSettings, WebchatSettingsPatch, WebhookSignatureError, Webhooks, WhatsAppConnect, type WorkspaceAuditItem, type WorkspaceAuditPage, type WorkspaceAuditParams, type WorkspaceDashboardLayout, type WorkspaceDefaultAutomation, type WorkspaceDefaultField, type WorkspaceDefaultPipeline, type WorkspaceModuleConfig, type WorkspaceProfile, ECODrIxAPI as default, getErrorDetails, getRetryConfig, handleAPIError, isAPIError, laieStageQueued, voiceErrorCode, voiceRefusalReason };
|
|
11024
|
+
export { type AIPersona, APIError, APIResource, type AddOnStatus, type AddOnView, type AgentAutomationTrigger, type AgentAutonomy, type AgentBudget, type AgentChannel, type AgentChatTurn, type AgentDraft, type AgentProposal, type AgentResults, type AgentTemplate, type AgentVersion, AiAgent, type AiAgentSettings, type AiAgentTool, type AiHumanTopics, type AiOutcomeChannel, type AiOutcomeCounts, type AiOutcomes, type AiReviewItem, type AiReviewStats, type AiReviewVerdict, type AiSuggestion, type AnswerFollowupBody, type AnswerOnboardingPayload, type AnswerOnboardingResponse, type AppSetup, type AppSetupStep, type AssignEventPayload, type AudienceChannel, type AudienceFieldRule, type AudienceInput, type AudienceLeftOut, type AudiencePerson, type AudiencePlainRule, type AudiencePreview, type AudienceRule, AuthenticationError, type AutomationCopilotChange, type AutomationCopilotDraft, type AutomationCopilotReach, type AutomationGraph, type AutomationLive, type AutomationLivePerson, type AutomationLiveStep, type AutomationStep, type AutomationTestData, type AutomationTestRunProgress, type AutomationTestRunStart, type AutomationTestRunState, type AutomationTestRunStep, type AutomationVersion, type AutomationVersionDetail, type AutomationVersions, type AutomationWeek, type BehaviorRules, type BuildAnswer, type BuildInput, type CampaignCheck, type CampaignChecks, type CampaignDetail, type CampaignGraph, type CampaignLaunchResult, type CampaignLaunchSummary, type CampaignListItem, type CampaignMode, type CampaignSettingsEdit, type CampaignState, type CampaignWaves, Campaigns, Catalog, type CatalogItem, type CheckboxConfig, type CheckoutAddress, type CheckoutAmounts, type CheckoutCartEditInput, type CheckoutCoupon, type CheckoutCouponInput, type CheckoutCouponPatch, type CheckoutItem, type CheckoutOrder, type CheckoutOrderAction, type CheckoutOrderList, type CheckoutOrderStatus, type CheckoutProduct, type CheckoutProductInput, type CheckoutProductLink, type CheckoutRazorpayVerifyInput, type CheckoutResponse, type CheckoutSession, type CheckoutSettings, type CheckoutVerifyInput, type CheckoutVerifyResult, Collector, type CollectorKind, type CollectorResult, type CollectorTask, type ColorRule, type ColumnConfig, type CompleteOnboardingPayload, type CompleteOnboardingResponse, type ConfidenceResponse, type ConnectAccount, type ConnectAccountPatch, type ConnectAccountRouting, ConnectAccounts, type ConnectAppAccess, ConnectInfra, type ConnectionHealth, type ConnectionView, type Conversation, type ConversationButton, type ConversationButtonTarget, type ConversationCheck, type ConversationCompare, type ConversationConfig, type ConversationDeployment, type ConversationDeploymentKind, type ConversationDeploymentStats, type ConversationField, type ListParams as ConversationListParams, type ConversationMode, type ConversationReplyMessage, type ConversationReplySource, type ConversationRollout, type ConversationSaved, type ConversationStep, type ConversationTest, type ConversationTestRun, type ConversationTopic, type ConversationTopicKind, type ConversationTryReply, type ConversationTurn, type ConversationUsage, type ConversationVersion, type ConversationVersionDetail, type Correction, type CreateAgentInput, type CreateCampaignParams, type CreateConversationDeploymentParams, type CreateConversationParams, type CreateLeadParams, type CreatePipelineParams, type CrmView, type CurrencyConfig, type CurrencyValue, type CustomAgent, type CustomAgentPatch, type CustomAgentView, type CustomFieldFilter, type DateConfig, type DateTimeConfig, type DropdownConfig, type DuplicateLead, ECODrIxAPI as ECODrIx, ECODrIxAPI, type ECODrIxAPIOptions, ERROR_RETRY_CONFIG, type EditOnboardingPayload, type EditOnboardingResponse, type EmailConfig, EmailConnect, ErixChat, ErixProduct, type EventDefinition, type FieldConfig, type FieldDefinition, type FieldManifest, type FieldType, type FileConfig, type FilterOperator, type FilterRule, type FlowAudience, FlowAudiences, FlowAutomations, type FlowBuildPlan, type FlowBuildTarget, type FlowConversation, FlowConversations, type FlowDraftKind, FlowDrafts, type FlowFirstRun, type FlowFirstRunInstall, FlowFirstRunResource, FlowHome, type FlowHomeCounts, type FlowHomeData, type FlowHomeNeed, type FlowHomeUsage, FlowProduct, type FormulaConfig, type GlobalOnboardingPayload, type GrievanceContact, HTTP_STATUS_ERROR_MAP, type ICP, type InboxChannel, InfraDomain, type InviteMemberInput, type InviteResult, KNOWLEDGE_FILE_TYPES, Knowledge, type KnowledgePassage, type KnowledgeSource, LAIE_EVENTS, LEAD_STATUS_VALUES, type LaieAsk, type LaieAssessment, LaieAudits, type LaieBulkResult, type LaieCampaign, type LaieCampaignInput, type LaieCampaignSettings, type LaieCampaignSettingsInput, type LaieCampaignSource, LaieCampaigns, type LaieCell, type LaieCollectInput, LaieCompliance, type LaieConfidence, type LaieCostClass, type LaieCrmImportResult, type LaieEmailCheck, type LaieEnvelope, type LaieFieldEvidence, type LaieFilters, type LaieFindResult, LaieFreshness, type LaieFreshnessStatus, LaieImport, type LaieImportComplete, type LaieLead, type LaieLeadDetail, type LaieLeadListQuery, type LaieLeadUpdate, LaieLeads, LaieLearning, type LaieListEnrichInput, type LaieListEnrichResult, type LaieListRow, LaieLists, type LaieLocality, LaieLookalikes, LaieMarket, type LaieNote, type LaiePack, type LaiePackCategory, type LaiePackId, LaiePacks, type LaiePage, type LaiePipeline, type LaiePipelineSummary, LaieProduct, type LaieRefusal, type LaieRun, type LaieRunChange, type LaieRunQuality, type LaieRunSummary, LaieRuns, type LaieSignalDef, type LaieSignalRow, LaieSignals, type LaieStageInput, type LaieStageName, type LaieStageResult, LaieTools, type LaieUseInput, type LaieUseResult, type LaieWebsiteLookup, type LaunchCampaignParams, type LayoutType, type Lead, type LeadFormView, type LeadFormsView, type LeadPattern, type LeadSource, type LeadStatus, type LearningMemory, type LibraryFile, type LibraryFolder, type ListLeadsParams, type ManagementMode, type ManifestFieldType, type MappingField, type MappingPreviewResult, type MappingSources, type MappingValidationResult, type MerchantCheckoutSession, type MerchantCheckoutSessionInput, type Message, type ModuleAgent, type ModuleAgentPatch, type ModuleAgentSettings, type ModuleAgentTool, type NichePack, type NichePackResearchConfig, type NichePackStatus, type NormalizedFieldValue, type NumberConfig, Onboarding, type OnboardingCohortRange, type OnboardingConfig, type OnboardingExperiment, type OnboardingExperimentStatus, type OnboardingExperimentVariant, type OnboardingMemoryMapping, type OnboardingOption, type OnboardingSession, type OnboardingSessionStatus, type OnboardingStateResponse, type OnboardingStep, type OnboardingStepType, type OrganizationUpdateInput, type OutboundMedia, type OutreachEdit, type OverageSetting, type PaginatedResponse, type PausedRun, type PermissionKey, type PermissionModuleInfo, type PermissionQuickStart, Persona, type PersonaFollowupQuestion, type PersonaFollowupsResponse, type PersonaIdentity, type PersonaTimelineEntry, type PersonaTimelineOptions, type PersonaTimelineResponse, type PhoneConfig, type Pipeline, type PipelineStage, type PipelineStageParams, type PlaceCheckoutOrderInput, type PlacedCheckoutOrder, PlatformDomain, PlatformTenants, PlatformUsers, ProductDomain, type ProgressConfig, type ProposeAgentChangeInput, type PublicCheckoutOrder, type PublicCheckoutProduct, type PublicCheckoutProductResponse, type PublicMerchantCart, type PublicMerchantSession, type PublicMerchantSessionResponse, RateLimitError, type RatingConfig, type RazorpayCheckoutOptions, type ReinforceResponse, type ReinforcementEvent, type RelationConfig, type RelationValue, type RequestOptions, type ResourceManifest, type SendMessageParams, type SendTemplateParams, SeoAudits, type SeoBacklinkOverview, type SeoBacklinkSite, SeoBacklinks, type SeoBrief, type SeoBriefPage, type SeoBriefResult, SeoBriefs, type SeoCcRelease, type SeoCcReleaseRow, type SeoCompetitor, type SeoDifficulty, type SeoDirectory, type SeoDirectoryListing, type SeoDomainStrength, type SeoEnvelope, type SeoFormat, type SeoGap, type SeoGoogleFeatures, type SeoGridPoint, type SeoGscAccess, type SeoGscDenied, type SeoGscImportResult, type SeoGscRow, type SeoGscSummary, type SeoGscTop, SeoInsights, type SeoKeywordIdea, type SeoLabel, SeoLocal, type SeoLocalCheck, type SeoLocalGrid, type SeoLocalGridRow, type SeoLocalHistoryRow, type SeoMapsProfile, type SeoOwnerVerificationMethod, SeoPerformance, SeoProduct, type SeoProject, type SeoProjectInput, SeoProjects, type SeoRankAddResult, type SeoRankChange, type SeoRankCheckRow, type SeoRankDevice, type SeoRankKeyword, type SeoRankLang, type SeoRankMove, type SeoRankPosition, type SeoRankTargetOptions, SeoRanks, type SeoReferringChanges, type SeoReferringDomain, type SeoReferringDomains, type SeoReport, SeoReports, SeoResearch, type SeoRun, type SeoSchedule, type SeoScoreRule, SeoSearchConsole, type SeoSourced, type SeoTopThree, type SeoVisibility, type SeoVisibilityNow, type SeoVitalsCheck, type SeoVitalsField, type SeoVitalsLab, type SeoVitalsStrategy, type ServiceConfig, type ServiceConfigGlobal, type ServiceConfigPerProduct, type SortRule, type StartOnboardingPayload, type StartOnboardingResponse, type StarterKind, type StarterPack, StorageInfra, type StoredFieldValue, type SuggestionEvent, type TagsConfig, type TeamAccessCatalog, type TeamInvitation, type TeamMember, type Template, type TemplateApiResponse, type TemplateBinding, type TemplateBindingSource, type TemplateButton, type TemplateCheck, type TemplateComponent, type TemplateDraft, type TemplateEmptyPolicy, type TemplateFix, type TemplateMapping, type TemplateResubmitInput, type TemplateResubmitResult, type TextConfig, type TriggerPayload, type TriggerResponse, type TryAgentInput, type TryAgentResult, type TryAgentToolCall, type UnansweredQuestion, type UpdateCampaignParams, type UpdateConversationDeploymentParams, type UpdateConversationParams, type UpdateMemberAccessInput, type UpsertLeadParams, type UrlConfig, VOICE_EVENTS, VOICE_REFUSAL_REASONS, type ViewConfig, type Vocabulary, Voice, type VoiceActivity, type VoiceAfterHours, type VoiceAgent, type VoiceAgentInput, type VoiceAgentSummary, type VoiceAudiencePreview, type VoiceBusinessHours, type VoiceBusinessType, type VoiceCall, type VoiceCallAction, type VoiceCallChanged, type VoiceCallCheck, type VoiceCallDetail, type VoiceCallFilters, type VoiceCallQueued, type VoiceCampaignApproval, type VoiceCampaignCounters, VoiceCampaigns, type VoiceDay, type VoiceDirection, type VoiceDisposition, type VoiceErrorCode, type VoiceForwardSlot, type VoiceFreeNumbers, type VoiceKycDocumentType, type VoiceKycInput, type VoiceKycStatus, type VoiceKycUpload, type VoiceKycView, type VoiceLines, type VoiceLiveStatus, type VoiceNumber, type VoiceNumberPatch, type VoiceOption, type VoicePreviewInput, type VoicePronunciation, type VoicePurpose, type VoiceRefusalCode, type VoiceSetup, type VoiceSetupCurrent, type VoiceSetupStep, type VoiceSkill, type VoiceSkillMap, type VoiceSkillParam, type VoiceSpeakingStyle, type VoiceStatus, type VoiceStyle, type VoiceTool, type VoiceTranscriptTurn, WebchatOwnerSettings, WebchatSettingsPatch, WebhookSignatureError, Webhooks, WhatsAppConnect, type WorkspaceAuditItem, type WorkspaceAuditPage, type WorkspaceAuditParams, type WorkspaceDashboardLayout, type WorkspaceDefaultAutomation, type WorkspaceDefaultField, type WorkspaceDefaultPipeline, type WorkspaceModuleConfig, type WorkspaceProfile, ECODrIxAPI as default, getErrorDetails, getRetryConfig, handleAPIError, isAPIError, laieStageQueued, voiceErrorCode, voiceRefusalReason };
|
package/dist/ts/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l,b as v,c as w,d as i,e as Mt,f as Nt,g as qt,h as Bt,i as cn,j as f,k as A,l as Kt,m as Te,n as R}from"./chunk-XPXDFZWU.js";import on from"axios";import Ht from"axios-retry";var s=class{constructor(e){i(this,"client",e)}async post(e,t,n){try{let o=this.buildConfig(n);return(await this.client.post(e,t,o)).data}catch(o){this.handleError(o)}}async get(e,t){try{let n=this.buildConfig(t);return(await this.client.get(e,n)).data}catch(n){this.handleError(n)}}async patch(e,t,n){try{let o=this.buildConfig(n);return(await this.client.patch(e,t,o)).data}catch(o){this.handleError(o)}}async put(e,t,n){try{let o=this.buildConfig(n);return(await this.client.put(e,t,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,t){try{let n=this.buildConfig(t);return(await this.client.delete(e,n)).data}catch(n){this.handleError(n)}}buildConfig(e){if(!e)return;let t=l({},e);return e.idempotencyKey&&(t.headers=v(l({},t.headers),{"Idempotency-Key":e.idempotencyKey})),t}handleError(e){throw R(e)}};var $=class extends s{async settings(){return this.get("/product/erix/ai/settings")}async updateSettings(e){return this.patch("/product/erix/ai/settings",e)}async outcomes(e={}){return this.get("/product/erix/ai/outcomes",{params:e})}async reviews(e){return this.get(`/product/erix/ai/reviews${e?`?status=${e}`:""}`)}async review(e,t,n){return this.post(`/product/erix/ai/reviews/${encodeURIComponent(e)}`,l({verdict:t},n?{note:n}:{}))}async suggestion(e){return this.get(`/product/erix/ai/suggestion/${e}`)}async approveAction(e){return this.post(`/product/erix/ai/suggestion/${e}/approve-action`,{})}async markSent(e,t,n){return this.post(`/product/erix/ai/suggestion/${e}/send`,{text:t,confidence:n})}async dismiss(e){return this.post(`/product/erix/ai/suggestion/${e}/dismiss`,{})}async approvals(){return this.get("/product/flow/approvals")}async agents(){return this.get("/product/flow/agents")}async agent(e){return this.get(`/product/flow/agents/${encodeURIComponent(e)}`)}async tryAgent(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/try`,t)}async proposeAgentChange(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/propose`,t)}async buildAgent(e){return this.post("/product/flow/agents/build",e)}async unansweredQuestions(){return this.get("/product/flow/agents/unanswered")}async markQuestionHandled(e){return this.post("/product/flow/agents/unanswered/handled",{question:e})}async agentTemplates(){return this.get("/product/flow/agents/templates")}async createAgent(e){return this.post("/product/flow/agents",e)}async updateAgent(e,t){return this.patch(`/product/flow/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return this.deleteRequest(`/product/flow/agents/${encodeURIComponent(e)}`)}async agentAutomation(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/automation`,{trigger:t})}async decideRun(e,t,n){return this.post(`/product/flow/runs/${encodeURIComponent(e)}/approve`,l({decision:t},n&&{nodeId:n}))}};var y="/product/erix/commerce/checkout",x="/product/erix/public/checkout",h=encodeURIComponent,yt=class extends s{async getProduct(e,t){return this.get(`${x}/products/${h(t)}`,{params:{c:e}})}async viewSession(e,t){return this.get(`${x}/sessions/view`,{params:{c:e,t}})}async updateItems(e){let o=e,{sessionId:t}=o,n=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/items`,n)}async startSession(e){return this.post(`${x}/sessions`,e)}async applyCoupon(e){let o=e,{sessionId:t}=o,n=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/coupon`,n)}async verify(e){let o=e,{sessionId:t}=o,n=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/verify`,n)}async placeOrder(e){let o=e,{sessionId:t}=o,n=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/order`,n)}async verifyRazorpay(e){let a=e,{sessionId:t,orderId:n}=a,o=w(a,["sessionId","orderId"]);return this.post(`${x}/sessions/${h(t)}/order/${h(n)}/razorpay`,o)}async orderStatus(e,t){return this.get(`${x}/orders/status`,{params:{c:e,t}})}async confirmCod(e,t){return this.post(`${x}/cod/confirm`,{clientCode:e,token:t})}},ht=class extends s{async create(e){return this.post(`${y}/sessions`,e)}},Se=class extends s{constructor(t){super(t);i(this,"buyer");i(this,"sessions");this.buyer=new yt(t),this.sessions=new ht(t)}async listProducts(){return this.get(`${y}/products`)}async createProduct(t){return this.post(`${y}/products`,t)}async updateProduct(t,n){return this.patch(`${y}/products/${h(t)}`,n)}async deleteProduct(t){return this.deleteRequest(`${y}/products/${h(t)}`)}async listCoupons(){return this.get(`${y}/coupons`)}async createCoupon(t){return this.post(`${y}/coupons`,t)}async updateCoupon(t,n){return this.patch(`${y}/coupons/${h(t)}`,n)}async deleteCoupon(t){return this.deleteRequest(`${y}/coupons/${h(t)}`)}async listOrders(t){return this.get(`${y}/orders`,{params:t})}async getOrder(t){return this.get(`${y}/orders/${h(t)}`)}async updateOrderStatus(t,n){return this.patch(`${y}/orders/${h(t)}/status`,n)}async getSettings(){return this.get(`${y}/settings`)}async updateSettings(t){return this.put(`${y}/settings`,t)}async createProductLink(t){return this.post(`${y}/links`,t)}};var Ce=class extends s{async providers(){return this.get("/infra/connect/providers")}async list(){return this.get("/infra/connect/connections")}async get_(e){return this.get(`/infra/connect/connections/${e}`)}async connect(e,t){return this.post(`/infra/connect/connections/${e}/connect`,t)}async configure(e,t){return this.put(`/infra/connect/connections/${e}/configure`,t)}async configureWebchat(e){return this.configure("webchat",{method:"domain",config:e})}async webchatSettings(){return this.get("/infra/connect/connections/webchat/settings")}async removeWebchatDomain(e){return this.deleteRequest(`/infra/connect/connections/webchat/domains/${encodeURIComponent(e)}`)}async disconnect(e){return this.post(`/infra/connect/connections/${e}/disconnect`,{})}async reveal(e){return this.post(`/infra/connect/connections/${e}/reveal`,{})}async test(e){return this.post(`/infra/connect/connections/${e}/test`,{})}async checkNow(e){return this.post(`/infra/connect/connections/${e}/health/check`,{})}async googleConnectUrl(){return this.post("/infra/connect/google/connect-url",{})}async moveChannel(e,t){return this.post(`/infra/connect/${e}/move`,{ticket:t})}async requestChannelRelease(e,t){return this.post(`/infra/connect/${e}/release-request`,{ticket:t})}async channelReleaseRequest(e){return this.get(`/infra/connect/${e}/release-request`)}async cancelChannelRelease(e){return this.deleteRequest(`/infra/connect/${e}/release-request`)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var V=class extends s{async list(e){return this.get("/infra/connect/accounts",e?{params:{providerId:e}}:void 0)}async retrieve(e){return this.get(`/infra/connect/accounts/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/infra/connect/accounts/${encodeURIComponent(e)}`,t)}async remove(e,t={}){return this.deleteRequest(`/infra/connect/accounts/${encodeURIComponent(e)}`,t.newDefaultId?{params:{newDefaultId:t.newDefaultId}}:void 0)}};var bt=class extends s{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async update(e,t){return this.patch(`/product/erix/crm/notes/${e}`,{content:t})}async pin(e,t=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:t})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},Ae=class extends s{constructor(t){super(t);i(this,"notes");this.notes=new bt(t)}async timeline(t,n){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:n})}async list(t,n){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:l({},n)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,n){return this.post(`/product/erix/crm/leads/${t}/calls`,n)}};var Re=class extends s{async overview(e){return this.get("/product/erix/crm/analytics/overview",{params:e})}async funnel(e){return this.get("/product/erix/crm/analytics/funnel",{params:{pipelineId:e}})}async forecast(e){return this.get("/product/erix/crm/analytics/forecast",{params:{pipelineId:e}})}async sources(e){return this.get("/product/erix/crm/analytics/sources",{params:e})}async team(e){return this.get("/product/erix/crm/analytics/team",{params:e})}async heatmap(e){return this.get("/product/erix/crm/analytics/heatmap",{params:e})}async scores(){return this.get("/product/erix/crm/analytics/scores")}async stageTime(e){return this.get("/product/erix/crm/analytics/stage-time",{params:{pipelineId:e}})}async tiered(e){return this.get("/product/erix/crm/analytics/tiered",{params:e})}async summary(e){return this.get("/product/erix/crm/analytics/summary",{params:e})}async whatsapp(e){return this.get("/product/erix/crm/analytics/whatsapp",{params:e})}async revenue(){return this.get("/product/erix/crm/analytics/revenue")}async health(){return this.get("/product/erix/crm/analytics/health")}async payments(){return this.get("/product/erix/crm/analytics/payments")}async reviews(){return this.get("/product/erix/crm/analytics/reviews")}async retention(){return this.get("/product/erix/crm/analytics/retention")}};var Ie=class extends s{async getChecklist(e){return this.get(`/product/erix/crm/documents/checklist/${e}`)}async createChecklist(e,t){return this.post(`/product/erix/crm/documents/checklist/${e}`,{templateNiche:t})}async markReceived(e,t,n){return this.patch(`/product/erix/crm/documents/checklist/${e}/${t}`,n?{fileUrl:n}:{})}async sendReminder(e){return this.post(`/product/erix/crm/documents/checklist/${e}/remind`)}async listIncomplete(){return this.get("/product/erix/crm/documents/checklist/incomplete")}async listTemplates(){return this.get("/product/erix/crm/documents/templates")}};var Pe=class extends s{async csv(e){return this.get("/product/erix/commerce/invoices/export/csv",{params:e})}async tally(e){return this.get("/product/erix/commerce/invoices/export/tally",{params:e})}async zoho(e){return this.get("/product/erix/commerce/invoices/export/zoho",{params:e})}};var jt=["open","won","lost","archived"],Le=class extends s{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),t=Array.isArray(e.data)?e.data:[],n=[{key:"firstName",label:"First Name",type:"string",required:!0,group:"Basic Info"},{key:"lastName",label:"Last Name",type:"string",required:!1,group:"Basic Info"},{key:"phone",label:"Phone Number",type:"phone",required:!0,group:"Contact"},{key:"email",label:"Email Address",type:"email",required:!1,group:"Contact"},{key:"status",label:"Status",type:"select",required:!0,options:jt.map(a=>({label:`${a.charAt(0).toUpperCase()}${a.slice(1)}`,value:a}))},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],o=t.map(a=>({key:`metadata.extra.${a.name}`,label:a.label||a.name,type:a.type||"string",required:!!a.required,options:a.options,group:"Custom Fields"}));return{name:"Lead",fields:[...n,...o],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}}async upsert(e){return this.post("/product/erix/crm/leads/upsert",e)}async createMany(e,t=50){let n=[];for(let o=0;o<e.length;o+=t){let u=e.slice(o,o+t).map(g=>this.create(g)),d=await Promise.allSettled(u);for(let g of d)if(g.status==="fulfilled")n.push(g.value);else throw g.reason}return n}async import(e,t={}){return this.post("/product/erix/crm/leads/import",l({leads:e},t))}async bulkUpsert(e){return this.import(e)}async list(e){let t=l({},e);return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}listAutoPaging(e){return Nt(this,null,function*(){let t=(e==null?void 0:e.page)||1,n=!0;for(;n;){let o=yield new Mt(this.list(v(l({},e),{page:t}))),a=Array.isArray(o.data)?o.data:o||[];if(a.length===0){n=!1;break}for(let u of a)yield u;o.pagination&&t<o.pagination.pages||!o.pagination&&a.length>0?t++:n=!1}})}async retrieve(e){return this.get(`/product/erix/crm/leads/${e}`)}async retrieveByPhone(e){return this.get(`/product/erix/crm/leads/phone/${encodeURIComponent(e)}`)}async byStage(e,t,n={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:n})}async retrieveByRef(e,t){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async update(e,t){return this.patch(`/product/erix/crm/leads/${e}`,t)}async setFollowUp(e,t,n){return this.patch(`/product/erix/crm/leads/${e}`,{nextFollowUpAt:t,nextFollowUpNote:t&&n!=null?n:null})}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,n){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:n})}async tags(e,t){return this.patch(`/product/erix/crm/leads/${e}/tags`,t)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,t){return this.patch(`/product/erix/crm/leads/${e}/metadata`,t)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,t){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:t})}async createNote(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async updateNote(e,t,n){return this.patch(`/product/erix/crm/notes/${t}`,n)}async deleteNote(e,t){return this.deleteRequest(`/product/erix/crm/notes/${t}`)}async delete(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async export(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/export`)}async erase(e){return this.post(`/product/erix/crm/leads/${encodeURIComponent(e)}/erase`,{confirm:"ERASE"})}async bulkArchive(e){return this.patch("/product/erix/crm/leads/bulk-archive",{ids:e})}async bulkDelete(e){return this.deleteRequest("/product/erix/crm/leads",{data:{ids:e}})}async archive(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async profile(e){return this.get(`/product/erix/crm/leads/${e}/profile`)}async invoices(e){return this.get(`/product/erix/crm/leads/${e}/invoices`)}async projects(e){return this.get(`/product/erix/crm/leads/${e}/projects`)}async conversations(e){return this.get(`/product/erix/crm/leads/${e}/conversations`)}async meetings(e){return this.get(`/product/erix/crm/leads/${e}/meetings`)}async flowRuns(e){return this.get(`/product/erix/crm/leads/${e}/flow-runs`)}async merge(e,t){return this.post("/product/erix/crm/leads/merge",{primaryId:e,secondaryId:t})}async duplicates(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/duplicates`)}};var Ee=class extends s{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var $e=class extends s{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,a;let t=await this.retrieve(e),n=Array.isArray((o=t.data)==null?void 0:o.stages)?t.data.stages:[];return{name:`Pipeline: ${((a=t.data)==null?void 0:a.name)||e}`,fields:n.map(u=>({key:u._id,label:u.name,type:"string",required:!0,options:[{label:u.name,value:u._id}],group:"Stages",uiHints:{color:u.color||"#cbd5e1",probability:u.probability}})),uiHints:{icon:"Columns",primaryColor:"#6366f1"}}}async create(e){return this.post("/product/erix/crm/pipelines",e)}async retrieve(e){return this.get(`/product/erix/crm/pipelines/${e}`)}async update(e,t){return this.patch(`/product/erix/crm/pipelines/${e}`,t)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,t){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{name:t})}async archive(e){return this.patch(`/product/erix/crm/pipelines/${e}/archive`,{})}async delete(e){return this.deleteRequest(`/product/erix/crm/pipelines/${e}`)}async checkInUse(e){return this.get(`/product/erix/crm/pipelines/${e}/in-use`)}async board(e){return this.get(`/product/erix/crm/pipelines/${e}/board`)}async forecast(e){return this.get(`/product/erix/crm/pipelines/${e}/forecast`)}async addStage(e,t){return this.post(`/product/erix/crm/pipelines/${e}/stages`,t)}async reorderStages(e,t){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:t})}async updateStage(e,t){return this.patch(`/product/erix/crm/stages/${e}`,t)}async deleteStage(e,t){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:t?{moveLeadsToStageId:t}:void 0})}};var Ve=class extends s{async getConfig(){return this.get("/product/erix/crm/scoring")}async updateConfig(e){return this.patch("/product/erix/crm/scoring",e)}async recalculate(e){return this.post(`/product/erix/crm/scoring/${e}/recalculate`,{})}async preview(e){return this.get(`/product/erix/crm/scoring/preview/${e}`)}};var Oe=class extends s{async sendTest(e){return this.post("/infra/connect/email/test",{to:e})}async listTemplates(e){return this.get("/infra/connect/email/templates",{params:e})}async getTemplate(e){return this.get(`/infra/connect/email/templates/${e}`)}async createTemplate(e){return this.post("/infra/connect/email/templates",e)}async updateTemplate(e,t){return this.put(`/infra/connect/email/templates/${e}`,t)}async deleteTemplate(e,t=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:t}})}async previewTemplate(e,t){return this.post(`/infra/connect/email/templates/${e}/preview`,t)}};var De=class extends s{async trigger(e){return this.post("/product/erix/events/trigger",e)}async listCustomEvents(){return this.get("/product/flow/config/triggers")}async createCustomEvent(e){return this.post("/product/flow/config/triggers",e)}async deleteCustomEvent(e){return this.deleteRequest(`/product/flow/config/triggers/${e}`)}};var Ue=class extends s{async list(){return this.get("/infra/connect/facebook/lead-forms")}async subscribe(){return this.post("/infra/connect/facebook/lead-forms/subscribe",{})}async setEnabled(e,t){return this.put(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}`,{enabled:t})}async importLast24Hours(e){return this.post(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}/import-last-24h`,{})}};var O=class extends s{path(e,t=""){return`/product/flow/workflows/${encodeURIComponent(e)}${t}`}async versions(e){return this.get(this.path(e,"/versions"))}async version(e,t){return this.get(this.path(e,`/versions/${encodeURIComponent(t)}`))}async restoreVersion(e,t){return this.post(this.path(e,`/versions/${encodeURIComponent(t)}/restore`))}async testData(e){return this.get(this.path(e,"/test-data"))}async pinTestData(e,t){return this.put(this.path(e,"/test-data"),{runId:t})}async unpinTestData(e){return this.deleteRequest(this.path(e,"/test-data"))}async testRun(e,t={}){return this.post(this.path(e,"/test-run"),t)}async testRunProgress(e,t){return this.get(this.path(e,"/test-run"),{params:{runIds:t.join(",")}})}async copilot(e,t){return this.post(this.path(e,"/copilot"),t)}async live(e){return this.get(this.path(e,"/live"))}async week(e){return this.get(this.path(e,"/week"))}async deleteImpact(e){return this.get(this.path(e,"/delete-impact"))}async remove(e,t={}){return this.deleteRequest(this.path(e,t.stop?"?stop=true":""))}async duplicate(e){return this.post(this.path(e,"/duplicate"))}async retryFailed(e,t={}){return this.post(this.path(e,"/retry-failed"),t)}};var T=class extends s{async list(e={}){return this.get("/product/flow/campaigns",{params:e})}async create(e){return this.post("/product/flow/campaigns",e)}async launch(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/launch`,t)}async retrieve(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/product/flow/campaigns/${encodeURIComponent(e)}`,t)}async test(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/test`,{})}async start(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/start`,t)}async pause(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/pause`,{})}async resume(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/resume`,{})}async stop(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/stop`,{})}async remove(e){return this.deleteRequest(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async duplicate(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/duplicate`,{})}async followUp(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/follow-up`,t)}async checks(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/checks`)}async results(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/results`)}async people(e,t={}){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/people`,{params:t})}};var I="/product/flow/conversations",m=(r,e="")=>`${I}/${encodeURIComponent(r)}${e}`,D=class extends s{async list(e={}){return this.get(I,{params:e})}async create(e){return this.post(I,e)}async retrieve(e){return this.get(m(e))}async update(e,t){return this.patch(m(e),t)}async duplicate(e){return this.post(m(e,"/duplicate"),{})}async archive(e){return this.deleteRequest(m(e))}async publish(e,t={}){return this.post(m(e,"/publish"),t)}async versions(e){return this.get(m(e,"/versions"))}async version(e,t){return this.get(m(e,`/versions/${t}`))}async rollback(e,t){return this.post(m(e,"/rollback"),{version:t})}async try(e,t){return this.post(m(e,"/try"),t)}async tests(e){return this.get(m(e,"/tests"))}async addTest(e,t){return this.post(m(e,"/tests"),t)}async deleteTest(e,t){return this.deleteRequest(m(e,`/tests/${encodeURIComponent(t)}`))}async runTests(e,t={}){return this.post(m(e,"/tests/run"),t)}async deployments(e){return this.get(m(e,"/deployments"))}async allDeployments(){return this.get(`${I}/deployments`)}async deploy(e,t){return this.post(m(e,"/deployments"),t)}async updateDeployment(e,t){return this.patch(`${I}/deployments/${encodeURIComponent(e)}`,t)}async removeDeployment(e){return this.deleteRequest(`${I}/deployments/${encodeURIComponent(e)}`)}async checks(e){return this.get(m(e,"/checks"))}};var U=class extends s{async get(){return super.get("/product/flow/home")}async nav(){return super.get("/product/flow/home/nav")}},_=class extends s{async create(e){return this.post("/product/flow/drafts",e)}async plan(e){return this.post("/product/flow/drafts/plan",e)}},F=class extends s{async status(){return this.get("/product/flow/first-run")}async installPack(e){return this.post(`/product/flow/first-run/packs/${e}`)}},M=class extends s{async list(){return this.get("/product/flow/audiences")}async byId(e){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}`)}async create(e){return this.post("/product/flow/audiences",e)}async update(e,t){return this.patch(`/product/flow/audiences/${encodeURIComponent(e)}`,t)}async remove(e){return this.deleteRequest(`/product/flow/audiences/${encodeURIComponent(e)}`)}async preview(e,t){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}/preview${t?`?channel=${t}`:""}`)}async previewRules(e){return this.post("/product/flow/audiences/preview",e)}};var _e=class extends s{async system(){return(await this.get("/health")).data}};var Fe=class extends s{async list(e){return this.get("/product/erix/commerce/invoices",{params:e})}async getInvoice(e){return this.get(`/product/erix/commerce/invoices/${e}`)}async create(e){return this.post("/product/erix/commerce/invoices",e)}async update(e,t){return this.patch(`/product/erix/commerce/invoices/${e}`,t)}async void(e){return this.post(`/product/erix/commerce/invoices/${e}/void`,{})}async sendViaWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${e}/send-whatsapp`,{})}async getSettings(){return this.get("/product/erix/commerce/settings")}async updateSettings(e){return this.put("/product/erix/commerce/settings",e)}async paymentLink(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payment-link`,{})}async recordPayment(e,t){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payments`,t)}async sendWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-whatsapp`,{})}async sendEmail(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-email`,{})}};var zt=r=>"queued"in r&&r.queued===!0,Yt={runProgress:"laie:run:progress",importComplete:"laie:import:complete"},p=encodeURIComponent,c="/product/laie",N=class extends s{async list(){return this.get(`${c}/packs`)}async byId(e){return this.get(`${c}/packs/${p(e)}`)}},q=class extends s{async catalog(e={}){return this.get(`${c}/signals/catalog`,{params:e})}async list(e={}){return this.get(`${c}/signals`,{params:e})}},B=class extends s{async find(e){return this.post(`${c}/tools/find`,e)}async collect(e){return this.post(`${c}/tools/collect`,e)}async enrich(e){return this.post(`${c}/tools/enrich`,e)}async verify(e){return this.post(`${c}/tools/verify`,e)}async qualify(e){return this.post(`${c}/tools/qualify`,e)}async store(e){return this.post(`${c}/tools/store`,e)}async use(e){return this.post(`${c}/tools/use`,e)}async verifyEmail(e){return this.post(`${c}/tools/verify-email`,{emails:e})}async websiteLookup(e){return this.post(`${c}/tools/website-lookup`,{url:e})}},K=class extends s{async list(){return this.get(`${c}/campaigns`)}async create(e){return this.post(`${c}/campaigns`,e)}async byId(e){return this.get(`${c}/flows/${p(e)}`)}async settings(e){return this.get(`${c}/campaigns/${p(e)}/settings`)}async updateSettings(e,t){return this.patch(`${c}/campaigns/${p(e)}/settings`,t)}async signals(e){return this.get(`${c}/campaigns/${p(e)}/signals`)}async setSignals(e,t){return this.put(`${c}/campaigns/${p(e)}/signals`,t)}},j=class extends s{async start(e){return this.post(`${c}/campaigns/${p(e)}/runs`)}async list(e,t={}){return this.get(`${c}/campaigns/${p(e)}/runs`,{params:t})}async byId(e,t){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}`)}async changes(e,t,n={}){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}/changes`,{params:n})}async cancel(e,t){return this.post(`${c}/campaigns/${p(e)}/runs/${p(t)}/cancel`)}async quality(e){return this.get(`${c}/jobs/${p(e)}/quality`)}},G=class extends s{async list(e={}){let o=e,{importedToCrm:t}=o,n=w(o,["importedToCrm"]);return this.get(`${c}/leads`,{params:l(l({},n),t!==void 0&&{importedToCrm:String(t)})})}async byId(e){return this.get(`${c}/leads/${p(e)}`)}async update(e,t){return this.patch(`${c}/leads/${p(e)}`,t)}async notes(e){return this.get(`${c}/leads/${p(e)}/notes`)}async addNote(e,t){return this.post(`${c}/leads/${p(e)}/notes`,t)}async generateKit(e){return this.post(`${c}/leads/${p(e)}/generate-kit`)}async pipelineSummary(){return this.get(`${c}/leads/pipeline-summary`)}async bulkContacted(e,t){return this.post(`${c}/leads/bulk/contacted`,{leadIds:e,channel:t})}async bulkTag(e,t){return this.post(`${c}/leads/bulk/tag`,{leadIds:e,tags:t})}async bulkDelete(e){return this.post(`${c}/leads/bulk/delete`,{leadIds:e})}async bulkExport(e,t="json"){return t==="csv"?this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t},{responseType:"text"}):this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t})}},H=class extends s{async pipelines(){return this.get(`${c}/import/pipelines`)}async crm(e){return this.post(`${c}/import/crm`,e)}},W=class extends s{async enrich(e){return this.post(`${c}/lists/enrich`,e)}},Q=class extends s{async dsr(e){return this.post(`${c}/compliance/dsr`,e)}async report(e={}){return this.get(`${c}/compliance/report`,{params:e})}},z=class extends s{async map(e={}){return this.get(`${c}/market-map`,{params:e})}async forCampaign(e){return this.get(`${c}/campaigns/${p(e)}/market-map`)}async refresh(e={}){return this.post(`${c}/market-map/refresh`,e)}},Y=class extends s{async weights(e={}){return this.get(`${c}/learning/weights`,{params:e})}async outcomes(e={}){return this.get(`${c}/learning/outcomes`,{params:e})}},J=class extends s{async preview(e){return this.post(`${c}/lookalikes/preview`,e)}async create(e){return this.post(`${c}/lookalikes`,e)}async list(e={}){return this.get(`${c}/lookalikes`,{params:e})}async byId(e){return this.get(`${c}/lookalikes/${p(e)}`)}async rank(e,t={}){return this.get(`${c}/lookalikes/${p(e)}/rank`,{params:t})}},X=class extends s{async status(){return this.get(`${c}/freshness`)}},Z=class extends s{async start(e){return this.post(`${c}/audit`,e)}async byId(e){return this.get(`${c}/audit/${p(e)}`)}};import Jt from"axios";var Me=class extends s{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}async delete(e){return this.deleteRequest("/infra/storage/files/files",{params:{key:e}})}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async aiDescribe(e){return this.post("/infra/storage/files/ai/describe",{key:e})}async upload(e,t){let n=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:o,key:a}=n.data;await Jt.put(o,e,{headers:{"Content-Type":t.contentType}});let u=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:a,sizeBytes:u})}};var Ne=class extends s{async create(e){return this.post("/infra/connect/meet",e)}async list(e){return this.get("/infra/connect/meet",{params:e})}async retrieve(e){return this.get(`/infra/connect/meet/${e}`)}async update(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async reschedule(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async delete(e){return this.update(e,{status:"cancelled"})}};var qe=class extends s{async workflowPacks(){return this.get("/product/erix/crm/niche/workflow-packs")}async workflowPackDetail(e){return this.get(`/product/erix/crm/niche/workflow-packs/${e}`)}async installWorkflowPack(e){return this.post(`/product/erix/crm/niche/workflow-packs/${e}/install`)}async templateSuggestions(){return this.get("/product/erix/crm/niche/template-suggestions")}};var Be=class extends s{async listAlerts(e){return this.get("/platform/users/notifications",{params:e})}async dismissAlert(e){return this.patch(`/platform/users/notifications/${e}/dismiss`)}async clearAllAlerts(){return this.deleteRequest("/platform/users/notifications/dismiss-all")}};var ee=class extends s{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}};var te=class extends s{async get(e){return super.get(`/platform/tenants/persona/${e}`)}async reinforce(e){return this.post(`/platform/tenants/persona/${e.productId}/reinforce`,e)}async confidence(e){return super.get(`/platform/tenants/persona/${e}/confidence`,{params:{productId:e}})}async timeline(e,t){var o;let n=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(o=n==null?void 0:n.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var n,o;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(n=t==null?void 0:t.data)==null?void 0:n.entries)!=null?o:[]}};var ft=class extends s{async chatSync(e){return this.post("/platform/ai/copilot/chat/sync",e)}async confirm(e){return this.post("/platform/ai/copilot/confirm",e)}async listSessions(){return this.get("/platform/ai/copilot/sessions")}async getSession(e){return this.get(`/platform/ai/copilot/sessions/${e}`)}async deleteSession(e){return this.deleteRequest(`/platform/ai/copilot/sessions/${e}`)}chatStreamUrl(){return"/platform/ai/copilot/chat"}},Ke=class{constructor(e){i(this,"copilot");this.copilot=new ft(e)}};var je=class extends s{async list(e){return this.get("/platform/tenants/audit",{params:e})}};var Ge=class extends s{async register(e){return this.post("/platform/auth/register",e)}async login(e){return this.post("/platform/auth/login",e)}async logout(e){return this.post("/platform/auth/logout",e)}async logoutAll(e){return this.post("/platform/auth/logout-all",e)}async validateSession(e){return this.post("/platform/auth/session/validate",e)}async listSessions(){return this.get("/platform/auth/sessions")}async revokeSession(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}async requestPasswordOtp(e){return this.post("/platform/auth/password/request-otp",e)}async setPassword(e){return this.post("/platform/auth/password/set",e)}async changePassword(e){return this.post("/platform/auth/password/change",e)}async forgotPassword(e){return this.post("/platform/auth/forgot",e)}async resetPassword(e){return this.post("/platform/auth/reset",e)}async linkOAuth(e){return this.post("/platform/auth/oauth-link",e)}async getInvitation(e){return this.get(`/platform/auth/invitations/${e}`)}async acceptInvitation(e,t){return this.post(`/platform/auth/invitations/${e}/accept`,t)}};var xt=class extends s{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},kt=class extends s{async upgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/upgrade",e)}async downgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/downgrade",e)}async cancel(e){return this.post("/platform/billing/subscriptions/subscriptions/cancel",e)}},wt=class extends s{list(){return this.get("/platform/billing/addons")}add(e,t){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/add`,t===void 0?{}:{quantity:t})}remove(e){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/remove`)}overage(){return this.get("/platform/billing/overage")}setOverage(e){return this.put("/platform/billing/overage",e)}},vt=class extends s{async listPublic(){return this.get("/platform/billing/plans/public")}},Tt=class extends s{async plans(){return this.get("/platform/billing/checkout/plans")}async proration(e,t){return this.get("/platform/billing/checkout/proration",{params:{planId:e,billingCycle:t}})}async subscribe(e){return this.post("/platform/billing/checkout/subscribe",e)}async verify(e){return this.post("/platform/billing/checkout/verify",e)}async cancel(e){return this.post("/platform/billing/checkout/cancel",e)}async status(){return this.get("/platform/billing/checkout/status")}async syncPlan(e){return this.post("/platform/billing/checkout/sync-plan",e)}},St=class extends s{async transactions(){return this.get("/platform/billing/user/transactions")}async transactionInvoice(e){return this.get(`/platform/billing/user/transactions/${encodeURIComponent(e)}/invoice`)}async subscription(){return this.get("/platform/billing/user/subscription")}async raiseDispute(e){return this.post("/platform/billing/user/dispute",e)}async disputes(){return this.get("/platform/billing/user/disputes")}},Ct=class extends s{async balance(){return this.get("/platform/billing/credits/balance")}async transactions(){return this.get("/platform/billing/credits/transactions")}async packs(){return this.get("/platform/billing/credits/packs")}async topupOrder(e){return this.post("/platform/billing/credits/topup/order",e)}async verifyTopup(e){return this.post("/platform/billing/credits/topup/verify",e)}async setAutoTopup(e){return this.patch("/platform/billing/credits/auto-topup",e)}async setSpendCap(e){return this.patch("/platform/billing/credits/spend-cap",e)}},He=class{constructor(e){i(this,"entitlements");i(this,"subscriptions");i(this,"plans");i(this,"checkout");i(this,"user");i(this,"credits");i(this,"addOns");this.entitlements=new xt(e),this.subscriptions=new kt(e),this.plans=new vt(e),this.checkout=new Tt(e),this.user=new St(e),this.credits=new Ct(e),this.addOns=new wt(e)}};var ne=class extends s{async list(){return this.get("/platform/public/catalog",{ignoreClientCode:!0})}};var P=class extends s{async send(e){if(e.conversationId)return this.post(`/platform/inbox/conversations/${e.conversationId}/messages`,{text:e.text,media:e.media});if(!e.to)throw new Error("send: conversationId or to is required");if(e.media)throw new Error("send: media goes to an inbox thread (conversationId)");return this.post("/infra/connect/send/whatsapp",l({phone:e.to,text:e.text},e.accountId?{accountId:e.accountId}:{}))}async sendTemplate(e){return this.post("/infra/connect/send/whatsapp",l({phone:e.to,templateName:e.templateName,language:e.language,variables:e.variables},e.accountId?{accountId:e.accountId}:{}))}async star(e,t){return this.post(`/platform/inbox/messages/${e}/star`,{starred:t})}async translate(e){return this.post(`/platform/inbox/messages/${encodeURIComponent(e)}/translate`,{})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async upload(e,t={}){var C,k,E;let n=(k=(C=t.fileName)!=null?C:e.name)!=null?k:"file",o=e.type||"application/octet-stream",a=await this.post("/infra/storage/files/upload-url",{folder:(E=t.folder)!=null?E:"inbox",filename:n,contentType:o}),{uploadUrl:u,key:d}=a.data,g=await fetch(u,{method:"PUT",headers:{"Content-Type":o},body:e});if(!g.ok)throw new Error(`upload failed (${g.status})`);return await this.post("/infra/storage/files/confirm-upload",{key:d,sizeBytes:e.size}),{key:d,mimeType:o,fileName:n}}};var Xt=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown","text/csv","text/html","image/png","image/jpeg","image/webp"],re=class extends s{async list(){return this.get("/platform/knowledge/sources")}async addText(e){return this.post("/platform/knowledge/sources",l({kind:"text"},e))}async addUrl(e){return this.post("/platform/knowledge/sources",l({kind:"url"},e))}async addWebsite(e){return this.post("/platform/knowledge/sources",{type:"website",url:e.url})}async addFile(e,t={}){var o,a;let n=await new P(this.client).upload(e,{folder:"knowledge"});return this.post("/platform/knowledge/sources",{kind:"file",key:n.key,mimeType:n.mimeType,title:(a=(o=t.title)!=null?o:n.fileName)!=null?a:"Document"})}async remove(e){return this.deleteRequest(`/platform/knowledge/sources/${e}`)}async reindex(e){return this.post(`/platform/knowledge/sources/${e}/reindex`,{})}async search(e,t){return this.post("/platform/knowledge/search",l({query:e},t?{limit:t}:{}))}};var We=class extends s{async categories(){return this.get("/platform/support/categories")}async listTickets(e){return this.get("/platform/support/tickets",{params:e})}async createTicket(e){return this.post("/platform/support/tickets",e)}async getTicket(e){return this.get(`/platform/support/tickets/${e}`)}async reply(e,t){return this.post(`/platform/support/tickets/${e}/reply`,t)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}async channelSetup(e){return this.get(`/platform/support/channel-requests/${encodeURIComponent(e)}/setup`)}};var Qe=class extends s{async get(){return super.get("/platform/users/me")}async update(e){return this.patch("/platform/users/me",e)}async updateOrganization(e){return this.patch("/platform/users/me/organization",e)}async toggleModules(e){return this.post("/platform/users/me/modules",e)}async workspaces(){return super.get("/platform/users/me/workspaces")}async setActiveOrg(e){return this.post("/platform/users/me/active-org",e)}async dismissWorkspaceSetup(){return this.post("/platform/users/me/workspace/dismiss-setup",{})}},ze=class extends s{async list(){return this.get("/platform/users/members")}async access(){return this.get("/platform/users/members/access")}async invite(e){return this.post("/platform/users/members/invite",e)}async updateAccess(e,t){return this.patch(`/platform/users/members/${encodeURIComponent(e)}`,t)}async updateRole(e,t){return this.updateAccess(e,{role:t})}async remove(e){return this.deleteRequest(`/platform/users/members/${encodeURIComponent(e)}`)}async invitations(){return this.get("/platform/users/members/invitations")}async resendInvitation(e){return this.post(`/platform/users/members/invitations/${encodeURIComponent(e)}/resend`,{})}async revokeInvitation(e){return this.deleteRequest(`/platform/users/members/invitations/${encodeURIComponent(e)}`)}},Ye=class extends s{async list(){return this.get("/platform/auth/sessions")}async revoke(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}};var Je=class extends s{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents`,t)}async toggleSignature(e,t,n){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:n})}async addSigner(e,t,n){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,n)}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,n){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,n)}};var se=class extends s{async list(){return this.get("/product/seo/projects")}async create(e){return this.post("/product/seo/projects",e)}async byId(e){return this.get(`/product/seo/projects/${e}`)}async update(e,t){return this.patch(`/product/seo/projects/${e}`,t)}async remove(e){return this.deleteRequest(`/product/seo/projects/${e}`)}async crawl(e){return this.post(`/product/seo/projects/${e}/crawl`)}async crawlCompetitor(e,t){return this.post(`/product/seo/projects/${e}/competitors/crawl`,{domain:t})}},ie=class extends s{async start(e){return this.post("/product/seo/audits",e)}async list(e={}){return this.get("/product/seo/audits",{params:e})}async compare(e){return this.post("/product/seo/audits/compare",e)}async byId(e){return this.get(`/product/seo/audits/${e}`)}async resume(e){return this.post(`/product/seo/audits/${e}/resume`)}async pages(e,t={}){return this.get(`/product/seo/audits/${e}/pages`,{params:t})}async issues(e){return this.get(`/product/seo/audits/${e}/issues`)}async links(e){return this.get(`/product/seo/audits/${e}/links`)}async export(e,t="json"){return this.get(`/product/seo/audits/${e}/export`,{params:{format:t},responseType:"text"})}},oe=class extends s{async keywords(e,t={}){return this.get(`/product/seo/audits/${e}/keywords`,{params:t})}async contentGap(e){return this.post("/product/seo/audits/content-gap",e)}async search(e){return this.post("/product/seo/audits/search",e)}async backlinks(e){return this.get("/product/seo/audits/backlinks",{params:e})}async domain(e){return this.get(`/product/seo/audits/domains/${encodeURIComponent(e)}`)}},ae=class extends s{async check(e){return this.post(`/product/seo/search-console/${e}/check`)}async importNow(e){return this.post(`/product/seo/search-console/${e}/import`)}async status(e){return this.get(`/product/seo/search-console/${e}/status`)}async queries(e,t={}){return this.get(`/product/seo/search-console/${e}/queries`,{params:t})}async pages(e,t={}){return this.get(`/product/seo/search-console/${e}/pages`,{params:t})}async trend(e,t={}){return this.get(`/product/seo/search-console/${e}/trend`,{params:t})}},ce=class extends s{async keywords(e){return this.get(`/product/seo/ranks/${e}/keywords`)}async add(e,t,n={}){return this.post(`/product/seo/ranks/${e}/keywords`,l({queries:t},n))}async visibility(e,t={}){return this.get(`/product/seo/ranks/${e}/visibility`,{params:t})}async competitors(e){return this.get(`/product/seo/ranks/${e}/competitors`)}async gap(e,t={}){return this.get(`/product/seo/ranks/${e}/gap`,{params:t})}async remove(e,t){return this.deleteRequest(`/product/seo/ranks/${e}/keywords/${t}`)}async checkNow(e,t){return this.post(`/product/seo/ranks/${e}/keywords/${t}/check`)}async history(e,t,n={}){return this.get(`/product/seo/ranks/${e}/keywords/${t}/history`,{params:n})}async changes(e){return this.get(`/product/seo/ranks/${e}/changes`)}},ue=class extends s{async checkNow(e){return this.post(`/product/seo/local/${e}/check`)}async latest(e){return this.get(`/product/seo/local/${e}`)}async history(e,t={}){return this.get(`/product/seo/local/${e}/history`,{params:t})}async startGrid(e,t={}){return this.post(`/product/seo/local/${e}/grid`,t)}async grid(e){return this.get(`/product/seo/local/${e}/grid`)}async grids(e,t={}){return this.get(`/product/seo/local/${e}/grids`,{params:t})}},le=class extends s{async byProject(e){return this.get(`/product/seo/reports/${e}`)}async export(e,t="csv"){return this.get(`/product/seo/reports/${e}/export`,{params:{format:t},responseType:"text"})}async pdf(e,t={}){return this.get(`/product/seo/reports/${e}/pdf`,{params:t,responseType:"arraybuffer"})}async generate(e,t={}){return this.post(`/product/seo/reports/${e}/generate`,t)}async history(e,t={}){return this.get(`/product/seo/reports/${e}/history`,{params:t})}async changes(e){return this.get(`/product/seo/reports/${e}/changes`)}},pe=class extends s{async seed(e,t,n="en"){return this.post(`/product/seo/research/${e}/seed`,{seed:t,lang:n})}async fromSearchConsole(e){return this.post(`/product/seo/research/${e}/from-search-console`)}async ideas(e,t={}){return this.get(`/product/seo/research/${e}/ideas`,{params:t})}async analyze(e,t){return this.post(`/product/seo/research/${e}/ideas/${t}/analyze`)}};var ge=class extends s{async releases(){return this.get("/product/seo/backlinks/releases")}async strength(e){return this.get("/product/seo/backlinks/strength",{params:{domains:e.join(",")}})}async overview(e){return this.get(`/product/seo/backlinks/${e}`)}async referring(e,t){return this.get(`/product/seo/backlinks/${e}/referring`,{params:t})}async changes(e,t){return this.get(`/product/seo/backlinks/${e}/changes`,{params:t})}},de=class extends s{async checkNow(e){return this.post(`/product/seo/performance/${e}/check`)}async latest(e){return this.get(`/product/seo/performance/${e}`)}async history(e,t={}){return this.get(`/product/seo/performance/${e}/history`,{params:t})}},me=class extends s{async create(e){return this.post("/product/seo/briefs",e)}async byId(e){return this.get(`/product/seo/briefs/${e}`)}async list(e,t={}){return this.get("/product/seo/briefs",{params:l({projectId:e},t)})}};var Zt=35e3,ye=class extends s{async claim(e,t){var o;let n=await this.post("/infra/serp/collector/claim",{collectorId:e,kinds:t},{timeout:Zt});return(o=n&&typeof n=="object"?n.data:null)!=null?o:null}async result(e){return this.post("/infra/serp/collector/result",e)}async heartbeat(e,t){return this.post("/infra/serp/collector/heartbeat",l({collectorId:e},t))}};var Xe=class extends s{async getConfig(){return this.get("/infra/connect/email/config")}async initDomainVerification(e){return this.post("/infra/connect/email/config/ses/domain",{domain:e})}async saveEmailConfig(e){return this.post("/infra/connect/email/config/ses/config",e)}async checkSesVerification(){return this.get("/infra/connect/email/config/ses/verify")}async removeSesIdentity(){return this.deleteRequest("/infra/connect/email/config/ses/domain")}async sendTest(e){return this.post("/infra/connect/email/config/test",{toEmail:e})}async saveAdvancedConfig(e){return this.post("/infra/connect/email/config/advanced",e)}async getHealth(){return this.get("/infra/connect/email/config/health")}async fixDmarc(){return this.post("/infra/connect/email/config/ses/fix-dmarc",{})}async listProviders(){return this.get("/infra/connect/email/config/providers")}};var Ze=class extends s{async create(e){return this.post("/infra/storage/files/folders",{name:e})}},et=class extends s{async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}async getUploadUrl(e){return this.post("/infra/storage/files/upload-url",e)}async confirmUpload(e){return this.post("/infra/storage/files/confirm-upload",e)}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async delete(e){return this.deleteRequest("/infra/storage/files/files",{params:{key:e}})}};var en={callChanged:"voice_call_changed"},tn=["NOT_FOUND","VOICE_CALL_REFUSED","VOICE_NOT_SET_UP","VOICE_CAMPAIGN_NOT_APPROVED","VOICE_NOT_ENABLED","VOICE_AGENT_UNAVAILABLE","VOICE_RUNTIME_UNAVAILABLE","VOICE_PREVIEW_FAILED","VOICE_NOT_CONFIGURED","LEAD_NOT_FOUND","INSUFFICIENT_CREDITS"];function nn(r){let e=r instanceof f?r.code:void 0;return e&&tn.includes(e)?e:void 0}var Gt={gate:"Voice calling isn't switched on for this workspace.",bad_number:"That phone number isn't a number we can call.",do_not_call:"They asked not to be called again.",dnd:"Their number is on the Do Not Disturb register.",hours:"No calling hours are open for this step.",recently_called:"They were called recently.",promotional:"Promotional calls aren't offered. Calls are for service, reminders, callbacks and demo follow-ups.",no_consent:"No record that they agreed to a phone call, or asked for one. They are not called.",campaign_stopped:"This campaign was stopped.",test_limit:"You can ring your own phone 3 times a day. Try again tomorrow.",not_on_plan:"Voice isn't on your plan. Upgrade your plan to use voice calls.",minutes_used_up:"You've used this month's included voice minutes. Your plan has no extra minutes.",low_balance:"Your balance is below \u20B910. Add credits to place voice calls."};function rn(r){var e;return(e=Gt[r])!=null?e:r}var he=encodeURIComponent,tt=class extends s{get flow(){return new T(this.client)}list(e={}){return this.flow.list(e)}retrieve(e){return this.flow.retrieve(e)}create(e){return this.flow.create(e)}launch(e,t={}){return this.flow.launch(e,t)}start(e,t={}){return this.flow.start(e,t)}pause(e){return this.flow.pause(e)}resume(e){return this.flow.resume(e)}stop(e){return this.flow.stop(e)}costPreview(e){return this.get(`/product/flow/campaigns/${he(e)}/voice-preview`)}counters(e){return this.get(`/infra/connect/voice/campaigns/${he(e)}/counters`)}approval(e){return this.get(`/infra/connect/voice/campaigns/${he(e)}/approval`)}requestApproval(e){return this.post(`/infra/connect/voice/campaigns/${he(e)}/approval/request`,{})}},be=class extends s{constructor(t){super(t);i(this,"campaigns");this.campaigns=new tt(t)}status(){return this.get("/infra/connect/voice/status")}setup(){return this.get("/infra/connect/voice/setup")}setupNumbers(){return this.get("/infra/connect/voice/setup/numbers")}kycUploadUrl(t){return this.post("/infra/connect/voice/setup/kyc/upload-url",t)}submitKyc(t){return this.post("/infra/connect/voice/setup/kyc",t)}pickNumber(t){return this.post("/infra/connect/voice/setup/number",{number:t})}askForNumber(){return this.post("/infra/connect/voice/setup/number/request",{})}goLive(){return this.post("/infra/connect/voice/setup/go-live",{})}agent(){return this.get("/infra/connect/voice/agent")}skills(){return this.get("/infra/connect/voice/skills")}voices(t){return this.get(`/infra/connect/voice/voices?language=${encodeURIComponent(t)}`)}saveAgent(t){return this.put("/infra/connect/voice/agent",t)}agents(){return this.get("/infra/connect/voice/agents")}createAgent(t){return this.post("/infra/connect/voice/agents",t)}getAgent(t){return this.get(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}updateAgent(t,n){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}`,n)}setAgentLead(t,n){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}/lead`,{customAgentId:n})}deleteAgent(t){return this.deleteRequest(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}numbers(){return this.get("/infra/connect/voice/numbers")}updateNumber(t,n){return this.patch(`/infra/connect/voice/numbers/${encodeURIComponent(t)}`,n)}async preview(t={}){var n;try{return(await this.client.post("/infra/connect/voice/preview",t,{responseType:"arraybuffer"})).data}catch(o){let a=(n=o==null?void 0:o.response)==null?void 0:n.data;if(a instanceof ArrayBuffer||ArrayBuffer.isView(a))try{o.response.data=JSON.parse(new TextDecoder().decode(a))}catch(u){o.response.data=void 0}throw R(o)}}lines(){return this.get("/infra/connect/voice/lines")}activity(){return this.get("/infra/connect/voice/activity")}calls(t={}){return this.get("/infra/connect/voice/calls",{params:t})}call(t){return this.get(`/infra/connect/voice/calls/${he(t)}`)}callWithAI(t){return this.post("/infra/connect/voice/calls",t)}checkCallWithAI(t){return this.post("/infra/connect/voice/calls/check",t)}callMyPhone(t={}){return this.post("/infra/connect/voice/calls/my-phone",t)}testCall(t={}){return this.post("/infra/connect/voice/test-call",t)}};var nt=class extends s{async list(e){return this.get("/platform/inbox/conversations",{params:e})}async create(e){var t;return this.post("/platform/inbox/conversations",{address:e.phone,channel:(t=e.channel)!=null?t:"whatsapp",userName:e.name})}async linkLead(e,t){return this.patch(`/platform/inbox/conversations/${e}/lead`,{leadId:t})}async retrieve(e){return this.get(`/platform/inbox/conversations/${e}`)}async messages(e,t){return this.get(`/platform/inbox/conversations/${e}/messages`,{params:t})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async delete(e){return this.deleteRequest(`/platform/inbox/conversations/${e}`)}async bulkDelete(e){return this.post("/platform/inbox/conversations/bulk-delete",{ids:e})}};var rt=class extends s{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(e={}){return this.post("/infra/connect/whatsapp/templates/sync",e.accountId?{accountId:e.accountId}:{})}async retrieve(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}`)}async create(e){return this.post("/infra/connect/whatsapp/templates",e)}async update(e,t){return this.put(`/infra/connect/whatsapp/templates/${e}`,t)}async fix(e){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/fix`,{})}async resubmit(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/resubmit`,t)}async deleteTemplate(e,t,n){let o=new URLSearchParams;t&&o.set("force","true"),n&&o.set("accountId",n);let a=o.toString();return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${a?`?${a}`:""}`)}async mappingConfig(){return this.get("/infra/connect/whatsapp/templates/mapping/config")}async mappingSources(){return this.get("/infra/connect/whatsapp/templates/mapping/sources")}async collections(){return this.get("/infra/connect/whatsapp/templates/collections")}async collectionFields(e){return this.get(`/infra/connect/whatsapp/templates/collections/${encodeURIComponent(e)}/fields`)}async updateMapping(e,t){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,t)}async validate(e,t){let n=`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`;return t?this.post(n,t):this.get(n)}async preview(e,t,n,o){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t,mappings:n,onEmptyVariable:o})}async getVariableManifest(e){var a,u;let t=await this.retrieve(e),n=Array.isArray((a=t.data)==null?void 0:a.components)?t.data.components:[],o=[];for(let d of n)if(d.text){let g=d.text.match(/{{(\d+)}}/g);if(g)for(let C of g){let k=C.replace(/{{|}}/g,"");o.push({key:`var_${k}`,label:`${d.type} Var {{${k}}}`,type:"string",required:!0,group:d.type,description:`Variable placeholder in template ${d.type}`})}}return{name:`Template variables: ${((u=t.data)==null?void 0:u.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}};var st=class{constructor(e){i(this,"messages");i(this,"conversations");this.messages=new P(e),this.conversations=new nt(e)}},it=class{constructor(e){i(this,"leads");i(this,"pipelines");i(this,"activities");i(this,"analytics");i(this,"scoring");i(this,"payments");i(this,"chat");i(this,"events");i(this,"invoices");i(this,"checkout");i(this,"projects");i(this,"niche");i(this,"documents");i(this,"invoiceExport");i(this,"ai");this.leads=new Le(e),this.pipelines=new $e(e),this.activities=new Ae(e),this.analytics=new Re(e),this.scoring=new Ve(e),this.payments=new Ee(e),this.chat=new st(e),this.events=new De(e),this.invoices=new Fe(e),this.checkout=new Se(e),this.projects=new Je(e),this.niche=new qe(e),this.documents=new Ie(e),this.invoiceExport=new Pe(e),this.ai=new $(e)}},ot=class{constructor(e){i(this,"automations");i(this,"campaigns");i(this,"conversations");i(this,"home");i(this,"drafts");i(this,"firstRun");i(this,"audiences");this.automations=new O(e),this.campaigns=new T(e),this.conversations=new D(e),this.home=new U(e),this.drafts=new _(e),this.firstRun=new F(e),this.audiences=new M(e)}},at=class{constructor(e){i(this,"projects");i(this,"audits");i(this,"insights");i(this,"searchConsole");i(this,"ranks");i(this,"local");i(this,"reports");i(this,"backlinks");i(this,"performance");i(this,"briefs");i(this,"research");this.projects=new se(e),this.audits=new ie(e),this.insights=new oe(e),this.searchConsole=new ae(e),this.ranks=new ce(e),this.local=new ue(e),this.reports=new le(e),this.backlinks=new ge(e),this.performance=new de(e),this.briefs=new me(e),this.research=new pe(e)}},ct=class{constructor(e){i(this,"packs");i(this,"signals");i(this,"tools");i(this,"campaigns");i(this,"runs");i(this,"leads");i(this,"import");i(this,"lists");i(this,"compliance");i(this,"market");i(this,"learning");i(this,"lookalikes");i(this,"freshness");i(this,"audit");this.packs=new N(e),this.signals=new q(e),this.tools=new B(e),this.campaigns=new K(e),this.runs=new j(e),this.leads=new G(e),this.import=new H(e),this.lists=new W(e),this.compliance=new Q(e),this.market=new z(e),this.learning=new Y(e),this.lookalikes=new J(e),this.freshness=new X(e),this.audit=new Z(e)}},fe=class{constructor(e){i(this,"erix");i(this,"flow");i(this,"seo");i(this,"laie");this.erix=new it(e),this.flow=new ot(e),this.seo=new at(e),this.laie=new ct(e)}},ut=class{constructor(e){i(this,"config");i(this,"templates");this.config=new Xe(e),this.templates=new Oe(e)}},lt=class{constructor(e){i(this,"templates");this.templates=new rt(e)}},At=class{constructor(e){i(this,"leadForms");this.leadForms=new Ue(e)}},pt=class{constructor(e){i(this,"email");i(this,"whatsapp");i(this,"facebook");i(this,"meet");i(this,"connections");i(this,"accounts");i(this,"voice");this.email=new ut(e),this.whatsapp=new lt(e),this.facebook=new At(e),this.meet=new Ne(e),this.connections=new Ce(e),this.accounts=new V(e),this.voice=new be(e)}},gt=class{constructor(e){i(this,"files");i(this,"folders");i(this,"media");this.files=new et(e),this.folders=new Ze(e),this.media=new Me(e)}},Rt=class{constructor(e){i(this,"collector");this.collector=new ye(e)}},xe=class{constructor(e){i(this,"connect");i(this,"storage");i(this,"serp");this.connect=new pt(e),this.storage=new gt(e),this.serp=new Rt(e)}},dt=class{constructor(e){i(this,"onboarding");i(this,"persona");i(this,"audit");this.onboarding=new ee(e),this.persona=new te(e),this.audit=new je(e)}},mt=class{constructor(e){i(this,"me");i(this,"members");i(this,"sessions");i(this,"notifications");this.me=new Qe(e),this.members=new ze(e),this.sessions=new Ye(e),this.notifications=new Be(e)}},ke=class{constructor(e){i(this,"auth");i(this,"users");i(this,"tenants");i(this,"billing");i(this,"support");i(this,"ai");i(this,"knowledge");i(this,"health");i(this,"catalog");this.auth=new Ge(e),this.users=new mt(e),this.tenants=new dt(e),this.billing=new He(e),this.support=new We(e),this.ai=new Ke(e),this.knowledge=new re(e),this.health=new _e(e),this.catalog=new ne(e)}};var S=class extends f{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},we=class{async constructEvent(e,t,n){if(!t)throw new S("No webhook signature provided");let o=Array.isArray(t)?t[0]:t;o.startsWith("sha256=")&&(o=o.slice(7));try{let a=await import("crypto"),d=a.createHmac("sha256",n).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(d),Buffer.from(o)))throw new S("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof S?a:new S(`Webhook payload parsing failed: ${a.message}`)}}};var It=typeof process!="undefined"&&"4.1.0"||"3.1.1";var Wt,Pt=(Wt=Ht.default)!=null?Wt:Ht,L=class{constructor(e){i(this,"client");i(this,"socket",null);i(this,"startSocket",null);i(this,"socketPromise",null);i(this,"socketQueue",[]);i(this,"clientCode");i(this,"apiVersion");i(this,"platform");i(this,"product");i(this,"infra");i(this,"webhooks");i(this,"lastSeq");i(this,"closed",!1);var k,E,Lt,Et,$t,Vt,Ot,Dt;let t=e.proxy;if(!e.apiKey&&!t)throw new A("API Key is required");this.clientCode=(k=e.clientCode)==null?void 0:k.toUpperCase(),this.apiVersion=(E=e.version)!=null?E:"v1";let n=(Lt=e.baseUrl)!=null?Lt:qt,o=Bt(this.apiVersion,(Et=t==null?void 0:t.url)!=null?Et:n),a=e.socketUrl||n,u=typeof window!="undefined"&&typeof window.document!="undefined",d=u?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",g=u?(($t=globalThis.navigator)==null?void 0:$t.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",C=v(l({},t?{}:{"x-api-key":e.apiKey,"x-client-code":((Vt=e.clientCode)==null?void 0:Vt.toUpperCase())||""}),{"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:It,runtime:d,os:g})});if(this.client=on.create({baseURL:o,headers:C,timeout:(Ot=e.timeout)!=null?Ot:3e4}),Pt(this.client,{retries:3,retryDelay:Pt.exponentialDelay,retryCondition:b=>{var ve;return Pt.isNetworkOrIdempotentRequestError(b)||((ve=b.response)==null?void 0:ve.status)===429},onRetry:(b,ve,Ut)=>{var _t,Ft;typeof process!="undefined"&&((_t=process.env)==null?void 0:_t.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${b}/3): ${(Ft=Ut.method)==null?void 0:Ft.toUpperCase()} ${Ut.url}. Reason: ${ve.message}`)}}),this.platform=new ke(this.client),this.product=new fe(this.client),this.infra=new xe(this.client),this.webhooks=new we,t){if(t.ticket){let b=t.ticket;this.startSocket=()=>this.initSocket(a,async()=>({ticket:await b()}))}}else{let b={apiKey:e.apiKey,clientCode:((Dt=e.clientCode)==null?void 0:Dt.toUpperCase())||""};this.startSocket=()=>this.initSocket(a,async()=>b,{"x-api-key":b.apiKey,"x-client-code":b.clientCode})}if(u){let b={version:It,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=b}}initSocket(e,t,n){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:o})=>{this.socket=o(e,{auth:a=>{t().then(u=>a(v(l({},u),{lastSeq:this.lastSeq})),()=>a({lastSeq:this.lastSeq}))},extraHeaders:n,transports:["websocket","polling"],tryAllTransports:!0}),this.setupSocket();for(let{type:a,args:u}of this.socketQueue)a==="joinRoom"?this.socket.emit("join-room",u[0]):a==="leaveRoom"?this.socket.emit("leave-room",u[0]):a==="on"?this.socket.on(u[0],u[1]):a==="off"?this.socket.off(u[0],u[1]):a==="disconnect"&&this.socket.disconnect();this.socketQueue=[]}),this.socketPromise)}joinRoom(e){var t;this.closed||(t=this.startSocket)==null||t.call(this),this.socket?this.socket.emit("join-room",e):this.socketQueue.push({type:"joinRoom",args:[e]})}leaveRoom(e){this.socket?this.socket.emit("leave-room",e):this.socketQueue.push({type:"leaveRoom",args:[e]})}setupSocket(){this.socket&&(this.socket.on("connect_error",()=>{var e;(e=this.socket)!=null&&e.active||setTimeout(()=>{var t;this.closed||(t=this.socket)==null||t.connect()},5e3)}),this.socket.onAny((...e)=>{var n,o;let t=(n=e.at(-1))==null?void 0:n.seq;typeof t=="number"&&t>((o=this.lastSeq)!=null?o:0)&&(this.lastSeq=t)}))}on(e,t){var n;return this.closed||(n=this.startSocket)==null||n.call(this),this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.closed=!0,this.socket?this.socket.disconnect():this.socketPromise&&this.socketQueue.push({type:"disconnect",args:[]})}off(e,t){return this.socket?this.socket.off(e,t):this.socketQueue.push({type:"off",args:[e,t]}),this}async request(e,t,n,o){var a,u,d;try{return(await this.client.request({method:e,url:t,data:n,params:o})).data}catch(g){throw g.response?new f(((a=g.response.data)==null?void 0:a.message)||((u=g.response.data)==null?void 0:u.error)||"Raw Execution Failed",g.response.status,(d=g.response.data)==null?void 0:d.code):new f(g.message||"Network Error")}}};var Ti={401:A,403:Kt,429:Te};function Si(r){throw R(r)}function Ci(r,e){return r instanceof e}function Ai(r){return r instanceof A?{message:r.message,status:r.status,code:r.code,type:"AuthenticationError"}:r instanceof Te?{message:r.message,status:r.status,code:r.code,type:"RateLimitError"}:r instanceof f?{message:r.message,status:r.status,code:r.code,type:"APIError"}:{message:r.message||"Unknown error",type:"UnknownError"}}var Qt={[A.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[Te.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[f.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function Ri(r){let e=r.constructor.name;return Qt[e]||Qt[f.name]}var Li=L;export{f as APIError,s as APIResource,$ as AiAgent,A as AuthenticationError,T as Campaigns,ne as Catalog,ye as Collector,V as ConnectAccounts,pt as ConnectInfra,L as ECODrIx,L as ECODrIxAPI,Qt as ERROR_RETRY_CONFIG,cn as EcodrixError,ut as EmailConnect,st as ErixChat,it as ErixProduct,M as FlowAudiences,O as FlowAutomations,D as FlowConversations,_ as FlowDrafts,F as FlowFirstRunResource,U as FlowHome,ot as FlowProduct,Ti as HTTP_STATUS_ERROR_MAP,xe as InfraDomain,Xt as KNOWLEDGE_FILE_TYPES,re as Knowledge,Yt as LAIE_EVENTS,jt as LEAD_STATUS_VALUES,Z as LaieAudits,K as LaieCampaigns,Q as LaieCompliance,X as LaieFreshness,H as LaieImport,G as LaieLeads,Y as LaieLearning,W as LaieLists,J as LaieLookalikes,z as LaieMarket,N as LaiePacks,ct as LaieProduct,j as LaieRuns,q as LaieSignals,B as LaieTools,ee as Onboarding,Kt as PermissionError,te as Persona,ke as PlatformDomain,dt as PlatformTenants,mt as PlatformUsers,fe as ProductDomain,Te as RateLimitError,ie as SeoAudits,ge as SeoBacklinks,me as SeoBriefs,oe as SeoInsights,ue as SeoLocal,de as SeoPerformance,at as SeoProduct,se as SeoProjects,ce as SeoRanks,le as SeoReports,pe as SeoResearch,ae as SeoSearchConsole,gt as StorageInfra,en as VOICE_EVENTS,Gt as VOICE_REFUSAL_REASONS,be as Voice,tt as VoiceCampaigns,S as WebhookSignatureError,we as Webhooks,lt as WhatsAppConnect,Li as default,Ai as getErrorDetails,Ri as getRetryConfig,Si as handleAPIError,Ci as isAPIError,zt as laieStageQueued,R as toAPIError,nn as voiceErrorCode,rn as voiceRefusalReason};
|
|
1
|
+
import{a as u,b as v,c as w,d as i,e as Nt,f as qt,g as Bt,h as Kt,i as ln,j as f,k as R,l as jt,m as Ce,n as A}from"./chunk-XPXDFZWU.js";import an from"axios";import Wt from"axios-retry";var s=class{constructor(e){i(this,"client",e)}async post(e,t,r){try{let o=this.buildConfig(r);return(await this.client.post(e,t,o)).data}catch(o){this.handleError(o)}}async get(e,t){try{let r=this.buildConfig(t);return(await this.client.get(e,r)).data}catch(r){this.handleError(r)}}async patch(e,t,r){try{let o=this.buildConfig(r);return(await this.client.patch(e,t,o)).data}catch(o){this.handleError(o)}}async put(e,t,r){try{let o=this.buildConfig(r);return(await this.client.put(e,t,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,t){try{let r=this.buildConfig(t);return(await this.client.delete(e,r)).data}catch(r){this.handleError(r)}}buildConfig(e){if(!e)return;let t=u({},e);return e.idempotencyKey&&(t.headers=v(u({},t.headers),{"Idempotency-Key":e.idempotencyKey})),t}handleError(e){throw A(e)}};var V=class extends s{async settings(){return this.get("/product/erix/ai/settings")}async updateSettings(e){return this.patch("/product/erix/ai/settings",e)}async outcomes(e={}){return this.get("/product/erix/ai/outcomes",{params:e})}async reviews(e){return this.get(`/product/erix/ai/reviews${e?`?status=${e}`:""}`)}async review(e,t,r){return this.post(`/product/erix/ai/reviews/${encodeURIComponent(e)}`,u({verdict:t},r?{note:r}:{}))}async suggestion(e){return this.get(`/product/erix/ai/suggestion/${e}`)}async approveAction(e){return this.post(`/product/erix/ai/suggestion/${e}/approve-action`,{})}async markSent(e,t,r){return this.post(`/product/erix/ai/suggestion/${e}/send`,{text:t,confidence:r})}async dismiss(e){return this.post(`/product/erix/ai/suggestion/${e}/dismiss`,{})}async approvals(){return this.get("/product/flow/approvals")}async agents(){return this.get("/product/flow/agents")}async agent(e){return this.get(`/product/flow/agents/${encodeURIComponent(e)}`)}async tryAgent(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/try`,t)}async proposeAgentChange(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/propose`,t)}async buildAgent(e){return this.post("/product/flow/agents/build",e)}async unansweredQuestions(){return this.get("/product/flow/agents/unanswered")}async markQuestionHandled(e){return this.post("/product/flow/agents/unanswered/handled",{question:e})}async agentTemplates(){return this.get("/product/flow/agents/templates")}async createAgent(e){return this.post("/product/flow/agents",e)}async updateAgent(e,t){return this.patch(`/product/flow/agents/${encodeURIComponent(e)}`,t)}async deleteAgent(e){return this.deleteRequest(`/product/flow/agents/${encodeURIComponent(e)}`)}async agentAutomation(e,t){return this.post(`/product/flow/agents/${encodeURIComponent(e)}/automation`,{trigger:t})}async decideRun(e,t,r){return this.post(`/product/flow/runs/${encodeURIComponent(e)}/approve`,u({decision:t},r&&{nodeId:r}))}};var y="/product/erix/commerce/checkout",x="/product/erix/public/checkout",h=encodeURIComponent,bt=class extends s{async getProduct(e,t){return this.get(`${x}/products/${h(t)}`,{params:{c:e}})}async viewSession(e,t){return this.get(`${x}/sessions/view`,{params:{c:e,t}})}async updateItems(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/items`,r)}async startSession(e){return this.post(`${x}/sessions`,e)}async applyCoupon(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/coupon`,r)}async verify(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/verify`,r)}async placeOrder(e){let o=e,{sessionId:t}=o,r=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/order`,r)}async verifyRazorpay(e){let a=e,{sessionId:t,orderId:r}=a,o=w(a,["sessionId","orderId"]);return this.post(`${x}/sessions/${h(t)}/order/${h(r)}/razorpay`,o)}async orderStatus(e,t){return this.get(`${x}/orders/status`,{params:{c:e,t}})}async confirmCod(e,t){return this.post(`${x}/cod/confirm`,{clientCode:e,token:t})}},ft=class extends s{async create(e){return this.post(`${y}/sessions`,e)}},Se=class extends s{constructor(t){super(t);i(this,"buyer");i(this,"sessions");this.buyer=new bt(t),this.sessions=new ft(t)}async listProducts(){return this.get(`${y}/products`)}async createProduct(t){return this.post(`${y}/products`,t)}async updateProduct(t,r){return this.patch(`${y}/products/${h(t)}`,r)}async deleteProduct(t){return this.deleteRequest(`${y}/products/${h(t)}`)}async listCoupons(){return this.get(`${y}/coupons`)}async createCoupon(t){return this.post(`${y}/coupons`,t)}async updateCoupon(t,r){return this.patch(`${y}/coupons/${h(t)}`,r)}async deleteCoupon(t){return this.deleteRequest(`${y}/coupons/${h(t)}`)}async listOrders(t){return this.get(`${y}/orders`,{params:t})}async getOrder(t){return this.get(`${y}/orders/${h(t)}`)}async updateOrderStatus(t,r){return this.patch(`${y}/orders/${h(t)}/status`,r)}async getSettings(){return this.get(`${y}/settings`)}async updateSettings(t){return this.put(`${y}/settings`,t)}async createProductLink(t){return this.post(`${y}/links`,t)}};var Re=class extends s{async providers(){return this.get("/infra/connect/providers")}async list(){return this.get("/infra/connect/connections")}async get_(e){return this.get(`/infra/connect/connections/${e}`)}async connect(e,t){return this.post(`/infra/connect/connections/${e}/connect`,t)}async configure(e,t){return this.put(`/infra/connect/connections/${e}/configure`,t)}async configureWebchat(e){return this.configure("webchat",{method:"domain",config:e})}async webchatSettings(){return this.get("/infra/connect/connections/webchat/settings")}async removeWebchatDomain(e){return this.deleteRequest(`/infra/connect/connections/webchat/domains/${encodeURIComponent(e)}`)}async disconnect(e){return this.post(`/infra/connect/connections/${e}/disconnect`,{})}async reveal(e){return this.post(`/infra/connect/connections/${e}/reveal`,{})}async test(e){return this.post(`/infra/connect/connections/${e}/test`,{})}async checkNow(e){return this.post(`/infra/connect/connections/${e}/health/check`,{})}async googleConnectUrl(){return this.post("/infra/connect/google/connect-url",{})}async moveChannel(e,t){return this.post(`/infra/connect/${e}/move`,{ticket:t})}async requestChannelRelease(e,t){return this.post(`/infra/connect/${e}/release-request`,{ticket:t})}async channelReleaseRequest(e){return this.get(`/infra/connect/${e}/release-request`)}async cancelChannelRelease(e){return this.deleteRequest(`/infra/connect/${e}/release-request`)}async createPaymentLink(e){return this.post("/infra/connect/connections/payments/payment-link",e)}};var O=class extends s{async list(e){return this.get("/infra/connect/accounts",e?{params:{providerId:e}}:void 0)}async retrieve(e){return this.get(`/infra/connect/accounts/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/infra/connect/accounts/${encodeURIComponent(e)}`,t)}async remove(e,t={}){return this.deleteRequest(`/infra/connect/accounts/${encodeURIComponent(e)}`,t.newDefaultId?{params:{newDefaultId:t.newDefaultId}}:void 0)}};var xt=class extends s{async list(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async create(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async update(e,t){return this.patch(`/product/erix/crm/notes/${e}`,{content:t})}async pin(e,t=!0){return this.patch(`/product/erix/crm/notes/${e}/pin`,{isPinned:t})}async delete(e){return this.deleteRequest(`/product/erix/crm/notes/${e}`)}},Ae=class extends s{constructor(t){super(t);i(this,"notes");this.notes=new xt(t)}async timeline(t,r){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:r})}async list(t,r){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:u({},r)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,r){return this.post(`/product/erix/crm/leads/${t}/calls`,r)}};var Ie=class extends s{async overview(e){return this.get("/product/erix/crm/analytics/overview",{params:e})}async funnel(e){return this.get("/product/erix/crm/analytics/funnel",{params:{pipelineId:e}})}async forecast(e){return this.get("/product/erix/crm/analytics/forecast",{params:{pipelineId:e}})}async sources(e){return this.get("/product/erix/crm/analytics/sources",{params:e})}async team(e){return this.get("/product/erix/crm/analytics/team",{params:e})}async heatmap(e){return this.get("/product/erix/crm/analytics/heatmap",{params:e})}async scores(){return this.get("/product/erix/crm/analytics/scores")}async stageTime(e){return this.get("/product/erix/crm/analytics/stage-time",{params:{pipelineId:e}})}async tiered(e){return this.get("/product/erix/crm/analytics/tiered",{params:e})}async summary(e){return this.get("/product/erix/crm/analytics/summary",{params:e})}async whatsapp(e){return this.get("/product/erix/crm/analytics/whatsapp",{params:e})}async revenue(){return this.get("/product/erix/crm/analytics/revenue")}async health(){return this.get("/product/erix/crm/analytics/health")}async payments(){return this.get("/product/erix/crm/analytics/payments")}async reviews(){return this.get("/product/erix/crm/analytics/reviews")}async retention(){return this.get("/product/erix/crm/analytics/retention")}};var Pe=class extends s{async getChecklist(e){return this.get(`/product/erix/crm/documents/checklist/${e}`)}async createChecklist(e,t){return this.post(`/product/erix/crm/documents/checklist/${e}`,{templateNiche:t})}async markReceived(e,t,r){return this.patch(`/product/erix/crm/documents/checklist/${e}/${t}`,r?{fileUrl:r}:{})}async sendReminder(e){return this.post(`/product/erix/crm/documents/checklist/${e}/remind`)}async listIncomplete(){return this.get("/product/erix/crm/documents/checklist/incomplete")}async listTemplates(){return this.get("/product/erix/crm/documents/templates")}};var Le=class extends s{async csv(e){return this.get("/product/erix/commerce/invoices/export/csv",{params:e})}async tally(e){return this.get("/product/erix/commerce/invoices/export/tally",{params:e})}async zoho(e){return this.get("/product/erix/commerce/invoices/export/zoho",{params:e})}};var Gt=["open","won","lost","archived"],Ee=class extends s{async create(e){return this.post("/product/erix/crm/leads",e)}async describe(){let e=await this.fields(),t=Array.isArray(e.data)?e.data:[],r=[{key:"firstName",label:"First Name",type:"string",required:!0,group:"Basic Info"},{key:"lastName",label:"Last Name",type:"string",required:!1,group:"Basic Info"},{key:"phone",label:"Phone Number",type:"phone",required:!0,group:"Contact"},{key:"email",label:"Email Address",type:"email",required:!1,group:"Contact"},{key:"status",label:"Status",type:"select",required:!0,options:Gt.map(a=>({label:`${a.charAt(0).toUpperCase()}${a.slice(1)}`,value:a}))},{key:"value",label:"Lead Value",type:"currency",required:!1},{key:"source",label:"Source",type:"string",required:!1}],o=t.map(a=>({key:`metadata.extra.${a.name}`,label:a.label||a.name,type:a.type||"string",required:!!a.required,options:a.options,group:"Custom Fields"}));return{name:"Lead",fields:[...r,...o],uiHints:{icon:"User",primaryColor:"#3b82f6",defaultSort:{field:"createdAt",direction:"desc"},summaryFields:["firstName","lastName","phone","status"]}}}async upsert(e){return this.post("/product/erix/crm/leads/upsert",e)}async createMany(e,t=50){let r=[];for(let o=0;o<e.length;o+=t){let l=e.slice(o,o+t).map(g=>this.create(g)),d=await Promise.allSettled(l);for(let g of d)if(g.status==="fulfilled")r.push(g.value);else throw g.reason}return r}async import(e,t={}){return this.post("/product/erix/crm/leads/import",u({leads:e},t))}async bulkUpsert(e){return this.import(e)}async list(e){let t=u({},e);return Array.isArray(t.tags)&&(t.tags=t.tags.join(",")),this.get("/product/erix/crm/leads",{params:t})}listAutoPaging(e){return qt(this,null,function*(){let t=(e==null?void 0:e.page)||1,r=!0;for(;r;){let o=yield new Nt(this.list(v(u({},e),{page:t}))),a=Array.isArray(o.data)?o.data:o||[];if(a.length===0){r=!1;break}for(let l of a)yield l;o.pagination&&t<o.pagination.pages||!o.pagination&&a.length>0?t++:r=!1}})}async retrieve(e){return this.get(`/product/erix/crm/leads/${e}`)}async retrieveByPhone(e){return this.get(`/product/erix/crm/leads/phone/${encodeURIComponent(e)}`)}async byStage(e,t,r={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:r})}async retrieveByRef(e,t){return this.get(`/product/erix/crm/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)}async update(e,t){return this.patch(`/product/erix/crm/leads/${e}`,t)}async setFollowUp(e,t,r){return this.patch(`/product/erix/crm/leads/${e}`,{nextFollowUpAt:t,nextFollowUpNote:t&&r!=null?r:null})}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,r){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:r})}async tags(e,t){return this.patch(`/product/erix/crm/leads/${e}/tags`,t)}async recalculateScore(e){return this.post(`/product/erix/crm/leads/${e}/score`,{})}async updateMetadata(e,t){return this.patch(`/product/erix/crm/leads/${e}/metadata`,t)}async fields(){return this.get("/product/erix/crm/fields")}async notes(e){return this.get(`/product/erix/crm/leads/${e}/notes`)}async activities(e,t){return this.get(`/product/erix/crm/leads/${e}/timeline`,{params:t})}async createNote(e,t){return this.post(`/product/erix/crm/leads/${e}/notes`,t)}async updateNote(e,t,r){return this.patch(`/product/erix/crm/notes/${t}`,r)}async deleteNote(e,t){return this.deleteRequest(`/product/erix/crm/notes/${t}`)}async delete(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async export(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/export`)}async erase(e){return this.post(`/product/erix/crm/leads/${encodeURIComponent(e)}/erase`,{confirm:"ERASE"})}async bulkArchive(e){return this.patch("/product/erix/crm/leads/bulk-archive",{ids:e})}async bulkDelete(e){return this.deleteRequest("/product/erix/crm/leads",{data:{ids:e}})}async archive(e){return this.deleteRequest(`/product/erix/crm/leads/${e}`)}async profile(e){return this.get(`/product/erix/crm/leads/${e}/profile`)}async invoices(e){return this.get(`/product/erix/crm/leads/${e}/invoices`)}async projects(e){return this.get(`/product/erix/crm/leads/${e}/projects`)}async conversations(e){return this.get(`/product/erix/crm/leads/${e}/conversations`)}async meetings(e){return this.get(`/product/erix/crm/leads/${e}/meetings`)}async flowRuns(e){return this.get(`/product/erix/crm/leads/${e}/flow-runs`)}async merge(e,t){return this.post("/product/erix/crm/leads/merge",{primaryId:e,secondaryId:t})}async duplicates(e){return this.get(`/product/erix/crm/leads/${encodeURIComponent(e)}/duplicates`)}};var $e=class extends s{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var Ve=class extends s{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,a;let t=await this.retrieve(e),r=Array.isArray((o=t.data)==null?void 0:o.stages)?t.data.stages:[];return{name:`Pipeline: ${((a=t.data)==null?void 0:a.name)||e}`,fields:r.map(l=>({key:l._id,label:l.name,type:"string",required:!0,options:[{label:l.name,value:l._id}],group:"Stages",uiHints:{color:l.color||"#cbd5e1",probability:l.probability}})),uiHints:{icon:"Columns",primaryColor:"#6366f1"}}}async create(e){return this.post("/product/erix/crm/pipelines",e)}async retrieve(e){return this.get(`/product/erix/crm/pipelines/${e}`)}async update(e,t){return this.patch(`/product/erix/crm/pipelines/${e}`,t)}async setDefault(e){return this.patch(`/product/erix/crm/pipelines/${e}/default`,{})}async duplicate(e,t){return this.post(`/product/erix/crm/pipelines/${e}/duplicate`,{name:t})}async archive(e){return this.patch(`/product/erix/crm/pipelines/${e}/archive`,{})}async delete(e){return this.deleteRequest(`/product/erix/crm/pipelines/${e}`)}async checkInUse(e){return this.get(`/product/erix/crm/pipelines/${e}/in-use`)}async board(e){return this.get(`/product/erix/crm/pipelines/${e}/board`)}async forecast(e){return this.get(`/product/erix/crm/pipelines/${e}/forecast`)}async addStage(e,t){return this.post(`/product/erix/crm/pipelines/${e}/stages`,t)}async reorderStages(e,t){return this.patch(`/product/erix/crm/pipelines/${e}/stages/reorder`,{order:t})}async updateStage(e,t){return this.patch(`/product/erix/crm/stages/${e}`,t)}async deleteStage(e,t){return this.deleteRequest(`/product/erix/crm/stages/${e}`,{data:t?{moveLeadsToStageId:t}:void 0})}};var Oe=class extends s{async getConfig(){return this.get("/product/erix/crm/scoring")}async updateConfig(e){return this.patch("/product/erix/crm/scoring",e)}async recalculate(e){return this.post(`/product/erix/crm/scoring/${e}/recalculate`,{})}async preview(e){return this.get(`/product/erix/crm/scoring/preview/${e}`)}};var De=class extends s{async sendTest(e){return this.post("/infra/connect/email/test",{to:e})}async listTemplates(e){return this.get("/infra/connect/email/templates",{params:e})}async getTemplate(e){return this.get(`/infra/connect/email/templates/${e}`)}async createTemplate(e){return this.post("/infra/connect/email/templates",e)}async updateTemplate(e,t){return this.put(`/infra/connect/email/templates/${e}`,t)}async deleteTemplate(e,t=!1){return this.deleteRequest(`/infra/connect/email/templates/${e}`,{params:{force:t}})}async previewTemplate(e,t){return this.post(`/infra/connect/email/templates/${e}/preview`,t)}};var Ue=class extends s{async trigger(e){return this.post("/product/erix/events/trigger",e)}async listCustomEvents(){return this.get("/product/flow/config/triggers")}async createCustomEvent(e){return this.post("/product/flow/config/triggers",e)}async deleteCustomEvent(e){return this.deleteRequest(`/product/flow/config/triggers/${e}`)}};var Fe=class extends s{async list(){return this.get("/infra/connect/facebook/lead-forms")}async subscribe(){return this.post("/infra/connect/facebook/lead-forms/subscribe",{})}async setEnabled(e,t){return this.put(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}`,{enabled:t})}async importLast24Hours(e){return this.post(`/infra/connect/facebook/lead-forms/${encodeURIComponent(e)}/import-last-24h`,{})}};var D=class extends s{path(e,t=""){return`/product/flow/workflows/${encodeURIComponent(e)}${t}`}async versions(e){return this.get(this.path(e,"/versions"))}async version(e,t){return this.get(this.path(e,`/versions/${encodeURIComponent(t)}`))}async restoreVersion(e,t){return this.post(this.path(e,`/versions/${encodeURIComponent(t)}/restore`))}async testData(e){return this.get(this.path(e,"/test-data"))}async pinTestData(e,t){return this.put(this.path(e,"/test-data"),{runId:t})}async unpinTestData(e){return this.deleteRequest(this.path(e,"/test-data"))}async testRun(e,t={}){return this.post(this.path(e,"/test-run"),t)}async testRunProgress(e,t){return this.get(this.path(e,"/test-run"),{params:{runIds:t.join(",")}})}async copilot(e,t){return this.post(this.path(e,"/copilot"),t)}async live(e){return this.get(this.path(e,"/live"))}async week(e){return this.get(this.path(e,"/week"))}async deleteImpact(e){return this.get(this.path(e,"/delete-impact"))}async remove(e,t={}){return this.deleteRequest(this.path(e,t.stop?"?stop=true":""))}async duplicate(e){return this.post(this.path(e,"/duplicate"))}async retryFailed(e,t={}){return this.post(this.path(e,"/retry-failed"),t)}};var T=class extends s{async list(e={}){return this.get("/product/flow/campaigns",{params:e})}async create(e){return this.post("/product/flow/campaigns",e)}async launch(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/launch`,t)}async retrieve(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async update(e,t){return this.patch(`/product/flow/campaigns/${encodeURIComponent(e)}`,t)}async test(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/test`,{})}async start(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/start`,t)}async pause(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/pause`,{})}async resume(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/resume`,{})}async stop(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/stop`,{})}async remove(e){return this.deleteRequest(`/product/flow/campaigns/${encodeURIComponent(e)}`)}async duplicate(e){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/duplicate`,{})}async followUp(e,t={}){return this.post(`/product/flow/campaigns/${encodeURIComponent(e)}/follow-up`,t)}async checks(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/checks`)}async results(e){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/results`)}async people(e,t={}){return this.get(`/product/flow/campaigns/${encodeURIComponent(e)}/people`,{params:t})}};var I="/product/flow/conversations",m=(n,e="")=>`${I}/${encodeURIComponent(n)}${e}`,U=class extends s{async list(e={}){return this.get(I,{params:e})}async create(e){return this.post(I,e)}async retrieve(e){return this.get(m(e))}async update(e,t){return this.patch(m(e),t)}async duplicate(e){return this.post(m(e,"/duplicate"),{})}async archive(e){return this.deleteRequest(m(e))}async publish(e,t={}){return this.post(m(e,"/publish"),t)}async versions(e){return this.get(m(e,"/versions"))}async version(e,t){return this.get(m(e,`/versions/${t}`))}async rollback(e,t){return this.post(m(e,"/rollback"),{version:t})}async try(e,t){return this.post(m(e,"/try"),t)}async tests(e){return this.get(m(e,"/tests"))}async addTest(e,t){return this.post(m(e,"/tests"),t)}async deleteTest(e,t){return this.deleteRequest(m(e,`/tests/${encodeURIComponent(t)}`))}async runTests(e,t={}){return this.post(m(e,"/tests/run"),t)}async deployments(e){return this.get(m(e,"/deployments"))}async allDeployments(){return this.get(`${I}/deployments`)}async deploy(e,t){return this.post(m(e,"/deployments"),t)}async updateDeployment(e,t){return this.patch(`${I}/deployments/${encodeURIComponent(e)}`,t)}async removeDeployment(e){return this.deleteRequest(`${I}/deployments/${encodeURIComponent(e)}`)}async checks(e){return this.get(m(e,"/checks"))}};var F=class extends s{async get(){return super.get("/product/flow/home")}async nav(){return super.get("/product/flow/home/nav")}},_=class extends s{async create(e){return this.post("/product/flow/drafts",e)}async plan(e){return this.post("/product/flow/drafts/plan",e)}},M=class extends s{async status(){return this.get("/product/flow/first-run")}async installPack(e){return this.post(`/product/flow/first-run/packs/${e}`)}},N=class extends s{async list(){return this.get("/product/flow/audiences")}async byId(e){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}`)}async create(e){return this.post("/product/flow/audiences",e)}async update(e,t){return this.patch(`/product/flow/audiences/${encodeURIComponent(e)}`,t)}async remove(e){return this.deleteRequest(`/product/flow/audiences/${encodeURIComponent(e)}`)}async preview(e,t){return this.get(`/product/flow/audiences/${encodeURIComponent(e)}/preview${t?`?channel=${t}`:""}`)}async previewRules(e){return this.post("/product/flow/audiences/preview",e)}};var _e=class extends s{async system(){return(await this.get("/health")).data}};var Me=class extends s{async list(e){return this.get("/product/erix/commerce/invoices",{params:e})}async getInvoice(e){return this.get(`/product/erix/commerce/invoices/${e}`)}async create(e){return this.post("/product/erix/commerce/invoices",e)}async update(e,t){return this.patch(`/product/erix/commerce/invoices/${e}`,t)}async void(e){return this.post(`/product/erix/commerce/invoices/${e}/void`,{})}async sendViaWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${e}/send-whatsapp`,{})}async getSettings(){return this.get("/product/erix/commerce/settings")}async updateSettings(e){return this.put("/product/erix/commerce/settings",e)}async paymentLink(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payment-link`,{})}async recordPayment(e,t){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/payments`,t)}async sendWhatsApp(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-whatsapp`,{})}async sendEmail(e){return this.post(`/product/erix/commerce/invoices/${encodeURIComponent(e)}/send-email`,{})}};var Yt=n=>"queued"in n&&n.queued===!0,Jt={runProgress:"laie:run:progress",importComplete:"laie:import:complete"},p=encodeURIComponent,c="/product/laie",q=class extends s{async list(){return this.get(`${c}/packs`)}async byId(e){return this.get(`${c}/packs/${p(e)}`)}},B=class extends s{async catalog(e={}){return this.get(`${c}/signals/catalog`,{params:e})}async list(e={}){return this.get(`${c}/signals`,{params:e})}},K=class extends s{async find(e){return this.post(`${c}/tools/find`,e)}async collect(e){return this.post(`${c}/tools/collect`,e)}async enrich(e){return this.post(`${c}/tools/enrich`,e)}async verify(e){return this.post(`${c}/tools/verify`,e)}async qualify(e){return this.post(`${c}/tools/qualify`,e)}async store(e){return this.post(`${c}/tools/store`,e)}async use(e){return this.post(`${c}/tools/use`,e)}async verifyEmail(e){return this.post(`${c}/tools/verify-email`,{emails:e})}async websiteLookup(e){return this.post(`${c}/tools/website-lookup`,{url:e})}},j=class extends s{async list(){return this.get(`${c}/campaigns`)}async create(e){return this.post(`${c}/campaigns`,e)}async byId(e){return this.get(`${c}/flows/${p(e)}`)}async settings(e){return this.get(`${c}/campaigns/${p(e)}/settings`)}async updateSettings(e,t){return this.patch(`${c}/campaigns/${p(e)}/settings`,t)}async signals(e){return this.get(`${c}/campaigns/${p(e)}/signals`)}async setSignals(e,t){return this.put(`${c}/campaigns/${p(e)}/signals`,t)}},G=class extends s{async start(e){return this.post(`${c}/campaigns/${p(e)}/runs`)}async list(e,t={}){return this.get(`${c}/campaigns/${p(e)}/runs`,{params:t})}async byId(e,t){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}`)}async changes(e,t,r={}){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}/changes`,{params:r})}async cancel(e,t){return this.post(`${c}/campaigns/${p(e)}/runs/${p(t)}/cancel`)}async quality(e){return this.get(`${c}/jobs/${p(e)}/quality`)}},H=class extends s{async list(e={}){let o=e,{importedToCrm:t}=o,r=w(o,["importedToCrm"]);return this.get(`${c}/leads`,{params:u(u({},r),t!==void 0&&{importedToCrm:String(t)})})}async byId(e){return this.get(`${c}/leads/${p(e)}`)}async update(e,t){return this.patch(`${c}/leads/${p(e)}`,t)}async notes(e){return this.get(`${c}/leads/${p(e)}/notes`)}async addNote(e,t){return this.post(`${c}/leads/${p(e)}/notes`,t)}async generateKit(e){return this.post(`${c}/leads/${p(e)}/generate-kit`)}async pipelineSummary(){return this.get(`${c}/leads/pipeline-summary`)}async bulkContacted(e,t){return this.post(`${c}/leads/bulk/contacted`,{leadIds:e,channel:t})}async bulkTag(e,t){return this.post(`${c}/leads/bulk/tag`,{leadIds:e,tags:t})}async bulkDelete(e){return this.post(`${c}/leads/bulk/delete`,{leadIds:e})}async bulkExport(e,t="json"){return t==="csv"?this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t},{responseType:"text"}):this.post(`${c}/leads/bulk/export`,{leadIds:e,format:t})}},W=class extends s{async pipelines(){return this.get(`${c}/import/pipelines`)}async crm(e){return this.post(`${c}/import/crm`,e)}},Q=class extends s{async enrich(e){return this.post(`${c}/lists/enrich`,e)}},z=class extends s{async dsr(e){return this.post(`${c}/compliance/dsr`,e)}async report(e={}){return this.get(`${c}/compliance/report`,{params:e})}},Y=class extends s{async map(e={}){return this.get(`${c}/market-map`,{params:e})}async forCampaign(e){return this.get(`${c}/campaigns/${p(e)}/market-map`)}async refresh(e={}){return this.post(`${c}/market-map/refresh`,e)}},J=class extends s{async weights(e={}){return this.get(`${c}/learning/weights`,{params:e})}async outcomes(e={}){return this.get(`${c}/learning/outcomes`,{params:e})}},X=class extends s{async preview(e){return this.post(`${c}/lookalikes/preview`,e)}async create(e){return this.post(`${c}/lookalikes`,e)}async list(e={}){return this.get(`${c}/lookalikes`,{params:e})}async byId(e){return this.get(`${c}/lookalikes/${p(e)}`)}async rank(e,t={}){return this.get(`${c}/lookalikes/${p(e)}/rank`,{params:t})}},Z=class extends s{async status(){return this.get(`${c}/freshness`)}},ee=class extends s{async start(e){return this.post(`${c}/audit`,e)}async byId(e){return this.get(`${c}/audit/${p(e)}`)}};import Xt from"axios";var Ne=class extends s{async getUsage(){return this.get("/infra/storage/files/usage")}async createFolder(e){return this.post("/infra/storage/files/folders",{name:e})}async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}async delete(e){return this.deleteRequest("/infra/storage/files/files",{params:{key:e}})}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async aiDescribe(e){return this.post("/infra/storage/files/ai/describe",{key:e})}async upload(e,t){let r=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:o,key:a,headers:l}=r.data;await Xt.put(o,e,{headers:l!=null?l:{"Content-Type":t.contentType}});let d=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:a,sizeBytes:d})}};var qe=class extends s{async create(e){return this.post("/infra/connect/meet",e)}async list(e){return this.get("/infra/connect/meet",{params:e})}async retrieve(e){return this.get(`/infra/connect/meet/${e}`)}async update(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async reschedule(e,t){return this.patch(`/infra/connect/meet/${e}`,t)}async delete(e){return this.update(e,{status:"cancelled"})}};var Be=class extends s{async workflowPacks(){return this.get("/product/erix/crm/niche/workflow-packs")}async workflowPackDetail(e){return this.get(`/product/erix/crm/niche/workflow-packs/${e}`)}async installWorkflowPack(e){return this.post(`/product/erix/crm/niche/workflow-packs/${e}/install`)}async templateSuggestions(){return this.get("/product/erix/crm/niche/template-suggestions")}};var Ke=class extends s{async listAlerts(e){return this.get("/platform/users/notifications",{params:e})}async dismissAlert(e){return this.patch(`/platform/users/notifications/${e}/dismiss`)}async clearAllAlerts(){return this.deleteRequest("/platform/users/notifications/dismiss-all")}};var te=class extends s{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}};var ne=class extends s{async get(e){return super.get(`/platform/tenants/persona/${e}`)}async reinforce(e){return this.post(`/platform/tenants/persona/${e.productId}/reinforce`,e)}async confidence(e){return super.get(`/platform/tenants/persona/${e}/confidence`,{params:{productId:e}})}async timeline(e,t){var o;let r=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(o=r==null?void 0:r.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var r,o;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(r=t==null?void 0:t.data)==null?void 0:r.entries)!=null?o:[]}};var kt=class extends s{async chatSync(e){return this.post("/platform/ai/copilot/chat/sync",e)}async confirm(e){return this.post("/platform/ai/copilot/confirm",e)}async listSessions(){return this.get("/platform/ai/copilot/sessions")}async getSession(e){return this.get(`/platform/ai/copilot/sessions/${e}`)}async deleteSession(e){return this.deleteRequest(`/platform/ai/copilot/sessions/${e}`)}chatStreamUrl(){return"/platform/ai/copilot/chat"}},je=class{constructor(e){i(this,"copilot");this.copilot=new kt(e)}};var Ge=class extends s{async list(e){return this.get("/platform/tenants/audit",{params:e})}};var He=class extends s{async register(e){return this.post("/platform/auth/register",e)}async login(e){return this.post("/platform/auth/login",e)}async logout(e){return this.post("/platform/auth/logout",e)}async logoutAll(e){return this.post("/platform/auth/logout-all",e)}async validateSession(e){return this.post("/platform/auth/session/validate",e)}async listSessions(){return this.get("/platform/auth/sessions")}async revokeSession(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}async requestPasswordOtp(e){return this.post("/platform/auth/password/request-otp",e)}async setPassword(e){return this.post("/platform/auth/password/set",e)}async changePassword(e){return this.post("/platform/auth/password/change",e)}async forgotPassword(e){return this.post("/platform/auth/forgot",e)}async resetPassword(e){return this.post("/platform/auth/reset",e)}async linkOAuth(e){return this.post("/platform/auth/oauth-link",e)}async getInvitation(e){return this.get(`/platform/auth/invitations/${e}`)}async acceptInvitation(e,t){return this.post(`/platform/auth/invitations/${e}/accept`,t)}};var wt=class extends s{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},vt=class extends s{async upgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/upgrade",e)}async downgrade(e){return this.post("/platform/billing/subscriptions/subscriptions/downgrade",e)}async cancel(e){return this.post("/platform/billing/subscriptions/subscriptions/cancel",e)}},Tt=class extends s{list(){return this.get("/platform/billing/addons")}add(e,t){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/add`,t===void 0?{}:{quantity:t})}remove(e){return this.post(`/platform/billing/addons/${encodeURIComponent(e)}/remove`)}overage(){return this.get("/platform/billing/overage")}setOverage(e){return this.put("/platform/billing/overage",e)}},Ct=class extends s{async listPublic(){return this.get("/platform/billing/plans/public")}},St=class extends s{async plans(){return this.get("/platform/billing/checkout/plans")}async proration(e,t){return this.get("/platform/billing/checkout/proration",{params:{planId:e,billingCycle:t}})}async subscribe(e){return this.post("/platform/billing/checkout/subscribe",e)}async verify(e){return this.post("/platform/billing/checkout/verify",e)}async cancel(e){return this.post("/platform/billing/checkout/cancel",e)}async status(){return this.get("/platform/billing/checkout/status")}async syncPlan(e){return this.post("/platform/billing/checkout/sync-plan",e)}},Rt=class extends s{async transactions(){return this.get("/platform/billing/user/transactions")}async transactionInvoice(e){return this.get(`/platform/billing/user/transactions/${encodeURIComponent(e)}/invoice`)}async subscription(){return this.get("/platform/billing/user/subscription")}async raiseDispute(e){return this.post("/platform/billing/user/dispute",e)}async disputes(){return this.get("/platform/billing/user/disputes")}},At=class extends s{async balance(){return this.get("/platform/billing/credits/balance")}async transactions(){return this.get("/platform/billing/credits/transactions")}async packs(){return this.get("/platform/billing/credits/packs")}async topupOrder(e){return this.post("/platform/billing/credits/topup/order",e)}async verifyTopup(e){return this.post("/platform/billing/credits/topup/verify",e)}async setAutoTopup(e){return this.patch("/platform/billing/credits/auto-topup",e)}async setSpendCap(e){return this.patch("/platform/billing/credits/spend-cap",e)}},We=class{constructor(e){i(this,"entitlements");i(this,"subscriptions");i(this,"plans");i(this,"checkout");i(this,"user");i(this,"credits");i(this,"addOns");this.entitlements=new wt(e),this.subscriptions=new vt(e),this.plans=new Ct(e),this.checkout=new St(e),this.user=new Rt(e),this.credits=new At(e),this.addOns=new Tt(e)}};var re=class extends s{async list(){return this.get("/platform/public/catalog",{ignoreClientCode:!0})}};var P=class extends s{async send(e){if(e.conversationId)return this.post(`/platform/inbox/conversations/${e.conversationId}/messages`,{text:e.text,media:e.media});if(!e.to)throw new Error("send: conversationId or to is required");if(e.media)throw new Error("send: media goes to an inbox thread (conversationId)");return this.post("/infra/connect/send/whatsapp",u({phone:e.to,text:e.text},e.accountId?{accountId:e.accountId}:{}))}async sendTemplate(e){return this.post("/infra/connect/send/whatsapp",u({phone:e.to,templateName:e.templateName,language:e.language,variables:e.variables},e.accountId?{accountId:e.accountId}:{}))}async star(e,t){return this.post(`/platform/inbox/messages/${e}/star`,{starred:t})}async translate(e){return this.post(`/platform/inbox/messages/${encodeURIComponent(e)}/translate`,{})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async upload(e,t={}){var k,E,$;let r=(E=(k=t.fileName)!=null?k:e.name)!=null?E:"file",o=e.type||"application/octet-stream",a=await this.post("/infra/storage/files/upload-url",{folder:($=t.folder)!=null?$:"inbox",filename:r,contentType:o}),{uploadUrl:l,key:d,headers:g}=a.data,S=await fetch(l,{method:"PUT",headers:g!=null?g:{"Content-Type":o},body:e});if(!S.ok)throw new Error(`upload failed (${S.status})`);return await this.post("/infra/storage/files/confirm-upload",{key:d,sizeBytes:e.size}),{key:d,mimeType:o,fileName:r}}};var Zt=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown","text/csv","text/html","image/png","image/jpeg","image/webp"],se=class extends s{async list(){return this.get("/platform/knowledge/sources")}async addText(e){return this.post("/platform/knowledge/sources",u({kind:"text"},e))}async addUrl(e){return this.post("/platform/knowledge/sources",u({kind:"url"},e))}async addWebsite(e){return this.post("/platform/knowledge/sources",{type:"website",url:e.url})}async addFile(e,t={}){var o,a;let r=await new P(this.client).upload(e,{folder:"knowledge"});return this.post("/platform/knowledge/sources",{kind:"file",key:r.key,mimeType:r.mimeType,title:(a=(o=t.title)!=null?o:r.fileName)!=null?a:"Document"})}async remove(e){return this.deleteRequest(`/platform/knowledge/sources/${e}`)}async reindex(e){return this.post(`/platform/knowledge/sources/${e}/reindex`,{})}async search(e,t){return this.post("/platform/knowledge/search",u({query:e},t?{limit:t}:{}))}};var Qe=class extends s{async categories(){return this.get("/platform/support/categories")}async listTickets(e){return this.get("/platform/support/tickets",{params:e})}async createTicket(e){return this.post("/platform/support/tickets",e)}async getTicket(e){return this.get(`/platform/support/tickets/${e}`)}async reply(e,t){return this.post(`/platform/support/tickets/${e}/reply`,t)}async close(e){return this.patch(`/platform/support/tickets/${e}/close`,{})}async channelSetup(e){return this.get(`/platform/support/channel-requests/${encodeURIComponent(e)}/setup`)}};var ze=class extends s{async get(){return super.get("/platform/users/me")}async update(e){return this.patch("/platform/users/me",e)}async updateOrganization(e){return this.patch("/platform/users/me/organization",e)}async toggleModules(e){return this.post("/platform/users/me/modules",e)}async workspaces(){return super.get("/platform/users/me/workspaces")}async setActiveOrg(e){return this.post("/platform/users/me/active-org",e)}async dismissWorkspaceSetup(){return this.post("/platform/users/me/workspace/dismiss-setup",{})}},Ye=class extends s{async list(){return this.get("/platform/users/members")}async access(){return this.get("/platform/users/members/access")}async invite(e){return this.post("/platform/users/members/invite",e)}async updateAccess(e,t){return this.patch(`/platform/users/members/${encodeURIComponent(e)}`,t)}async updateRole(e,t){return this.updateAccess(e,{role:t})}async remove(e){return this.deleteRequest(`/platform/users/members/${encodeURIComponent(e)}`)}async invitations(){return this.get("/platform/users/members/invitations")}async resendInvitation(e){return this.post(`/platform/users/members/invitations/${encodeURIComponent(e)}/resend`,{})}async revokeInvitation(e){return this.deleteRequest(`/platform/users/members/invitations/${encodeURIComponent(e)}`)}},Je=class extends s{async list(){return this.get("/platform/auth/sessions")}async revoke(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}};var Xe=class extends s{async list(e){return this.get(`/product/erix/commerce/projects/${e}/documents`)}async upload(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents`,t)}async toggleSignature(e,t,r){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:r})}async addSigner(e,t,r){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,r)}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,r){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,r)}};var ie=class extends s{async list(){return this.get("/product/seo/projects")}async create(e){return this.post("/product/seo/projects",e)}async byId(e){return this.get(`/product/seo/projects/${e}`)}async update(e,t){return this.patch(`/product/seo/projects/${e}`,t)}async remove(e){return this.deleteRequest(`/product/seo/projects/${e}`)}async crawl(e){return this.post(`/product/seo/projects/${e}/crawl`)}async crawlCompetitor(e,t){return this.post(`/product/seo/projects/${e}/competitors/crawl`,{domain:t})}},oe=class extends s{async start(e){return this.post("/product/seo/audits",e)}async list(e={}){return this.get("/product/seo/audits",{params:e})}async compare(e){return this.post("/product/seo/audits/compare",e)}async byId(e){return this.get(`/product/seo/audits/${e}`)}async resume(e){return this.post(`/product/seo/audits/${e}/resume`)}async pages(e,t={}){return this.get(`/product/seo/audits/${e}/pages`,{params:t})}async issues(e){return this.get(`/product/seo/audits/${e}/issues`)}async links(e){return this.get(`/product/seo/audits/${e}/links`)}async export(e,t="json"){return this.get(`/product/seo/audits/${e}/export`,{params:{format:t},responseType:"text"})}},ae=class extends s{async keywords(e,t={}){return this.get(`/product/seo/audits/${e}/keywords`,{params:t})}async contentGap(e){return this.post("/product/seo/audits/content-gap",e)}async search(e){return this.post("/product/seo/audits/search",e)}async backlinks(e){return this.get("/product/seo/audits/backlinks",{params:e})}async domain(e){return this.get(`/product/seo/audits/domains/${encodeURIComponent(e)}`)}},ce=class extends s{async check(e){return this.post(`/product/seo/search-console/${e}/check`)}async importNow(e){return this.post(`/product/seo/search-console/${e}/import`)}async status(e){return this.get(`/product/seo/search-console/${e}/status`)}async queries(e,t={}){return this.get(`/product/seo/search-console/${e}/queries`,{params:t})}async pages(e,t={}){return this.get(`/product/seo/search-console/${e}/pages`,{params:t})}async trend(e,t={}){return this.get(`/product/seo/search-console/${e}/trend`,{params:t})}},le=class extends s{async keywords(e){return this.get(`/product/seo/ranks/${e}/keywords`)}async add(e,t,r={}){return this.post(`/product/seo/ranks/${e}/keywords`,u({queries:t},r))}async visibility(e,t={}){return this.get(`/product/seo/ranks/${e}/visibility`,{params:t})}async competitors(e){return this.get(`/product/seo/ranks/${e}/competitors`)}async gap(e,t={}){return this.get(`/product/seo/ranks/${e}/gap`,{params:t})}async remove(e,t){return this.deleteRequest(`/product/seo/ranks/${e}/keywords/${t}`)}async checkNow(e,t){return this.post(`/product/seo/ranks/${e}/keywords/${t}/check`)}async history(e,t,r={}){return this.get(`/product/seo/ranks/${e}/keywords/${t}/history`,{params:r})}async changes(e){return this.get(`/product/seo/ranks/${e}/changes`)}},ue=class extends s{async checkNow(e){return this.post(`/product/seo/local/${e}/check`)}async latest(e){return this.get(`/product/seo/local/${e}`)}async history(e,t={}){return this.get(`/product/seo/local/${e}/history`,{params:t})}async startGrid(e,t={}){return this.post(`/product/seo/local/${e}/grid`,t)}async grid(e){return this.get(`/product/seo/local/${e}/grid`)}async grids(e,t={}){return this.get(`/product/seo/local/${e}/grids`,{params:t})}},pe=class extends s{async byProject(e){return this.get(`/product/seo/reports/${e}`)}async export(e,t="csv"){return this.get(`/product/seo/reports/${e}/export`,{params:{format:t},responseType:"text"})}async pdf(e,t={}){return this.get(`/product/seo/reports/${e}/pdf`,{params:t,responseType:"arraybuffer"})}async generate(e,t={}){return this.post(`/product/seo/reports/${e}/generate`,t)}async history(e,t={}){return this.get(`/product/seo/reports/${e}/history`,{params:t})}async changes(e){return this.get(`/product/seo/reports/${e}/changes`)}},ge=class extends s{async seed(e,t,r="en"){return this.post(`/product/seo/research/${e}/seed`,{seed:t,lang:r})}async fromSearchConsole(e){return this.post(`/product/seo/research/${e}/from-search-console`)}async ideas(e,t={}){return this.get(`/product/seo/research/${e}/ideas`,{params:t})}async analyze(e,t){return this.post(`/product/seo/research/${e}/ideas/${t}/analyze`)}};var de=class extends s{async releases(){return this.get("/product/seo/backlinks/releases")}async strength(e){return this.get("/product/seo/backlinks/strength",{params:{domains:e.join(",")}})}async overview(e){return this.get(`/product/seo/backlinks/${e}`)}async referring(e,t){return this.get(`/product/seo/backlinks/${e}/referring`,{params:t})}async changes(e,t){return this.get(`/product/seo/backlinks/${e}/changes`,{params:t})}},me=class extends s{async checkNow(e){return this.post(`/product/seo/performance/${e}/check`)}async latest(e){return this.get(`/product/seo/performance/${e}`)}async history(e,t={}){return this.get(`/product/seo/performance/${e}/history`,{params:t})}},ye=class extends s{async create(e){return this.post("/product/seo/briefs",e)}async byId(e){return this.get(`/product/seo/briefs/${e}`)}async list(e,t={}){return this.get("/product/seo/briefs",{params:u({projectId:e},t)})}};var en=35e3,he=class extends s{async claim(e,t){var o;let r=await this.post("/infra/serp/collector/claim",{collectorId:e,kinds:t},{timeout:en});return(o=r&&typeof r=="object"?r.data:null)!=null?o:null}async result(e){return this.post("/infra/serp/collector/result",e)}async heartbeat(e,t){return this.post("/infra/serp/collector/heartbeat",u({collectorId:e},t))}};var Ze=class extends s{async getConfig(){return this.get("/infra/connect/email/config")}async initDomainVerification(e){return this.post("/infra/connect/email/config/ses/domain",{domain:e})}async saveEmailConfig(e){return this.post("/infra/connect/email/config/ses/config",e)}async checkSesVerification(){return this.get("/infra/connect/email/config/ses/verify")}async removeSesIdentity(){return this.deleteRequest("/infra/connect/email/config/ses/domain")}async sendTest(e){return this.post("/infra/connect/email/config/test",{toEmail:e})}async saveAdvancedConfig(e){return this.post("/infra/connect/email/config/advanced",e)}async getHealth(){return this.get("/infra/connect/email/config/health")}async fixDmarc(){return this.post("/infra/connect/email/config/ses/fix-dmarc",{})}async listProviders(){return this.get("/infra/connect/email/config/providers")}};var et=class extends s{async create(e){return this.post("/infra/storage/files/folders",{name:e})}},tt=class extends s{async list(e,t){return this.get(`/infra/storage/files/files/${e}`,{params:t})}async getUploadUrl(e){return this.post("/infra/storage/files/upload-url",e)}async confirmUpload(e){return this.post("/infra/storage/files/confirm-upload",e)}async getDownloadUrl(e){return this.post("/infra/storage/files/download-url",{key:e})}async delete(e){return this.deleteRequest("/infra/storage/files/files",{params:{key:e}})}},nt=class extends s{async list(e={}){return this.get("/infra/storage/library",{params:e})}async folders(){return this.get("/infra/storage/library/folders")}async remove(e){return this.deleteRequest(`/infra/storage/library/${encodeURIComponent(e)}`)}};var tn={callChanged:"voice_call_changed"},nn=["NOT_FOUND","VOICE_CALL_REFUSED","VOICE_NOT_SET_UP","VOICE_CAMPAIGN_NOT_APPROVED","VOICE_NOT_ENABLED","VOICE_AGENT_UNAVAILABLE","VOICE_RUNTIME_UNAVAILABLE","VOICE_PREVIEW_FAILED","VOICE_NOT_CONFIGURED","LEAD_NOT_FOUND","INSUFFICIENT_CREDITS"];function rn(n){let e=n instanceof f?n.code:void 0;return e&&nn.includes(e)?e:void 0}var Ht={gate:"Voice calling isn't switched on for this workspace.",bad_number:"That phone number isn't a number we can call.",do_not_call:"They asked not to be called again.",dnd:"Their number is on the Do Not Disturb register.",hours:"No calling hours are open for this step.",recently_called:"They were called recently.",promotional:"Promotional calls aren't offered. Calls are for service, reminders, callbacks and demo follow-ups.",no_consent:"No record that they agreed to a phone call, or asked for one. They are not called.",campaign_stopped:"This campaign was stopped.",test_limit:"You can ring your own phone 3 times a day. Try again tomorrow.",not_on_plan:"Voice isn't on your plan. Upgrade your plan to use voice calls.",minutes_used_up:"You've used this month's included voice minutes. Your plan has no extra minutes.",low_balance:"Your balance is below \u20B910. Add credits to place voice calls."};function sn(n){var e;return(e=Ht[n])!=null?e:n}var be=encodeURIComponent,rt=class extends s{get flow(){return new T(this.client)}list(e={}){return this.flow.list(e)}retrieve(e){return this.flow.retrieve(e)}create(e){return this.flow.create(e)}launch(e,t={}){return this.flow.launch(e,t)}start(e,t={}){return this.flow.start(e,t)}pause(e){return this.flow.pause(e)}resume(e){return this.flow.resume(e)}stop(e){return this.flow.stop(e)}costPreview(e){return this.get(`/product/flow/campaigns/${be(e)}/voice-preview`)}counters(e){return this.get(`/infra/connect/voice/campaigns/${be(e)}/counters`)}approval(e){return this.get(`/infra/connect/voice/campaigns/${be(e)}/approval`)}requestApproval(e){return this.post(`/infra/connect/voice/campaigns/${be(e)}/approval/request`,{})}},fe=class extends s{constructor(t){super(t);i(this,"campaigns");this.campaigns=new rt(t)}status(){return this.get("/infra/connect/voice/status")}setup(){return this.get("/infra/connect/voice/setup")}setupNumbers(){return this.get("/infra/connect/voice/setup/numbers")}kycUploadUrl(t){return this.post("/infra/connect/voice/setup/kyc/upload-url",t)}submitKyc(t){return this.post("/infra/connect/voice/setup/kyc",t)}pickNumber(t){return this.post("/infra/connect/voice/setup/number",{number:t})}askForNumber(){return this.post("/infra/connect/voice/setup/number/request",{})}goLive(){return this.post("/infra/connect/voice/setup/go-live",{})}agent(){return this.get("/infra/connect/voice/agent")}skills(){return this.get("/infra/connect/voice/skills")}voices(t){return this.get(`/infra/connect/voice/voices?language=${encodeURIComponent(t)}`)}saveAgent(t){return this.put("/infra/connect/voice/agent",t)}agents(){return this.get("/infra/connect/voice/agents")}createAgent(t){return this.post("/infra/connect/voice/agents",t)}getAgent(t){return this.get(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}updateAgent(t,r){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}`,r)}setAgentLead(t,r){return this.put(`/infra/connect/voice/agents/${encodeURIComponent(t)}/lead`,{customAgentId:r})}deleteAgent(t){return this.deleteRequest(`/infra/connect/voice/agents/${encodeURIComponent(t)}`)}numbers(){return this.get("/infra/connect/voice/numbers")}updateNumber(t,r){return this.patch(`/infra/connect/voice/numbers/${encodeURIComponent(t)}`,r)}async preview(t={}){var r;try{return(await this.client.post("/infra/connect/voice/preview",t,{responseType:"arraybuffer"})).data}catch(o){let a=(r=o==null?void 0:o.response)==null?void 0:r.data;if(a instanceof ArrayBuffer||ArrayBuffer.isView(a))try{o.response.data=JSON.parse(new TextDecoder().decode(a))}catch(l){o.response.data=void 0}throw A(o)}}lines(){return this.get("/infra/connect/voice/lines")}activity(){return this.get("/infra/connect/voice/activity")}calls(t={}){return this.get("/infra/connect/voice/calls",{params:t})}call(t){return this.get(`/infra/connect/voice/calls/${be(t)}`)}callWithAI(t){return this.post("/infra/connect/voice/calls",t)}checkCallWithAI(t){return this.post("/infra/connect/voice/calls/check",t)}callMyPhone(t={}){return this.post("/infra/connect/voice/calls/my-phone",t)}testCall(t={}){return this.post("/infra/connect/voice/test-call",t)}};var st=class extends s{async list(e){return this.get("/platform/inbox/conversations",{params:e})}async create(e){var t;return this.post("/platform/inbox/conversations",{address:e.phone,channel:(t=e.channel)!=null?t:"whatsapp",userName:e.name})}async linkLead(e,t){return this.patch(`/platform/inbox/conversations/${e}/lead`,{leadId:t})}async retrieve(e){return this.get(`/platform/inbox/conversations/${e}`)}async messages(e,t){return this.get(`/platform/inbox/conversations/${e}/messages`,{params:t})}async setStatus(e,t){return this.patch(`/platform/inbox/conversations/${e}/status`,{status:t})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async delete(e){return this.deleteRequest(`/platform/inbox/conversations/${e}`)}async bulkDelete(e){return this.post("/platform/inbox/conversations/bulk-delete",{ids:e})}};var it=class extends s{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(e={}){return this.post("/infra/connect/whatsapp/templates/sync",e.accountId?{accountId:e.accountId}:{})}async retrieve(e){return this.get(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}`)}async create(e){return this.post("/infra/connect/whatsapp/templates",e)}async update(e,t){return this.put(`/infra/connect/whatsapp/templates/${e}`,t)}async fix(e){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/fix`,{})}async resubmit(e,t){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/resubmit`,t)}async deleteTemplate(e,t,r){let o=new URLSearchParams;t&&o.set("force","true"),r&&o.set("accountId",r);let a=o.toString();return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${a?`?${a}`:""}`)}async mappingConfig(){return this.get("/infra/connect/whatsapp/templates/mapping/config")}async mappingSources(){return this.get("/infra/connect/whatsapp/templates/mapping/sources")}async collections(){return this.get("/infra/connect/whatsapp/templates/collections")}async collectionFields(e){return this.get(`/infra/connect/whatsapp/templates/collections/${encodeURIComponent(e)}/fields`)}async updateMapping(e,t){return this.put(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/mapping`,t)}async validate(e,t){let r=`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`;return t?this.post(r,t):this.get(r)}async preview(e,t,r,o){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t,mappings:r,onEmptyVariable:o})}async getVariableManifest(e){var a,l;let t=await this.retrieve(e),r=Array.isArray((a=t.data)==null?void 0:a.components)?t.data.components:[],o=[];for(let d of r)if(d.text){let g=d.text.match(/{{(\d+)}}/g);if(g)for(let S of g){let k=S.replace(/{{|}}/g,"");o.push({key:`var_${k}`,label:`${d.type} Var {{${k}}}`,type:"string",required:!0,group:d.type,description:`Variable placeholder in template ${d.type}`})}}return{name:`Template variables: ${((l=t.data)==null?void 0:l.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}};var ot=class{constructor(e){i(this,"messages");i(this,"conversations");this.messages=new P(e),this.conversations=new st(e)}},at=class{constructor(e){i(this,"leads");i(this,"pipelines");i(this,"activities");i(this,"analytics");i(this,"scoring");i(this,"payments");i(this,"chat");i(this,"events");i(this,"invoices");i(this,"checkout");i(this,"projects");i(this,"niche");i(this,"documents");i(this,"invoiceExport");i(this,"ai");this.leads=new Ee(e),this.pipelines=new Ve(e),this.activities=new Ae(e),this.analytics=new Ie(e),this.scoring=new Oe(e),this.payments=new $e(e),this.chat=new ot(e),this.events=new Ue(e),this.invoices=new Me(e),this.checkout=new Se(e),this.projects=new Xe(e),this.niche=new Be(e),this.documents=new Pe(e),this.invoiceExport=new Le(e),this.ai=new V(e)}},ct=class{constructor(e){i(this,"automations");i(this,"campaigns");i(this,"conversations");i(this,"home");i(this,"drafts");i(this,"firstRun");i(this,"audiences");this.automations=new D(e),this.campaigns=new T(e),this.conversations=new U(e),this.home=new F(e),this.drafts=new _(e),this.firstRun=new M(e),this.audiences=new N(e)}},lt=class{constructor(e){i(this,"projects");i(this,"audits");i(this,"insights");i(this,"searchConsole");i(this,"ranks");i(this,"local");i(this,"reports");i(this,"backlinks");i(this,"performance");i(this,"briefs");i(this,"research");this.projects=new ie(e),this.audits=new oe(e),this.insights=new ae(e),this.searchConsole=new ce(e),this.ranks=new le(e),this.local=new ue(e),this.reports=new pe(e),this.backlinks=new de(e),this.performance=new me(e),this.briefs=new ye(e),this.research=new ge(e)}},ut=class{constructor(e){i(this,"packs");i(this,"signals");i(this,"tools");i(this,"campaigns");i(this,"runs");i(this,"leads");i(this,"import");i(this,"lists");i(this,"compliance");i(this,"market");i(this,"learning");i(this,"lookalikes");i(this,"freshness");i(this,"audit");this.packs=new q(e),this.signals=new B(e),this.tools=new K(e),this.campaigns=new j(e),this.runs=new G(e),this.leads=new H(e),this.import=new W(e),this.lists=new Q(e),this.compliance=new z(e),this.market=new Y(e),this.learning=new J(e),this.lookalikes=new X(e),this.freshness=new Z(e),this.audit=new ee(e)}},xe=class{constructor(e){i(this,"erix");i(this,"flow");i(this,"seo");i(this,"laie");this.erix=new at(e),this.flow=new ct(e),this.seo=new lt(e),this.laie=new ut(e)}},pt=class{constructor(e){i(this,"config");i(this,"templates");this.config=new Ze(e),this.templates=new De(e)}},gt=class{constructor(e){i(this,"templates");this.templates=new it(e)}},It=class{constructor(e){i(this,"leadForms");this.leadForms=new Fe(e)}},dt=class{constructor(e){i(this,"email");i(this,"whatsapp");i(this,"facebook");i(this,"meet");i(this,"connections");i(this,"accounts");i(this,"voice");this.email=new pt(e),this.whatsapp=new gt(e),this.facebook=new It(e),this.meet=new qe(e),this.connections=new Re(e),this.accounts=new O(e),this.voice=new fe(e)}},mt=class{constructor(e){i(this,"files");i(this,"folders");i(this,"media");i(this,"library");this.files=new tt(e),this.folders=new et(e),this.media=new Ne(e),this.library=new nt(e)}},Pt=class{constructor(e){i(this,"collector");this.collector=new he(e)}},ke=class{constructor(e){i(this,"connect");i(this,"storage");i(this,"serp");this.connect=new dt(e),this.storage=new mt(e),this.serp=new Pt(e)}},yt=class{constructor(e){i(this,"onboarding");i(this,"persona");i(this,"audit");this.onboarding=new te(e),this.persona=new ne(e),this.audit=new Ge(e)}},ht=class{constructor(e){i(this,"me");i(this,"members");i(this,"sessions");i(this,"notifications");this.me=new ze(e),this.members=new Ye(e),this.sessions=new Je(e),this.notifications=new Ke(e)}},we=class{constructor(e){i(this,"auth");i(this,"users");i(this,"tenants");i(this,"billing");i(this,"support");i(this,"ai");i(this,"knowledge");i(this,"health");i(this,"catalog");this.auth=new He(e),this.users=new ht(e),this.tenants=new yt(e),this.billing=new We(e),this.support=new Qe(e),this.ai=new je(e),this.knowledge=new se(e),this.health=new _e(e),this.catalog=new re(e)}};var C=class extends f{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},ve=class{async constructEvent(e,t,r){if(!t)throw new C("No webhook signature provided");let o=Array.isArray(t)?t[0]:t;o.startsWith("sha256=")&&(o=o.slice(7));try{let a=await import("crypto"),d=a.createHmac("sha256",r).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(d),Buffer.from(o)))throw new C("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof C?a:new C(`Webhook payload parsing failed: ${a.message}`)}}};var Lt=typeof process!="undefined"&&"4.2.0"||"3.1.1";var Qt,Et=(Qt=Wt.default)!=null?Qt:Wt,L=class{constructor(e){i(this,"client");i(this,"socket",null);i(this,"startSocket",null);i(this,"socketPromise",null);i(this,"socketQueue",[]);i(this,"clientCode");i(this,"apiVersion");i(this,"platform");i(this,"product");i(this,"infra");i(this,"webhooks");i(this,"lastSeq");i(this,"closed",!1);var k,E,$,$t,Vt,Ot,Dt,Ut;let t=e.proxy;if(!e.apiKey&&!t)throw new R("API Key is required");this.clientCode=(k=e.clientCode)==null?void 0:k.toUpperCase(),this.apiVersion=(E=e.version)!=null?E:"v1";let r=($=e.baseUrl)!=null?$:Bt,o=Kt(this.apiVersion,($t=t==null?void 0:t.url)!=null?$t:r),a=e.socketUrl||r,l=typeof window!="undefined"&&typeof window.document!="undefined",d=l?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",g=l?((Vt=globalThis.navigator)==null?void 0:Vt.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",S=v(u({},t?{}:{"x-api-key":e.apiKey,"x-client-code":((Ot=e.clientCode)==null?void 0:Ot.toUpperCase())||""}),{"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:Lt,runtime:d,os:g})});if(this.client=an.create({baseURL:o,headers:S,timeout:(Dt=e.timeout)!=null?Dt:3e4}),Et(this.client,{retries:3,retryDelay:Et.exponentialDelay,retryCondition:b=>{var Te;return Et.isNetworkOrIdempotentRequestError(b)||((Te=b.response)==null?void 0:Te.status)===429},onRetry:(b,Te,Ft)=>{var _t,Mt;typeof process!="undefined"&&((_t=process.env)==null?void 0:_t.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${b}/3): ${(Mt=Ft.method)==null?void 0:Mt.toUpperCase()} ${Ft.url}. Reason: ${Te.message}`)}}),this.platform=new we(this.client),this.product=new xe(this.client),this.infra=new ke(this.client),this.webhooks=new ve,t){if(t.ticket){let b=t.ticket;this.startSocket=()=>this.initSocket(a,async()=>({ticket:await b()}))}}else{let b={apiKey:e.apiKey,clientCode:((Ut=e.clientCode)==null?void 0:Ut.toUpperCase())||""};this.startSocket=()=>this.initSocket(a,async()=>b,{"x-api-key":b.apiKey,"x-client-code":b.clientCode})}if(l){let b={version:Lt,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=b}}initSocket(e,t,r){return this.socketPromise?this.socketPromise:(this.socketPromise=import("socket.io-client").then(({io:o})=>{this.socket=o(e,{auth:a=>{t().then(l=>a(v(u({},l),{lastSeq:this.lastSeq})),()=>a({lastSeq:this.lastSeq}))},extraHeaders:r,transports:["websocket","polling"],tryAllTransports:!0}),this.setupSocket();for(let{type:a,args:l}of this.socketQueue)a==="joinRoom"?this.socket.emit("join-room",l[0]):a==="leaveRoom"?this.socket.emit("leave-room",l[0]):a==="on"?this.socket.on(l[0],l[1]):a==="off"?this.socket.off(l[0],l[1]):a==="disconnect"&&this.socket.disconnect();this.socketQueue=[]}),this.socketPromise)}joinRoom(e){var t;this.closed||(t=this.startSocket)==null||t.call(this),this.socket?this.socket.emit("join-room",e):this.socketQueue.push({type:"joinRoom",args:[e]})}leaveRoom(e){this.socket?this.socket.emit("leave-room",e):this.socketQueue.push({type:"leaveRoom",args:[e]})}setupSocket(){this.socket&&(this.socket.on("connect_error",()=>{var e;(e=this.socket)!=null&&e.active||setTimeout(()=>{var t;this.closed||(t=this.socket)==null||t.connect()},5e3)}),this.socket.onAny((...e)=>{var r,o;let t=(r=e.at(-1))==null?void 0:r.seq;typeof t=="number"&&t>((o=this.lastSeq)!=null?o:0)&&(this.lastSeq=t)}))}on(e,t){var r;return this.closed||(r=this.startSocket)==null||r.call(this),this.socket?this.socket.on(e,t):this.socketQueue.push({type:"on",args:[e,t]}),this}disconnect(){this.closed=!0,this.socket?this.socket.disconnect():this.socketPromise&&this.socketQueue.push({type:"disconnect",args:[]})}off(e,t){return this.socket?this.socket.off(e,t):this.socketQueue.push({type:"off",args:[e,t]}),this}async request(e,t,r,o){var a,l,d;try{return(await this.client.request({method:e,url:t,data:r,params:o})).data}catch(g){throw g.response?new f(((a=g.response.data)==null?void 0:a.message)||((l=g.response.data)==null?void 0:l.error)||"Raw Execution Failed",g.response.status,(d=g.response.data)==null?void 0:d.code):new f(g.message||"Network Error")}}};var Ci={401:R,403:jt,429:Ce};function Si(n){throw A(n)}function Ri(n,e){return n instanceof e}function Ai(n){return n instanceof R?{message:n.message,status:n.status,code:n.code,type:"AuthenticationError"}:n instanceof Ce?{message:n.message,status:n.status,code:n.code,type:"RateLimitError"}:n instanceof f?{message:n.message,status:n.status,code:n.code,type:"APIError"}:{message:n.message||"Unknown error",type:"UnknownError"}}var zt={[R.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[Ce.name]:{shouldRetry:!0,maxRetries:3,baseDelay:1e3,backoffMultiplier:2,reason:"Rate limit errors can be retried with exponential backoff"},[f.name]:{shouldRetry:!0,maxRetries:2,baseDelay:500,backoffMultiplier:1.5,reason:"Generic API errors may be transient and worth retrying"}};function Ii(n){let e=n.constructor.name;return zt[e]||zt[f.name]}var Ei=L;export{f as APIError,s as APIResource,V as AiAgent,R as AuthenticationError,T as Campaigns,re as Catalog,he as Collector,O as ConnectAccounts,dt as ConnectInfra,L as ECODrIx,L as ECODrIxAPI,zt as ERROR_RETRY_CONFIG,ln as EcodrixError,pt as EmailConnect,ot as ErixChat,at as ErixProduct,N as FlowAudiences,D as FlowAutomations,U as FlowConversations,_ as FlowDrafts,M as FlowFirstRunResource,F as FlowHome,ct as FlowProduct,Ci as HTTP_STATUS_ERROR_MAP,ke as InfraDomain,Zt as KNOWLEDGE_FILE_TYPES,se as Knowledge,Jt as LAIE_EVENTS,Gt as LEAD_STATUS_VALUES,ee as LaieAudits,j as LaieCampaigns,z as LaieCompliance,Z as LaieFreshness,W as LaieImport,H as LaieLeads,J as LaieLearning,Q as LaieLists,X as LaieLookalikes,Y as LaieMarket,q as LaiePacks,ut as LaieProduct,G as LaieRuns,B as LaieSignals,K as LaieTools,te as Onboarding,jt as PermissionError,ne as Persona,we as PlatformDomain,yt as PlatformTenants,ht as PlatformUsers,xe as ProductDomain,Ce as RateLimitError,oe as SeoAudits,de as SeoBacklinks,ye as SeoBriefs,ae as SeoInsights,ue as SeoLocal,me as SeoPerformance,lt as SeoProduct,ie as SeoProjects,le as SeoRanks,pe as SeoReports,ge as SeoResearch,ce as SeoSearchConsole,mt as StorageInfra,tn as VOICE_EVENTS,Ht as VOICE_REFUSAL_REASONS,fe as Voice,rt as VoiceCampaigns,C as WebhookSignatureError,ve as Webhooks,gt as WhatsAppConnect,Ei as default,Ai as getErrorDetails,Ii as getRetryConfig,Si as handleAPIError,Ri as isAPIError,Yt as laieStageQueued,A as toAPIError,rn as voiceErrorCode,sn as voiceRefusalReason};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecodrix/erix-api",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"author": "ECODrIx Team <contact@ecodrix.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Official TypeScript SDK for the ERIX API by ECODrIx: CRM, Flow automations, one inbox across WhatsApp, Instagram and email, GST invoices and payments. Node and browser (proxy mode).",
|