@hipnation-truth/sdk 0.16.3 → 0.17.1
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 +111 -1
- package/dist/react.js +164 -125
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -156,6 +156,21 @@ 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[];
|
|
165
|
+
/**
|
|
166
|
+
* Which backend table the task lives in:
|
|
167
|
+
* - `"conversation"` — `conversationTasks`, tied to a conversation.
|
|
168
|
+
* - `"standalone"` — the general `tasks` table (New Task modal with
|
|
169
|
+
* a patient but no conversation). For standalone rows
|
|
170
|
+
* `conversationId` is `""` and `phonePair` is `null`; status /
|
|
171
|
+
* priority mutations must route to the `tasks` resource.
|
|
172
|
+
*/
|
|
173
|
+
source: "conversation" | "standalone";
|
|
159
174
|
}
|
|
160
175
|
interface ConversationMessageRow {
|
|
161
176
|
kind: "call" | "sms";
|
|
@@ -394,6 +409,45 @@ declare function useDialpadCallLog(callId: string | null | undefined, options?:
|
|
|
394
409
|
limit?: number;
|
|
395
410
|
}): UseQueryResult<DialpadCallLogRow[]>;
|
|
396
411
|
|
|
412
|
+
/**
|
|
413
|
+
* React hook for a single conversation lookup by Convex id — Truth SDK.
|
|
414
|
+
*
|
|
415
|
+
* Replaces CommHub's `useGet_Conversation_EventQuery` (backed by the
|
|
416
|
+
* Hasura `Get_Conversation_Event` GraphQL query). Queries the Convex
|
|
417
|
+
* `conversations:getById` function which returns the raw conversation
|
|
418
|
+
* row, or `null` when the id doesn't exist.
|
|
419
|
+
*
|
|
420
|
+
* The returned `ConversationRow` carries the same phone-pair fields as
|
|
421
|
+
* `useConversationByPhonePair` — `patientPhone`, `providerPhone`,
|
|
422
|
+
* `phonePair`, `patientId` — but is keyed on the Convex document `_id`
|
|
423
|
+
* rather than the pair. Use this when you have a Convex id from a push
|
|
424
|
+
* notification or a deep-link route param.
|
|
425
|
+
*
|
|
426
|
+
* Must be used within a `<TruthProvider />`.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```tsx
|
|
430
|
+
* import { useConversationById } from '@hipnation-truth/sdk/react/conversation-by-id';
|
|
431
|
+
*
|
|
432
|
+
* function ConversationScreen({ id }: { id: string }) {
|
|
433
|
+
* const { data: conversation, loading } = useConversationById(id);
|
|
434
|
+
* if (loading) return <Spinner />;
|
|
435
|
+
* if (!conversation) return <NotFound />;
|
|
436
|
+
* return <View>{conversation.patientPhone}</View>;
|
|
437
|
+
* }
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Subscribe to a single conversation by its Convex document id. Returns
|
|
443
|
+
* `null` when no conversation exists for that id.
|
|
444
|
+
*
|
|
445
|
+
* `data` is `undefined` while loading or when `id` is falsy (skip). Pass
|
|
446
|
+
* `null` or `undefined` to skip the query — useful when the route param
|
|
447
|
+
* hasn't resolved yet.
|
|
448
|
+
*/
|
|
449
|
+
declare function useConversationById(id: string | null | undefined): UseQueryResult<ConversationRow | null>;
|
|
450
|
+
|
|
397
451
|
/**
|
|
398
452
|
* React hooks for Truth SDK — real-time Convex-backed data access.
|
|
399
453
|
*
|
|
@@ -1015,6 +1069,41 @@ interface ScheduleReminderResult {
|
|
|
1015
1069
|
*/
|
|
1016
1070
|
declare function useRemindersForConversations(conversationIds: string[] | null | undefined): UseQueryResult<Record<string, Reminder>>;
|
|
1017
1071
|
|
|
1072
|
+
/**
|
|
1073
|
+
* React hooks for conversation tasks (My Tasks surface).
|
|
1074
|
+
*
|
|
1075
|
+
* Provides a reactive `useMutation` wrapper around the
|
|
1076
|
+
* `conversationTasks:markSeen` Convex mutation so CommHub can replace
|
|
1077
|
+
* `useMark_Event_Activity_SeenMutation` from `@/generated/graphql`
|
|
1078
|
+
* with a Truth SDK equivalent without touching `react.ts` exports (the
|
|
1079
|
+
* central agent wires those).
|
|
1080
|
+
*
|
|
1081
|
+
* Pattern mirrors the existing hooks in `./conversations.ts`:
|
|
1082
|
+
* - `makeFunctionReference` for decoupled Convex references
|
|
1083
|
+
* - SKIP sentinel for conditional execution
|
|
1084
|
+
* - Returns a stable callback, not a live subscription
|
|
1085
|
+
*
|
|
1086
|
+
* Must be used within `<TruthProvider />`.
|
|
1087
|
+
*/
|
|
1088
|
+
/**
|
|
1089
|
+
* Returns a stable `markSeen(taskId, userId)` callback backed by the
|
|
1090
|
+
* `conversationTasks:markSeen` Convex mutation. Replaces the Hasura
|
|
1091
|
+
* `useMark_Event_Activity_SeenMutation` in CommHub's My Tasks surface.
|
|
1092
|
+
*
|
|
1093
|
+
* @example
|
|
1094
|
+
* ```tsx
|
|
1095
|
+
* const markSeen = useConversationTaskMarkSeen();
|
|
1096
|
+
*
|
|
1097
|
+
* // When a task row is pressed:
|
|
1098
|
+
* if (!task.seenBy.includes(userId)) {
|
|
1099
|
+
* markSeen(task.id, userId).catch(console.error);
|
|
1100
|
+
* }
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
declare function useConversationTaskMarkSeen(): (taskId: string, userId: string) => Promise<{
|
|
1104
|
+
ok: true;
|
|
1105
|
+
}>;
|
|
1106
|
+
|
|
1018
1107
|
/**
|
|
1019
1108
|
* Typed event definitions for the Truth Platform event store.
|
|
1020
1109
|
*
|
|
@@ -2328,6 +2417,16 @@ interface UpdateTaskStatusInput {
|
|
|
2328
2417
|
resolvedBy?: string;
|
|
2329
2418
|
data?: unknown;
|
|
2330
2419
|
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Input for `tasks.markSeen()` — marks a conversation task as seen by
|
|
2422
|
+
* the given user, backing CommHub's My Tasks "unseen" indicator.
|
|
2423
|
+
*/
|
|
2424
|
+
interface ConversationTaskMarkSeenInput {
|
|
2425
|
+
/** Convex `_id` of the `conversationTasks` row. */
|
|
2426
|
+
taskId: string;
|
|
2427
|
+
/** User id of the person who viewed the task. */
|
|
2428
|
+
userId: string;
|
|
2429
|
+
}
|
|
2331
2430
|
|
|
2332
2431
|
/**
|
|
2333
2432
|
* TasksResource — create, update status, list, get tasks.
|
|
@@ -2355,6 +2454,17 @@ declare class TasksResource {
|
|
|
2355
2454
|
limit?: number;
|
|
2356
2455
|
}): Promise<Task[]>;
|
|
2357
2456
|
listOpen(limit?: number): Promise<Task[]>;
|
|
2457
|
+
/**
|
|
2458
|
+
* Mark a conversation task as seen by the given user. Appends `userId`
|
|
2459
|
+
* to the `seenBy` array on the `conversationTasks` row if not already
|
|
2460
|
+
* present. Replaces CommHub's `useMark_Event_Activity_SeenMutation`.
|
|
2461
|
+
*
|
|
2462
|
+
* @returns `{ ok: true }` on success.
|
|
2463
|
+
* @throws if the task does not exist in Convex.
|
|
2464
|
+
*/
|
|
2465
|
+
markSeen(input: ConversationTaskMarkSeenInput): Promise<{
|
|
2466
|
+
ok: true;
|
|
2467
|
+
}>;
|
|
2358
2468
|
}
|
|
2359
2469
|
|
|
2360
2470
|
interface TranslationResult {
|
|
@@ -2554,4 +2664,4 @@ interface UseVoicemailUrlResult {
|
|
|
2554
2664
|
*/
|
|
2555
2665
|
declare function useVoicemailUrl(client: TruthClient): UseVoicemailUrlResult;
|
|
2556
2666
|
|
|
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 };
|
|
2667
|
+
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 };
|