@hipnation-truth/sdk 0.11.0 → 0.13.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 +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +148 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -12
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +95 -79
- package/dist/react.js +177 -148
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
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,109 @@ 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
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
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
|
-
|
|
213
|
+
|
|
214
|
+
declare const DialpadCallState: {
|
|
215
|
+
readonly Calling: "calling";
|
|
216
|
+
readonly Ringing: "ringing";
|
|
217
|
+
readonly Connected: "connected";
|
|
218
|
+
readonly Hold: "hold";
|
|
219
|
+
readonly Hangup: "hangup";
|
|
220
|
+
readonly Missed: "missed";
|
|
221
|
+
readonly VoicemailUploaded: "voicemail_uploaded";
|
|
222
|
+
};
|
|
223
|
+
type DialpadCallState = (typeof DialpadCallState)[keyof typeof DialpadCallState];
|
|
224
|
+
/** Ringing states — caller hasn't been picked up yet. */
|
|
225
|
+
declare const RINGING_CALL_STATES: ReadonlySet<DialpadCallState>;
|
|
226
|
+
/** Connected states — call is live (or on hold). */
|
|
227
|
+
declare const CONNECTED_CALL_STATES: ReadonlySet<DialpadCallState>;
|
|
228
|
+
/**
|
|
229
|
+
* Active states — anything not terminal. Default filter for
|
|
230
|
+
* `useActiveCalls`; the union of ringing + connected. `hold` is NOT
|
|
231
|
+
* included by default because the IncomingCalls UI doesn't surface
|
|
232
|
+
* held calls in the inbox banner.
|
|
233
|
+
*/
|
|
234
|
+
declare const ACTIVE_CALL_STATES: ReadonlySet<DialpadCallState>;
|
|
235
|
+
/** Terminal states — call has ended. Used to exclude rows from active lists. */
|
|
236
|
+
declare const TERMINAL_CALL_STATES: ReadonlySet<DialpadCallState>;
|
|
237
|
+
interface DialpadCallRow {
|
|
238
|
+
_id: string;
|
|
239
|
+
_creationTime: number;
|
|
240
|
+
callId: string;
|
|
241
|
+
state: string;
|
|
242
|
+
direction: string | null;
|
|
243
|
+
fromNumber: string | null;
|
|
244
|
+
toNumber: string | null;
|
|
245
|
+
phonePair: string | null;
|
|
246
|
+
conversationId: string | null;
|
|
247
|
+
patientId: string | null;
|
|
248
|
+
voicemailLink: string | null;
|
|
249
|
+
voicemailDurationSec: number | null;
|
|
250
|
+
transcript: unknown | null;
|
|
251
|
+
duration: number | null;
|
|
252
|
+
occurredAt: string;
|
|
253
|
+
updatedAt: string;
|
|
254
|
+
}
|
|
255
|
+
interface DialpadCallLogRow {
|
|
256
|
+
_id: string;
|
|
257
|
+
_creationTime: number;
|
|
258
|
+
callId: string;
|
|
259
|
+
state: string;
|
|
260
|
+
direction: string | null;
|
|
261
|
+
payload: unknown | null;
|
|
262
|
+
occurredAt: string;
|
|
263
|
+
}
|
|
264
|
+
interface UseActiveCallsOptions {
|
|
265
|
+
/** Page cap. Default 50. */
|
|
266
|
+
limit?: number;
|
|
267
|
+
/**
|
|
268
|
+
* Terminal states excluded from the active list. Override only if
|
|
269
|
+
* Dialpad introduces a new state.
|
|
270
|
+
*/
|
|
271
|
+
terminalStates?: string[];
|
|
272
|
+
}
|
|
261
273
|
/**
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* `[]` if no conversation exists for the pair yet.
|
|
274
|
+
* Live list of every Dialpad call that hasn't reached a terminal state
|
|
275
|
+
* — used by CommHub's IncomingCalls banner. Updates as the webhook
|
|
276
|
+
* handler patches the per-call row.
|
|
266
277
|
*/
|
|
267
|
-
declare function
|
|
278
|
+
declare function useActiveCalls(options?: UseActiveCallsOptions): UseQueryResult<DialpadCallRow[]>;
|
|
268
279
|
/**
|
|
269
|
-
*
|
|
280
|
+
* All calls (most-recent-first) on a single conversation. Pass the
|
|
281
|
+
* Convex conversation `_id` (e.g. from `useConversationByPhonePair`).
|
|
270
282
|
*/
|
|
283
|
+
declare function useDialpadCallsForConversation(conversationId: string | null | undefined, options?: {
|
|
284
|
+
limit?: number;
|
|
285
|
+
}): UseQueryResult<DialpadCallRow[]>;
|
|
286
|
+
/** Single call lookup by Dialpad `call_id`. */
|
|
287
|
+
declare function useDialpadCallByCallId(callId: string | null | undefined): UseQueryResult<DialpadCallRow | null>;
|
|
271
288
|
/**
|
|
272
|
-
*
|
|
273
|
-
*
|
|
289
|
+
* Full audit history of state transitions for a call — backs the
|
|
290
|
+
* hold / recording / transcription timeline in the right panel.
|
|
274
291
|
*/
|
|
275
|
-
declare function
|
|
292
|
+
declare function useDialpadCallLog(callId: string | null | undefined, options?: {
|
|
276
293
|
limit?: number;
|
|
277
|
-
}): UseQueryResult<
|
|
278
|
-
declare function useConversationTasksByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
|
|
294
|
+
}): UseQueryResult<DialpadCallLogRow[]>;
|
|
279
295
|
|
|
280
296
|
/**
|
|
281
297
|
* React hooks for Truth SDK — real-time Convex-backed data access.
|
|
@@ -993,4 +1009,4 @@ interface PatientListOptions {
|
|
|
993
1009
|
cursor?: string;
|
|
994
1010
|
}
|
|
995
1011
|
|
|
996
|
-
export { type Appointment, type AppointmentListOptions, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type
|
|
1012
|
+
export { ACTIVE_CALL_STATES, type Appointment, type AppointmentListOptions, CONNECTED_CALL_STATES, type ConversationListItem, type ConversationMessage, type ConversationMessageRow, type ConversationRow, type DialpadCallLogRow, type DialpadCallRow, DialpadCallState, type EventPayloadMap, type EventType, type Patient, type PatientListOptions, type PermissionStatus, type 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 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 };
|