@marktiderman/genesis-chat 0.7.0 → 0.9.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.
Files changed (53) hide show
  1. package/README.md +132 -3
  2. package/dist/{chunk-GBJ3YI4E.js → chunk-5XYDVUPS.js} +6 -3
  3. package/dist/chunk-5XYDVUPS.js.map +1 -0
  4. package/dist/{chunk-XQ2ULNHV.js → chunk-D4RPOYB7.js} +4 -4
  5. package/dist/chunk-D4RPOYB7.js.map +1 -0
  6. package/dist/{chunk-RYD6WJE5.js → chunk-O2QSBRSH.js} +3 -3
  7. package/dist/{chunk-RYD6WJE5.js.map → chunk-O2QSBRSH.js.map} +1 -1
  8. package/dist/{chunk-A4YJX7KT.js → chunk-ZQFREERR.js} +3 -3
  9. package/dist/{chunk-A4YJX7KT.js.map → chunk-ZQFREERR.js.map} +1 -1
  10. package/dist/{client-DUIG1hum.d.ts → client-DP7rhJ1U.d.ts} +17 -6
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.js +2 -2
  13. package/dist/native.d.ts +35 -16
  14. package/dist/native.js +168 -490
  15. package/dist/native.js.map +1 -1
  16. package/dist/{outbox-B9NAWQ58.d.ts → outbox-C4LnqpKT.d.ts} +1 -1
  17. package/dist/push.d.ts +2 -2
  18. package/dist/react.d.ts +4 -8
  19. package/dist/react.js +3 -3
  20. package/dist/server.d.ts +1 -1
  21. package/dist/server.js +1 -1
  22. package/dist/{thread-oPra7pkW.d.ts → thread-CSzdqNR_.d.ts} +1 -1
  23. package/dist/web.d.ts +201 -7
  24. package/dist/web.js +580 -56
  25. package/dist/web.js.map +1 -1
  26. package/migrations/0004_genesis_chat_tenants.sql +716 -0
  27. package/migrations/tests/0001_genesis_chat.test.sql +10 -2
  28. package/migrations/tests/0002_genesis_chat_coaching.test.sql +8 -0
  29. package/migrations/tests/0003_genesis_chat_search_threads.test.sql +8 -0
  30. package/migrations/tests/0004_genesis_chat_tenants.test.sql +259 -0
  31. package/package.json +18 -7
  32. package/src/__tests__/core.test.ts +12 -0
  33. package/src/__tests__/web-dock.test.tsx +465 -0
  34. package/src/__tests__/web-photo-viewer.test.tsx +43 -0
  35. package/src/__tests__/web.test.tsx +26 -0
  36. package/src/core/client.ts +5 -1
  37. package/src/core/types.ts +16 -0
  38. package/src/native/__tests__/photo-viewer.test.tsx +24 -5
  39. package/src/native/__tests__/thread-screen.test.tsx +40 -2
  40. package/src/native/message-bubble.tsx +1 -1
  41. package/src/native/photo-viewer.tsx +109 -422
  42. package/src/native/thread-screen.tsx +77 -207
  43. package/src/native/use-jump.ts +7 -1
  44. package/src/react/index.tsx +2 -1
  45. package/src/web/attachments.tsx +39 -55
  46. package/src/web/composer.tsx +5 -0
  47. package/src/web/dock.tsx +889 -0
  48. package/src/web/inbox.tsx +5 -0
  49. package/src/web/index.ts +23 -0
  50. package/src/web/memory-client.ts +1 -1
  51. package/src/web/thread.tsx +42 -3
  52. package/dist/chunk-GBJ3YI4E.js.map +0 -1
  53. package/dist/chunk-XQ2ULNHV.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { extractLinks, isHttpsUrl, isSchedulable, scheduleLabel, scheduleQuickPicks, snippetParts, topicKey } from './chunk-BJCE5O7V.js';
2
- export { activityLine, createOutbox, currentActivity, dayLabel, firstUnreadId, itemSender, itemTime, memoryOutboxStore, mergeThread, parseMentions, previewText, releaseObjectUrl, sameDay, startsDay, startsGroup, summarizeReactions, throttle, upsertMessages } from './chunk-A4YJX7KT.js';
3
- export { ALLOWED_EXTENSIONS, CHAT_BUCKET, CHAT_LIMITS, CHAT_SCHEMA, ChatError, MAX_RANGES_PER_DAY, PLAYBACK_RATES, WEEKDAYS, attachmentKindFor, awayLine, awaySummary, conversationTopic, createChatClient, fileExtension, formatDuration, hoursSummary, isAllowedExtension, isAway, isWithinWorkingHours, localClock, minutesOf, namesLine, nextPlaybackRate, normalizeHours, randomId, recordingLimitMs, sendBytes, timeZoneLabel, toAttachment, toAvailability, toLinkPreview, toMessage, toScheduled, toSearchHit, toTopic, untilLabel, userTopic, waveformFromMetering, waveformPeaks } from './chunk-GBJ3YI4E.js';
2
+ export { activityLine, createOutbox, currentActivity, dayLabel, firstUnreadId, itemSender, itemTime, memoryOutboxStore, mergeThread, parseMentions, previewText, releaseObjectUrl, sameDay, startsDay, startsGroup, summarizeReactions, throttle, upsertMessages } from './chunk-ZQFREERR.js';
3
+ export { ALLOWED_EXTENSIONS, CHAT_BUCKET, CHAT_LIMITS, CHAT_SCHEMA, ChatError, MAX_RANGES_PER_DAY, PLAYBACK_RATES, WEEKDAYS, attachmentKindFor, awayLine, awaySummary, conversationTopic, createChatClient, fileExtension, formatDuration, hoursSummary, isAllowedExtension, isAway, isWithinWorkingHours, localClock, minutesOf, namesLine, nextPlaybackRate, normalizeHours, randomId, recordingLimitMs, sendBytes, timeZoneLabel, toAttachment, toAvailability, toLinkPreview, toMessage, toScheduled, toSearchHit, toTopic, untilLabel, userTopic, waveformFromMetering, waveformPeaks } from './chunk-5XYDVUPS.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
package/dist/native.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, ReactNode, ReactElement } from 'react';
3
3
  import { InboxPageProps, InboxItem, ScreenHeaderProps } from '@marktiderman/genesis-ui-native/layouts';
4
- import { m as ChatInboxItem, h as ChatAttachment, q as ChatMessage, k as ChatConversation, t as ChatRole, P as PendingFile, o as ChatLinkPreview, F as SendInput, x as ChatTopic, T as TopicInput, S as ScheduleInput, W as Weekday, C as ChatAvailability, d as AvailabilityInput, p as ChatMember, a as WorkingHours, u as ChatSearchHit } from './client-DUIG1hum.js';
4
+ import { m as ChatInboxItem, h as ChatAttachment, q as ChatMessage, k as ChatConversation, t as ChatRole, P as PendingFile, o as ChatLinkPreview, F as SendInput, x as ChatTopic, T as TopicInput, S as ScheduleInput, W as Weekday, C as ChatAvailability, d as AvailabilityInput, p as ChatMember, a as WorkingHours, u as ChatSearchHit } from './client-DP7rhJ1U.js';
5
5
  import { ChatAttachmentKind, ChatCardContext, ChatVideoUpload } from './react.js';
6
- import { T as ThreadItem } from './thread-oPra7pkW.js';
6
+ import { T as ThreadItem } from './thread-CSzdqNR_.js';
7
7
  import { ColorValue } from 'react-native';
8
- import { L as LocalFile } from './outbox-B9NAWQ58.js';
8
+ import { L as LocalFile } from './outbox-C4LnqpKT.js';
9
+ import { lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, NativeIconName } from '@marktiderman/genesis-ui-native/components';
9
10
  export { CHAT_MARK_READ_ACTION, CHAT_PUSH_CATEGORY, CHAT_REPLY_ACTION, ChatPushCopy, ChatPushData, ChatPushOutboxDeps, ChatPushOutcome, ChatPushPayload, ChatPushPayloadInput, ChatPushResponseLike, NotificationCategoriesLike, PUSH_REPLY_WAIT_MS, chatNotificationActions, chatPath, chatPushCategory, chatPushCopy, chatPushPayload, chatThreadMatch, conversationIdFromData, failedReply, handleChatPushResponse, registerChatNotificationActions, replyClientId, replyClientIdFor } from './push.js';
10
- import { NativeIconName } from '@marktiderman/genesis-ui-native/components';
11
11
  import '@supabase/supabase-js';
12
12
  import '@tanstack/query-core';
13
13
 
@@ -808,7 +808,10 @@ interface JumpTarget {
808
808
  messageId: string;
809
809
  seq?: number;
810
810
  }
811
- /** The row a message is drawn in, or -1. */
811
+ /**
812
+ * The row a message is drawn in, or -1.
813
+ * @deprecated NativeThreadList finds a row by `jumpId`. Removed in a later minor, with `useJumpToMessage`.
814
+ */
812
815
  declare function rowIndexOf(rows: readonly ThreadRow[], messageId: string): number;
813
816
  interface UseJumpOptions {
814
817
  /** What to go to; a new target (another id or seq) starts again. */
@@ -828,6 +831,9 @@ interface UseJumpOptions {
828
831
  onGone: () => void;
829
832
  onError: (e: unknown) => void;
830
833
  }
834
+ /**
835
+ * @deprecated Use genesis-ui-native's `NativeThreadList` (`jumpTo`, `jumpId`, `onLoadUntil`), or `useThreadJump` for a list of your own. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
836
+ */
831
837
  declare function useJumpToMessage({ target, rows, loading, has, loadUntil, scrollTo, onStart, onLanded, onGone, onError }: UseJumpOptions): {
832
838
  highlightedId: string | null;
833
839
  jumping: boolean;
@@ -875,7 +881,10 @@ interface ChatThreadScreenSlots {
875
881
  /** Draws the app's own attachment kinds; the card by default. */
876
882
  attachment?: ChatAttachmentSlot | null;
877
883
  }
878
- /** Points from the bottom that still count as "at the bottom" (FlatList, which follows by hand). */
884
+ /**
885
+ * Points from the bottom that still count as "at the bottom" (FlatList, which follows by hand).
886
+ * @deprecated Use genesis-ui-native's `THREAD_AT_BOTTOM_POINTS`. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
887
+ */
879
888
  declare const AT_BOTTOM_POINTS = 120;
880
889
  /**
881
890
  * How the thread's list is set up, oldest first and not inverted. FlashList:
@@ -883,12 +892,16 @@ declare const AT_BOTTOM_POINTS = 120;
883
892
  * a screen of it, keeps the first visible row in place when earlier ones load
884
893
  * at the top). FlatList: keeps its place when earlier rows load at the top;
885
894
  * the screen follows new rows itself (`followsByHand`).
895
+ * @deprecated Use genesis-ui-native's `threadListMode` (which anchors FlatList past the header, `minIndexForVisible: 1`). ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
886
896
  */
887
897
  declare function threadListMode(flash: boolean, reducedMotion: boolean): {
888
898
  followsByHand: boolean;
889
899
  maintainVisibleContentPosition: Record<string, unknown>;
890
900
  };
891
- /** Whether a scroll position is at (or near) the bottom of its content. */
901
+ /**
902
+ * Whether a scroll position is at (or near) the bottom of its content.
903
+ * @deprecated Use genesis-ui-native's `threadNearBottom`. ChatThreadScreen is on NativeThreadList; this copy is removed in a later minor.
904
+ */
892
905
  declare function nearBottom(m: {
893
906
  contentOffset: {
894
907
  y: number;
@@ -1295,19 +1308,25 @@ interface ChatPhotoViewerProps {
1295
1308
  onClose: () => void;
1296
1309
  testID?: string;
1297
1310
  }
1298
- /** Points pulled down (or dragged, on Android) that close the viewer on release. */
1311
+ /** @deprecated Use `LIGHTBOX_DISMISS_DISTANCE` from `@marktiderman/genesis-ui-native/components`. */
1299
1312
  declare const DISMISS_DISTANCE = 110;
1300
- /** Or a quick flick down, in points per millisecond. */
1313
+ /** @deprecated Use `LIGHTBOX_DISMISS_VELOCITY` from `@marktiderman/genesis-ui-native/components`. */
1301
1314
  declare const DISMISS_VELOCITY = 1.1;
1315
+ /** @deprecated Use `LIGHTBOX_MAX_ZOOM` from `@marktiderman/genesis-ui-native/components`. */
1302
1316
  declare const MAX_ZOOM = 4;
1303
- /** Whether a drag down that ended here closes the viewer. */
1304
- declare function shouldDismiss(dy: number, vy: number): boolean;
1305
- /** The zoom a pinch has reached: from where it started, by how far the fingers spread. */
1306
- declare function pinchScale(startScale: number, startDistance: number, distance: number): number;
1307
- /** How far a zoomed photo may pan before an edge shows, per axis. */
1308
- declare function panLimit(scale: number, size: number): number;
1309
- /** A file already on the phone, which shares and saves without a download. */
1317
+ /** @deprecated Use `lightboxShouldDismiss` from `@marktiderman/genesis-ui-native/components`. */
1318
+ declare const shouldDismiss: typeof lightboxShouldDismiss;
1319
+ /** @deprecated Use `lightboxPinchScale` from `@marktiderman/genesis-ui-native/components`. */
1320
+ declare const pinchScale: typeof lightboxPinchScale;
1321
+ /** @deprecated Use `lightboxPanLimit` from `@marktiderman/genesis-ui-native/components`. */
1322
+ declare const panLimit: typeof lightboxPanLimit;
1323
+ /** A file on the phone (a photo still sending), not a link. */
1310
1324
  declare function isLocalUri(uri: string): boolean;
1325
+ /**
1326
+ * Chat's photos full screen: genesis-ui-native's `NativeLightbox` (pinch and double-tap zoom, pull
1327
+ * down to close, an adjustable pager), with chat's words and its Save and Share buttons when the
1328
+ * app passes `mediaLibrary` and `sharing` to `ChatNativeProvider`.
1329
+ */
1311
1330
  declare function ChatPhotoViewer({ photos, initialIndex, onClose, testID }: ChatPhotoViewerProps): react.JSX.Element;
1312
1331
  /**
1313
1332
  * The photos of the message a tapped photo belongs to, and where it is among them, for