@flamingo-stack/openframe-frontend-core 0.0.657-2297.6706.1 → 0.0.657

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 (104) hide show
  1. package/dist/{chunk-PRDDD4XG.js → chunk-43UWVVPF.js} +5 -5
  2. package/dist/{chunk-QVYOB5XS.js → chunk-45UD5DWC.js} +2 -2
  3. package/dist/{chunk-XRTV557U.cjs → chunk-73G2JJZQ.cjs} +5 -5
  4. package/dist/{chunk-XRTV557U.cjs.map → chunk-73G2JJZQ.cjs.map} +1 -1
  5. package/dist/{chunk-RKARBDEI.js → chunk-ATVY6VKT.js} +10 -8
  6. package/dist/{chunk-RKARBDEI.js.map → chunk-ATVY6VKT.js.map} +1 -1
  7. package/dist/{chunk-LDLR3OQS.js → chunk-AYVTBCYB.js} +19 -21
  8. package/dist/{chunk-LDLR3OQS.js.map → chunk-AYVTBCYB.js.map} +1 -1
  9. package/dist/{chunk-WYGRTI4G.cjs → chunk-BACI3M4T.cjs} +10 -10
  10. package/dist/{chunk-WYGRTI4G.cjs.map → chunk-BACI3M4T.cjs.map} +1 -1
  11. package/dist/{chunk-DCM4GRHE.js → chunk-BLXMHTEO.js} +6 -6
  12. package/dist/{chunk-UMTXMG64.cjs → chunk-FXVAUABF.cjs} +171 -169
  13. package/dist/chunk-FXVAUABF.cjs.map +1 -0
  14. package/dist/{chunk-DZKNS54Q.cjs → chunk-H4EVZRNR.cjs} +10 -10
  15. package/dist/{chunk-DZKNS54Q.cjs.map → chunk-H4EVZRNR.cjs.map} +1 -1
  16. package/dist/{chunk-B7LNJIXK.js → chunk-HCCX6DMN.js} +5 -5
  17. package/dist/{chunk-VUN6UTNF.js → chunk-IXD25DBI.js} +4 -4
  18. package/dist/{chunk-6WJAZNCX.js → chunk-KIRDULVH.js} +3 -3
  19. package/dist/{chunk-IVE2YXXG.js → chunk-LACNKEJO.js} +5 -5
  20. package/dist/{chunk-BXBGOK2C.js → chunk-LMJ47EPZ.js} +2 -2
  21. package/dist/{chunk-XO4A65WL.cjs → chunk-NLGTHKU3.cjs} +71 -71
  22. package/dist/{chunk-XO4A65WL.cjs.map → chunk-NLGTHKU3.cjs.map} +1 -1
  23. package/dist/{chunk-EEBEE6NO.cjs → chunk-OYLAWIUG.cjs} +45 -45
  24. package/dist/{chunk-EEBEE6NO.cjs.map → chunk-OYLAWIUG.cjs.map} +1 -1
  25. package/dist/{chunk-EZPNPDVG.js → chunk-PDMIYWKB.js} +2 -2
  26. package/dist/{chunk-GCUZRLQG.cjs → chunk-PEK6JBTK.cjs} +19 -21
  27. package/dist/chunk-PEK6JBTK.cjs.map +1 -0
  28. package/dist/{chunk-T3WJOUTG.cjs → chunk-PPQLBZ5X.cjs} +15 -15
  29. package/dist/{chunk-T3WJOUTG.cjs.map → chunk-PPQLBZ5X.cjs.map} +1 -1
  30. package/dist/{chunk-2KYMY3QF.cjs → chunk-QQ72MAPB.cjs} +3 -3
  31. package/dist/{chunk-2KYMY3QF.cjs.map → chunk-QQ72MAPB.cjs.map} +1 -1
  32. package/dist/{chunk-FR3LYY5E.cjs → chunk-RNXQGKU3.cjs} +10 -10
  33. package/dist/{chunk-FR3LYY5E.cjs.map → chunk-RNXQGKU3.cjs.map} +1 -1
  34. package/dist/{chunk-LWUY62TD.cjs → chunk-UQBOEQOK.cjs} +3 -3
  35. package/dist/{chunk-LWUY62TD.cjs.map → chunk-UQBOEQOK.cjs.map} +1 -1
  36. package/dist/{chunk-HSY6BBYR.js → chunk-WL4QOUQN.js} +2 -2
  37. package/dist/{chunk-GQ4OOT6J.js → chunk-WQ7GXPTR.js} +3 -3
  38. package/dist/{chunk-MOGGEWBY.js → chunk-WWXQ7WUE.js} +3 -3
  39. package/dist/{chunk-4TWD4JCU.js → chunk-XC4UQ4QP.js} +3 -3
  40. package/dist/{chunk-JCFQAHUS.cjs → chunk-XGOQZJ7O.cjs} +4 -4
  41. package/dist/{chunk-JCFQAHUS.cjs.map → chunk-XGOQZJ7O.cjs.map} +1 -1
  42. package/dist/{chunk-KC4MFXR6.cjs → chunk-XX6Z63VU.cjs} +22 -22
  43. package/dist/{chunk-KC4MFXR6.cjs.map → chunk-XX6Z63VU.cjs.map} +1 -1
  44. package/dist/{chunk-NJGPTN2R.cjs → chunk-Y3Z2EO4C.cjs} +22 -22
  45. package/dist/{chunk-NJGPTN2R.cjs.map → chunk-Y3Z2EO4C.cjs.map} +1 -1
  46. package/dist/{chunk-C3XPFZPN.cjs → chunk-YPNLR6L2.cjs} +33 -33
  47. package/dist/{chunk-C3XPFZPN.cjs.map → chunk-YPNLR6L2.cjs.map} +1 -1
  48. package/dist/{chunk-CWIO64ZJ.js → chunk-ZHR5RWCF.js} +3 -3
  49. package/dist/{chunk-NJNIPXLS.cjs → chunk-ZKS4OMO4.cjs} +25 -25
  50. package/dist/{chunk-NJNIPXLS.cjs.map → chunk-ZKS4OMO4.cjs.map} +1 -1
  51. package/dist/components/case-studies/index.cjs +14 -14
  52. package/dist/components/case-studies/index.js +3 -3
  53. package/dist/components/chat/index.cjs +2 -2
  54. package/dist/components/chat/index.js +1 -1
  55. package/dist/components/chat/utils/history-merge.d.ts +0 -6
  56. package/dist/components/chat/utils/history-merge.d.ts.map +1 -1
  57. package/dist/components/contact/index.cjs +4 -4
  58. package/dist/components/contact/index.js +3 -3
  59. package/dist/components/docs/index.cjs +7 -7
  60. package/dist/components/docs/index.js +6 -6
  61. package/dist/components/embeds/index.cjs +4 -4
  62. package/dist/components/embeds/index.js +3 -3
  63. package/dist/components/faq/index.cjs +4 -4
  64. package/dist/components/faq/index.js +3 -3
  65. package/dist/components/features/filters-dropdown.d.ts.map +1 -1
  66. package/dist/components/features/index.cjs +3 -3
  67. package/dist/components/features/index.js +2 -2
  68. package/dist/components/help-center-pages/index.cjs +23 -23
  69. package/dist/components/help-center-pages/index.js +14 -14
  70. package/dist/components/index.cjs +39 -39
  71. package/dist/components/index.js +13 -13
  72. package/dist/components/meeting-scheduler/index.cjs +24 -24
  73. package/dist/components/meeting-scheduler/index.js +2 -2
  74. package/dist/components/navigation/index.cjs +6 -6
  75. package/dist/components/navigation/index.js +5 -5
  76. package/dist/components/onboarding-guides/index.cjs +6 -6
  77. package/dist/components/onboarding-guides/index.js +5 -5
  78. package/dist/components/tickets/index.cjs +7 -7
  79. package/dist/components/tickets/index.js +6 -6
  80. package/dist/components/ui/index.cjs +3 -3
  81. package/dist/components/ui/index.js +2 -2
  82. package/dist/index.cjs +7 -7
  83. package/dist/index.js +6 -6
  84. package/package.json +1 -1
  85. package/src/components/chat/utils/__tests__/history-merge.test.ts +0 -62
  86. package/src/components/chat/utils/history-merge.ts +17 -31
  87. package/src/components/features/__tests__/filters-dropdown-placement.test.tsx +88 -0
  88. package/src/components/features/filters-dropdown.tsx +15 -6
  89. package/dist/chunk-GCUZRLQG.cjs.map +0 -1
  90. package/dist/chunk-UMTXMG64.cjs.map +0 -1
  91. /package/dist/{chunk-PRDDD4XG.js.map → chunk-43UWVVPF.js.map} +0 -0
  92. /package/dist/{chunk-QVYOB5XS.js.map → chunk-45UD5DWC.js.map} +0 -0
  93. /package/dist/{chunk-DCM4GRHE.js.map → chunk-BLXMHTEO.js.map} +0 -0
  94. /package/dist/{chunk-B7LNJIXK.js.map → chunk-HCCX6DMN.js.map} +0 -0
  95. /package/dist/{chunk-VUN6UTNF.js.map → chunk-IXD25DBI.js.map} +0 -0
  96. /package/dist/{chunk-6WJAZNCX.js.map → chunk-KIRDULVH.js.map} +0 -0
  97. /package/dist/{chunk-IVE2YXXG.js.map → chunk-LACNKEJO.js.map} +0 -0
  98. /package/dist/{chunk-BXBGOK2C.js.map → chunk-LMJ47EPZ.js.map} +0 -0
  99. /package/dist/{chunk-EZPNPDVG.js.map → chunk-PDMIYWKB.js.map} +0 -0
  100. /package/dist/{chunk-HSY6BBYR.js.map → chunk-WL4QOUQN.js.map} +0 -0
  101. /package/dist/{chunk-GQ4OOT6J.js.map → chunk-WQ7GXPTR.js.map} +0 -0
  102. /package/dist/{chunk-MOGGEWBY.js.map → chunk-WWXQ7WUE.js.map} +0 -0
  103. /package/dist/{chunk-4TWD4JCU.js.map → chunk-XC4UQ4QP.js.map} +0 -0
  104. /package/dist/{chunk-CWIO64ZJ.js.map → chunk-ZHR5RWCF.js.map} +0 -0
@@ -24,12 +24,6 @@ export interface MergeableChatMessage {
24
24
  role: string;
25
25
  content: MessageContent;
26
26
  timestamp?: Date;
27
- /** Who authored a `user`-role row: the host's own user (`'user'` / unset),
28
- * a technician (`'admin'`) or the system (`'system'`). Every host renders
29
- * technician and system lines under role `user`, so a user row's twin must
30
- * match on this as well as on text - otherwise the end user's "?" is taken
31
- * for the twin of the technician's "?" and dropped from the thread. */
32
- authorType?: string;
33
27
  /** Highest CONTENT chunk streamSeq that composed this message (text / tool /
34
28
  * approval / error / compaction — never the non-persisted MESSAGE_END /
35
29
  * TOKEN_USAGE control chunks). Hosts stamp it on realtime synthetics so the
@@ -160,17 +154,10 @@ function sharesRequestKey(keys: ReadonlySet<string>, others: ReadonlySet<string>
160
154
  return false;
161
155
  }
162
156
 
163
- /** A user row's identity is its text under its author kind; empty text is no
164
- * identity (system rows persist with `content: ''`). `''` for any other row.
165
- * The kind is part of the key because technician (`authorType: 'admin'`) and
166
- * system rows share role `user` with the host's own sends: without it a
167
- * technician who typed the same text is the own bubble's "twin", and the own
168
- * bubble is dropped while its row is not in the snapshot yet. An unset
169
- * authorType is the own user (hosts stamp `'admin'` on their own sends where
170
- * the operator IS the admin, so the rule stays symmetric per host). */
171
- function userTwinKey(m: MergeableChatMessage): string {
172
- if (m.role !== 'user' || typeof m.content !== 'string' || m.content === '') return '';
173
- return `${m.authorType ?? 'user'}\u0000${m.content}`;
157
+ /** A user row's identity is its text; empty text is no identity (system rows
158
+ * persist with `content: ''`). `''` for any other row. */
159
+ function userText(m: MergeableChatMessage): string {
160
+ return m.role === 'user' && typeof m.content === 'string' ? m.content : '';
174
161
  }
175
162
 
176
163
  /** What a set of rows says about the turns they render, so another copy of one
@@ -195,8 +182,8 @@ function collectTwinSignals(rows: readonly MergeableChatMessage[]): TwinSignals
195
182
  if (text !== '') signals.assistantTexts.set(text, (signals.assistantTexts.get(text) ?? 0) + 1);
196
183
  continue;
197
184
  }
198
- const key = userTwinKey(row);
199
- if (key !== '') signals.userContents.set(key, (signals.userContents.get(key) ?? 0) + 1);
185
+ const text = userText(row);
186
+ if (text !== '') signals.userContents.set(text, (signals.userContents.get(text) ?? 0) + 1);
200
187
  }
201
188
  return signals;
202
189
  }
@@ -211,9 +198,9 @@ type TwinVerdict = 'twin' | 'distinct' | 'unknown';
211
198
  * request id, no answer text), so "no match" says nothing about it. */
212
199
  function twinVerdict(signals: TwinSignals, m: MergeableChatMessage): TwinVerdict {
213
200
  if (m.role !== 'assistant') {
214
- const key = userTwinKey(m);
215
- if (key === '') return 'unknown';
216
- return signals.userContents.has(key) ? 'twin' : 'distinct';
201
+ const text = userText(m);
202
+ if (text === '') return 'unknown';
203
+ return signals.userContents.has(text) ? 'twin' : 'distinct';
217
204
  }
218
205
  const keys = turnRequestKeys(m.content);
219
206
  if (keys.size > 0) return sharesRequestKey(keys, signals.requestKeys) ? 'twin' : 'distinct';
@@ -542,7 +529,7 @@ export function mergeHistoryWithRealtime<M extends MergeableChatMessage>(input:
542
529
  // optimistic messages are minted on send, never by chunk replay, so
543
530
  // their timestamps are trustworthy.
544
531
  const canBeInSnapshot = (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
545
- return !(canBeInSnapshot && windowSignals.userContents.has(userTwinKey(m)));
532
+ return !(canBeInSnapshot && windowSignals.userContents.has(m.content));
546
533
  }
547
534
  // Freshness rule: a synthetic whose turn is represented in the snapshot
548
535
  // (under its persisted Mongo id) must be dropped or the turn renders
@@ -573,11 +560,10 @@ export function mergeHistoryWithRealtime<M extends MergeableChatMessage>(input:
573
560
  // already does for DIRECT/SYSTEM), which also stops the replay at the
574
561
  // source via a correct `optStartSeq`.
575
562
  if (m.role === 'user' && isUserRequestSyntheticId(m.id) && typeof m.content === 'string') {
576
- const twinKey = userTwinKey(m);
577
- const seen = (seenUserSyntheticByContent.get(twinKey) ?? 0) + 1;
578
- seenUserSyntheticByContent.set(twinKey, seen);
563
+ const seen = (seenUserSyntheticByContent.get(m.content) ?? 0) + 1;
564
+ seenUserSyntheticByContent.set(m.content, seen);
579
565
  // No persisted row for THIS occurrence slot → keep (nothing renders it).
580
- if ((windowSignals.userContents.get(twinKey) ?? 0) < seen) return true;
566
+ if ((windowSignals.userContents.get(m.content) ?? 0) < seen) return true;
581
567
  // A same-text persisted twin exists for this slot. User rows carry no
582
568
  // persisted seq, so that twin may be THIS message's OWN row (drop — it
583
569
  // renders the message) OR an OLDER identical-text turn while this is a
@@ -596,7 +582,7 @@ export function mergeHistoryWithRealtime<M extends MergeableChatMessage>(input:
596
582
  if (typeof m.streamSeq !== 'number' || historyMaxStreamSeq <= 0) return false;
597
583
  if (historyMaxStreamSeq >= m.streamSeq) return false;
598
584
  const lastPersisted = processedToUse[processedToUse.length - 1];
599
- if (lastPersisted && userTwinKey(lastPersisted) === twinKey) return false;
585
+ if (lastPersisted && lastPersisted.role === 'user' && lastPersisted.content === m.content) return false;
600
586
  return true;
601
587
  }
602
588
  // Per-message seq coverage for the remaining synthetics (assistant /
@@ -715,10 +701,10 @@ export function computeHistoryPrepend<M extends MergeableChatMessage>(
715
701
  for (let i = newEnd - 1; i >= 0; i--) {
716
702
  const pm = processedHistory[i];
717
703
  if (pm.role === 'user') {
718
- const key = userTwinKey(pm);
719
- const left = key === '' ? 0 : (userTwinsLeft.get(key) ?? 0);
704
+ const text = userText(pm);
705
+ const left = text === '' ? 0 : (userTwinsLeft.get(text) ?? 0);
720
706
  if (left === 0) continue;
721
- userTwinsLeft.set(key, left - 1);
707
+ userTwinsLeft.set(text, left - 1);
722
708
  twinIndices.add(i);
723
709
  } else if (pm.role === 'assistant') {
724
710
  const keys = turnRequestKeys(pm.content);
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Pins where the panel hangs when the trigger is as wide as its column — a
3
+ * table's filter header is `w-full` of a `flex-1` cell. The auto-placement once
4
+ * measured the room past the trigger's FAR edge, so a wide trigger near the
5
+ * row's end flipped `bottom-start` to `bottom-end` and the panel landed at the
6
+ * far right, away from the label it belongs to. What has to fit is the panel's
7
+ * own width from the edge it hangs off.
8
+ */
9
+
10
+ import { fireEvent, render, screen } from '@testing-library/react';
11
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
12
+ import { type FilterSection, FiltersDropdown } from '../filters-dropdown';
13
+
14
+ const SECTIONS: FilterSection[] = [
15
+ {
16
+ id: 'status',
17
+ title: 'Software Version',
18
+ type: 'checkbox',
19
+ options: [{ id: 'outdated', label: 'Outdated', value: 'outdated' }],
20
+ },
21
+ ];
22
+
23
+ const VIEWPORT_WIDTH = 1900;
24
+
25
+ function mockTriggerRect(left: number, right: number) {
26
+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockReturnValue({
27
+ left,
28
+ right,
29
+ top: 0,
30
+ bottom: 48,
31
+ width: right - left,
32
+ height: 48,
33
+ x: left,
34
+ y: 0,
35
+ toJSON: () => ({}),
36
+ });
37
+ }
38
+
39
+ function openAndReadPanel(placement: 'bottom-start' | 'bottom-end') {
40
+ render(
41
+ <FiltersDropdown
42
+ triggerElement={<div className="w-full">Software Version</div>}
43
+ sections={SECTIONS}
44
+ onApply={() => {}}
45
+ placement={placement}
46
+ className="!block w-full"
47
+ />,
48
+ );
49
+ fireEvent.click(screen.getByText('Software Version'));
50
+ // Apply sits in the panel's own tree; the panel is the closest absolutely
51
+ // positioned element, which is where the placement class lands.
52
+ const panel = screen.getByRole('button', { name: 'Apply' }).closest('.absolute');
53
+ if (!panel) throw new Error('the panel did not open');
54
+ return panel;
55
+ }
56
+
57
+ describe('FiltersDropdown auto-placement', () => {
58
+ beforeEach(() => {
59
+ Object.defineProperty(window, 'innerWidth', { value: VIEWPORT_WIDTH, configurable: true, writable: true });
60
+ });
61
+
62
+ afterEach(() => {
63
+ vi.restoreAllMocks();
64
+ });
65
+
66
+ it('keeps bottom-start under a column-wide trigger whose far edge is near the viewport edge', () => {
67
+ // The trigger spans 900–1800 of 1900: 100px past its right edge, but the
68
+ // panel hangs off its LEFT edge, where there is 1000px.
69
+ mockTriggerRect(900, 1800);
70
+ const panel = openAndReadPanel('bottom-start');
71
+ expect(panel.classList.contains('left-0')).toBe(true);
72
+ expect(panel.classList.contains('right-0')).toBe(false);
73
+ });
74
+
75
+ it('flips bottom-start to bottom-end only when the panel would not fit from the left edge', () => {
76
+ // 1700 + 320 overshoots 1900; from the right edge it fits.
77
+ mockTriggerRect(1700, 1800);
78
+ const panel = openAndReadPanel('bottom-start');
79
+ expect(panel.classList.contains('right-0')).toBe(true);
80
+ });
81
+
82
+ it('flips bottom-end to bottom-start only when the panel would not fit from the right edge', () => {
83
+ // 100 − 320 falls off the left; from the left edge it fits.
84
+ mockTriggerRect(20, 100);
85
+ const panel = openAndReadPanel('bottom-end');
86
+ expect(panel.classList.contains('left-0')).toBe(true);
87
+ });
88
+ });
@@ -178,17 +178,26 @@ export const FiltersDropdown: FC<FiltersDropdownProps> = ({
178
178
  const dropdownWidth = 320; // Fixed width from the dropdown
179
179
  const viewportWidth = window.innerWidth;
180
180
 
181
- const spaceRight = viewportWidth - triggerRect.right;
182
- const spaceLeft = triggerRect.left;
181
+ // The panel hangs off ONE edge of the trigger — its left for `bottom-start`,
182
+ // its right for `bottom-end` — so what has to fit is the panel's own width
183
+ // from that edge, not the room beyond the trigger's far side. A trigger as
184
+ // wide as its column (a table's filter header, `w-full` of a `flex-1`
185
+ // cell) would otherwise report no room past its right edge while the
186
+ // panel, hung from its left, has the whole column to itself — and flip to
187
+ // the far end of the row, away from the label it belongs to.
188
+ const fitsFromLeft = triggerRect.left + dropdownWidth <= viewportWidth;
189
+ const fitsFromRight = triggerRect.right - dropdownWidth >= 0;
190
+ const center = (triggerRect.left + triggerRect.right) / 2;
191
+ const fitsCentered = center - dropdownWidth / 2 >= 0 && center + dropdownWidth / 2 <= viewportWidth;
183
192
 
184
193
  let optimalPlacement = placement;
185
194
 
186
- if (placement === 'bottom-start' && spaceRight < dropdownWidth && spaceLeft >= dropdownWidth) {
195
+ if (placement === 'bottom-start' && !fitsFromLeft && fitsFromRight) {
187
196
  optimalPlacement = 'bottom-end';
188
- } else if (placement === 'bottom-end' && spaceLeft < dropdownWidth && spaceRight >= dropdownWidth) {
197
+ } else if (placement === 'bottom-end' && !fitsFromRight && fitsFromLeft) {
189
198
  optimalPlacement = 'bottom-start';
190
- } else if (placement === 'bottom' && (spaceLeft < dropdownWidth / 2 || spaceRight < dropdownWidth / 2)) {
191
- optimalPlacement = spaceLeft > spaceRight ? 'bottom-end' : 'bottom-start';
199
+ } else if (placement === 'bottom' && !fitsCentered) {
200
+ optimalPlacement = !fitsFromLeft && fitsFromRight ? 'bottom-end' : 'bottom-start';
192
201
  }
193
202
 
194
203
  setActualPlacement(optimalPlacement);