@hipnation-truth/sdk 0.11.0 → 0.12.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
@@ -107,54 +107,6 @@ interface ConversationRow {
107
107
  * already exported from the SDK; re-exported here under a clearer name
108
108
  * for the new hook surface.
109
109
  */
110
- /**
111
- * Conversation note row — single entry shown in the right-panel notes
112
- * tab in CommHub. Replaces the urql Hasura `internal_activities` row
113
- * with `type='note'`.
114
- */
115
- interface ConversationNoteRow {
116
- /** Convex id of the conversationNotes row. */
117
- id: string;
118
- conversationId: string;
119
- /** Dialpad event the note is attached to, when present. */
120
- eventId: string | null;
121
- author: string;
122
- content: string;
123
- /** Free-form status flag — matches CommHub's existing schema. */
124
- status: string | null;
125
- /** Free-form `type` discriminator — matches CommHub's existing schema. */
126
- type: string | null;
127
- createdAt: string;
128
- updatedAt: string;
129
- }
130
- /**
131
- * Conversation task row — single entry shown in the right-panel tasks
132
- * tab. Replaces the urql Hasura `internal_activities` row with
133
- * `type='task'`.
134
- */
135
- interface ConversationTaskRow {
136
- id: string;
137
- conversationId: string;
138
- eventId: string | null;
139
- author: string;
140
- description: string;
141
- status: "pending" | "completed";
142
- priority: "high" | "medium" | "low" | null;
143
- assignee: string | null;
144
- resolvedBy: string | null;
145
- type: string | null;
146
- createdAt: string;
147
- updatedAt: string;
148
- }
149
- /**
150
- * Cross-conversation task row used by the "My Tasks" tab. Adds the
151
- * conversation's normalized phone pair so the UI can render the
152
- * patient handle without a second reactive query.
153
- */
154
- interface ConversationTaskForUserRow extends ConversationTaskRow {
155
- /** Normalized `(patient_phone | provider_phone)` for the task's conversation. */
156
- phonePair: string | null;
157
- }
158
110
  interface ConversationMessageRow {
159
111
  kind: "call" | "sms";
160
112
  id: string;
@@ -194,15 +146,6 @@ interface UseConversationsFilters {
194
146
  * the query — useful when the auth session is still loading.
195
147
  */
196
148
  userId: string | null | undefined;
197
- /**
198
- * Optional search term — when non-empty, switches the hook from
199
- * `conversations:listForUser` to `conversations:searchForUser`, which
200
- * fans out two parallel Convex full-text patient searches
201
- * (firstName + lastName) and returns the matching conversations the
202
- * user can see, sorted by recency. Whitespace-only values are treated
203
- * as empty.
204
- */
205
- search?: string;
206
149
  /** Page size. Server caps at 100 by default. */
207
150
  limit?: number;
208
151
  }
@@ -246,36 +189,86 @@ declare function useMessages(conversationId: string | null | undefined, options?
246
189
  * messages, `undefined` while loading or when `userId` is missing.
247
190
  */
248
191
  declare function useUnreadCount(userId: string | null | undefined): UseQueryResult<number>;
192
+
249
193
  /**
250
- * Subscribe to all notes attached to a conversation, newest first.
251
- * Replaces the urql Hasura `useConversation_NotesSubscription` in
252
- * CommHub (Truth #730). Pass `null`/`undefined` to skip the query.
253
- */
254
- declare function useConversationNotes(conversationId: string | null | undefined): UseQueryResult<ConversationNoteRow[]>;
255
- /**
256
- * Subscribe to all tasks attached to a conversation, newest first.
257
- * Replaces the urql Hasura `useConversation_TasksSubscription` in
258
- * CommHub (Truth #730).
194
+ * React hooks for Dialpad call events replaces CommHub's Hasura
195
+ * `useDialpad_EventsSubscription`. Powered by the new
196
+ * `dialpadCallEvents` + `dialpadCallEventLog` Convex tables that the
197
+ * Truth webhook handler writes on every call state transition.
198
+ *
199
+ * Same `{ data, loading, error }` contract as the other hooks in this
200
+ * SDK; same `skip` semantics on missing arguments.
201
+ *
202
+ * @example
203
+ * ```tsx
204
+ * import { useActiveCalls, useDialpadCallByCallId } from '@hipnation-truth/sdk/react';
205
+ *
206
+ * function IncomingBanner() {
207
+ * const { data: active } = useActiveCalls();
208
+ * if (!active?.length) return null;
209
+ * return <Banner calls={active} />;
210
+ * }
211
+ * ```
259
212
  */
260
- declare function useConversationTasks(conversationId: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
213
+
214
+ interface DialpadCallRow {
215
+ _id: string;
216
+ _creationTime: number;
217
+ callId: string;
218
+ state: string;
219
+ direction: string | null;
220
+ fromNumber: string | null;
221
+ toNumber: string | null;
222
+ phonePair: string | null;
223
+ conversationId: string | null;
224
+ patientId: string | null;
225
+ voicemailLink: string | null;
226
+ voicemailDurationSec: number | null;
227
+ transcript: unknown | null;
228
+ duration: number | null;
229
+ occurredAt: string;
230
+ updatedAt: string;
231
+ }
232
+ interface DialpadCallLogRow {
233
+ _id: string;
234
+ _creationTime: number;
235
+ callId: string;
236
+ state: string;
237
+ direction: string | null;
238
+ payload: unknown | null;
239
+ occurredAt: string;
240
+ }
241
+ interface UseActiveCallsOptions {
242
+ /** Page cap. Default 50. */
243
+ limit?: number;
244
+ /**
245
+ * Terminal states excluded from the active list. Override only if
246
+ * Dialpad introduces a new state.
247
+ */
248
+ terminalStates?: string[];
249
+ }
261
250
  /**
262
- * Same as `useConversationNotes` but keyed on the normalized
263
- * `(patient_phone | provider_phone)` pair saves the caller from
264
- * chaining a separate `useConversationByPhonePair` call. Returns
265
- * `[]` if no conversation exists for the pair yet.
251
+ * Live list of every Dialpad call that hasn't reached a terminal state
252
+ * used by CommHub's IncomingCalls banner. Updates as the webhook
253
+ * handler patches the per-call row.
266
254
  */
267
- declare function useConversationNotesByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationNoteRow[]>;
255
+ declare function useActiveCalls(options?: UseActiveCallsOptions): UseQueryResult<DialpadCallRow[]>;
268
256
  /**
269
- * Same as `useConversationTasks` but keyed on phonePair.
257
+ * All calls (most-recent-first) on a single conversation. Pass the
258
+ * Convex conversation `_id` (e.g. from `useConversationByPhonePair`).
270
259
  */
260
+ declare function useDialpadCallsForConversation(conversationId: string | null | undefined, options?: {
261
+ limit?: number;
262
+ }): UseQueryResult<DialpadCallRow[]>;
263
+ /** Single call lookup by Dialpad `call_id`. */
264
+ declare function useDialpadCallByCallId(callId: string | null | undefined): UseQueryResult<DialpadCallRow | null>;
271
265
  /**
272
- * Subscribe to every conversation task where the caller is the
273
- * assignee or the author. Backs CommHub's "My Tasks" tab.
266
+ * Full audit history of state transitions for a call — backs the
267
+ * hold / recording / transcription timeline in the right panel.
274
268
  */
275
- declare function useConversationTasksForUser(userId: string | null | undefined, options?: {
269
+ declare function useDialpadCallLog(callId: string | null | undefined, options?: {
276
270
  limit?: number;
277
- }): UseQueryResult<ConversationTaskForUserRow[]>;
278
- declare function useConversationTasksByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
271
+ }): UseQueryResult<DialpadCallLogRow[]>;
279
272
 
280
273
  /**
281
274
  * React hooks for Truth SDK — real-time Convex-backed data access.
@@ -993,4 +986,4 @@ interface PatientListOptions {
993
986
  cursor?: string;
994
987
  }
995
988
 
996
- export { type Appointment, type AppointmentListOptions, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type ConversationNoteRow, type ConversationRow, type ConversationTaskForUserRow, type ConversationTaskRow, type EventPayloadMap, type EventType, type Patient, type PatientListOptions, type PermissionStatus, type Physician, type TrackOptions, TruthProvider, type TruthProviderProps, type TruthTrackingContextValue, TruthTrackingProvider, type TruthTrackingProviderProps, type UseAppointmentListOptions, type UseConversationMessagesOptions, type UseConversationsFilters, type UseMessagesOptions, type UseNotificationsOptions, type UseNotificationsResult, type UsePatientBasicOptions, type UsePatientBasicResult, type UsePatientListOptions, type UsePatientMedicalOptions, type UsePatientPhotoOptions, type UseQueryResult, useAppointment, useAppointmentByElationId, useAppointments, useConversationByPhonePair, useConversationMessages, useConversationNotes, useConversationNotesByPhonePair, useConversationTasks, useConversationTasksByPhonePair, useConversationTasksForUser, useConversations, useMessages, useNotifications, usePatient, usePatientBasic, usePatientByElationId, usePatientByHintId, usePatientMedical, usePatientPhoto, usePatients, usePharmacyByNcpdpId, usePhysicianByElationId, usePhysiciansByElationIds, useTruth, useUnreadCount };
989
+ export { type Appointment, type AppointmentListOptions, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type ConversationRow, type DialpadCallLogRow, type DialpadCallRow, type EventPayloadMap, type EventType, type Patient, type PatientListOptions, type PermissionStatus, type Physician, 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 UsePatientListOptions, type UsePatientMedicalOptions, type UsePatientPhotoOptions, type UseQueryResult, useActiveCalls, useAppointment, useAppointmentByElationId, useAppointments, useConversationByPhonePair, useConversationMessages, useConversations, useDialpadCallByCallId, useDialpadCallLog, useDialpadCallsForConversation, useMessages, useNotifications, usePatient, usePatientBasic, usePatientByElationId, usePatientByHintId, usePatientMedical, usePatientPhoto, usePatients, usePharmacyByNcpdpId, usePhysicianByElationId, usePhysiciansByElationIds, useTruth, useUnreadCount };