@flamingo-stack/openframe-frontend-core 0.0.829 → 0.0.831

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 (135) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/{case-study-card-QMFGPABF.cjs → case-study-card-TK7ZCNLM.cjs} +5 -5
  3. package/dist/{chunk-LKP5R3EQ.cjs → chunk-46LATWQR.cjs} +2 -2
  4. package/dist/{chunk-IBD2FPSX.cjs → chunk-4JHO2NVI.cjs} +2 -2
  5. package/dist/{chunk-3B6ZE4EZ.cjs → chunk-5L3UKDC6.cjs} +16 -16
  6. package/dist/{chunk-THPAGFT6.cjs → chunk-7COZUANC.cjs} +60 -69
  7. package/dist/{chunk-DWSU35QQ.cjs → chunk-7WQD3R5J.cjs} +84 -84
  8. package/dist/{chunk-DAKGX2WF.cjs → chunk-APNONOHY.cjs} +2 -2
  9. package/dist/{chunk-KPGKTEEB.cjs → chunk-BUEEQD3G.cjs} +2 -2
  10. package/dist/{chunk-YMLRDVPO.cjs → chunk-C4OQIYGW.cjs} +11 -11
  11. package/dist/{chunk-IFLGIBFZ.cjs → chunk-CP46CVUC.cjs} +91 -91
  12. package/dist/{chunk-UO6F6LLI.cjs → chunk-D6ZSRGH2.cjs} +699 -642
  13. package/dist/{chunk-UE5ZBCJ4.cjs → chunk-DAQMCWCK.cjs} +3 -3
  14. package/dist/{chunk-MFYSV7DE.cjs → chunk-EYSIQORA.cjs} +94 -94
  15. package/dist/{chunk-DU6AF77X.cjs → chunk-FNNDGOR3.cjs} +33 -33
  16. package/dist/{chunk-OKTNRGM5.cjs → chunk-GPXKG34G.cjs} +54 -54
  17. package/dist/{chunk-FMSAN6SR.cjs → chunk-H3WTYAVR.cjs} +129 -129
  18. package/dist/{chunk-HMC2IWV4.cjs → chunk-HDLY6OMQ.cjs} +6 -6
  19. package/dist/{chunk-2VLPXUQK.cjs → chunk-HLJXCOMA.cjs} +4 -4
  20. package/dist/{chunk-PBHP3FHO.cjs → chunk-JBTH3O2C.cjs} +4 -4
  21. package/dist/{chunk-2HQNXX2K.cjs → chunk-JQCQCE6U.cjs} +2 -2
  22. package/dist/{chunk-AY6XJOIN.cjs → chunk-LWMWY3JO.cjs} +45 -45
  23. package/dist/{chunk-R3PKAIX3.cjs → chunk-OGPAVRNF.cjs} +17 -17
  24. package/dist/{chunk-4DUVTJ6A.cjs → chunk-P5DWAVWK.cjs} +28 -28
  25. package/dist/{chunk-4ZIKDOPY.cjs → chunk-QHBKZJ6A.cjs} +4 -4
  26. package/dist/{chunk-PRZAEPGG.cjs → chunk-R6QZHOJB.cjs} +46 -46
  27. package/dist/{chunk-F2J5WN6U.cjs → chunk-SOCCHWDK.cjs} +2 -2
  28. package/dist/{chunk-IMDYB77M.cjs → chunk-SRHHLDBP.cjs} +36 -36
  29. package/dist/{chunk-7PZQ7SHB.cjs → chunk-SWMUW3RR.cjs} +18 -18
  30. package/dist/{chunk-6GPMVHJN.cjs → chunk-TD4CC4KV.cjs} +20 -20
  31. package/dist/{chunk-6WNSZ5XP.cjs → chunk-UGM3YDCK.cjs} +25 -25
  32. package/dist/{chunk-AH4YWTWZ.cjs → chunk-UQS2RI5Y.cjs} +12 -12
  33. package/dist/{chunk-IHRMX3X6.cjs → chunk-VBGBKRDO.cjs} +684 -661
  34. package/dist/{chunk-YHQDB5QJ.cjs → chunk-VQG2A7GA.cjs} +2 -2
  35. package/dist/{chunk-S6UJEW4G.cjs → chunk-WCOSGDGA.cjs} +2 -2
  36. package/dist/{chunk-ENMPSEEQ.cjs → chunk-WVNUCKB7.cjs} +4 -4
  37. package/dist/{chunk-LNXRTVOY.cjs → chunk-X76TZ5YR.cjs} +21 -21
  38. package/dist/{chunk-IBQ3CSKL.cjs → chunk-X7VQM5TU.cjs} +6 -6
  39. package/dist/{chunk-BIG3O33P.cjs → chunk-YJZ7R3W5.cjs} +28 -2
  40. package/dist/{chunk-W4VEDSAX.cjs → chunk-ZABZIM2Y.cjs} +6 -6
  41. package/dist/{chunk-ZJXLNIWC.cjs → chunk-ZJ5K6XHW.cjs} +21 -21
  42. package/dist/{cloud-tenants-YVCSVVIS.cjs → cloud-tenants-E2AC4WEJ.cjs} +20 -20
  43. package/dist/components/case-studies/index.cjs +36 -36
  44. package/dist/components/chat/embeddable-chat.d.ts +3 -3
  45. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  46. package/dist/components/chat/embeddable-chat.js +21 -14
  47. package/dist/components/chat/guide-welcome.d.ts +5 -16
  48. package/dist/components/chat/guide-welcome.d.ts.map +1 -1
  49. package/dist/components/chat/guide-welcome.js +4 -29
  50. package/dist/components/chat/index.cjs +19 -15
  51. package/dist/components/chat/mingo-quick-action-wall.d.ts +42 -16
  52. package/dist/components/chat/mingo-quick-action-wall.d.ts.map +1 -1
  53. package/dist/components/chat/mingo-quick-action-wall.js +105 -19
  54. package/dist/components/chat/mingo-welcome.d.ts +6 -13
  55. package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
  56. package/dist/components/chat/mingo-welcome.js +5 -9
  57. package/dist/components/chat/quick-action-chip.d.ts +8 -2
  58. package/dist/components/chat/quick-action-chip.d.ts.map +1 -1
  59. package/dist/components/chat/quick-action-chip.js +18 -8
  60. package/dist/components/chat/utils/icon-registry.d.ts +2 -2
  61. package/dist/components/chat/utils/icon-registry.js +2 -2
  62. package/dist/components/contact/index.cjs +21 -21
  63. package/dist/components/docs/index.cjs +24 -24
  64. package/dist/components/embeds/index.cjs +21 -21
  65. package/dist/components/faq/index.cjs +22 -22
  66. package/dist/components/features/index.cjs +22 -20
  67. package/dist/components/features/notifications/index.d.ts +3 -1
  68. package/dist/components/features/notifications/index.d.ts.map +1 -1
  69. package/dist/components/features/notifications/index.js +2 -0
  70. package/dist/components/features/notifications/notification-category-icon.d.ts +7 -0
  71. package/dist/components/features/notifications/notification-category-icon.d.ts.map +1 -0
  72. package/dist/components/features/notifications/notification-category-icon.js +26 -0
  73. package/dist/components/features/notifications/notification-tile.d.ts.map +1 -1
  74. package/dist/components/features/notifications/types.d.ts +1 -1
  75. package/dist/components/features/notifications/types.d.ts.map +1 -1
  76. package/dist/components/help-center-pages/index.cjs +125 -125
  77. package/dist/components/index.cjs +90 -82
  78. package/dist/components/meeting-scheduler/index.cjs +69 -69
  79. package/dist/components/navigation/index.cjs +23 -23
  80. package/dist/components/navigation/site-footer.d.ts.map +1 -1
  81. package/dist/components/navigation/site-footer.js +2 -12
  82. package/dist/components/onboarding-guides/index.cjs +23 -23
  83. package/dist/components/product-demo/index.cjs +31 -31
  84. package/dist/components/related-content/index.cjs +9 -9
  85. package/dist/components/social-icon-row.d.ts +6 -2
  86. package/dist/components/social-icon-row.d.ts.map +1 -1
  87. package/dist/components/social-icon-row.js +5 -6
  88. package/dist/components/tickets/index.cjs +27 -27
  89. package/dist/components/ui/actions-menu.d.ts.map +1 -1
  90. package/dist/components/ui/actions-menu.js +27 -1
  91. package/dist/components/ui/index.cjs +24 -20
  92. package/dist/{devices-AW6BERJF.cjs → devices-CAYUGD2N.cjs} +21 -21
  93. package/dist/{embeddable-chat-ZJIOMMSA.cjs → embeddable-chat-FYHMR66R.cjs} +121 -114
  94. package/dist/hooks/index.cjs +7 -7
  95. package/dist/index.cjs +31 -25
  96. package/dist/{knowledge-PEOXTIVS.cjs → knowledge-OI4OPEVL.cjs} +21 -21
  97. package/dist/{logs-CYA7H4KM.cjs → logs-B3XV2NHV.cjs} +27 -27
  98. package/dist/platform-domains.cjs +4 -0
  99. package/dist/platform-domains.d.ts +2 -0
  100. package/dist/platform-domains.d.ts.map +1 -1
  101. package/dist/platform-domains.js +4 -0
  102. package/dist/{policies-M6QSFL5G.cjs → policies-ZB4Z42DV.cjs} +24 -24
  103. package/dist/{remote-session-QGFG5WAL.cjs → remote-session-CN3G7JNR.cjs} +7 -7
  104. package/dist/{scripts-Y46ECDDP.cjs → scripts-I4DNUOQC.cjs} +27 -27
  105. package/dist/{software-update-OTC2DGQZ.cjs → software-update-AWH4WXOH.cjs} +24 -24
  106. package/dist/{tickets-board-KCH6ITUV.cjs → tickets-board-PLYD2NSY.cjs} +11 -11
  107. package/dist/types/marketing.d.ts +61 -216
  108. package/dist/types/marketing.d.ts.map +1 -1
  109. package/dist/utils/index.cjs +2 -2
  110. package/dist/utils/notifications.cjs +55 -0
  111. package/dist/utils/notifications.d.ts +29 -0
  112. package/dist/utils/notifications.d.ts.map +1 -0
  113. package/dist/utils/notifications.js +53 -0
  114. package/dist/utils/social-platforms.d.ts +9 -9
  115. package/dist/utils/social-platforms.d.ts.map +1 -1
  116. package/package.json +7 -1
  117. package/src/components/chat/embeddable-chat.tsx +29 -45
  118. package/src/components/chat/guide-welcome.tsx +12 -57
  119. package/src/components/chat/mingo-quick-action-wall.tsx +166 -31
  120. package/src/components/chat/mingo-welcome.tsx +16 -35
  121. package/src/components/chat/quick-action-chip.tsx +32 -8
  122. package/src/components/chat/utils/icon-registry.ts +5 -5
  123. package/src/components/chat/utils/index.ts +1 -1
  124. package/src/components/features/notifications/index.ts +2 -1
  125. package/src/components/features/notifications/notification-category-icon.tsx +38 -0
  126. package/src/components/features/notifications/notification-tile.tsx +2 -1
  127. package/src/components/features/notifications/types.ts +1 -2
  128. package/src/components/navigation/site-footer.tsx +2 -11
  129. package/src/components/social-icon-row.tsx +11 -10
  130. package/src/components/ui/actions-menu.tsx +35 -1
  131. package/src/platform-domains.ts +5 -0
  132. package/src/types/marketing.ts +90 -268
  133. package/src/utils/index.ts +1 -1
  134. package/src/utils/notifications.ts +71 -0
  135. package/src/utils/social-platforms.ts +9 -9
@@ -1,13 +1,15 @@
1
1
  'use client';
2
2
 
3
3
  import { createElement } from 'react';
4
+ import type { NavLink } from '../types/navigation';
4
5
  import { normalizeSocialPlatform, type SocialIconLink } from '../utils/social-platforms';
5
6
  import { iconOf, type IconComponent, type IconRef } from './chat/utils/icon-loading';
6
7
  import { Button } from './ui/button';
7
8
 
8
9
  interface SocialIconRowProps {
9
10
  className?: string;
10
- links?: SocialIconLink[];
11
+ /** The links to draw: a person's profiles, or a site's own (`siteNavSocialLinks`). */
12
+ links: SocialIconLink[];
11
13
  variant?: 'accent' | 'outline' | 'transparent' | 'destructive' | null | undefined;
12
14
  /** Quiet metadata row for page-level identity/share slots: 32px ghost
13
15
  * icon buttons (size="icon-sm", 16px glyphs), gap-2, w-fit container,
@@ -22,16 +24,15 @@ interface SocialIconRowProps {
22
24
  groupByVisibility?: boolean;
23
25
  /**
24
26
  * The links are a read list (a person's profiles, whose number is the data's): every button carries
25
- * `data-loading-item`, as the caller's loading state's buttons do. Default false (a fixed set, e.g. the defaults).
27
+ * `data-loading-item`, as the caller's loading state's buttons do. Default false (a fixed set, e.g. a site's own).
26
28
  */
27
29
  listItems?: boolean;
28
30
  }
29
31
 
30
- const defaultLinks: SocialIconLink[] = [
31
- { platform: 'github', href: 'https://github.com/flamingo-stack', label: 'GitHub' },
32
- { platform: 'linkedin', href: 'https://linkedin.com/company/flamingo.run', label: 'LinkedIn' },
33
- { platform: 'facebook', href: 'https://www.facebook.com/flamingoai.msp', label: 'Facebook' },
34
- ];
32
+ /** A site's social links as a row draws them: the `brand.social` links of its navigation (the header and the footer read the same list). */
33
+ export function siteNavSocialLinks(social: readonly NavLink[]): SocialIconLink[] {
34
+ return social.map(link => ({ platform: link.iconName ?? link.id, href: link.href, label: link.label }));
35
+ }
35
36
 
36
37
  /** The colour a social mark is drawn in: the themed foreground, so a row reads as one set. */
37
38
  const MARK = 'var(--color-text-primary)';
@@ -40,10 +41,10 @@ const MARK = 'var(--color-text-primary)';
40
41
  * Platform name → the icon it draws, as DATA: the icon is loaded when a link to
41
42
  * that platform is drawn, so a row fetches only the marks of its own links. The
42
43
  * ONLY thing about a social platform that lives in code; the DB names the glyph
43
- * it wants through `social_platforms.icon_name`.
44
+ * it wants through `channel_platforms.icon_name`.
44
45
  *
45
46
  * Deliberately an OPEN record, not `satisfies Record<SomeUnion, …>`: the set of
46
- * platforms is the `social_platforms` table's to decide, and a row added there
47
+ * platforms is the `channel_platforms` table's to decide, and a row added there
47
48
  * must render — with the globe, until somebody adds art for it — rather than
48
49
  * fail to type-check against a list in this file.
49
50
  */
@@ -94,7 +95,7 @@ export function socialIconButtonProps(compact = false): { size: 'icon-sm' | 'ico
94
95
 
95
96
  export function SocialIconRow({
96
97
  className = '',
97
- links = defaultLinks,
98
+ links,
98
99
  variant,
99
100
  compact = false,
100
101
  groupByVisibility = false,
@@ -190,7 +190,7 @@ const MenuItem: React.FC<MenuItemProps> = ({ item, onItemClick }) => {
190
190
  ROW_CLASSES,
191
191
  item.disabled
192
192
  ? 'pointer-events-none cursor-not-allowed text-ods-text-secondary opacity-60'
193
- : 'text-ods-text-primary hover:bg-ods-bg-hover',
193
+ : 'text-ods-text-primary hover:bg-ods-bg-hover focus-visible:bg-ods-bg-hover',
194
194
  );
195
195
 
196
196
  const subTriggerClasses = cn(itemClasses, 'focus:bg-ods-bg-hover data-[state=open]:bg-ods-bg-active');
@@ -306,6 +306,20 @@ const MenuItem: React.FC<MenuItemProps> = ({ item, onItemClick }) => {
306
306
  );
307
307
  };
308
308
 
309
+ /** The rows a keyboard moves between in an open menu: every enabled `menuitem` (plain, radio, submenu trigger). */
310
+ function menuRows(content: HTMLElement | null): HTMLElement[] {
311
+ if (!content) return [];
312
+ return [...content.querySelectorAll<HTMLElement>('[role^="menuitem"]:not([aria-disabled="true"])')];
313
+ }
314
+
315
+ /** The menu-button keys (WAI-ARIA APG, "Menu Button"): ↓/↑ move between rows (wrapping), Home/End jump to the ends. */
316
+ const MENU_ROW_KEYS: Record<string, (index: number, count: number) => number> = {
317
+ ArrowDown: (index, count) => (index + 1) % count,
318
+ ArrowUp: (index, count) => (index - 1 + count) % count,
319
+ Home: () => 0,
320
+ End: (_index, count) => count - 1,
321
+ };
322
+
309
323
  const GroupSeparator: React.FC = () => <div className="h-[3px] w-full bg-ods-bg-surface" />;
310
324
 
311
325
  export const ActionsMenu: React.FC<ActionsMenuProps> = ({ groups, className = '', onItemClick, header }) => {
@@ -407,6 +421,14 @@ export const ActionsMenuDropdown: React.FC<ActionsMenuDropdownProps> = ({
407
421
  // momentum and the ~1px settle after opening don't close the menu the
408
422
  // user is reaching for.
409
423
  const triggerRef = React.useRef<HTMLButtonElement | null>(null);
424
+ const contentRef = React.useRef<HTMLDivElement | null>(null);
425
+ // On open, focus goes to the first row (WAI-ARIA APG, "Menu Button"). The rows are not Radix items, so Radix only
426
+ // focuses the menu itself; one frame later, once it has, the first row takes focus.
427
+ React.useEffect(() => {
428
+ if (!open) return undefined;
429
+ const frame = requestAnimationFrame(() => menuRows(contentRef.current)[0]?.focus());
430
+ return () => cancelAnimationFrame(frame);
431
+ }, [open]);
410
432
  React.useEffect(() => {
411
433
  if (!open) return undefined;
412
434
  if (typeof document === 'undefined') return undefined;
@@ -461,9 +483,21 @@ export const ActionsMenuDropdown: React.FC<ActionsMenuDropdownProps> = ({
461
483
  {triggerNode}
462
484
  </DropdownMenuTrigger>
463
485
  <DropdownMenuContent
486
+ ref={contentRef}
464
487
  align={align}
465
488
  side={side}
466
489
  sideOffset={sideOffset}
490
+ // The rows are this menu's own, not Radix items, so Radix does not move between them: the menu-button
491
+ // pattern's keys are done here, and the first row takes focus on open (the effect above).
492
+ onKeyDown={event => {
493
+ const move = MENU_ROW_KEYS[event.key];
494
+ if (!move) return;
495
+ const rows = menuRows(contentRef.current);
496
+ if (rows.length === 0) return;
497
+ event.preventDefault();
498
+ const current = rows.indexOf(document.activeElement as HTMLElement);
499
+ rows[move(Math.max(current, 0), rows.length)]?.focus();
500
+ }}
467
501
  onCloseAutoFocus={onCloseAutoFocus}
468
502
  className={cn('overflow-visible border-0 bg-transparent p-0 shadow-none', contentClassName)}
469
503
  >
@@ -297,6 +297,11 @@ export function isPreviewEnv(): boolean {
297
297
  return process.env.VERCEL_ENV === 'preview';
298
298
  }
299
299
 
300
+ /** Env-form production predicate (Vercel `VERCEL_ENV`): the production deployment, not a preview, not a local run. */
301
+ export function isProductionEnv(env: Record<string, string | undefined> = process.env): boolean {
302
+ return env.VERCEL_ENV === 'production';
303
+ }
304
+
300
305
  /** Host-form preview predicate (a `*.vercel.app` host). Dot-bounded suffix so a
301
306
  * malicious `foo.vercel.app.evil.com` is NOT treated as preview. */
302
307
  export function isPreviewHost(hostname: string): boolean {
@@ -1,66 +1,74 @@
1
1
  /**
2
2
  * Marketing Campaign Types
3
3
  *
4
- * Types for the Marketing AI system including campaigns, content, media,
5
- * social accounts, scheduled posts, and usage tracking.
4
+ * The rows of the marketing tables as the database holds them (`marketing_campaigns`, `ai_content`, `ai_media`),
5
+ * column for column, and the vocabularies their check constraints allow. A type here names no column the table
6
+ * does not have.
6
7
  */
7
8
 
8
9
  // =============================================================================
9
- // Core Campaign Types
10
+ // Campaign Types
10
11
  // =============================================================================
11
12
 
13
+ /** `marketing_campaigns.status` (its check constraint). */
14
+ export type CampaignStatus = 'draft' | 'active' | 'completed';
15
+
16
+ /** What a campaign is about (`marketing_campaigns.content_source`). */
17
+ export interface CampaignContentSource {
18
+ type: ContentSourceType | null;
19
+ /** The source record; absent for a campaign written from scratch. */
20
+ id?: number | string | null;
21
+ url?: string | null;
22
+ /** The blog a seed-blog campaign writes its article for. */
23
+ blog_account_id?: number | null;
24
+ }
25
+
12
26
  export interface MarketingCampaign {
13
27
  id: number;
14
28
  name: string;
15
- description: string | null; // Optional - ONLY used for blog_post + new mode OR from_scratch
16
- platform: string;
29
+ description: string | null;
17
30
  start_date: string | null;
18
- end_date: string | null;
19
- goals: string[] | null; // Optional - ONLY used for blog_post + new mode OR from_scratch
20
- // NEW: Content seed fields
21
- content_source_type?: 'product_release' | 'blog_post' | 'case_study' | 'from_scratch' | null;
22
- content_source_id?: number | null;
23
- content_source_url?: string | null;
24
- future_blog_social_account_id?: number | null; // For blog_post + new mode - target account for AI-generated blog
31
+ goals: string[] | null;
32
+ status: CampaignStatus;
33
+ content_source: CampaignContentSource | null;
34
+ /** The accounts the campaign writes for, each with what to generate (the hub's own shape). */
35
+ selected_accounts: unknown[] | null;
36
+ settings: Record<string, unknown> | null;
37
+ strategy_settings: Record<string, unknown> | null;
38
+ copy_settings: Record<string, unknown> | null;
39
+ image_settings: Record<string, unknown> | null;
40
+ video_settings: Record<string, unknown> | null;
41
+ details_feedback: unknown;
42
+ copy_feedback: unknown;
43
+ image_feedback: unknown;
44
+ video_feedback: unknown;
45
+ designer_feedback: unknown;
46
+ strategy_feedback: unknown;
25
47
  /** Editor-provided AI generation instructions (steers Generate Content / Image / Video / Workflow prompts) */
26
- custom_instructions?: string | null;
48
+ custom_instructions: string | null;
49
+ ai_effort_score: number | null;
27
50
  created_by: string;
28
51
  created_at: string;
29
52
  updated_at: string;
30
53
  }
31
54
 
32
- export interface CreateCampaignInput {
33
- name: string;
34
- description?: string; // Optional - ONLY for blog_post + new mode OR from_scratch
35
- start_date?: string;
36
- goals?: string[]; // Optional - ONLY for blog_post + new mode OR from_scratch
37
- // NEW: Content seed fields
38
- content_source_type?: 'product_release' | 'blog_post' | 'case_study' | 'from_scratch';
39
- content_source_id?: number;
40
- content_source_url?: string;
41
- future_blog_social_account_id?: number; // For blog_post + new mode - target account for AI-generated blog
42
- custom_instructions?: string | null;
43
- }
44
-
45
- export interface UpdateCampaignInput {
46
- name?: string;
47
- description?: string; // Optional - ONLY for blog_post + new mode OR from_scratch
48
- start_date?: string;
49
- goals?: string[]; // Optional - ONLY for blog_post + new mode OR from_scratch
50
- // NEW: Content seed fields
51
- content_source_type?: 'product_release' | 'blog_post' | 'case_study' | 'from_scratch' | null;
52
- content_source_id?: number | null;
53
- content_source_url?: string | null;
54
- future_blog_social_account_id?: number | null; // For blog_post + new mode - target account for AI-generated blog
55
- custom_instructions?: string | null;
56
- }
57
-
58
55
  // =============================================================================
59
56
  // AI Content Types
60
57
  // =============================================================================
61
58
 
62
- export type ContentType = 'blog_post' | 'social_post' | 'ad_copy' | 'email';
63
- export type ContentStatus = 'draft' | 'pending_approval' | 'approved' | 'rejected' | 'published';
59
+ /** `ai_content.content_type` (its check constraint). */
60
+ export type ContentType = 'blog_post' | 'channel_post' | 'ad_copy' | 'email' | 'video_script';
61
+
62
+ /** `ai_content.status` and `ai_media.status` (their check constraints). */
63
+ export type ContentStatus =
64
+ | 'generating'
65
+ | 'draft'
66
+ | 'pending_review'
67
+ | 'pending_approval'
68
+ | 'approved'
69
+ | 'rejected'
70
+ | 'revision_requested'
71
+ | 'published';
64
72
 
65
73
  export interface AIContent {
66
74
  id: number;
@@ -69,40 +77,23 @@ export interface AIContent {
69
77
  title: string | null;
70
78
  content: string;
71
79
  prompt_used: string | null;
72
- ai_model: string;
73
- generation_tokens: number | null;
74
- cost_cents: number | null;
75
- confidence_score: number | null;
80
+ ai_provider: 'anthropic' | 'openai' | null;
81
+ ai_model: string | null;
76
82
  metadata: Record<string, unknown> | null;
77
83
  status: ContentStatus;
78
- reviewed_by: string | null;
79
- reviewed_at: string | null;
80
- platform?: string; // Optional - legacy field, use social_account_id instead
81
- social_account_id: number | null; // FK to social_accounts table - primary source of truth
82
- created_at: string;
83
- updated_at: string;
84
- // Publishing & Override fields
85
84
  selected_for_publish: boolean;
86
- override_url: string | null;
87
- override_at: string | null;
88
- override_by: string | null;
89
- // NEW: URL injection preference (per-item control)
90
- url_injection_preference?: 'none' | 'in_post' | 'as_comment';
91
- // NEW: External comment ID tracking (for 'as_comment' mode)
85
+ blog_post_id: number | null;
86
+ workflow_id: string | null;
87
+ /** The distribution channel the post is written for. */
88
+ distribution_channel_id: number | null;
89
+ published_at: string | null;
90
+ external_post_id: string | null;
91
+ external_post_url: string | null;
92
+ url_injection_preference?: URLInjectionPreference;
93
+ /** The comment that carries the link, when the link went `as_comment`. */
92
94
  external_comment_id?: string | null;
93
- }
94
-
95
- export interface CreateAIContentInput {
96
- campaign_id?: number;
97
- content_type: ContentType;
98
- title?: string;
99
- content: string;
100
- prompt_used?: string;
101
- ai_model: string;
102
- generation_tokens?: number;
103
- cost_cents?: number;
104
- confidence_score?: number;
105
- metadata?: Record<string, unknown>;
95
+ created_at: string;
96
+ updated_at: string;
106
97
  }
107
98
 
108
99
  // =============================================================================
@@ -111,6 +102,8 @@ export interface CreateAIContentInput {
111
102
 
112
103
  /** Row union. Compare through `utils/media-type` (`isVideoMedia` / `isImageMedia` / `MEDIA_TYPE`), never a literal. */
113
104
  export type MediaType = 'image' | 'video' | 'figma_export';
105
+
106
+ /** `ai_media.provider` (its check constraint). */
114
107
  export type MediaProvider =
115
108
  | 'dalle'
116
109
  | 'dalle-3'
@@ -119,17 +112,31 @@ export type MediaProvider =
119
112
  | 'figma'
120
113
  | 'manual'
121
114
  | 'midjourney'
115
+ | 'flux-2-pro'
122
116
  | 'flux-pro'
123
117
  | 'flux-dev'
118
+ | 'flux-schnell'
124
119
  | 'ideogram-v2'
120
+ | 'ideogram-v3-turbo'
125
121
  | 'recraft-v3'
122
+ | 'imagen-4'
123
+ | 'nano-banana-pro'
124
+ | 'seedream-4.5'
125
+ | 'sd-3.5-large'
126
+ | 'veo-3-fast'
127
+ | 'veo-3'
126
128
  | 'kling-v2.5'
127
129
  | 'luma-ray2'
130
+ | 'pixverse-v5'
131
+ | 'mochi-1'
132
+ | 'cogvideox-t2v'
133
+ | 'cogvideox-i2v'
128
134
  | 'hailuo'
135
+ | 'wan-2.5'
129
136
  | 'ltx-video'
130
137
  | 'stable-video-diffusion';
131
- export type MediaStatus =
132
- 'draft' | 'pending_review' | 'pending_approval' | 'approved' | 'rejected' | 'published' | 'generating';
138
+
139
+ export type MediaStatus = ContentStatus;
133
140
 
134
141
  export interface AIMedia {
135
142
  id: number;
@@ -140,28 +147,19 @@ export interface AIMedia {
140
147
  prompt_used: string | null;
141
148
  provider: MediaProvider;
142
149
  model_version: string | null;
143
- cost_cents: number | null;
144
- storage_path: string | null;
145
150
  storage_url: string | null;
146
151
  thumbnail_url: string | null;
147
152
  dimensions: MediaDimensions | null;
148
153
  file_size_bytes: number | null;
149
154
  status: MediaStatus;
150
- figma_file_id: string | null;
151
- figma_node_id: string | null;
152
- reviewed_by: string | null;
153
- reviewed_at: string | null;
154
155
  metadata: Record<string, unknown> | null;
155
- platform?: string; // Optional - legacy field, use social_account_id instead
156
- social_account_id: number | null; // FK to social_accounts table - primary source of truth
156
+ workflow_id: string | null;
157
+ /** The distribution channel the media is made for. NOTE: there is no `selected_for_publish` on media — a media
158
+ * item is "selected" by being ATTACHED to a post that is selected (`ai_content_media`). */
159
+ distribution_channel_id: number | null;
160
+ published_at: string | null;
157
161
  created_at: string;
158
162
  updated_at: string;
159
- // Override fields. NOTE: there is no `selected_for_publish` on media — a
160
- // media item is "selected" by being ATTACHED to a post that is selected
161
- // (`ai_content_media`); consumers derive the flag in their DAL.
162
- override_url: string | null;
163
- override_at: string | null;
164
- override_by: string | null;
165
163
  }
166
164
 
167
165
  export interface MediaDimensions {
@@ -170,186 +168,6 @@ export interface MediaDimensions {
170
168
  aspectRatio?: string; // e.g., "16:9", "9:16", "1:1"
171
169
  }
172
170
 
173
- export interface CreateAIMediaInput {
174
- campaign_id?: number;
175
- media_type: MediaType;
176
- title?: string;
177
- description?: string;
178
- prompt_used?: string;
179
- provider: MediaProvider;
180
- model_version?: string;
181
- cost_cents?: number;
182
- storage_path?: string;
183
- storage_url?: string;
184
- thumbnail_url?: string;
185
- dimensions?: MediaDimensions;
186
- file_size_bytes?: number;
187
- figma_file_id?: string;
188
- figma_node_id?: string;
189
- }
190
-
191
- // =============================================================================
192
- // Social Account Types
193
- // =============================================================================
194
-
195
- export type SocialChannel = 'slack' | 'linkedin' | 'facebook' | 'instagram' | 'twitter' | 'youtube';
196
- export type SocialAccountType = 'personal' | 'page' | 'organization' | 'channel';
197
-
198
- export interface SocialAccount {
199
- id: number;
200
- channel: SocialChannel;
201
- account_type: SocialAccountType;
202
- account_name: string;
203
- account_id: string;
204
- platform: string;
205
- access_token_encrypted: string | null;
206
- refresh_token_encrypted: string | null;
207
- token_expires_at: string | null;
208
- permissions: string[] | null;
209
- is_active: boolean;
210
- last_sync_at: string | null;
211
- metadata: Record<string, unknown> | null;
212
- created_at: string;
213
- updated_at: string;
214
- }
215
-
216
- export interface CreateSocialAccountInput {
217
- channel: SocialChannel;
218
- account_type: SocialAccountType;
219
- account_name: string;
220
- account_id: string;
221
- access_token?: string;
222
- refresh_token?: string;
223
- token_expires_at?: string;
224
- permissions?: string[];
225
- metadata?: Record<string, unknown>;
226
- }
227
-
228
- // =============================================================================
229
- // Scheduled Post Types
230
- // =============================================================================
231
-
232
- export type ScheduledPostStatus = 'scheduled' | 'publishing' | 'published' | 'failed' | 'cancelled';
233
-
234
- export interface ScheduledPost {
235
- id: number;
236
- campaign_id: number;
237
- content_id: number | null;
238
- media_ids: number[];
239
- social_account_id: number;
240
- scheduled_at: string;
241
- published_at: string | null;
242
- status: ScheduledPostStatus;
243
- external_post_id: string | null;
244
- external_post_url: string | null;
245
- error_message: string | null;
246
- retry_count: number;
247
- created_by: string | null;
248
- platform: string;
249
- created_at: string;
250
- updated_at: string;
251
- }
252
-
253
- export interface CreateScheduledPostInput {
254
- campaign_id: number;
255
- content_id?: number;
256
- media_ids?: number[];
257
- social_account_id: number;
258
- scheduled_at: string;
259
- created_by?: string;
260
- }
261
-
262
- // =============================================================================
263
- // Content Approval Types
264
- // =============================================================================
265
-
266
- export type ContentApprovalType = 'ai_content' | 'ai_media' | 'campaign';
267
- export type ApprovalStatus = 'pending' | 'approved' | 'rejected' | 'revision_requested';
268
-
269
- export interface ContentApproval {
270
- id: number;
271
- content_type: ContentApprovalType;
272
- content_id: number;
273
- status: ApprovalStatus;
274
- reviewer_id: string | null;
275
- reviewer_notes: string | null;
276
- revision_notes: string | null;
277
- approved_at: string | null;
278
- platform: string;
279
- created_at: string;
280
- }
281
-
282
- export interface CreateContentApprovalInput {
283
- content_type: ContentApprovalType;
284
- content_id: number;
285
- status: ApprovalStatus;
286
- reviewer_id?: string;
287
- reviewer_notes?: string;
288
- revision_notes?: string;
289
- }
290
-
291
- // =============================================================================
292
- // AI Usage Tracking Types
293
- // =============================================================================
294
-
295
- export type AIService = 'anthropic' | 'openai' | 'replicate' | 'figma' | 'google';
296
- export type AIOperation = 'text_generation' | 'image_generation' | 'video_generation' | 'figma_export';
297
-
298
- export interface AIUsage {
299
- id: number;
300
- service: AIService;
301
- operation: AIOperation;
302
- model: string;
303
- input_tokens: number | null;
304
- output_tokens: number | null;
305
- cost_cents: number | null;
306
- user_id: string | null;
307
- content_id: number | null;
308
- media_id: number | null;
309
- platform: string;
310
- created_at: string;
311
- }
312
-
313
- export interface TrackAIUsageInput {
314
- service: AIService;
315
- operation: AIOperation;
316
- model: string;
317
- input_tokens?: number;
318
- output_tokens?: number;
319
- cost_cents?: number;
320
- user_id?: string;
321
- content_id?: number;
322
- media_id?: number;
323
- metadata?: Record<string, unknown>;
324
- }
325
-
326
- // =============================================================================
327
- // Statistics Types
328
- // =============================================================================
329
-
330
- export interface CampaignStats {
331
- totalCampaigns: number;
332
- drafts: number; // Campaigns with 0 workflow runs
333
- active: number; // Campaigns with ≥1 workflow run (not completed)
334
- completed: number; // Campaigns marked as completed
335
- }
336
-
337
- export interface AIUsageSummary {
338
- totalCostCents: number;
339
- totalTokens: number;
340
- byService: Record<string, { cost: number; count: number }>;
341
- }
342
-
343
- // =============================================================================
344
- // Campaign with Related Data
345
- // =============================================================================
346
-
347
- export interface CampaignWithDetails {
348
- campaign: MarketingCampaign;
349
- content: AIContent[];
350
- media: AIMedia[];
351
- }
352
-
353
171
  // =============================================================================
354
172
  // Content Source Types (NEW)
355
173
  // =============================================================================
@@ -373,7 +191,11 @@ export type ContentSourceType =
373
191
  | 'design_doc' // Internal design docs (product-hub admin; preview route only, no public page)
374
192
  | 'from_scratch';
375
193
 
376
- export type URLInjectionPreference = 'none' | 'in_post' | 'as_comment';
194
+ /**
195
+ * Where a post's link goes: nowhere, written into the post, posted as a comment, or opened by the post itself
196
+ * (`as_link`: tapping the notification of an OpenFrame announcement opens it).
197
+ */
198
+ export type URLInjectionPreference = 'none' | 'in_post' | 'as_comment' | 'as_link';
377
199
 
378
200
  export interface ContentSourceOption {
379
201
  id: number | string; // Events/podcasts/webinars use UUID strings
@@ -103,7 +103,7 @@ export {
103
103
  // Dynamic icon registry — single source of truth lives at
104
104
  // components/chat/utils/icon-registry. Re-exported here so existing
105
105
  // `@flamingo-stack/openframe-frontend-core/utils` callers (hub admin
106
- // social-account screens) keep working without changing their import path.
106
+ // distribution-channel screens) keep working without changing their import path.
107
107
  export {
108
108
  getDynamicIcon,
109
109
  type DynamicIconSize,
@@ -0,0 +1,71 @@
1
+ /**
2
+ * What an OpenFrame notification can say about itself: its severity and the
3
+ * dashboard section (category) it belongs to, as the backend's enums name them.
4
+ * Stated once for every host that writes or draws one: the OpenFrame app's
5
+ * notification tiles, the Backoffice API's announcement request and the hub's
6
+ * preview of an announcement before it is sent.
7
+ *
8
+ * Pure and server-safe; also published as the granular subpath
9
+ * `./utils/notifications`, so server code reads the vocabulary without React.
10
+ */
11
+
12
+ /** The backend's notification severities, drawn as the tile's colour. */
13
+ export const NOTIFICATION_SEVERITIES = ['INFO', 'SUCCESS', 'WARNING', 'DANGER'] as const;
14
+ export type NotificationSeverity = (typeof NOTIFICATION_SEVERITIES)[number];
15
+
16
+ export const NOTIFICATION_SEVERITY_LABELS: Readonly<Record<NotificationSeverity, string>> = {
17
+ INFO: 'Info',
18
+ SUCCESS: 'Success',
19
+ WARNING: 'Warning',
20
+ DANGER: 'Danger',
21
+ };
22
+
23
+ /** The severity a notification has when it states none. */
24
+ export const DEFAULT_NOTIFICATION_SEVERITY: NotificationSeverity = 'INFO';
25
+
26
+ /**
27
+ * The backend's `NotificationCategory`: the dashboard section a notification
28
+ * belongs to. Any section but GENERIC shows an unread counter on its menu item.
29
+ */
30
+ export const NOTIFICATION_CATEGORIES = [
31
+ 'DASHBOARD',
32
+ 'CUSTOMERS',
33
+ 'DEVICES',
34
+ 'SCRIPTS',
35
+ 'MONITORING',
36
+ 'SOFTWARE',
37
+ 'LOGS',
38
+ 'TICKETS',
39
+ 'INSIGHTS',
40
+ 'MINGO',
41
+ 'INTEGRATIONS',
42
+ 'GENERIC',
43
+ ] as const;
44
+ export type NotificationCategory = (typeof NOTIFICATION_CATEGORIES)[number];
45
+
46
+ /** Each category as the app's navigation names its section. */
47
+ export const NOTIFICATION_CATEGORY_LABELS: Readonly<Record<NotificationCategory, string>> = {
48
+ DASHBOARD: 'Dashboard',
49
+ CUSTOMERS: 'Customers',
50
+ DEVICES: 'Devices',
51
+ SCRIPTS: 'Scripts',
52
+ MONITORING: 'Monitoring',
53
+ SOFTWARE: 'Software',
54
+ LOGS: 'Logs',
55
+ TICKETS: 'Tickets',
56
+ INSIGHTS: 'Insights',
57
+ MINGO: 'Mingo',
58
+ INTEGRATIONS: 'Integrations',
59
+ GENERIC: 'General',
60
+ };
61
+
62
+ /** The category a notification has when it states none. */
63
+ export const DEFAULT_NOTIFICATION_CATEGORY: NotificationCategory = 'GENERIC';
64
+
65
+ export function isNotificationSeverity(value: unknown): value is NotificationSeverity {
66
+ return typeof value === 'string' && (NOTIFICATION_SEVERITIES as readonly string[]).includes(value);
67
+ }
68
+
69
+ export function isNotificationCategory(value: unknown): value is NotificationCategory {
70
+ return typeof value === 'string' && (NOTIFICATION_CATEGORIES as readonly string[]).includes(value);
71
+ }