@growth-labs/cms 0.5.9 → 0.5.10

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.
Files changed (44) hide show
  1. package/README.md +17 -1
  2. package/dist/engine/content-insights.d.ts +11 -4
  3. package/dist/engine/content-insights.d.ts.map +1 -1
  4. package/dist/engine/content-insights.js +22 -7
  5. package/dist/engine/content-insights.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/routes/content-insights.d.ts +1 -1
  11. package/dist/routes/content-insights.d.ts.map +1 -1
  12. package/dist/routes/content-insights.js +20 -5
  13. package/dist/routes/content-insights.js.map +1 -1
  14. package/dist/schema/index.d.ts +1 -0
  15. package/dist/schema/index.d.ts.map +1 -1
  16. package/dist/schema/index.js +1 -0
  17. package/dist/schema/index.js.map +1 -1
  18. package/dist/schema/insights-ingest.d.ts +48 -48
  19. package/dist/schema/migrations.d.ts.map +1 -1
  20. package/dist/schema/migrations.js +9 -0
  21. package/dist/schema/migrations.js.map +1 -1
  22. package/dist/schema/types.d.ts +67 -0
  23. package/dist/schema/types.d.ts.map +1 -1
  24. package/dist/schema/types.js +10 -0
  25. package/dist/schema/types.js.map +1 -1
  26. package/dist/surveys/schema.d.ts +48 -48
  27. package/dist/ui/screens/ContentInsightsScreen.d.ts +28 -0
  28. package/dist/ui/screens/ContentInsightsScreen.d.ts.map +1 -1
  29. package/dist/ui/screens/ContentInsightsScreen.js +111 -36
  30. package/dist/ui/screens/ContentInsightsScreen.js.map +1 -1
  31. package/dist/ui/screens/content-insights-data.d.ts +13 -1
  32. package/dist/ui/screens/content-insights-data.d.ts.map +1 -1
  33. package/dist/ui/screens/content-insights-data.js +29 -1
  34. package/dist/ui/screens/content-insights-data.js.map +1 -1
  35. package/migrations/0022_content_insight_dismissal_reasons.sql +8 -0
  36. package/package.json +1 -1
  37. package/src/engine/content-insights.ts +32 -7
  38. package/src/index.ts +2 -0
  39. package/src/routes/content-insights.ts +31 -5
  40. package/src/schema/index.ts +1 -0
  41. package/src/schema/migrations.ts +9 -0
  42. package/src/schema/types.ts +92 -0
  43. package/src/ui/screens/ContentInsightsScreen.tsx +416 -195
  44. package/src/ui/screens/content-insights-data.ts +40 -2
@@ -9,6 +9,8 @@
9
9
  // Nullability: a column declared NOT NULL maps to a required, non-nullable
10
10
  // field; a nullable column maps to `T | null` (D1 returns SQL NULL as JS null).
11
11
 
12
+ import { z } from 'zod'
13
+
12
14
  /** content_items.type CHECK domain. */
13
15
  export type ContentType = 'article' | 'video' | 'podcast' | 'newsletter' | 'page'
14
16
 
@@ -417,6 +419,60 @@ export type InsightRunStatus = 'running' | 'completed' | 'partial' | 'failed'
417
419
  /** Beat facet — secondary topical facet (geographic theater lives in desk). */
418
420
  export type InsightBeat = 'defense' | 'intelligence' | 'diplomacy' | 'analysis'
419
421
 
422
+ /** Insight Engine v2 editorial action lane. */
423
+ export type InsightLane = 'commission' | 'refresh' | 'optimize-ctr' | 'consolidate' | 'monitor'
424
+
425
+ /** Bounded scoring inputs carried with Insight Engine v2 evidence. */
426
+ export interface InsightScoreBreakdown {
427
+ actualCtr: number
428
+ expectedCtr: number
429
+ expectedClicksGain: number
430
+ laneWeight: number
431
+ score: number
432
+ targetPosition: number
433
+ topicalFit: number
434
+ winnabilityPrior: number
435
+ }
436
+
437
+ export type InsightJudgeReasonCode =
438
+ | 'no_coherent_intent'
439
+ | 'navigational_or_entity_locked'
440
+ | 'off_topic'
441
+ | 'already_covered'
442
+ | 'unwinnable'
443
+ | 'unsustainable_format'
444
+ | 'too_thin'
445
+ | 'accept'
446
+
447
+ export type InsightJudgeVerdict = 'accept' | 'reject' | 'abstain'
448
+
449
+ export interface InsightWinnabilityEvidence {
450
+ verdict: InsightJudgeVerdict
451
+ confidence: number
452
+ serp_summary: string
453
+ }
454
+
455
+ export interface InsightJudgeEvidence {
456
+ verdict: InsightJudgeVerdict
457
+ reason_code: InsightJudgeReasonCode
458
+ confidence: number
459
+ intent_statement: string
460
+ winnability?: InsightWinnabilityEvidence
461
+ }
462
+
463
+ export interface InsightSemanticEvidence {
464
+ topicalFit: number
465
+ disposition: 'reject' | 'judge_only' | 'advance'
466
+ coverageSimilarity: number
467
+ coverageAligned: boolean
468
+ sharedConcepts: number
469
+ nearest: Array<{
470
+ title: string
471
+ slug: string
472
+ similarity: number
473
+ }>
474
+ }
475
+
420
476
  /** Demand evidence chip (signal_type='demand'): the real GSC metric. */
421
477
  export interface InsightEvidenceDemand {
422
478
  query: string
@@ -428,6 +484,12 @@ export interface InsightEvidenceDemand {
428
484
  position: number
429
485
  /** Impression delta vs the prior window (signed). */
430
486
  trend: number
487
+ lane?: InsightLane
488
+ coveredBy?: string | null
489
+ coverageSource?: 'page_join' | 'semantic' | 'lexical' | null
490
+ scoreBreakdown?: InsightScoreBreakdown
491
+ judge?: InsightJudgeEvidence
492
+ semantic?: InsightSemanticEvidence
431
493
  }
432
494
 
433
495
  /** Opportunity evidence chip (signal_type='opportunity'): validated-research basis. */
@@ -436,6 +498,10 @@ export interface InsightEvidenceOpportunity {
436
498
  basis: string
437
499
  /** Count of cite-or-cut validated sources backing the idea. */
438
500
  source_count: number
501
+ lane?: InsightLane
502
+ scoreBreakdown?: InsightScoreBreakdown
503
+ judge?: InsightJudgeEvidence
504
+ semantic?: InsightSemanticEvidence
439
505
  }
440
506
 
441
507
  /** content_insights.evidence — JSON stored as TEXT NOT NULL, zod-validated. */
@@ -463,6 +529,16 @@ export interface InsightBrief {
463
529
  spokes: string[]
464
530
  }
465
531
  sources: Array<{ title: string; url: string }>
532
+ format?: 'cornerstone' | 'pillar' | 'standalone'
533
+ content_outline?: Array<{
534
+ question: string
535
+ demand?: {
536
+ query: string
537
+ impressions: number
538
+ position: number
539
+ trend: number
540
+ }
541
+ }>
466
542
  /**
467
543
  * Which open-web discovery STREAM produced this opportunity row (the theater
468
544
  * split): 'competitor' (RSS competitor-watch) vs 'audience_question' (Google
@@ -532,12 +608,28 @@ export interface ContentInsightRunRow {
532
608
  error: string | null
533
609
  }
534
610
 
611
+ /** Editor-owned dismissal taxonomy (migration 0022). */
612
+ export const InsightDismissalReasonCodeSchema = z.enum([
613
+ 'off_topic',
614
+ 'already_covered',
615
+ 'cant_win',
616
+ 'wrong_format',
617
+ 'not_now',
618
+ 'other',
619
+ ])
620
+
621
+ export type InsightDismissalReasonCode = z.infer<typeof InsightDismissalReasonCodeSchema>
622
+
535
623
  /** A content_insight_dismissals row (PK (site_id, intent_key)). */
536
624
  export interface ContentInsightDismissalRow {
537
625
  site_id: string
538
626
  intent_key: string
539
627
  dismissed_at: number
540
628
  dismissed_by: string | null
629
+ /** NULL is a pre-0022 legacy dismissal. */
630
+ reason_code: InsightDismissalReasonCode | null
631
+ /** NULL is either legacy or an editor dismissal without a note. */
632
+ note: string | null
541
633
  }
542
634
 
543
635
  export type ContentPublicationOperation = 'publish' | 'rollback'