@hipnation-truth/sdk 0.16.1 → 0.17.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 +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 +114 -1
- package/dist/react.js +185 -121
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -67,10 +67,12 @@ __export(react_exports, {
|
|
|
67
67
|
useAppointment: () => useAppointment,
|
|
68
68
|
useAppointmentByElationId: () => useAppointmentByElationId,
|
|
69
69
|
useAppointments: () => useAppointments,
|
|
70
|
+
useConversationById: () => useConversationById,
|
|
70
71
|
useConversationByPhonePair: () => useConversationByPhonePair,
|
|
71
72
|
useConversationMessages: () => useConversationMessages,
|
|
72
73
|
useConversationNotes: () => useConversationNotes,
|
|
73
74
|
useConversationNotesByPhonePair: () => useConversationNotesByPhonePair,
|
|
75
|
+
useConversationTaskMarkSeen: () => useConversationTaskMarkSeen,
|
|
74
76
|
useConversationTasks: () => useConversationTasks,
|
|
75
77
|
useConversationTasksByPhonePair: () => useConversationTasksByPhonePair,
|
|
76
78
|
useConversationTasksForUser: () => useConversationTasksForUser,
|
|
@@ -96,6 +98,7 @@ __export(react_exports, {
|
|
|
96
98
|
usePhysiciansByElationIds: () => usePhysiciansByElationIds,
|
|
97
99
|
useRemindersForConversations: () => useRemindersForConversations,
|
|
98
100
|
useTruth: () => useTruth,
|
|
101
|
+
useUnreadAggregate: () => useUnreadAggregate,
|
|
99
102
|
useUnreadCount: () => useUnreadCount,
|
|
100
103
|
useUserSettings: () => useUserSettings,
|
|
101
104
|
useVoicemailUrl: () => useVoicemailUrl
|
|
@@ -180,19 +183,41 @@ function useDialpadCallLog(callId, options) {
|
|
|
180
183
|
return toResult(result, skipped);
|
|
181
184
|
}
|
|
182
185
|
|
|
183
|
-
// src/react/
|
|
186
|
+
// src/react/conversation-by-id.ts
|
|
184
187
|
var import_react2 = require("convex/react");
|
|
185
188
|
var import_server2 = require("convex/server");
|
|
186
|
-
var
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
var conversationsGetByIdRef = (0, import_server2.makeFunctionReference)("conversations:getById");
|
|
190
|
+
function useConversationById(id) {
|
|
191
|
+
const skipped = !id;
|
|
192
|
+
const result = (0, import_react2.useQuery)(
|
|
193
|
+
conversationsGetByIdRef,
|
|
194
|
+
skipped ? "skip" : { id }
|
|
195
|
+
);
|
|
196
|
+
if (skipped) {
|
|
197
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
data: result,
|
|
201
|
+
loading: result === void 0,
|
|
202
|
+
error: void 0
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// src/react/conversations.ts
|
|
207
|
+
var import_react3 = require("convex/react");
|
|
208
|
+
var import_server3 = require("convex/server");
|
|
209
|
+
var import_react4 = require("react");
|
|
210
|
+
var conversationsListForUserRef = (0, import_server3.makeFunctionReference)("conversations:listForUser");
|
|
211
|
+
var conversationsSearchForUserRef = (0, import_server3.makeFunctionReference)("conversations:searchForUser");
|
|
212
|
+
var conversationsGetUnreadTotalForUserRef = (0, import_server3.makeFunctionReference)("conversations:getUnreadTotalForUser");
|
|
213
|
+
var conversationsGetUnreadAggregateForUserRef = (0, import_server3.makeFunctionReference)("conversations:getUnreadAggregateForUser");
|
|
214
|
+
var conversationsGetByPhonePairRef = (0, import_server3.makeFunctionReference)("conversations:getByPhonePair");
|
|
215
|
+
var conversationMessagesGetByConversationIdRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
216
|
+
var conversationNotesListForConversationRef = (0, import_server3.makeFunctionReference)("conversationNotes:listForConversation");
|
|
217
|
+
var conversationTasksListForConversationRef = (0, import_server3.makeFunctionReference)("conversationTasks:listForConversation");
|
|
218
|
+
var conversationNotesListByPhonePairRef = (0, import_server3.makeFunctionReference)("conversationNotes:listByPhonePair");
|
|
219
|
+
var conversationTasksListByPhonePairRef = (0, import_server3.makeFunctionReference)("conversationTasks:listByPhonePair");
|
|
220
|
+
var conversationTasksListForUserRef = (0, import_server3.makeFunctionReference)("conversationTasks:listForUser");
|
|
196
221
|
var SKIP2 = "skip";
|
|
197
222
|
function toResult2(value, skipped) {
|
|
198
223
|
if (skipped) {
|
|
@@ -209,14 +234,14 @@ function useConversations(filters) {
|
|
|
209
234
|
const trimmedSearch = (_b = (_a = filters.search) == null ? void 0 : _a.trim()) != null ? _b : "";
|
|
210
235
|
const isSearchMode = trimmedSearch.length > 0;
|
|
211
236
|
const skipped = !filters.userId;
|
|
212
|
-
const listResult = (0,
|
|
237
|
+
const listResult = (0, import_react3.useQuery)(
|
|
213
238
|
conversationsListForUserRef,
|
|
214
239
|
skipped || isSearchMode ? SKIP2 : {
|
|
215
240
|
userId: filters.userId,
|
|
216
241
|
limit: filters.limit
|
|
217
242
|
}
|
|
218
243
|
);
|
|
219
|
-
const searchResult = (0,
|
|
244
|
+
const searchResult = (0, import_react3.useQuery)(
|
|
220
245
|
conversationsSearchForUserRef,
|
|
221
246
|
skipped || !isSearchMode ? SKIP2 : {
|
|
222
247
|
userId: filters.userId,
|
|
@@ -228,7 +253,7 @@ function useConversations(filters) {
|
|
|
228
253
|
}
|
|
229
254
|
function useConversationByPhonePair(phonePair) {
|
|
230
255
|
const skipped = !phonePair;
|
|
231
|
-
const result = (0,
|
|
256
|
+
const result = (0, import_react3.useQuery)(
|
|
232
257
|
conversationsGetByPhonePairRef,
|
|
233
258
|
skipped ? SKIP2 : { phonePair }
|
|
234
259
|
);
|
|
@@ -236,7 +261,7 @@ function useConversationByPhonePair(phonePair) {
|
|
|
236
261
|
}
|
|
237
262
|
function useMessages(conversationId, options) {
|
|
238
263
|
const skipped = !conversationId;
|
|
239
|
-
const result = (0,
|
|
264
|
+
const result = (0, import_react3.useQuery)(
|
|
240
265
|
conversationMessagesGetByConversationIdRef,
|
|
241
266
|
skipped ? SKIP2 : {
|
|
242
267
|
conversationId,
|
|
@@ -247,15 +272,36 @@ function useMessages(conversationId, options) {
|
|
|
247
272
|
}
|
|
248
273
|
function useUnreadCount(userId) {
|
|
249
274
|
const skipped = !userId;
|
|
250
|
-
const result = (0,
|
|
275
|
+
const result = (0, import_react3.useQuery)(
|
|
251
276
|
conversationsGetUnreadTotalForUserRef,
|
|
252
277
|
skipped ? SKIP2 : { userId }
|
|
253
278
|
);
|
|
254
279
|
return toResult2(result, skipped);
|
|
255
280
|
}
|
|
281
|
+
function useUnreadAggregate(userId, options) {
|
|
282
|
+
const skipped = !userId;
|
|
283
|
+
const phones = options == null ? void 0 : options.providerPhones;
|
|
284
|
+
const stablePhones = useMemoizedPhones(phones);
|
|
285
|
+
const result = (0, import_react3.useQuery)(
|
|
286
|
+
conversationsGetUnreadAggregateForUserRef,
|
|
287
|
+
skipped ? SKIP2 : {
|
|
288
|
+
userId,
|
|
289
|
+
providerPhones: stablePhones
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
return toResult2(result, skipped);
|
|
293
|
+
}
|
|
294
|
+
function useMemoizedPhones(phones) {
|
|
295
|
+
const key = phones ? [...phones].sort().join("|") : "";
|
|
296
|
+
return (0, import_react4.useMemo)(
|
|
297
|
+
() => phones && phones.length ? [...phones].sort() : void 0,
|
|
298
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
299
|
+
[key]
|
|
300
|
+
);
|
|
301
|
+
}
|
|
256
302
|
function useConversationNotes(conversationId) {
|
|
257
303
|
const skipped = !conversationId;
|
|
258
|
-
const result = (0,
|
|
304
|
+
const result = (0, import_react3.useQuery)(
|
|
259
305
|
conversationNotesListForConversationRef,
|
|
260
306
|
skipped ? SKIP2 : { conversationId }
|
|
261
307
|
);
|
|
@@ -263,7 +309,7 @@ function useConversationNotes(conversationId) {
|
|
|
263
309
|
}
|
|
264
310
|
function useConversationTasks(conversationId) {
|
|
265
311
|
const skipped = !conversationId;
|
|
266
|
-
const result = (0,
|
|
312
|
+
const result = (0, import_react3.useQuery)(
|
|
267
313
|
conversationTasksListForConversationRef,
|
|
268
314
|
skipped ? SKIP2 : { conversationId }
|
|
269
315
|
);
|
|
@@ -271,7 +317,7 @@ function useConversationTasks(conversationId) {
|
|
|
271
317
|
}
|
|
272
318
|
function useConversationNotesByPhonePair(phonePair) {
|
|
273
319
|
const skipped = !phonePair;
|
|
274
|
-
const result = (0,
|
|
320
|
+
const result = (0, import_react3.useQuery)(
|
|
275
321
|
conversationNotesListByPhonePairRef,
|
|
276
322
|
skipped ? SKIP2 : { phonePair }
|
|
277
323
|
);
|
|
@@ -279,7 +325,7 @@ function useConversationNotesByPhonePair(phonePair) {
|
|
|
279
325
|
}
|
|
280
326
|
function useConversationTasksForUser(userId, options) {
|
|
281
327
|
const skipped = !userId;
|
|
282
|
-
const result = (0,
|
|
328
|
+
const result = (0, import_react3.useQuery)(
|
|
283
329
|
conversationTasksListForUserRef,
|
|
284
330
|
skipped ? SKIP2 : { userId, limit: options == null ? void 0 : options.limit }
|
|
285
331
|
);
|
|
@@ -287,7 +333,7 @@ function useConversationTasksForUser(userId, options) {
|
|
|
287
333
|
}
|
|
288
334
|
function useConversationTasksByPhonePair(phonePair) {
|
|
289
335
|
const skipped = !phonePair;
|
|
290
|
-
const result = (0,
|
|
336
|
+
const result = (0, import_react3.useQuery)(
|
|
291
337
|
conversationTasksListByPhonePairRef,
|
|
292
338
|
skipped ? SKIP2 : { phonePair }
|
|
293
339
|
);
|
|
@@ -295,82 +341,82 @@ function useConversationTasksByPhonePair(phonePair) {
|
|
|
295
341
|
}
|
|
296
342
|
|
|
297
343
|
// src/react/hooks.ts
|
|
298
|
-
var
|
|
299
|
-
var
|
|
300
|
-
var
|
|
301
|
-
var patientsListRef = (0,
|
|
302
|
-
var patientsGetRef = (0,
|
|
303
|
-
var patientsByElationIdRef = (0,
|
|
304
|
-
var patientsByHintIdRef = (0,
|
|
305
|
-
var appointmentsListRef = (0,
|
|
306
|
-
var appointmentsGetRef = (0,
|
|
307
|
-
var appointmentsByElationIdRef = (0,
|
|
344
|
+
var import_react5 = require("convex/react");
|
|
345
|
+
var import_react6 = require("react");
|
|
346
|
+
var import_server4 = require("convex/server");
|
|
347
|
+
var patientsListRef = (0, import_server4.makeFunctionReference)("patients:list");
|
|
348
|
+
var patientsGetRef = (0, import_server4.makeFunctionReference)("patients:get");
|
|
349
|
+
var patientsByElationIdRef = (0, import_server4.makeFunctionReference)("patients:getByElationId");
|
|
350
|
+
var patientsByHintIdRef = (0, import_server4.makeFunctionReference)("patients:getByHintId");
|
|
351
|
+
var appointmentsListRef = (0, import_server4.makeFunctionReference)("appointments:list");
|
|
352
|
+
var appointmentsGetRef = (0, import_server4.makeFunctionReference)("appointments:get");
|
|
353
|
+
var appointmentsByElationIdRef = (0, import_server4.makeFunctionReference)("appointments:getByElationId");
|
|
308
354
|
function usePatients(options) {
|
|
309
|
-
return (0,
|
|
355
|
+
return (0, import_react5.useQuery)(patientsListRef, options != null ? options : {});
|
|
310
356
|
}
|
|
311
357
|
function usePatient(id) {
|
|
312
|
-
return (0,
|
|
358
|
+
return (0, import_react5.useQuery)(patientsGetRef, { id });
|
|
313
359
|
}
|
|
314
360
|
function usePatientByElationId(elationId) {
|
|
315
|
-
return (0,
|
|
361
|
+
return (0, import_react5.useQuery)(patientsByElationIdRef, {
|
|
316
362
|
elationId
|
|
317
363
|
});
|
|
318
364
|
}
|
|
319
365
|
function usePatientByHintId(hintId) {
|
|
320
|
-
return (0,
|
|
366
|
+
return (0, import_react5.useQuery)(patientsByHintIdRef, {
|
|
321
367
|
hintId
|
|
322
368
|
});
|
|
323
369
|
}
|
|
324
370
|
function useAppointments(options) {
|
|
325
|
-
return (0,
|
|
371
|
+
return (0, import_react5.useQuery)(
|
|
326
372
|
appointmentsListRef,
|
|
327
373
|
options != null ? options : {}
|
|
328
374
|
);
|
|
329
375
|
}
|
|
330
376
|
function useAppointment(id) {
|
|
331
|
-
return (0,
|
|
377
|
+
return (0, import_react5.useQuery)(appointmentsGetRef, { id });
|
|
332
378
|
}
|
|
333
379
|
function useAppointmentByElationId(elationId) {
|
|
334
|
-
return (0,
|
|
380
|
+
return (0, import_react5.useQuery)(appointmentsByElationIdRef, {
|
|
335
381
|
elationId
|
|
336
382
|
});
|
|
337
383
|
}
|
|
338
|
-
var physiciansGetByElationIdsRef = (0,
|
|
339
|
-
var physiciansGetByElationIdRef = (0,
|
|
384
|
+
var physiciansGetByElationIdsRef = (0, import_server4.makeFunctionReference)("physicians:getByElationIds");
|
|
385
|
+
var physiciansGetByElationIdRef = (0, import_server4.makeFunctionReference)("physicians:getByElationId");
|
|
340
386
|
function usePhysiciansByElationIds(ids) {
|
|
341
|
-
return (0,
|
|
387
|
+
return (0, import_react5.useQuery)(
|
|
342
388
|
physiciansGetByElationIdsRef,
|
|
343
389
|
ids && ids.length > 0 ? { ids } : "skip"
|
|
344
390
|
);
|
|
345
391
|
}
|
|
346
392
|
function usePhysicianByElationId(id) {
|
|
347
|
-
return (0,
|
|
393
|
+
return (0, import_react5.useQuery)(
|
|
348
394
|
physiciansGetByElationIdRef,
|
|
349
395
|
id !== void 0 ? { id } : "skip"
|
|
350
396
|
);
|
|
351
397
|
}
|
|
352
|
-
var medicationsByPatientRef = (0,
|
|
353
|
-
var problemsByPatientRef = (0,
|
|
354
|
-
var allergiesByPatientRef = (0,
|
|
355
|
-
var appointmentsByPatientRef = (0,
|
|
398
|
+
var medicationsByPatientRef = (0, import_server4.makeFunctionReference)("medicalRecords:getMedicationsByElationPatient");
|
|
399
|
+
var problemsByPatientRef = (0, import_server4.makeFunctionReference)("medicalRecords:getProblemsByElationPatient");
|
|
400
|
+
var allergiesByPatientRef = (0, import_server4.makeFunctionReference)("medicalRecords:getAllergiesByElationPatient");
|
|
401
|
+
var appointmentsByPatientRef = (0, import_server4.makeFunctionReference)("medicalRecords:getAppointmentsByElationPatient");
|
|
356
402
|
function usePatientMedical(elationId, options) {
|
|
357
|
-
const medications = (0,
|
|
403
|
+
const medications = (0, import_react5.useQuery)(
|
|
358
404
|
medicationsByPatientRef,
|
|
359
405
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
360
406
|
);
|
|
361
|
-
const problems = (0,
|
|
407
|
+
const problems = (0, import_react5.useQuery)(
|
|
362
408
|
problemsByPatientRef,
|
|
363
409
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
364
410
|
);
|
|
365
|
-
const allergies = (0,
|
|
411
|
+
const allergies = (0, import_react5.useQuery)(
|
|
366
412
|
allergiesByPatientRef,
|
|
367
413
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
368
414
|
);
|
|
369
|
-
const appointments = (0,
|
|
415
|
+
const appointments = (0, import_react5.useQuery)(
|
|
370
416
|
appointmentsByPatientRef,
|
|
371
417
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
372
418
|
);
|
|
373
|
-
(0,
|
|
419
|
+
(0, import_react6.useEffect)(() => {
|
|
374
420
|
if (elationId === void 0 || (options == null ? void 0 : options.skipRefresh)) {
|
|
375
421
|
return;
|
|
376
422
|
}
|
|
@@ -394,21 +440,21 @@ function usePatientMedical(elationId, options) {
|
|
|
394
440
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
395
441
|
return { medications, problems, allergies, appointments };
|
|
396
442
|
}
|
|
397
|
-
var elationPatientByIdRef = (0,
|
|
398
|
-
var hintPatientByIdRef = (0,
|
|
399
|
-
var pharmacyByNcpdpRef = (0,
|
|
400
|
-
var patientPhotoByIdRef = (0,
|
|
443
|
+
var elationPatientByIdRef = (0, import_server4.makeFunctionReference)("elationPatients:getByElationId");
|
|
444
|
+
var hintPatientByIdRef = (0, import_server4.makeFunctionReference)("hintPatients:getByHintId");
|
|
445
|
+
var pharmacyByNcpdpRef = (0, import_server4.makeFunctionReference)("elationPharmacies:getByNcpdpId");
|
|
446
|
+
var patientPhotoByIdRef = (0, import_server4.makeFunctionReference)("elationPatientPhotos:getByElationPatientId");
|
|
401
447
|
function usePatientBasic(input, options) {
|
|
402
448
|
var _a, _b;
|
|
403
|
-
const elationRow = (0,
|
|
449
|
+
const elationRow = (0, import_react5.useQuery)(
|
|
404
450
|
elationPatientByIdRef,
|
|
405
451
|
input.elationId !== void 0 ? { elationId: input.elationId } : "skip"
|
|
406
452
|
);
|
|
407
|
-
const hintRow = (0,
|
|
453
|
+
const hintRow = (0, import_react5.useQuery)(
|
|
408
454
|
hintPatientByIdRef,
|
|
409
455
|
input.hintId !== void 0 ? { hintId: input.hintId } : "skip"
|
|
410
456
|
);
|
|
411
|
-
(0,
|
|
457
|
+
(0, import_react6.useEffect)(() => {
|
|
412
458
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
413
459
|
return;
|
|
414
460
|
}
|
|
@@ -455,17 +501,17 @@ function usePatientBasic(input, options) {
|
|
|
455
501
|
};
|
|
456
502
|
}
|
|
457
503
|
function usePharmacyByNcpdpId(ncpdpId) {
|
|
458
|
-
return (0,
|
|
504
|
+
return (0, import_react5.useQuery)(
|
|
459
505
|
pharmacyByNcpdpRef,
|
|
460
506
|
ncpdpId ? { ncpdpId } : "skip"
|
|
461
507
|
);
|
|
462
508
|
}
|
|
463
509
|
function usePatientPhoto(elationId, options) {
|
|
464
|
-
const photo = (0,
|
|
510
|
+
const photo = (0, import_react5.useQuery)(
|
|
465
511
|
patientPhotoByIdRef,
|
|
466
512
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
467
513
|
);
|
|
468
|
-
(0,
|
|
514
|
+
(0, import_react6.useEffect)(() => {
|
|
469
515
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
470
516
|
return;
|
|
471
517
|
}
|
|
@@ -492,11 +538,11 @@ function usePatientPhoto(elationId, options) {
|
|
|
492
538
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
493
539
|
return photo;
|
|
494
540
|
}
|
|
495
|
-
var messagesByPhonesRef = (0,
|
|
496
|
-
var messagesByConversationIdRef = (0,
|
|
541
|
+
var messagesByPhonesRef = (0, import_server4.makeFunctionReference)("conversationMessages:getByPhones");
|
|
542
|
+
var messagesByConversationIdRef = (0, import_server4.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
497
543
|
function useConversationMessages(input, options) {
|
|
498
544
|
const hasPair = !!input.phoneA && !!input.phoneB;
|
|
499
|
-
const byPair = (0,
|
|
545
|
+
const byPair = (0, import_react5.useQuery)(
|
|
500
546
|
messagesByPhonesRef,
|
|
501
547
|
hasPair ? {
|
|
502
548
|
phoneA: input.phoneA,
|
|
@@ -504,7 +550,7 @@ function useConversationMessages(input, options) {
|
|
|
504
550
|
limit: options == null ? void 0 : options.limit
|
|
505
551
|
} : "skip"
|
|
506
552
|
);
|
|
507
|
-
const byConvo = (0,
|
|
553
|
+
const byConvo = (0, import_react5.useQuery)(
|
|
508
554
|
messagesByConversationIdRef,
|
|
509
555
|
!hasPair && input.conversationId ? { conversationId: input.conversationId, limit: options == null ? void 0 : options.limit } : "skip"
|
|
510
556
|
);
|
|
@@ -512,7 +558,7 @@ function useConversationMessages(input, options) {
|
|
|
512
558
|
}
|
|
513
559
|
|
|
514
560
|
// src/react/notifications.ts
|
|
515
|
-
var
|
|
561
|
+
var import_react7 = require("react");
|
|
516
562
|
|
|
517
563
|
// src/web-push.ts
|
|
518
564
|
function isWebPushSupported() {
|
|
@@ -571,12 +617,12 @@ function loadExpo() {
|
|
|
571
617
|
}
|
|
572
618
|
function useNotifications(options) {
|
|
573
619
|
var _a;
|
|
574
|
-
const [permissionStatus, setPermissionStatus] = (0,
|
|
575
|
-
const [devicePushToken, setDevicePushToken] = (0,
|
|
576
|
-
const expoRef = (0,
|
|
577
|
-
const isWebRef = (0,
|
|
578
|
-
const vapidKeyRef = (0,
|
|
579
|
-
(0,
|
|
620
|
+
const [permissionStatus, setPermissionStatus] = (0, import_react7.useState)("unknown");
|
|
621
|
+
const [devicePushToken, setDevicePushToken] = (0, import_react7.useState)(null);
|
|
622
|
+
const expoRef = (0, import_react7.useRef)(null);
|
|
623
|
+
const isWebRef = (0, import_react7.useRef)(false);
|
|
624
|
+
const vapidKeyRef = (0, import_react7.useRef)((_a = options.vapidPublicKey) != null ? _a : null);
|
|
625
|
+
(0, import_react7.useEffect)(() => {
|
|
580
626
|
let mounted = true;
|
|
581
627
|
void (() => __async(null, null, function* () {
|
|
582
628
|
var _a2;
|
|
@@ -632,7 +678,7 @@ function useNotifications(options) {
|
|
|
632
678
|
mounted = false;
|
|
633
679
|
};
|
|
634
680
|
}, [options.apiBaseUrl, options.apiKey]);
|
|
635
|
-
const register = (0,
|
|
681
|
+
const register = (0, import_react7.useCallback)(() => __async(null, null, function* () {
|
|
636
682
|
var _a2, _b;
|
|
637
683
|
if (!options.userId) {
|
|
638
684
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -742,7 +788,7 @@ function useNotifications(options) {
|
|
|
742
788
|
options.appVersion,
|
|
743
789
|
options.serviceWorkerPath
|
|
744
790
|
]);
|
|
745
|
-
const unregister = (0,
|
|
791
|
+
const unregister = (0, import_react7.useCallback)(() => __async(null, null, function* () {
|
|
746
792
|
if (!devicePushToken) {
|
|
747
793
|
return;
|
|
748
794
|
}
|
|
@@ -757,7 +803,7 @@ function useNotifications(options) {
|
|
|
757
803
|
});
|
|
758
804
|
setDevicePushToken(null);
|
|
759
805
|
}), [options.apiBaseUrl, options.apiKey, devicePushToken]);
|
|
760
|
-
const addReceivedListener = (0,
|
|
806
|
+
const addReceivedListener = (0, import_react7.useCallback)(
|
|
761
807
|
(listener) => {
|
|
762
808
|
if (isWebRef.current) {
|
|
763
809
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -786,7 +832,7 @@ function useNotifications(options) {
|
|
|
786
832
|
},
|
|
787
833
|
[]
|
|
788
834
|
);
|
|
789
|
-
const addResponseListener = (0,
|
|
835
|
+
const addResponseListener = (0, import_react7.useCallback)(
|
|
790
836
|
(listener) => {
|
|
791
837
|
if (isWebRef.current) {
|
|
792
838
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -815,7 +861,7 @@ function useNotifications(options) {
|
|
|
815
861
|
},
|
|
816
862
|
[]
|
|
817
863
|
);
|
|
818
|
-
const getBadgeCount = (0,
|
|
864
|
+
const getBadgeCount = (0, import_react7.useCallback)(() => __async(null, null, function* () {
|
|
819
865
|
var _a2;
|
|
820
866
|
const expo = expoRef.current;
|
|
821
867
|
if (!(expo == null ? void 0 : expo.getBadgeCountAsync)) {
|
|
@@ -823,7 +869,7 @@ function useNotifications(options) {
|
|
|
823
869
|
}
|
|
824
870
|
return (_a2 = yield expo.getBadgeCountAsync()) != null ? _a2 : 0;
|
|
825
871
|
}), []);
|
|
826
|
-
const setBadgeCount = (0,
|
|
872
|
+
const setBadgeCount = (0, import_react7.useCallback)((count) => __async(null, null, function* () {
|
|
827
873
|
const expo = expoRef.current;
|
|
828
874
|
if (!(expo == null ? void 0 : expo.setBadgeCountAsync)) {
|
|
829
875
|
return;
|
|
@@ -831,7 +877,7 @@ function useNotifications(options) {
|
|
|
831
877
|
yield expo.setBadgeCountAsync(count);
|
|
832
878
|
}), []);
|
|
833
879
|
const autoRegister = options.autoRegister !== false;
|
|
834
|
-
(0,
|
|
880
|
+
(0, import_react7.useEffect)(() => {
|
|
835
881
|
if (!autoRegister) {
|
|
836
882
|
return;
|
|
837
883
|
}
|
|
@@ -889,16 +935,16 @@ function detectPlatform(tokenType) {
|
|
|
889
935
|
}
|
|
890
936
|
|
|
891
937
|
// src/react/patient-family.ts
|
|
892
|
-
var
|
|
893
|
-
var
|
|
894
|
-
var patientsFamilyMembersRef = (0,
|
|
938
|
+
var import_react8 = require("convex/react");
|
|
939
|
+
var import_server5 = require("convex/server");
|
|
940
|
+
var patientsFamilyMembersRef = (0, import_server5.makeFunctionReference)("patients:listFamilyMembers");
|
|
895
941
|
var SKIP3 = "skip";
|
|
896
942
|
function usePatientFamilyMembers(input) {
|
|
897
943
|
const hasFamilyId = !!(input == null ? void 0 : input.familyId);
|
|
898
944
|
const hasPhoneNumbers = !!((input == null ? void 0 : input.phoneNumbers) && input.phoneNumbers.length > 0);
|
|
899
945
|
const shouldQuery = hasFamilyId || hasPhoneNumbers;
|
|
900
946
|
const args = shouldQuery ? __spreadValues(__spreadValues(__spreadValues({}, (input == null ? void 0 : input.familyId) ? { familyId: input.familyId } : {}), (input == null ? void 0 : input.phoneNumbers) && input.phoneNumbers.length > 0 ? { phoneNumbers: input.phoneNumbers } : {}), (input == null ? void 0 : input.excludeHintId) ? { excludeHintId: input.excludeHintId } : {}) : SKIP3;
|
|
901
|
-
const result = (0,
|
|
947
|
+
const result = (0, import_react8.useQuery)(
|
|
902
948
|
patientsFamilyMembersRef,
|
|
903
949
|
args
|
|
904
950
|
);
|
|
@@ -913,15 +959,15 @@ function usePatientFamilyMembers(input) {
|
|
|
913
959
|
}
|
|
914
960
|
|
|
915
961
|
// src/react/patient-search.ts
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
var patientsSearchRef = (0,
|
|
962
|
+
var import_react9 = require("convex/react");
|
|
963
|
+
var import_server6 = require("convex/server");
|
|
964
|
+
var patientsSearchRef = (0, import_server6.makeFunctionReference)("patients:search");
|
|
919
965
|
var SKIP4 = "skip";
|
|
920
966
|
function usePatientSearch(options) {
|
|
921
967
|
var _a;
|
|
922
968
|
const trimmedQuery = ((_a = options.query) != null ? _a : "").trim();
|
|
923
969
|
const skipped = trimmedQuery.length === 0;
|
|
924
|
-
const result = (0,
|
|
970
|
+
const result = (0, import_react9.useQuery)(
|
|
925
971
|
patientsSearchRef,
|
|
926
972
|
skipped ? SKIP4 : __spreadValues(__spreadValues(__spreadValues({
|
|
927
973
|
query: trimmedQuery
|
|
@@ -938,23 +984,23 @@ function usePatientSearch(options) {
|
|
|
938
984
|
}
|
|
939
985
|
|
|
940
986
|
// src/react/patients-bulk.ts
|
|
941
|
-
var
|
|
942
|
-
var
|
|
943
|
-
var
|
|
944
|
-
var patientsGetByIdsRef = (0,
|
|
945
|
-
var patientsGetByPhonesRef = (0,
|
|
987
|
+
var import_react10 = require("convex/react");
|
|
988
|
+
var import_server7 = require("convex/server");
|
|
989
|
+
var import_react11 = require("react");
|
|
990
|
+
var patientsGetByIdsRef = (0, import_server7.makeFunctionReference)("patients:getByIds");
|
|
991
|
+
var patientsGetByPhonesRef = (0, import_server7.makeFunctionReference)("patients:getByPhones");
|
|
946
992
|
var SKIP5 = "skip";
|
|
947
993
|
function usePatientsByIds(ids) {
|
|
948
|
-
const stableIds = (0,
|
|
994
|
+
const stableIds = (0, import_react11.useMemo)(() => {
|
|
949
995
|
const arr = ids != null ? ids : [];
|
|
950
996
|
return [...new Set(arr)].sort();
|
|
951
997
|
}, [ids]);
|
|
952
998
|
const skipped = stableIds.length === 0;
|
|
953
|
-
const result = (0,
|
|
999
|
+
const result = (0, import_react10.useQuery)(
|
|
954
1000
|
patientsGetByIdsRef,
|
|
955
1001
|
skipped ? SKIP5 : { ids: stableIds }
|
|
956
1002
|
);
|
|
957
|
-
const mapped = (0,
|
|
1003
|
+
const mapped = (0, import_react11.useMemo)(() => {
|
|
958
1004
|
if (result === void 0) return void 0;
|
|
959
1005
|
return Object.fromEntries(
|
|
960
1006
|
result.map((p) => {
|
|
@@ -974,17 +1020,17 @@ function usePatientsByIds(ids) {
|
|
|
974
1020
|
};
|
|
975
1021
|
}
|
|
976
1022
|
function usePatientsByPhones(phones) {
|
|
977
|
-
const stableDigits = (0,
|
|
1023
|
+
const stableDigits = (0, import_react11.useMemo)(() => {
|
|
978
1024
|
const arr = phones != null ? phones : [];
|
|
979
1025
|
const digits = arr.map((p) => p.replace(/\D+/g, "")).filter((s) => s.length > 0);
|
|
980
1026
|
return [...new Set(digits)].sort();
|
|
981
1027
|
}, [phones]);
|
|
982
1028
|
const skipped = stableDigits.length === 0;
|
|
983
|
-
const result = (0,
|
|
1029
|
+
const result = (0, import_react10.useQuery)(
|
|
984
1030
|
patientsGetByPhonesRef,
|
|
985
1031
|
skipped ? SKIP5 : { phoneDigits: stableDigits }
|
|
986
1032
|
);
|
|
987
|
-
const mapped = (0,
|
|
1033
|
+
const mapped = (0, import_react11.useMemo)(() => {
|
|
988
1034
|
if (result === void 0) return void 0;
|
|
989
1035
|
return Object.fromEntries(result.map((r) => [r.phoneDigits, r.patient]));
|
|
990
1036
|
}, [result]);
|
|
@@ -999,8 +1045,8 @@ function usePatientsByPhones(phones) {
|
|
|
999
1045
|
}
|
|
1000
1046
|
|
|
1001
1047
|
// src/react/provider.ts
|
|
1002
|
-
var
|
|
1003
|
-
var
|
|
1048
|
+
var import_react12 = require("convex/react");
|
|
1049
|
+
var import_react13 = require("react");
|
|
1004
1050
|
var CONVEX_URLS = {
|
|
1005
1051
|
local: "https://courteous-duck-623.convex.cloud",
|
|
1006
1052
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -1023,19 +1069,19 @@ function TruthProvider({
|
|
|
1023
1069
|
children
|
|
1024
1070
|
}) {
|
|
1025
1071
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
1026
|
-
const client = (0,
|
|
1027
|
-
return (0,
|
|
1072
|
+
const client = (0, import_react13.useMemo)(() => new import_react12.ConvexReactClient(url), [url]);
|
|
1073
|
+
return (0, import_react13.createElement)(import_react12.ConvexProvider, { client }, children);
|
|
1028
1074
|
}
|
|
1029
1075
|
|
|
1030
1076
|
// src/react/reminders.ts
|
|
1031
|
-
var
|
|
1032
|
-
var
|
|
1033
|
-
var remindersListPendingByConversationIdsRef = (0,
|
|
1077
|
+
var import_react14 = require("convex/react");
|
|
1078
|
+
var import_server8 = require("convex/server");
|
|
1079
|
+
var remindersListPendingByConversationIdsRef = (0, import_server8.makeFunctionReference)("reminders:listPendingByConversationIds");
|
|
1034
1080
|
var SKIP6 = "skip";
|
|
1035
1081
|
function useRemindersForConversations(conversationIds) {
|
|
1036
1082
|
const ids = conversationIds != null ? conversationIds : [];
|
|
1037
1083
|
const skipped = ids.length === 0;
|
|
1038
|
-
const result = (0,
|
|
1084
|
+
const result = (0, import_react14.useQuery)(
|
|
1039
1085
|
remindersListPendingByConversationIdsRef,
|
|
1040
1086
|
skipped ? SKIP6 : { conversationIds: ids }
|
|
1041
1087
|
);
|
|
@@ -1050,8 +1096,23 @@ function useRemindersForConversations(conversationIds) {
|
|
|
1050
1096
|
};
|
|
1051
1097
|
}
|
|
1052
1098
|
|
|
1099
|
+
// src/react/tasks.ts
|
|
1100
|
+
var import_react15 = require("convex/react");
|
|
1101
|
+
var import_server9 = require("convex/server");
|
|
1102
|
+
var import_react16 = require("react");
|
|
1103
|
+
var conversationTasksMarkSeenRef = (0, import_server9.makeFunctionReference)("conversationTasks:markSeen");
|
|
1104
|
+
function useConversationTaskMarkSeen() {
|
|
1105
|
+
const mutate = (0, import_react15.useMutation)(
|
|
1106
|
+
conversationTasksMarkSeenRef
|
|
1107
|
+
);
|
|
1108
|
+
return (0, import_react16.useCallback)(
|
|
1109
|
+
(taskId, userId) => mutate({ taskId, userId }),
|
|
1110
|
+
[mutate]
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1053
1114
|
// src/react/tracking.ts
|
|
1054
|
-
var
|
|
1115
|
+
var import_react17 = require("react");
|
|
1055
1116
|
|
|
1056
1117
|
// src/tracking/tracker.ts
|
|
1057
1118
|
function generateUuidV7() {
|
|
@@ -1246,7 +1307,7 @@ function sleep(ms) {
|
|
|
1246
1307
|
}
|
|
1247
1308
|
|
|
1248
1309
|
// src/react/tracking.ts
|
|
1249
|
-
var TruthTrackingContext = (0,
|
|
1310
|
+
var TruthTrackingContext = (0, import_react17.createContext)(
|
|
1250
1311
|
null
|
|
1251
1312
|
);
|
|
1252
1313
|
function TruthTrackingProvider({
|
|
@@ -1257,7 +1318,7 @@ function TruthTrackingProvider({
|
|
|
1257
1318
|
apiKey = "",
|
|
1258
1319
|
children
|
|
1259
1320
|
}) {
|
|
1260
|
-
const value = (0,
|
|
1321
|
+
const value = (0, import_react17.useMemo)(() => {
|
|
1261
1322
|
const tracker = new Tracker({
|
|
1262
1323
|
apiKey,
|
|
1263
1324
|
environment,
|
|
@@ -1276,10 +1337,10 @@ function TruthTrackingProvider({
|
|
|
1276
1337
|
}
|
|
1277
1338
|
};
|
|
1278
1339
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1279
|
-
return (0,
|
|
1340
|
+
return (0, import_react17.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1280
1341
|
}
|
|
1281
1342
|
function useTruth() {
|
|
1282
|
-
const ctx = (0,
|
|
1343
|
+
const ctx = (0, import_react17.useContext)(TruthTrackingContext);
|
|
1283
1344
|
if (!ctx) {
|
|
1284
1345
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1285
1346
|
}
|
|
@@ -1287,13 +1348,13 @@ function useTruth() {
|
|
|
1287
1348
|
}
|
|
1288
1349
|
|
|
1289
1350
|
// src/react/user-settings.ts
|
|
1290
|
-
var
|
|
1291
|
-
var
|
|
1292
|
-
var userSettingsGetByUserIdRef = (0,
|
|
1351
|
+
var import_react18 = require("convex/react");
|
|
1352
|
+
var import_server10 = require("convex/server");
|
|
1353
|
+
var userSettingsGetByUserIdRef = (0, import_server10.makeFunctionReference)("userSettings:getByUserId");
|
|
1293
1354
|
var SKIP7 = "skip";
|
|
1294
1355
|
function useUserSettings(userId) {
|
|
1295
1356
|
const skip = !userId;
|
|
1296
|
-
const result = (0,
|
|
1357
|
+
const result = (0, import_react18.useQuery)(
|
|
1297
1358
|
userSettingsGetByUserIdRef,
|
|
1298
1359
|
skip ? SKIP7 : { userId }
|
|
1299
1360
|
);
|
|
@@ -1308,13 +1369,13 @@ function useUserSettings(userId) {
|
|
|
1308
1369
|
}
|
|
1309
1370
|
|
|
1310
1371
|
// src/react/voicemail.ts
|
|
1311
|
-
var
|
|
1372
|
+
var import_react19 = require("react");
|
|
1312
1373
|
function useVoicemailUrl(client) {
|
|
1313
|
-
const [url, setUrl] = (0,
|
|
1314
|
-
const [isLoading, setIsLoading] = (0,
|
|
1315
|
-
const [error, setError] = (0,
|
|
1316
|
-
const inFlightRef = (0,
|
|
1317
|
-
const fetchUrl = (0,
|
|
1374
|
+
const [url, setUrl] = (0, import_react19.useState)(null);
|
|
1375
|
+
const [isLoading, setIsLoading] = (0, import_react19.useState)(false);
|
|
1376
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
1377
|
+
const inFlightRef = (0, import_react19.useRef)(false);
|
|
1378
|
+
const fetchUrl = (0, import_react19.useCallback)(
|
|
1318
1379
|
(voicemailLink) => __async(null, null, function* () {
|
|
1319
1380
|
if (inFlightRef.current) return null;
|
|
1320
1381
|
inFlightRef.current = true;
|
|
@@ -1350,10 +1411,12 @@ function useVoicemailUrl(client) {
|
|
|
1350
1411
|
useAppointment,
|
|
1351
1412
|
useAppointmentByElationId,
|
|
1352
1413
|
useAppointments,
|
|
1414
|
+
useConversationById,
|
|
1353
1415
|
useConversationByPhonePair,
|
|
1354
1416
|
useConversationMessages,
|
|
1355
1417
|
useConversationNotes,
|
|
1356
1418
|
useConversationNotesByPhonePair,
|
|
1419
|
+
useConversationTaskMarkSeen,
|
|
1357
1420
|
useConversationTasks,
|
|
1358
1421
|
useConversationTasksByPhonePair,
|
|
1359
1422
|
useConversationTasksForUser,
|
|
@@ -1379,6 +1442,7 @@ function useVoicemailUrl(client) {
|
|
|
1379
1442
|
usePhysiciansByElationIds,
|
|
1380
1443
|
useRemindersForConversations,
|
|
1381
1444
|
useTruth,
|
|
1445
|
+
useUnreadAggregate,
|
|
1382
1446
|
useUnreadCount,
|
|
1383
1447
|
useUserSettings,
|
|
1384
1448
|
useVoicemailUrl
|