@hipnation-truth/sdk 0.16.1 → 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/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +114 -1
- package/dist/react.js +185 -121
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
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";
|
|
@@ -248,6 +254,18 @@ declare function useMessages(conversationId: string | null | undefined, options?
|
|
|
248
254
|
* messages, `undefined` while loading or when `userId` is missing.
|
|
249
255
|
*/
|
|
250
256
|
declare function useUnreadCount(userId: string | null | undefined): UseQueryResult<number>;
|
|
257
|
+
/**
|
|
258
|
+
* Server-side aggregate of the user's unread total + count of
|
|
259
|
+
* conversations with at least one unread. Optionally filtered by
|
|
260
|
+
* `providerPhones` (e.g. selected offices) — the aggregate is
|
|
261
|
+
* computed in Convex, no client-side fetch-and-filter.
|
|
262
|
+
*/
|
|
263
|
+
declare function useUnreadAggregate(userId: string | null | undefined, options?: {
|
|
264
|
+
providerPhones?: string[];
|
|
265
|
+
}): UseQueryResult<{
|
|
266
|
+
totalMessages: number;
|
|
267
|
+
conversationCount: number;
|
|
268
|
+
}>;
|
|
251
269
|
/**
|
|
252
270
|
* Subscribe to all notes attached to a conversation, newest first.
|
|
253
271
|
* Replaces the urql Hasura `useConversation_NotesSubscription` in
|
|
@@ -382,6 +400,45 @@ declare function useDialpadCallLog(callId: string | null | undefined, options?:
|
|
|
382
400
|
limit?: number;
|
|
383
401
|
}): UseQueryResult<DialpadCallLogRow[]>;
|
|
384
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
|
+
|
|
385
442
|
/**
|
|
386
443
|
* React hooks for Truth SDK — real-time Convex-backed data access.
|
|
387
444
|
*
|
|
@@ -1003,6 +1060,41 @@ interface ScheduleReminderResult {
|
|
|
1003
1060
|
*/
|
|
1004
1061
|
declare function useRemindersForConversations(conversationIds: string[] | null | undefined): UseQueryResult<Record<string, Reminder>>;
|
|
1005
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
|
+
|
|
1006
1098
|
/**
|
|
1007
1099
|
* Typed event definitions for the Truth Platform event store.
|
|
1008
1100
|
*
|
|
@@ -2316,6 +2408,16 @@ interface UpdateTaskStatusInput {
|
|
|
2316
2408
|
resolvedBy?: string;
|
|
2317
2409
|
data?: unknown;
|
|
2318
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
|
+
}
|
|
2319
2421
|
|
|
2320
2422
|
/**
|
|
2321
2423
|
* TasksResource — create, update status, list, get tasks.
|
|
@@ -2343,6 +2445,17 @@ declare class TasksResource {
|
|
|
2343
2445
|
limit?: number;
|
|
2344
2446
|
}): Promise<Task[]>;
|
|
2345
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
|
+
}>;
|
|
2346
2459
|
}
|
|
2347
2460
|
|
|
2348
2461
|
interface TranslationResult {
|
|
@@ -2542,4 +2655,4 @@ interface UseVoicemailUrlResult {
|
|
|
2542
2655
|
*/
|
|
2543
2656
|
declare function useVoicemailUrl(client: TruthClient): UseVoicemailUrlResult;
|
|
2544
2657
|
|
|
2545
|
-
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, 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 };
|