@hipnation-truth/sdk 0.10.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,45 +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
110
  interface ConversationMessageRow {
150
111
  kind: "call" | "sms";
151
112
  id: string;
@@ -185,15 +146,6 @@ interface UseConversationsFilters {
185
146
  * the query — useful when the auth session is still loading.
186
147
  */
187
148
  userId: string | null | undefined;
188
- /**
189
- * Optional search term — when non-empty, switches the hook from
190
- * `conversations:listForUser` to `conversations:searchForUser`, which
191
- * fans out two parallel Convex full-text patient searches
192
- * (firstName + lastName) and returns the matching conversations the
193
- * user can see, sorted by recency. Whitespace-only values are treated
194
- * as empty.
195
- */
196
- search?: string;
197
149
  /** Page size. Server caps at 100 by default. */
198
150
  limit?: number;
199
151
  }
@@ -237,29 +189,86 @@ declare function useMessages(conversationId: string | null | undefined, options?
237
189
  * messages, `undefined` while loading or when `userId` is missing.
238
190
  */
239
191
  declare function useUnreadCount(userId: string | null | undefined): UseQueryResult<number>;
192
+
240
193
  /**
241
- * Subscribe to all notes attached to a conversation, newest first.
242
- * Replaces the urql Hasura `useConversation_NotesSubscription` in
243
- * CommHub (Truth #730). Pass `null`/`undefined` to skip the query.
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
+ * ```
244
212
  */
245
- declare function useConversationNotes(conversationId: string | null | undefined): UseQueryResult<ConversationNoteRow[]>;
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
+ }
246
250
  /**
247
- * Subscribe to all tasks attached to a conversation, newest first.
248
- * Replaces the urql Hasura `useConversation_TasksSubscription` in
249
- * CommHub (Truth #730).
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.
250
254
  */
251
- declare function useConversationTasks(conversationId: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
255
+ declare function useActiveCalls(options?: UseActiveCallsOptions): UseQueryResult<DialpadCallRow[]>;
252
256
  /**
253
- * Same as `useConversationNotes` but keyed on the normalized
254
- * `(patient_phone | provider_phone)` pair saves the caller from
255
- * chaining a separate `useConversationByPhonePair` call. Returns
256
- * `[]` if no conversation exists for the pair yet.
257
+ * All calls (most-recent-first) on a single conversation. Pass the
258
+ * Convex conversation `_id` (e.g. from `useConversationByPhonePair`).
257
259
  */
258
- declare function useConversationNotesByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationNoteRow[]>;
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>;
259
265
  /**
260
- * Same as `useConversationTasks` but keyed on phonePair.
266
+ * Full audit history of state transitions for a call — backs the
267
+ * hold / recording / transcription timeline in the right panel.
261
268
  */
262
- declare function useConversationTasksByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
269
+ declare function useDialpadCallLog(callId: string | null | undefined, options?: {
270
+ limit?: number;
271
+ }): UseQueryResult<DialpadCallLogRow[]>;
263
272
 
264
273
  /**
265
274
  * React hooks for Truth SDK — real-time Convex-backed data access.
@@ -977,4 +986,4 @@ interface PatientListOptions {
977
986
  cursor?: string;
978
987
  }
979
988
 
980
- export { type Appointment, type AppointmentListOptions, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type ConversationNoteRow, type ConversationRow, 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, 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 };