@flamingo-stack/openframe-frontend-core 0.0.244 → 0.0.246

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 (133) hide show
  1. package/dist/{chunk-STKMIMLP.cjs → chunk-3JRA55FZ.cjs} +12 -12
  2. package/dist/{chunk-STKMIMLP.cjs.map → chunk-3JRA55FZ.cjs.map} +1 -1
  3. package/dist/{chunk-DV3YZWGN.cjs → chunk-3TDLFCCS.cjs} +33 -20
  4. package/dist/chunk-3TDLFCCS.cjs.map +1 -0
  5. package/dist/{chunk-ORJREQ2W.js → chunk-4XLJWX2N.js} +4 -4
  6. package/dist/{chunk-P5C732SC.js → chunk-DB4HW42V.js} +6 -6
  7. package/dist/{chunk-EPXROXYC.cjs → chunk-ESADULCN.cjs} +651 -716
  8. package/dist/chunk-ESADULCN.cjs.map +1 -0
  9. package/dist/{chunk-EJ7J4QAD.cjs → chunk-GMFDA36U.cjs} +12 -12
  10. package/dist/{chunk-EJ7J4QAD.cjs.map → chunk-GMFDA36U.cjs.map} +1 -1
  11. package/dist/{chunk-PTSAF7T2.js → chunk-LXDA67PW.js} +2 -2
  12. package/dist/{chunk-APGMNHPY.js → chunk-MKVKVJQQ.js} +32 -19
  13. package/dist/chunk-MKVKVJQQ.js.map +1 -0
  14. package/dist/{chunk-M7DPUWAL.js → chunk-NZST65RV.js} +126 -191
  15. package/dist/chunk-NZST65RV.js.map +1 -0
  16. package/dist/{chunk-Z6GGYZDR.cjs → chunk-P2G5X6AW.cjs} +27 -27
  17. package/dist/{chunk-Z6GGYZDR.cjs.map → chunk-P2G5X6AW.cjs.map} +1 -1
  18. package/dist/chunk-PINAV6VJ.cjs +287 -0
  19. package/dist/chunk-PINAV6VJ.cjs.map +1 -0
  20. package/dist/{chunk-NKGNRFSS.js → chunk-QRGODKEG.js} +8 -8
  21. package/dist/{chunk-FSS2MIEA.cjs → chunk-SGJBUL2Y.cjs} +20 -3
  22. package/dist/chunk-SGJBUL2Y.cjs.map +1 -0
  23. package/dist/{chunk-LJGBFD52.js → chunk-VAUI3CND.js} +18 -1
  24. package/dist/chunk-VAUI3CND.js.map +1 -0
  25. package/dist/{chunk-OB45JHDY.cjs → chunk-VFKQMAUF.cjs} +3 -3
  26. package/dist/{chunk-OB45JHDY.cjs.map → chunk-VFKQMAUF.cjs.map} +1 -1
  27. package/dist/chunk-VI7GW7PE.js +287 -0
  28. package/dist/chunk-VI7GW7PE.js.map +1 -0
  29. package/dist/{chunk-RJC3L5DT.cjs → chunk-YJVDQZ5Y.cjs} +7 -7
  30. package/dist/{chunk-RJC3L5DT.cjs.map → chunk-YJVDQZ5Y.cjs.map} +1 -1
  31. package/dist/{chunk-WD2MZVJI.js → chunk-ZXECERJ4.js} +5 -5
  32. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  33. package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts.map +1 -1
  34. package/dist/components/chat/hooks/use-chat-card-item.d.ts.map +1 -1
  35. package/dist/components/chat/index.cjs +6 -16
  36. package/dist/components/chat/index.cjs.map +1 -1
  37. package/dist/components/chat/index.js +5 -15
  38. package/dist/components/chat/types/entities/content-ref.d.ts +5 -20
  39. package/dist/components/chat/types/entities/content-ref.d.ts.map +1 -1
  40. package/dist/components/chat/utils/index.d.ts +0 -1
  41. package/dist/components/chat/utils/index.d.ts.map +1 -1
  42. package/dist/components/contact/index.cjs +7 -7
  43. package/dist/components/contact/index.js +6 -6
  44. package/dist/components/faq/faq-section.d.ts +7 -1
  45. package/dist/components/faq/faq-section.d.ts.map +1 -1
  46. package/dist/components/faq/index.cjs +3 -3
  47. package/dist/components/faq/index.js +2 -2
  48. package/dist/components/features/index.cjs +6 -6
  49. package/dist/components/features/index.js +5 -5
  50. package/dist/components/features/policy-configuration-panel.d.ts.map +1 -1
  51. package/dist/components/index.cjs +87 -93
  52. package/dist/components/index.cjs.map +1 -1
  53. package/dist/components/index.d.ts +1 -0
  54. package/dist/components/index.d.ts.map +1 -1
  55. package/dist/components/index.js +31 -37
  56. package/dist/components/index.js.map +1 -1
  57. package/dist/components/navigation/index.cjs +6 -6
  58. package/dist/components/navigation/index.js +5 -5
  59. package/dist/components/onboarding-guides/index.cjs +30 -30
  60. package/dist/components/onboarding-guides/index.cjs.map +1 -1
  61. package/dist/components/onboarding-guides/index.js +11 -11
  62. package/dist/components/related-content/index.cjs +26 -0
  63. package/dist/components/related-content/index.cjs.map +1 -0
  64. package/dist/components/related-content/index.d.ts +2 -0
  65. package/dist/components/related-content/index.d.ts.map +1 -0
  66. package/dist/components/related-content/index.js +26 -0
  67. package/dist/components/related-content/index.js.map +1 -0
  68. package/dist/components/related-content/related-content-section.d.ts +149 -0
  69. package/dist/components/related-content/related-content-section.d.ts.map +1 -0
  70. package/dist/components/tickets/index.cjs +73 -73
  71. package/dist/components/tickets/index.cjs.map +1 -1
  72. package/dist/components/tickets/index.js +15 -15
  73. package/dist/components/ui/index.cjs +9 -19
  74. package/dist/components/ui/index.cjs.map +1 -1
  75. package/dist/components/ui/index.js +13 -23
  76. package/dist/embed-shims/index.cjs +3 -3
  77. package/dist/embed-shims/index.cjs.map +1 -1
  78. package/dist/embed-shims/index.js +5 -5
  79. package/dist/index.cjs +17 -11
  80. package/dist/index.cjs.map +1 -1
  81. package/dist/index.js +55 -49
  82. package/dist/types/content-ref.d.ts +35 -0
  83. package/dist/types/content-ref.d.ts.map +1 -0
  84. package/dist/types/index.d.ts +1 -0
  85. package/dist/types/index.d.ts.map +1 -1
  86. package/dist/utils/content-ref-groups.d.ts +58 -0
  87. package/dist/utils/content-ref-groups.d.ts.map +1 -0
  88. package/dist/utils/extract-items.d.ts +18 -0
  89. package/dist/utils/extract-items.d.ts.map +1 -0
  90. package/dist/utils/index.cjs +81 -0
  91. package/dist/utils/index.cjs.map +1 -1
  92. package/dist/utils/index.d.ts +4 -1
  93. package/dist/utils/index.d.ts.map +1 -1
  94. package/dist/utils/index.js +74 -1
  95. package/dist/utils/index.js.map +1 -1
  96. package/dist/utils/list-url.d.ts +6 -0
  97. package/dist/utils/list-url.d.ts.map +1 -1
  98. package/dist/utils/suggestion-url.d.ts +26 -0
  99. package/dist/utils/suggestion-url.d.ts.map +1 -0
  100. package/package.json +7 -1
  101. package/src/components/chat/chat-message-list.tsx +49 -74
  102. package/src/components/chat/entity-cards/onboarding-guide-card.tsx +18 -3
  103. package/src/components/chat/hooks/use-chat-card-item.ts +3 -38
  104. package/src/components/chat/types/entities/content-ref.ts +5 -21
  105. package/src/components/chat/utils/index.ts +0 -12
  106. package/src/components/faq/faq-section.tsx +69 -24
  107. package/src/components/features/policy-configuration-panel.tsx +0 -1
  108. package/src/components/index.ts +1 -0
  109. package/src/components/related-content/index.ts +9 -0
  110. package/src/components/related-content/related-content-section.tsx +630 -0
  111. package/src/types/content-ref.ts +34 -0
  112. package/src/types/index.ts +1 -0
  113. package/src/utils/content-ref-groups.ts +89 -0
  114. package/src/utils/extract-items.ts +48 -0
  115. package/src/utils/index.ts +16 -1
  116. package/src/utils/list-url.ts +9 -0
  117. package/src/utils/suggestion-url.ts +39 -0
  118. package/dist/chunk-APGMNHPY.js.map +0 -1
  119. package/dist/chunk-DV3YZWGN.cjs.map +0 -1
  120. package/dist/chunk-EPXROXYC.cjs.map +0 -1
  121. package/dist/chunk-FSS2MIEA.cjs.map +0 -1
  122. package/dist/chunk-LJGBFD52.js.map +0 -1
  123. package/dist/chunk-M7DPUWAL.js.map +0 -1
  124. package/dist/components/chat/utils/history-merge.d.ts +0 -92
  125. package/dist/components/chat/utils/history-merge.d.ts.map +0 -1
  126. package/src/components/chat/__tests__/chat-message-list.test.tsx +0 -92
  127. package/src/components/chat/utils/__tests__/history-merge.test.ts +0 -339
  128. package/src/components/chat/utils/history-merge.ts +0 -255
  129. /package/dist/{chunk-ORJREQ2W.js.map → chunk-4XLJWX2N.js.map} +0 -0
  130. /package/dist/{chunk-P5C732SC.js.map → chunk-DB4HW42V.js.map} +0 -0
  131. /package/dist/{chunk-PTSAF7T2.js.map → chunk-LXDA67PW.js.map} +0 -0
  132. /package/dist/{chunk-NKGNRFSS.js.map → chunk-QRGODKEG.js.map} +0 -0
  133. /package/dist/{chunk-WD2MZVJI.js.map → chunk-ZXECERJ4.js.map} +0 -0
@@ -0,0 +1,149 @@
1
+ /**
2
+ * RelatedContentSection
3
+ *
4
+ * Renders content references grouped by type using the canonical card
5
+ * components. MOVED from the hub (`components/shared/related-content-card.tsx`)
6
+ * so any consuming app can embed it; the hub keeps a thin wrapper that
7
+ * pre-binds its host-specific injections (nav hook, URL recomposition,
8
+ * program configs, admin campaign card).
9
+ *
10
+ * THREE data modes (precedence top-down):
11
+ * 1. CONTROLLED — `contentRefs` provided (even `[]`): render exactly those
12
+ * refs, no suggestion fetch (the original investor-update behavior).
13
+ * 2. SUGGESTION — `entityType` + `entityId` provided: self-fetch
14
+ * `GET {apiBaseUrl}/api/related-content?entityType&entityId[&count][&excludeTypes]`
15
+ * (the generic 5-tier engine's second web service). `minResults` maps to
16
+ * `count`; absent → param not sent (server default applies). Each ref
17
+ * carries a `reason` (data-only — never rendered, matching the
18
+ * FaqSection/FaqWithReason precedent).
19
+ * 3. SSR-HYDRATED suggestion — also pass `initialItems` (the server page
20
+ * called the engine directly); the first client fetch is skipped per the
21
+ * `useSelfFetch` initialData contract.
22
+ *
23
+ * Group layout (list vs grid) + card size (lg vs default) come from
24
+ * `CONTENT_REF_GROUPS` in `../../utils/content-ref-groups` — single source of
25
+ * truth, no per-type logic in this file. Skeletons come from
26
+ * `renderSkeletonForType` so the placeholder height matches the loaded card
27
+ * exactly (zero layout shift on resolve).
28
+ *
29
+ * One API call per content type via the shared list-URL builder
30
+ * (`buildListUrl` — injectable; defaults to the lib's byte-parity-tested
31
+ * builder prefixed with `apiBaseUrl`). Fetching uses `useSelfFetch` (plain
32
+ * fetch, NO react-query) so third-party embedders need no QueryClientProvider;
33
+ * cards are imported via DEEP module paths (not the chat barrel) so this
34
+ * chunk never reaches `@tanstack/react-query`.
35
+ *
36
+ * LOCKSTEP NOTE: this file's per-type card/skeleton dispatch is the SIZED
37
+ * sibling of the chat-side `CHAT_CARD_REGISTRY` (`../chat/entity-cards/
38
+ * dispatch.tsx`), which renders compact `size='sm'` cards wired to the chat
39
+ * runtime. Two dispatchers by design — when registering a new fetch-mode
40
+ * content type, add it BOTH there and here (cards + skeleton + list URL).
41
+ */
42
+ import React from 'react';
43
+ import type { ContentRef, ContentRefWithReason } from '../../types/content-ref';
44
+ import type { ChatCardDispatchExtras } from '../chat/entity-cards/dispatch';
45
+ /** Anchor prop bundle the per-card link surface receives — same shape the
46
+ * hub's `useNavLink` returns and the chat dispatcher's anchor builders
47
+ * produce. `null` = non-anchor mode (no URL). */
48
+ export interface CardLinkAnchorProps {
49
+ href: string;
50
+ target?: '_blank';
51
+ rel?: 'noopener noreferrer';
52
+ onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
53
+ }
54
+ /** Render-prop component injection for the navigation decision — keeps hook
55
+ * calls legal (hooks live INSIDE the injected component; `CardForType`
56
+ * itself calls zero hooks). The hub injects a `useNavLink`-backed provider;
57
+ * the default is hook-free (pure `decideNewTab`). MUST be defined at module
58
+ * scope by hosts — an inline arrow would remount every card each render. */
59
+ export interface CardLinkProviderProps {
60
+ href: string | null;
61
+ targetPlatform: string | null;
62
+ children: (linkProps: CardLinkAnchorProps | null) => React.ReactElement | null;
63
+ }
64
+ export type CardLinkProvider = React.ComponentType<CardLinkProviderProps>;
65
+ /** Host-injected renderer pair for the admin-only `marketing_campaign` type.
66
+ * Absent (every non-hub embed) → the type renders nothing (its list URL
67
+ * hits `/api/admin`, unreachable outside the hub anyway). */
68
+ export interface AdminCampaignCardSlot {
69
+ Card: React.ComponentType<{
70
+ campaign: any;
71
+ }>;
72
+ Skeleton: React.ComponentType<{
73
+ size?: 'default' | 'sm';
74
+ }>;
75
+ }
76
+ export interface RelatedContentSectionProps {
77
+ /** CONTROLLED mode (the original behavior). When defined — even `[]` — no
78
+ * suggestion fetch runs and exactly these refs render. */
79
+ contentRefs?: ContentRef[];
80
+ /** SUGGESTION mode (with `entityId`): self-fetch suggestions for this host
81
+ * entity from `{apiBaseUrl}/api/related-content`. Ignored when
82
+ * `contentRefs` is provided. */
83
+ entityType?: string;
84
+ entityId?: number | string;
85
+ /** Maps to the suggestion API's `count` param — the PER-TYPE fill target
86
+ * for every candidate type EXCEPT the host's own. Absent → param not sent
87
+ * (server default applies). */
88
+ minResults?: number;
89
+ /** Maps to the suggestion API's `sameTypeCount` param — the budget for the
90
+ * candidate type MATCHING the host's own `entityType` (same-type boost:
91
+ * a blog post's rail leads with more blog posts). Absent → param not
92
+ * sent (host's type uses the server's `count`). */
93
+ sameTypeMinResults?: number;
94
+ /** SSR hydrate for suggestion mode — the server page ran the engine and
95
+ * drills the refs here; the first client fetch is skipped (useSelfFetch
96
+ * initialData contract). */
97
+ initialItems?: ContentRefWithReason[];
98
+ /** Section title (default: "Related Content") */
99
+ title?: string;
100
+ /**
101
+ * Grid columns at desktop. 2 = denser cards / wider summary (original
102
+ * investor-update layout); 3 = more cards per row for dashboards.
103
+ * Only consulted for grid-layout groups. Default: 2.
104
+ */
105
+ columns?: 2 | 3;
106
+ /**
107
+ * ContentRef.type values to exclude. Honored in ALL modes — controlled
108
+ * mode post-filters (original behavior); suggestion mode ALSO forwards the
109
+ * list verbatim as the API's `excludeTypes=` param so excluded types never
110
+ * consume engine fill slots (`minResults` stays honored). The subtraction
111
+ * happens SERVER-side — this component never mirrors the hub's candidate
112
+ * list.
113
+ */
114
+ excludeTypes?: string[];
115
+ /**
116
+ * SUGGESTION-mode allow-list (rail vocabulary): which content types
117
+ * participate in this rail. Sent verbatim as the API's `types=` param —
118
+ * the SERVER intersects it with its own allowed candidate set, and
119
+ * platform policy gates (e.g. internal-only types) ALWAYS win: the client
120
+ * cannot request its way past them. Absent → all server-side candidates.
121
+ */
122
+ includeTypes?: string[];
123
+ /** Fetch-URL prefix for third-party embeds / reverse proxies
124
+ * ('' = same-origin). Applied to BOTH the suggestion fetch and the
125
+ * default per-group list fetches. */
126
+ apiBaseUrl?: string;
127
+ /** Host injection bundle — REUSES the chat dispatcher's
128
+ * `ChatCardDispatchExtras` (programConfigs, buildOgPlaceholderUrl,
129
+ * buildProductReleaseCardProps override). Program groups render nothing
130
+ * when their config is absent. */
131
+ extras?: ChatCardDispatchExtras;
132
+ /** Hub injects its `buildContentURL` recomposition; default uses the
133
+ * ref's stored `url`/`targetPlatform` as the API composed them. */
134
+ resolveHref?: (ref: ContentRef) => {
135
+ href: string | null;
136
+ targetPlatform: string | null;
137
+ };
138
+ /** Hub injects its registry-driven entity-list-api builder; default = the
139
+ * lib's `buildListUrl(type, ids, apiBaseUrl)`. */
140
+ buildListUrl?: (type: string, ids: string[]) => string | null;
141
+ /** Hub injects a `useNavLink`-backed render-prop provider; default = pure
142
+ * anchor via `decideNewTab`. MUST be a module-scope component. */
143
+ LinkProvider?: CardLinkProvider;
144
+ /** Renderer pair for the admin-only `marketing_campaign` type. Absent →
145
+ * the type renders nothing. */
146
+ adminCampaignCard?: AdminCampaignCardSlot;
147
+ }
148
+ export declare function RelatedContentSection({ contentRefs, entityType, entityId, minResults, sameTypeMinResults, includeTypes, initialItems, title, columns, excludeTypes, apiBaseUrl, extras, resolveHref, buildListUrl, LinkProvider, adminCampaignCard, }: RelatedContentSectionProps): React.JSX.Element | null;
149
+ //# sourceMappingURL=related-content-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"related-content-section.d.ts","sourceRoot":"","sources":["../../../src/components/related-content/related-content-section.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAOvC,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAuBhF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAI5E;;kDAEkD;AAClD,MAAM,WAAW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