@hipnation-truth/sdk 0.16.3 → 0.17.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/dist/react.d.ts CHANGED
@@ -156,6 +156,12 @@ interface ConversationTaskRow {
156
156
  interface ConversationTaskForUserRow extends ConversationTaskRow {
157
157
  /** Normalized `(patient_phone | provider_phone)` for the task's conversation. */
158
158
  phonePair: string | null;
159
+ /**
160
+ * Set of user ids who have seen this task (opened the detail panel).
161
+ * Replaces the Hasura `event_activities.seen` boolean — use
162
+ * `seenBy.includes(userId)` to derive the per-user boolean.
163
+ */
164
+ seenBy: string[];
159
165
  }
160
166
  interface ConversationMessageRow {
161
167
  kind: "call" | "sms";
@@ -394,6 +400,45 @@ declare function useDialpadCallLog(callId: string | null | undefined, options?:
394
400
  limit?: number;
395
401
  }): UseQueryResult<DialpadCallLogRow[]>;
396
402
 
403
+ /**
404
+ * React hook for a single conversation lookup by Convex id — Truth SDK.
405
+ *
406
+ * Replaces CommHub's `useGet_Conversation_EventQuery` (backed by the
407
+ * Hasura `Get_Conversation_Event` GraphQL query). Queries the Convex
408
+ * `conversations:getById` function which returns the raw conversation
409
+ * row, or `null` when the id doesn't exist.
410
+ *
411
+ * The returned `ConversationRow` carries the same phone-pair fields as
412
+ * `useConversationByPhonePair` — `patientPhone`, `providerPhone`,
413
+ * `phonePair`, `patientId` — but is keyed on the Convex document `_id`
414
+ * rather than the pair. Use this when you have a Convex id from a push
415
+ * notification or a deep-link route param.
416
+ *
417
+ * Must be used within a `<TruthProvider />`.
418
+ *
419
+ * @example
420
+ * ```tsx
421
+ * import { useConversationById } from '@hipnation-truth/sdk/react/conversation-by-id';
422
+ *
423
+ * function ConversationScreen({ id }: { id: string }) {
424
+ * const { data: conversation, loading } = useConversationById(id);
425
+ * if (loading) return <Spinner />;
426
+ * if (!conversation) return <NotFound />;
427
+ * return <View>{conversation.patientPhone}</View>;
428
+ * }
429
+ * ```
430
+ */
431
+
432
+ /**
433
+ * Subscribe to a single conversation by its Convex document id. Returns
434
+ * `null` when no conversation exists for that id.
435
+ *
436
+ * `data` is `undefined` while loading or when `id` is falsy (skip). Pass
437
+ * `null` or `undefined` to skip the query — useful when the route param
438
+ * hasn't resolved yet.
439
+ */
440
+ declare function useConversationById(id: string | null | undefined): UseQueryResult<ConversationRow | null>;
441
+
397
442
  /**
398
443
  * React hooks for Truth SDK — real-time Convex-backed data access.
399
444
  *
@@ -1015,6 +1060,41 @@ interface ScheduleReminderResult {
1015
1060
  */
1016
1061
  declare function useRemindersForConversations(conversationIds: string[] | null | undefined): UseQueryResult<Record<string, Reminder>>;
1017
1062
 
1063
+ /**
1064
+ * React hooks for conversation tasks (My Tasks surface).
1065
+ *
1066
+ * Provides a reactive `useMutation` wrapper around the
1067
+ * `conversationTasks:markSeen` Convex mutation so CommHub can replace
1068
+ * `useMark_Event_Activity_SeenMutation` from `@/generated/graphql`
1069
+ * with a Truth SDK equivalent without touching `react.ts` exports (the
1070
+ * central agent wires those).
1071
+ *
1072
+ * Pattern mirrors the existing hooks in `./conversations.ts`:
1073
+ * - `makeFunctionReference` for decoupled Convex references
1074
+ * - SKIP sentinel for conditional execution
1075
+ * - Returns a stable callback, not a live subscription
1076
+ *
1077
+ * Must be used within `<TruthProvider />`.
1078
+ */
1079
+ /**
1080
+ * Returns a stable `markSeen(taskId, userId)` callback backed by the
1081
+ * `conversationTasks:markSeen` Convex mutation. Replaces the Hasura
1082
+ * `useMark_Event_Activity_SeenMutation` in CommHub's My Tasks surface.
1083
+ *
1084
+ * @example
1085
+ * ```tsx
1086
+ * const markSeen = useConversationTaskMarkSeen();
1087
+ *
1088
+ * // When a task row is pressed:
1089
+ * if (!task.seenBy.includes(userId)) {
1090
+ * markSeen(task.id, userId).catch(console.error);
1091
+ * }
1092
+ * ```
1093
+ */
1094
+ declare function useConversationTaskMarkSeen(): (taskId: string, userId: string) => Promise<{
1095
+ ok: true;
1096
+ }>;
1097
+
1018
1098
  /**
1019
1099
  * Typed event definitions for the Truth Platform event store.
1020
1100
  *
@@ -2328,6 +2408,16 @@ interface UpdateTaskStatusInput {
2328
2408
  resolvedBy?: string;
2329
2409
  data?: unknown;
2330
2410
  }
2411
+ /**
2412
+ * Input for `tasks.markSeen()` — marks a conversation task as seen by
2413
+ * the given user, backing CommHub's My Tasks "unseen" indicator.
2414
+ */
2415
+ interface ConversationTaskMarkSeenInput {
2416
+ /** Convex `_id` of the `conversationTasks` row. */
2417
+ taskId: string;
2418
+ /** User id of the person who viewed the task. */
2419
+ userId: string;
2420
+ }
2331
2421
 
2332
2422
  /**
2333
2423
  * TasksResource — create, update status, list, get tasks.
@@ -2355,6 +2445,17 @@ declare class TasksResource {
2355
2445
  limit?: number;
2356
2446
  }): Promise<Task[]>;
2357
2447
  listOpen(limit?: number): Promise<Task[]>;
2448
+ /**
2449
+ * Mark a conversation task as seen by the given user. Appends `userId`
2450
+ * to the `seenBy` array on the `conversationTasks` row if not already
2451
+ * present. Replaces CommHub's `useMark_Event_Activity_SeenMutation`.
2452
+ *
2453
+ * @returns `{ ok: true }` on success.
2454
+ * @throws if the task does not exist in Convex.
2455
+ */
2456
+ markSeen(input: ConversationTaskMarkSeenInput): Promise<{
2457
+ ok: true;
2458
+ }>;
2358
2459
  }
2359
2460
 
2360
2461
  interface TranslationResult {
@@ -2554,4 +2655,4 @@ interface UseVoicemailUrlResult {
2554
2655
  */
2555
2656
  declare function useVoicemailUrl(client: TruthClient): UseVoicemailUrlResult;
2556
2657
 
2557
- export { ACTIVE_CALL_STATES, type Appointment, type AppointmentListOptions, CONNECTED_CALL_STATES, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type ConversationNoteRow, type ConversationRow, type ConversationTaskForUserRow, type ConversationTaskRow, type DialpadCallLogRow, type DialpadCallRow, DialpadCallState, type EventPayloadMap, type EventType, type FamilyMemberRow, type Patient, type PatientListOptions, type PatientSearchResult, type PermissionStatus, type Physician$1 as Physician, RINGING_CALL_STATES, TERMINAL_CALL_STATES, type TrackOptions, TruthProvider, type TruthProviderProps, type TruthTrackingContextValue, TruthTrackingProvider, type TruthTrackingProviderProps, type UseActiveCallsOptions, type UseAppointmentListOptions, type UseConversationMessagesOptions, type UseConversationsFilters, type UseMessagesOptions, type UseNotificationsOptions, type UseNotificationsResult, type UsePatientBasicOptions, type UsePatientBasicResult, type UsePatientFamilyMembersInput, type UsePatientListOptions, type UsePatientMedicalOptions, type UsePatientPhotoOptions, type UsePatientSearchOptions, type UseQueryResult, useActiveCalls, useAppointment, useAppointmentByElationId, useAppointments, useConversationByPhonePair, useConversationMessages, useConversationNotes, useConversationNotesByPhonePair, useConversationTasks, useConversationTasksByPhonePair, useConversationTasksForUser, useConversations, useDialpadCallByCallId, useDialpadCallLog, useDialpadCallsForConversation, useMessages, useNotifications, usePatient, usePatientBasic, usePatientByElationId, usePatientByHintId, usePatientFamilyMembers, usePatientMedical, usePatientPhoto, usePatientSearch, usePatients, usePatientsByIds, usePatientsByPhones, usePharmacyByNcpdpId, usePhysicianByElationId, usePhysiciansByElationIds, useRemindersForConversations, useTruth, useUnreadAggregate, useUnreadCount, useUserSettings, useVoicemailUrl };
2658
+ export { ACTIVE_CALL_STATES, type Appointment, type AppointmentListOptions, CONNECTED_CALL_STATES, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type ConversationNoteRow, type ConversationRow, type ConversationTaskForUserRow, type ConversationTaskRow, type DialpadCallLogRow, type DialpadCallRow, DialpadCallState, type EventPayloadMap, type EventType, type FamilyMemberRow, type Patient, type PatientListOptions, type PatientSearchResult, type PermissionStatus, type Physician$1 as Physician, RINGING_CALL_STATES, TERMINAL_CALL_STATES, type TrackOptions, TruthProvider, type TruthProviderProps, type TruthTrackingContextValue, TruthTrackingProvider, type TruthTrackingProviderProps, type UseActiveCallsOptions, type UseAppointmentListOptions, type UseConversationMessagesOptions, type UseConversationsFilters, type UseMessagesOptions, type UseNotificationsOptions, type UseNotificationsResult, type UsePatientBasicOptions, type UsePatientBasicResult, type UsePatientFamilyMembersInput, type UsePatientListOptions, type UsePatientMedicalOptions, type UsePatientPhotoOptions, type UsePatientSearchOptions, type UseQueryResult, useActiveCalls, useAppointment, useAppointmentByElationId, useAppointments, useConversationById, useConversationByPhonePair, useConversationMessages, useConversationNotes, useConversationNotesByPhonePair, useConversationTaskMarkSeen, useConversationTasks, useConversationTasksByPhonePair, useConversationTasksForUser, useConversations, useDialpadCallByCallId, useDialpadCallLog, useDialpadCallsForConversation, useMessages, useNotifications, usePatient, usePatientBasic, usePatientByElationId, usePatientByHintId, usePatientFamilyMembers, usePatientMedical, usePatientPhoto, usePatientSearch, usePatients, usePatientsByIds, usePatientsByPhones, usePharmacyByNcpdpId, usePhysicianByElationId, usePhysiciansByElationIds, useRemindersForConversations, useTruth, useUnreadAggregate, useUnreadCount, useUserSettings, useVoicemailUrl };