@scalemule/sdk 0.0.59 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +40 -0
- package/dist/index.mjs +334 -16
- package/package.json +1 -1
- package/dist/chunk-3FTGBRLU.mjs +0 -158
- package/dist/upload-compression-VOUJRAIM.mjs +0 -97
- package/dist/upload-resume-RXLHBH5E.mjs +0 -6
package/dist/index.d.mts
CHANGED
|
@@ -3085,6 +3085,64 @@ declare class ReferralsService extends ServiceModule {
|
|
|
3085
3085
|
resolveCode(code: string, options?: RequestOptions): Promise<ApiResponse<ResolvedReferral>>;
|
|
3086
3086
|
}
|
|
3087
3087
|
|
|
3088
|
+
/**
|
|
3089
|
+
* Leads Service Module
|
|
3090
|
+
*
|
|
3091
|
+
* Sales lead capture — e.g. the "Contact us" form on a custom/enterprise plan.
|
|
3092
|
+
* Callable by a not-logged-in visitor (only the app's API key is required).
|
|
3093
|
+
*
|
|
3094
|
+
* Routes:
|
|
3095
|
+
* POST / → create a lead (tenant-scoped by the app credential)
|
|
3096
|
+
*
|
|
3097
|
+
* The leads table has native contact fields (name/email/phone) plus a free-form
|
|
3098
|
+
* `metadata` JSON. Enterprise-form extras (company, job title, employees,
|
|
3099
|
+
* country, message) and the plan context are placed into `metadata`.
|
|
3100
|
+
*/
|
|
3101
|
+
|
|
3102
|
+
interface CreateLeadInput {
|
|
3103
|
+
/** Required. Full contact name (e.g. `${firstName} ${lastName}`). */
|
|
3104
|
+
contactName: string;
|
|
3105
|
+
/** Required. */
|
|
3106
|
+
contactEmail: string;
|
|
3107
|
+
contactPhone?: string;
|
|
3108
|
+
/** Defaults to 'sales_inquiry'. */
|
|
3109
|
+
serviceCategory?: string;
|
|
3110
|
+
/** Defaults to 'form'. */
|
|
3111
|
+
leadSource?: string;
|
|
3112
|
+
/** Free-text "how can sales help you?". Stored in metadata. */
|
|
3113
|
+
message?: string;
|
|
3114
|
+
company?: string;
|
|
3115
|
+
jobTitle?: string;
|
|
3116
|
+
employees?: string;
|
|
3117
|
+
country?: string;
|
|
3118
|
+
/** The plan the enquiry is about (custom/enterprise tier). */
|
|
3119
|
+
planId?: string;
|
|
3120
|
+
planName?: string;
|
|
3121
|
+
utmSource?: string;
|
|
3122
|
+
utmMedium?: string;
|
|
3123
|
+
utmCampaign?: string;
|
|
3124
|
+
/** Extra fields merged into the lead's metadata. */
|
|
3125
|
+
metadata?: Record<string, unknown>;
|
|
3126
|
+
}
|
|
3127
|
+
interface Lead {
|
|
3128
|
+
id: string;
|
|
3129
|
+
contact_name: string;
|
|
3130
|
+
contact_email: string;
|
|
3131
|
+
contact_phone?: string;
|
|
3132
|
+
service_category: string;
|
|
3133
|
+
lead_source: string;
|
|
3134
|
+
lead_status: string;
|
|
3135
|
+
created_at: string;
|
|
3136
|
+
}
|
|
3137
|
+
declare class LeadsService extends ServiceModule {
|
|
3138
|
+
protected basePath: string;
|
|
3139
|
+
/**
|
|
3140
|
+
* Submit a sales lead. Enterprise-form extras and the plan context are folded
|
|
3141
|
+
* into `metadata` (the leads table has no native company/employees columns).
|
|
3142
|
+
*/
|
|
3143
|
+
create(input: CreateLeadInput, options?: RequestOptions): Promise<ApiResponse<Lead>>;
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3088
3146
|
/**
|
|
3089
3147
|
* Billing Service Module
|
|
3090
3148
|
*
|
|
@@ -7240,6 +7298,7 @@ declare class ScaleMule {
|
|
|
7240
7298
|
readonly socialPolicy: SocialPolicyService;
|
|
7241
7299
|
readonly referrals: ReferralsService;
|
|
7242
7300
|
readonly billing: BillingService;
|
|
7301
|
+
readonly leads: LeadsService;
|
|
7243
7302
|
readonly analytics: AnalyticsService;
|
|
7244
7303
|
readonly flags: FlagsService;
|
|
7245
7304
|
readonly communication: CommunicationService;
|
|
@@ -7340,4 +7399,4 @@ declare class ScaleMule {
|
|
|
7340
7399
|
getClient(): ScaleMuleClient;
|
|
7341
7400
|
}
|
|
7342
7401
|
|
|
7343
|
-
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, readAnonymousId, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
|
7402
|
+
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateLeadInput, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Lead, type Leaderboard, type LeaderboardEntry, LeaderboardService, LeadsService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, type VoteState, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, readAnonymousId, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
package/dist/index.d.ts
CHANGED
|
@@ -3085,6 +3085,64 @@ declare class ReferralsService extends ServiceModule {
|
|
|
3085
3085
|
resolveCode(code: string, options?: RequestOptions): Promise<ApiResponse<ResolvedReferral>>;
|
|
3086
3086
|
}
|
|
3087
3087
|
|
|
3088
|
+
/**
|
|
3089
|
+
* Leads Service Module
|
|
3090
|
+
*
|
|
3091
|
+
* Sales lead capture — e.g. the "Contact us" form on a custom/enterprise plan.
|
|
3092
|
+
* Callable by a not-logged-in visitor (only the app's API key is required).
|
|
3093
|
+
*
|
|
3094
|
+
* Routes:
|
|
3095
|
+
* POST / → create a lead (tenant-scoped by the app credential)
|
|
3096
|
+
*
|
|
3097
|
+
* The leads table has native contact fields (name/email/phone) plus a free-form
|
|
3098
|
+
* `metadata` JSON. Enterprise-form extras (company, job title, employees,
|
|
3099
|
+
* country, message) and the plan context are placed into `metadata`.
|
|
3100
|
+
*/
|
|
3101
|
+
|
|
3102
|
+
interface CreateLeadInput {
|
|
3103
|
+
/** Required. Full contact name (e.g. `${firstName} ${lastName}`). */
|
|
3104
|
+
contactName: string;
|
|
3105
|
+
/** Required. */
|
|
3106
|
+
contactEmail: string;
|
|
3107
|
+
contactPhone?: string;
|
|
3108
|
+
/** Defaults to 'sales_inquiry'. */
|
|
3109
|
+
serviceCategory?: string;
|
|
3110
|
+
/** Defaults to 'form'. */
|
|
3111
|
+
leadSource?: string;
|
|
3112
|
+
/** Free-text "how can sales help you?". Stored in metadata. */
|
|
3113
|
+
message?: string;
|
|
3114
|
+
company?: string;
|
|
3115
|
+
jobTitle?: string;
|
|
3116
|
+
employees?: string;
|
|
3117
|
+
country?: string;
|
|
3118
|
+
/** The plan the enquiry is about (custom/enterprise tier). */
|
|
3119
|
+
planId?: string;
|
|
3120
|
+
planName?: string;
|
|
3121
|
+
utmSource?: string;
|
|
3122
|
+
utmMedium?: string;
|
|
3123
|
+
utmCampaign?: string;
|
|
3124
|
+
/** Extra fields merged into the lead's metadata. */
|
|
3125
|
+
metadata?: Record<string, unknown>;
|
|
3126
|
+
}
|
|
3127
|
+
interface Lead {
|
|
3128
|
+
id: string;
|
|
3129
|
+
contact_name: string;
|
|
3130
|
+
contact_email: string;
|
|
3131
|
+
contact_phone?: string;
|
|
3132
|
+
service_category: string;
|
|
3133
|
+
lead_source: string;
|
|
3134
|
+
lead_status: string;
|
|
3135
|
+
created_at: string;
|
|
3136
|
+
}
|
|
3137
|
+
declare class LeadsService extends ServiceModule {
|
|
3138
|
+
protected basePath: string;
|
|
3139
|
+
/**
|
|
3140
|
+
* Submit a sales lead. Enterprise-form extras and the plan context are folded
|
|
3141
|
+
* into `metadata` (the leads table has no native company/employees columns).
|
|
3142
|
+
*/
|
|
3143
|
+
create(input: CreateLeadInput, options?: RequestOptions): Promise<ApiResponse<Lead>>;
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3088
3146
|
/**
|
|
3089
3147
|
* Billing Service Module
|
|
3090
3148
|
*
|
|
@@ -7240,6 +7298,7 @@ declare class ScaleMule {
|
|
|
7240
7298
|
readonly socialPolicy: SocialPolicyService;
|
|
7241
7299
|
readonly referrals: ReferralsService;
|
|
7242
7300
|
readonly billing: BillingService;
|
|
7301
|
+
readonly leads: LeadsService;
|
|
7243
7302
|
readonly analytics: AnalyticsService;
|
|
7244
7303
|
readonly flags: FlagsService;
|
|
7245
7304
|
readonly communication: CommunicationService;
|
|
@@ -7340,4 +7399,4 @@ declare class ScaleMule {
|
|
|
7340
7399
|
getClient(): ScaleMuleClient;
|
|
7341
7400
|
}
|
|
7342
7401
|
|
|
7343
|
-
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Leaderboard, type LeaderboardEntry, LeaderboardService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, readAnonymousId, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
|
7402
|
+
export { type AccountBalance, type AccountSwitcherPrivacy, AccountsService, type ActiveUsers, type ActivityItem, AgentAuthService, AgentModelsService, type AgentProfile, AgentProjectsService, type AgentResponse, type AgentSecurityPolicy, AgentSessionsService, type AgentSigningKey, type AgentToken, type AgentToolEntitlement, AgentToolsService, type Workspace as AgentWorkspace, AgentsService, type AggregateOptions, type AggregateResult, type AnalyticsEvent, AnalyticsService, type ApiError, type ApiKey, type ApiResponse, type Appeal, type Application, type Attachment, type Attendee, type AudioRegisterResult, AudioService, type AudioUploadViaStorageResult, type AuditLog, type AuthRegisterAgentRequest, type AuthRegisterAgentResponse, AuthService, type AuthSession, type AuthUser, type BackupCodes, BillingService, type CacheEntry, CacheService, type CalendarEvent, type CallParticipant, type CallSession, type CatalogEntry, CatalogService, type ChatMessage, type ChatReaction, ChatService, type ClaimResult, type Client, type ClientContext, type Collection, type Comment, CommunicationService, type CompletedPart, ComplianceService, type CompressionConfig, ConferenceService, type ConferenceSettings, type ConnectedAccount, type ConnectedAccountSubscription, type ConnectedSetupIntentResponse, type ConnectedSubscriptionListParams, type ConnectionStatus, type ContentFlag, type ContentPolicy, type Conversation, type CostReportDay, type CreateProjectInput as CreateCreatorProjectInput, type CreateFlagRequest, type CreateLeadInput, type CreateRuleRequest, type CreateSegmentRequest, type CreateSessionResponse, type CreateVariantRequest, type GenerationJob as CreatorJob, CreatorMakerService, type GenerationOutput as CreatorOutput, type CreatorProject, type CreatorUsage, type Credential, type CredentialScope, type Customer, type DataAccessPolicy, type DataExport, DataService, type DataSource, type DeadLetterJob, type DeviceInfo, type DirectoryUser, type DirectoryUserDetail, type DirectoryUsersListResponse, type Document, type ErrorCode, ErrorCodes, type EventAggregation, EventsService, type FileInfo, type FileStatus, type FlagAuditEntry, type FlagCheck, type FlagCondition, FlagContentService, type FlagDefinition, type FlagDetail, type FlagEnvironment, type FlagEvaluation, type FlagSegment, type FlagVariant, FlagsService, type FollowStatus, type FunctionExecution, type FunctionMetrics, FunctionsService, type Funnel, type FunnelConversion, type GdprRequest, type GenerateInput, type GrantInfo, type GraphEdge, type GraphNode, GraphService, IdentityService, type IdentityType, type IncomingRequestLike, type Invoice, type JobExecution, type JobStats, type JoinCallResponse, type KnownAccount, type KnownAccountDisplay, LEGACY_ANONYMOUS_ID_KEYS, type Lead, type Leaderboard, type LeaderboardEntry, LeaderboardService, LeadsService, type Like, type ListNotificationsParams, type Listing, ListingsService, type LogEntry, type LogInput, type LogQueryParams, type LogQueryResponse, type LogRecord, LoggerService, type LoginActivitySummary, type LoginDeviceInfo, type LoginHistoryEntry, type LoginRiskInfo, MEDIA_PRESETS, type MediaAsset, type MediaKind, type MediaManifest, type MediaManifestOptions, type MediaPolicy, type MediaPreset, type MediaPresetSpec, MediaService, type MediaUploadEvent, type MediaUploadOptions, type MediaUploadPhase, type MediaUploadResult, type MessageCallback, type MessagePin, type MessageStatus, type MetricDataPoint, type MfaStatus, type Model, type ModelEntitlement, type ModelPricing, type ModelProvider, type UsageSummary as ModelUsageSummary, type MultipartCompleteResponse, type MultipartConfig, type MultipartPartUrl, type MultipartPartUrlsResponse, type MultipartStartResponse, type NetworkClass, type Notification, type NotificationListResponse, NotificationsService, type OAuthProvider, type OAuthUrl, OrchestratorService, PHOTO_BREAKPOINTS, type PaginatedResponse, type PaginationMetadata, type PaginationParams, type PartResult, type PartUrl, type Participant, type Payment, type PaymentListParams, type PaymentMethod, type PaymentStatusResponse, type Payout, type PayoutSchedule, type PermissionCheck, type PermissionMatrix, PermissionsService, type PhotoInfo, PhotoService, type PinnedMessagesResponse, type Pipeline, type PipelineVersion, type Policy, type PresenceCallback, type PresenceEvent, type PresignedUploadResponse, type Price, type Product, type Project, type ProjectDocument, type ProjectGrant, type ProjectMember, type PushApiFetcher, type PushPreferences, type PushSettings, type PushSubscriptionInfo, type PushToken, type PushTokenAssociationResult, type PushTopic, type QueryFilter, type QueryOptions, type QuerySort, type QueueJob, QueueService, type ReadStatus, RealtimeService, type RedeemResult, type ReferralAnalytics, type ReferralCampaign, type ReferralProfile, type ReferralStats, ReferralsService, type Refund, type RegisterAgentRequest, type RegisterAgentResponse, type RegisterPushTokenData, type RequestOptions, type ResolvedReferral, type ResumeSession, type Role, type RuntimeTemplate, type RuntimeTemplateVersion, type S3MultipartOptions, type S3MultipartResult, type S3SingleUploadOptions, type S3SingleUploadResult, type S3UploadProgress, STORAGE_KEYS, ScaleMule, ScaleMuleClient, type ScaleMuleConfig, type SchedulerJob, SchedulerService, type SearchResult, SearchService, type SearchUsersParams, type SecurityLayers, type ServerlessFunction, type ServiceHealth, ServiceModule, type Session, type SessionArtifact, type SessionInfo, type SessionLog, type SessionPoolEntry, type Severity, type ShareLink, type ShortestPathResult, type SignedUrlResponse, type SocialPolicyAction, type SocialPolicyBatchDecisionItem, type SocialPolicyBatchDecisionRequest, type SocialPolicyBatchDecisionResponse, type SocialPolicyBatchDecisionTarget, type SocialPolicyBlockRequest, type SocialPolicyContactRequest, type SocialPolicyContactRequestListItem, type SocialPolicyContactRequestQuery, type SocialPolicyContactRequestRequest, type SocialPolicyContext, type SocialPolicyDecision, type SocialPolicyDecisionLimits, type SocialPolicyDecisionRequest, type SocialPolicyDecisionResponse, type SocialPolicyIdentity, type SocialPolicyIdentityType, type SocialPolicyMuteRequest, type SocialPolicyPolicyPack, type SocialPolicyRelationship, type SocialPolicyRelationshipQuery, type SocialPolicyRelationshipRequest, type SocialPolicyReportRequest, SocialPolicyService, type SocialPolicySettings, type SocialPolicyUnblockRequest, type SocialPolicyUpdateSettingsRequest, type SocialPost, SocialService, type SocialUser, type SsoConfig, type StatusCallback, type StorageAdapter, StorageService, type StorageSettings, type StrategyResult, type StylePreset, type SubmitResult, type Subscription, type TargetingRule, type Task, type TaskAttempt, type TaskTransition, type Team, type TeamInvitation, type TeamMember, TeamsService, type TelemetryPayload, type Tool, type ToolCapability, type ToolIntegration, type TopEvent, type TotpSetup, type Transaction, type TransactionListParams, type TransactionSummary, type TransactionSummaryParams, type Transfer, type TransformOptions, type TransformResult, type TraversalResult, type TtsAccessMode, type TtsAudioInfo, type TtsJobStatus, type TtsListVoicesParams, TtsService, type TtsSpeechMetadata, type TtsSpeechProfile, type TtsSynthesizeParams, type TtsSynthesizeQueuedResult, type TtsSynthesizeReadyResult, type TtsSynthesizeResult, type TtsVoice, type TtsVoicesResponse, type UnreadCountResponse, type UpdateFlagRequest, type UpdateRuleRequest, type UpdateSegmentRequest, type UpdateVariantRequest, type UploadCompleteResponse, type UploadEngineConfig, type UploadFailureReport, type UploadFailureReportResponse, type UploadOptions, type UploadPlan, UploadResumeStore, type UploadStrategy, UploadTelemetry, type UploadTelemetryConfig, type UploadTelemetryEvent, type UpsertEnvironmentRequest, type UsageRecord, type UsageSummary$1 as UsageSummary, type UserRank, type VideoInfo, VideoService, type VideoUploadOptions, type VoteState, WEB_PUSH_SERVICE_WORKER, WebPushManager, type WebPushManagerOptions, type WebPushSubscriptionData, type Webhook, WebhooksService, type WebrtcStats, type Workflow, type WorkflowExecution, type Workspace$1 as Workspace, type WorkspaceInvitation, type WorkspaceMember, WorkspacesService, buildClientContextHeaders, calculateTotalParts, canPerform, createUploadPlan, ScaleMule as default, detectNetworkClass, ensureAnonymousId, extractClientContext, generateAnonymousId, generateUploadSessionId, getMeasuredBandwidthMbps, getPartRange, hasMinRoleLevel, readAnonymousId, resolveStrategy, uploadMultipartToS3, uploadSingleToS3, validateIP };
|
package/dist/index.js
CHANGED
|
@@ -321,6 +321,7 @@ __export(index_exports, {
|
|
|
321
321
|
IdentityService: () => IdentityService,
|
|
322
322
|
LEGACY_ANONYMOUS_ID_KEYS: () => LEGACY_ANONYMOUS_ID_KEYS,
|
|
323
323
|
LeaderboardService: () => LeaderboardService,
|
|
324
|
+
LeadsService: () => LeadsService,
|
|
324
325
|
ListingsService: () => ListingsService,
|
|
325
326
|
LoggerService: () => LoggerService,
|
|
326
327
|
MEDIA_PRESETS: () => MEDIA_PRESETS,
|
|
@@ -5297,6 +5298,43 @@ var ReferralsService = class extends ServiceModule {
|
|
|
5297
5298
|
}
|
|
5298
5299
|
};
|
|
5299
5300
|
|
|
5301
|
+
// src/services/leads.ts
|
|
5302
|
+
var LeadsService = class extends ServiceModule {
|
|
5303
|
+
constructor() {
|
|
5304
|
+
super(...arguments);
|
|
5305
|
+
this.basePath = "/v1/leads";
|
|
5306
|
+
}
|
|
5307
|
+
/**
|
|
5308
|
+
* Submit a sales lead. Enterprise-form extras and the plan context are folded
|
|
5309
|
+
* into `metadata` (the leads table has no native company/employees columns).
|
|
5310
|
+
*/
|
|
5311
|
+
async create(input, options) {
|
|
5312
|
+
const metadata = {
|
|
5313
|
+
...input.metadata ?? {},
|
|
5314
|
+
...input.message ? { message: input.message } : {},
|
|
5315
|
+
...input.company ? { company: input.company } : {},
|
|
5316
|
+
...input.jobTitle ? { job_title: input.jobTitle } : {},
|
|
5317
|
+
...input.employees ? { employees: input.employees } : {},
|
|
5318
|
+
...input.country ? { country: input.country } : {},
|
|
5319
|
+
...input.planId ? { plan_id: input.planId } : {},
|
|
5320
|
+
...input.planName ? { plan_name: input.planName } : {}
|
|
5321
|
+
};
|
|
5322
|
+
const body = {
|
|
5323
|
+
contact_name: input.contactName,
|
|
5324
|
+
contact_email: input.contactEmail,
|
|
5325
|
+
contact_phone: input.contactPhone,
|
|
5326
|
+
service_category: input.serviceCategory ?? "sales_inquiry",
|
|
5327
|
+
lead_source: input.leadSource ?? "form",
|
|
5328
|
+
utm_source: input.utmSource,
|
|
5329
|
+
utm_medium: input.utmMedium,
|
|
5330
|
+
utm_campaign: input.utmCampaign,
|
|
5331
|
+
// Backend stores metadata as a JSON string (matches admin client shape).
|
|
5332
|
+
metadata: JSON.stringify(metadata)
|
|
5333
|
+
};
|
|
5334
|
+
return this.post("", body, options);
|
|
5335
|
+
}
|
|
5336
|
+
};
|
|
5337
|
+
|
|
5300
5338
|
// src/services/billing.ts
|
|
5301
5339
|
var BillingService = class extends ServiceModule {
|
|
5302
5340
|
constructor() {
|
|
@@ -8578,6 +8616,7 @@ var ScaleMule = class {
|
|
|
8578
8616
|
this.socialPolicy = new SocialPolicyService(this._client);
|
|
8579
8617
|
this.referrals = new ReferralsService(this._client);
|
|
8580
8618
|
this.billing = new BillingService(this._client);
|
|
8619
|
+
this.leads = new LeadsService(this._client);
|
|
8581
8620
|
this.analytics = new AnalyticsService(this._client);
|
|
8582
8621
|
this.flags = new FlagsService(this._client);
|
|
8583
8622
|
this.communication = new CommunicationService(this._client);
|
|
@@ -8765,6 +8804,7 @@ var index_default = ScaleMule;
|
|
|
8765
8804
|
IdentityService,
|
|
8766
8805
|
LEGACY_ANONYMOUS_ID_KEYS,
|
|
8767
8806
|
LeaderboardService,
|
|
8807
|
+
LeadsService,
|
|
8768
8808
|
ListingsService,
|
|
8769
8809
|
LoggerService,
|
|
8770
8810
|
MEDIA_PRESETS,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,282 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __esm = (fn, res) => function __init() {
|
|
4
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
+
};
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/services/upload-resume.ts
|
|
12
|
+
var upload_resume_exports = {};
|
|
13
|
+
__export(upload_resume_exports, {
|
|
14
|
+
UploadResumeStore: () => UploadResumeStore
|
|
15
|
+
});
|
|
16
|
+
var DB_NAME, STORE_NAME, DB_VERSION, MAX_AGE_MS, UploadResumeStore;
|
|
17
|
+
var init_upload_resume = __esm({
|
|
18
|
+
"src/services/upload-resume.ts"() {
|
|
19
|
+
"use strict";
|
|
20
|
+
DB_NAME = "sm_upload_sessions_v1";
|
|
21
|
+
STORE_NAME = "sessions";
|
|
22
|
+
DB_VERSION = 1;
|
|
23
|
+
MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
24
|
+
UploadResumeStore = class {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.db = null;
|
|
27
|
+
}
|
|
28
|
+
/** Generate a deterministic resume key from upload identity */
|
|
29
|
+
static async generateResumeKey(appId, userId, filename, size, lastModified) {
|
|
30
|
+
const raw = `${appId}:${userId}:${filename}:${size}:${lastModified ?? 0}`;
|
|
31
|
+
if (typeof crypto !== "undefined" && crypto.subtle) {
|
|
32
|
+
const buffer = new TextEncoder().encode(raw);
|
|
33
|
+
const hash2 = await crypto.subtle.digest("SHA-256", buffer);
|
|
34
|
+
return Array.from(new Uint8Array(hash2)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
35
|
+
}
|
|
36
|
+
let hash = 0;
|
|
37
|
+
for (let i = 0; i < raw.length; i++) {
|
|
38
|
+
const chr = raw.charCodeAt(i);
|
|
39
|
+
hash = (hash << 5) - hash + chr;
|
|
40
|
+
hash |= 0;
|
|
41
|
+
}
|
|
42
|
+
return `fallback_${Math.abs(hash).toString(36)}`;
|
|
43
|
+
}
|
|
44
|
+
/** Open the IndexedDB store. No-ops if IndexedDB is unavailable. */
|
|
45
|
+
async open() {
|
|
46
|
+
if (typeof indexedDB === "undefined") return;
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
49
|
+
request.onupgradeneeded = () => {
|
|
50
|
+
const db = request.result;
|
|
51
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
52
|
+
const store = db.createObjectStore(STORE_NAME, { keyPath: "key" });
|
|
53
|
+
store.createIndex("updated_at", "updated_at");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
request.onsuccess = () => {
|
|
57
|
+
this.db = request.result;
|
|
58
|
+
resolve();
|
|
59
|
+
};
|
|
60
|
+
request.onerror = () => {
|
|
61
|
+
reject(request.error);
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Get a resume session by key. Returns null if not found or stale. */
|
|
66
|
+
async get(key) {
|
|
67
|
+
if (!this.db) return null;
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
const tx = this.db.transaction(STORE_NAME, "readonly");
|
|
70
|
+
const store = tx.objectStore(STORE_NAME);
|
|
71
|
+
const request = store.get(key);
|
|
72
|
+
request.onsuccess = () => {
|
|
73
|
+
const entry = request.result;
|
|
74
|
+
if (!entry) {
|
|
75
|
+
resolve(null);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (Date.now() - entry.updated_at > MAX_AGE_MS) {
|
|
79
|
+
this.remove(key).catch(() => {
|
|
80
|
+
});
|
|
81
|
+
resolve(null);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
resolve(entry.session);
|
|
85
|
+
};
|
|
86
|
+
request.onerror = () => resolve(null);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** Save a new resume session. */
|
|
90
|
+
async save(key, session) {
|
|
91
|
+
if (!this.db) return;
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
94
|
+
const store = tx.objectStore(STORE_NAME);
|
|
95
|
+
const entry = {
|
|
96
|
+
key,
|
|
97
|
+
session: { ...session, created_at: Date.now() },
|
|
98
|
+
updated_at: Date.now()
|
|
99
|
+
};
|
|
100
|
+
const request = store.put(entry);
|
|
101
|
+
request.onsuccess = () => resolve();
|
|
102
|
+
request.onerror = () => reject(request.error);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** Update a single completed part in an existing session. */
|
|
106
|
+
async updatePart(key, partNumber, etag) {
|
|
107
|
+
if (!this.db) return;
|
|
108
|
+
return new Promise((resolve) => {
|
|
109
|
+
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
110
|
+
const store = tx.objectStore(STORE_NAME);
|
|
111
|
+
const getRequest = store.get(key);
|
|
112
|
+
getRequest.onsuccess = () => {
|
|
113
|
+
const entry = getRequest.result;
|
|
114
|
+
if (!entry) {
|
|
115
|
+
resolve();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const existing = entry.session.completed_parts.find((p) => p.part_number === partNumber);
|
|
119
|
+
if (!existing) {
|
|
120
|
+
entry.session.completed_parts.push({ part_number: partNumber, etag });
|
|
121
|
+
}
|
|
122
|
+
entry.updated_at = Date.now();
|
|
123
|
+
const putRequest = store.put(entry);
|
|
124
|
+
putRequest.onsuccess = () => resolve();
|
|
125
|
+
putRequest.onerror = () => resolve();
|
|
126
|
+
};
|
|
127
|
+
getRequest.onerror = () => resolve();
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/** Remove a resume session (e.g., after successful completion). */
|
|
131
|
+
async remove(key) {
|
|
132
|
+
if (!this.db) return;
|
|
133
|
+
return new Promise((resolve) => {
|
|
134
|
+
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
135
|
+
const store = tx.objectStore(STORE_NAME);
|
|
136
|
+
const request = store.delete(key);
|
|
137
|
+
request.onsuccess = () => resolve();
|
|
138
|
+
request.onerror = () => resolve();
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/** Purge all stale entries (older than MAX_AGE_MS). */
|
|
142
|
+
async purgeStale() {
|
|
143
|
+
if (!this.db) return 0;
|
|
144
|
+
return new Promise((resolve) => {
|
|
145
|
+
const cutoff = Date.now() - MAX_AGE_MS;
|
|
146
|
+
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
147
|
+
const store = tx.objectStore(STORE_NAME);
|
|
148
|
+
const index = store.index("updated_at");
|
|
149
|
+
const range = IDBKeyRange.upperBound(cutoff);
|
|
150
|
+
const request = index.openCursor(range);
|
|
151
|
+
let count = 0;
|
|
152
|
+
request.onsuccess = () => {
|
|
153
|
+
const cursor = request.result;
|
|
154
|
+
if (cursor) {
|
|
155
|
+
cursor.delete();
|
|
156
|
+
count++;
|
|
157
|
+
cursor.continue();
|
|
158
|
+
} else {
|
|
159
|
+
resolve(count);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
request.onerror = () => resolve(0);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** Close the database connection. */
|
|
166
|
+
close() {
|
|
167
|
+
if (this.db) {
|
|
168
|
+
this.db.close();
|
|
169
|
+
this.db = null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// src/services/upload-compression.ts
|
|
177
|
+
var upload_compression_exports = {};
|
|
178
|
+
__export(upload_compression_exports, {
|
|
179
|
+
maybeCompressImage: () => maybeCompressImage
|
|
180
|
+
});
|
|
181
|
+
async function maybeCompressImage(file, userConfig, sessionId, telemetry) {
|
|
182
|
+
const type = file.type?.toLowerCase() || "";
|
|
183
|
+
if (!type.startsWith("image/")) return null;
|
|
184
|
+
if (SKIP_TYPES.has(type)) {
|
|
185
|
+
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "format", type });
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
if (!COMPRESSIBLE_TYPES.has(type)) {
|
|
189
|
+
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "unsupported_type", type });
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
if (file.size < MIN_COMPRESS_SIZE) {
|
|
193
|
+
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "too_small", size: file.size });
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const networkType = getNetworkEffectiveType();
|
|
197
|
+
const defaultProfile = { maxWidth: 3840, maxHeight: 3840, quality: 0.85, maxSizeMB: 5 };
|
|
198
|
+
const networkProfile = NETWORK_PROFILES[networkType] ?? defaultProfile;
|
|
199
|
+
const config = {
|
|
200
|
+
maxWidth: userConfig?.maxWidth ?? networkProfile.maxWidth,
|
|
201
|
+
maxHeight: userConfig?.maxHeight ?? networkProfile.maxHeight,
|
|
202
|
+
quality: userConfig?.quality ?? networkProfile.quality,
|
|
203
|
+
maxSizeMB: userConfig?.maxSizeMB ?? networkProfile.maxSizeMB
|
|
204
|
+
};
|
|
205
|
+
telemetry?.emit(sessionId, "upload.compression.started", {
|
|
206
|
+
original_size: file.size,
|
|
207
|
+
network: networkType,
|
|
208
|
+
target_quality: config.quality
|
|
209
|
+
});
|
|
210
|
+
try {
|
|
211
|
+
const imageCompression = await loadImageCompression();
|
|
212
|
+
if (!imageCompression) {
|
|
213
|
+
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "library_unavailable" });
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
const compressed = await imageCompression(file, {
|
|
217
|
+
maxSizeMB: config.maxSizeMB,
|
|
218
|
+
maxWidthOrHeight: Math.max(config.maxWidth, config.maxHeight),
|
|
219
|
+
initialQuality: config.quality,
|
|
220
|
+
useWebWorker: true,
|
|
221
|
+
fileType: type === "image/png" ? "image/webp" : void 0
|
|
222
|
+
});
|
|
223
|
+
if (compressed.size >= file.size * 0.95) {
|
|
224
|
+
telemetry?.emit(sessionId, "upload.compression.skipped", {
|
|
225
|
+
reason: "no_size_reduction",
|
|
226
|
+
original_size: file.size,
|
|
227
|
+
compressed_size: compressed.size
|
|
228
|
+
});
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
telemetry?.emit(sessionId, "upload.compression.completed", {
|
|
232
|
+
original_size: file.size,
|
|
233
|
+
compressed_size: compressed.size,
|
|
234
|
+
ratio: (compressed.size / file.size).toFixed(2)
|
|
235
|
+
});
|
|
236
|
+
return compressed;
|
|
237
|
+
} catch (err) {
|
|
238
|
+
telemetry?.emit(sessionId, "upload.compression.skipped", {
|
|
239
|
+
reason: "error",
|
|
240
|
+
error: err instanceof Error ? err.message : "Unknown compression error"
|
|
241
|
+
});
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async function loadImageCompression() {
|
|
246
|
+
if (cachedImport === false) return null;
|
|
247
|
+
if (cachedImport) return cachedImport;
|
|
248
|
+
try {
|
|
249
|
+
const mod = await Function('return import("browser-image-compression")')();
|
|
250
|
+
cachedImport = mod.default || mod;
|
|
251
|
+
return cachedImport;
|
|
252
|
+
} catch {
|
|
253
|
+
cachedImport = false;
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function getNetworkEffectiveType() {
|
|
258
|
+
if (typeof navigator !== "undefined" && "connection" in navigator) {
|
|
259
|
+
const conn = navigator.connection;
|
|
260
|
+
return conn?.effectiveType || "4g";
|
|
261
|
+
}
|
|
262
|
+
return "4g";
|
|
263
|
+
}
|
|
264
|
+
var MIN_COMPRESS_SIZE, COMPRESSIBLE_TYPES, SKIP_TYPES, NETWORK_PROFILES, cachedImport;
|
|
265
|
+
var init_upload_compression = __esm({
|
|
266
|
+
"src/services/upload-compression.ts"() {
|
|
267
|
+
"use strict";
|
|
268
|
+
MIN_COMPRESS_SIZE = 100 * 1024;
|
|
269
|
+
COMPRESSIBLE_TYPES = /* @__PURE__ */ new Set(["image/jpeg", "image/jpg", "image/png", "image/bmp", "image/tiff"]);
|
|
270
|
+
SKIP_TYPES = /* @__PURE__ */ new Set(["image/gif", "image/svg+xml", "image/webp", "image/avif"]);
|
|
271
|
+
NETWORK_PROFILES = {
|
|
272
|
+
"slow-2g": { maxWidth: 1280, maxHeight: 1280, quality: 0.6, maxSizeMB: 0.5 },
|
|
273
|
+
"2g": { maxWidth: 1600, maxHeight: 1600, quality: 0.65, maxSizeMB: 1 },
|
|
274
|
+
"3g": { maxWidth: 2048, maxHeight: 2048, quality: 0.75, maxSizeMB: 2 },
|
|
275
|
+
"4g": { maxWidth: 3840, maxHeight: 3840, quality: 0.85, maxSizeMB: 5 }
|
|
276
|
+
};
|
|
277
|
+
cachedImport = null;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
4
280
|
|
|
5
281
|
// src/types.ts
|
|
6
282
|
var ErrorCodes = {
|
|
@@ -2128,7 +2404,7 @@ var StorageService = class extends ServiceModule {
|
|
|
2128
2404
|
size_bytes: file.size,
|
|
2129
2405
|
content_type: file.type,
|
|
2130
2406
|
strategy: this.shouldUseMultipart(file, options) ? "multipart" : "direct",
|
|
2131
|
-
network_type:
|
|
2407
|
+
network_type: getNetworkEffectiveType2()
|
|
2132
2408
|
});
|
|
2133
2409
|
try {
|
|
2134
2410
|
let uploadFile = file;
|
|
@@ -2344,7 +2620,7 @@ var StorageService = class extends ServiceModule {
|
|
|
2344
2620
|
let resumeData = null;
|
|
2345
2621
|
if (options?.resume !== "off" && typeof window !== "undefined") {
|
|
2346
2622
|
try {
|
|
2347
|
-
const { UploadResumeStore: UploadResumeStore2 } = await
|
|
2623
|
+
const { UploadResumeStore: UploadResumeStore2 } = await Promise.resolve().then(() => (init_upload_resume(), upload_resume_exports));
|
|
2348
2624
|
resumeStore = new UploadResumeStore2();
|
|
2349
2625
|
await resumeStore.open();
|
|
2350
2626
|
const resumeKey = await UploadResumeStore2.generateResumeKey(
|
|
@@ -2392,7 +2668,7 @@ var StorageService = class extends ServiceModule {
|
|
|
2392
2668
|
} else {
|
|
2393
2669
|
let clientUploadKey;
|
|
2394
2670
|
try {
|
|
2395
|
-
const { UploadResumeStore: UploadResumeStore2 } = await
|
|
2671
|
+
const { UploadResumeStore: UploadResumeStore2 } = await Promise.resolve().then(() => (init_upload_resume(), upload_resume_exports));
|
|
2396
2672
|
clientUploadKey = await UploadResumeStore2.generateResumeKey(
|
|
2397
2673
|
this.client.getApiKey?.() || "",
|
|
2398
2674
|
this.client.getUserId?.() || "",
|
|
@@ -2425,7 +2701,7 @@ var StorageService = class extends ServiceModule {
|
|
|
2425
2701
|
const { upload_session_id, file_id, part_size_bytes, total_parts } = startData;
|
|
2426
2702
|
if (resumeStore && !resumeData) {
|
|
2427
2703
|
try {
|
|
2428
|
-
const { UploadResumeStore: UploadResumeStore2 } = await
|
|
2704
|
+
const { UploadResumeStore: UploadResumeStore2 } = await Promise.resolve().then(() => (init_upload_resume(), upload_resume_exports));
|
|
2429
2705
|
const resumeKey = await UploadResumeStore2.generateResumeKey(
|
|
2430
2706
|
this.client.getApiKey?.() || "",
|
|
2431
2707
|
this.client.getUserId?.() || "",
|
|
@@ -2576,7 +2852,7 @@ var StorageService = class extends ServiceModule {
|
|
|
2576
2852
|
telemetry?.emit(sessionId, "upload.multipart.part_completed", { part_number: result.partNum });
|
|
2577
2853
|
if (resumeStore) {
|
|
2578
2854
|
try {
|
|
2579
|
-
const { UploadResumeStore: UploadResumeStore2 } = await
|
|
2855
|
+
const { UploadResumeStore: UploadResumeStore2 } = await Promise.resolve().then(() => (init_upload_resume(), upload_resume_exports));
|
|
2580
2856
|
const resumeKey = await UploadResumeStore2.generateResumeKey(
|
|
2581
2857
|
this.client.getApiKey?.() || "",
|
|
2582
2858
|
this.client.getUserId?.() || "",
|
|
@@ -2628,7 +2904,7 @@ var StorageService = class extends ServiceModule {
|
|
|
2628
2904
|
);
|
|
2629
2905
|
if (resumeStore) {
|
|
2630
2906
|
try {
|
|
2631
|
-
const { UploadResumeStore: UploadResumeStore2 } = await
|
|
2907
|
+
const { UploadResumeStore: UploadResumeStore2 } = await Promise.resolve().then(() => (init_upload_resume(), upload_resume_exports));
|
|
2632
2908
|
const resumeKey = await UploadResumeStore2.generateResumeKey(
|
|
2633
2909
|
this.client.getApiKey?.() || "",
|
|
2634
2910
|
this.client.getUserId?.() || "",
|
|
@@ -3267,21 +3543,21 @@ var StorageService = class extends ServiceModule {
|
|
|
3267
3543
|
}
|
|
3268
3544
|
defaultChunkSize(fileSize) {
|
|
3269
3545
|
if (fileSize > 512 * 1024 * 1024) return 16 * 1024 * 1024;
|
|
3270
|
-
const effectiveType =
|
|
3546
|
+
const effectiveType = getNetworkEffectiveType2();
|
|
3271
3547
|
if (effectiveType === "slow-2g" || effectiveType === "2g") return 5 * 1024 * 1024;
|
|
3272
3548
|
if (effectiveType === "3g") return 5 * 1024 * 1024;
|
|
3273
3549
|
return 8 * 1024 * 1024;
|
|
3274
3550
|
}
|
|
3275
3551
|
defaultConcurrency() {
|
|
3276
|
-
const effectiveType =
|
|
3552
|
+
const effectiveType = getNetworkEffectiveType2();
|
|
3277
3553
|
if (effectiveType === "slow-2g" || effectiveType === "2g") return 1;
|
|
3278
3554
|
if (effectiveType === "3g") return 2;
|
|
3279
3555
|
return 4;
|
|
3280
3556
|
}
|
|
3281
3557
|
async maybeCompress(file, config, sessionId, telemetry) {
|
|
3282
3558
|
try {
|
|
3283
|
-
const { maybeCompressImage } = await
|
|
3284
|
-
return await
|
|
3559
|
+
const { maybeCompressImage: maybeCompressImage2 } = await Promise.resolve().then(() => (init_upload_compression(), upload_compression_exports));
|
|
3560
|
+
return await maybeCompressImage2(file, config, sessionId, telemetry);
|
|
3285
3561
|
} catch {
|
|
3286
3562
|
return null;
|
|
3287
3563
|
}
|
|
@@ -3321,10 +3597,10 @@ function getStallTimeout() {
|
|
|
3321
3597
|
return isSlowNetwork() ? SLOW_NETWORK_STALL_TIMEOUT_MS : DEFAULT_STALL_TIMEOUT_MS;
|
|
3322
3598
|
}
|
|
3323
3599
|
function isSlowNetwork() {
|
|
3324
|
-
const effectiveType =
|
|
3600
|
+
const effectiveType = getNetworkEffectiveType2();
|
|
3325
3601
|
return effectiveType === "slow-2g" || effectiveType === "2g" || effectiveType === "3g";
|
|
3326
3602
|
}
|
|
3327
|
-
function
|
|
3603
|
+
function getNetworkEffectiveType2() {
|
|
3328
3604
|
if (typeof navigator !== "undefined" && "connection" in navigator) {
|
|
3329
3605
|
const conn = navigator.connection;
|
|
3330
3606
|
return conn?.effectiveType || "4g";
|
|
@@ -3337,7 +3613,7 @@ function getOnlineStatus() {
|
|
|
3337
3613
|
}
|
|
3338
3614
|
function getUploadEnvironmentDiagnostics() {
|
|
3339
3615
|
const diagnostics = {
|
|
3340
|
-
network_type:
|
|
3616
|
+
network_type: getNetworkEffectiveType2(),
|
|
3341
3617
|
online: getOnlineStatus()
|
|
3342
3618
|
};
|
|
3343
3619
|
if (typeof navigator !== "undefined") {
|
|
@@ -3369,6 +3645,9 @@ function extractS3ErrorCode(body) {
|
|
|
3369
3645
|
return m ? m[1] : void 0;
|
|
3370
3646
|
}
|
|
3371
3647
|
|
|
3648
|
+
// src/index.ts
|
|
3649
|
+
init_upload_resume();
|
|
3650
|
+
|
|
3372
3651
|
// src/services/upload-strategy.ts
|
|
3373
3652
|
var MULTIPART_THRESHOLD2 = 8 * 1024 * 1024;
|
|
3374
3653
|
var MULTIPART_THRESHOLD_SLOW2 = 1 * 1024 * 1024;
|
|
@@ -4915,6 +5194,43 @@ var ReferralsService = class extends ServiceModule {
|
|
|
4915
5194
|
}
|
|
4916
5195
|
};
|
|
4917
5196
|
|
|
5197
|
+
// src/services/leads.ts
|
|
5198
|
+
var LeadsService = class extends ServiceModule {
|
|
5199
|
+
constructor() {
|
|
5200
|
+
super(...arguments);
|
|
5201
|
+
this.basePath = "/v1/leads";
|
|
5202
|
+
}
|
|
5203
|
+
/**
|
|
5204
|
+
* Submit a sales lead. Enterprise-form extras and the plan context are folded
|
|
5205
|
+
* into `metadata` (the leads table has no native company/employees columns).
|
|
5206
|
+
*/
|
|
5207
|
+
async create(input, options) {
|
|
5208
|
+
const metadata = {
|
|
5209
|
+
...input.metadata ?? {},
|
|
5210
|
+
...input.message ? { message: input.message } : {},
|
|
5211
|
+
...input.company ? { company: input.company } : {},
|
|
5212
|
+
...input.jobTitle ? { job_title: input.jobTitle } : {},
|
|
5213
|
+
...input.employees ? { employees: input.employees } : {},
|
|
5214
|
+
...input.country ? { country: input.country } : {},
|
|
5215
|
+
...input.planId ? { plan_id: input.planId } : {},
|
|
5216
|
+
...input.planName ? { plan_name: input.planName } : {}
|
|
5217
|
+
};
|
|
5218
|
+
const body = {
|
|
5219
|
+
contact_name: input.contactName,
|
|
5220
|
+
contact_email: input.contactEmail,
|
|
5221
|
+
contact_phone: input.contactPhone,
|
|
5222
|
+
service_category: input.serviceCategory ?? "sales_inquiry",
|
|
5223
|
+
lead_source: input.leadSource ?? "form",
|
|
5224
|
+
utm_source: input.utmSource,
|
|
5225
|
+
utm_medium: input.utmMedium,
|
|
5226
|
+
utm_campaign: input.utmCampaign,
|
|
5227
|
+
// Backend stores metadata as a JSON string (matches admin client shape).
|
|
5228
|
+
metadata: JSON.stringify(metadata)
|
|
5229
|
+
};
|
|
5230
|
+
return this.post("", body, options);
|
|
5231
|
+
}
|
|
5232
|
+
};
|
|
5233
|
+
|
|
4918
5234
|
// src/services/billing.ts
|
|
4919
5235
|
var BillingService = class extends ServiceModule {
|
|
4920
5236
|
constructor() {
|
|
@@ -8196,6 +8512,7 @@ var ScaleMule = class {
|
|
|
8196
8512
|
this.socialPolicy = new SocialPolicyService(this._client);
|
|
8197
8513
|
this.referrals = new ReferralsService(this._client);
|
|
8198
8514
|
this.billing = new BillingService(this._client);
|
|
8515
|
+
this.leads = new LeadsService(this._client);
|
|
8199
8516
|
this.analytics = new AnalyticsService(this._client);
|
|
8200
8517
|
this.flags = new FlagsService(this._client);
|
|
8201
8518
|
this.communication = new CommunicationService(this._client);
|
|
@@ -8382,6 +8699,7 @@ export {
|
|
|
8382
8699
|
IdentityService,
|
|
8383
8700
|
LEGACY_ANONYMOUS_ID_KEYS,
|
|
8384
8701
|
LeaderboardService,
|
|
8702
|
+
LeadsService,
|
|
8385
8703
|
ListingsService,
|
|
8386
8704
|
LoggerService,
|
|
8387
8705
|
MEDIA_PRESETS,
|
package/package.json
CHANGED
package/dist/chunk-3FTGBRLU.mjs
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
// src/services/upload-resume.ts
|
|
2
|
-
var DB_NAME = "sm_upload_sessions_v1";
|
|
3
|
-
var STORE_NAME = "sessions";
|
|
4
|
-
var DB_VERSION = 1;
|
|
5
|
-
var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
6
|
-
var UploadResumeStore = class {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.db = null;
|
|
9
|
-
}
|
|
10
|
-
/** Generate a deterministic resume key from upload identity */
|
|
11
|
-
static async generateResumeKey(appId, userId, filename, size, lastModified) {
|
|
12
|
-
const raw = `${appId}:${userId}:${filename}:${size}:${lastModified ?? 0}`;
|
|
13
|
-
if (typeof crypto !== "undefined" && crypto.subtle) {
|
|
14
|
-
const buffer = new TextEncoder().encode(raw);
|
|
15
|
-
const hash2 = await crypto.subtle.digest("SHA-256", buffer);
|
|
16
|
-
return Array.from(new Uint8Array(hash2)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
17
|
-
}
|
|
18
|
-
let hash = 0;
|
|
19
|
-
for (let i = 0; i < raw.length; i++) {
|
|
20
|
-
const chr = raw.charCodeAt(i);
|
|
21
|
-
hash = (hash << 5) - hash + chr;
|
|
22
|
-
hash |= 0;
|
|
23
|
-
}
|
|
24
|
-
return `fallback_${Math.abs(hash).toString(36)}`;
|
|
25
|
-
}
|
|
26
|
-
/** Open the IndexedDB store. No-ops if IndexedDB is unavailable. */
|
|
27
|
-
async open() {
|
|
28
|
-
if (typeof indexedDB === "undefined") return;
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
31
|
-
request.onupgradeneeded = () => {
|
|
32
|
-
const db = request.result;
|
|
33
|
-
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
34
|
-
const store = db.createObjectStore(STORE_NAME, { keyPath: "key" });
|
|
35
|
-
store.createIndex("updated_at", "updated_at");
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
request.onsuccess = () => {
|
|
39
|
-
this.db = request.result;
|
|
40
|
-
resolve();
|
|
41
|
-
};
|
|
42
|
-
request.onerror = () => {
|
|
43
|
-
reject(request.error);
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/** Get a resume session by key. Returns null if not found or stale. */
|
|
48
|
-
async get(key) {
|
|
49
|
-
if (!this.db) return null;
|
|
50
|
-
return new Promise((resolve) => {
|
|
51
|
-
const tx = this.db.transaction(STORE_NAME, "readonly");
|
|
52
|
-
const store = tx.objectStore(STORE_NAME);
|
|
53
|
-
const request = store.get(key);
|
|
54
|
-
request.onsuccess = () => {
|
|
55
|
-
const entry = request.result;
|
|
56
|
-
if (!entry) {
|
|
57
|
-
resolve(null);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (Date.now() - entry.updated_at > MAX_AGE_MS) {
|
|
61
|
-
this.remove(key).catch(() => {
|
|
62
|
-
});
|
|
63
|
-
resolve(null);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
resolve(entry.session);
|
|
67
|
-
};
|
|
68
|
-
request.onerror = () => resolve(null);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/** Save a new resume session. */
|
|
72
|
-
async save(key, session) {
|
|
73
|
-
if (!this.db) return;
|
|
74
|
-
return new Promise((resolve, reject) => {
|
|
75
|
-
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
76
|
-
const store = tx.objectStore(STORE_NAME);
|
|
77
|
-
const entry = {
|
|
78
|
-
key,
|
|
79
|
-
session: { ...session, created_at: Date.now() },
|
|
80
|
-
updated_at: Date.now()
|
|
81
|
-
};
|
|
82
|
-
const request = store.put(entry);
|
|
83
|
-
request.onsuccess = () => resolve();
|
|
84
|
-
request.onerror = () => reject(request.error);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/** Update a single completed part in an existing session. */
|
|
88
|
-
async updatePart(key, partNumber, etag) {
|
|
89
|
-
if (!this.db) return;
|
|
90
|
-
return new Promise((resolve) => {
|
|
91
|
-
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
92
|
-
const store = tx.objectStore(STORE_NAME);
|
|
93
|
-
const getRequest = store.get(key);
|
|
94
|
-
getRequest.onsuccess = () => {
|
|
95
|
-
const entry = getRequest.result;
|
|
96
|
-
if (!entry) {
|
|
97
|
-
resolve();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const existing = entry.session.completed_parts.find((p) => p.part_number === partNumber);
|
|
101
|
-
if (!existing) {
|
|
102
|
-
entry.session.completed_parts.push({ part_number: partNumber, etag });
|
|
103
|
-
}
|
|
104
|
-
entry.updated_at = Date.now();
|
|
105
|
-
const putRequest = store.put(entry);
|
|
106
|
-
putRequest.onsuccess = () => resolve();
|
|
107
|
-
putRequest.onerror = () => resolve();
|
|
108
|
-
};
|
|
109
|
-
getRequest.onerror = () => resolve();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/** Remove a resume session (e.g., after successful completion). */
|
|
113
|
-
async remove(key) {
|
|
114
|
-
if (!this.db) return;
|
|
115
|
-
return new Promise((resolve) => {
|
|
116
|
-
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
117
|
-
const store = tx.objectStore(STORE_NAME);
|
|
118
|
-
const request = store.delete(key);
|
|
119
|
-
request.onsuccess = () => resolve();
|
|
120
|
-
request.onerror = () => resolve();
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/** Purge all stale entries (older than MAX_AGE_MS). */
|
|
124
|
-
async purgeStale() {
|
|
125
|
-
if (!this.db) return 0;
|
|
126
|
-
return new Promise((resolve) => {
|
|
127
|
-
const cutoff = Date.now() - MAX_AGE_MS;
|
|
128
|
-
const tx = this.db.transaction(STORE_NAME, "readwrite");
|
|
129
|
-
const store = tx.objectStore(STORE_NAME);
|
|
130
|
-
const index = store.index("updated_at");
|
|
131
|
-
const range = IDBKeyRange.upperBound(cutoff);
|
|
132
|
-
const request = index.openCursor(range);
|
|
133
|
-
let count = 0;
|
|
134
|
-
request.onsuccess = () => {
|
|
135
|
-
const cursor = request.result;
|
|
136
|
-
if (cursor) {
|
|
137
|
-
cursor.delete();
|
|
138
|
-
count++;
|
|
139
|
-
cursor.continue();
|
|
140
|
-
} else {
|
|
141
|
-
resolve(count);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
request.onerror = () => resolve(0);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/** Close the database connection. */
|
|
148
|
-
close() {
|
|
149
|
-
if (this.db) {
|
|
150
|
-
this.db.close();
|
|
151
|
-
this.db = null;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export {
|
|
157
|
-
UploadResumeStore
|
|
158
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// src/services/upload-compression.ts
|
|
2
|
-
var MIN_COMPRESS_SIZE = 100 * 1024;
|
|
3
|
-
var COMPRESSIBLE_TYPES = /* @__PURE__ */ new Set(["image/jpeg", "image/jpg", "image/png", "image/bmp", "image/tiff"]);
|
|
4
|
-
var SKIP_TYPES = /* @__PURE__ */ new Set(["image/gif", "image/svg+xml", "image/webp", "image/avif"]);
|
|
5
|
-
var NETWORK_PROFILES = {
|
|
6
|
-
"slow-2g": { maxWidth: 1280, maxHeight: 1280, quality: 0.6, maxSizeMB: 0.5 },
|
|
7
|
-
"2g": { maxWidth: 1600, maxHeight: 1600, quality: 0.65, maxSizeMB: 1 },
|
|
8
|
-
"3g": { maxWidth: 2048, maxHeight: 2048, quality: 0.75, maxSizeMB: 2 },
|
|
9
|
-
"4g": { maxWidth: 3840, maxHeight: 3840, quality: 0.85, maxSizeMB: 5 }
|
|
10
|
-
};
|
|
11
|
-
async function maybeCompressImage(file, userConfig, sessionId, telemetry) {
|
|
12
|
-
const type = file.type?.toLowerCase() || "";
|
|
13
|
-
if (!type.startsWith("image/")) return null;
|
|
14
|
-
if (SKIP_TYPES.has(type)) {
|
|
15
|
-
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "format", type });
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
if (!COMPRESSIBLE_TYPES.has(type)) {
|
|
19
|
-
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "unsupported_type", type });
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
if (file.size < MIN_COMPRESS_SIZE) {
|
|
23
|
-
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "too_small", size: file.size });
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const networkType = getNetworkEffectiveType();
|
|
27
|
-
const defaultProfile = { maxWidth: 3840, maxHeight: 3840, quality: 0.85, maxSizeMB: 5 };
|
|
28
|
-
const networkProfile = NETWORK_PROFILES[networkType] ?? defaultProfile;
|
|
29
|
-
const config = {
|
|
30
|
-
maxWidth: userConfig?.maxWidth ?? networkProfile.maxWidth,
|
|
31
|
-
maxHeight: userConfig?.maxHeight ?? networkProfile.maxHeight,
|
|
32
|
-
quality: userConfig?.quality ?? networkProfile.quality,
|
|
33
|
-
maxSizeMB: userConfig?.maxSizeMB ?? networkProfile.maxSizeMB
|
|
34
|
-
};
|
|
35
|
-
telemetry?.emit(sessionId, "upload.compression.started", {
|
|
36
|
-
original_size: file.size,
|
|
37
|
-
network: networkType,
|
|
38
|
-
target_quality: config.quality
|
|
39
|
-
});
|
|
40
|
-
try {
|
|
41
|
-
const imageCompression = await loadImageCompression();
|
|
42
|
-
if (!imageCompression) {
|
|
43
|
-
telemetry?.emit(sessionId, "upload.compression.skipped", { reason: "library_unavailable" });
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
const compressed = await imageCompression(file, {
|
|
47
|
-
maxSizeMB: config.maxSizeMB,
|
|
48
|
-
maxWidthOrHeight: Math.max(config.maxWidth, config.maxHeight),
|
|
49
|
-
initialQuality: config.quality,
|
|
50
|
-
useWebWorker: true,
|
|
51
|
-
fileType: type === "image/png" ? "image/webp" : void 0
|
|
52
|
-
});
|
|
53
|
-
if (compressed.size >= file.size * 0.95) {
|
|
54
|
-
telemetry?.emit(sessionId, "upload.compression.skipped", {
|
|
55
|
-
reason: "no_size_reduction",
|
|
56
|
-
original_size: file.size,
|
|
57
|
-
compressed_size: compressed.size
|
|
58
|
-
});
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
telemetry?.emit(sessionId, "upload.compression.completed", {
|
|
62
|
-
original_size: file.size,
|
|
63
|
-
compressed_size: compressed.size,
|
|
64
|
-
ratio: (compressed.size / file.size).toFixed(2)
|
|
65
|
-
});
|
|
66
|
-
return compressed;
|
|
67
|
-
} catch (err) {
|
|
68
|
-
telemetry?.emit(sessionId, "upload.compression.skipped", {
|
|
69
|
-
reason: "error",
|
|
70
|
-
error: err instanceof Error ? err.message : "Unknown compression error"
|
|
71
|
-
});
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
var cachedImport = null;
|
|
76
|
-
async function loadImageCompression() {
|
|
77
|
-
if (cachedImport === false) return null;
|
|
78
|
-
if (cachedImport) return cachedImport;
|
|
79
|
-
try {
|
|
80
|
-
const mod = await Function('return import("browser-image-compression")')();
|
|
81
|
-
cachedImport = mod.default || mod;
|
|
82
|
-
return cachedImport;
|
|
83
|
-
} catch {
|
|
84
|
-
cachedImport = false;
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function getNetworkEffectiveType() {
|
|
89
|
-
if (typeof navigator !== "undefined" && "connection" in navigator) {
|
|
90
|
-
const conn = navigator.connection;
|
|
91
|
-
return conn?.effectiveType || "4g";
|
|
92
|
-
}
|
|
93
|
-
return "4g";
|
|
94
|
-
}
|
|
95
|
-
export {
|
|
96
|
-
maybeCompressImage
|
|
97
|
-
};
|