@seenn/types 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -322,6 +322,12 @@ interface EtaStats {
322
322
  * Connection mode for real-time updates
323
323
  */
324
324
  type ConnectionMode = 'sse' | 'polling';
325
+ /**
326
+ * iOS push authorization mode
327
+ * - 'standard': Shows permission prompt, full push access
328
+ * - 'provisional': No prompt, quiet notifications only (iOS 12+)
329
+ */
330
+ type PushAuthorizationMode = 'standard' | 'provisional';
325
331
  /**
326
332
  * Base SDK configuration
327
333
  */
@@ -346,6 +352,28 @@ interface SeennConfig {
346
352
  maxReconnectAttempts?: number;
347
353
  /** Enable debug logging (default: false) */
348
354
  debug?: boolean;
355
+ /** iOS push authorization mode (default: 'standard') */
356
+ pushAuthorizationMode?: PushAuthorizationMode;
357
+ }
358
+ /**
359
+ * iOS push authorization status
360
+ * - 'notDetermined': Permission never requested
361
+ * - 'denied': User denied permission
362
+ * - 'authorized': Full push access granted
363
+ * - 'provisional': Quiet notifications only (iOS 12+)
364
+ * - 'ephemeral': App Clips only (iOS 14+)
365
+ */
366
+ type PushAuthorizationStatus = 'notDetermined' | 'denied' | 'authorized' | 'provisional' | 'ephemeral';
367
+ /**
368
+ * Push authorization information
369
+ */
370
+ interface PushAuthorizationInfo {
371
+ /** Current authorization status */
372
+ status: PushAuthorizationStatus;
373
+ /** Whether current authorization is provisional */
374
+ isProvisional: boolean;
375
+ /** Whether user can be prompted to upgrade to full authorization */
376
+ canRequestFullAuthorization: boolean;
349
377
  }
350
378
  /**
351
379
  * Live Activity start parameters
@@ -609,7 +637,7 @@ interface SeennWidgetConfig {
609
637
  /**
610
638
  * SDK version info
611
639
  */
612
- declare const SDK_VERSION = "0.3.0";
640
+ declare const SDK_VERSION = "0.4.0";
613
641
  /**
614
642
  * Minimum API version required
615
643
  */
@@ -619,4 +647,4 @@ declare const MIN_API_VERSION = "1.0.0";
619
647
  */
620
648
  declare const SSE_PROTOCOL_VERSION = "1.0";
621
649
 
622
- export { type ChildJobSummary, type ChildProgressMode, type ChildrenStats, type CompleteJobParams, type ConnectionMode, type ConnectionState, type CreateJobParams, type EtaStats, type FailJobParams, type FontConfig, type FontWeight, type GradientPoint, type InAppMessage, type InAppMessageType, type JobError, type JobResult, type JobStatus, type JobTypeConfig, type LiveActivityCTAButton, type LiveActivityCTAButtonStyle, type LiveActivityCTAConfig, type LiveActivityCTAStyle, type LiveActivityColors, type LiveActivityEndParams, type LiveActivityFonts, type LiveActivityGradient, type LiveActivityLayout, type LiveActivityPushTokenEvent, type LiveActivityResult, type LiveActivityStartParams, type LiveActivityThemeConfig, type LiveActivityThemePreset, type LiveActivityUpdateParams, MIN_API_VERSION, type ParentInfo, type ParentWithChildren, type QueueInfo, SDK_VERSION, type SSEEvent, type SSEEventType, SSE_PROTOCOL_VERSION, type SeennConfig, type SeennJob, type SeennWidgetConfig, type StageInfo, type UpdateJobParams, type WebhookEventType, type WebhookPayload, type WidgetExtensionConfig };
650
+ export { type ChildJobSummary, type ChildProgressMode, type ChildrenStats, type CompleteJobParams, type ConnectionMode, type ConnectionState, type CreateJobParams, type EtaStats, type FailJobParams, type FontConfig, type FontWeight, type GradientPoint, type InAppMessage, type InAppMessageType, type JobError, type JobResult, type JobStatus, type JobTypeConfig, type LiveActivityCTAButton, type LiveActivityCTAButtonStyle, type LiveActivityCTAConfig, type LiveActivityCTAStyle, type LiveActivityColors, type LiveActivityEndParams, type LiveActivityFonts, type LiveActivityGradient, type LiveActivityLayout, type LiveActivityPushTokenEvent, type LiveActivityResult, type LiveActivityStartParams, type LiveActivityThemeConfig, type LiveActivityThemePreset, type LiveActivityUpdateParams, MIN_API_VERSION, type ParentInfo, type ParentWithChildren, type PushAuthorizationInfo, type PushAuthorizationMode, type PushAuthorizationStatus, type QueueInfo, SDK_VERSION, type SSEEvent, type SSEEventType, SSE_PROTOCOL_VERSION, type SeennConfig, type SeennJob, type SeennWidgetConfig, type StageInfo, type UpdateJobParams, type WebhookEventType, type WebhookPayload, type WidgetExtensionConfig };
package/dist/index.d.ts CHANGED
@@ -322,6 +322,12 @@ interface EtaStats {
322
322
  * Connection mode for real-time updates
323
323
  */
324
324
  type ConnectionMode = 'sse' | 'polling';
325
+ /**
326
+ * iOS push authorization mode
327
+ * - 'standard': Shows permission prompt, full push access
328
+ * - 'provisional': No prompt, quiet notifications only (iOS 12+)
329
+ */
330
+ type PushAuthorizationMode = 'standard' | 'provisional';
325
331
  /**
326
332
  * Base SDK configuration
327
333
  */
@@ -346,6 +352,28 @@ interface SeennConfig {
346
352
  maxReconnectAttempts?: number;
347
353
  /** Enable debug logging (default: false) */
348
354
  debug?: boolean;
355
+ /** iOS push authorization mode (default: 'standard') */
356
+ pushAuthorizationMode?: PushAuthorizationMode;
357
+ }
358
+ /**
359
+ * iOS push authorization status
360
+ * - 'notDetermined': Permission never requested
361
+ * - 'denied': User denied permission
362
+ * - 'authorized': Full push access granted
363
+ * - 'provisional': Quiet notifications only (iOS 12+)
364
+ * - 'ephemeral': App Clips only (iOS 14+)
365
+ */
366
+ type PushAuthorizationStatus = 'notDetermined' | 'denied' | 'authorized' | 'provisional' | 'ephemeral';
367
+ /**
368
+ * Push authorization information
369
+ */
370
+ interface PushAuthorizationInfo {
371
+ /** Current authorization status */
372
+ status: PushAuthorizationStatus;
373
+ /** Whether current authorization is provisional */
374
+ isProvisional: boolean;
375
+ /** Whether user can be prompted to upgrade to full authorization */
376
+ canRequestFullAuthorization: boolean;
349
377
  }
350
378
  /**
351
379
  * Live Activity start parameters
@@ -609,7 +637,7 @@ interface SeennWidgetConfig {
609
637
  /**
610
638
  * SDK version info
611
639
  */
612
- declare const SDK_VERSION = "0.3.0";
640
+ declare const SDK_VERSION = "0.4.0";
613
641
  /**
614
642
  * Minimum API version required
615
643
  */
@@ -619,4 +647,4 @@ declare const MIN_API_VERSION = "1.0.0";
619
647
  */
620
648
  declare const SSE_PROTOCOL_VERSION = "1.0";
621
649
 
622
- export { type ChildJobSummary, type ChildProgressMode, type ChildrenStats, type CompleteJobParams, type ConnectionMode, type ConnectionState, type CreateJobParams, type EtaStats, type FailJobParams, type FontConfig, type FontWeight, type GradientPoint, type InAppMessage, type InAppMessageType, type JobError, type JobResult, type JobStatus, type JobTypeConfig, type LiveActivityCTAButton, type LiveActivityCTAButtonStyle, type LiveActivityCTAConfig, type LiveActivityCTAStyle, type LiveActivityColors, type LiveActivityEndParams, type LiveActivityFonts, type LiveActivityGradient, type LiveActivityLayout, type LiveActivityPushTokenEvent, type LiveActivityResult, type LiveActivityStartParams, type LiveActivityThemeConfig, type LiveActivityThemePreset, type LiveActivityUpdateParams, MIN_API_VERSION, type ParentInfo, type ParentWithChildren, type QueueInfo, SDK_VERSION, type SSEEvent, type SSEEventType, SSE_PROTOCOL_VERSION, type SeennConfig, type SeennJob, type SeennWidgetConfig, type StageInfo, type UpdateJobParams, type WebhookEventType, type WebhookPayload, type WidgetExtensionConfig };
650
+ export { type ChildJobSummary, type ChildProgressMode, type ChildrenStats, type CompleteJobParams, type ConnectionMode, type ConnectionState, type CreateJobParams, type EtaStats, type FailJobParams, type FontConfig, type FontWeight, type GradientPoint, type InAppMessage, type InAppMessageType, type JobError, type JobResult, type JobStatus, type JobTypeConfig, type LiveActivityCTAButton, type LiveActivityCTAButtonStyle, type LiveActivityCTAConfig, type LiveActivityCTAStyle, type LiveActivityColors, type LiveActivityEndParams, type LiveActivityFonts, type LiveActivityGradient, type LiveActivityLayout, type LiveActivityPushTokenEvent, type LiveActivityResult, type LiveActivityStartParams, type LiveActivityThemeConfig, type LiveActivityThemePreset, type LiveActivityUpdateParams, MIN_API_VERSION, type ParentInfo, type ParentWithChildren, type PushAuthorizationInfo, type PushAuthorizationMode, type PushAuthorizationStatus, type QueueInfo, SDK_VERSION, type SSEEvent, type SSEEventType, SSE_PROTOCOL_VERSION, type SeennConfig, type SeennJob, type SeennWidgetConfig, type StageInfo, type UpdateJobParams, type WebhookEventType, type WebhookPayload, type WidgetExtensionConfig };
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ __export(index_exports, {
25
25
  SSE_PROTOCOL_VERSION: () => SSE_PROTOCOL_VERSION
26
26
  });
27
27
  module.exports = __toCommonJS(index_exports);
28
- var SDK_VERSION = "0.3.0";
28
+ var SDK_VERSION = "0.4.0";
29
29
  var MIN_API_VERSION = "1.0.0";
30
30
  var SSE_PROTOCOL_VERSION = "1.0";
31
31
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @seenn/types - Shared TypeScript types for Seenn SDKs\n *\n * This package is the single source of truth for all Seenn type definitions.\n * All SDK packages (react-native, node, flutter) should depend on this package.\n *\n * @version 0.1.0\n * @license MIT\n */\n\n// ============================================\n// Core Job Types\n// ============================================\n\n/**\n * Job status values\n */\nexport type JobStatus =\n | 'pending'\n | 'queued'\n | 'running'\n | 'completed'\n | 'failed'\n | 'cancelled';\n\n/**\n * How parent job progress is calculated from children\n */\nexport type ChildProgressMode = 'average' | 'weighted' | 'sequential';\n\n/**\n * Main job object returned by API and SSE\n */\nexport interface SeennJob {\n /** Unique job identifier (ULID format) */\n jobId: string;\n /** User who owns this job */\n userId: string;\n /** Application ID */\n appId: string;\n /** Current job status */\n status: JobStatus;\n /** Human-readable job title */\n title: string;\n /** Job type for categorization */\n jobType: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Progress percentage (0-100) */\n progress: number;\n /** Current status message */\n message?: string;\n /** Stage information for multi-step jobs */\n stage?: StageInfo;\n /** Estimated completion timestamp (ISO 8601) */\n estimatedCompletionAt?: string;\n /** ETA confidence score (0.0 - 1.0) */\n etaConfidence?: number;\n /** Number of historical jobs used to calculate ETA */\n etaBasedOn?: number;\n /** Queue position info */\n queue?: QueueInfo;\n /** Job result on completion */\n result?: JobResult;\n /** Error details on failure */\n error?: JobError;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Parent info (if this is a child job) */\n parent?: ParentInfo;\n /** Children stats (if this is a parent job) */\n children?: ChildrenStats;\n /** Progress calculation mode for parent jobs */\n childProgressMode?: ChildProgressMode;\n /** Job creation timestamp (ISO 8601) */\n createdAt: string;\n /** Last update timestamp (ISO 8601) */\n updatedAt: string;\n /** When the job started running (ISO 8601) */\n startedAt?: string;\n /** Job completion timestamp (ISO 8601) */\n completedAt?: string;\n /**\n * CTA button text (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaButtonText?: string;\n /**\n * CTA deep link (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaDeepLink?: string;\n}\n\n// ============================================\n// Stage & Queue Types\n// ============================================\n\n/**\n * Stage information for multi-step jobs\n */\nexport interface StageInfo {\n /** Current stage name */\n name: string;\n /** Current stage index (1-based) */\n current: number;\n /** Total number of stages */\n total: number;\n /** Optional stage description */\n description?: string;\n}\n\n/**\n * Queue position information\n */\nexport interface QueueInfo {\n /** Position in queue (1-based) */\n position: number;\n /** Total items in queue */\n total?: number;\n /** Queue name/identifier */\n queueName?: string;\n}\n\n// ============================================\n// Result & Error Types\n// ============================================\n\n/**\n * Job result on successful completion\n */\nexport interface JobResult {\n /** Result type (e.g., 'video', 'image', 'file') */\n type?: string;\n /** Result URL if applicable */\n url?: string;\n /** Additional result data */\n data?: Record<string, unknown>;\n}\n\n/**\n * Error details on job failure\n */\nexport interface JobError {\n /** Error code for programmatic handling */\n code: string;\n /** Human-readable error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n}\n\n// ============================================\n// Parent-Child Types\n// ============================================\n\n/**\n * Parent info for child jobs\n */\nexport interface ParentInfo {\n /** Parent job ID */\n parentJobId: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n}\n\n/**\n * Children stats for parent jobs\n */\nexport interface ChildrenStats {\n /** Total number of children */\n total: number;\n /** Number of completed children */\n completed: number;\n /** Number of failed children */\n failed: number;\n /** Number of running children */\n running: number;\n /** Number of pending children */\n pending: number;\n}\n\n/**\n * Summary of a child job (used in parent.children array)\n */\nexport interface ChildJobSummary {\n /** Child job ID */\n id: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n /** Child job title */\n title: string;\n /** Child job status */\n status: JobStatus;\n /** Child progress (0-100) */\n progress: number;\n /** Child status message */\n message?: string;\n /** Child result */\n result?: JobResult;\n /** Child error */\n error?: JobError;\n /** Child creation timestamp */\n createdAt: string;\n /** Child last update timestamp */\n updatedAt: string;\n /** Child completion timestamp */\n completedAt?: string;\n}\n\n/**\n * Parent job with all its children\n */\nexport interface ParentWithChildren {\n /** Parent job */\n parent: SeennJob;\n /** List of child jobs */\n children: ChildJobSummary[];\n}\n\n// ============================================\n// SSE Types\n// ============================================\n\n/**\n * Connection state for SSE\n */\nexport type ConnectionState =\n | 'disconnected'\n | 'connecting'\n | 'connected'\n | 'reconnecting';\n\n/**\n * SSE event types\n */\nexport type SSEEventType =\n | 'connected'\n | 'job.sync'\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled'\n | 'child.progress'\n | 'parent.updated'\n | 'in_app_message'\n | 'connection.idle'\n | 'heartbeat'\n | 'error';\n\n/**\n * SSE event wrapper\n */\nexport interface SSEEvent {\n /** Event type */\n event: SSEEventType;\n /** Event data */\n data: unknown;\n /** Event ID for replay */\n id?: string;\n}\n\n// ============================================\n// In-App Message Types\n// ============================================\n\n/**\n * In-app message types\n */\nexport type InAppMessageType =\n | 'job_complete_banner'\n | 'job_failed_modal'\n | 'job_toast';\n\n/**\n * In-app message for UI notifications\n */\nexport interface InAppMessage {\n /** Message ID */\n messageId: string;\n /** Message type */\n type: InAppMessageType;\n /** Associated job ID */\n jobId: string;\n /** Message title */\n title: string;\n /** Message body */\n body?: string;\n /** Call-to-action text */\n cta?: string;\n /** Call-to-action URL */\n ctaUrl?: string;\n}\n\n// ============================================\n// API Types\n// ============================================\n\n/**\n * Create job request parameters\n */\nexport interface CreateJobParams {\n /** User ID */\n userId: string;\n /** Job type */\n jobType: string;\n /** Job title */\n title: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Initial message */\n message?: string;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Estimated duration in ms (for ETA default) */\n estimatedDuration?: number;\n /** Parent job ID (for child jobs) */\n parentJobId?: string;\n /** Child index (for child jobs) */\n childIndex?: number;\n /** Total children (for parent jobs) */\n totalChildren?: number;\n /** Child progress mode (for parent jobs) */\n childProgressMode?: ChildProgressMode;\n}\n\n/**\n * Update job request parameters\n */\nexport interface UpdateJobParams {\n /** New progress (0-100) */\n progress?: number;\n /** New message */\n message?: string;\n /** New stage info */\n stage?: StageInfo;\n /** Custom metadata to merge */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Complete job request parameters\n */\nexport interface CompleteJobParams {\n /** Job result */\n result?: JobResult;\n /** Final message */\n message?: string;\n}\n\n/**\n * Fail job request parameters\n */\nexport interface FailJobParams {\n /** Error details */\n error: JobError;\n}\n\n// ============================================\n// Webhook Types\n// ============================================\n\n/**\n * Webhook event types\n */\nexport type WebhookEventType =\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled';\n\n/**\n * Webhook payload\n */\nexport interface WebhookPayload {\n /** Event type */\n event: WebhookEventType;\n /** Job data */\n job: SeennJob;\n /** Event timestamp (ISO 8601) */\n timestamp: string;\n /** Webhook delivery ID */\n deliveryId: string;\n}\n\n// ============================================\n// ETA Types\n// ============================================\n\n/**\n * ETA statistics for a workflow/jobType\n */\nexport interface EtaStats {\n /** ETA key (workflowId or jobType) */\n etaKey: string;\n /** Number of completed jobs */\n count: number;\n /** Average duration in ms */\n avgDuration: number;\n /** Minimum duration in ms */\n minDuration: number;\n /** Maximum duration in ms */\n maxDuration: number;\n /** Default duration if no history */\n defaultDuration?: number;\n /** Last updated timestamp */\n lastUpdated: string;\n}\n\n// ============================================\n// SDK Configuration Types\n// ============================================\n\n/**\n * Connection mode for real-time updates\n */\nexport type ConnectionMode = 'sse' | 'polling';\n\n/**\n * Base SDK configuration\n */\nexport interface SeennConfig {\n /** API base URL */\n baseUrl: string;\n /** API key (pk_* for client SDKs, sk_* for server SDKs) */\n apiKey?: string;\n /** API base path prefix (default: '/v1'). Self-hosted backends can use custom paths. */\n basePath?: string;\n /** SSE endpoint URL (default: baseUrl + basePath + /sse) */\n sseUrl?: string;\n /** Connection mode: 'sse' (default) or 'polling' (for self-hosted) */\n mode?: ConnectionMode;\n /** Polling interval in ms (default: 5000, only used when mode is 'polling') */\n pollInterval?: number;\n /** Enable auto-reconnect (default: true) */\n reconnect?: boolean;\n /** Reconnect interval in ms (default: 1000) */\n reconnectInterval?: number;\n /** Max reconnect attempts (default: 10) */\n maxReconnectAttempts?: number;\n /** Enable debug logging (default: false) */\n debug?: boolean;\n}\n\n// ============================================\n// Live Activity Types (iOS/Android)\n// ============================================\n\n/**\n * Live Activity start parameters\n */\nexport interface LiveActivityStartParams {\n /** Job ID */\n jobId: string;\n /** Activity title */\n title: string;\n /** Job type for icon selection */\n jobType?: string;\n /** Initial progress (0-100) */\n initialProgress?: number;\n /** Initial message */\n initialMessage?: string;\n}\n\n/**\n * Live Activity update parameters\n */\nexport interface LiveActivityUpdateParams {\n /** Job ID */\n jobId: string;\n /** New progress (0-100) */\n progress?: number;\n /** New status */\n status?: JobStatus;\n /** New message */\n message?: string;\n /** Stage info */\n stage?: StageInfo;\n /** ETA timestamp (Unix ms) */\n estimatedEndTime?: number;\n}\n\n/**\n * Live Activity end parameters\n */\nexport interface LiveActivityEndParams {\n /** Job ID */\n jobId: string;\n /** Final status */\n finalStatus?: JobStatus;\n /** Final progress */\n finalProgress?: number;\n /** Final message */\n message?: string;\n /** Result URL */\n resultUrl?: string;\n /** Error message */\n errorMessage?: string;\n /** Dismiss after seconds (default: 300) */\n dismissAfter?: number;\n /** CTA button to show on completion/failure */\n ctaButton?: LiveActivityCTAButton;\n}\n\n/**\n * Live Activity result\n */\nexport interface LiveActivityResult {\n /** Success flag */\n success: boolean;\n /** Activity ID (platform-specific) */\n activityId?: string;\n /** Associated job ID */\n jobId?: string;\n /** Error message if failed */\n error?: string;\n}\n\n/**\n * Push token event for Live Activity updates\n */\nexport interface LiveActivityPushTokenEvent {\n /** Job ID */\n jobId: string;\n /** APNs push token */\n token: string;\n}\n\n// ============================================\n// Live Activity CTA Button Types\n// ============================================\n\n/**\n * CTA (Call-to-Action) button style\n */\nexport type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';\n\n/**\n * CTA button configuration for Live Activity completion\n */\nexport interface LiveActivityCTAButton {\n /** Button text */\n text: string;\n /** Deep link URL to open when tapped */\n deepLink: string;\n /** Button style preset */\n style?: LiveActivityCTAButtonStyle;\n /** Custom background color (hex) */\n backgroundColor?: string;\n /** Custom text color (hex) */\n textColor?: string;\n /** Corner radius (default: 20) */\n cornerRadius?: number;\n}\n\n// ============================================\n// Live Activity Theme Configuration Types\n// ============================================\n\n/**\n * Gradient point positions\n */\nexport type GradientPoint =\n | 'top'\n | 'topLeading'\n | 'topTrailing'\n | 'leading'\n | 'trailing'\n | 'bottom'\n | 'bottomLeading'\n | 'bottomTrailing'\n | 'center';\n\n/**\n * Built-in theme presets\n */\nexport type LiveActivityThemePreset =\n | 'default'\n | 'gradient-sunset'\n | 'gradient-ocean'\n | 'gradient-purple'\n | 'minimal-dark'\n | 'minimal-light';\n\n/**\n * Color configuration for Live Activity\n */\nexport interface LiveActivityColors {\n /** Background color (hex) */\n background?: string;\n /** Primary text color (hex) */\n primary?: string;\n /** Secondary text color (hex) */\n secondary?: string;\n /** Progress bar fill color (hex) */\n progressBar?: string;\n /** Progress bar track color (hex) */\n progressTrack?: string;\n /** Status color for running state (hex) */\n statusRunning?: string;\n /** Status color for completed state (hex) */\n statusCompleted?: string;\n /** Status color for failed state (hex) */\n statusFailed?: string;\n}\n\n/**\n * Gradient configuration for Live Activity background\n */\nexport interface LiveActivityGradient {\n /** Gradient color stops (hex values) */\n colors: string[];\n /** Start point of gradient */\n startPoint?: GradientPoint;\n /** End point of gradient */\n endPoint?: GradientPoint;\n}\n\n/**\n * Layout configuration for Live Activity\n */\nexport interface LiveActivityLayout {\n /** Progress bar height in points */\n progressBarHeight?: number;\n /** Corner radius for progress bar */\n progressBarCornerRadius?: number;\n /** Overall corner radius */\n cornerRadius?: number;\n /** Show job type icon */\n showIcon?: boolean;\n /** Show ETA countdown */\n showEta?: boolean;\n /** Show current stage */\n showStage?: boolean;\n /** Show progress percentage text */\n showProgressText?: boolean;\n /** Compact mode for Dynamic Island */\n compactMode?: boolean;\n}\n\n/**\n * Font weight options\n */\nexport type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';\n\n/**\n * Font configuration\n */\nexport interface FontConfig {\n /** Font size in points */\n size?: number;\n /** Font weight */\n weight?: FontWeight;\n}\n\n/**\n * Font configuration for Live Activity text elements\n */\nexport interface LiveActivityFonts {\n /** Title text font */\n title?: FontConfig;\n /** Progress/percentage text font */\n progress?: FontConfig;\n /** Message text font */\n message?: FontConfig;\n /** Stage text font */\n stage?: FontConfig;\n /** ETA text font */\n eta?: FontConfig;\n}\n\n/**\n * Job type specific icon and color configuration\n */\nexport interface JobTypeConfig {\n /** SF Symbol name (iOS) */\n icon?: string;\n /** Icon tint color (hex) */\n color?: string;\n /** Custom display name */\n displayName?: string;\n}\n\n/**\n * CTA button default styling\n */\nexport interface LiveActivityCTAStyle {\n /** Background color (hex) */\n backgroundColor?: string;\n /** Text color (hex) */\n textColor?: string;\n /** Corner radius */\n cornerRadius?: number;\n /** Font configuration */\n font?: FontConfig;\n}\n\n/**\n * CTA button configuration in theme\n */\nexport interface LiveActivityCTAConfig {\n /** Default CTA button style */\n style?: LiveActivityCTAStyle;\n /** Show CTA on these statuses */\n showOn?: ('completed' | 'failed')[];\n}\n\n/**\n * Complete theme configuration for Live Activity\n */\nexport interface LiveActivityThemeConfig {\n /** Use a built-in preset as base */\n preset?: LiveActivityThemePreset;\n /** Custom colors (override preset) */\n colors?: LiveActivityColors;\n /** Gradient background (overrides solid color) */\n gradient?: LiveActivityGradient;\n /** Layout options */\n layout?: LiveActivityLayout;\n /** Font configuration */\n fonts?: LiveActivityFonts;\n /** CTA button configuration */\n cta?: LiveActivityCTAConfig;\n}\n\n/**\n * Widget extension configuration\n */\nexport interface WidgetExtensionConfig {\n /** Widget extension name (default: 'SeennWidgetExtension') */\n name?: string;\n /** iOS deployment target (default: '16.1') */\n deploymentTarget?: string;\n /** App Groups identifier (auto-generated if not provided) */\n appGroupId?: string;\n}\n\n/**\n * Complete Seenn widget configuration file format\n */\nexport interface SeennWidgetConfig {\n /** Widget extension settings */\n widget?: WidgetExtensionConfig;\n /** Theme configuration */\n theme?: LiveActivityThemeConfig;\n /** Job type specific configurations */\n jobTypes?: Record<string, JobTypeConfig>;\n /** CTA button configuration */\n ctaButton?: LiveActivityCTAConfig;\n}\n\n// ============================================\n// Version & Compatibility\n// ============================================\n\n/**\n * SDK version info\n */\nexport const SDK_VERSION = '0.3.0';\n\n/**\n * Minimum API version required\n */\nexport const MIN_API_VERSION = '1.0.0';\n\n/**\n * SSE protocol version\n */\nexport const SSE_PROTOCOL_VERSION = '1.0';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwvBO,IAAM,cAAc;AAKpB,IAAM,kBAAkB;AAKxB,IAAM,uBAAuB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @seenn/types - Shared TypeScript types for Seenn SDKs\n *\n * This package is the single source of truth for all Seenn type definitions.\n * All SDK packages (react-native, node, flutter) should depend on this package.\n *\n * @version 0.1.0\n * @license MIT\n */\n\n// ============================================\n// Core Job Types\n// ============================================\n\n/**\n * Job status values\n */\nexport type JobStatus =\n | 'pending'\n | 'queued'\n | 'running'\n | 'completed'\n | 'failed'\n | 'cancelled';\n\n/**\n * How parent job progress is calculated from children\n */\nexport type ChildProgressMode = 'average' | 'weighted' | 'sequential';\n\n/**\n * Main job object returned by API and SSE\n */\nexport interface SeennJob {\n /** Unique job identifier (ULID format) */\n jobId: string;\n /** User who owns this job */\n userId: string;\n /** Application ID */\n appId: string;\n /** Current job status */\n status: JobStatus;\n /** Human-readable job title */\n title: string;\n /** Job type for categorization */\n jobType: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Progress percentage (0-100) */\n progress: number;\n /** Current status message */\n message?: string;\n /** Stage information for multi-step jobs */\n stage?: StageInfo;\n /** Estimated completion timestamp (ISO 8601) */\n estimatedCompletionAt?: string;\n /** ETA confidence score (0.0 - 1.0) */\n etaConfidence?: number;\n /** Number of historical jobs used to calculate ETA */\n etaBasedOn?: number;\n /** Queue position info */\n queue?: QueueInfo;\n /** Job result on completion */\n result?: JobResult;\n /** Error details on failure */\n error?: JobError;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Parent info (if this is a child job) */\n parent?: ParentInfo;\n /** Children stats (if this is a parent job) */\n children?: ChildrenStats;\n /** Progress calculation mode for parent jobs */\n childProgressMode?: ChildProgressMode;\n /** Job creation timestamp (ISO 8601) */\n createdAt: string;\n /** Last update timestamp (ISO 8601) */\n updatedAt: string;\n /** When the job started running (ISO 8601) */\n startedAt?: string;\n /** Job completion timestamp (ISO 8601) */\n completedAt?: string;\n /**\n * CTA button text (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaButtonText?: string;\n /**\n * CTA deep link (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaDeepLink?: string;\n}\n\n// ============================================\n// Stage & Queue Types\n// ============================================\n\n/**\n * Stage information for multi-step jobs\n */\nexport interface StageInfo {\n /** Current stage name */\n name: string;\n /** Current stage index (1-based) */\n current: number;\n /** Total number of stages */\n total: number;\n /** Optional stage description */\n description?: string;\n}\n\n/**\n * Queue position information\n */\nexport interface QueueInfo {\n /** Position in queue (1-based) */\n position: number;\n /** Total items in queue */\n total?: number;\n /** Queue name/identifier */\n queueName?: string;\n}\n\n// ============================================\n// Result & Error Types\n// ============================================\n\n/**\n * Job result on successful completion\n */\nexport interface JobResult {\n /** Result type (e.g., 'video', 'image', 'file') */\n type?: string;\n /** Result URL if applicable */\n url?: string;\n /** Additional result data */\n data?: Record<string, unknown>;\n}\n\n/**\n * Error details on job failure\n */\nexport interface JobError {\n /** Error code for programmatic handling */\n code: string;\n /** Human-readable error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n}\n\n// ============================================\n// Parent-Child Types\n// ============================================\n\n/**\n * Parent info for child jobs\n */\nexport interface ParentInfo {\n /** Parent job ID */\n parentJobId: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n}\n\n/**\n * Children stats for parent jobs\n */\nexport interface ChildrenStats {\n /** Total number of children */\n total: number;\n /** Number of completed children */\n completed: number;\n /** Number of failed children */\n failed: number;\n /** Number of running children */\n running: number;\n /** Number of pending children */\n pending: number;\n}\n\n/**\n * Summary of a child job (used in parent.children array)\n */\nexport interface ChildJobSummary {\n /** Child job ID */\n id: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n /** Child job title */\n title: string;\n /** Child job status */\n status: JobStatus;\n /** Child progress (0-100) */\n progress: number;\n /** Child status message */\n message?: string;\n /** Child result */\n result?: JobResult;\n /** Child error */\n error?: JobError;\n /** Child creation timestamp */\n createdAt: string;\n /** Child last update timestamp */\n updatedAt: string;\n /** Child completion timestamp */\n completedAt?: string;\n}\n\n/**\n * Parent job with all its children\n */\nexport interface ParentWithChildren {\n /** Parent job */\n parent: SeennJob;\n /** List of child jobs */\n children: ChildJobSummary[];\n}\n\n// ============================================\n// SSE Types\n// ============================================\n\n/**\n * Connection state for SSE\n */\nexport type ConnectionState =\n | 'disconnected'\n | 'connecting'\n | 'connected'\n | 'reconnecting';\n\n/**\n * SSE event types\n */\nexport type SSEEventType =\n | 'connected'\n | 'job.sync'\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled'\n | 'child.progress'\n | 'parent.updated'\n | 'in_app_message'\n | 'connection.idle'\n | 'heartbeat'\n | 'error';\n\n/**\n * SSE event wrapper\n */\nexport interface SSEEvent {\n /** Event type */\n event: SSEEventType;\n /** Event data */\n data: unknown;\n /** Event ID for replay */\n id?: string;\n}\n\n// ============================================\n// In-App Message Types\n// ============================================\n\n/**\n * In-app message types\n */\nexport type InAppMessageType =\n | 'job_complete_banner'\n | 'job_failed_modal'\n | 'job_toast';\n\n/**\n * In-app message for UI notifications\n */\nexport interface InAppMessage {\n /** Message ID */\n messageId: string;\n /** Message type */\n type: InAppMessageType;\n /** Associated job ID */\n jobId: string;\n /** Message title */\n title: string;\n /** Message body */\n body?: string;\n /** Call-to-action text */\n cta?: string;\n /** Call-to-action URL */\n ctaUrl?: string;\n}\n\n// ============================================\n// API Types\n// ============================================\n\n/**\n * Create job request parameters\n */\nexport interface CreateJobParams {\n /** User ID */\n userId: string;\n /** Job type */\n jobType: string;\n /** Job title */\n title: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Initial message */\n message?: string;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Estimated duration in ms (for ETA default) */\n estimatedDuration?: number;\n /** Parent job ID (for child jobs) */\n parentJobId?: string;\n /** Child index (for child jobs) */\n childIndex?: number;\n /** Total children (for parent jobs) */\n totalChildren?: number;\n /** Child progress mode (for parent jobs) */\n childProgressMode?: ChildProgressMode;\n}\n\n/**\n * Update job request parameters\n */\nexport interface UpdateJobParams {\n /** New progress (0-100) */\n progress?: number;\n /** New message */\n message?: string;\n /** New stage info */\n stage?: StageInfo;\n /** Custom metadata to merge */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Complete job request parameters\n */\nexport interface CompleteJobParams {\n /** Job result */\n result?: JobResult;\n /** Final message */\n message?: string;\n}\n\n/**\n * Fail job request parameters\n */\nexport interface FailJobParams {\n /** Error details */\n error: JobError;\n}\n\n// ============================================\n// Webhook Types\n// ============================================\n\n/**\n * Webhook event types\n */\nexport type WebhookEventType =\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled';\n\n/**\n * Webhook payload\n */\nexport interface WebhookPayload {\n /** Event type */\n event: WebhookEventType;\n /** Job data */\n job: SeennJob;\n /** Event timestamp (ISO 8601) */\n timestamp: string;\n /** Webhook delivery ID */\n deliveryId: string;\n}\n\n// ============================================\n// ETA Types\n// ============================================\n\n/**\n * ETA statistics for a workflow/jobType\n */\nexport interface EtaStats {\n /** ETA key (workflowId or jobType) */\n etaKey: string;\n /** Number of completed jobs */\n count: number;\n /** Average duration in ms */\n avgDuration: number;\n /** Minimum duration in ms */\n minDuration: number;\n /** Maximum duration in ms */\n maxDuration: number;\n /** Default duration if no history */\n defaultDuration?: number;\n /** Last updated timestamp */\n lastUpdated: string;\n}\n\n// ============================================\n// SDK Configuration Types\n// ============================================\n\n/**\n * Connection mode for real-time updates\n */\nexport type ConnectionMode = 'sse' | 'polling';\n\n/**\n * iOS push authorization mode\n * - 'standard': Shows permission prompt, full push access\n * - 'provisional': No prompt, quiet notifications only (iOS 12+)\n */\nexport type PushAuthorizationMode = 'standard' | 'provisional';\n\n/**\n * Base SDK configuration\n */\nexport interface SeennConfig {\n /** API base URL */\n baseUrl: string;\n /** API key (pk_* for client SDKs, sk_* for server SDKs) */\n apiKey?: string;\n /** API base path prefix (default: '/v1'). Self-hosted backends can use custom paths. */\n basePath?: string;\n /** SSE endpoint URL (default: baseUrl + basePath + /sse) */\n sseUrl?: string;\n /** Connection mode: 'sse' (default) or 'polling' (for self-hosted) */\n mode?: ConnectionMode;\n /** Polling interval in ms (default: 5000, only used when mode is 'polling') */\n pollInterval?: number;\n /** Enable auto-reconnect (default: true) */\n reconnect?: boolean;\n /** Reconnect interval in ms (default: 1000) */\n reconnectInterval?: number;\n /** Max reconnect attempts (default: 10) */\n maxReconnectAttempts?: number;\n /** Enable debug logging (default: false) */\n debug?: boolean;\n /** iOS push authorization mode (default: 'standard') */\n pushAuthorizationMode?: PushAuthorizationMode;\n}\n\n// ============================================\n// Push Authorization Types (iOS)\n// ============================================\n\n/**\n * iOS push authorization status\n * - 'notDetermined': Permission never requested\n * - 'denied': User denied permission\n * - 'authorized': Full push access granted\n * - 'provisional': Quiet notifications only (iOS 12+)\n * - 'ephemeral': App Clips only (iOS 14+)\n */\nexport type PushAuthorizationStatus =\n | 'notDetermined'\n | 'denied'\n | 'authorized'\n | 'provisional'\n | 'ephemeral';\n\n/**\n * Push authorization information\n */\nexport interface PushAuthorizationInfo {\n /** Current authorization status */\n status: PushAuthorizationStatus;\n /** Whether current authorization is provisional */\n isProvisional: boolean;\n /** Whether user can be prompted to upgrade to full authorization */\n canRequestFullAuthorization: boolean;\n}\n\n// ============================================\n// Live Activity Types (iOS/Android)\n// ============================================\n\n/**\n * Live Activity start parameters\n */\nexport interface LiveActivityStartParams {\n /** Job ID */\n jobId: string;\n /** Activity title */\n title: string;\n /** Job type for icon selection */\n jobType?: string;\n /** Initial progress (0-100) */\n initialProgress?: number;\n /** Initial message */\n initialMessage?: string;\n}\n\n/**\n * Live Activity update parameters\n */\nexport interface LiveActivityUpdateParams {\n /** Job ID */\n jobId: string;\n /** New progress (0-100) */\n progress?: number;\n /** New status */\n status?: JobStatus;\n /** New message */\n message?: string;\n /** Stage info */\n stage?: StageInfo;\n /** ETA timestamp (Unix ms) */\n estimatedEndTime?: number;\n}\n\n/**\n * Live Activity end parameters\n */\nexport interface LiveActivityEndParams {\n /** Job ID */\n jobId: string;\n /** Final status */\n finalStatus?: JobStatus;\n /** Final progress */\n finalProgress?: number;\n /** Final message */\n message?: string;\n /** Result URL */\n resultUrl?: string;\n /** Error message */\n errorMessage?: string;\n /** Dismiss after seconds (default: 300) */\n dismissAfter?: number;\n /** CTA button to show on completion/failure */\n ctaButton?: LiveActivityCTAButton;\n}\n\n/**\n * Live Activity result\n */\nexport interface LiveActivityResult {\n /** Success flag */\n success: boolean;\n /** Activity ID (platform-specific) */\n activityId?: string;\n /** Associated job ID */\n jobId?: string;\n /** Error message if failed */\n error?: string;\n}\n\n/**\n * Push token event for Live Activity updates\n */\nexport interface LiveActivityPushTokenEvent {\n /** Job ID */\n jobId: string;\n /** APNs push token */\n token: string;\n}\n\n// ============================================\n// Live Activity CTA Button Types\n// ============================================\n\n/**\n * CTA (Call-to-Action) button style\n */\nexport type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';\n\n/**\n * CTA button configuration for Live Activity completion\n */\nexport interface LiveActivityCTAButton {\n /** Button text */\n text: string;\n /** Deep link URL to open when tapped */\n deepLink: string;\n /** Button style preset */\n style?: LiveActivityCTAButtonStyle;\n /** Custom background color (hex) */\n backgroundColor?: string;\n /** Custom text color (hex) */\n textColor?: string;\n /** Corner radius (default: 20) */\n cornerRadius?: number;\n}\n\n// ============================================\n// Live Activity Theme Configuration Types\n// ============================================\n\n/**\n * Gradient point positions\n */\nexport type GradientPoint =\n | 'top'\n | 'topLeading'\n | 'topTrailing'\n | 'leading'\n | 'trailing'\n | 'bottom'\n | 'bottomLeading'\n | 'bottomTrailing'\n | 'center';\n\n/**\n * Built-in theme presets\n */\nexport type LiveActivityThemePreset =\n | 'default'\n | 'gradient-sunset'\n | 'gradient-ocean'\n | 'gradient-purple'\n | 'minimal-dark'\n | 'minimal-light';\n\n/**\n * Color configuration for Live Activity\n */\nexport interface LiveActivityColors {\n /** Background color (hex) */\n background?: string;\n /** Primary text color (hex) */\n primary?: string;\n /** Secondary text color (hex) */\n secondary?: string;\n /** Progress bar fill color (hex) */\n progressBar?: string;\n /** Progress bar track color (hex) */\n progressTrack?: string;\n /** Status color for running state (hex) */\n statusRunning?: string;\n /** Status color for completed state (hex) */\n statusCompleted?: string;\n /** Status color for failed state (hex) */\n statusFailed?: string;\n}\n\n/**\n * Gradient configuration for Live Activity background\n */\nexport interface LiveActivityGradient {\n /** Gradient color stops (hex values) */\n colors: string[];\n /** Start point of gradient */\n startPoint?: GradientPoint;\n /** End point of gradient */\n endPoint?: GradientPoint;\n}\n\n/**\n * Layout configuration for Live Activity\n */\nexport interface LiveActivityLayout {\n /** Progress bar height in points */\n progressBarHeight?: number;\n /** Corner radius for progress bar */\n progressBarCornerRadius?: number;\n /** Overall corner radius */\n cornerRadius?: number;\n /** Show job type icon */\n showIcon?: boolean;\n /** Show ETA countdown */\n showEta?: boolean;\n /** Show current stage */\n showStage?: boolean;\n /** Show progress percentage text */\n showProgressText?: boolean;\n /** Compact mode for Dynamic Island */\n compactMode?: boolean;\n}\n\n/**\n * Font weight options\n */\nexport type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';\n\n/**\n * Font configuration\n */\nexport interface FontConfig {\n /** Font size in points */\n size?: number;\n /** Font weight */\n weight?: FontWeight;\n}\n\n/**\n * Font configuration for Live Activity text elements\n */\nexport interface LiveActivityFonts {\n /** Title text font */\n title?: FontConfig;\n /** Progress/percentage text font */\n progress?: FontConfig;\n /** Message text font */\n message?: FontConfig;\n /** Stage text font */\n stage?: FontConfig;\n /** ETA text font */\n eta?: FontConfig;\n}\n\n/**\n * Job type specific icon and color configuration\n */\nexport interface JobTypeConfig {\n /** SF Symbol name (iOS) */\n icon?: string;\n /** Icon tint color (hex) */\n color?: string;\n /** Custom display name */\n displayName?: string;\n}\n\n/**\n * CTA button default styling\n */\nexport interface LiveActivityCTAStyle {\n /** Background color (hex) */\n backgroundColor?: string;\n /** Text color (hex) */\n textColor?: string;\n /** Corner radius */\n cornerRadius?: number;\n /** Font configuration */\n font?: FontConfig;\n}\n\n/**\n * CTA button configuration in theme\n */\nexport interface LiveActivityCTAConfig {\n /** Default CTA button style */\n style?: LiveActivityCTAStyle;\n /** Show CTA on these statuses */\n showOn?: ('completed' | 'failed')[];\n}\n\n/**\n * Complete theme configuration for Live Activity\n */\nexport interface LiveActivityThemeConfig {\n /** Use a built-in preset as base */\n preset?: LiveActivityThemePreset;\n /** Custom colors (override preset) */\n colors?: LiveActivityColors;\n /** Gradient background (overrides solid color) */\n gradient?: LiveActivityGradient;\n /** Layout options */\n layout?: LiveActivityLayout;\n /** Font configuration */\n fonts?: LiveActivityFonts;\n /** CTA button configuration */\n cta?: LiveActivityCTAConfig;\n}\n\n/**\n * Widget extension configuration\n */\nexport interface WidgetExtensionConfig {\n /** Widget extension name (default: 'SeennWidgetExtension') */\n name?: string;\n /** iOS deployment target (default: '16.1') */\n deploymentTarget?: string;\n /** App Groups identifier (auto-generated if not provided) */\n appGroupId?: string;\n}\n\n/**\n * Complete Seenn widget configuration file format\n */\nexport interface SeennWidgetConfig {\n /** Widget extension settings */\n widget?: WidgetExtensionConfig;\n /** Theme configuration */\n theme?: LiveActivityThemeConfig;\n /** Job type specific configurations */\n jobTypes?: Record<string, JobTypeConfig>;\n /** CTA button configuration */\n ctaButton?: LiveActivityCTAConfig;\n}\n\n// ============================================\n// Version & Compatibility\n// ============================================\n\n/**\n * SDK version info\n */\nexport const SDK_VERSION = '0.4.0';\n\n/**\n * Minimum API version required\n */\nexport const MIN_API_VERSION = '1.0.0';\n\n/**\n * SSE protocol version\n */\nexport const SSE_PROTOCOL_VERSION = '1.0';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgyBO,IAAM,cAAc;AAKpB,IAAM,kBAAkB;AAKxB,IAAM,uBAAuB;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var SDK_VERSION = "0.3.0";
2
+ var SDK_VERSION = "0.4.0";
3
3
  var MIN_API_VERSION = "1.0.0";
4
4
  var SSE_PROTOCOL_VERSION = "1.0";
5
5
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @seenn/types - Shared TypeScript types for Seenn SDKs\n *\n * This package is the single source of truth for all Seenn type definitions.\n * All SDK packages (react-native, node, flutter) should depend on this package.\n *\n * @version 0.1.0\n * @license MIT\n */\n\n// ============================================\n// Core Job Types\n// ============================================\n\n/**\n * Job status values\n */\nexport type JobStatus =\n | 'pending'\n | 'queued'\n | 'running'\n | 'completed'\n | 'failed'\n | 'cancelled';\n\n/**\n * How parent job progress is calculated from children\n */\nexport type ChildProgressMode = 'average' | 'weighted' | 'sequential';\n\n/**\n * Main job object returned by API and SSE\n */\nexport interface SeennJob {\n /** Unique job identifier (ULID format) */\n jobId: string;\n /** User who owns this job */\n userId: string;\n /** Application ID */\n appId: string;\n /** Current job status */\n status: JobStatus;\n /** Human-readable job title */\n title: string;\n /** Job type for categorization */\n jobType: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Progress percentage (0-100) */\n progress: number;\n /** Current status message */\n message?: string;\n /** Stage information for multi-step jobs */\n stage?: StageInfo;\n /** Estimated completion timestamp (ISO 8601) */\n estimatedCompletionAt?: string;\n /** ETA confidence score (0.0 - 1.0) */\n etaConfidence?: number;\n /** Number of historical jobs used to calculate ETA */\n etaBasedOn?: number;\n /** Queue position info */\n queue?: QueueInfo;\n /** Job result on completion */\n result?: JobResult;\n /** Error details on failure */\n error?: JobError;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Parent info (if this is a child job) */\n parent?: ParentInfo;\n /** Children stats (if this is a parent job) */\n children?: ChildrenStats;\n /** Progress calculation mode for parent jobs */\n childProgressMode?: ChildProgressMode;\n /** Job creation timestamp (ISO 8601) */\n createdAt: string;\n /** Last update timestamp (ISO 8601) */\n updatedAt: string;\n /** When the job started running (ISO 8601) */\n startedAt?: string;\n /** Job completion timestamp (ISO 8601) */\n completedAt?: string;\n /**\n * CTA button text (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaButtonText?: string;\n /**\n * CTA deep link (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaDeepLink?: string;\n}\n\n// ============================================\n// Stage & Queue Types\n// ============================================\n\n/**\n * Stage information for multi-step jobs\n */\nexport interface StageInfo {\n /** Current stage name */\n name: string;\n /** Current stage index (1-based) */\n current: number;\n /** Total number of stages */\n total: number;\n /** Optional stage description */\n description?: string;\n}\n\n/**\n * Queue position information\n */\nexport interface QueueInfo {\n /** Position in queue (1-based) */\n position: number;\n /** Total items in queue */\n total?: number;\n /** Queue name/identifier */\n queueName?: string;\n}\n\n// ============================================\n// Result & Error Types\n// ============================================\n\n/**\n * Job result on successful completion\n */\nexport interface JobResult {\n /** Result type (e.g., 'video', 'image', 'file') */\n type?: string;\n /** Result URL if applicable */\n url?: string;\n /** Additional result data */\n data?: Record<string, unknown>;\n}\n\n/**\n * Error details on job failure\n */\nexport interface JobError {\n /** Error code for programmatic handling */\n code: string;\n /** Human-readable error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n}\n\n// ============================================\n// Parent-Child Types\n// ============================================\n\n/**\n * Parent info for child jobs\n */\nexport interface ParentInfo {\n /** Parent job ID */\n parentJobId: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n}\n\n/**\n * Children stats for parent jobs\n */\nexport interface ChildrenStats {\n /** Total number of children */\n total: number;\n /** Number of completed children */\n completed: number;\n /** Number of failed children */\n failed: number;\n /** Number of running children */\n running: number;\n /** Number of pending children */\n pending: number;\n}\n\n/**\n * Summary of a child job (used in parent.children array)\n */\nexport interface ChildJobSummary {\n /** Child job ID */\n id: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n /** Child job title */\n title: string;\n /** Child job status */\n status: JobStatus;\n /** Child progress (0-100) */\n progress: number;\n /** Child status message */\n message?: string;\n /** Child result */\n result?: JobResult;\n /** Child error */\n error?: JobError;\n /** Child creation timestamp */\n createdAt: string;\n /** Child last update timestamp */\n updatedAt: string;\n /** Child completion timestamp */\n completedAt?: string;\n}\n\n/**\n * Parent job with all its children\n */\nexport interface ParentWithChildren {\n /** Parent job */\n parent: SeennJob;\n /** List of child jobs */\n children: ChildJobSummary[];\n}\n\n// ============================================\n// SSE Types\n// ============================================\n\n/**\n * Connection state for SSE\n */\nexport type ConnectionState =\n | 'disconnected'\n | 'connecting'\n | 'connected'\n | 'reconnecting';\n\n/**\n * SSE event types\n */\nexport type SSEEventType =\n | 'connected'\n | 'job.sync'\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled'\n | 'child.progress'\n | 'parent.updated'\n | 'in_app_message'\n | 'connection.idle'\n | 'heartbeat'\n | 'error';\n\n/**\n * SSE event wrapper\n */\nexport interface SSEEvent {\n /** Event type */\n event: SSEEventType;\n /** Event data */\n data: unknown;\n /** Event ID for replay */\n id?: string;\n}\n\n// ============================================\n// In-App Message Types\n// ============================================\n\n/**\n * In-app message types\n */\nexport type InAppMessageType =\n | 'job_complete_banner'\n | 'job_failed_modal'\n | 'job_toast';\n\n/**\n * In-app message for UI notifications\n */\nexport interface InAppMessage {\n /** Message ID */\n messageId: string;\n /** Message type */\n type: InAppMessageType;\n /** Associated job ID */\n jobId: string;\n /** Message title */\n title: string;\n /** Message body */\n body?: string;\n /** Call-to-action text */\n cta?: string;\n /** Call-to-action URL */\n ctaUrl?: string;\n}\n\n// ============================================\n// API Types\n// ============================================\n\n/**\n * Create job request parameters\n */\nexport interface CreateJobParams {\n /** User ID */\n userId: string;\n /** Job type */\n jobType: string;\n /** Job title */\n title: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Initial message */\n message?: string;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Estimated duration in ms (for ETA default) */\n estimatedDuration?: number;\n /** Parent job ID (for child jobs) */\n parentJobId?: string;\n /** Child index (for child jobs) */\n childIndex?: number;\n /** Total children (for parent jobs) */\n totalChildren?: number;\n /** Child progress mode (for parent jobs) */\n childProgressMode?: ChildProgressMode;\n}\n\n/**\n * Update job request parameters\n */\nexport interface UpdateJobParams {\n /** New progress (0-100) */\n progress?: number;\n /** New message */\n message?: string;\n /** New stage info */\n stage?: StageInfo;\n /** Custom metadata to merge */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Complete job request parameters\n */\nexport interface CompleteJobParams {\n /** Job result */\n result?: JobResult;\n /** Final message */\n message?: string;\n}\n\n/**\n * Fail job request parameters\n */\nexport interface FailJobParams {\n /** Error details */\n error: JobError;\n}\n\n// ============================================\n// Webhook Types\n// ============================================\n\n/**\n * Webhook event types\n */\nexport type WebhookEventType =\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled';\n\n/**\n * Webhook payload\n */\nexport interface WebhookPayload {\n /** Event type */\n event: WebhookEventType;\n /** Job data */\n job: SeennJob;\n /** Event timestamp (ISO 8601) */\n timestamp: string;\n /** Webhook delivery ID */\n deliveryId: string;\n}\n\n// ============================================\n// ETA Types\n// ============================================\n\n/**\n * ETA statistics for a workflow/jobType\n */\nexport interface EtaStats {\n /** ETA key (workflowId or jobType) */\n etaKey: string;\n /** Number of completed jobs */\n count: number;\n /** Average duration in ms */\n avgDuration: number;\n /** Minimum duration in ms */\n minDuration: number;\n /** Maximum duration in ms */\n maxDuration: number;\n /** Default duration if no history */\n defaultDuration?: number;\n /** Last updated timestamp */\n lastUpdated: string;\n}\n\n// ============================================\n// SDK Configuration Types\n// ============================================\n\n/**\n * Connection mode for real-time updates\n */\nexport type ConnectionMode = 'sse' | 'polling';\n\n/**\n * Base SDK configuration\n */\nexport interface SeennConfig {\n /** API base URL */\n baseUrl: string;\n /** API key (pk_* for client SDKs, sk_* for server SDKs) */\n apiKey?: string;\n /** API base path prefix (default: '/v1'). Self-hosted backends can use custom paths. */\n basePath?: string;\n /** SSE endpoint URL (default: baseUrl + basePath + /sse) */\n sseUrl?: string;\n /** Connection mode: 'sse' (default) or 'polling' (for self-hosted) */\n mode?: ConnectionMode;\n /** Polling interval in ms (default: 5000, only used when mode is 'polling') */\n pollInterval?: number;\n /** Enable auto-reconnect (default: true) */\n reconnect?: boolean;\n /** Reconnect interval in ms (default: 1000) */\n reconnectInterval?: number;\n /** Max reconnect attempts (default: 10) */\n maxReconnectAttempts?: number;\n /** Enable debug logging (default: false) */\n debug?: boolean;\n}\n\n// ============================================\n// Live Activity Types (iOS/Android)\n// ============================================\n\n/**\n * Live Activity start parameters\n */\nexport interface LiveActivityStartParams {\n /** Job ID */\n jobId: string;\n /** Activity title */\n title: string;\n /** Job type for icon selection */\n jobType?: string;\n /** Initial progress (0-100) */\n initialProgress?: number;\n /** Initial message */\n initialMessage?: string;\n}\n\n/**\n * Live Activity update parameters\n */\nexport interface LiveActivityUpdateParams {\n /** Job ID */\n jobId: string;\n /** New progress (0-100) */\n progress?: number;\n /** New status */\n status?: JobStatus;\n /** New message */\n message?: string;\n /** Stage info */\n stage?: StageInfo;\n /** ETA timestamp (Unix ms) */\n estimatedEndTime?: number;\n}\n\n/**\n * Live Activity end parameters\n */\nexport interface LiveActivityEndParams {\n /** Job ID */\n jobId: string;\n /** Final status */\n finalStatus?: JobStatus;\n /** Final progress */\n finalProgress?: number;\n /** Final message */\n message?: string;\n /** Result URL */\n resultUrl?: string;\n /** Error message */\n errorMessage?: string;\n /** Dismiss after seconds (default: 300) */\n dismissAfter?: number;\n /** CTA button to show on completion/failure */\n ctaButton?: LiveActivityCTAButton;\n}\n\n/**\n * Live Activity result\n */\nexport interface LiveActivityResult {\n /** Success flag */\n success: boolean;\n /** Activity ID (platform-specific) */\n activityId?: string;\n /** Associated job ID */\n jobId?: string;\n /** Error message if failed */\n error?: string;\n}\n\n/**\n * Push token event for Live Activity updates\n */\nexport interface LiveActivityPushTokenEvent {\n /** Job ID */\n jobId: string;\n /** APNs push token */\n token: string;\n}\n\n// ============================================\n// Live Activity CTA Button Types\n// ============================================\n\n/**\n * CTA (Call-to-Action) button style\n */\nexport type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';\n\n/**\n * CTA button configuration for Live Activity completion\n */\nexport interface LiveActivityCTAButton {\n /** Button text */\n text: string;\n /** Deep link URL to open when tapped */\n deepLink: string;\n /** Button style preset */\n style?: LiveActivityCTAButtonStyle;\n /** Custom background color (hex) */\n backgroundColor?: string;\n /** Custom text color (hex) */\n textColor?: string;\n /** Corner radius (default: 20) */\n cornerRadius?: number;\n}\n\n// ============================================\n// Live Activity Theme Configuration Types\n// ============================================\n\n/**\n * Gradient point positions\n */\nexport type GradientPoint =\n | 'top'\n | 'topLeading'\n | 'topTrailing'\n | 'leading'\n | 'trailing'\n | 'bottom'\n | 'bottomLeading'\n | 'bottomTrailing'\n | 'center';\n\n/**\n * Built-in theme presets\n */\nexport type LiveActivityThemePreset =\n | 'default'\n | 'gradient-sunset'\n | 'gradient-ocean'\n | 'gradient-purple'\n | 'minimal-dark'\n | 'minimal-light';\n\n/**\n * Color configuration for Live Activity\n */\nexport interface LiveActivityColors {\n /** Background color (hex) */\n background?: string;\n /** Primary text color (hex) */\n primary?: string;\n /** Secondary text color (hex) */\n secondary?: string;\n /** Progress bar fill color (hex) */\n progressBar?: string;\n /** Progress bar track color (hex) */\n progressTrack?: string;\n /** Status color for running state (hex) */\n statusRunning?: string;\n /** Status color for completed state (hex) */\n statusCompleted?: string;\n /** Status color for failed state (hex) */\n statusFailed?: string;\n}\n\n/**\n * Gradient configuration for Live Activity background\n */\nexport interface LiveActivityGradient {\n /** Gradient color stops (hex values) */\n colors: string[];\n /** Start point of gradient */\n startPoint?: GradientPoint;\n /** End point of gradient */\n endPoint?: GradientPoint;\n}\n\n/**\n * Layout configuration for Live Activity\n */\nexport interface LiveActivityLayout {\n /** Progress bar height in points */\n progressBarHeight?: number;\n /** Corner radius for progress bar */\n progressBarCornerRadius?: number;\n /** Overall corner radius */\n cornerRadius?: number;\n /** Show job type icon */\n showIcon?: boolean;\n /** Show ETA countdown */\n showEta?: boolean;\n /** Show current stage */\n showStage?: boolean;\n /** Show progress percentage text */\n showProgressText?: boolean;\n /** Compact mode for Dynamic Island */\n compactMode?: boolean;\n}\n\n/**\n * Font weight options\n */\nexport type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';\n\n/**\n * Font configuration\n */\nexport interface FontConfig {\n /** Font size in points */\n size?: number;\n /** Font weight */\n weight?: FontWeight;\n}\n\n/**\n * Font configuration for Live Activity text elements\n */\nexport interface LiveActivityFonts {\n /** Title text font */\n title?: FontConfig;\n /** Progress/percentage text font */\n progress?: FontConfig;\n /** Message text font */\n message?: FontConfig;\n /** Stage text font */\n stage?: FontConfig;\n /** ETA text font */\n eta?: FontConfig;\n}\n\n/**\n * Job type specific icon and color configuration\n */\nexport interface JobTypeConfig {\n /** SF Symbol name (iOS) */\n icon?: string;\n /** Icon tint color (hex) */\n color?: string;\n /** Custom display name */\n displayName?: string;\n}\n\n/**\n * CTA button default styling\n */\nexport interface LiveActivityCTAStyle {\n /** Background color (hex) */\n backgroundColor?: string;\n /** Text color (hex) */\n textColor?: string;\n /** Corner radius */\n cornerRadius?: number;\n /** Font configuration */\n font?: FontConfig;\n}\n\n/**\n * CTA button configuration in theme\n */\nexport interface LiveActivityCTAConfig {\n /** Default CTA button style */\n style?: LiveActivityCTAStyle;\n /** Show CTA on these statuses */\n showOn?: ('completed' | 'failed')[];\n}\n\n/**\n * Complete theme configuration for Live Activity\n */\nexport interface LiveActivityThemeConfig {\n /** Use a built-in preset as base */\n preset?: LiveActivityThemePreset;\n /** Custom colors (override preset) */\n colors?: LiveActivityColors;\n /** Gradient background (overrides solid color) */\n gradient?: LiveActivityGradient;\n /** Layout options */\n layout?: LiveActivityLayout;\n /** Font configuration */\n fonts?: LiveActivityFonts;\n /** CTA button configuration */\n cta?: LiveActivityCTAConfig;\n}\n\n/**\n * Widget extension configuration\n */\nexport interface WidgetExtensionConfig {\n /** Widget extension name (default: 'SeennWidgetExtension') */\n name?: string;\n /** iOS deployment target (default: '16.1') */\n deploymentTarget?: string;\n /** App Groups identifier (auto-generated if not provided) */\n appGroupId?: string;\n}\n\n/**\n * Complete Seenn widget configuration file format\n */\nexport interface SeennWidgetConfig {\n /** Widget extension settings */\n widget?: WidgetExtensionConfig;\n /** Theme configuration */\n theme?: LiveActivityThemeConfig;\n /** Job type specific configurations */\n jobTypes?: Record<string, JobTypeConfig>;\n /** CTA button configuration */\n ctaButton?: LiveActivityCTAConfig;\n}\n\n// ============================================\n// Version & Compatibility\n// ============================================\n\n/**\n * SDK version info\n */\nexport const SDK_VERSION = '0.3.0';\n\n/**\n * Minimum API version required\n */\nexport const MIN_API_VERSION = '1.0.0';\n\n/**\n * SSE protocol version\n */\nexport const SSE_PROTOCOL_VERSION = '1.0';\n"],"mappings":";AAwvBO,IAAM,cAAc;AAKpB,IAAM,kBAAkB;AAKxB,IAAM,uBAAuB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @seenn/types - Shared TypeScript types for Seenn SDKs\n *\n * This package is the single source of truth for all Seenn type definitions.\n * All SDK packages (react-native, node, flutter) should depend on this package.\n *\n * @version 0.1.0\n * @license MIT\n */\n\n// ============================================\n// Core Job Types\n// ============================================\n\n/**\n * Job status values\n */\nexport type JobStatus =\n | 'pending'\n | 'queued'\n | 'running'\n | 'completed'\n | 'failed'\n | 'cancelled';\n\n/**\n * How parent job progress is calculated from children\n */\nexport type ChildProgressMode = 'average' | 'weighted' | 'sequential';\n\n/**\n * Main job object returned by API and SSE\n */\nexport interface SeennJob {\n /** Unique job identifier (ULID format) */\n jobId: string;\n /** User who owns this job */\n userId: string;\n /** Application ID */\n appId: string;\n /** Current job status */\n status: JobStatus;\n /** Human-readable job title */\n title: string;\n /** Job type for categorization */\n jobType: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Progress percentage (0-100) */\n progress: number;\n /** Current status message */\n message?: string;\n /** Stage information for multi-step jobs */\n stage?: StageInfo;\n /** Estimated completion timestamp (ISO 8601) */\n estimatedCompletionAt?: string;\n /** ETA confidence score (0.0 - 1.0) */\n etaConfidence?: number;\n /** Number of historical jobs used to calculate ETA */\n etaBasedOn?: number;\n /** Queue position info */\n queue?: QueueInfo;\n /** Job result on completion */\n result?: JobResult;\n /** Error details on failure */\n error?: JobError;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Parent info (if this is a child job) */\n parent?: ParentInfo;\n /** Children stats (if this is a parent job) */\n children?: ChildrenStats;\n /** Progress calculation mode for parent jobs */\n childProgressMode?: ChildProgressMode;\n /** Job creation timestamp (ISO 8601) */\n createdAt: string;\n /** Last update timestamp (ISO 8601) */\n updatedAt: string;\n /** When the job started running (ISO 8601) */\n startedAt?: string;\n /** Job completion timestamp (ISO 8601) */\n completedAt?: string;\n /**\n * CTA button text (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaButtonText?: string;\n /**\n * CTA deep link (optional backend override for Live Activity)\n * If provided, overrides mobile SDK default CTA\n */\n ctaDeepLink?: string;\n}\n\n// ============================================\n// Stage & Queue Types\n// ============================================\n\n/**\n * Stage information for multi-step jobs\n */\nexport interface StageInfo {\n /** Current stage name */\n name: string;\n /** Current stage index (1-based) */\n current: number;\n /** Total number of stages */\n total: number;\n /** Optional stage description */\n description?: string;\n}\n\n/**\n * Queue position information\n */\nexport interface QueueInfo {\n /** Position in queue (1-based) */\n position: number;\n /** Total items in queue */\n total?: number;\n /** Queue name/identifier */\n queueName?: string;\n}\n\n// ============================================\n// Result & Error Types\n// ============================================\n\n/**\n * Job result on successful completion\n */\nexport interface JobResult {\n /** Result type (e.g., 'video', 'image', 'file') */\n type?: string;\n /** Result URL if applicable */\n url?: string;\n /** Additional result data */\n data?: Record<string, unknown>;\n}\n\n/**\n * Error details on job failure\n */\nexport interface JobError {\n /** Error code for programmatic handling */\n code: string;\n /** Human-readable error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n}\n\n// ============================================\n// Parent-Child Types\n// ============================================\n\n/**\n * Parent info for child jobs\n */\nexport interface ParentInfo {\n /** Parent job ID */\n parentJobId: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n}\n\n/**\n * Children stats for parent jobs\n */\nexport interface ChildrenStats {\n /** Total number of children */\n total: number;\n /** Number of completed children */\n completed: number;\n /** Number of failed children */\n failed: number;\n /** Number of running children */\n running: number;\n /** Number of pending children */\n pending: number;\n}\n\n/**\n * Summary of a child job (used in parent.children array)\n */\nexport interface ChildJobSummary {\n /** Child job ID */\n id: string;\n /** Child index within parent (0-based) */\n childIndex: number;\n /** Child job title */\n title: string;\n /** Child job status */\n status: JobStatus;\n /** Child progress (0-100) */\n progress: number;\n /** Child status message */\n message?: string;\n /** Child result */\n result?: JobResult;\n /** Child error */\n error?: JobError;\n /** Child creation timestamp */\n createdAt: string;\n /** Child last update timestamp */\n updatedAt: string;\n /** Child completion timestamp */\n completedAt?: string;\n}\n\n/**\n * Parent job with all its children\n */\nexport interface ParentWithChildren {\n /** Parent job */\n parent: SeennJob;\n /** List of child jobs */\n children: ChildJobSummary[];\n}\n\n// ============================================\n// SSE Types\n// ============================================\n\n/**\n * Connection state for SSE\n */\nexport type ConnectionState =\n | 'disconnected'\n | 'connecting'\n | 'connected'\n | 'reconnecting';\n\n/**\n * SSE event types\n */\nexport type SSEEventType =\n | 'connected'\n | 'job.sync'\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled'\n | 'child.progress'\n | 'parent.updated'\n | 'in_app_message'\n | 'connection.idle'\n | 'heartbeat'\n | 'error';\n\n/**\n * SSE event wrapper\n */\nexport interface SSEEvent {\n /** Event type */\n event: SSEEventType;\n /** Event data */\n data: unknown;\n /** Event ID for replay */\n id?: string;\n}\n\n// ============================================\n// In-App Message Types\n// ============================================\n\n/**\n * In-app message types\n */\nexport type InAppMessageType =\n | 'job_complete_banner'\n | 'job_failed_modal'\n | 'job_toast';\n\n/**\n * In-app message for UI notifications\n */\nexport interface InAppMessage {\n /** Message ID */\n messageId: string;\n /** Message type */\n type: InAppMessageType;\n /** Associated job ID */\n jobId: string;\n /** Message title */\n title: string;\n /** Message body */\n body?: string;\n /** Call-to-action text */\n cta?: string;\n /** Call-to-action URL */\n ctaUrl?: string;\n}\n\n// ============================================\n// API Types\n// ============================================\n\n/**\n * Create job request parameters\n */\nexport interface CreateJobParams {\n /** User ID */\n userId: string;\n /** Job type */\n jobType: string;\n /** Job title */\n title: string;\n /** Workflow ID for ETA tracking (default: jobType) */\n workflowId?: string;\n /** Initial message */\n message?: string;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n /** Estimated duration in ms (for ETA default) */\n estimatedDuration?: number;\n /** Parent job ID (for child jobs) */\n parentJobId?: string;\n /** Child index (for child jobs) */\n childIndex?: number;\n /** Total children (for parent jobs) */\n totalChildren?: number;\n /** Child progress mode (for parent jobs) */\n childProgressMode?: ChildProgressMode;\n}\n\n/**\n * Update job request parameters\n */\nexport interface UpdateJobParams {\n /** New progress (0-100) */\n progress?: number;\n /** New message */\n message?: string;\n /** New stage info */\n stage?: StageInfo;\n /** Custom metadata to merge */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * Complete job request parameters\n */\nexport interface CompleteJobParams {\n /** Job result */\n result?: JobResult;\n /** Final message */\n message?: string;\n}\n\n/**\n * Fail job request parameters\n */\nexport interface FailJobParams {\n /** Error details */\n error: JobError;\n}\n\n// ============================================\n// Webhook Types\n// ============================================\n\n/**\n * Webhook event types\n */\nexport type WebhookEventType =\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed'\n | 'job.cancelled';\n\n/**\n * Webhook payload\n */\nexport interface WebhookPayload {\n /** Event type */\n event: WebhookEventType;\n /** Job data */\n job: SeennJob;\n /** Event timestamp (ISO 8601) */\n timestamp: string;\n /** Webhook delivery ID */\n deliveryId: string;\n}\n\n// ============================================\n// ETA Types\n// ============================================\n\n/**\n * ETA statistics for a workflow/jobType\n */\nexport interface EtaStats {\n /** ETA key (workflowId or jobType) */\n etaKey: string;\n /** Number of completed jobs */\n count: number;\n /** Average duration in ms */\n avgDuration: number;\n /** Minimum duration in ms */\n minDuration: number;\n /** Maximum duration in ms */\n maxDuration: number;\n /** Default duration if no history */\n defaultDuration?: number;\n /** Last updated timestamp */\n lastUpdated: string;\n}\n\n// ============================================\n// SDK Configuration Types\n// ============================================\n\n/**\n * Connection mode for real-time updates\n */\nexport type ConnectionMode = 'sse' | 'polling';\n\n/**\n * iOS push authorization mode\n * - 'standard': Shows permission prompt, full push access\n * - 'provisional': No prompt, quiet notifications only (iOS 12+)\n */\nexport type PushAuthorizationMode = 'standard' | 'provisional';\n\n/**\n * Base SDK configuration\n */\nexport interface SeennConfig {\n /** API base URL */\n baseUrl: string;\n /** API key (pk_* for client SDKs, sk_* for server SDKs) */\n apiKey?: string;\n /** API base path prefix (default: '/v1'). Self-hosted backends can use custom paths. */\n basePath?: string;\n /** SSE endpoint URL (default: baseUrl + basePath + /sse) */\n sseUrl?: string;\n /** Connection mode: 'sse' (default) or 'polling' (for self-hosted) */\n mode?: ConnectionMode;\n /** Polling interval in ms (default: 5000, only used when mode is 'polling') */\n pollInterval?: number;\n /** Enable auto-reconnect (default: true) */\n reconnect?: boolean;\n /** Reconnect interval in ms (default: 1000) */\n reconnectInterval?: number;\n /** Max reconnect attempts (default: 10) */\n maxReconnectAttempts?: number;\n /** Enable debug logging (default: false) */\n debug?: boolean;\n /** iOS push authorization mode (default: 'standard') */\n pushAuthorizationMode?: PushAuthorizationMode;\n}\n\n// ============================================\n// Push Authorization Types (iOS)\n// ============================================\n\n/**\n * iOS push authorization status\n * - 'notDetermined': Permission never requested\n * - 'denied': User denied permission\n * - 'authorized': Full push access granted\n * - 'provisional': Quiet notifications only (iOS 12+)\n * - 'ephemeral': App Clips only (iOS 14+)\n */\nexport type PushAuthorizationStatus =\n | 'notDetermined'\n | 'denied'\n | 'authorized'\n | 'provisional'\n | 'ephemeral';\n\n/**\n * Push authorization information\n */\nexport interface PushAuthorizationInfo {\n /** Current authorization status */\n status: PushAuthorizationStatus;\n /** Whether current authorization is provisional */\n isProvisional: boolean;\n /** Whether user can be prompted to upgrade to full authorization */\n canRequestFullAuthorization: boolean;\n}\n\n// ============================================\n// Live Activity Types (iOS/Android)\n// ============================================\n\n/**\n * Live Activity start parameters\n */\nexport interface LiveActivityStartParams {\n /** Job ID */\n jobId: string;\n /** Activity title */\n title: string;\n /** Job type for icon selection */\n jobType?: string;\n /** Initial progress (0-100) */\n initialProgress?: number;\n /** Initial message */\n initialMessage?: string;\n}\n\n/**\n * Live Activity update parameters\n */\nexport interface LiveActivityUpdateParams {\n /** Job ID */\n jobId: string;\n /** New progress (0-100) */\n progress?: number;\n /** New status */\n status?: JobStatus;\n /** New message */\n message?: string;\n /** Stage info */\n stage?: StageInfo;\n /** ETA timestamp (Unix ms) */\n estimatedEndTime?: number;\n}\n\n/**\n * Live Activity end parameters\n */\nexport interface LiveActivityEndParams {\n /** Job ID */\n jobId: string;\n /** Final status */\n finalStatus?: JobStatus;\n /** Final progress */\n finalProgress?: number;\n /** Final message */\n message?: string;\n /** Result URL */\n resultUrl?: string;\n /** Error message */\n errorMessage?: string;\n /** Dismiss after seconds (default: 300) */\n dismissAfter?: number;\n /** CTA button to show on completion/failure */\n ctaButton?: LiveActivityCTAButton;\n}\n\n/**\n * Live Activity result\n */\nexport interface LiveActivityResult {\n /** Success flag */\n success: boolean;\n /** Activity ID (platform-specific) */\n activityId?: string;\n /** Associated job ID */\n jobId?: string;\n /** Error message if failed */\n error?: string;\n}\n\n/**\n * Push token event for Live Activity updates\n */\nexport interface LiveActivityPushTokenEvent {\n /** Job ID */\n jobId: string;\n /** APNs push token */\n token: string;\n}\n\n// ============================================\n// Live Activity CTA Button Types\n// ============================================\n\n/**\n * CTA (Call-to-Action) button style\n */\nexport type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';\n\n/**\n * CTA button configuration for Live Activity completion\n */\nexport interface LiveActivityCTAButton {\n /** Button text */\n text: string;\n /** Deep link URL to open when tapped */\n deepLink: string;\n /** Button style preset */\n style?: LiveActivityCTAButtonStyle;\n /** Custom background color (hex) */\n backgroundColor?: string;\n /** Custom text color (hex) */\n textColor?: string;\n /** Corner radius (default: 20) */\n cornerRadius?: number;\n}\n\n// ============================================\n// Live Activity Theme Configuration Types\n// ============================================\n\n/**\n * Gradient point positions\n */\nexport type GradientPoint =\n | 'top'\n | 'topLeading'\n | 'topTrailing'\n | 'leading'\n | 'trailing'\n | 'bottom'\n | 'bottomLeading'\n | 'bottomTrailing'\n | 'center';\n\n/**\n * Built-in theme presets\n */\nexport type LiveActivityThemePreset =\n | 'default'\n | 'gradient-sunset'\n | 'gradient-ocean'\n | 'gradient-purple'\n | 'minimal-dark'\n | 'minimal-light';\n\n/**\n * Color configuration for Live Activity\n */\nexport interface LiveActivityColors {\n /** Background color (hex) */\n background?: string;\n /** Primary text color (hex) */\n primary?: string;\n /** Secondary text color (hex) */\n secondary?: string;\n /** Progress bar fill color (hex) */\n progressBar?: string;\n /** Progress bar track color (hex) */\n progressTrack?: string;\n /** Status color for running state (hex) */\n statusRunning?: string;\n /** Status color for completed state (hex) */\n statusCompleted?: string;\n /** Status color for failed state (hex) */\n statusFailed?: string;\n}\n\n/**\n * Gradient configuration for Live Activity background\n */\nexport interface LiveActivityGradient {\n /** Gradient color stops (hex values) */\n colors: string[];\n /** Start point of gradient */\n startPoint?: GradientPoint;\n /** End point of gradient */\n endPoint?: GradientPoint;\n}\n\n/**\n * Layout configuration for Live Activity\n */\nexport interface LiveActivityLayout {\n /** Progress bar height in points */\n progressBarHeight?: number;\n /** Corner radius for progress bar */\n progressBarCornerRadius?: number;\n /** Overall corner radius */\n cornerRadius?: number;\n /** Show job type icon */\n showIcon?: boolean;\n /** Show ETA countdown */\n showEta?: boolean;\n /** Show current stage */\n showStage?: boolean;\n /** Show progress percentage text */\n showProgressText?: boolean;\n /** Compact mode for Dynamic Island */\n compactMode?: boolean;\n}\n\n/**\n * Font weight options\n */\nexport type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';\n\n/**\n * Font configuration\n */\nexport interface FontConfig {\n /** Font size in points */\n size?: number;\n /** Font weight */\n weight?: FontWeight;\n}\n\n/**\n * Font configuration for Live Activity text elements\n */\nexport interface LiveActivityFonts {\n /** Title text font */\n title?: FontConfig;\n /** Progress/percentage text font */\n progress?: FontConfig;\n /** Message text font */\n message?: FontConfig;\n /** Stage text font */\n stage?: FontConfig;\n /** ETA text font */\n eta?: FontConfig;\n}\n\n/**\n * Job type specific icon and color configuration\n */\nexport interface JobTypeConfig {\n /** SF Symbol name (iOS) */\n icon?: string;\n /** Icon tint color (hex) */\n color?: string;\n /** Custom display name */\n displayName?: string;\n}\n\n/**\n * CTA button default styling\n */\nexport interface LiveActivityCTAStyle {\n /** Background color (hex) */\n backgroundColor?: string;\n /** Text color (hex) */\n textColor?: string;\n /** Corner radius */\n cornerRadius?: number;\n /** Font configuration */\n font?: FontConfig;\n}\n\n/**\n * CTA button configuration in theme\n */\nexport interface LiveActivityCTAConfig {\n /** Default CTA button style */\n style?: LiveActivityCTAStyle;\n /** Show CTA on these statuses */\n showOn?: ('completed' | 'failed')[];\n}\n\n/**\n * Complete theme configuration for Live Activity\n */\nexport interface LiveActivityThemeConfig {\n /** Use a built-in preset as base */\n preset?: LiveActivityThemePreset;\n /** Custom colors (override preset) */\n colors?: LiveActivityColors;\n /** Gradient background (overrides solid color) */\n gradient?: LiveActivityGradient;\n /** Layout options */\n layout?: LiveActivityLayout;\n /** Font configuration */\n fonts?: LiveActivityFonts;\n /** CTA button configuration */\n cta?: LiveActivityCTAConfig;\n}\n\n/**\n * Widget extension configuration\n */\nexport interface WidgetExtensionConfig {\n /** Widget extension name (default: 'SeennWidgetExtension') */\n name?: string;\n /** iOS deployment target (default: '16.1') */\n deploymentTarget?: string;\n /** App Groups identifier (auto-generated if not provided) */\n appGroupId?: string;\n}\n\n/**\n * Complete Seenn widget configuration file format\n */\nexport interface SeennWidgetConfig {\n /** Widget extension settings */\n widget?: WidgetExtensionConfig;\n /** Theme configuration */\n theme?: LiveActivityThemeConfig;\n /** Job type specific configurations */\n jobTypes?: Record<string, JobTypeConfig>;\n /** CTA button configuration */\n ctaButton?: LiveActivityCTAConfig;\n}\n\n// ============================================\n// Version & Compatibility\n// ============================================\n\n/**\n * SDK version info\n */\nexport const SDK_VERSION = '0.4.0';\n\n/**\n * Minimum API version required\n */\nexport const MIN_API_VERSION = '1.0.0';\n\n/**\n * SSE protocol version\n */\nexport const SSE_PROTOCOL_VERSION = '1.0';\n"],"mappings":";AAgyBO,IAAM,cAAc;AAKpB,IAAM,kBAAkB;AAKxB,IAAM,uBAAuB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seenn/types",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared TypeScript types for Seenn SDKs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/index.ts CHANGED
@@ -418,6 +418,13 @@ export interface EtaStats {
418
418
  */
419
419
  export type ConnectionMode = 'sse' | 'polling';
420
420
 
421
+ /**
422
+ * iOS push authorization mode
423
+ * - 'standard': Shows permission prompt, full push access
424
+ * - 'provisional': No prompt, quiet notifications only (iOS 12+)
425
+ */
426
+ export type PushAuthorizationMode = 'standard' | 'provisional';
427
+
421
428
  /**
422
429
  * Base SDK configuration
423
430
  */
@@ -442,6 +449,39 @@ export interface SeennConfig {
442
449
  maxReconnectAttempts?: number;
443
450
  /** Enable debug logging (default: false) */
444
451
  debug?: boolean;
452
+ /** iOS push authorization mode (default: 'standard') */
453
+ pushAuthorizationMode?: PushAuthorizationMode;
454
+ }
455
+
456
+ // ============================================
457
+ // Push Authorization Types (iOS)
458
+ // ============================================
459
+
460
+ /**
461
+ * iOS push authorization status
462
+ * - 'notDetermined': Permission never requested
463
+ * - 'denied': User denied permission
464
+ * - 'authorized': Full push access granted
465
+ * - 'provisional': Quiet notifications only (iOS 12+)
466
+ * - 'ephemeral': App Clips only (iOS 14+)
467
+ */
468
+ export type PushAuthorizationStatus =
469
+ | 'notDetermined'
470
+ | 'denied'
471
+ | 'authorized'
472
+ | 'provisional'
473
+ | 'ephemeral';
474
+
475
+ /**
476
+ * Push authorization information
477
+ */
478
+ export interface PushAuthorizationInfo {
479
+ /** Current authorization status */
480
+ status: PushAuthorizationStatus;
481
+ /** Whether current authorization is provisional */
482
+ isProvisional: boolean;
483
+ /** Whether user can be prompted to upgrade to full authorization */
484
+ canRequestFullAuthorization: boolean;
445
485
  }
446
486
 
447
487
  // ============================================
@@ -758,7 +798,7 @@ export interface SeennWidgetConfig {
758
798
  /**
759
799
  * SDK version info
760
800
  */
761
- export const SDK_VERSION = '0.3.0';
801
+ export const SDK_VERSION = '0.4.0';
762
802
 
763
803
  /**
764
804
  * Minimum API version required