@hipnation-truth/sdk 0.13.0 → 0.15.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 +103 -1
- package/dist/index.d.ts +103 -1
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +88 -1
- package/dist/react.js +70 -3
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -107,6 +107,54 @@ 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
|
+
}
|
|
110
158
|
interface ConversationMessageRow {
|
|
111
159
|
kind: "call" | "sms";
|
|
112
160
|
id: string;
|
|
@@ -146,6 +194,15 @@ interface UseConversationsFilters {
|
|
|
146
194
|
* the query — useful when the auth session is still loading.
|
|
147
195
|
*/
|
|
148
196
|
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;
|
|
149
206
|
/** Page size. Server caps at 100 by default. */
|
|
150
207
|
limit?: number;
|
|
151
208
|
}
|
|
@@ -189,6 +246,36 @@ declare function useMessages(conversationId: string | null | undefined, options?
|
|
|
189
246
|
* messages, `undefined` while loading or when `userId` is missing.
|
|
190
247
|
*/
|
|
191
248
|
declare function useUnreadCount(userId: string | null | undefined): UseQueryResult<number>;
|
|
249
|
+
/**
|
|
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).
|
|
259
|
+
*/
|
|
260
|
+
declare function useConversationTasks(conversationId: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
|
|
261
|
+
/**
|
|
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.
|
|
266
|
+
*/
|
|
267
|
+
declare function useConversationNotesByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationNoteRow[]>;
|
|
268
|
+
/**
|
|
269
|
+
* Same as `useConversationTasks` but keyed on phonePair.
|
|
270
|
+
*/
|
|
271
|
+
/**
|
|
272
|
+
* Subscribe to every conversation task where the caller is the
|
|
273
|
+
* assignee or the author. Backs CommHub's "My Tasks" tab.
|
|
274
|
+
*/
|
|
275
|
+
declare function useConversationTasksForUser(userId: string | null | undefined, options?: {
|
|
276
|
+
limit?: number;
|
|
277
|
+
}): UseQueryResult<ConversationTaskForUserRow[]>;
|
|
278
|
+
declare function useConversationTasksByPhonePair(phonePair: string | null | undefined): UseQueryResult<ConversationTaskRow[]>;
|
|
192
279
|
|
|
193
280
|
/**
|
|
194
281
|
* React hooks for Dialpad call events — replaces CommHub's Hasura
|
|
@@ -1009,4 +1096,4 @@ interface PatientListOptions {
|
|
|
1009
1096
|
cursor?: string;
|
|
1010
1097
|
}
|
|
1011
1098
|
|
|
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 };
|
|
1099
|
+
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 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, useConversationNotes, useConversationNotesByPhonePair, useConversationTasks, useConversationTasksByPhonePair, useConversationTasksForUser, useConversations, useDialpadCallByCallId, useDialpadCallLog, useDialpadCallsForConversation, useMessages, useNotifications, usePatient, usePatientBasic, usePatientByElationId, usePatientByHintId, usePatientMedical, usePatientPhoto, usePatients, usePharmacyByNcpdpId, usePhysicianByElationId, usePhysiciansByElationIds, useTruth, useUnreadCount };
|
package/dist/react.js
CHANGED
|
@@ -69,6 +69,11 @@ __export(react_exports, {
|
|
|
69
69
|
useAppointments: () => useAppointments,
|
|
70
70
|
useConversationByPhonePair: () => useConversationByPhonePair,
|
|
71
71
|
useConversationMessages: () => useConversationMessages,
|
|
72
|
+
useConversationNotes: () => useConversationNotes,
|
|
73
|
+
useConversationNotesByPhonePair: () => useConversationNotesByPhonePair,
|
|
74
|
+
useConversationTasks: () => useConversationTasks,
|
|
75
|
+
useConversationTasksByPhonePair: () => useConversationTasksByPhonePair,
|
|
76
|
+
useConversationTasksForUser: () => useConversationTasksForUser,
|
|
72
77
|
useConversations: () => useConversations,
|
|
73
78
|
useDialpadCallByCallId: () => useDialpadCallByCallId,
|
|
74
79
|
useDialpadCallLog: () => useDialpadCallLog,
|
|
@@ -172,9 +177,15 @@ function useDialpadCallLog(callId, options) {
|
|
|
172
177
|
var import_react2 = require("convex/react");
|
|
173
178
|
var import_server2 = require("convex/server");
|
|
174
179
|
var conversationsListForUserRef = (0, import_server2.makeFunctionReference)("conversations:listForUser");
|
|
180
|
+
var conversationsSearchForUserRef = (0, import_server2.makeFunctionReference)("conversations:searchForUser");
|
|
175
181
|
var conversationsGetUnreadTotalForUserRef = (0, import_server2.makeFunctionReference)("conversations:getUnreadTotalForUser");
|
|
176
182
|
var conversationsGetByPhonePairRef = (0, import_server2.makeFunctionReference)("conversations:getByPhonePair");
|
|
177
183
|
var conversationMessagesGetByConversationIdRef = (0, import_server2.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
184
|
+
var conversationNotesListForConversationRef = (0, import_server2.makeFunctionReference)("conversationNotes:listForConversation");
|
|
185
|
+
var conversationTasksListForConversationRef = (0, import_server2.makeFunctionReference)("conversationTasks:listForConversation");
|
|
186
|
+
var conversationNotesListByPhonePairRef = (0, import_server2.makeFunctionReference)("conversationNotes:listByPhonePair");
|
|
187
|
+
var conversationTasksListByPhonePairRef = (0, import_server2.makeFunctionReference)("conversationTasks:listByPhonePair");
|
|
188
|
+
var conversationTasksListForUserRef = (0, import_server2.makeFunctionReference)("conversationTasks:listForUser");
|
|
178
189
|
var SKIP2 = "skip";
|
|
179
190
|
function toResult2(value, skipped) {
|
|
180
191
|
if (skipped) {
|
|
@@ -187,15 +198,26 @@ function toResult2(value, skipped) {
|
|
|
187
198
|
};
|
|
188
199
|
}
|
|
189
200
|
function useConversations(filters) {
|
|
201
|
+
var _a, _b;
|
|
202
|
+
const trimmedSearch = (_b = (_a = filters.search) == null ? void 0 : _a.trim()) != null ? _b : "";
|
|
203
|
+
const isSearchMode = trimmedSearch.length > 0;
|
|
190
204
|
const skipped = !filters.userId;
|
|
191
|
-
const
|
|
205
|
+
const listResult = (0, import_react2.useQuery)(
|
|
192
206
|
conversationsListForUserRef,
|
|
193
|
-
skipped ? SKIP2 : {
|
|
207
|
+
skipped || isSearchMode ? SKIP2 : {
|
|
194
208
|
userId: filters.userId,
|
|
195
209
|
limit: filters.limit
|
|
196
210
|
}
|
|
197
211
|
);
|
|
198
|
-
|
|
212
|
+
const searchResult = (0, import_react2.useQuery)(
|
|
213
|
+
conversationsSearchForUserRef,
|
|
214
|
+
skipped || !isSearchMode ? SKIP2 : {
|
|
215
|
+
userId: filters.userId,
|
|
216
|
+
search: trimmedSearch,
|
|
217
|
+
limit: filters.limit
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
return toResult2(isSearchMode ? searchResult : listResult, skipped);
|
|
199
221
|
}
|
|
200
222
|
function useConversationByPhonePair(phonePair) {
|
|
201
223
|
const skipped = !phonePair;
|
|
@@ -224,6 +246,46 @@ function useUnreadCount(userId) {
|
|
|
224
246
|
);
|
|
225
247
|
return toResult2(result, skipped);
|
|
226
248
|
}
|
|
249
|
+
function useConversationNotes(conversationId) {
|
|
250
|
+
const skipped = !conversationId;
|
|
251
|
+
const result = (0, import_react2.useQuery)(
|
|
252
|
+
conversationNotesListForConversationRef,
|
|
253
|
+
skipped ? SKIP2 : { conversationId }
|
|
254
|
+
);
|
|
255
|
+
return toResult2(result, skipped);
|
|
256
|
+
}
|
|
257
|
+
function useConversationTasks(conversationId) {
|
|
258
|
+
const skipped = !conversationId;
|
|
259
|
+
const result = (0, import_react2.useQuery)(
|
|
260
|
+
conversationTasksListForConversationRef,
|
|
261
|
+
skipped ? SKIP2 : { conversationId }
|
|
262
|
+
);
|
|
263
|
+
return toResult2(result, skipped);
|
|
264
|
+
}
|
|
265
|
+
function useConversationNotesByPhonePair(phonePair) {
|
|
266
|
+
const skipped = !phonePair;
|
|
267
|
+
const result = (0, import_react2.useQuery)(
|
|
268
|
+
conversationNotesListByPhonePairRef,
|
|
269
|
+
skipped ? SKIP2 : { phonePair }
|
|
270
|
+
);
|
|
271
|
+
return toResult2(result, skipped);
|
|
272
|
+
}
|
|
273
|
+
function useConversationTasksForUser(userId, options) {
|
|
274
|
+
const skipped = !userId;
|
|
275
|
+
const result = (0, import_react2.useQuery)(
|
|
276
|
+
conversationTasksListForUserRef,
|
|
277
|
+
skipped ? SKIP2 : { userId, limit: options == null ? void 0 : options.limit }
|
|
278
|
+
);
|
|
279
|
+
return toResult2(result, skipped);
|
|
280
|
+
}
|
|
281
|
+
function useConversationTasksByPhonePair(phonePair) {
|
|
282
|
+
const skipped = !phonePair;
|
|
283
|
+
const result = (0, import_react2.useQuery)(
|
|
284
|
+
conversationTasksListByPhonePairRef,
|
|
285
|
+
skipped ? SKIP2 : { phonePair }
|
|
286
|
+
);
|
|
287
|
+
return toResult2(result, skipped);
|
|
288
|
+
}
|
|
227
289
|
|
|
228
290
|
// src/react/hooks.ts
|
|
229
291
|
var import_react3 = require("convex/react");
|
|
@@ -1098,6 +1160,11 @@ function useTruth() {
|
|
|
1098
1160
|
useAppointments,
|
|
1099
1161
|
useConversationByPhonePair,
|
|
1100
1162
|
useConversationMessages,
|
|
1163
|
+
useConversationNotes,
|
|
1164
|
+
useConversationNotesByPhonePair,
|
|
1165
|
+
useConversationTasks,
|
|
1166
|
+
useConversationTasksByPhonePair,
|
|
1167
|
+
useConversationTasksForUser,
|
|
1101
1168
|
useConversations,
|
|
1102
1169
|
useDialpadCallByCallId,
|
|
1103
1170
|
useDialpadCallLog,
|