@ecodrix/erix-api 4.0.1 → 4.0.2

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.
@@ -1562,9 +1562,16 @@ interface PublicMerchantSession extends PublicMerchantCart {
1562
1562
  /** The shop's thank-you page, when it gave one. */
1563
1563
  successUrl: string | null;
1564
1564
  }
1565
+ /** Who to write to about personal data (DPDP). `name` is optional. */
1566
+ interface GrievanceContact {
1567
+ name: string | null;
1568
+ email: string;
1569
+ }
1565
1570
  interface PublicMerchantSessionResponse extends CheckoutResponse<PublicMerchantSession> {
1566
1571
  consentNotice: string;
1567
1572
  privacyPolicyUrl: string | null;
1573
+ /** The workspace's DPDP grievance contact, when the owner set one. */
1574
+ grievanceContact?: GrievanceContact | null;
1568
1575
  }
1569
1576
  /**
1570
1577
  * The buyer's cart after dropping lines or lowering counts: every sku must be
@@ -1585,6 +1592,8 @@ interface PublicCheckoutProductResponse extends CheckoutResponse<PublicCheckoutP
1585
1592
  /** Show next to the required consent box; the server records this text. */
1586
1593
  consentNotice: string;
1587
1594
  privacyPolicyUrl: string | null;
1595
+ /** The workspace's DPDP grievance contact, when the owner set one. */
1596
+ grievanceContact?: GrievanceContact | null;
1588
1597
  }
1589
1598
  interface CheckoutSession {
1590
1599
  sessionId: string;
@@ -5588,6 +5597,8 @@ interface VoiceSkill {
5588
5597
  type VoiceSkillMap = Record<string, Record<string, number | string>>;
5589
5598
  /** The tone of the assistant's voice. */
5590
5599
  type VoiceStyle = "calm" | "natural" | "lively";
5600
+ /** How the assistant talks: `natural` = the everyday mix locals use (Tenglish, Hinglish, Tanglish...); `pure` = the formal language. */
5601
+ type VoiceSpeakingStyle = "natural" | "pure";
5591
5602
  /** One voice the assistant can speak with (`voice.voices(language)`). */
5592
5603
  interface VoiceOption {
5593
5604
  /** Pass this as `voiceName`. Lowercase, e.g. `priya`. */
@@ -5613,7 +5624,7 @@ interface VoiceAgent {
5613
5624
  status: "draft" | "active" | "paused";
5614
5625
  /** The main language, e.g. `hi-IN`. */
5615
5626
  language: string;
5616
- /** Languages the assistant may speak (default `te-IN`, `hi-IN`, `en-IN`); includes `language`. */
5627
+ /** Languages the assistant may speak (default `te-IN`, `hi-IN`, `en-IN`); includes `language`. English, Hindi and Telugu are open to every workspace; the other eight Bulbul languages are "preview" and only ECODrIx staff can add them (a customer save gets 403 `PREVIEW_LANGUAGE`). */
5617
5628
  languages: string[];
5618
5629
  greeting: string;
5619
5630
  /** Kept in step with `skills` on save; read `skills` instead. */
@@ -5637,6 +5648,14 @@ interface VoiceAgent {
5637
5648
  voicePace: number | null;
5638
5649
  /** null = natural. */
5639
5650
  voiceStyle: VoiceStyle | null;
5651
+ /** A voice per language (`te-IN`: a name from `voice.voices(language)`, or `"auto"` = the recommended voice for `voiceGender`). `null` = none picked (all auto). */
5652
+ voicesByLanguage: Record<string, string> | null;
5653
+ /** On (default): when the caller's language is known after their first turn, the assistant switches once to that language's voice and keeps it. */
5654
+ accentMatch: boolean;
5655
+ /** Default `natural`. */
5656
+ speakingStyle: VoiceSpeakingStyle;
5657
+ /** Read-only: true when the signed-in person may switch on preview languages (ECODrIx staff). The others stay disabled in the picker. */
5658
+ canUsePreviewLanguages: boolean;
5640
5659
  /** Default `closed`. Acts only when `businessHours` or `closedDates` are set. */
5641
5660
  afterHours: VoiceAfterHours;
5642
5661
  /** The owner's own "we are closed" sentence; null = the default line in the caller's language. */
@@ -5668,7 +5687,7 @@ interface VoiceAgentInput {
5668
5687
  name: string;
5669
5688
  status?: "draft" | "active" | "paused";
5670
5689
  language: string;
5671
- /** Omitted = `language` plus `te-IN`, `hi-IN`, `en-IN`. Must include `language`. */
5690
+ /** Omitted = `language` plus `te-IN`, `hi-IN`, `en-IN`. Must include `language`. Only the 11 Bulbul codes (`xx-IN`); adding a preview language (not `en-IN`, `hi-IN`, `te-IN`) is staff-only: 403 `PREVIEW_LANGUAGE`. */
5672
5691
  languages?: string[];
5673
5692
  greeting?: string;
5674
5693
  /** Superseded by `skills`; ignored once the assistant has saved skills. */
@@ -5689,6 +5708,12 @@ interface VoiceAgentInput {
5689
5708
  voicePace?: number | null;
5690
5709
  /** Omitted = keep the saved one, null = natural. */
5691
5710
  voiceStyle?: VoiceStyle | null;
5711
+ /** `{ "te-IN": "neha" | "auto" }`. Omitted = keep, null = all auto. Replaces the whole map. */
5712
+ voicesByLanguage?: Record<string, string> | null;
5713
+ /** Omitted = keep (a new assistant: on). */
5714
+ accentMatch?: boolean;
5715
+ /** Omitted = keep (a new assistant: `natural`). */
5716
+ speakingStyle?: VoiceSpeakingStyle;
5692
5717
  /** Omitted = `{}` (the defaults). Replaces the whole map. */
5693
5718
  pronunciations?: Record<string, VoicePronunciation>;
5694
5719
  /** Omitted = keep the saved one. */
@@ -9059,6 +9084,56 @@ declare class PlatformAI {
9059
9084
  constructor(client: AxiosInstance);
9060
9085
  }
9061
9086
 
9087
+ /** One line of the workspace activity trail. */
9088
+ interface WorkspaceAuditItem {
9089
+ id: string;
9090
+ /** The raw action key, for filtering (for example `invitation.created`). */
9091
+ action: string;
9092
+ /** A plain sentence for the list (for example "Invited a teammate"). */
9093
+ label: string;
9094
+ /** Who did it. `id` is null (and `email` null) for ECODrIx staff ("ERIX") and system work ("System"). */
9095
+ actor: {
9096
+ id: string | null;
9097
+ name: string;
9098
+ email: string | null;
9099
+ };
9100
+ /** What it touched, with a short safe summary when the action has one. */
9101
+ target: {
9102
+ type: string | null;
9103
+ id: string | null;
9104
+ summary: string | null;
9105
+ };
9106
+ createdAt: string;
9107
+ }
9108
+ interface WorkspaceAuditPage {
9109
+ items: WorkspaceAuditItem[];
9110
+ /** Pass back as `cursor` for the next page; null on the last page. */
9111
+ nextCursor: string | null;
9112
+ }
9113
+ interface WorkspaceAuditParams {
9114
+ /** 1 to 50, default 25. */
9115
+ limit?: number;
9116
+ cursor?: string;
9117
+ /** A member id. */
9118
+ actor?: string;
9119
+ /** An action prefix such as `invitation.` or `org.`. */
9120
+ action?: string;
9121
+ /** ISO 8601 date-times, with offset. */
9122
+ from?: string;
9123
+ to?: string;
9124
+ }
9125
+ /**
9126
+ * The workspace's own activity trail (read-only). Needs `team.update`: the
9127
+ * owner and admins. Access via `ecod.platform.tenants.audit`.
9128
+ */
9129
+ declare class WorkspaceAudit extends APIResource {
9130
+ /** One page of activity, newest first. */
9131
+ list<T = {
9132
+ success: boolean;
9133
+ data: WorkspaceAuditPage;
9134
+ }>(params?: WorkspaceAuditParams): Promise<T>;
9135
+ }
9136
+
9062
9137
  /**
9063
9138
  * Platform authentication resource — registration, login, sessions,
9064
9139
  * password management, OAuth linking, and organization invitations.
@@ -9528,6 +9603,18 @@ declare class Support extends APIResource {
9528
9603
  }>;
9529
9604
  }
9530
9605
 
9606
+ /** The business details Settings › Business details saves. All optional; `null` or `""` clears a text field. */
9607
+ interface OrganizationUpdateInput {
9608
+ name?: string;
9609
+ industry?: string | null;
9610
+ country?: string;
9611
+ website?: string | null;
9612
+ /** DPDP grievance contact, shown on consent text and public forms. Max 120 characters. */
9613
+ grievanceName?: string | null;
9614
+ /** Must be a valid email, max 254 characters. */
9615
+ grievanceEmail?: string | null;
9616
+ [key: string]: unknown;
9617
+ }
9531
9618
  /**
9532
9619
  * Current-user ("me") resource — profile, organization, modules,
9533
9620
  * workspaces, and active-org management.
@@ -9546,9 +9633,11 @@ declare class Me extends APIResource {
9546
9633
  */
9547
9634
  update<T = any>(body: Record<string, unknown>): Promise<T>;
9548
9635
  /**
9549
- * Update the current user's active organization details.
9636
+ * Update the current user's active organization details. Needs
9637
+ * `settings.update` (owner/admin). `GET /me` returns the saved
9638
+ * `org.grievanceName` and `org.grievanceEmail` beside the other details.
9550
9639
  */
9551
- updateOrganization<T = any>(body: Record<string, unknown>): Promise<T>;
9640
+ updateOrganization<T = any>(body: OrganizationUpdateInput): Promise<T>;
9552
9641
  /**
9553
9642
  * Toggle enabled modules for the current user / organization.
9554
9643
  */
@@ -9881,6 +9970,8 @@ declare class InfraDomain {
9881
9970
  declare class PlatformTenants {
9882
9971
  readonly onboarding: Onboarding;
9883
9972
  readonly persona: Persona;
9973
+ /** Owner/admin activity trail (read-only). */
9974
+ readonly audit: WorkspaceAudit;
9884
9975
  constructor(client: AxiosInstance);
9885
9976
  }
9886
9977
  /** Tenant user surface (`/platform/users/*`). */
@@ -10541,4 +10632,4 @@ declare function getRetryConfig(error: any): {
10541
10632
  readonly reason: "Generic API errors may be transient and worth retrying";
10542
10633
  };
10543
10634
 
10544
- export { type AIPersona, APIError, APIResource, type AddOnStatus, type AddOnView, type AgentAutomationTrigger, type AgentAutonomy, type AgentBudget, type AgentChannel, type AgentResults, type AgentTemplate, 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 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 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 FlowConversation, FlowConversations, type FlowDraftKind, FlowDrafts, type FlowFirstRun, type FlowFirstRunInstall, FlowFirstRunResource, FlowHome, type FlowHomeCounts, type FlowHomeData, type FlowHomeNeed, type FlowHomeUsage, FlowProduct, type FormulaConfig, type GlobalOnboardingPayload, 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 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 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 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 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 VoiceOption, type VoicePreviewInput, type VoicePronunciation, type VoicePurpose, type VoiceRefusalCode, type VoiceSetup, type VoiceSetupCurrent, type VoiceSetupStep, type VoiceSkill, type VoiceSkillMap, type VoiceSkillParam, type VoiceStatus, type VoiceStyle, type VoiceTool, type VoiceTranscriptTurn, WebchatOwnerSettings, WebchatSettingsPatch, WebhookSignatureError, Webhooks, WhatsAppConnect, type WorkspaceDashboardLayout, type WorkspaceDefaultAutomation, type WorkspaceDefaultField, type WorkspaceDefaultPipeline, type WorkspaceModuleConfig, type WorkspaceProfile, ECODrIxAPI as default, getErrorDetails, getRetryConfig, handleAPIError, isAPIError, laieStageQueued, voiceErrorCode, voiceRefusalReason };
10635
+ export { type AIPersona, APIError, APIResource, type AddOnStatus, type AddOnView, type AgentAutomationTrigger, type AgentAutonomy, type AgentBudget, type AgentChannel, type AgentResults, type AgentTemplate, 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 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 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 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 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 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 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 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 };
@@ -1 +1 @@
1
- import{a as u,b as v,c as w,d as i,e as Mt,f as Ut,g as Ft,h as Nt,i as on,j as f,k as R,l as qt,m as ve,n as A}from"./chunk-XPXDFZWU.js";import rn from"axios";import jt from"axios-retry";var r=class{constructor(e){i(this,"client",e)}async post(e,t,s){try{let o=this.buildConfig(s);return(await this.client.post(e,t,o)).data}catch(o){this.handleError(o)}}async get(e,t){try{let s=this.buildConfig(t);return(await this.client.get(e,s)).data}catch(s){this.handleError(s)}}async patch(e,t,s){try{let o=this.buildConfig(s);return(await this.client.patch(e,t,o)).data}catch(o){this.handleError(o)}}async put(e,t,s){try{let o=this.buildConfig(s);return(await this.client.put(e,t,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,t){try{let s=this.buildConfig(t);return(await this.client.delete(e,s)).data}catch(s){this.handleError(s)}}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 $=class extends r{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 r{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}`,V=class extends r{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 O=class extends r{async get(){return super.get("/product/flow/home")}async nav(){return super.get("/product/flow/home/nav")}},D=class extends r{async create(e){return this.post("/product/flow/drafts",e)}},_=class extends r{async status(){return this.get("/product/flow/first-run")}async installPack(e){return this.post(`/product/flow/first-run/packs/${e}`)}},M=class extends r{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 y="/product/erix/commerce/checkout",x="/product/erix/public/checkout",h=encodeURIComponent,dt=class extends r{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,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/items`,s)}async startSession(e){return this.post(`${x}/sessions`,e)}async applyCoupon(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/coupon`,s)}async verify(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/verify`,s)}async placeOrder(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/order`,s)}async verifyRazorpay(e){let a=e,{sessionId:t,orderId:s}=a,o=w(a,["sessionId","orderId"]);return this.post(`${x}/sessions/${h(t)}/order/${h(s)}/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})}},mt=class extends r{async create(e){return this.post(`${y}/sessions`,e)}},Te=class extends r{constructor(t){super(t);i(this,"buyer");i(this,"sessions");this.buyer=new dt(t),this.sessions=new mt(t)}async listProducts(){return this.get(`${y}/products`)}async createProduct(t){return this.post(`${y}/products`,t)}async updateProduct(t,s){return this.patch(`${y}/products/${h(t)}`,s)}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,s){return this.patch(`${y}/coupons/${h(t)}`,s)}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,s){return this.patch(`${y}/orders/${h(t)}/status`,s)}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 yt=class extends r{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}`)}},Se=class extends r{constructor(t){super(t);i(this,"notes");this.notes=new yt(t)}async timeline(t,s){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:s})}async list(t,s){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:u({},s)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,s){return this.post(`/product/erix/crm/leads/${t}/calls`,s)}};var Ce=class extends r{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 Re=class extends r{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,s){return this.patch(`/product/erix/crm/documents/checklist/${e}/${t}`,s?{fileUrl:s}:{})}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 Ae=class extends r{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 Bt=["open","won","lost","archived"],Ie=class extends r{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:[],s=[{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:Bt.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:[...s,...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 s=[];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")s.push(g.value);else throw g.reason}return s}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 Ut(this,null,function*(){let t=(e==null?void 0:e.page)||1,s=!0;for(;s;){let o=yield new Mt(this.list(v(u({},e),{page:t}))),a=Array.isArray(o.data)?o.data:o||[];if(a.length===0){s=!1;break}for(let l of a)yield l;o.pagination&&t<o.pagination.pages||!o.pagination&&a.length>0?t++:s=!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,s={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:s})}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,s){return this.patch(`/product/erix/crm/leads/${e}`,{nextFollowUpAt:t,nextFollowUpNote:t&&s!=null?s:null})}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,s){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:s})}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,s){return this.patch(`/product/erix/crm/notes/${t}`,s)}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 Pe=class extends r{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var Le=class extends r{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,a;let t=await this.retrieve(e),s=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:s.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 Ee=class extends r{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 $e=class extends r{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 Ve=class extends r{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 Oe=class extends r{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 De=class extends r{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,s){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:s})}async addSigner(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,s)}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,s)}};var _e=class extends r{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 P=class extends r{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",{phone:e.to,text:e.text})}async sendTemplate(e){return this.post("/infra/connect/send/whatsapp",{phone:e.to,templateName:e.templateName,language:e.language,variables:e.variables})}async star(e,t){return this.post(`/platform/inbox/messages/${e}/star`,{starred:t})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async upload(e,t={}){var C,k,E;let s=(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:s,contentType:o}),{uploadUrl:l,key:d}=a.data,g=await fetch(l,{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:s}}};var Me=class extends r{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 Ue=class extends r{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 Fe=class extends r{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 Ne=class extends r{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 qe=class extends r{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(){return this.post("/infra/connect/whatsapp/templates/sync",{})}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){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${t?"?force=true":""}`)}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 s=`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`;return t?this.post(s,t):this.get(s)}async preview(e,t,s,o){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t,mappings:s,onEmptyVariable:o})}async getVariableManifest(e){var a,l;let t=await this.retrieve(e),s=Array.isArray((a=t.data)==null?void 0:a.components)?t.data.components:[],o=[];for(let d of s)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: ${((l=t.data)==null?void 0:l.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}};var Wt=n=>"queued"in n&&n.queued===!0,Qt={runProgress:"laie:run:progress",importComplete:"laie:import:complete"},p=encodeURIComponent,c="/product/laie",U=class extends r{async list(){return this.get(`${c}/packs`)}async byId(e){return this.get(`${c}/packs/${p(e)}`)}},F=class extends r{async catalog(e={}){return this.get(`${c}/signals/catalog`,{params:e})}async list(e={}){return this.get(`${c}/signals`,{params:e})}},N=class extends r{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})}},q=class extends r{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)}},B=class extends r{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,s={}){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}/changes`,{params:s})}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`)}},K=class extends r{async list(e={}){let o=e,{importedToCrm:t}=o,s=w(o,["importedToCrm"]);return this.get(`${c}/leads`,{params:u(u({},s),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})}},j=class extends r{async pipelines(){return this.get(`${c}/import/pipelines`)}async crm(e){return this.post(`${c}/import/crm`,e)}},G=class extends r{async enrich(e){return this.post(`${c}/lists/enrich`,e)}},H=class extends r{async dsr(e){return this.post(`${c}/compliance/dsr`,e)}async report(e={}){return this.get(`${c}/compliance/report`,{params:e})}},W=class extends r{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)}},Q=class extends r{async weights(e={}){return this.get(`${c}/learning/weights`,{params:e})}async outcomes(e={}){return this.get(`${c}/learning/outcomes`,{params:e})}},z=class extends r{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})}},Y=class extends r{async status(){return this.get(`${c}/freshness`)}},J=class extends r{async start(e){return this.post(`${c}/audit`,e)}async byId(e){return this.get(`${c}/audit/${p(e)}`)}};import zt from"axios";var Be=class extends r{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 s=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:o,key:a}=s.data;await zt.put(o,e,{headers:{"Content-Type":t.contentType}});let l=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:a,sizeBytes:l})}};var Ke=class extends r{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 Yt={callChanged:"voice_call_changed"},Jt=["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 Xt(n){let e=n instanceof f?n.code:void 0;return e&&Jt.includes(e)?e:void 0}var Kt={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 Zt(n){var e;return(e=Kt[n])!=null?e:n}var X=encodeURIComponent,je=class extends r{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/${X(e)}/voice-preview`)}counters(e){return this.get(`/infra/connect/voice/campaigns/${X(e)}/counters`)}approval(e){return this.get(`/infra/connect/voice/campaigns/${X(e)}/approval`)}requestApproval(e){return this.post(`/infra/connect/voice/campaigns/${X(e)}/approval/request`,{})}},Z=class extends r{constructor(t){super(t);i(this,"campaigns");this.campaigns=new je(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)}async preview(t={}){var s;try{return(await this.client.post("/infra/connect/voice/preview",t,{responseType:"arraybuffer"})).data}catch(o){let a=(s=o==null?void 0:o.response)==null?void 0:s.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/${X(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 ee=class extends r{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})}},te=class extends r{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"})}},ne=class extends r{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)}`)}},re=class extends r{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})}},se=class extends r{async keywords(e){return this.get(`/product/seo/ranks/${e}/keywords`)}async add(e,t,s={}){return this.post(`/product/seo/ranks/${e}/keywords`,u({queries:t},s))}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,s={}){return this.get(`/product/seo/ranks/${e}/keywords/${t}/history`,{params:s})}async changes(e){return this.get(`/product/seo/ranks/${e}/changes`)}},ie=class extends r{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})}},oe=class extends r{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`)}},ae=class extends r{async seed(e,t,s="en"){return this.post(`/product/seo/research/${e}/seed`,{seed:t,lang:s})}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 ce=class extends r{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})}},le=class extends r{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})}},ue=class extends r{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,pe=class extends r{async claim(e,t){var o;let s=await this.post("/infra/serp/collector/claim",{collectorId:e,kinds:t},{timeout:en});return(o=s&&typeof s=="object"?s.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 Ge=class extends r{async create(e){return this.post("/infra/storage/files/folders",{name:e})}},He=class extends r{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 ge=class extends r{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,s){return this.post(`/product/erix/ai/reviews/${encodeURIComponent(e)}`,u({verdict:t},s?{note:s}:{}))}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,s){return this.post(`/product/erix/ai/suggestion/${e}/send`,{text:t,confidence:s})}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 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,s){return this.post(`/product/flow/runs/${encodeURIComponent(e)}/approve`,u({decision:t},s&&{nodeId:s}))}};var We=class extends r{async system(){return(await this.get("/health")).data}};var Qe=class extends r{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 de=class extends r{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}};var me=class extends r{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 s=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(o=s==null?void 0:s.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var s,o;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(s=t==null?void 0:t.data)==null?void 0:s.entries)!=null?o:[]}};var ht=class extends r{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"}},ze=class{constructor(e){i(this,"copilot");this.copilot=new ht(e)}};var Ye=class extends r{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 bt=class extends r{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},ft=class extends r{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)}},xt=class extends r{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)}},kt=class extends r{async listPublic(){return this.get("/platform/billing/plans/public")}},wt=class extends r{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)}},vt=class extends r{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")}},Tt=class extends r{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)}},Je=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 bt(e),this.subscriptions=new ft(e),this.plans=new kt(e),this.checkout=new wt(e),this.user=new vt(e),this.credits=new Tt(e),this.addOns=new xt(e)}};var ye=class extends r{async list(){return this.get("/platform/public/catalog",{ignoreClientCode:!0})}};var tn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown","text/csv","text/html","image/png","image/jpeg","image/webp"],he=class extends r{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 s=await new P(this.client).upload(e,{folder:"knowledge"});return this.post("/platform/knowledge/sources",{kind:"file",key:s.key,mimeType:s.mimeType,title:(a=(o=t.title)!=null?o:s.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 Xe=class extends r{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 r{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",{})}},et=class extends r{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)}`)}},tt=class extends r{async list(){return this.get("/platform/auth/sessions")}async revoke(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}};var nt=class{constructor(e){i(this,"messages");i(this,"conversations");this.messages=new P(e),this.conversations=new _e(e)}},rt=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 Ie(e),this.pipelines=new Le(e),this.activities=new Se(e),this.analytics=new Ce(e),this.scoring=new Ee(e),this.payments=new Pe(e),this.chat=new nt(e),this.events=new $e(e),this.invoices=new Ve(e),this.checkout=new Te(e),this.projects=new De(e),this.niche=new Oe(e),this.documents=new Re(e),this.invoiceExport=new Ae(e),this.ai=new ge(e)}},st=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 $(e),this.campaigns=new T(e),this.conversations=new V(e),this.home=new O(e),this.drafts=new D(e),this.firstRun=new _(e),this.audiences=new M(e)}},it=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 ee(e),this.audits=new te(e),this.insights=new ne(e),this.searchConsole=new re(e),this.ranks=new se(e),this.local=new ie(e),this.reports=new oe(e),this.backlinks=new ce(e),this.performance=new le(e),this.briefs=new ue(e),this.research=new ae(e)}},ot=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 U(e),this.signals=new F(e),this.tools=new N(e),this.campaigns=new q(e),this.runs=new B(e),this.leads=new K(e),this.import=new j(e),this.lists=new G(e),this.compliance=new H(e),this.market=new W(e),this.learning=new Q(e),this.lookalikes=new z(e),this.freshness=new Y(e),this.audit=new J(e)}},be=class{constructor(e){i(this,"erix");i(this,"flow");i(this,"seo");i(this,"laie");this.erix=new rt(e),this.flow=new st(e),this.seo=new it(e),this.laie=new ot(e)}},at=class{constructor(e){i(this,"config");i(this,"templates");this.config=new Ne(e),this.templates=new Ue(e)}},ct=class{constructor(e){i(this,"templates");this.templates=new qe(e)}},St=class{constructor(e){i(this,"leadForms");this.leadForms=new Ke(e)}},lt=class{constructor(e){i(this,"email");i(this,"whatsapp");i(this,"facebook");i(this,"meet");i(this,"connections");i(this,"voice");this.email=new at(e),this.whatsapp=new ct(e),this.facebook=new St(e),this.meet=new Fe(e),this.connections=new Me(e),this.voice=new Z(e)}},ut=class{constructor(e){i(this,"files");i(this,"folders");i(this,"media");this.files=new He(e),this.folders=new Ge(e),this.media=new Be(e)}},Ct=class{constructor(e){i(this,"collector");this.collector=new pe(e)}},fe=class{constructor(e){i(this,"connect");i(this,"storage");i(this,"serp");this.connect=new lt(e),this.storage=new ut(e),this.serp=new Ct(e)}},pt=class{constructor(e){i(this,"onboarding");i(this,"persona");this.onboarding=new de(e),this.persona=new me(e)}},gt=class{constructor(e){i(this,"me");i(this,"members");i(this,"sessions");i(this,"notifications");this.me=new Ze(e),this.members=new et(e),this.sessions=new tt(e),this.notifications=new Qe(e)}},xe=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 Ye(e),this.users=new gt(e),this.tenants=new pt(e),this.billing=new Je(e),this.support=new Xe(e),this.ai=new ze(e),this.knowledge=new he(e),this.health=new We(e),this.catalog=new ye(e)}};var S=class extends f{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},ke=class{async constructEvent(e,t,s){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",s).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 Rt=typeof process!="undefined"&&"4.0.1"||"3.1.1";var Gt,At=(Gt=jt.default)!=null?Gt:jt,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,It,Pt,Lt,Et,$t,Vt;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 s=(It=e.baseUrl)!=null?It:Ft,o=Nt(this.apiVersion,(Pt=t==null?void 0:t.url)!=null?Pt:s),a=e.socketUrl||s,l=typeof window!="undefined"&&typeof window.document!="undefined",d=l?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",g=l?((Lt=globalThis.navigator)==null?void 0:Lt.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",C=v(u({},t?{}:{"x-api-key":e.apiKey,"x-client-code":((Et=e.clientCode)==null?void 0:Et.toUpperCase())||""}),{"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:Rt,runtime:d,os:g})});if(this.client=rn.create({baseURL:o,headers:C,timeout:($t=e.timeout)!=null?$t:3e4}),At(this.client,{retries:3,retryDelay:At.exponentialDelay,retryCondition:b=>{var we;return At.isNetworkOrIdempotentRequestError(b)||((we=b.response)==null?void 0:we.status)===429},onRetry:(b,we,Ot)=>{var Dt,_t;typeof process!="undefined"&&((Dt=process.env)==null?void 0:Dt.NODE_ENV)==="development"&&console.warn(`[ECODrIx SDK] Retrying request (${b}/3): ${(_t=Ot.method)==null?void 0:_t.toUpperCase()} ${Ot.url}. Reason: ${we.message}`)}}),this.platform=new xe(this.client),this.product=new be(this.client),this.infra=new fe(this.client),this.webhooks=new ke,t){if(t.ticket){let b=t.ticket;this.startSocket=()=>this.initSocket(a,async()=>({ticket:await b()}))}}else{let b={apiKey:e.apiKey,clientCode:((Vt=e.clientCode)==null?void 0:Vt.toUpperCase())||""};this.startSocket=()=>this.initSocket(a,async()=>b,{"x-api-key":b.apiKey,"x-client-code":b.clientCode})}if(l){let b={version:Rt,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=b}}initSocket(e,t,s){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:s}),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 s,o;let t=(s=e.at(-1))==null?void 0:s.seq;typeof t=="number"&&t>((o=this.lastSeq)!=null?o:0)&&(this.lastSeq=t)}))}on(e,t){var s;return this.closed||(s=this.startSocket)==null||s.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,s,o){var a,l,d;try{return(await this.client.request({method:e,url:t,data:s,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 mi={401:R,403:qt,429:ve};function yi(n){throw A(n)}function hi(n,e){return n instanceof e}function bi(n){return n instanceof R?{message:n.message,status:n.status,code:n.code,type:"AuthenticationError"}:n instanceof ve?{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 Ht={[R.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[ve.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 fi(n){let e=n.constructor.name;return Ht[e]||Ht[f.name]}var wi=L;export{f as APIError,r as APIResource,ge as AiAgent,R as AuthenticationError,T as Campaigns,ye as Catalog,pe as Collector,lt as ConnectInfra,L as ECODrIx,L as ECODrIxAPI,Ht as ERROR_RETRY_CONFIG,on as EcodrixError,at as EmailConnect,nt as ErixChat,rt as ErixProduct,M as FlowAudiences,$ as FlowAutomations,V as FlowConversations,D as FlowDrafts,_ as FlowFirstRunResource,O as FlowHome,st as FlowProduct,mi as HTTP_STATUS_ERROR_MAP,fe as InfraDomain,tn as KNOWLEDGE_FILE_TYPES,he as Knowledge,Qt as LAIE_EVENTS,Bt as LEAD_STATUS_VALUES,J as LaieAudits,q as LaieCampaigns,H as LaieCompliance,Y as LaieFreshness,j as LaieImport,K as LaieLeads,Q as LaieLearning,G as LaieLists,z as LaieLookalikes,W as LaieMarket,U as LaiePacks,ot as LaieProduct,B as LaieRuns,F as LaieSignals,N as LaieTools,de as Onboarding,qt as PermissionError,me as Persona,xe as PlatformDomain,pt as PlatformTenants,gt as PlatformUsers,be as ProductDomain,ve as RateLimitError,te as SeoAudits,ce as SeoBacklinks,ue as SeoBriefs,ne as SeoInsights,ie as SeoLocal,le as SeoPerformance,it as SeoProduct,ee as SeoProjects,se as SeoRanks,oe as SeoReports,ae as SeoResearch,re as SeoSearchConsole,ut as StorageInfra,Yt as VOICE_EVENTS,Kt as VOICE_REFUSAL_REASONS,Z as Voice,je as VoiceCampaigns,S as WebhookSignatureError,ke as Webhooks,ct as WhatsAppConnect,wi as default,bi as getErrorDetails,fi as getRetryConfig,yi as handleAPIError,hi as isAPIError,Wt as laieStageQueued,A as toAPIError,Xt as voiceErrorCode,Zt as voiceRefusalReason};
1
+ import{a as u,b as v,c as w,d as i,e as Ut,f as Ft,g as Nt,h as qt,i as an,j as f,k as R,l as Bt,m as ve,n as A}from"./chunk-XPXDFZWU.js";import sn from"axios";import Gt from"axios-retry";var r=class{constructor(e){i(this,"client",e)}async post(e,t,s){try{let o=this.buildConfig(s);return(await this.client.post(e,t,o)).data}catch(o){this.handleError(o)}}async get(e,t){try{let s=this.buildConfig(t);return(await this.client.get(e,s)).data}catch(s){this.handleError(s)}}async patch(e,t,s){try{let o=this.buildConfig(s);return(await this.client.patch(e,t,o)).data}catch(o){this.handleError(o)}}async put(e,t,s){try{let o=this.buildConfig(s);return(await this.client.put(e,t,o)).data}catch(o){this.handleError(o)}}async deleteRequest(e,t){try{let s=this.buildConfig(t);return(await this.client.delete(e,s)).data}catch(s){this.handleError(s)}}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 $=class extends r{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 r{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}`,V=class extends r{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 O=class extends r{async get(){return super.get("/product/flow/home")}async nav(){return super.get("/product/flow/home/nav")}},D=class extends r{async create(e){return this.post("/product/flow/drafts",e)}},_=class extends r{async status(){return this.get("/product/flow/first-run")}async installPack(e){return this.post(`/product/flow/first-run/packs/${e}`)}},M=class extends r{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 y="/product/erix/commerce/checkout",x="/product/erix/public/checkout",h=encodeURIComponent,mt=class extends r{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,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/items`,s)}async startSession(e){return this.post(`${x}/sessions`,e)}async applyCoupon(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/coupon`,s)}async verify(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/verify`,s)}async placeOrder(e){let o=e,{sessionId:t}=o,s=w(o,["sessionId"]);return this.post(`${x}/sessions/${h(t)}/order`,s)}async verifyRazorpay(e){let a=e,{sessionId:t,orderId:s}=a,o=w(a,["sessionId","orderId"]);return this.post(`${x}/sessions/${h(t)}/order/${h(s)}/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})}},yt=class extends r{async create(e){return this.post(`${y}/sessions`,e)}},Te=class extends r{constructor(t){super(t);i(this,"buyer");i(this,"sessions");this.buyer=new mt(t),this.sessions=new yt(t)}async listProducts(){return this.get(`${y}/products`)}async createProduct(t){return this.post(`${y}/products`,t)}async updateProduct(t,s){return this.patch(`${y}/products/${h(t)}`,s)}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,s){return this.patch(`${y}/coupons/${h(t)}`,s)}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,s){return this.patch(`${y}/orders/${h(t)}/status`,s)}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 ht=class extends r{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}`)}},Se=class extends r{constructor(t){super(t);i(this,"notes");this.notes=new ht(t)}async timeline(t,s){return this.get(`/product/erix/crm/leads/${t}/timeline`,{params:s})}async list(t,s){return this.get(`/product/erix/crm/leads/${t}/activities`,{params:u({},s)})}async log(t){return this.post(`/product/erix/crm/leads/${t.leadId}/activities`,t)}async logCall(t,s){return this.post(`/product/erix/crm/leads/${t}/calls`,s)}};var Ce=class extends r{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 Re=class extends r{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,s){return this.patch(`/product/erix/crm/documents/checklist/${e}/${t}`,s?{fileUrl:s}:{})}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 Ae=class extends r{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 Kt=["open","won","lost","archived"],Ie=class extends r{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:[],s=[{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:Kt.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:[...s,...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 s=[];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")s.push(g.value);else throw g.reason}return s}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 Ft(this,null,function*(){let t=(e==null?void 0:e.page)||1,s=!0;for(;s;){let o=yield new Ut(this.list(v(u({},e),{page:t}))),a=Array.isArray(o.data)?o.data:o||[];if(a.length===0){s=!1;break}for(let l of a)yield l;o.pagination&&t<o.pagination.pages||!o.pagination&&a.length>0?t++:s=!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,s={}){return this.get(`/product/erix/crm/pipelines/${e}/stages/${t}/leads`,{params:s})}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,s){return this.patch(`/product/erix/crm/leads/${e}`,{nextFollowUpAt:t,nextFollowUpNote:t&&s!=null?s:null})}async move(e,t){return this.patch(`/product/erix/crm/leads/${e}/move`,{stageId:t})}async convert(e,t,s){return this.post(`/product/erix/crm/leads/${e}/convert`,{outcome:t,reason:s})}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,s){return this.patch(`/product/erix/crm/notes/${t}`,s)}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 Pe=class extends r{async capture(e){return this.post("/product/erix/crm/payments/capture",e)}};var Le=class extends r{async list(){return this.get("/product/erix/crm/pipelines")}async getStageManifest(e){var o,a;let t=await this.retrieve(e),s=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:s.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 Ee=class extends r{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 $e=class extends r{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 Ve=class extends r{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 Oe=class extends r{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 De=class extends r{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,s){return this.patch(`/product/erix/commerce/projects/${e}/documents/${t}/signature`,{required:s})}async addSigner(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/signers`,s)}async decline(e,t){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/decline`,{})}async stampSign(e,t,s){return this.post(`/product/erix/commerce/projects/${e}/documents/${t}/stamp-sign`,s)}};var _e=class extends r{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 P=class extends r{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",{phone:e.to,text:e.text})}async sendTemplate(e){return this.post("/infra/connect/send/whatsapp",{phone:e.to,templateName:e.templateName,language:e.language,variables:e.variables})}async star(e,t){return this.post(`/platform/inbox/messages/${e}/star`,{starred:t})}async markRead(e){return this.post(`/platform/inbox/conversations/${e}/read`,{})}async upload(e,t={}){var C,k,E;let s=(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:s,contentType:o}),{uploadUrl:l,key:d}=a.data,g=await fetch(l,{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:s}}};var Me=class extends r{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 Ue=class extends r{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 Fe=class extends r{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 Ne=class extends r{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 qe=class extends r{async list(e){return this.get("/infra/connect/whatsapp/templates",{params:e})}async sync(){return this.post("/infra/connect/whatsapp/templates/sync",{})}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){return this.deleteRequest(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}${t?"?force=true":""}`)}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 s=`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/validate`;return t?this.post(s,t):this.get(s)}async preview(e,t,s,o){return this.post(`/infra/connect/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:t,mappings:s,onEmptyVariable:o})}async getVariableManifest(e){var a,l;let t=await this.retrieve(e),s=Array.isArray((a=t.data)==null?void 0:a.components)?t.data.components:[],o=[];for(let d of s)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: ${((l=t.data)==null?void 0:l.name)||e}`,fields:o,uiHints:{icon:"Variables",primaryColor:"#059669"}}}};var Qt=n=>"queued"in n&&n.queued===!0,zt={runProgress:"laie:run:progress",importComplete:"laie:import:complete"},p=encodeURIComponent,c="/product/laie",U=class extends r{async list(){return this.get(`${c}/packs`)}async byId(e){return this.get(`${c}/packs/${p(e)}`)}},F=class extends r{async catalog(e={}){return this.get(`${c}/signals/catalog`,{params:e})}async list(e={}){return this.get(`${c}/signals`,{params:e})}},N=class extends r{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})}},q=class extends r{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)}},B=class extends r{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,s={}){return this.get(`${c}/campaigns/${p(e)}/runs/${p(t)}/changes`,{params:s})}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`)}},K=class extends r{async list(e={}){let o=e,{importedToCrm:t}=o,s=w(o,["importedToCrm"]);return this.get(`${c}/leads`,{params:u(u({},s),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})}},j=class extends r{async pipelines(){return this.get(`${c}/import/pipelines`)}async crm(e){return this.post(`${c}/import/crm`,e)}},G=class extends r{async enrich(e){return this.post(`${c}/lists/enrich`,e)}},H=class extends r{async dsr(e){return this.post(`${c}/compliance/dsr`,e)}async report(e={}){return this.get(`${c}/compliance/report`,{params:e})}},W=class extends r{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)}},Q=class extends r{async weights(e={}){return this.get(`${c}/learning/weights`,{params:e})}async outcomes(e={}){return this.get(`${c}/learning/outcomes`,{params:e})}},z=class extends r{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})}},Y=class extends r{async status(){return this.get(`${c}/freshness`)}},J=class extends r{async start(e){return this.post(`${c}/audit`,e)}async byId(e){return this.get(`${c}/audit/${p(e)}`)}};import Yt from"axios";var Be=class extends r{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 s=await this.post("/infra/storage/files/upload-url",t),{uploadUrl:o,key:a}=s.data;await Yt.put(o,e,{headers:{"Content-Type":t.contentType}});let l=e.size||e.byteLength||0;return this.post("/infra/storage/files/confirm-upload",{key:a,sizeBytes:l})}};var Ke=class extends r{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 Jt={callChanged:"voice_call_changed"},Xt=["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 Zt(n){let e=n instanceof f?n.code:void 0;return e&&Xt.includes(e)?e:void 0}var jt={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 en(n){var e;return(e=jt[n])!=null?e:n}var X=encodeURIComponent,je=class extends r{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/${X(e)}/voice-preview`)}counters(e){return this.get(`/infra/connect/voice/campaigns/${X(e)}/counters`)}approval(e){return this.get(`/infra/connect/voice/campaigns/${X(e)}/approval`)}requestApproval(e){return this.post(`/infra/connect/voice/campaigns/${X(e)}/approval/request`,{})}},Z=class extends r{constructor(t){super(t);i(this,"campaigns");this.campaigns=new je(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)}async preview(t={}){var s;try{return(await this.client.post("/infra/connect/voice/preview",t,{responseType:"arraybuffer"})).data}catch(o){let a=(s=o==null?void 0:o.response)==null?void 0:s.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/${X(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 ee=class extends r{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})}},te=class extends r{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"})}},ne=class extends r{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)}`)}},re=class extends r{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})}},se=class extends r{async keywords(e){return this.get(`/product/seo/ranks/${e}/keywords`)}async add(e,t,s={}){return this.post(`/product/seo/ranks/${e}/keywords`,u({queries:t},s))}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,s={}){return this.get(`/product/seo/ranks/${e}/keywords/${t}/history`,{params:s})}async changes(e){return this.get(`/product/seo/ranks/${e}/changes`)}},ie=class extends r{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})}},oe=class extends r{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`)}},ae=class extends r{async seed(e,t,s="en"){return this.post(`/product/seo/research/${e}/seed`,{seed:t,lang:s})}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 ce=class extends r{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})}},le=class extends r{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})}},ue=class extends r{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 tn=35e3,pe=class extends r{async claim(e,t){var o;let s=await this.post("/infra/serp/collector/claim",{collectorId:e,kinds:t},{timeout:tn});return(o=s&&typeof s=="object"?s.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 Ge=class extends r{async create(e){return this.post("/infra/storage/files/folders",{name:e})}},He=class extends r{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 ge=class extends r{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,s){return this.post(`/product/erix/ai/reviews/${encodeURIComponent(e)}`,u({verdict:t},s?{note:s}:{}))}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,s){return this.post(`/product/erix/ai/suggestion/${e}/send`,{text:t,confidence:s})}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 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,s){return this.post(`/product/flow/runs/${encodeURIComponent(e)}/approve`,u({decision:t},s&&{nodeId:s}))}};var We=class extends r{async system(){return(await this.get("/health")).data}};var Qe=class extends r{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 de=class extends r{async global(e){return this.post("/platform/tenants/onboarding/global",e)}async complete(e){return this.post("/platform/tenants/onboarding/complete",e)}};var me=class extends r{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 s=await super.get(`/platform/tenants/persona/${e}/timeline`,{params:t});return(o=s==null?void 0:s.data)!=null?o:{entries:[],hasMore:!1}}async followups(e){var s,o;let t=await super.get(`/platform/tenants/persona/${e}/followups`);return(o=(s=t==null?void 0:t.data)==null?void 0:s.entries)!=null?o:[]}};var bt=class extends r{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"}},ze=class{constructor(e){i(this,"copilot");this.copilot=new bt(e)}};var Ye=class extends r{async list(e){return this.get("/platform/tenants/audit",{params:e})}};var Je=class extends r{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 ft=class extends r{async get(){return super.get("/platform/billing/entitlements/entitlements")}async usage(){return super.get("/platform/billing/entitlements/usage")}},xt=class extends r{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)}},kt=class extends r{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)}},wt=class extends r{async listPublic(){return this.get("/platform/billing/plans/public")}},vt=class extends r{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)}},Tt=class extends r{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")}},St=class extends r{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)}},Xe=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 ft(e),this.subscriptions=new xt(e),this.plans=new wt(e),this.checkout=new vt(e),this.user=new Tt(e),this.credits=new St(e),this.addOns=new kt(e)}};var ye=class extends r{async list(){return this.get("/platform/public/catalog",{ignoreClientCode:!0})}};var nn=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown","text/csv","text/html","image/png","image/jpeg","image/webp"],he=class extends r{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 s=await new P(this.client).upload(e,{folder:"knowledge"});return this.post("/platform/knowledge/sources",{kind:"file",key:s.key,mimeType:s.mimeType,title:(a=(o=t.title)!=null?o:s.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 Ze=class extends r{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 et=class extends r{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",{})}},tt=class extends r{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)}`)}},nt=class extends r{async list(){return this.get("/platform/auth/sessions")}async revoke(e){return this.deleteRequest(`/platform/auth/sessions/${e}`)}};var rt=class{constructor(e){i(this,"messages");i(this,"conversations");this.messages=new P(e),this.conversations=new _e(e)}},st=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 Ie(e),this.pipelines=new Le(e),this.activities=new Se(e),this.analytics=new Ce(e),this.scoring=new Ee(e),this.payments=new Pe(e),this.chat=new rt(e),this.events=new $e(e),this.invoices=new Ve(e),this.checkout=new Te(e),this.projects=new De(e),this.niche=new Oe(e),this.documents=new Re(e),this.invoiceExport=new Ae(e),this.ai=new ge(e)}},it=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 $(e),this.campaigns=new T(e),this.conversations=new V(e),this.home=new O(e),this.drafts=new D(e),this.firstRun=new _(e),this.audiences=new M(e)}},ot=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 ee(e),this.audits=new te(e),this.insights=new ne(e),this.searchConsole=new re(e),this.ranks=new se(e),this.local=new ie(e),this.reports=new oe(e),this.backlinks=new ce(e),this.performance=new le(e),this.briefs=new ue(e),this.research=new ae(e)}},at=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 U(e),this.signals=new F(e),this.tools=new N(e),this.campaigns=new q(e),this.runs=new B(e),this.leads=new K(e),this.import=new j(e),this.lists=new G(e),this.compliance=new H(e),this.market=new W(e),this.learning=new Q(e),this.lookalikes=new z(e),this.freshness=new Y(e),this.audit=new J(e)}},be=class{constructor(e){i(this,"erix");i(this,"flow");i(this,"seo");i(this,"laie");this.erix=new st(e),this.flow=new it(e),this.seo=new ot(e),this.laie=new at(e)}},ct=class{constructor(e){i(this,"config");i(this,"templates");this.config=new Ne(e),this.templates=new Ue(e)}},lt=class{constructor(e){i(this,"templates");this.templates=new qe(e)}},Ct=class{constructor(e){i(this,"leadForms");this.leadForms=new Ke(e)}},ut=class{constructor(e){i(this,"email");i(this,"whatsapp");i(this,"facebook");i(this,"meet");i(this,"connections");i(this,"voice");this.email=new ct(e),this.whatsapp=new lt(e),this.facebook=new Ct(e),this.meet=new Fe(e),this.connections=new Me(e),this.voice=new Z(e)}},pt=class{constructor(e){i(this,"files");i(this,"folders");i(this,"media");this.files=new He(e),this.folders=new Ge(e),this.media=new Be(e)}},Rt=class{constructor(e){i(this,"collector");this.collector=new pe(e)}},fe=class{constructor(e){i(this,"connect");i(this,"storage");i(this,"serp");this.connect=new ut(e),this.storage=new pt(e),this.serp=new Rt(e)}},gt=class{constructor(e){i(this,"onboarding");i(this,"persona");i(this,"audit");this.onboarding=new de(e),this.persona=new me(e),this.audit=new Ye(e)}},dt=class{constructor(e){i(this,"me");i(this,"members");i(this,"sessions");i(this,"notifications");this.me=new et(e),this.members=new tt(e),this.sessions=new nt(e),this.notifications=new Qe(e)}},xe=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 Je(e),this.users=new dt(e),this.tenants=new gt(e),this.billing=new Xe(e),this.support=new Ze(e),this.ai=new ze(e),this.knowledge=new he(e),this.health=new We(e),this.catalog=new ye(e)}};var S=class extends f{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},ke=class{async constructEvent(e,t,s){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",s).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 At=typeof process!="undefined"&&"4.0.2"||"3.1.1";var Ht,It=(Ht=Gt.default)!=null?Ht:Gt,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,Pt,Lt,Et,$t,Vt,Ot;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 s=(Pt=e.baseUrl)!=null?Pt:Nt,o=qt(this.apiVersion,(Lt=t==null?void 0:t.url)!=null?Lt:s),a=e.socketUrl||s,l=typeof window!="undefined"&&typeof window.document!="undefined",d=l?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",g=l?((Et=globalThis.navigator)==null?void 0:Et.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown",C=v(u({},t?{}:{"x-api-key":e.apiKey,"x-client-code":(($t=e.clientCode)==null?void 0:$t.toUpperCase())||""}),{"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:At,runtime:d,os:g})});if(this.client=sn.create({baseURL:o,headers:C,timeout:(Vt=e.timeout)!=null?Vt:3e4}),It(this.client,{retries:3,retryDelay:It.exponentialDelay,retryCondition:b=>{var we;return It.isNetworkOrIdempotentRequestError(b)||((we=b.response)==null?void 0:we.status)===429},onRetry:(b,we,Dt)=>{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=Dt.method)==null?void 0:Mt.toUpperCase()} ${Dt.url}. Reason: ${we.message}`)}}),this.platform=new xe(this.client),this.product=new be(this.client),this.infra=new fe(this.client),this.webhooks=new ke,t){if(t.ticket){let b=t.ticket;this.startSocket=()=>this.initSocket(a,async()=>({ticket:await b()}))}}else{let b={apiKey:e.apiKey,clientCode:((Ot=e.clientCode)==null?void 0:Ot.toUpperCase())||""};this.startSocket=()=>this.initSocket(a,async()=>b,{"x-api-key":b.apiKey,"x-client-code":b.clientCode})}if(l){let b={version:At,clientCode:e.clientCode,initializedAt:new Date().toISOString()};window.__ECODRIX_SDK__=b}}initSocket(e,t,s){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:s}),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 s,o;let t=(s=e.at(-1))==null?void 0:s.seq;typeof t=="number"&&t>((o=this.lastSeq)!=null?o:0)&&(this.lastSeq=t)}))}on(e,t){var s;return this.closed||(s=this.startSocket)==null||s.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,s,o){var a,l,d;try{return(await this.client.request({method:e,url:t,data:s,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 fi={401:R,403:Bt,429:ve};function xi(n){throw A(n)}function ki(n,e){return n instanceof e}function wi(n){return n instanceof R?{message:n.message,status:n.status,code:n.code,type:"AuthenticationError"}:n instanceof ve?{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 Wt={[R.name]:{shouldRetry:!1,reason:"Authentication errors require fixing credentials, not retrying"},[ve.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 vi(n){let e=n.constructor.name;return Wt[e]||Wt[f.name]}var Ci=L;export{f as APIError,r as APIResource,ge as AiAgent,R as AuthenticationError,T as Campaigns,ye as Catalog,pe as Collector,ut as ConnectInfra,L as ECODrIx,L as ECODrIxAPI,Wt as ERROR_RETRY_CONFIG,an as EcodrixError,ct as EmailConnect,rt as ErixChat,st as ErixProduct,M as FlowAudiences,$ as FlowAutomations,V as FlowConversations,D as FlowDrafts,_ as FlowFirstRunResource,O as FlowHome,it as FlowProduct,fi as HTTP_STATUS_ERROR_MAP,fe as InfraDomain,nn as KNOWLEDGE_FILE_TYPES,he as Knowledge,zt as LAIE_EVENTS,Kt as LEAD_STATUS_VALUES,J as LaieAudits,q as LaieCampaigns,H as LaieCompliance,Y as LaieFreshness,j as LaieImport,K as LaieLeads,Q as LaieLearning,G as LaieLists,z as LaieLookalikes,W as LaieMarket,U as LaiePacks,at as LaieProduct,B as LaieRuns,F as LaieSignals,N as LaieTools,de as Onboarding,Bt as PermissionError,me as Persona,xe as PlatformDomain,gt as PlatformTenants,dt as PlatformUsers,be as ProductDomain,ve as RateLimitError,te as SeoAudits,ce as SeoBacklinks,ue as SeoBriefs,ne as SeoInsights,ie as SeoLocal,le as SeoPerformance,ot as SeoProduct,ee as SeoProjects,se as SeoRanks,oe as SeoReports,ae as SeoResearch,re as SeoSearchConsole,pt as StorageInfra,Jt as VOICE_EVENTS,jt as VOICE_REFUSAL_REASONS,Z as Voice,je as VoiceCampaigns,S as WebhookSignatureError,ke as Webhooks,lt as WhatsAppConnect,Ci as default,wi as getErrorDetails,vi as getRetryConfig,xi as handleAPIError,ki as isAPIError,Qt as laieStageQueued,A as toAPIError,Zt as voiceErrorCode,en as voiceRefusalReason};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodrix/erix-api",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
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).",