@marktiderman/genesis-chat 0.12.0 → 0.13.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.
- package/README.md +46 -1
- package/dist/{chunk-2HNQWDLF.js → chunk-3UNYTK62.js} +3 -3
- package/dist/{chunk-2HNQWDLF.js.map → chunk-3UNYTK62.js.map} +1 -1
- package/dist/{chunk-VBIYDXL2.js → chunk-GEEJMKQF.js} +22 -3
- package/dist/chunk-GEEJMKQF.js.map +1 -0
- package/dist/{chunk-K5GYNHNE.js → chunk-H4BRVJJ7.js} +136 -23
- package/dist/chunk-H4BRVJJ7.js.map +1 -0
- package/dist/{chunk-3HQN2FZ5.js → chunk-SEMN3S6Q.js} +3 -3
- package/dist/{chunk-3HQN2FZ5.js.map → chunk-SEMN3S6Q.js.map} +1 -1
- package/dist/{client-DJs3ltZc.d.ts → client-DXWyDJ2u.d.ts} +14 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/native.d.ts +20 -12
- package/dist/native.js +40 -32
- package/dist/native.js.map +1 -1
- package/dist/{outbox-YFTbGIAl.d.ts → outbox-Ctngv6Yz.d.ts} +1 -1
- package/dist/push.d.ts +2 -2
- package/dist/react.d.ts +73 -4
- package/dist/react.js +3 -3
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/{thread-CgHP00Jw.d.ts → thread-mZsRiIGz.d.ts} +1 -1
- package/dist/web.d.ts +24 -7
- package/dist/web.js +140 -67
- package/dist/web.js.map +1 -1
- package/migrations/0007_genesis_chat_unread_and_delete_for_me.sql +455 -0
- package/migrations/tests/0007_genesis_chat_unread_and_delete_for_me.test.sql +178 -0
- package/package.json +13 -9
- package/src/__tests__/inbox-row-actions.test.tsx +251 -0
- package/src/__tests__/unread-delete-for-me.test.ts +84 -0
- package/src/__tests__/web.test.tsx +5 -2
- package/src/core/client.ts +21 -1
- package/src/native/__tests__/inbox-screen-actions.test.tsx +131 -0
- package/src/native/__tests__/inbox-screen.test.tsx +29 -1
- package/src/native/__tests__/thread-layout.test.ts +2 -2
- package/src/native/copy.ts +7 -10
- package/src/native/inbox-screen.tsx +52 -27
- package/src/native/index.ts +1 -1
- package/src/react/inbox-actions.ts +121 -0
- package/src/react/index.tsx +99 -17
- package/src/web/inbox.tsx +120 -11
- package/src/web/index.ts +1 -1
- package/src/web/memory-client.ts +40 -7
- package/dist/chunk-K5GYNHNE.js.map +0 -1
- package/dist/chunk-VBIYDXL2.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/inbox-actions.ts","../src/react/index.tsx"],"names":["list"],"mappings":";;;;;;;AAmCO,IAAM,wBAAA,GAAkD,OAAO,MAAA,CAAO;AAAA,EAC3E,QAAA,EAAU,WAAA;AAAA,EACV,UAAA,EAAY,gBAAA;AAAA,EACZ,GAAA,EAAK,KAAA;AAAA,EACL,KAAA,EAAO,OAAA;AAAA,EACP,UAAA,EAAY,aAAA;AAAA,EACZ,UAAA,EAAY,aAAA;AAAA,EACZ,OAAA,EAAS,SAAA;AAAA,EACT,kBAAA,EAAoB,QAAA;AAAA,EACpB,uBAAA,EAAyB,2BAAA;AAAA,EACzB,sBAAA,EACE,qJAAA;AAAA,EACF,MAAA,EAAQ,QAAA;AAAA,EACR,SAAA,EAAW,YAAA;AAAA,EACX,UAAA,EAAY;AACd,CAAC;AAyBM,SAAS,eAAA,CAAgB,IAAA,EAAqB,GAAA,EAAuB,MAAA,EAA+B,OAAA,EAAmD;AAC5J,EAAA,MAAM,GAAA,GAAM,CAAC,IAAA,KAA2B;AACtC,IAAA,IAAA,CAAK,MAAM,CAAC,KAAA,KAAmB,OAAA,CAAQ,OAAA,GAAU,KAAK,CAAC,CAAA;AAAA,EACzD,CAAA;AACA,EAAA,MAAM,MAAA,GAAS,KAAK,MAAA,GAAS,CAAA;AAC7B,EAAA,OAAO;AAAA,IACL;AAAA,MACE,EAAA,EAAI,SAAS,MAAA,GAAS,QAA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(`inboxRowActions`): Messages' Mark as\n * Unread (or Read) and Pin to the leading side, Hide Alerts and Delete for me to the trailing one,\n * Archive in the menu only. ChatInboxScreen (native) and ChatInbox (web) both take them, and an app\n * reshapes them with `rowActions(item, defaults)`.\n *\n * The look is Messages': Unread blue (`info`), Pin orange, Hide Alerts purple, Delete red.\n */\nimport type { RowSwipeAction } from \"@marktiderman/genesis-core/row-actions\";\nimport type { ChatInboxItem } from \"../core/types\";\n\n/** The words on the inbox's row actions, shared by the native copy and the web inbox. */\nexport interface ChatInboxActionLabels {\n markRead: string;\n /** Mark as Unread (migration 0007): only you see it. */\n markUnread: string;\n pin: string;\n unpin: string;\n /** Mute from the inbox row, as Messages names it. */\n hideAlerts: string;\n showAlerts: string;\n archive: string;\n /** Delete for me (migration 0007), and its confirmation. */\n deleteConversation: string;\n deleteConversationTitle: string;\n deleteConversationBody: string;\n /** The confirmation's Cancel. */\n cancel: string;\n /** A muted row's bell-slash, for a screen reader. */\n alertsOff: string;\n /** A pinned row's pin, for a screen reader. */\n pinnedMark: string;\n}\n\n/** The English words, which the native copy starts from too. */\nexport const defaultInboxActionLabels: ChatInboxActionLabels = Object.freeze({\n markRead: \"Mark read\",\n markUnread: \"Mark as Unread\",\n pin: \"Pin\",\n unpin: \"Unpin\",\n hideAlerts: \"Hide Alerts\",\n showAlerts: \"Show Alerts\",\n archive: \"Archive\",\n deleteConversation: \"Delete\",\n deleteConversationTitle: \"Delete this conversation?\",\n deleteConversationBody:\n \"Its messages are removed for you and it leaves your inbox. Everyone else still sees them. A new message brings it back, with only what comes after.\",\n cancel: \"Cancel\",\n alertsOff: \"Alerts off\",\n pinnedMark: \"Pinned\",\n});\n\n/** Asks before a destructive action: resolves `true` to go ahead. Native passes an Alert, web a dialog. */\nexport type ChatConfirm = (title: string, body: string, confirmLabel: string) => Promise<boolean>;\n\n/** What `useInboxActions` returns: your own actions on one inbox row, each the call's promise. */\nexport interface ChatInboxActions {\n /** Mark as Read when it has unread messages, else Mark as Unread. */\n toggleUnread: (item: ChatInboxItem) => Promise<unknown>;\n togglePinned: (item: ChatInboxItem) => Promise<unknown>;\n /** Show Alerts when muted, else Hide Alerts until `until` (default: until turned back on). */\n toggleMuted: (item: ChatInboxItem, until?: string) => Promise<unknown>;\n setArchived: (item: ChatInboxItem, archived: boolean) => Promise<unknown>;\n /** Delete for me, up to the last message the row showed (`item.lastSeq`). */\n deleteForMe: (item: ChatInboxItem) => Promise<unknown>;\n}\n\nexport interface InboxRowActionsOptions {\n /** Asks before Delete for me. */\n confirm: ChatConfirm;\n /** A failed action: say so (an alert, a toast). Default: nothing. */\n onError?: (error: unknown) => void;\n}\n\n/** One inbox row's actions: Messages' set, in its order and colors. */\nexport function inboxRowActions(item: ChatInboxItem, act: ChatInboxActions, labels: ChatInboxActionLabels, options: InboxRowActionsOptions): RowSwipeAction[] {\n const run = (call: Promise<unknown>) => {\n call.catch((error: unknown) => options.onError?.(error));\n };\n const unread = item.unread > 0;\n return [\n {\n id: unread ? \"read\" : \"unread\",\n label: unread ? labels.markRead : labels.markUnread,\n icon: unread ? \"mail-open\" : \"message-unread\",\n tone: \"info\",\n swipe: { side: \"leading\", full: true },\n onPress: () => run(act.toggleUnread(item)),\n },\n {\n id: \"pin\",\n label: item.pinned ? labels.unpin : labels.pin,\n icon: \"pin\",\n accent: \"orange\",\n swipe: { side: \"leading\" },\n onPress: () => run(act.togglePinned(item)),\n },\n {\n id: \"alerts\",\n label: item.muted ? labels.showAlerts : labels.hideAlerts,\n icon: item.muted ? \"bell\" : \"bell-off\",\n accent: \"purple\",\n swipe: { side: \"trailing\" },\n onPress: () => run(act.toggleMuted(item)),\n },\n {\n id: \"delete\",\n label: labels.deleteConversation,\n icon: \"trash\",\n destructive: true,\n swipe: { side: \"trailing\", full: true },\n // It asks first, so a full swipe can't delete by mistake.\n confirms: true,\n onPress: () =>\n run(\n options.confirm(labels.deleteConversationTitle, labels.deleteConversationBody, labels.deleteConversation).then((ok) => (ok ? act.deleteForMe(item) : undefined)),\n ),\n },\n ...(item.archived ? [] : [{ id: \"archive\", label: labels.archive, icon: \"archive\", swipe: false as const, onPress: () => run(act.setArchived(item, true)) }]),\n ];\n}\n","/**\n * @feat:chat\n * React hooks for chat, the same on web and native: the inbox, one\n * conversation (its messages, members, your role, who is typing) kept live by\n * Realtime hints, sending through the outbox, and message actions. Server\n * state is TanStack Query's; the renderers in /web and /native only draw.\n */\nimport { keepPreviousData, useQueries, useQuery, useQueryClient, type QueryClient } from \"@tanstack/react-query\";\nimport type { ChatInboxActions } from \"./inbox-actions\";\nimport { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport type { ChatClient, ConversationChannel, MessagePage } from \"../core/client\";\nimport {\n createOutbox,\n type HostedUpload,\n type LocalFile,\n type Outbox,\n type OutboxStore,\n type QueuedMessage,\n type StorageUpload,\n} from \"../core/outbox\";\nimport { sendBytes } from \"../core/transfer\";\nimport { currentActivity, firstUnreadId, mergeThread, throttle, upsertMessages, type ThreadItem } from \"../core/thread\";\nimport { attachmentKindFor, randomId } from \"../core/media\";\nimport type {\n AvailabilityInput,\n ChatActivity,\n ChatAttachment,\n ChatAvailability,\n ChatLinkPreview,\n ChatMember,\n ChatMessage,\n ChatSearchHit,\n ChatSignal,\n ChatTopic,\n ScheduleInput,\n ScheduledMessage,\n SendInput,\n StartConversationOptions,\n TopicInput,\n} from \"../core/types\";\n\nexport const chatKeys = {\n all: [\"genesis-chat\"] as const,\n /** Every inbox list (each `inbox(opts)` is under it). */\n inboxAll: () => [\"genesis-chat\", \"inbox\"] as const,\n inbox: (opts?: object) => [\"genesis-chat\", \"inbox\", opts ?? {}] as const,\n unread: () => [\"genesis-chat\", \"unread\"] as const,\n conversation: (id: string) => [\"genesis-chat\", \"conversation\", id] as const,\n members: (id: string) => [\"genesis-chat\", \"members\", id] as const,\n role: (id: string) => [\"genesis-chat\", \"role\", id] as const,\n pins: (id: string) => [\"genesis-chat\", \"pins\", id] as const,\n files: (paths: string[]) => [\"genesis-chat\", \"files\", [...paths].sort()] as const,\n /** Under the conversation's key, so its `conversation` hint (set_topic broadcasts one) refreshes them. */\n topics: (id: string) => [\"genesis-chat\", \"conversation\", id, \"topics\"] as const,\n scheduled: (conversationId?: string | null) => [\"genesis-chat\", \"scheduled\", conversationId ?? null] as const,\n availability: (conversationId: string) => [\"genesis-chat\", \"conversation\", conversationId, \"availability\"] as const,\n myAvailability: () => [\"genesis-chat\", \"my-availability\"] as const,\n /** Every search's results (each `search(query, id)` is under it). */\n searchAll: () => [\"genesis-chat\", \"search\"] as const,\n search: (query: string, conversationId?: string | null) => [\"genesis-chat\", \"search\", conversationId ?? null, query] as const,\n previews: (messageIds: string[]) => [\"genesis-chat\", \"previews\", [...messageIds].sort()] as const,\n /** One message's link previews (useLinkPreviews keeps one query per message). */\n preview: (messageId: string) => [\"genesis-chat\", \"preview\", messageId] as const,\n};\n\n/** Refreshes every inbox list and the unread badge: after anything that changes a row. */\nfunction refreshInbox(queryClient: QueryClient): void {\n void queryClient.invalidateQueries({ queryKey: chatKeys.inboxAll() });\n void queryClient.invalidateQueries({ queryKey: chatKeys.unread() });\n}\n\n/**\n * How many times each conversation has been forgotten, per query cache. A load (a catch-up, a\n * live message, an earlier page) captures it when it starts and writes nothing if it changed, so\n * a fetch already under way when the conversation was deleted can't put its history back. Loads\n * started afterwards write as usual.\n */\nconst forgotten = new WeakMap<QueryClient, Map<string, number>>();\nfunction generationOf(queryClient: QueryClient, conversationId: string): number {\n return forgotten.get(queryClient)?.get(conversationId) ?? 0;\n}\n\n/** Drops what this device holds of a conversation (its thread, pins and every search), so deleted history can't show again. */\nfunction forgetConversation(queryClient: QueryClient, conversationId: string): void {\n let byId = forgotten.get(queryClient);\n if (!byId) forgotten.set(queryClient, (byId = new Map()));\n byId.set(conversationId, generationOf(queryClient, conversationId) + 1);\n queryClient.removeQueries({ queryKey: chatKeys.conversation(conversationId) });\n queryClient.removeQueries({ queryKey: chatKeys.pins(conversationId) });\n queryClient.removeQueries({ queryKey: chatKeys.searchAll() });\n}\n\n/** Hide Alerts from the row: until it's turned back on (a date far enough away to read as always). */\nconst MUTED_FOREVER = \"9999-12-31T00:00:00.000Z\";\n\n/** How many messages a catch-up asks for at a time, and how many pages before it gives up and jumps to the newest. */\nexport const CATCH_UP_PAGE = 200;\nexport const CATCH_UP_MAX_PAGES = 10;\n\n/** What a messages list holds in the query cache: the page, and whether older messages exist. */\nexport type MessagesData = MessagePage;\n\nfunction isMessagesData(v: unknown): v is MessagesData {\n return typeof v === \"object\" && v !== null && Array.isArray((v as MessagesData).messages) && \"hasEarlier\" in v;\n}\n\n/** Adds or replaces messages in a cached list, keeping `hasEarlier`. */\nfunction upsertInto(prev: unknown, incoming: ChatMessage[]): MessagesData | undefined {\n return isMessagesData(prev) ? { ...prev, messages: upsertMessages(prev.messages, incoming) } : undefined;\n}\n\n/** Does a messages list (`[genesis-chat, conversation, id, messages, threadRootId, topic]`) hold this message? */\nexport function belongsTo(key: readonly unknown[], m: ChatMessage): boolean {\n return (\n key[0] === \"genesis-chat\" &&\n key[1] === \"conversation\" &&\n key[2] === m.conversationId &&\n key[3] === \"messages\" &&\n (key[4] ?? null) === (m.threadRootId ?? null) &&\n (key[5] == null || key[5] === m.topic)\n );\n}\n\n/**\n * Hosted video uploads (Mux direct uploads): your server makes an upload and returns its URL\n * (`createVideoUploadHandler` in /server). A video the composer marks `hosted` is sent through\n * the outbox at once, in order, with `{ kind: \"video\", provider, providerId, status: \"pending\" }`,\n * while its bytes are PUT to that URL (see `hostedUploadFrom`). Without it, videos go to storage\n * as files.\n */\nexport interface ChatVideoUpload {\n create(conversationId: string): Promise<{ url: string; providerId: string; provider: \"mux\" }>;\n}\n\n/**\n * The outbox's `hostedUpload` from a `ChatVideoUpload`: mints the upload (or, resuming, reuses\n * the one minted before), resolves at once with its id, and PUTs the whole file to its URL in\n * the background (XMLHttpRequest where there is one, for progress). A native file URI is read\n * with `readFile`. Native apps with chunked, resumable uploads pass their own `hostedUpload`.\n */\nexport function hostedUploadFrom(\n videoUpload: ChatVideoUpload,\n options: { readFile?: (uri: string) => Promise<Blob | ArrayBuffer>; fetch?: typeof fetch } = {},\n): HostedUpload {\n return async (conversationId, file, { signal, onProgress, resume }) => {\n const minted = resume?.url\n ? { url: resume.url, providerId: resume.providerId, provider: resume.provider }\n : await videoUpload.create(conversationId);\n const done = (async () => {\n const body =\n typeof file.data === \"string\"\n ? await (options.readFile ?? (() => Promise.reject(new Error(\"This file can't be read on this device\"))))(file.data)\n : file.data;\n await sendBytes(minted.url, body, { method: \"PUT\", headers: { \"Content-Type\": file.contentType }, signal, onProgress, fetch: options.fetch });\n })();\n return { provider: minted.provider, providerId: minted.providerId, status: \"pending\", url: minted.url, done };\n };\n}\n\n/** What a kind's `title`, `subtitle` and `action` are told besides the attachment. */\nexport interface ChatCardContext {\n /** The card is on a message you sent (your own check-in reads \"Sent\", not \"Answer\"). */\n mine: boolean;\n}\n\n/** What an app attachment kind's card shows (a form, a check-in): plain data, drawn by each renderer. */\nexport interface ChatAttachmentKind {\n title(attachment: ChatAttachment, ctx?: ChatCardContext): string;\n subtitle?(attachment: ChatAttachment, ctx?: ChatCardContext): string | null | undefined;\n /**\n * The card's button: a link (`href`) or a handler (`onPress`). On native the button is also the\n * bubble's VoiceOver action, and a handler that returns a promise shows the card as busy until\n * it settles (and a short error if it rejects).\n */\n action?(attachment: ChatAttachment, ctx?: ChatCardContext): { label: string; href?: string; onPress?: () => void | Promise<unknown> } | null | undefined;\n /** What previews call it (the inbox's last message, \"Check-in\"); the title by default. */\n label?: string;\n}\n\ninterface ChatContextValue {\n client: ChatClient;\n userId: string;\n outbox: Outbox;\n queue: QueuedMessage[];\n loadPeople?: (userIds: string[]) => Promise<Record<string, ChatPerson>>;\n videoUpload?: ChatVideoUpload;\n attachmentKinds?: Record<string, ChatAttachmentKind>;\n /** Retries every failed message (call it when the connection comes back: AppState, NetInfo). */\n retryAll(): Promise<void>;\n /** Forgets every unsent message, here and in the outbox store (call it on sign-out). */\n clearOutbox(): Promise<void>;\n /** Subscribe to inbox hints (one channel for the app, fanned out here). */\n onInbox(listener: (s: ChatSignal) => void): () => void;\n}\n\nconst ChatContext = createContext<ChatContextValue | null>(null);\n\nexport interface ChatProviderProps {\n client: ChatClient;\n /** The signed-in user's id (auth.users). */\n userId: string;\n /** Where unsent messages wait between launches (localStorage, MMKV…). Memory by default. */\n outboxStore?: OutboxStore;\n /** Reads a native file URI for upload. */\n readFile?: (uri: string) => Promise<Blob | ArrayBuffer>;\n /**\n * Replaces the plain upload (resumable uploads on native). `signal` aborts when the message is\n * discarded or the outbox cleared; `onProgress(sent, total)` fills the pending bubble's bar.\n */\n upload?: StorageUpload;\n /**\n * Starts a hosted upload for files marked `hosted` (see HostedUpload): resolve with\n * `{ provider, providerId, status: \"pending\", url?, done }` once the upload id exists. Default:\n * `hostedUploadFrom(videoUpload)` when `videoUpload` is given.\n */\n hostedUpload?: HostedUpload;\n /** Makes client ids (default: a random UUID that works without crypto.randomUUID). */\n newId?: () => string;\n /** Keeps a byte file (a pasted image, a recording) across launches: write it, return a URI. */\n persistFile?: (file: LocalFile) => Promise<string>;\n /** Lets go of a sent file's preview (default: revokes `blob:` object URLs only). */\n releasePreview?: (url: string) => void;\n /** Names and avatars for user ids, fetched in batches (usePeople, usePerson). */\n loadPeople?: (userIds: string[]) => Promise<Record<string, ChatPerson>>;\n /** Hosted video uploads (Mux); videos go to storage without it. */\n videoUpload?: ChatVideoUpload;\n /** Cards for your own attachment kinds (`{ form: { title, subtitle, action } }`). */\n attachmentKinds?: Record<string, ChatAttachmentKind>;\n children: ReactNode;\n}\n\n/** How the app shows a person. */\nexport interface ChatPerson {\n name: string;\n avatarUrl?: string | null;\n}\n\n/** Puts chat in reach of every hook below it. Needs a TanStack QueryClientProvider above it. */\nexport function ChatProvider({\n client,\n userId,\n outboxStore,\n readFile,\n upload,\n hostedUpload,\n newId,\n persistFile,\n releasePreview,\n loadPeople,\n videoUpload,\n attachmentKinds,\n children,\n}: ChatProviderProps) {\n const queryClient = useQueryClient();\n const [queue, setQueue] = useState<QueuedMessage[]>([]);\n const listeners = useRef(new Set<(s: ChatSignal) => void>());\n // The outbox lives as long as the client and user, so it reads the app's functions here at call\n // time: an inline `videoUpload.create` closing over a refreshed token keeps working.\n const live = useRef({ readFile, upload, hostedUpload, videoUpload, persistFile });\n live.current = { readFile, upload, hostedUpload, videoUpload, persistFile };\n\n const outbox = useMemo(\n () =>\n createOutbox({\n client,\n userId,\n store: outboxStore,\n readFile: readFile && ((uri) => (live.current.readFile ?? readFile)(uri)),\n upload: upload && ((...args) => (live.current.upload ?? upload)(...args)),\n hostedUpload:\n hostedUpload || videoUpload\n ? (...args) => {\n const now = live.current;\n const video = now.videoUpload ?? videoUpload;\n const send = now.hostedUpload ?? (video ? hostedUploadFrom(video, { readFile: now.readFile ?? readFile }) : hostedUpload!);\n return send(...args);\n }\n : undefined,\n newId,\n persistFile: persistFile && ((file) => (live.current.persistFile ?? persistFile)(file)),\n releasePreview,\n onChange: setQueue,\n onSent: (message) => {\n // Into every loaded list it belongs to (the main timeline, its thread, its topic), so\n // the bubble never disappears between the send landing and the live hint.\n queryClient.setQueriesData<MessagesData>(\n { predicate: (q) => belongsTo(q.queryKey, message) },\n (prev) => upsertInto(prev, [message]) ?? prev,\n );\n void queryClient.invalidateQueries({ queryKey: [\"genesis-chat\", \"scheduled\"] });\n refreshInbox(queryClient);\n },\n }),\n // A new person or client is a new outbox.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [client, userId],\n );\n\n useEffect(() => {\n // What a relaunch left unsent is retried once (messages waiting for a lost file stay put),\n // and again whenever the browser comes back online.\n void outbox.load().then(() => outbox.retryAll()).catch(() => undefined);\n const online = () => void outbox.retryAll().catch(() => undefined);\n const target = typeof window !== \"undefined\" && typeof window.addEventListener === \"function\" ? window : null;\n target?.addEventListener(\"online\", online);\n const sub = client.subscribeInbox(userId, (signal) => {\n refreshInbox(queryClient);\n for (const l of listeners.current) l(signal);\n });\n return () => {\n sub.unsubscribe();\n target?.removeEventListener(\"online\", online);\n };\n }, [client, userId, outbox, queryClient]);\n\n const value = useMemo<ChatContextValue>(\n () => ({\n client,\n userId,\n outbox,\n queue,\n loadPeople,\n videoUpload,\n attachmentKinds,\n retryAll: () => outbox.retryAll(),\n clearOutbox: () => outbox.clear(),\n onInbox: (l) => {\n listeners.current.add(l);\n return () => listeners.current.delete(l);\n },\n }),\n [client, userId, outbox, queue, loadPeople, videoUpload, attachmentKinds],\n );\n return <ChatContext.Provider value={value}>{children}</ChatContext.Provider>;\n}\n\nexport function useChat(): ChatContextValue {\n const ctx = useContext(ChatContext);\n if (!ctx) throw new Error(\"Chat hooks need a <ChatProvider> above them.\");\n return ctx;\n}\n\n/** Your conversations, live. `kind` narrows to one kind; `archived` shows the archived ones. */\nexport function useInbox(opts: { kind?: string; kinds?: string[]; excludeKinds?: string[]; archived?: boolean; limit?: number } = {}) {\n const { client } = useChat();\n const query = useQuery({ queryKey: chatKeys.inbox(opts), queryFn: () => client.inbox(opts), staleTime: 15_000 });\n return { items: query.data ?? [], isLoading: query.isLoading, error: query.error, refetch: query.refetch };\n}\n\n/** How many messages wait for you everywhere (for a badge), live. */\nexport function useUnreadTotal(opts: { excludeKinds?: string[] } = {}): number {\n const { client } = useChat();\n return (\n useQuery({ queryKey: [...chatKeys.unread(), opts.excludeKinds ?? []], queryFn: () => client.unreadTotal(opts), staleTime: 15_000 }).data ??\n 0\n );\n}\n\nexport interface UseConversationOptions {\n /** Mark messages read as they arrive while this is true (the thread is on screen). Default true. */\n markRead?: boolean;\n /** One thread's replies instead of the main timeline. */\n threadRootId?: string;\n /** One topic's messages. */\n topic?: string;\n pageSize?: number;\n}\n\n/** One conversation: its messages (with what you are still sending), members, your role, and who is typing. */\n/** How long a `read` hint waits for others before the members are read again. */\nconst READ_REFETCH_MS = 300;\n\nexport function useConversation(conversationId: string | null | undefined, opts: UseConversationOptions = {}) {\n const { client, userId, outbox, queue } = useChat();\n const queryClient = useQueryClient();\n const id = conversationId ?? \"\";\n const enabled = Boolean(conversationId);\n const pageSize = opts.pageSize ?? 50;\n const messagesKey = useMemo(\n () => [...chatKeys.conversation(id), \"messages\", opts.threadRootId ?? null, opts.topic ?? null] as const,\n [id, opts.threadRootId, opts.topic],\n );\n\n const conversation = useQuery({ queryKey: chatKeys.conversation(id), queryFn: () => client.conversation(id), enabled });\n const members = useQuery({ queryKey: chatKeys.members(id), queryFn: () => client.members(id), enabled, staleTime: 60_000, refetchOnMount: \"always\" });\n const kindRules = useQuery({\n queryKey: [\"genesis-chat\", \"kind\", conversation.data?.kind ?? \"\"],\n queryFn: () => client.kind(conversation.data!.kind),\n enabled: Boolean(conversation.data?.kind),\n staleTime: 10 * 60_000,\n });\n const access = useQuery({\n queryKey: chatKeys.role(id),\n queryFn: async () => ({ role: await client.myRole(id), canPost: await client.canPost(id) }),\n enabled,\n staleTime: 60_000,\n });\n\n const [loadingEarlier, setLoadingEarlier] = useState(false);\n const fetchPage = useCallback(\n () => client.messages(id, { limit: pageSize, threadRootId: opts.threadRootId, topic: opts.topic }),\n [client, id, pageSize, opts.threadRootId, opts.topic],\n );\n // Kept fresh by live hints and the catch-up on every join, so never refetched on its own.\n const messages = useQuery<MessagesData>({ queryKey: messagesKey, queryFn: fetchPage, enabled, staleTime: Infinity });\n const hasEarlier = messages.data?.hasEarlier ?? false;\n // Where \"New\" goes: what you had read when the conversation opened.\n const [readWhenOpened, setReadWhenOpened] = useState<number | null>(null);\n // Another conversation in the same screen (a split view, no remount) opens at its own read place:\n // forget the last one's, and read this one's members afresh (a cached copy may be from an earlier visit).\n const [openedFor, setOpenedFor] = useState(id);\n if (openedFor !== id) {\n setOpenedFor(id);\n setReadWhenOpened(null);\n }\n const { refetch: refetchMembers } = members;\n const firstId = useRef(id);\n useEffect(() => {\n if (firstId.current === id) return;\n firstId.current = id;\n if (enabled) void refetchMembers();\n }, [id, enabled, refetchMembers]);\n\n /**\n * Merges messages into the list. `since` is the conversation's forget generation when the load\n * began (see forgetConversation): when it has moved on, the load predates a Delete for me and\n * writes nothing.\n */\n const merge = useCallback(\n (incoming: ChatMessage[], hasEarlierNow?: boolean, since = generationOf(queryClient, id)) => {\n if (generationOf(queryClient, id) !== since) return;\n queryClient.setQueryData<MessagesData>(messagesKey, (prev) => {\n const base = prev ?? { messages: [], hasEarlier: false };\n return { messages: upsertMessages(base.messages, incoming), hasEarlier: hasEarlierNow ?? base.hasEarlier };\n });\n },\n [queryClient, messagesKey, id],\n );\n\n /**\n * Fetches what came after the newest message held (everything, for an empty list). Runs on\n * every join of the live channel, the first included, so messages that arrived while the\n * thread was closed, or between the first fetch and the subscription, always show. Pages\n * until a short one; after CATCH_UP_MAX_PAGES full pages (a long time away from a busy group)\n * it shows the newest page instead, with the rest behind \"load earlier\".\n */\n const catchUp = useCallback(async () => {\n const since = generationOf(queryClient, id);\n const current = queryClient.getQueryData<MessagesData>(messagesKey) ?? (await queryClient.ensureQueryData<MessagesData>({ queryKey: messagesKey, queryFn: fetchPage }));\n const list = current.messages;\n let after = list.length ? list[list.length - 1]!.seq : 0;\n for (let pages = 0; ; ) {\n const page = await client.messages(id, { afterSeq: after, limit: CATCH_UP_PAGE, threadRootId: opts.threadRootId, topic: opts.topic });\n if (generationOf(queryClient, id) !== since) return;\n if (page.messages.length) merge(page.messages, undefined, since);\n if (page.messages.length < CATCH_UP_PAGE) return;\n after = Math.max(after, ...page.messages.map((m) => m.seq));\n if (++pages >= CATCH_UP_MAX_PAGES) break;\n }\n const newest = await fetchPage();\n if (generationOf(queryClient, id) !== since) return;\n queryClient.setQueryData<MessagesData>(messagesKey, { messages: newest.messages, hasEarlier: true });\n }, [client, fetchPage, id, merge, messagesKey, opts.threadRootId, opts.topic, queryClient]);\n\n const [activity, setActivity] = useState<ChatActivity[]>([]);\n const channel = useRef<ConversationChannel | null>(null);\n // Whether the live channel is joined: null until the client first says, false when it dropped.\n const [live, setLive] = useState<boolean | null>(null);\n useEffect(() => {\n if (!enabled) return;\n setLive(null);\n const fetchOne = async (messageId: string) => {\n const since = generationOf(queryClient, id);\n const m = await client.message(messageId);\n if (!m) return;\n const belongs = opts.threadRootId ? m.threadRootId === opts.threadRootId : m.threadRootId === null;\n if (belongs && (!opts.topic || m.topic === opts.topic)) merge([m], undefined, since);\n if (m.threadRootId && !opts.threadRootId) {\n const root = await client.message(m.threadRootId);\n if (root) merge([root], undefined, since);\n }\n };\n let readRefetch: ReturnType<typeof setTimeout> | null = null;\n channel.current = client.subscribeConversation(id, userId, {\n onSignal: (s) => {\n if (s.type === \"message\") void fetchOne(s.id);\n else if (s.type === \"reaction\") void fetchOne(s.messageId);\n else if (s.type === \"read\") {\n // Read receipts: a cue to read the members again, never the read place itself (a payload\n // is only as good as whoever sent it). Coalesced, so a burst of reads is one fetch.\n if (readRefetch === null) {\n readRefetch = setTimeout(() => {\n readRefetch = null;\n void queryClient.invalidateQueries({ queryKey: chatKeys.members(id) });\n }, READ_REFETCH_MS);\n }\n } else if (s.type === \"members\") {\n void queryClient.invalidateQueries({ queryKey: chatKeys.members(id) });\n void queryClient.invalidateQueries({ queryKey: chatKeys.role(id) });\n } else if (s.type === \"conversation\") {\n // The conversation row, its topics and availability (not its messages, kept by hints).\n void queryClient.invalidateQueries({ queryKey: chatKeys.conversation(id), exact: true });\n void queryClient.invalidateQueries({ queryKey: chatKeys.topics(id) });\n void queryClient.invalidateQueries({ queryKey: chatKeys.pins(id) });\n }\n },\n onActivity: (a) => setActivity((prev) => currentActivity([...prev, a])),\n // Every join: what was missed while the channel was down, messages and read places both.\n onJoin: () => {\n void catchUp().catch(() => undefined);\n void queryClient.invalidateQueries({ queryKey: chatKeys.members(id) });\n },\n onLive: setLive,\n });\n return () => {\n if (readRefetch) clearTimeout(readRefetch);\n channel.current?.unsubscribe();\n channel.current = null;\n };\n }, [client, enabled, id, userId, merge, catchUp, queryClient, opts.threadRootId, opts.topic]);\n\n // Activity fades after a few seconds without news.\n useEffect(() => {\n if (activity.length === 0) return;\n const t = setTimeout(() => setActivity((prev) => currentActivity(prev)), 2000);\n return () => clearTimeout(t);\n }, [activity]);\n\n const list = useMemo(() => messages.data?.messages ?? [], [messages.data]);\n const latestSeq = list.length ? list[list.length - 1]!.seq : 0;\n // Where \"New\" goes comes from your read place as fetched for this opening, never a cached\n // copy from an earlier visit (which would draw the line above messages already read).\n const myLastRead = members.isFetchedAfterMount ? members.data?.find((m) => m.userId === userId)?.lastReadSeq : undefined;\n useEffect(() => {\n if (readWhenOpened === null && myLastRead !== undefined) setReadWhenOpened(myLastRead);\n }, [myLastRead, readWhenOpened]);\n\n const markRead = useCallback(async () => {\n if (!enabled || latestSeq === 0) return;\n await client.markRead(id, latestSeq);\n refreshInbox(queryClient);\n }, [client, enabled, id, latestSeq, queryClient]);\n\n // Your read place is one number for the whole conversation, so only the whole timeline moves\n // it: a topic (or a thread) shows a slice, and marking up to its newest message would also\n // mark unseen messages in other topics read.\n const shouldMark = opts.markRead !== false && !opts.threadRootId && !opts.topic;\n useEffect(() => {\n if (shouldMark && latestSeq > 0) void markRead().catch(() => undefined);\n }, [shouldMark, latestSeq, markRead]);\n\n const refetchConversation = useCallback(\n () =>\n Promise.all([\n // The conversation and what hangs off it (topics, availability), never its message lists:\n // a refetch would replace loaded history and merged live messages with one fresh page.\n queryClient.refetchQueries({ queryKey: chatKeys.conversation(id), predicate: (q) => q.queryKey[3] !== \"messages\" }),\n queryClient.refetchQueries({ queryKey: chatKeys.members(id) }),\n queryClient.refetchQueries({ queryKey: chatKeys.role(id) }),\n queryClient.refetchQueries({ queryKey: chatKeys.pins(id) }),\n queryClient.refetchQueries({ queryKey: [\"genesis-chat\", \"kind\"] }),\n ]).then(() => undefined),\n [queryClient, id],\n );\n\n const { refetch: refetchMessages } = messages;\n const { refetch: refetchConversationRow } = conversation;\n const reload = useCallback(\n () => Promise.all([refetchConversationRow(), refetchMessages()]).then(() => undefined),\n [refetchConversationRow, refetchMessages],\n );\n\n const loadEarlier = useCallback(async () => {\n const first = list[0];\n if (!first || loadingEarlier) return;\n setLoadingEarlier(true);\n const since = generationOf(queryClient, id);\n try {\n const page = await client.messages(id, { beforeSeq: first.seq, limit: pageSize, threadRootId: opts.threadRootId, topic: opts.topic });\n merge(page.messages, page.hasEarlier, since);\n } finally {\n setLoadingEarlier(false);\n }\n }, [client, id, list, loadingEarlier, merge, opts.threadRootId, opts.topic, pageSize, queryClient]);\n\n /** Loads earlier messages until the one with this seq is held (a search result, a pinned message). True when it is. */\n const loadUntil = useCallback(\n async (seq: number) => {\n const since = generationOf(queryClient, id);\n let current = queryClient.getQueryData<MessagesData>(messagesKey);\n for (let guard = 0; guard < 20 && current; guard++) {\n const first = current.messages[0];\n if (!first || first.seq <= seq || !current.hasEarlier) break;\n const page = await client.messages(id, {\n beforeSeq: first.seq,\n limit: Math.min(200, first.seq - seq + 10),\n threadRootId: opts.threadRootId,\n topic: opts.topic,\n });\n if (generationOf(queryClient, id) !== since) return false;\n merge(page.messages, page.hasEarlier, since);\n current = queryClient.getQueryData<MessagesData>(messagesKey);\n }\n return Boolean(current?.messages.some((m) => m.seq === seq));\n },\n [client, id, merge, messagesKey, opts.threadRootId, opts.topic, queryClient],\n );\n\n const pending = useMemo(\n () =>\n queue.filter(\n (q) =>\n q.input.conversationId === id &&\n (q.input.threadRootId ?? null) === (opts.threadRootId ?? null) &&\n (!opts.topic || q.input.topic === opts.topic),\n ).map((q) => ({ ...q, files: q.pendingFiles })),\n [queue, id, opts.threadRootId, opts.topic],\n );\n const items: ThreadItem[] = useMemo(() => mergeThread(list, pending), [list, pending]);\n\n const signalTyping = useMemo(() => throttle(() => channel.current?.signal(\"typing\")), []);\n const signalRecording = useMemo(\n () => throttle(() => channel.current?.signal(\"recording-voice\")),\n [],\n );\n const signalRecordingVideo = useMemo(() => throttle(() => channel.current?.signal(\"recording-video\")), []);\n\n /** Sends text and files to this conversation (through the outbox: shown at once, retried safely). */\n const send = useCallback(\n (input: Omit<SendInput, \"conversationId\" | \"clientId\">, files: LocalFile[] = []) =>\n outbox.send({ ...input, conversationId: id, threadRootId: input.threadRootId ?? opts.threadRootId, topic: input.topic ?? opts.topic }, files),\n [outbox, id, opts.threadRootId, opts.topic],\n );\n\n return {\n conversation: conversation.data ?? null,\n members: members.data ?? [],\n role: access.data?.role ?? null,\n canPost: access.data?.canPost ?? false,\n /** Your role and posting rights are still loading: show the composer as waiting, not refused. */\n accessLoading: enabled && access.isLoading,\n /** The conversation itself is still loading (it settles to `null` when you can't see it). */\n conversationLoading: conversation.isLoading,\n /** Your role couldn't be loaded (offline): offer `refetchAccess`, don't say \"can't post\". */\n accessError: access.error ?? null,\n /** Retries everything this conversation loads (role, members, the conversation, topics, availability, pins), not only access. */\n refetchAccess: refetchConversation,\n /** Same as refetchAccess: every per-conversation lookup again, for a Retry after being offline. */\n refetchConversation,\n /** The kind's rules (max members, threads, who posts). */\n kind: kindRules.data ?? null,\n /** May you pin here: owners and admins, or anyone in a two-person conversation. */\n canPin:\n access.data?.role === \"owner\" ||\n access.data?.role === \"admin\" ||\n (access.data?.role === \"member\" && kindRules.data?.maxMembers === 2),\n /** Gives a message whose files were lost on a relaunch its files again. */\n reattach: outbox.reattach,\n items,\n messages: list,\n isLoading: messages.isLoading || conversation.isLoading,\n error: messages.error ?? conversation.error,\n hasEarlier,\n loadingEarlier,\n loadEarlier,\n loadUntil,\n /** Where to draw the \"New\" line, from what you had read when it opened. */\n firstUnreadId: readWhenOpened === null ? null : firstUnreadId(list, readWhenOpened, userId),\n /** Whether `firstUnreadId` is known yet (your read place as of this opening has been fetched). */\n firstUnreadKnown: readWhenOpened !== null,\n activity: currentActivity(activity),\n signalTyping,\n signalRecording,\n /** Tells the others you are recording a video (throttled). */\n signalRecordingVideo,\n markRead,\n send,\n retry: outbox.retry,\n discard: outbox.discard,\n refetch: catchUp,\n /** The conversation and its first page again, after either failed (a Retry on the thread's error row). */\n reload,\n /** The live channel: true once joined, false when it dropped (errored, timed out, closed), null until the client says. */\n live,\n };\n}\n\nexport type ConversationState = ReturnType<typeof useConversation>;\n\n/** Edit, delete, react, pin, save and report, refreshing what they change. */\nexport function useMessageActions() {\n const { client } = useChat();\n const queryClient = useQueryClient();\n return useMemo(() => {\n const refresh = async (conversationId: string, messageId: string) => {\n const m = await client.message(messageId);\n queryClient.setQueriesData<MessagesData>({ queryKey: chatKeys.conversation(conversationId) }, (prev) =>\n m ? (upsertInto(prev, [m]) ?? prev) : prev,\n );\n };\n return {\n edit: async (m: ChatMessage, body: string, mentions: string[] = []) => {\n await client.edit(m.id, body, mentions);\n await refresh(m.conversationId, m.id);\n },\n remove: async (m: ChatMessage) => {\n await client.remove(m.id);\n await refresh(m.conversationId, m.id);\n },\n react: async (m: ChatMessage, emoji: string, on: boolean) => {\n await client.react(m.id, emoji, on);\n await refresh(m.conversationId, m.id);\n },\n pin: async (m: ChatMessage, on: boolean) => {\n await client.pin(m.id, on);\n void queryClient.invalidateQueries({ queryKey: chatKeys.pins(m.conversationId) });\n },\n save: (m: ChatMessage, on: boolean, note?: string) => client.save(m.id, on, note),\n report: (m: ChatMessage, reason: \"spam\" | \"harassment\" | \"safety\" | \"other\", note?: string) => client.report(m.id, reason, note),\n };\n }, [client, queryClient]);\n}\n\n/**\n * Your own actions on one inbox row (Mark as Unread or Read, Pin, Hide Alerts, Archive, Delete for\n * me), refreshing the inbox and badge afterwards. Each takes the row's item and returns the call's\n * promise, so a failure reaches the caller to show. Delete for me reads the row's `lastSeq` (what\n * you saw) and drops the conversation's cached thread, pins and search results, so its deleted\n * history can't show again on this device when a new message brings it back.\n * `inboxRowActions(item, actions, labels, { confirm })` turns them into the row's swipe and menu.\n */\nexport function useInboxActions(): ChatInboxActions {\n const { client } = useChat();\n const queryClient = useQueryClient();\n return useMemo(() => {\n const run = async <T,>(call: () => Promise<T>): Promise<T> => {\n try {\n return await call();\n } finally {\n refreshInbox(queryClient);\n }\n };\n return {\n toggleUnread: (item) =>\n run<unknown>(() => (item.unread > 0 ? client.markRead(item.conversationId) : client.setMySettings(item.conversationId, { markedUnread: true }))),\n togglePinned: (item) => run(() => client.setMySettings(item.conversationId, { pinned: !item.pinned })),\n toggleMuted: (item, until = MUTED_FOREVER) => run(() => client.setMySettings(item.conversationId, { mutedUntil: item.muted ? null : until })),\n setArchived: (item, archived) => run(() => client.setMySettings(item.conversationId, { archived })),\n deleteForMe: (item) =>\n run(async () => {\n await client.deleteConversationForMe(item.conversationId, item.lastSeq);\n forgetConversation(queryClient, item.conversationId);\n }),\n };\n }, [client, queryClient]);\n}\n\n/**\n * What the read hooks return while there is nothing yet: one frozen object (and array) for every\n * caller, so a row's memo holds across renders instead of seeing a fresh `{}` each time.\n */\nconst NO_PEOPLE: Record<string, ChatPerson> = Object.freeze({}) as Record<string, ChatPerson>;\nconst NO_URLS: Record<string, string> = Object.freeze({}) as Record<string, string>;\nconst NO_PINS: string[] = Object.freeze([]) as unknown as string[];\n\n/**\n * Names and avatars for these people, from the provider's `loadPeople`, fetched as one\n * batch per set of ids and cached. Unknown ids are left out.\n */\nexport function usePeople(userIds: (string | null | undefined)[]): Record<string, ChatPerson> {\n const { loadPeople } = useChat();\n const ids = useMemo(() => [...new Set(userIds.filter((x): x is string => Boolean(x)))].sort(), [userIds]);\n return (\n useQuery({\n queryKey: [\"genesis-chat\", \"people\", ids],\n queryFn: () => loadPeople!(ids),\n enabled: Boolean(loadPeople) && ids.length > 0,\n staleTime: 5 * 60_000,\n }).data ?? NO_PEOPLE\n );\n}\n\n/** One person's name and avatar (see usePeople). */\nexport function usePerson(userId: string | null | undefined): ChatPerson | null {\n const people = usePeople(useMemo(() => [userId], [userId]));\n return userId ? (people[userId] ?? null) : null;\n}\n\n/** The pinned message ids of a conversation. */\nexport function usePins(conversationId: string | null | undefined): string[] {\n const { client } = useChat();\n return (\n useQuery({ queryKey: chatKeys.pins(conversationId ?? \"\"), queryFn: () => client.pins(conversationId!), enabled: Boolean(conversationId) }).data ?? NO_PINS\n );\n}\n\n/**\n * Signed links for files (cached by the client until shortly before they expire). While a new set\n * of paths loads (a photo arrives), the links already signed stay: the photos on screen don't blank.\n */\nexport function useFileUrls(paths: (string | null | undefined)[]): Record<string, string> {\n const { client } = useChat();\n const list = useMemo(() => [...new Set(paths.filter((p): p is string => Boolean(p)))], [paths]);\n return (\n useQuery({\n queryKey: chatKeys.files(list),\n queryFn: () => client.fileUrls(list),\n enabled: list.length > 0,\n staleTime: 50 * 60_000,\n placeholderData: keepPreviousData,\n }).data ?? NO_URLS\n );\n}\n\n/** Starts (or finds again) a conversation, then refreshes the inbox. */\nexport function useStartConversation() {\n const { client } = useChat();\n const queryClient = useQueryClient();\n return useCallback(\n async (kind: string, memberIds: string[], opts?: StartConversationOptions) => {\n const id = await client.startConversation(kind, memberIds, opts);\n refreshInbox(queryClient);\n return id;\n },\n [client, queryClient],\n );\n}\n\n// ── Migration 0002: topics, scheduled send, availability, broadcast, search, previews ──\n\n/**\n * A conversation's topics, live (set_topic's hint refreshes them), and `setTopic` for owners\n * and admins: add one (`setTopic(\"week-1\", { title: \"Week 1\" })`), close or reopen it.\n */\nexport function useTopics(conversationId: string | null | undefined) {\n const { client } = useChat();\n const queryClient = useQueryClient();\n const id = conversationId ?? \"\";\n const query = useQuery({ queryKey: chatKeys.topics(id), queryFn: () => client.topics(id), enabled: Boolean(conversationId), staleTime: 60_000 });\n const setTopic = useCallback(\n async (topic: string, input: TopicInput = {}) => {\n await client.setTopic(id, topic, input);\n await queryClient.invalidateQueries({ queryKey: chatKeys.topics(id) });\n },\n [client, id, queryClient],\n );\n const topics: ChatTopic[] = query.data ?? [];\n return { topics, isLoading: query.isLoading, error: query.error, setTopic, refetch: query.refetch };\n}\n\n/**\n * Your scheduled messages (in one conversation, or all), soonest first, with `schedule` and\n * `cancel` (which also removes one that failed). `schedule` uploads its files to storage first,\n * the way `send` does (the provider's `upload` hook, or a native URI read through `readFile`),\n * then schedules them with the message. A file marked `hosted` goes to storage too.\n */\nexport function useScheduled(conversationId?: string | null, opts: { enabled?: boolean } = {}) {\n const { client, outbox } = useChat();\n const queryClient = useQueryClient();\n const query = useQuery({\n queryKey: chatKeys.scheduled(conversationId),\n queryFn: () => client.scheduled(conversationId ?? undefined),\n enabled: opts.enabled ?? true,\n staleTime: 30_000,\n });\n const refresh = useCallback(() => queryClient.invalidateQueries({ queryKey: [\"genesis-chat\", \"scheduled\"] }), [queryClient]);\n const schedule = useCallback(\n async (input: Omit<ScheduleInput, \"clientId\"> & { clientId?: string }, files: LocalFile[] = []) => {\n const attachments = [...(input.attachments ?? [])];\n for (const f of files) {\n const path = await outbox.uploadFile(input.conversationId, f);\n attachments.push({ ...f.meta, kind: f.meta?.kind ?? attachmentKindFor(f.contentType), path, name: f.meta?.name ?? f.name, mime: f.contentType });\n }\n const id = await client.schedule({ ...input, clientId: input.clientId ?? randomId(), attachments });\n await refresh();\n return id;\n },\n [client, outbox, refresh],\n );\n const cancel = useCallback(\n async (id: string) => {\n queryClient.setQueriesData<ScheduledMessage[]>({ queryKey: [\"genesis-chat\", \"scheduled\"] }, (prev) => (Array.isArray(prev) ? prev.filter((s) => s.id !== id) : prev));\n try {\n await client.cancelScheduled(id);\n } finally {\n await refresh();\n }\n },\n [client, queryClient, refresh],\n );\n const items: ScheduledMessage[] = query.data ?? [];\n return { items, isLoading: query.isLoading, error: query.error, schedule, cancel, refetch: query.refetch };\n}\n\n/**\n * Availability: yours (`mine`, `setMine`) and, given a conversation, its members' (`members`,\n * `forUser`). Pair with `awayLine` and `isWithinWorkingHours` from the core.\n */\nexport function useAvailability(conversationId?: string | null) {\n const { client, userId } = useChat();\n const queryClient = useQueryClient();\n const mine = useQuery({ queryKey: chatKeys.myAvailability(), queryFn: () => client.myAvailability(), staleTime: 5 * 60_000 });\n const members = useQuery({\n queryKey: chatKeys.availability(conversationId ?? \"\"),\n queryFn: () => client.availabilityFor(conversationId!),\n enabled: Boolean(conversationId),\n staleTime: 5 * 60_000,\n });\n const setMine = useCallback(\n async (input: AvailabilityInput) => {\n await client.setAvailability(input);\n await queryClient.invalidateQueries({ queryKey: chatKeys.myAvailability() });\n await queryClient.invalidateQueries({ predicate: (q) => q.queryKey[0] === \"genesis-chat\" && q.queryKey[3] === \"availability\" });\n },\n [client, queryClient],\n );\n const list: ChatAvailability[] = members.data ?? [];\n const forUser = useCallback((id: string) => list.find((a) => a.userId === id) ?? null, [list]);\n return {\n mine: mine.data ?? null,\n mineLoading: mine.isLoading,\n setMine,\n members: list,\n /** Everyone else's, without yours. */\n others: list.filter((a) => a.userId !== userId),\n forUser,\n isLoading: mine.isLoading || (Boolean(conversationId) && members.isLoading),\n };\n}\n\n/** Sends one message into many conversations (replies come back privately in each). */\nexport function useBroadcast() {\n const { client } = useChat();\n const queryClient = useQueryClient();\n const [sending, setSending] = useState(false);\n const send = useCallback(\n async (conversationIds: string[], body: string, opts: { silent?: boolean; clientId?: string } = {}) => {\n setSending(true);\n try {\n const ids = await client.broadcast(conversationIds, opts.clientId ?? randomId(), body, { silent: opts.silent });\n refreshInbox(queryClient);\n return ids;\n } finally {\n setSending(false);\n }\n },\n [client, queryClient],\n );\n return { send, sending };\n}\n\n/** The value, once it has stopped changing for `ms`. */\nexport function useDebouncedValue<T>(value: T, ms: number): T {\n const [v, setV] = useState(value);\n useEffect(() => {\n if (ms <= 0) {\n setV(value);\n return;\n }\n const t = setTimeout(() => setV(value), ms);\n return () => clearTimeout(t);\n }, [value, ms]);\n return ms <= 0 ? value : v;\n}\n\n/** Search, debounced (250 ms by default), in one conversation or all of yours. Queries under two characters return nothing. */\nexport function useSearch(query: string, opts: { conversationId?: string | null; debounceMs?: number; limit?: number } = {}) {\n const { client } = useChat();\n const q = useDebouncedValue(query.trim(), opts.debounceMs ?? 250);\n const enabled = q.length >= 2;\n const result = useQuery({\n queryKey: chatKeys.search(q, opts.conversationId),\n queryFn: () => client.search(q, opts.conversationId ?? null, { limit: opts.limit }),\n enabled,\n staleTime: 30_000,\n });\n const hits: ChatSearchHit[] = enabled ? (result.data ?? []) : [];\n return {\n hits,\n /** The query the hits are for. */\n query: q,\n /** Typing, or fetching: results are on their way. */\n isSearching: query.trim() !== q || (enabled && result.isFetching),\n error: result.error,\n };\n}\n\n/** At most this many link-preview reads at once, per client. */\nexport const LINK_PREVIEW_CONCURRENCY = 4;\nconst previewGates = new WeakMap<object, <T>(task: () => Promise<T>) => Promise<T>>();\n\n/** A gate that lets `max` tasks run at once and queues the rest. */\nfunction gate(max: number) {\n let active = 0;\n const waiting: (() => void)[] = [];\n return async <T,>(task: () => Promise<T>): Promise<T> => {\n if (active >= max) await new Promise<void>((r) => waiting.push(r));\n active += 1;\n try {\n return await task();\n } finally {\n active -= 1;\n waiting.shift()?.();\n }\n };\n}\n\n/**\n * Link previews for these messages, by message id, in link order (only those the server has\n * fetched). Pass the messages whose text has links (`extractLinks(body).length > 0`). One query\n * per message, so a new message asks only for its own, and at most LINK_PREVIEW_CONCURRENCY\n * run at once. One with none yet is asked again a few times, since the runner fills them\n * moments after it lands.\n */\nexport function useLinkPreviews(messageIds: (string | null | undefined)[]): Record<string, ChatLinkPreview[]> {\n const { client } = useChat();\n const list = useMemo(() => [...new Set(messageIds.filter((u): u is string => Boolean(u)))].sort(), [messageIds]);\n let run = previewGates.get(client);\n if (!run) {\n run = gate(LINK_PREVIEW_CONCURRENCY);\n previewGates.set(client, run);\n }\n const limited = run;\n const combine = useCallback(\n (results: { data?: ChatLinkPreview[] }[]) => {\n let out: Record<string, ChatLinkPreview[]> | null = null;\n results.forEach((r, i) => {\n if (r.data) (out ??= {})[list[i]!] = r.data;\n });\n return out ?? EMPTY_PREVIEWS;\n },\n [list],\n );\n return useQueries({\n queries: list.map((id) => ({\n queryKey: chatKeys.preview(id),\n queryFn: () => limited(async () => (await client.linkPreviewsFor([id]))[id] ?? []),\n staleTime: 60_000,\n refetchInterval: (q: { state: { data?: ChatLinkPreview[]; dataUpdateCount: number } }) =>\n !q.state.data?.length && q.state.dataUpdateCount < 4 ? 5_000 : false,\n })),\n combine,\n });\n}\nconst EMPTY_PREVIEWS: Record<string, ChatLinkPreview[]> = {};\n\nexport type { ThreadItem, LocalFile, QueuedMessage };\nexport { defaultInboxActionLabels, inboxRowActions, type ChatConfirm, type ChatInboxActionLabels, type ChatInboxActions, type InboxRowActionsOptions } from \"./inbox-actions\";\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { previewText } from './chunk-
|
|
1
|
+
import { previewText } from './chunk-3UNYTK62.js';
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
import { reportError } from '@marktiderman/genesis-core/errors';
|
|
4
4
|
|
|
@@ -49,5 +49,5 @@ var ChatErrorBoundary = class extends Component {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export { ChatErrorBoundary, attachmentPreview, callAttachmentKind, cardTitle, messagePreview };
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-SEMN3S6Q.js.map
|
|
53
|
+
//# sourceMappingURL=chunk-SEMN3S6Q.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/previews.ts","../src/react/error-boundary.tsx"],"names":[],"mappings":";;;;;AAWO,IAAM,kBAAA,GAAqB,CAA4C,IAAA,EAAsC,GAAA,EAAQ,CAAA,EAAmB,GAAA,KAC5I,IAAA,GAAO,GAAG,CAAA,EAAoG,IAAA,CAAK,IAAA,EAAO,CAAA,EAAG,GAAG;AAK5H,SAAS,UAAU,IAAA,EAAsC,CAAA,EAAmB,MAAuB,EAAE,IAAA,EAAM,OAAM,EAAW;AACjI,EAAA,IAAI;AACF,IAAA,OAAO,kBAAA,CAAmB,MAAM,OAAA,EAAS,CAAA,EAAG,GAAG,CAAA,IAAK,CAAA,CAAE,QAAQ,CAAA,CAAE,IAAA;AAAA,EAClE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,CAAA,CAAE,QAAQ,CAAA,CAAE,IAAA;AAAA,EACrB;AACF;AAGA,SAAS,eAAe,IAAA,EAA8B;AACpD,EAAA,OAAO,EAAE,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KAAM,CAAC,MAAA,CAAO,EAAA,CAAG,CAAA,EAAG,CAAA,CAAE,CAAC,CAAC,CAAC,CAAA;AAC7C;AAEO,IAAM,iBAAA,GAAN,cAAgC,SAAA,CAAuD;AAAA,EACnF,KAAA,GAAQ,EAAE,MAAA,EAAQ,KAAA,EAAM;AAAA,EAEjC,OAAO,wBAAA,GAAgD;AACrD,IAAA,OAAO,EAAE,QAAQ,IAAA,EAAK;AAAA,EACxB;AAAA,EAES,mBAAmB,IAAA,EAA8B;AACxD,IAAA,IAAI,IAAA,CAAK,KAAA,CAAM,MAAA,IAAU,OAAA,CAAQ,KAAK,SAAA,EAAW,IAAA,CAAK,KAAA,CAAM,SAAS,GAAG,IAAA,CAAK,QAAA,CAAS,EAAE,MAAA,EAAQ,OAAO,CAAA;AAAA,EACzG;AAAA,EAES,iBAAA,CAAkB,OAAgB,IAAA,EAAiB;AAC1D,IAAA,IAAI,KAAK,KAAA,CAAM,OAAA,OAAc,KAAA,CAAM,OAAA,CAAQ,OAAO,IAAI,CAAA;AAAA,SACjD,WAAA,CAAY,OAAO,aAAa,CAAA;AAAA,EACvC;AAAA,EAES,MAAA,GAAS;AAChB,IAAA,OAAO,KAAK,KAAA,CAAM,MAAA,GAAS,KAAK,KAAA,CAAM,QAAA,GAAW,KAAK,KAAA,CAAM,QAAA;AAAA,EAC9D;AACF","file":"chunk-SEMN3S6Q.js","sourcesContent":["/**\n * @feat:chat\n * One-line previews of a message (the inbox, the long-press sheet) where an app attachment kind\n * reads as its `label`, else its title (\"Check-in\"), not \"Attachment\". No React or DOM: web and\n * native both draw from it.\n */\nimport { previewText } from \"../core/thread\";\nimport type { ChatAttachment, ChatMessage } from \"../core/types\";\nimport type { ChatAttachmentKind, ChatCardContext } from \"./index\";\n\n/** Calls a kind's `title`, `subtitle` or `action` with the card context. */\nexport const callAttachmentKind = <K extends \"title\" | \"subtitle\" | \"action\">(kind: ChatAttachmentKind | undefined, key: K, a: ChatAttachment, ctx: ChatCardContext) =>\n (kind?.[key] as ((this: ChatAttachmentKind, a: ChatAttachment, ctx: ChatCardContext) => unknown) | undefined)?.call(kind!, a, ctx) as\n | ReturnType<NonNullable<ChatAttachmentKind[K]>>\n | undefined;\n\n/** A card's title (the kind's, else the file's name, else the kind); an app kind that throws reads as its name. */\nexport function cardTitle(kind: ChatAttachmentKind | undefined, a: ChatAttachment, ctx: ChatCardContext = { mine: false }): string {\n try {\n return callAttachmentKind(kind, \"title\", a, ctx) || a.name || a.kind;\n } catch {\n return a.name || a.kind;\n }\n}\n\n/** An attachment with only its kind, for a preview that knows no more (the inbox's last message). */\nfunction bareAttachment(kind: string): ChatAttachment {\n return { id: \"\", messageId: \"\", position: 0, kind, ref: {}, provider: \"none\", path: null, providerId: null, playbackId: null, url: null, status: \"ready\", name: null, mime: null, bytes: null, width: null, height: null, durationMs: null, waveform: null, posterPath: null, thumbhash: null, transcript: null, transcriptStatus: null };\n}\n\n/**\n * A message's one-line preview: its text, else what it carries, where an app kind reads as its\n * title (\"Check-in\") instead of \"Attachment\". `attachment` is the kind alone (the inbox) or the\n * attachment itself.\n */\nexport function attachmentPreview(body: string, attachment: string | ChatAttachment | null | undefined, kinds: Record<string, ChatAttachmentKind> | undefined, deleted = false): string {\n const kind = typeof attachment === \"string\" ? attachment : attachment?.kind;\n const text = previewText(body, kind, deleted);\n // Text that reads as something (not only markdown marks) is the preview, as previewText has it.\n if (deleted || !kind || !kinds || !Object.prototype.hasOwnProperty.call(kinds, kind) || previewText(body, null)) return text;\n const a = typeof attachment === \"string\" ? bareAttachment(attachment) : attachment!;\n const k = kinds[kind];\n const title = typeof k?.label === \"string\" && k.label.trim() ? k.label.trim() : cardTitle(k, a);\n return title && title !== kind ? title : text;\n}\n\n/** The long-press sheet's caption for a message. */\nexport function messagePreview(message: ChatMessage, kinds: Record<string, ChatAttachmentKind> | undefined): string {\n return attachmentPreview(message.body, message.attachments[0], kinds, Boolean(message.deletedAt));\n}\n\n","/**\n * @feat:chat\n * `ChatErrorBoundary`: what one message (or one app attachment card) draws can't take the whole\n * thread down. Messages carry what other people sent, and app renderers get sender-controlled\n * data, so a render that throws shows its fallback instead, and the error goes to `onError`\n * (by default `reportError` from genesis-core, source `chat:render`: the app's crash reporter\n * when it registered one, the console in development) so it is never silent. `resetKeys` lets it try again once what it\n * draws changes (the app's data arrived).\n */\nimport { Component, type ErrorInfo, type ReactNode } from \"react\";\nimport { reportError } from \"@marktiderman/genesis-core/errors\";\n\nexport interface ChatErrorBoundaryProps {\n /** Drawn instead of the children once they throw. */\n fallback: ReactNode;\n /** Told about the error. Default `reportError(error, \"chat:render\")` from genesis-core. */\n onError?: (error: unknown, info: ErrorInfo) => void;\n /** When any of these changes (by identity), a boundary showing its fallback tries the children again. */\n resetKeys?: readonly unknown[];\n children: ReactNode;\n}\n\nfunction changed(a: readonly unknown[] | undefined, b: readonly unknown[] | undefined): boolean {\n if (a === b) return false;\n if (!a || !b || a.length !== b.length) return true;\n return a.some((v, i) => !Object.is(v, b[i]));\n}\n\nexport class ChatErrorBoundary extends Component<ChatErrorBoundaryProps, { failed: boolean }> {\n override state = { failed: false };\n\n static getDerivedStateFromError(): { failed: boolean } {\n return { failed: true };\n }\n\n override componentDidUpdate(prev: ChatErrorBoundaryProps) {\n if (this.state.failed && changed(prev.resetKeys, this.props.resetKeys)) this.setState({ failed: false });\n }\n\n override componentDidCatch(error: unknown, info: ErrorInfo) {\n if (this.props.onError) this.props.onError(error, info);\n else reportError(error, \"chat:render\");\n }\n\n override render() {\n return this.state.failed ? this.props.fallback : this.props.children;\n }\n}\n"]}
|
|
@@ -466,12 +466,26 @@ declare function createChatClient(supabase: ChatSupabase, options?: ChatClientOp
|
|
|
466
466
|
remove(messageId: string): Promise<void>;
|
|
467
467
|
react(messageId: string, emoji: string, on?: boolean): Promise<void>;
|
|
468
468
|
markRead(conversationId: string, seq?: number): Promise<number>;
|
|
469
|
+
/**
|
|
470
|
+
* Your own settings for a conversation. `markedUnread` (migration 0007) marks it unread for you
|
|
471
|
+
* only, as Messages' Mark as Unread: it counts as one unread until you read it, and your read
|
|
472
|
+
* place (what senders see as "Read") never moves back. It's sent only when given, so an app
|
|
473
|
+
* whose database predates 0007 keeps working.
|
|
474
|
+
*/
|
|
469
475
|
setMySettings(conversationId: string, s: {
|
|
470
476
|
mutedUntil?: string | null;
|
|
471
477
|
notify?: "all" | "mentions" | "none";
|
|
472
478
|
archived?: boolean;
|
|
473
479
|
pinned?: boolean;
|
|
480
|
+
markedUnread?: boolean;
|
|
474
481
|
}): Promise<void>;
|
|
482
|
+
/**
|
|
483
|
+
* Delete for me (migration 0007): the conversation leaves your inbox, and its history your
|
|
484
|
+
* thread, until a new message you can read arrives. Nobody else's inbox, thread or read
|
|
485
|
+
* receipts change. `seq` is the latest message you saw (the inbox row's `lastSeq`): a message
|
|
486
|
+
* that came in after it isn't deleted unseen. Without it, everything up to the latest goes.
|
|
487
|
+
*/
|
|
488
|
+
deleteConversationForMe(conversationId: string, seq?: number): Promise<void>;
|
|
475
489
|
updateConversation(conversationId: string, s: {
|
|
476
490
|
title?: string;
|
|
477
491
|
settings?: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as Weekday, C as ChatAvailability, a as WorkingHours } from './client-
|
|
2
|
-
export { A as AttachmentInput, b as AttachmentKind, c as AttachmentProvider, d as AvailabilityInput, e as CHAT_BUCKET, f as CHAT_SCHEMA, g as ChatActivity, h as ChatAttachment, i as ChatClient, j as ChatClientOptions, k as ChatConversation, l as ChatError, m as ChatInboxItem, n as ChatKindRules, o as ChatLinkPreview, p as ChatMember, q as ChatMessage, r as ChatPreview, s as ChatReaction, t as ChatRole, u as ChatSearchHit, v as ChatSignal, w as ChatSupabase, x as ChatTopic, y as ConversationChannel, z as ConversationHandlers, H as HostedAttachment, M as MessagePage, P as PendingFile, B as PendingMessage, S as ScheduleInput, D as ScheduledMessage, E as SendBytesOptions, F as SendInput, G as StartConversationOptions, I as Subscription, T as TopicInput, U as UploadProgress, J as conversationTopic, K as createChatClient, L as sendBytes, N as toAttachment, O as toAvailability, Q as toLinkPreview, R as toMessage, V as toScheduled, X as toSearchHit, Y as toTopic, Z as userTopic } from './client-
|
|
3
|
-
export { A as ALLOWED_EXTENSIONS, C as CHAT_LIMITS, H as HostedUpload, a as HostedUploadOptions, b as HostedUploadRecord, c as HostedUploadStart, L as LocalFile, O as Outbox, d as OutboxOptions, e as OutboxStore, P as PLAYBACK_RATES, Q as QueuedMessage, S as StorageUpload, f as attachmentKindFor, g as createOutbox, h as fileExtension, i as formatDuration, j as isAllowedExtension, m as memoryOutboxStore, n as nextPlaybackRate, r as randomId, k as recordingLimitMs, l as releaseObjectUrl, w as waveformFromMetering, o as waveformPeaks } from './outbox-
|
|
4
|
-
export { R as ReactionSummary, T as ThreadItem, a as activityLine, c as currentActivity, d as dayLabel, f as firstUnreadId, i as itemSender, b as itemTime, m as mergeThread, p as parseMentions, e as previewText, s as sameDay, g as startsDay, h as startsGroup, j as summarizeReactions, t as throttle, u as upsertMessages } from './thread-
|
|
1
|
+
import { W as Weekday, C as ChatAvailability, a as WorkingHours } from './client-DXWyDJ2u.js';
|
|
2
|
+
export { A as AttachmentInput, b as AttachmentKind, c as AttachmentProvider, d as AvailabilityInput, e as CHAT_BUCKET, f as CHAT_SCHEMA, g as ChatActivity, h as ChatAttachment, i as ChatClient, j as ChatClientOptions, k as ChatConversation, l as ChatError, m as ChatInboxItem, n as ChatKindRules, o as ChatLinkPreview, p as ChatMember, q as ChatMessage, r as ChatPreview, s as ChatReaction, t as ChatRole, u as ChatSearchHit, v as ChatSignal, w as ChatSupabase, x as ChatTopic, y as ConversationChannel, z as ConversationHandlers, H as HostedAttachment, M as MessagePage, P as PendingFile, B as PendingMessage, S as ScheduleInput, D as ScheduledMessage, E as SendBytesOptions, F as SendInput, G as StartConversationOptions, I as Subscription, T as TopicInput, U as UploadProgress, J as conversationTopic, K as createChatClient, L as sendBytes, N as toAttachment, O as toAvailability, Q as toLinkPreview, R as toMessage, V as toScheduled, X as toSearchHit, Y as toTopic, Z as userTopic } from './client-DXWyDJ2u.js';
|
|
3
|
+
export { A as ALLOWED_EXTENSIONS, C as CHAT_LIMITS, H as HostedUpload, a as HostedUploadOptions, b as HostedUploadRecord, c as HostedUploadStart, L as LocalFile, O as Outbox, d as OutboxOptions, e as OutboxStore, P as PLAYBACK_RATES, Q as QueuedMessage, S as StorageUpload, f as attachmentKindFor, g as createOutbox, h as fileExtension, i as formatDuration, j as isAllowedExtension, m as memoryOutboxStore, n as nextPlaybackRate, r as randomId, k as recordingLimitMs, l as releaseObjectUrl, w as waveformFromMetering, o as waveformPeaks } from './outbox-Ctngv6Yz.js';
|
|
4
|
+
export { R as ReactionSummary, T as ThreadItem, a as activityLine, c as currentActivity, d as dayLabel, f as firstUnreadId, i as itemSender, b as itemTime, m as mergeThread, p as parseMentions, e as previewText, s as sameDay, g as startsDay, h as startsGroup, j as summarizeReactions, t as throttle, u as upsertMessages } from './thread-mZsRiIGz.js';
|
|
5
5
|
import '@supabase/supabase-js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { extractLinks, isHttpsUrl, isSchedulable, scheduleLabel, scheduleQuickPicks, snippetParts, topicKey } from './chunk-BJCE5O7V.js';
|
|
2
|
-
import { previewText } from './chunk-
|
|
3
|
-
export { activityLine, createOutbox, currentActivity, dayLabel, firstUnreadId, itemSender, itemTime, memoryOutboxStore, mergeThread, parseMentions, previewText, releaseObjectUrl, sameDay, startsDay, startsGroup, summarizeReactions, throttle, upsertMessages } from './chunk-
|
|
4
|
-
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-
|
|
2
|
+
import { previewText } from './chunk-3UNYTK62.js';
|
|
3
|
+
export { activityLine, createOutbox, currentActivity, dayLabel, firstUnreadId, itemSender, itemTime, memoryOutboxStore, mergeThread, parseMentions, previewText, releaseObjectUrl, sameDay, startsDay, startsGroup, summarizeReactions, throttle, upsertMessages } from './chunk-3UNYTK62.js';
|
|
4
|
+
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-GEEJMKQF.js';
|
|
5
5
|
|
|
6
6
|
// src/core/inbox.ts
|
|
7
7
|
function conversationInbox(options = {}) {
|
package/dist/native.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { RowSwipeAction } from '@marktiderman/genesis-core/row-actions';
|
|
3
4
|
import { InboxPageProps, InboxItem, ScreenHeaderProps } from '@marktiderman/genesis-ui-native/layouts';
|
|
4
|
-
import { m as ChatInboxItem, h as ChatAttachment, q as ChatMessage, p as ChatMember, 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, a as WorkingHours, u as ChatSearchHit } from './client-
|
|
5
|
-
import { ChatAttachmentKind, ChatCardContext, ChatVideoUpload } from './react.js';
|
|
6
|
-
import { T as ThreadItem } from './thread-
|
|
7
|
-
import { L as LocalFile } from './outbox-
|
|
5
|
+
import { m as ChatInboxItem, h as ChatAttachment, q as ChatMessage, p as ChatMember, 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, a as WorkingHours, u as ChatSearchHit } from './client-DXWyDJ2u.js';
|
|
6
|
+
import { ChatInboxActionLabels, ChatConfirm, ChatAttachmentKind, ChatCardContext, ChatVideoUpload } from './react.js';
|
|
7
|
+
import { T as ThreadItem } from './thread-mZsRiIGz.js';
|
|
8
|
+
import { L as LocalFile } from './outbox-Ctngv6Yz.js';
|
|
8
9
|
import { ColorValue } from 'react-native';
|
|
9
10
|
import { lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, NativeIconName } from '@marktiderman/genesis-ui-native/components';
|
|
10
11
|
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';
|
|
@@ -119,8 +120,11 @@ declare const chatOrganiseCopy: ChatOrganiseCopy;
|
|
|
119
120
|
* (translate, rename "Message" to "Note"). `{name}` and `{count}` are filled in.
|
|
120
121
|
*/
|
|
121
122
|
|
|
122
|
-
/**
|
|
123
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Topics, scheduled send, availability, broadcast, search and moderation are in `ChatOrganiseCopy`;
|
|
125
|
+
* the inbox row actions' words in `ChatInboxActionLabels`, shared with the web inbox.
|
|
126
|
+
*/
|
|
127
|
+
interface ChatNativeCopy extends ChatOrganiseCopy, ChatInboxActionLabels {
|
|
124
128
|
inboxTitle: string;
|
|
125
129
|
inboxEmptyTitle: string;
|
|
126
130
|
inboxEmptyBody: string;
|
|
@@ -132,10 +136,6 @@ interface ChatNativeCopy extends ChatOrganiseCopy {
|
|
|
132
136
|
someone: string;
|
|
133
137
|
youPrefix: string;
|
|
134
138
|
mentionedYou: string;
|
|
135
|
-
markRead: string;
|
|
136
|
-
pin: string;
|
|
137
|
-
unpin: string;
|
|
138
|
-
archive: string;
|
|
139
139
|
threadEmptyTitle: string;
|
|
140
140
|
threadEmptyBody: string;
|
|
141
141
|
/** The conversation or its first page couldn't be read, and there's nothing to show. */
|
|
@@ -624,6 +624,12 @@ interface ChatInboxScreenProps {
|
|
|
624
624
|
/** Every kind but these (`["support"]` keeps support tickets out of a messages inbox). */
|
|
625
625
|
excludeKinds?: string[];
|
|
626
626
|
archived?: boolean;
|
|
627
|
+
/**
|
|
628
|
+
* Each row's actions: receives the conversation and the default set (`inboxRowActions`:
|
|
629
|
+
* Messages' Unread, Pin, Hide Alerts, Delete for me and Archive) and returns the row's. Add,
|
|
630
|
+
* drop, reorder or relabel them; the default keeps them as they are.
|
|
631
|
+
*/
|
|
632
|
+
rowActions?: (item: ChatInboxItem, defaults: RowSwipeAction[]) => RowSwipeAction[];
|
|
627
633
|
/** Passed to InboxPage (a header, a section title, slots). */
|
|
628
634
|
pageProps?: Partial<Omit<InboxPageProps, "items">>;
|
|
629
635
|
testID?: string;
|
|
@@ -636,7 +642,9 @@ declare function inboxRow(item: ChatInboxItem, ctx: {
|
|
|
636
642
|
/** The app's attachment kinds: a last message that is a card reads as its title ("Check-in"). */
|
|
637
643
|
kinds?: Record<string, ChatAttachmentKind>;
|
|
638
644
|
}): Omit<InboxItem, "onPress" | "swipeActions">;
|
|
639
|
-
|
|
645
|
+
/** Asks with the system alert: Cancel, then the destructive action. */
|
|
646
|
+
declare function alertConfirm(cancelLabel: string): ChatConfirm;
|
|
647
|
+
declare function ChatInboxScreen({ onOpen, onStart, kind, kinds, excludeKinds, archived, rowActions, pageProps, testID }: ChatInboxScreenProps): react.JSX.Element;
|
|
640
648
|
|
|
641
649
|
/** A card's title (the kind's, else the file's name, else the kind); an app kind that throws reads as its name. */
|
|
642
650
|
declare function cardTitle(kind: ChatAttachmentKind | undefined, a: ChatAttachment, ctx?: ChatCardContext): string;
|
|
@@ -2351,4 +2359,4 @@ declare function ModerationMarker({ note, mine, testID }: {
|
|
|
2351
2359
|
testID?: string;
|
|
2352
2360
|
}): react.JSX.Element;
|
|
2353
2361
|
|
|
2354
|
-
export { AT_BOTTOM_POINTS, AppAttachment, type AppAttachmentProps, type AppStateLike, type AudioPlayerLike, type AudioRecorderLike, type AudioStatusLike, type AvailabilityForm, BUILT_IN_KINDS, type BubbleAttachment, type BubblePosition, type BuildRowsOptions, type ByteSource, CARD_ACTION_TIMEOUT_MS, type CameraViewHandleLike, CardError, type CardRunOptions, type CardRunState, ChatAccessError, type ChatAccessErrorProps, ChatAttachmentCard, type ChatAttachmentCardProps, type ChatAttachmentSlot, type ChatAttachmentSlotProps, ChatAutoRetry, type ChatAutoRetryOptions, ChatAvailabilityScreen, type ChatAvailabilityScreenProps, ChatAwayLine, type ChatAwayLineProps, ChatBroadcastSheet, type ChatBroadcastSheetProps, ChatCardContext, ChatComposer, type ChatComposerHandle, type ChatComposerProps, type ChatConnectionState, ChatEmojiPicker, type ChatEmojiPickerProps, ChatEmojiPickerSheet, type ChatEmojiPickerSheetProps, ChatIconButton, type ChatIconButtonProps, ChatInboxScreen, type ChatInboxScreenProps, ChatLinkPreviewCard, type ChatLinkPreviewCardProps, ChatMediaViewer, type ChatMediaViewerProps, type ChatNativeContextValue, type ChatNativeCopy, type ChatNativeCopyOverrides, type ChatNativeModules, ChatNativeProvider, type ChatNativeProviderProps, type ChatOrganiseCopy, type ChatPerson, type ChatPhoto, ChatPhotoViewer, type ChatPhotoViewerProps, type ChatReceiptsMode, ChatScheduleSheet, type ChatScheduleSheetProps, ChatScheduledBar, type ChatScheduledBarProps, ChatScheduledList, type ChatScheduledListProps, ChatSearchScreen, type ChatSearchScreenProps, ChatStartButton, type ChatStartPerson, ChatStartSheet, type ChatStartSheetProps, type ChatThreadAccessoryContext, ChatThreadScreen, type ChatThreadScreenProps, type ChatThreadScreenSlots, type ChatThreadStackOptionsProps, ChatThreadTitle, type ChatThreadTitleAvatar, type ChatThreadTitleProps, ChatTopicBar, type ChatTopicBarProps, ChatTypingBubble, type ChatTypingBubbleProps, ChatVideoPlayer, type ChatVideoPlayerProps, ChatVideoRecorder, type ChatVideoRecorderProps, type ChatVideoState, type ChunkFileLike, type ChunkedPutOptions, type ClipboardLike, type ComposerAction, type ComposerAttachment, type ComposerDraft, type ComposerState, DISMISS_DISTANCE, DISMISS_VELOCITY, type DayHours, type DraftStorageLike, EMOJI_CATEGORIES, type EmojiCategoryId, type EmojiEntry, type ExpoAudioLike, type ExpoCameraLike, type ExpoVideoLike, type HapticEvent, type HapticsLike, type ImagePickerLike, type JumpTarget, type KeyboardAvoidingLike, MAX_ZOOM, type MediaLibraryLike, type MessageActionContext, type MessageActionId, MessageActionsSheet, type MessageActionsSheetProps, MessageAttachments, MessageBubble, type MessageBubbleProps, type MessageReceipt, type MessageReceiptFor, type MintedUpload, ModerationMarker, type ModerationNote, type NetInfoLike, type OpenAttachment, type OutboxSend, type PermissionLike, type PickedAssetLike, type PickerResultLike, QUICK_REACTIONS, RECENT_EMOJI_MAX, type ReceiptCopy, type ReceiptOptions, type RecordedVideo, type RecorderConfig, type RecorderEffect, type RecorderEvent, type RecorderNotice, type RecorderPhase, type RecorderState, type RecorderStateLike, type ReplyTarget, SearchSnippet, type SharingLike, type StartVideoInput, TIME_REVEAL_WIDTH, TRANSCRIPT_LINES, TUS_CHUNK_BYTES, type ThreadRow, type TopicMenuAction, type TusSendInfo, type TusTransport, type TusUploadOptions, type TusUploadRecord, type TusUploadSource, type UseJumpOptions, type UseVoiceRecorderOptions, VIDEO_CHUNK_BYTES, VIDEO_HOLD_MS, VIDEO_MIN_MS, type VideoPlayerLike, type VideoRecorderEffect, type VideoRecorderEvent, type VideoRecorderPhase, type VideoRecorderState, type VideoUploadError, type VideoUploadTask, VideoUploadTray, type VideoUploadTrayProps, type VideoUploads, type VideoViewHandleLike, VoiceNotePlayer, type VoiceNotePlayerProps, VoiceTranscript, type VoiceTranscriptProps, type WebBrowserLike, type WeekHours, activePlaybackId, attachmentKindOf, attachmentPaths, attachmentPreview, availabilityInput, awayLineFor, barsThatFit, base64ToBytes, base64Utf8, broadcastOutcome, broadcastRows, bubbleCorners, bubblePosition, buildThreadRows, canManageTopics, canReactTo, canSend, cardAction, cardTitle, chatNativeCopy, chatOrganiseCopy, chatThreadStackOptions, checkTopicName, chunkedPut, claimPlayback, clearDrafts, clockToDate, composerDisabledReason, composerReducer, connectionState, countUnseenBelow, createDraftSaver, createTusUpload, createVideoUploads, cycleVideoRate, cycleVoiceNoteRate, dateToClock, defaultScheduleAt, defaultWeek, deviceTimeZone, displayBody, draftKey, emojiEntry, emojiInCategory, emptyComposer, fileFromDataUri, fileSource, filesFromAssets, fill, forgetRecentEmoji, formFrom, formatClock, fullScreenVideo, galleryFor, haptic, hoursFromWeek, idleRecorder, inboxRow, initialVideoRecorder, initials, insertAtSelection, invertedRows, isLocalUri, isOnline, isOpenableHref, isVideoPlaying, lastSentReceipt, linkHost, linkPreviewIds, liveBars, loadDraft, loadRecentEmoji, memoryDraftStorage, messageActionsFor, messagePreview, moderationNote, moderationText, muxPosterUrl, muxStreamUrl, nearBottom, nextOffset, openChatLink, panLimit, pauseChatPlayback, pinchScale, previewToShow, pushRecentEmoji, readWhen, receiptText, recentEmojiKey, recordedVideoFile, recorderStep, recordingType, releasePlayback, replyTargetFor, resolveChatCopy, rowIndexOf, rowKey, sameTimeDays, saveRecentEmoji, scheduleInputFrom, scrubSeconds, searchEmoji, shouldDismiss, slotUrl, snippetText, splitCardAttachments, startsTimeReveal, threadListMode, timeRevealFor, timeZones, toSend, toggleVideo, toggleVideoMute, toggleVoiceNote, topicClosedFor, topicMenuFor, transcriptIsLong, useAwayLine, useCardRuns, useChatAutoRetry, useChatComposer, useChatNative, useChatThreadStackOptions, useJumpToMessage, useOnline, usePlayingVideo, usePlayingVoiceNote, useScheduleSend, useVideoUploads, useVoiceRecorder, videoRecorderStep, videoSource, videoState, videoUploads, voiceNoteFile, waveformBars, weekFromHours, withDay, withTime };
|
|
2362
|
+
export { AT_BOTTOM_POINTS, AppAttachment, type AppAttachmentProps, type AppStateLike, type AudioPlayerLike, type AudioRecorderLike, type AudioStatusLike, type AvailabilityForm, BUILT_IN_KINDS, type BubbleAttachment, type BubblePosition, type BuildRowsOptions, type ByteSource, CARD_ACTION_TIMEOUT_MS, type CameraViewHandleLike, CardError, type CardRunOptions, type CardRunState, ChatAccessError, type ChatAccessErrorProps, ChatAttachmentCard, type ChatAttachmentCardProps, type ChatAttachmentSlot, type ChatAttachmentSlotProps, ChatAutoRetry, type ChatAutoRetryOptions, ChatAvailabilityScreen, type ChatAvailabilityScreenProps, ChatAwayLine, type ChatAwayLineProps, ChatBroadcastSheet, type ChatBroadcastSheetProps, ChatCardContext, ChatComposer, type ChatComposerHandle, type ChatComposerProps, type ChatConnectionState, ChatEmojiPicker, type ChatEmojiPickerProps, ChatEmojiPickerSheet, type ChatEmojiPickerSheetProps, ChatIconButton, type ChatIconButtonProps, ChatInboxScreen, type ChatInboxScreenProps, ChatLinkPreviewCard, type ChatLinkPreviewCardProps, ChatMediaViewer, type ChatMediaViewerProps, type ChatNativeContextValue, type ChatNativeCopy, type ChatNativeCopyOverrides, type ChatNativeModules, ChatNativeProvider, type ChatNativeProviderProps, type ChatOrganiseCopy, type ChatPerson, type ChatPhoto, ChatPhotoViewer, type ChatPhotoViewerProps, type ChatReceiptsMode, ChatScheduleSheet, type ChatScheduleSheetProps, ChatScheduledBar, type ChatScheduledBarProps, ChatScheduledList, type ChatScheduledListProps, ChatSearchScreen, type ChatSearchScreenProps, ChatStartButton, type ChatStartPerson, ChatStartSheet, type ChatStartSheetProps, type ChatThreadAccessoryContext, ChatThreadScreen, type ChatThreadScreenProps, type ChatThreadScreenSlots, type ChatThreadStackOptionsProps, ChatThreadTitle, type ChatThreadTitleAvatar, type ChatThreadTitleProps, ChatTopicBar, type ChatTopicBarProps, ChatTypingBubble, type ChatTypingBubbleProps, ChatVideoPlayer, type ChatVideoPlayerProps, ChatVideoRecorder, type ChatVideoRecorderProps, type ChatVideoState, type ChunkFileLike, type ChunkedPutOptions, type ClipboardLike, type ComposerAction, type ComposerAttachment, type ComposerDraft, type ComposerState, DISMISS_DISTANCE, DISMISS_VELOCITY, type DayHours, type DraftStorageLike, EMOJI_CATEGORIES, type EmojiCategoryId, type EmojiEntry, type ExpoAudioLike, type ExpoCameraLike, type ExpoVideoLike, type HapticEvent, type HapticsLike, type ImagePickerLike, type JumpTarget, type KeyboardAvoidingLike, MAX_ZOOM, type MediaLibraryLike, type MessageActionContext, type MessageActionId, MessageActionsSheet, type MessageActionsSheetProps, MessageAttachments, MessageBubble, type MessageBubbleProps, type MessageReceipt, type MessageReceiptFor, type MintedUpload, ModerationMarker, type ModerationNote, type NetInfoLike, type OpenAttachment, type OutboxSend, type PermissionLike, type PickedAssetLike, type PickerResultLike, QUICK_REACTIONS, RECENT_EMOJI_MAX, type ReceiptCopy, type ReceiptOptions, type RecordedVideo, type RecorderConfig, type RecorderEffect, type RecorderEvent, type RecorderNotice, type RecorderPhase, type RecorderState, type RecorderStateLike, type ReplyTarget, SearchSnippet, type SharingLike, type StartVideoInput, TIME_REVEAL_WIDTH, TRANSCRIPT_LINES, TUS_CHUNK_BYTES, type ThreadRow, type TopicMenuAction, type TusSendInfo, type TusTransport, type TusUploadOptions, type TusUploadRecord, type TusUploadSource, type UseJumpOptions, type UseVoiceRecorderOptions, VIDEO_CHUNK_BYTES, VIDEO_HOLD_MS, VIDEO_MIN_MS, type VideoPlayerLike, type VideoRecorderEffect, type VideoRecorderEvent, type VideoRecorderPhase, type VideoRecorderState, type VideoUploadError, type VideoUploadTask, VideoUploadTray, type VideoUploadTrayProps, type VideoUploads, type VideoViewHandleLike, VoiceNotePlayer, type VoiceNotePlayerProps, VoiceTranscript, type VoiceTranscriptProps, type WebBrowserLike, type WeekHours, activePlaybackId, alertConfirm, attachmentKindOf, attachmentPaths, attachmentPreview, availabilityInput, awayLineFor, barsThatFit, base64ToBytes, base64Utf8, broadcastOutcome, broadcastRows, bubbleCorners, bubblePosition, buildThreadRows, canManageTopics, canReactTo, canSend, cardAction, cardTitle, chatNativeCopy, chatOrganiseCopy, chatThreadStackOptions, checkTopicName, chunkedPut, claimPlayback, clearDrafts, clockToDate, composerDisabledReason, composerReducer, connectionState, countUnseenBelow, createDraftSaver, createTusUpload, createVideoUploads, cycleVideoRate, cycleVoiceNoteRate, dateToClock, defaultScheduleAt, defaultWeek, deviceTimeZone, displayBody, draftKey, emojiEntry, emojiInCategory, emptyComposer, fileFromDataUri, fileSource, filesFromAssets, fill, forgetRecentEmoji, formFrom, formatClock, fullScreenVideo, galleryFor, haptic, hoursFromWeek, idleRecorder, inboxRow, initialVideoRecorder, initials, insertAtSelection, invertedRows, isLocalUri, isOnline, isOpenableHref, isVideoPlaying, lastSentReceipt, linkHost, linkPreviewIds, liveBars, loadDraft, loadRecentEmoji, memoryDraftStorage, messageActionsFor, messagePreview, moderationNote, moderationText, muxPosterUrl, muxStreamUrl, nearBottom, nextOffset, openChatLink, panLimit, pauseChatPlayback, pinchScale, previewToShow, pushRecentEmoji, readWhen, receiptText, recentEmojiKey, recordedVideoFile, recorderStep, recordingType, releasePlayback, replyTargetFor, resolveChatCopy, rowIndexOf, rowKey, sameTimeDays, saveRecentEmoji, scheduleInputFrom, scrubSeconds, searchEmoji, shouldDismiss, slotUrl, snippetText, splitCardAttachments, startsTimeReveal, threadListMode, timeRevealFor, timeZones, toSend, toggleVideo, toggleVideoMute, toggleVoiceNote, topicClosedFor, topicMenuFor, transcriptIsLong, useAwayLine, useCardRuns, useChatAutoRetry, useChatComposer, useChatNative, useChatThreadStackOptions, useJumpToMessage, useOnline, usePlayingVideo, usePlayingVoiceNote, useScheduleSend, useVideoUploads, useVoiceRecorder, videoRecorderStep, videoSource, videoState, videoUploads, voiceNoteFile, waveformBars, weekFromHours, withDay, withTime };
|
package/dist/native.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { cardTitle, attachmentPreview, callAttachmentKind, ChatErrorBoundary, messagePreview } from './chunk-
|
|
2
|
-
export { attachmentPreview, cardTitle, messagePreview } from './chunk-
|
|
1
|
+
import { cardTitle, attachmentPreview, callAttachmentKind, ChatErrorBoundary, messagePreview } from './chunk-SEMN3S6Q.js';
|
|
2
|
+
export { attachmentPreview, cardTitle, messagePreview } from './chunk-SEMN3S6Q.js';
|
|
3
3
|
import { isHttpsUrl, extractLinks, scheduleLabel, scheduleQuickPicks, isSchedulable, topicKey, snippetParts } from './chunk-BJCE5O7V.js';
|
|
4
|
-
import { useChat, useInbox, usePeople,
|
|
5
|
-
import { summarizeReactions, parseMentions, startsDay, dayLabel, itemTime, itemSender, startsGroup, sameDay, activityLine } from './chunk-
|
|
6
|
-
import { formatDuration, nextPlaybackRate, ChatError, CHAT_LIMITS, fileExtension, isAllowedExtension, attachmentKindFor, awaySummary, WEEKDAYS, minutesOf, waveformFromMetering, recordingLimitMs, CHAT_BUCKET, randomId } from './chunk-
|
|
4
|
+
import { defaultInboxActionLabels, useChat, useInboxActions, useInbox, usePeople, inboxRowActions, useScheduled, useAvailability, useTopics, useConversation, usePins, useMessageActions, useFileUrls, useLinkPreviews, chatKeys, useStartConversation, useBroadcast, useSearch } from './chunk-H4BRVJJ7.js';
|
|
5
|
+
import { summarizeReactions, parseMentions, startsDay, dayLabel, itemTime, itemSender, startsGroup, sameDay, activityLine } from './chunk-3UNYTK62.js';
|
|
6
|
+
import { formatDuration, nextPlaybackRate, ChatError, CHAT_LIMITS, fileExtension, isAllowedExtension, attachmentKindFor, awaySummary, WEEKDAYS, minutesOf, waveformFromMetering, recordingLimitMs, CHAT_BUCKET, randomId } from './chunk-GEEJMKQF.js';
|
|
7
7
|
export { CHAT_MARK_READ_ACTION, CHAT_PUSH_CATEGORY, CHAT_REPLY_ACTION, PUSH_REPLY_WAIT_MS, chatNotificationActions, chatPath, chatPushCategory, chatPushCopy, chatPushPayload, chatThreadMatch, conversationIdFromData, failedReply, handleChatPushResponse, registerChatNotificationActions, replyClientId, replyClientIdFor } from './chunk-BTG4JWLF.js';
|
|
8
8
|
import { createContext, memo, useMemo, useState, useCallback, useRef, useContext, useSyncExternalStore, useLayoutEffect, useEffect, useReducer, createElement, isValidElement } from 'react';
|
|
9
|
+
import { Pressable, Animated, PanResponder, View, Linking, useWindowDimensions, ActivityIndicator, AppState, Alert, Modal, AccessibilityInfo, ScrollView, FlatList, Platform, KeyboardAvoidingView } from 'react-native';
|
|
9
10
|
import { NativeText, useGenesisModules, NativeAvatar, NativeImage, NativeIcon, NativeButton, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_MAX_ZOOM, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, NativeProgress, useToast, NativeSheet, NativeDatePicker, NativeTimePicker, NativeListItem, NativeSkeleton, NativeEmptyState, NativeSheetScrollView, NativeTextarea, NativeSwitch, NativeCombobox, NativeChipGroup, NativeChip, NativeInput, NativeSearchBar, NativeComposerBar, NativeContextMenu, NativeInlineAlert, NativeLightbox, NativeThreadList, NativeCheckbox, NativeBadge } from '@marktiderman/genesis-ui-native/components';
|
|
10
11
|
import { InboxPage, SettingsSubPage, getThreadPageStackOptions, formatInboxTime } from '@marktiderman/genesis-ui-native/layouts';
|
|
11
|
-
import { Pressable, Animated, PanResponder, View, Linking, useWindowDimensions, ActivityIndicator, AppState, Modal, AccessibilityInfo, ScrollView, FlatList, Platform, KeyboardAvoidingView, Alert } from 'react-native';
|
|
12
12
|
import { useThemeRoles, sentBubbleColor, playHaptic, useReducedMotion } from '@marktiderman/genesis-ui-native/hooks';
|
|
13
13
|
import { reportError } from '@marktiderman/genesis-core/errors';
|
|
14
14
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
|
-
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
16
15
|
import { useSafeAreaInsets, SafeAreaView } from 'react-native-safe-area-context';
|
|
16
|
+
import { useQuery } from '@tanstack/react-query';
|
|
17
17
|
|
|
18
18
|
// src/native/organise-copy.ts
|
|
19
19
|
var chatOrganiseCopy = {
|
|
@@ -122,10 +122,7 @@ var chatNativeCopy = {
|
|
|
122
122
|
someone: "Someone",
|
|
123
123
|
youPrefix: "You: ",
|
|
124
124
|
mentionedYou: "Mentioned you",
|
|
125
|
-
|
|
126
|
-
pin: "Pin",
|
|
127
|
-
unpin: "Unpin",
|
|
128
|
-
archive: "Archive",
|
|
125
|
+
...defaultInboxActionLabels,
|
|
129
126
|
threadEmptyTitle: "No messages yet",
|
|
130
127
|
threadEmptyBody: "Say hello below.",
|
|
131
128
|
threadErrorTitle: "Couldn't load messages",
|
|
@@ -1693,12 +1690,22 @@ function inboxRow(item, ctx) {
|
|
|
1693
1690
|
unread: item.unread > 0,
|
|
1694
1691
|
unreadCount: item.unread,
|
|
1695
1692
|
meta: item.mentioned ? ctx.copy.mentionedYou : void 0,
|
|
1693
|
+
muted: item.muted,
|
|
1694
|
+
pinned: item.pinned,
|
|
1696
1695
|
avatar: /* @__PURE__ */ jsx(NativeAvatar, { size: 40, src: other?.avatarUrl ?? null, fallback: initials(title), alt: title, recyclingKey: item.conversationId })
|
|
1697
1696
|
};
|
|
1698
1697
|
}
|
|
1699
|
-
function
|
|
1700
|
-
|
|
1701
|
-
|
|
1698
|
+
function alertConfirm(cancelLabel) {
|
|
1699
|
+
return (title, body, confirmLabel) => new Promise(
|
|
1700
|
+
(resolve) => Alert.alert(title, body, [
|
|
1701
|
+
{ text: cancelLabel, style: "cancel", onPress: () => resolve(false) },
|
|
1702
|
+
{ text: confirmLabel, style: "destructive", onPress: () => resolve(true) }
|
|
1703
|
+
], { cancelable: true, onDismiss: () => resolve(false) })
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
function ChatInboxScreen({ onOpen, onStart, kind, kinds, excludeKinds, archived, rowActions, pageProps, testID = "chat-inbox" }) {
|
|
1707
|
+
const { userId, attachmentKinds } = useChat();
|
|
1708
|
+
const act = useInboxActions();
|
|
1702
1709
|
const { copy, person: known } = useChatNative();
|
|
1703
1710
|
const inbox = useInbox({ kind, kinds, excludeKinds, archived });
|
|
1704
1711
|
const others = useMemo(() => inbox.items.map((i) => i.otherUserId), [inbox.items]);
|
|
@@ -1713,23 +1720,21 @@ function ChatInboxScreen({ onOpen, onStart, kind, kinds, excludeKinds, archived,
|
|
|
1713
1720
|
setRefreshing(false);
|
|
1714
1721
|
}
|
|
1715
1722
|
}, [inbox]);
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
]
|
|
1732
|
-
}));
|
|
1723
|
+
const options = useMemo(
|
|
1724
|
+
() => ({
|
|
1725
|
+
confirm: alertConfirm(copy.cancel),
|
|
1726
|
+
onError: (e) => Alert.alert(copy.actionFailed, e instanceof Error ? e.message : void 0)
|
|
1727
|
+
}),
|
|
1728
|
+
[copy]
|
|
1729
|
+
);
|
|
1730
|
+
const items = inbox.items.map((item) => {
|
|
1731
|
+
const defaults = inboxRowActions(item, act, copy, options);
|
|
1732
|
+
return {
|
|
1733
|
+
...inboxRow(item, { me: userId, copy, person, kinds: attachmentKinds }),
|
|
1734
|
+
onPress: () => onOpen(item.conversationId),
|
|
1735
|
+
swipeActions: rowActions ? rowActions(item, defaults) : defaults
|
|
1736
|
+
};
|
|
1737
|
+
});
|
|
1733
1738
|
return /* @__PURE__ */ jsx(
|
|
1734
1739
|
InboxPage,
|
|
1735
1740
|
{
|
|
@@ -1742,6 +1747,9 @@ function ChatInboxScreen({ onOpen, onStart, kind, kinds, excludeKinds, archived,
|
|
|
1742
1747
|
onRefresh: refresh,
|
|
1743
1748
|
emptyTitle: copy.inboxEmptyTitle,
|
|
1744
1749
|
emptyBody: copy.inboxEmptyBody,
|
|
1750
|
+
swipeAppearance: "round",
|
|
1751
|
+
mutedLabel: copy.alertsOff,
|
|
1752
|
+
pinnedLabel: copy.pinnedMark,
|
|
1745
1753
|
emptyActionLabel: onStart ? copy.startConversation : void 0,
|
|
1746
1754
|
onEmptyAction: onStart,
|
|
1747
1755
|
...pageProps
|
|
@@ -5416,6 +5424,6 @@ function useJumpToMessage({ target, rows, loading, has, loadUntil, scrollTo, onS
|
|
|
5416
5424
|
return { highlightedId, jumping: pending !== null };
|
|
5417
5425
|
}
|
|
5418
5426
|
|
|
5419
|
-
export { AT_BOTTOM_POINTS, AppAttachment, BUILT_IN_KINDS, CARD_ACTION_TIMEOUT_MS, CardError, ChatAccessError, ChatAttachmentCard, ChatAutoRetry, ChatAvailabilityScreen, ChatAwayLine, ChatBroadcastSheet, ChatComposer, ChatEmojiPicker, ChatEmojiPickerSheet, ChatIconButton, ChatInboxScreen, ChatLinkPreviewCard, ChatMediaViewer, ChatNativeProvider, ChatPhotoViewer, ChatScheduleSheet, ChatScheduledBar, ChatScheduledList, ChatSearchScreen, ChatStartButton, ChatStartSheet, ChatThreadScreen, ChatThreadTitle, ChatTopicBar, ChatTypingBubble, ChatVideoPlayer, ChatVideoRecorder, DISMISS_DISTANCE, DISMISS_VELOCITY, EMOJI_CATEGORIES, MAX_ZOOM, MessageActionsSheet, MessageAttachments, MessageBubble, ModerationMarker, QUICK_REACTIONS, RECENT_EMOJI_MAX, SearchSnippet, TIME_REVEAL_WIDTH, TRANSCRIPT_LINES, TUS_CHUNK_BYTES, VIDEO_CHUNK_BYTES, VIDEO_HOLD_MS, VIDEO_MIN_MS, VideoUploadTray, VoiceNotePlayer, VoiceTranscript, activePlaybackId, attachmentKindOf, attachmentPaths, availabilityInput, awayLineFor, barsThatFit, base64ToBytes, base64Utf8, broadcastOutcome, broadcastRows, bubbleCorners, bubblePosition, buildThreadRows, canManageTopics, canReactTo, canSend, cardAction, chatNativeCopy, chatOrganiseCopy, chatThreadStackOptions, checkTopicName, chunkedPut, claimPlayback, clearDrafts, clockToDate, composerDisabledReason, composerReducer, connectionState, countUnseenBelow, createDraftSaver, createTusUpload, createVideoUploads, cycleVideoRate, cycleVoiceNoteRate, dateToClock, defaultScheduleAt, defaultWeek, deviceTimeZone, displayBody, draftKey, emojiEntry, emojiInCategory, emptyComposer, fileFromDataUri, fileSource, filesFromAssets, fill, forgetRecentEmoji, formFrom, formatClock, fullScreenVideo, galleryFor, haptic, hoursFromWeek, idleRecorder, inboxRow, initialVideoRecorder, initials, insertAtSelection, invertedRows, isLocalUri, isOnline, isOpenableHref, isVideoPlaying, lastSentReceipt, linkHost, linkPreviewIds, liveBars, loadDraft, loadRecentEmoji, memoryDraftStorage, messageActionsFor, moderationNote, moderationText, muxPosterUrl, muxStreamUrl, nearBottom, nextOffset, openChatLink, panLimit, pauseChatPlayback, pinchScale, previewToShow, pushRecentEmoji, readWhen, receiptText, recentEmojiKey, recordedVideoFile, recorderStep, recordingType, releasePlayback, replyTargetFor, resolveChatCopy, rowIndexOf, rowKey, sameTimeDays, saveRecentEmoji, scheduleInputFrom, scrubSeconds, searchEmoji, shouldDismiss, slotUrl, snippetText, splitCardAttachments, startsTimeReveal, threadListMode, timeRevealFor, timeZones, toSend, toggleVideo, toggleVideoMute, toggleVoiceNote, topicClosedFor, topicMenuFor, transcriptIsLong, useAwayLine, useCardRuns, useChatAutoRetry, useChatComposer, useChatNative, useChatThreadStackOptions, useJumpToMessage, useOnline, usePlayingVideo, usePlayingVoiceNote, useScheduleSend, useVideoUploads, useVoiceRecorder, videoRecorderStep, videoSource, videoState, videoUploads, voiceNoteFile, waveformBars, weekFromHours, withDay, withTime };
|
|
5427
|
+
export { AT_BOTTOM_POINTS, AppAttachment, BUILT_IN_KINDS, CARD_ACTION_TIMEOUT_MS, CardError, ChatAccessError, ChatAttachmentCard, ChatAutoRetry, ChatAvailabilityScreen, ChatAwayLine, ChatBroadcastSheet, ChatComposer, ChatEmojiPicker, ChatEmojiPickerSheet, ChatIconButton, ChatInboxScreen, ChatLinkPreviewCard, ChatMediaViewer, ChatNativeProvider, ChatPhotoViewer, ChatScheduleSheet, ChatScheduledBar, ChatScheduledList, ChatSearchScreen, ChatStartButton, ChatStartSheet, ChatThreadScreen, ChatThreadTitle, ChatTopicBar, ChatTypingBubble, ChatVideoPlayer, ChatVideoRecorder, DISMISS_DISTANCE, DISMISS_VELOCITY, EMOJI_CATEGORIES, MAX_ZOOM, MessageActionsSheet, MessageAttachments, MessageBubble, ModerationMarker, QUICK_REACTIONS, RECENT_EMOJI_MAX, SearchSnippet, TIME_REVEAL_WIDTH, TRANSCRIPT_LINES, TUS_CHUNK_BYTES, VIDEO_CHUNK_BYTES, VIDEO_HOLD_MS, VIDEO_MIN_MS, VideoUploadTray, VoiceNotePlayer, VoiceTranscript, activePlaybackId, alertConfirm, attachmentKindOf, attachmentPaths, availabilityInput, awayLineFor, barsThatFit, base64ToBytes, base64Utf8, broadcastOutcome, broadcastRows, bubbleCorners, bubblePosition, buildThreadRows, canManageTopics, canReactTo, canSend, cardAction, chatNativeCopy, chatOrganiseCopy, chatThreadStackOptions, checkTopicName, chunkedPut, claimPlayback, clearDrafts, clockToDate, composerDisabledReason, composerReducer, connectionState, countUnseenBelow, createDraftSaver, createTusUpload, createVideoUploads, cycleVideoRate, cycleVoiceNoteRate, dateToClock, defaultScheduleAt, defaultWeek, deviceTimeZone, displayBody, draftKey, emojiEntry, emojiInCategory, emptyComposer, fileFromDataUri, fileSource, filesFromAssets, fill, forgetRecentEmoji, formFrom, formatClock, fullScreenVideo, galleryFor, haptic, hoursFromWeek, idleRecorder, inboxRow, initialVideoRecorder, initials, insertAtSelection, invertedRows, isLocalUri, isOnline, isOpenableHref, isVideoPlaying, lastSentReceipt, linkHost, linkPreviewIds, liveBars, loadDraft, loadRecentEmoji, memoryDraftStorage, messageActionsFor, moderationNote, moderationText, muxPosterUrl, muxStreamUrl, nearBottom, nextOffset, openChatLink, panLimit, pauseChatPlayback, pinchScale, previewToShow, pushRecentEmoji, readWhen, receiptText, recentEmojiKey, recordedVideoFile, recorderStep, recordingType, releasePlayback, replyTargetFor, resolveChatCopy, rowIndexOf, rowKey, sameTimeDays, saveRecentEmoji, scheduleInputFrom, scrubSeconds, searchEmoji, shouldDismiss, slotUrl, snippetText, splitCardAttachments, startsTimeReveal, threadListMode, timeRevealFor, timeZones, toSend, toggleVideo, toggleVideoMute, toggleVoiceNote, topicClosedFor, topicMenuFor, transcriptIsLong, useAwayLine, useCardRuns, useChatAutoRetry, useChatComposer, useChatNative, useChatThreadStackOptions, useJumpToMessage, useOnline, usePlayingVideo, usePlayingVoiceNote, useScheduleSend, useVideoUploads, useVoiceRecorder, videoRecorderStep, videoSource, videoState, videoUploads, voiceNoteFile, waveformBars, weekFromHours, withDay, withTime };
|
|
5420
5428
|
//# sourceMappingURL=native.js.map
|
|
5421
5429
|
//# sourceMappingURL=native.js.map
|