@seenn/types 0.2.2 → 0.3.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
@@ -67,6 +67,16 @@ interface SeennJob {
67
67
  startedAt?: string;
68
68
  /** Job completion timestamp (ISO 8601) */
69
69
  completedAt?: string;
70
+ /**
71
+ * CTA button text (optional backend override for Live Activity)
72
+ * If provided, overrides mobile SDK default CTA
73
+ */
74
+ ctaButtonText?: string;
75
+ /**
76
+ * CTA deep link (optional backend override for Live Activity)
77
+ * If provided, overrides mobile SDK default CTA
78
+ */
79
+ ctaDeepLink?: string;
70
80
  }
71
81
  /**
72
82
  * Stage information for multi-step jobs
@@ -387,6 +397,8 @@ interface LiveActivityEndParams {
387
397
  errorMessage?: string;
388
398
  /** Dismiss after seconds (default: 300) */
389
399
  dismissAfter?: number;
400
+ /** CTA button to show on completion/failure */
401
+ ctaButton?: LiveActivityCTAButton;
390
402
  }
391
403
  /**
392
404
  * Live Activity result
@@ -410,10 +422,194 @@ interface LiveActivityPushTokenEvent {
410
422
  /** APNs push token */
411
423
  token: string;
412
424
  }
425
+ /**
426
+ * CTA (Call-to-Action) button style
427
+ */
428
+ type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';
429
+ /**
430
+ * CTA button configuration for Live Activity completion
431
+ */
432
+ interface LiveActivityCTAButton {
433
+ /** Button text */
434
+ text: string;
435
+ /** Deep link URL to open when tapped */
436
+ deepLink: string;
437
+ /** Button style preset */
438
+ style?: LiveActivityCTAButtonStyle;
439
+ /** Custom background color (hex) */
440
+ backgroundColor?: string;
441
+ /** Custom text color (hex) */
442
+ textColor?: string;
443
+ /** Corner radius (default: 20) */
444
+ cornerRadius?: number;
445
+ }
446
+ /**
447
+ * Gradient point positions
448
+ */
449
+ type GradientPoint = 'top' | 'topLeading' | 'topTrailing' | 'leading' | 'trailing' | 'bottom' | 'bottomLeading' | 'bottomTrailing' | 'center';
450
+ /**
451
+ * Built-in theme presets
452
+ */
453
+ type LiveActivityThemePreset = 'default' | 'gradient-sunset' | 'gradient-ocean' | 'gradient-purple' | 'minimal-dark' | 'minimal-light';
454
+ /**
455
+ * Color configuration for Live Activity
456
+ */
457
+ interface LiveActivityColors {
458
+ /** Background color (hex) */
459
+ background?: string;
460
+ /** Primary text color (hex) */
461
+ primary?: string;
462
+ /** Secondary text color (hex) */
463
+ secondary?: string;
464
+ /** Progress bar fill color (hex) */
465
+ progressBar?: string;
466
+ /** Progress bar track color (hex) */
467
+ progressTrack?: string;
468
+ /** Status color for running state (hex) */
469
+ statusRunning?: string;
470
+ /** Status color for completed state (hex) */
471
+ statusCompleted?: string;
472
+ /** Status color for failed state (hex) */
473
+ statusFailed?: string;
474
+ }
475
+ /**
476
+ * Gradient configuration for Live Activity background
477
+ */
478
+ interface LiveActivityGradient {
479
+ /** Gradient color stops (hex values) */
480
+ colors: string[];
481
+ /** Start point of gradient */
482
+ startPoint?: GradientPoint;
483
+ /** End point of gradient */
484
+ endPoint?: GradientPoint;
485
+ }
486
+ /**
487
+ * Layout configuration for Live Activity
488
+ */
489
+ interface LiveActivityLayout {
490
+ /** Progress bar height in points */
491
+ progressBarHeight?: number;
492
+ /** Corner radius for progress bar */
493
+ progressBarCornerRadius?: number;
494
+ /** Overall corner radius */
495
+ cornerRadius?: number;
496
+ /** Show job type icon */
497
+ showIcon?: boolean;
498
+ /** Show ETA countdown */
499
+ showEta?: boolean;
500
+ /** Show current stage */
501
+ showStage?: boolean;
502
+ /** Show progress percentage text */
503
+ showProgressText?: boolean;
504
+ /** Compact mode for Dynamic Island */
505
+ compactMode?: boolean;
506
+ }
507
+ /**
508
+ * Font weight options
509
+ */
510
+ type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';
511
+ /**
512
+ * Font configuration
513
+ */
514
+ interface FontConfig {
515
+ /** Font size in points */
516
+ size?: number;
517
+ /** Font weight */
518
+ weight?: FontWeight;
519
+ }
520
+ /**
521
+ * Font configuration for Live Activity text elements
522
+ */
523
+ interface LiveActivityFonts {
524
+ /** Title text font */
525
+ title?: FontConfig;
526
+ /** Progress/percentage text font */
527
+ progress?: FontConfig;
528
+ /** Message text font */
529
+ message?: FontConfig;
530
+ /** Stage text font */
531
+ stage?: FontConfig;
532
+ /** ETA text font */
533
+ eta?: FontConfig;
534
+ }
535
+ /**
536
+ * Job type specific icon and color configuration
537
+ */
538
+ interface JobTypeConfig {
539
+ /** SF Symbol name (iOS) */
540
+ icon?: string;
541
+ /** Icon tint color (hex) */
542
+ color?: string;
543
+ /** Custom display name */
544
+ displayName?: string;
545
+ }
546
+ /**
547
+ * CTA button default styling
548
+ */
549
+ interface LiveActivityCTAStyle {
550
+ /** Background color (hex) */
551
+ backgroundColor?: string;
552
+ /** Text color (hex) */
553
+ textColor?: string;
554
+ /** Corner radius */
555
+ cornerRadius?: number;
556
+ /** Font configuration */
557
+ font?: FontConfig;
558
+ }
559
+ /**
560
+ * CTA button configuration in theme
561
+ */
562
+ interface LiveActivityCTAConfig {
563
+ /** Default CTA button style */
564
+ style?: LiveActivityCTAStyle;
565
+ /** Show CTA on these statuses */
566
+ showOn?: ('completed' | 'failed')[];
567
+ }
568
+ /**
569
+ * Complete theme configuration for Live Activity
570
+ */
571
+ interface LiveActivityThemeConfig {
572
+ /** Use a built-in preset as base */
573
+ preset?: LiveActivityThemePreset;
574
+ /** Custom colors (override preset) */
575
+ colors?: LiveActivityColors;
576
+ /** Gradient background (overrides solid color) */
577
+ gradient?: LiveActivityGradient;
578
+ /** Layout options */
579
+ layout?: LiveActivityLayout;
580
+ /** Font configuration */
581
+ fonts?: LiveActivityFonts;
582
+ /** CTA button configuration */
583
+ cta?: LiveActivityCTAConfig;
584
+ }
585
+ /**
586
+ * Widget extension configuration
587
+ */
588
+ interface WidgetExtensionConfig {
589
+ /** Widget extension name (default: 'SeennWidgetExtension') */
590
+ name?: string;
591
+ /** iOS deployment target (default: '16.1') */
592
+ deploymentTarget?: string;
593
+ /** App Groups identifier (auto-generated if not provided) */
594
+ appGroupId?: string;
595
+ }
596
+ /**
597
+ * Complete Seenn widget configuration file format
598
+ */
599
+ interface SeennWidgetConfig {
600
+ /** Widget extension settings */
601
+ widget?: WidgetExtensionConfig;
602
+ /** Theme configuration */
603
+ theme?: LiveActivityThemeConfig;
604
+ /** Job type specific configurations */
605
+ jobTypes?: Record<string, JobTypeConfig>;
606
+ /** CTA button configuration */
607
+ ctaButton?: LiveActivityCTAConfig;
608
+ }
413
609
  /**
414
610
  * SDK version info
415
611
  */
416
- declare const SDK_VERSION = "0.2.0";
612
+ declare const SDK_VERSION = "0.3.0";
417
613
  /**
418
614
  * Minimum API version required
419
615
  */
@@ -423,4 +619,4 @@ declare const MIN_API_VERSION = "1.0.0";
423
619
  */
424
620
  declare const SSE_PROTOCOL_VERSION = "1.0";
425
621
 
426
- export { type ChildJobSummary, type ChildProgressMode, type ChildrenStats, type CompleteJobParams, type ConnectionMode, type ConnectionState, type CreateJobParams, type EtaStats, type FailJobParams, type InAppMessage, type InAppMessageType, type JobError, type JobResult, type JobStatus, type LiveActivityEndParams, type LiveActivityPushTokenEvent, type LiveActivityResult, type LiveActivityStartParams, 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 StageInfo, type UpdateJobParams, type WebhookEventType, type WebhookPayload };
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 };
package/dist/index.d.ts CHANGED
@@ -67,6 +67,16 @@ interface SeennJob {
67
67
  startedAt?: string;
68
68
  /** Job completion timestamp (ISO 8601) */
69
69
  completedAt?: string;
70
+ /**
71
+ * CTA button text (optional backend override for Live Activity)
72
+ * If provided, overrides mobile SDK default CTA
73
+ */
74
+ ctaButtonText?: string;
75
+ /**
76
+ * CTA deep link (optional backend override for Live Activity)
77
+ * If provided, overrides mobile SDK default CTA
78
+ */
79
+ ctaDeepLink?: string;
70
80
  }
71
81
  /**
72
82
  * Stage information for multi-step jobs
@@ -387,6 +397,8 @@ interface LiveActivityEndParams {
387
397
  errorMessage?: string;
388
398
  /** Dismiss after seconds (default: 300) */
389
399
  dismissAfter?: number;
400
+ /** CTA button to show on completion/failure */
401
+ ctaButton?: LiveActivityCTAButton;
390
402
  }
391
403
  /**
392
404
  * Live Activity result
@@ -410,10 +422,194 @@ interface LiveActivityPushTokenEvent {
410
422
  /** APNs push token */
411
423
  token: string;
412
424
  }
425
+ /**
426
+ * CTA (Call-to-Action) button style
427
+ */
428
+ type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';
429
+ /**
430
+ * CTA button configuration for Live Activity completion
431
+ */
432
+ interface LiveActivityCTAButton {
433
+ /** Button text */
434
+ text: string;
435
+ /** Deep link URL to open when tapped */
436
+ deepLink: string;
437
+ /** Button style preset */
438
+ style?: LiveActivityCTAButtonStyle;
439
+ /** Custom background color (hex) */
440
+ backgroundColor?: string;
441
+ /** Custom text color (hex) */
442
+ textColor?: string;
443
+ /** Corner radius (default: 20) */
444
+ cornerRadius?: number;
445
+ }
446
+ /**
447
+ * Gradient point positions
448
+ */
449
+ type GradientPoint = 'top' | 'topLeading' | 'topTrailing' | 'leading' | 'trailing' | 'bottom' | 'bottomLeading' | 'bottomTrailing' | 'center';
450
+ /**
451
+ * Built-in theme presets
452
+ */
453
+ type LiveActivityThemePreset = 'default' | 'gradient-sunset' | 'gradient-ocean' | 'gradient-purple' | 'minimal-dark' | 'minimal-light';
454
+ /**
455
+ * Color configuration for Live Activity
456
+ */
457
+ interface LiveActivityColors {
458
+ /** Background color (hex) */
459
+ background?: string;
460
+ /** Primary text color (hex) */
461
+ primary?: string;
462
+ /** Secondary text color (hex) */
463
+ secondary?: string;
464
+ /** Progress bar fill color (hex) */
465
+ progressBar?: string;
466
+ /** Progress bar track color (hex) */
467
+ progressTrack?: string;
468
+ /** Status color for running state (hex) */
469
+ statusRunning?: string;
470
+ /** Status color for completed state (hex) */
471
+ statusCompleted?: string;
472
+ /** Status color for failed state (hex) */
473
+ statusFailed?: string;
474
+ }
475
+ /**
476
+ * Gradient configuration for Live Activity background
477
+ */
478
+ interface LiveActivityGradient {
479
+ /** Gradient color stops (hex values) */
480
+ colors: string[];
481
+ /** Start point of gradient */
482
+ startPoint?: GradientPoint;
483
+ /** End point of gradient */
484
+ endPoint?: GradientPoint;
485
+ }
486
+ /**
487
+ * Layout configuration for Live Activity
488
+ */
489
+ interface LiveActivityLayout {
490
+ /** Progress bar height in points */
491
+ progressBarHeight?: number;
492
+ /** Corner radius for progress bar */
493
+ progressBarCornerRadius?: number;
494
+ /** Overall corner radius */
495
+ cornerRadius?: number;
496
+ /** Show job type icon */
497
+ showIcon?: boolean;
498
+ /** Show ETA countdown */
499
+ showEta?: boolean;
500
+ /** Show current stage */
501
+ showStage?: boolean;
502
+ /** Show progress percentage text */
503
+ showProgressText?: boolean;
504
+ /** Compact mode for Dynamic Island */
505
+ compactMode?: boolean;
506
+ }
507
+ /**
508
+ * Font weight options
509
+ */
510
+ type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';
511
+ /**
512
+ * Font configuration
513
+ */
514
+ interface FontConfig {
515
+ /** Font size in points */
516
+ size?: number;
517
+ /** Font weight */
518
+ weight?: FontWeight;
519
+ }
520
+ /**
521
+ * Font configuration for Live Activity text elements
522
+ */
523
+ interface LiveActivityFonts {
524
+ /** Title text font */
525
+ title?: FontConfig;
526
+ /** Progress/percentage text font */
527
+ progress?: FontConfig;
528
+ /** Message text font */
529
+ message?: FontConfig;
530
+ /** Stage text font */
531
+ stage?: FontConfig;
532
+ /** ETA text font */
533
+ eta?: FontConfig;
534
+ }
535
+ /**
536
+ * Job type specific icon and color configuration
537
+ */
538
+ interface JobTypeConfig {
539
+ /** SF Symbol name (iOS) */
540
+ icon?: string;
541
+ /** Icon tint color (hex) */
542
+ color?: string;
543
+ /** Custom display name */
544
+ displayName?: string;
545
+ }
546
+ /**
547
+ * CTA button default styling
548
+ */
549
+ interface LiveActivityCTAStyle {
550
+ /** Background color (hex) */
551
+ backgroundColor?: string;
552
+ /** Text color (hex) */
553
+ textColor?: string;
554
+ /** Corner radius */
555
+ cornerRadius?: number;
556
+ /** Font configuration */
557
+ font?: FontConfig;
558
+ }
559
+ /**
560
+ * CTA button configuration in theme
561
+ */
562
+ interface LiveActivityCTAConfig {
563
+ /** Default CTA button style */
564
+ style?: LiveActivityCTAStyle;
565
+ /** Show CTA on these statuses */
566
+ showOn?: ('completed' | 'failed')[];
567
+ }
568
+ /**
569
+ * Complete theme configuration for Live Activity
570
+ */
571
+ interface LiveActivityThemeConfig {
572
+ /** Use a built-in preset as base */
573
+ preset?: LiveActivityThemePreset;
574
+ /** Custom colors (override preset) */
575
+ colors?: LiveActivityColors;
576
+ /** Gradient background (overrides solid color) */
577
+ gradient?: LiveActivityGradient;
578
+ /** Layout options */
579
+ layout?: LiveActivityLayout;
580
+ /** Font configuration */
581
+ fonts?: LiveActivityFonts;
582
+ /** CTA button configuration */
583
+ cta?: LiveActivityCTAConfig;
584
+ }
585
+ /**
586
+ * Widget extension configuration
587
+ */
588
+ interface WidgetExtensionConfig {
589
+ /** Widget extension name (default: 'SeennWidgetExtension') */
590
+ name?: string;
591
+ /** iOS deployment target (default: '16.1') */
592
+ deploymentTarget?: string;
593
+ /** App Groups identifier (auto-generated if not provided) */
594
+ appGroupId?: string;
595
+ }
596
+ /**
597
+ * Complete Seenn widget configuration file format
598
+ */
599
+ interface SeennWidgetConfig {
600
+ /** Widget extension settings */
601
+ widget?: WidgetExtensionConfig;
602
+ /** Theme configuration */
603
+ theme?: LiveActivityThemeConfig;
604
+ /** Job type specific configurations */
605
+ jobTypes?: Record<string, JobTypeConfig>;
606
+ /** CTA button configuration */
607
+ ctaButton?: LiveActivityCTAConfig;
608
+ }
413
609
  /**
414
610
  * SDK version info
415
611
  */
416
- declare const SDK_VERSION = "0.2.0";
612
+ declare const SDK_VERSION = "0.3.0";
417
613
  /**
418
614
  * Minimum API version required
419
615
  */
@@ -423,4 +619,4 @@ declare const MIN_API_VERSION = "1.0.0";
423
619
  */
424
620
  declare const SSE_PROTOCOL_VERSION = "1.0";
425
621
 
426
- export { type ChildJobSummary, type ChildProgressMode, type ChildrenStats, type CompleteJobParams, type ConnectionMode, type ConnectionState, type CreateJobParams, type EtaStats, type FailJobParams, type InAppMessage, type InAppMessageType, type JobError, type JobResult, type JobStatus, type LiveActivityEndParams, type LiveActivityPushTokenEvent, type LiveActivityResult, type LiveActivityStartParams, 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 StageInfo, type UpdateJobParams, type WebhookEventType, type WebhookPayload };
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 };
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.2.0";
28
+ var SDK_VERSION = "0.3.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\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}\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// Version & Compatibility\n// ============================================\n\n/**\n * SDK version info\n */\nexport const SDK_VERSION = '0.2.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;AA6gBO,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 * 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":[]}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var SDK_VERSION = "0.2.0";
2
+ var SDK_VERSION = "0.3.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\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}\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// Version & Compatibility\n// ============================================\n\n/**\n * SDK version info\n */\nexport const SDK_VERSION = '0.2.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":";AA6gBO,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 * 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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seenn/types",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Shared TypeScript types for Seenn SDKs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -18,12 +18,6 @@
18
18
  "typescript",
19
19
  "job-tracking"
20
20
  ],
21
- "scripts": {
22
- "build": "tsup",
23
- "dev": "tsup --watch",
24
- "typecheck": "tsc --noEmit",
25
- "prepublishOnly": "pnpm build"
26
- },
27
21
  "devDependencies": {
28
22
  "tsup": "^8.0.1",
29
23
  "typescript": "^5.3.3"
@@ -35,5 +29,10 @@
35
29
  "publishConfig": {
36
30
  "access": "public"
37
31
  },
38
- "sideEffects": false
39
- }
32
+ "sideEffects": false,
33
+ "scripts": {
34
+ "build": "tsup",
35
+ "dev": "tsup --watch",
36
+ "typecheck": "tsc --noEmit"
37
+ }
38
+ }
package/src/index.ts CHANGED
@@ -80,6 +80,16 @@ export interface SeennJob {
80
80
  startedAt?: string;
81
81
  /** Job completion timestamp (ISO 8601) */
82
82
  completedAt?: string;
83
+ /**
84
+ * CTA button text (optional backend override for Live Activity)
85
+ * If provided, overrides mobile SDK default CTA
86
+ */
87
+ ctaButtonText?: string;
88
+ /**
89
+ * CTA deep link (optional backend override for Live Activity)
90
+ * If provided, overrides mobile SDK default CTA
91
+ */
92
+ ctaDeepLink?: string;
83
93
  }
84
94
 
85
95
  // ============================================
@@ -490,6 +500,8 @@ export interface LiveActivityEndParams {
490
500
  errorMessage?: string;
491
501
  /** Dismiss after seconds (default: 300) */
492
502
  dismissAfter?: number;
503
+ /** CTA button to show on completion/failure */
504
+ ctaButton?: LiveActivityCTAButton;
493
505
  }
494
506
 
495
507
  /**
@@ -516,6 +528,229 @@ export interface LiveActivityPushTokenEvent {
516
528
  token: string;
517
529
  }
518
530
 
531
+ // ============================================
532
+ // Live Activity CTA Button Types
533
+ // ============================================
534
+
535
+ /**
536
+ * CTA (Call-to-Action) button style
537
+ */
538
+ export type LiveActivityCTAButtonStyle = 'primary' | 'secondary' | 'outline';
539
+
540
+ /**
541
+ * CTA button configuration for Live Activity completion
542
+ */
543
+ export interface LiveActivityCTAButton {
544
+ /** Button text */
545
+ text: string;
546
+ /** Deep link URL to open when tapped */
547
+ deepLink: string;
548
+ /** Button style preset */
549
+ style?: LiveActivityCTAButtonStyle;
550
+ /** Custom background color (hex) */
551
+ backgroundColor?: string;
552
+ /** Custom text color (hex) */
553
+ textColor?: string;
554
+ /** Corner radius (default: 20) */
555
+ cornerRadius?: number;
556
+ }
557
+
558
+ // ============================================
559
+ // Live Activity Theme Configuration Types
560
+ // ============================================
561
+
562
+ /**
563
+ * Gradient point positions
564
+ */
565
+ export type GradientPoint =
566
+ | 'top'
567
+ | 'topLeading'
568
+ | 'topTrailing'
569
+ | 'leading'
570
+ | 'trailing'
571
+ | 'bottom'
572
+ | 'bottomLeading'
573
+ | 'bottomTrailing'
574
+ | 'center';
575
+
576
+ /**
577
+ * Built-in theme presets
578
+ */
579
+ export type LiveActivityThemePreset =
580
+ | 'default'
581
+ | 'gradient-sunset'
582
+ | 'gradient-ocean'
583
+ | 'gradient-purple'
584
+ | 'minimal-dark'
585
+ | 'minimal-light';
586
+
587
+ /**
588
+ * Color configuration for Live Activity
589
+ */
590
+ export interface LiveActivityColors {
591
+ /** Background color (hex) */
592
+ background?: string;
593
+ /** Primary text color (hex) */
594
+ primary?: string;
595
+ /** Secondary text color (hex) */
596
+ secondary?: string;
597
+ /** Progress bar fill color (hex) */
598
+ progressBar?: string;
599
+ /** Progress bar track color (hex) */
600
+ progressTrack?: string;
601
+ /** Status color for running state (hex) */
602
+ statusRunning?: string;
603
+ /** Status color for completed state (hex) */
604
+ statusCompleted?: string;
605
+ /** Status color for failed state (hex) */
606
+ statusFailed?: string;
607
+ }
608
+
609
+ /**
610
+ * Gradient configuration for Live Activity background
611
+ */
612
+ export interface LiveActivityGradient {
613
+ /** Gradient color stops (hex values) */
614
+ colors: string[];
615
+ /** Start point of gradient */
616
+ startPoint?: GradientPoint;
617
+ /** End point of gradient */
618
+ endPoint?: GradientPoint;
619
+ }
620
+
621
+ /**
622
+ * Layout configuration for Live Activity
623
+ */
624
+ export interface LiveActivityLayout {
625
+ /** Progress bar height in points */
626
+ progressBarHeight?: number;
627
+ /** Corner radius for progress bar */
628
+ progressBarCornerRadius?: number;
629
+ /** Overall corner radius */
630
+ cornerRadius?: number;
631
+ /** Show job type icon */
632
+ showIcon?: boolean;
633
+ /** Show ETA countdown */
634
+ showEta?: boolean;
635
+ /** Show current stage */
636
+ showStage?: boolean;
637
+ /** Show progress percentage text */
638
+ showProgressText?: boolean;
639
+ /** Compact mode for Dynamic Island */
640
+ compactMode?: boolean;
641
+ }
642
+
643
+ /**
644
+ * Font weight options
645
+ */
646
+ export type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';
647
+
648
+ /**
649
+ * Font configuration
650
+ */
651
+ export interface FontConfig {
652
+ /** Font size in points */
653
+ size?: number;
654
+ /** Font weight */
655
+ weight?: FontWeight;
656
+ }
657
+
658
+ /**
659
+ * Font configuration for Live Activity text elements
660
+ */
661
+ export interface LiveActivityFonts {
662
+ /** Title text font */
663
+ title?: FontConfig;
664
+ /** Progress/percentage text font */
665
+ progress?: FontConfig;
666
+ /** Message text font */
667
+ message?: FontConfig;
668
+ /** Stage text font */
669
+ stage?: FontConfig;
670
+ /** ETA text font */
671
+ eta?: FontConfig;
672
+ }
673
+
674
+ /**
675
+ * Job type specific icon and color configuration
676
+ */
677
+ export interface JobTypeConfig {
678
+ /** SF Symbol name (iOS) */
679
+ icon?: string;
680
+ /** Icon tint color (hex) */
681
+ color?: string;
682
+ /** Custom display name */
683
+ displayName?: string;
684
+ }
685
+
686
+ /**
687
+ * CTA button default styling
688
+ */
689
+ export interface LiveActivityCTAStyle {
690
+ /** Background color (hex) */
691
+ backgroundColor?: string;
692
+ /** Text color (hex) */
693
+ textColor?: string;
694
+ /** Corner radius */
695
+ cornerRadius?: number;
696
+ /** Font configuration */
697
+ font?: FontConfig;
698
+ }
699
+
700
+ /**
701
+ * CTA button configuration in theme
702
+ */
703
+ export interface LiveActivityCTAConfig {
704
+ /** Default CTA button style */
705
+ style?: LiveActivityCTAStyle;
706
+ /** Show CTA on these statuses */
707
+ showOn?: ('completed' | 'failed')[];
708
+ }
709
+
710
+ /**
711
+ * Complete theme configuration for Live Activity
712
+ */
713
+ export interface LiveActivityThemeConfig {
714
+ /** Use a built-in preset as base */
715
+ preset?: LiveActivityThemePreset;
716
+ /** Custom colors (override preset) */
717
+ colors?: LiveActivityColors;
718
+ /** Gradient background (overrides solid color) */
719
+ gradient?: LiveActivityGradient;
720
+ /** Layout options */
721
+ layout?: LiveActivityLayout;
722
+ /** Font configuration */
723
+ fonts?: LiveActivityFonts;
724
+ /** CTA button configuration */
725
+ cta?: LiveActivityCTAConfig;
726
+ }
727
+
728
+ /**
729
+ * Widget extension configuration
730
+ */
731
+ export interface WidgetExtensionConfig {
732
+ /** Widget extension name (default: 'SeennWidgetExtension') */
733
+ name?: string;
734
+ /** iOS deployment target (default: '16.1') */
735
+ deploymentTarget?: string;
736
+ /** App Groups identifier (auto-generated if not provided) */
737
+ appGroupId?: string;
738
+ }
739
+
740
+ /**
741
+ * Complete Seenn widget configuration file format
742
+ */
743
+ export interface SeennWidgetConfig {
744
+ /** Widget extension settings */
745
+ widget?: WidgetExtensionConfig;
746
+ /** Theme configuration */
747
+ theme?: LiveActivityThemeConfig;
748
+ /** Job type specific configurations */
749
+ jobTypes?: Record<string, JobTypeConfig>;
750
+ /** CTA button configuration */
751
+ ctaButton?: LiveActivityCTAConfig;
752
+ }
753
+
519
754
  // ============================================
520
755
  // Version & Compatibility
521
756
  // ============================================
@@ -523,7 +758,7 @@ export interface LiveActivityPushTokenEvent {
523
758
  /**
524
759
  * SDK version info
525
760
  */
526
- export const SDK_VERSION = '0.2.0';
761
+ export const SDK_VERSION = '0.3.0';
527
762
 
528
763
  /**
529
764
  * Minimum API version required