@hipnation-truth/sdk 0.16.3 → 0.17.1
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 +111 -1
- package/dist/react.js +164 -125
- 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,
|
|
@@ -181,21 +183,41 @@ function useDialpadCallLog(callId, options) {
|
|
|
181
183
|
return toResult(result, skipped);
|
|
182
184
|
}
|
|
183
185
|
|
|
184
|
-
// src/react/
|
|
186
|
+
// src/react/conversation-by-id.ts
|
|
185
187
|
var import_react2 = require("convex/react");
|
|
186
188
|
var import_server2 = require("convex/server");
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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");
|
|
199
221
|
var SKIP2 = "skip";
|
|
200
222
|
function toResult2(value, skipped) {
|
|
201
223
|
if (skipped) {
|
|
@@ -212,14 +234,14 @@ function useConversations(filters) {
|
|
|
212
234
|
const trimmedSearch = (_b = (_a = filters.search) == null ? void 0 : _a.trim()) != null ? _b : "";
|
|
213
235
|
const isSearchMode = trimmedSearch.length > 0;
|
|
214
236
|
const skipped = !filters.userId;
|
|
215
|
-
const listResult = (0,
|
|
237
|
+
const listResult = (0, import_react3.useQuery)(
|
|
216
238
|
conversationsListForUserRef,
|
|
217
239
|
skipped || isSearchMode ? SKIP2 : {
|
|
218
240
|
userId: filters.userId,
|
|
219
241
|
limit: filters.limit
|
|
220
242
|
}
|
|
221
243
|
);
|
|
222
|
-
const searchResult = (0,
|
|
244
|
+
const searchResult = (0, import_react3.useQuery)(
|
|
223
245
|
conversationsSearchForUserRef,
|
|
224
246
|
skipped || !isSearchMode ? SKIP2 : {
|
|
225
247
|
userId: filters.userId,
|
|
@@ -231,7 +253,7 @@ function useConversations(filters) {
|
|
|
231
253
|
}
|
|
232
254
|
function useConversationByPhonePair(phonePair) {
|
|
233
255
|
const skipped = !phonePair;
|
|
234
|
-
const result = (0,
|
|
256
|
+
const result = (0, import_react3.useQuery)(
|
|
235
257
|
conversationsGetByPhonePairRef,
|
|
236
258
|
skipped ? SKIP2 : { phonePair }
|
|
237
259
|
);
|
|
@@ -239,7 +261,7 @@ function useConversationByPhonePair(phonePair) {
|
|
|
239
261
|
}
|
|
240
262
|
function useMessages(conversationId, options) {
|
|
241
263
|
const skipped = !conversationId;
|
|
242
|
-
const result = (0,
|
|
264
|
+
const result = (0, import_react3.useQuery)(
|
|
243
265
|
conversationMessagesGetByConversationIdRef,
|
|
244
266
|
skipped ? SKIP2 : {
|
|
245
267
|
conversationId,
|
|
@@ -250,7 +272,7 @@ function useMessages(conversationId, options) {
|
|
|
250
272
|
}
|
|
251
273
|
function useUnreadCount(userId) {
|
|
252
274
|
const skipped = !userId;
|
|
253
|
-
const result = (0,
|
|
275
|
+
const result = (0, import_react3.useQuery)(
|
|
254
276
|
conversationsGetUnreadTotalForUserRef,
|
|
255
277
|
skipped ? SKIP2 : { userId }
|
|
256
278
|
);
|
|
@@ -260,7 +282,7 @@ function useUnreadAggregate(userId, options) {
|
|
|
260
282
|
const skipped = !userId;
|
|
261
283
|
const phones = options == null ? void 0 : options.providerPhones;
|
|
262
284
|
const stablePhones = useMemoizedPhones(phones);
|
|
263
|
-
const result = (0,
|
|
285
|
+
const result = (0, import_react3.useQuery)(
|
|
264
286
|
conversationsGetUnreadAggregateForUserRef,
|
|
265
287
|
skipped ? SKIP2 : {
|
|
266
288
|
userId,
|
|
@@ -271,7 +293,7 @@ function useUnreadAggregate(userId, options) {
|
|
|
271
293
|
}
|
|
272
294
|
function useMemoizedPhones(phones) {
|
|
273
295
|
const key = phones ? [...phones].sort().join("|") : "";
|
|
274
|
-
return (0,
|
|
296
|
+
return (0, import_react4.useMemo)(
|
|
275
297
|
() => phones && phones.length ? [...phones].sort() : void 0,
|
|
276
298
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
277
299
|
[key]
|
|
@@ -279,7 +301,7 @@ function useMemoizedPhones(phones) {
|
|
|
279
301
|
}
|
|
280
302
|
function useConversationNotes(conversationId) {
|
|
281
303
|
const skipped = !conversationId;
|
|
282
|
-
const result = (0,
|
|
304
|
+
const result = (0, import_react3.useQuery)(
|
|
283
305
|
conversationNotesListForConversationRef,
|
|
284
306
|
skipped ? SKIP2 : { conversationId }
|
|
285
307
|
);
|
|
@@ -287,7 +309,7 @@ function useConversationNotes(conversationId) {
|
|
|
287
309
|
}
|
|
288
310
|
function useConversationTasks(conversationId) {
|
|
289
311
|
const skipped = !conversationId;
|
|
290
|
-
const result = (0,
|
|
312
|
+
const result = (0, import_react3.useQuery)(
|
|
291
313
|
conversationTasksListForConversationRef,
|
|
292
314
|
skipped ? SKIP2 : { conversationId }
|
|
293
315
|
);
|
|
@@ -295,7 +317,7 @@ function useConversationTasks(conversationId) {
|
|
|
295
317
|
}
|
|
296
318
|
function useConversationNotesByPhonePair(phonePair) {
|
|
297
319
|
const skipped = !phonePair;
|
|
298
|
-
const result = (0,
|
|
320
|
+
const result = (0, import_react3.useQuery)(
|
|
299
321
|
conversationNotesListByPhonePairRef,
|
|
300
322
|
skipped ? SKIP2 : { phonePair }
|
|
301
323
|
);
|
|
@@ -303,7 +325,7 @@ function useConversationNotesByPhonePair(phonePair) {
|
|
|
303
325
|
}
|
|
304
326
|
function useConversationTasksForUser(userId, options) {
|
|
305
327
|
const skipped = !userId;
|
|
306
|
-
const result = (0,
|
|
328
|
+
const result = (0, import_react3.useQuery)(
|
|
307
329
|
conversationTasksListForUserRef,
|
|
308
330
|
skipped ? SKIP2 : { userId, limit: options == null ? void 0 : options.limit }
|
|
309
331
|
);
|
|
@@ -311,7 +333,7 @@ function useConversationTasksForUser(userId, options) {
|
|
|
311
333
|
}
|
|
312
334
|
function useConversationTasksByPhonePair(phonePair) {
|
|
313
335
|
const skipped = !phonePair;
|
|
314
|
-
const result = (0,
|
|
336
|
+
const result = (0, import_react3.useQuery)(
|
|
315
337
|
conversationTasksListByPhonePairRef,
|
|
316
338
|
skipped ? SKIP2 : { phonePair }
|
|
317
339
|
);
|
|
@@ -319,82 +341,82 @@ function useConversationTasksByPhonePair(phonePair) {
|
|
|
319
341
|
}
|
|
320
342
|
|
|
321
343
|
// src/react/hooks.ts
|
|
322
|
-
var
|
|
323
|
-
var
|
|
324
|
-
var
|
|
325
|
-
var patientsListRef = (0,
|
|
326
|
-
var patientsGetRef = (0,
|
|
327
|
-
var patientsByElationIdRef = (0,
|
|
328
|
-
var patientsByHintIdRef = (0,
|
|
329
|
-
var appointmentsListRef = (0,
|
|
330
|
-
var appointmentsGetRef = (0,
|
|
331
|
-
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");
|
|
332
354
|
function usePatients(options) {
|
|
333
|
-
return (0,
|
|
355
|
+
return (0, import_react5.useQuery)(patientsListRef, options != null ? options : {});
|
|
334
356
|
}
|
|
335
357
|
function usePatient(id) {
|
|
336
|
-
return (0,
|
|
358
|
+
return (0, import_react5.useQuery)(patientsGetRef, { id });
|
|
337
359
|
}
|
|
338
360
|
function usePatientByElationId(elationId) {
|
|
339
|
-
return (0,
|
|
361
|
+
return (0, import_react5.useQuery)(patientsByElationIdRef, {
|
|
340
362
|
elationId
|
|
341
363
|
});
|
|
342
364
|
}
|
|
343
365
|
function usePatientByHintId(hintId) {
|
|
344
|
-
return (0,
|
|
366
|
+
return (0, import_react5.useQuery)(patientsByHintIdRef, {
|
|
345
367
|
hintId
|
|
346
368
|
});
|
|
347
369
|
}
|
|
348
370
|
function useAppointments(options) {
|
|
349
|
-
return (0,
|
|
371
|
+
return (0, import_react5.useQuery)(
|
|
350
372
|
appointmentsListRef,
|
|
351
373
|
options != null ? options : {}
|
|
352
374
|
);
|
|
353
375
|
}
|
|
354
376
|
function useAppointment(id) {
|
|
355
|
-
return (0,
|
|
377
|
+
return (0, import_react5.useQuery)(appointmentsGetRef, { id });
|
|
356
378
|
}
|
|
357
379
|
function useAppointmentByElationId(elationId) {
|
|
358
|
-
return (0,
|
|
380
|
+
return (0, import_react5.useQuery)(appointmentsByElationIdRef, {
|
|
359
381
|
elationId
|
|
360
382
|
});
|
|
361
383
|
}
|
|
362
|
-
var physiciansGetByElationIdsRef = (0,
|
|
363
|
-
var physiciansGetByElationIdRef = (0,
|
|
384
|
+
var physiciansGetByElationIdsRef = (0, import_server4.makeFunctionReference)("physicians:getByElationIds");
|
|
385
|
+
var physiciansGetByElationIdRef = (0, import_server4.makeFunctionReference)("physicians:getByElationId");
|
|
364
386
|
function usePhysiciansByElationIds(ids) {
|
|
365
|
-
return (0,
|
|
387
|
+
return (0, import_react5.useQuery)(
|
|
366
388
|
physiciansGetByElationIdsRef,
|
|
367
389
|
ids && ids.length > 0 ? { ids } : "skip"
|
|
368
390
|
);
|
|
369
391
|
}
|
|
370
392
|
function usePhysicianByElationId(id) {
|
|
371
|
-
return (0,
|
|
393
|
+
return (0, import_react5.useQuery)(
|
|
372
394
|
physiciansGetByElationIdRef,
|
|
373
395
|
id !== void 0 ? { id } : "skip"
|
|
374
396
|
);
|
|
375
397
|
}
|
|
376
|
-
var medicationsByPatientRef = (0,
|
|
377
|
-
var problemsByPatientRef = (0,
|
|
378
|
-
var allergiesByPatientRef = (0,
|
|
379
|
-
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");
|
|
380
402
|
function usePatientMedical(elationId, options) {
|
|
381
|
-
const medications = (0,
|
|
403
|
+
const medications = (0, import_react5.useQuery)(
|
|
382
404
|
medicationsByPatientRef,
|
|
383
405
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
384
406
|
);
|
|
385
|
-
const problems = (0,
|
|
407
|
+
const problems = (0, import_react5.useQuery)(
|
|
386
408
|
problemsByPatientRef,
|
|
387
409
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
388
410
|
);
|
|
389
|
-
const allergies = (0,
|
|
411
|
+
const allergies = (0, import_react5.useQuery)(
|
|
390
412
|
allergiesByPatientRef,
|
|
391
413
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
392
414
|
);
|
|
393
|
-
const appointments = (0,
|
|
415
|
+
const appointments = (0, import_react5.useQuery)(
|
|
394
416
|
appointmentsByPatientRef,
|
|
395
417
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
396
418
|
);
|
|
397
|
-
(0,
|
|
419
|
+
(0, import_react6.useEffect)(() => {
|
|
398
420
|
if (elationId === void 0 || (options == null ? void 0 : options.skipRefresh)) {
|
|
399
421
|
return;
|
|
400
422
|
}
|
|
@@ -418,21 +440,21 @@ function usePatientMedical(elationId, options) {
|
|
|
418
440
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
419
441
|
return { medications, problems, allergies, appointments };
|
|
420
442
|
}
|
|
421
|
-
var elationPatientByIdRef = (0,
|
|
422
|
-
var hintPatientByIdRef = (0,
|
|
423
|
-
var pharmacyByNcpdpRef = (0,
|
|
424
|
-
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");
|
|
425
447
|
function usePatientBasic(input, options) {
|
|
426
448
|
var _a, _b;
|
|
427
|
-
const elationRow = (0,
|
|
449
|
+
const elationRow = (0, import_react5.useQuery)(
|
|
428
450
|
elationPatientByIdRef,
|
|
429
451
|
input.elationId !== void 0 ? { elationId: input.elationId } : "skip"
|
|
430
452
|
);
|
|
431
|
-
const hintRow = (0,
|
|
453
|
+
const hintRow = (0, import_react5.useQuery)(
|
|
432
454
|
hintPatientByIdRef,
|
|
433
455
|
input.hintId !== void 0 ? { hintId: input.hintId } : "skip"
|
|
434
456
|
);
|
|
435
|
-
(0,
|
|
457
|
+
(0, import_react6.useEffect)(() => {
|
|
436
458
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
437
459
|
return;
|
|
438
460
|
}
|
|
@@ -479,17 +501,17 @@ function usePatientBasic(input, options) {
|
|
|
479
501
|
};
|
|
480
502
|
}
|
|
481
503
|
function usePharmacyByNcpdpId(ncpdpId) {
|
|
482
|
-
return (0,
|
|
504
|
+
return (0, import_react5.useQuery)(
|
|
483
505
|
pharmacyByNcpdpRef,
|
|
484
506
|
ncpdpId ? { ncpdpId } : "skip"
|
|
485
507
|
);
|
|
486
508
|
}
|
|
487
509
|
function usePatientPhoto(elationId, options) {
|
|
488
|
-
const photo = (0,
|
|
510
|
+
const photo = (0, import_react5.useQuery)(
|
|
489
511
|
patientPhotoByIdRef,
|
|
490
512
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
491
513
|
);
|
|
492
|
-
(0,
|
|
514
|
+
(0, import_react6.useEffect)(() => {
|
|
493
515
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
494
516
|
return;
|
|
495
517
|
}
|
|
@@ -516,11 +538,11 @@ function usePatientPhoto(elationId, options) {
|
|
|
516
538
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
517
539
|
return photo;
|
|
518
540
|
}
|
|
519
|
-
var messagesByPhonesRef = (0,
|
|
520
|
-
var messagesByConversationIdRef = (0,
|
|
541
|
+
var messagesByPhonesRef = (0, import_server4.makeFunctionReference)("conversationMessages:getByPhones");
|
|
542
|
+
var messagesByConversationIdRef = (0, import_server4.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
521
543
|
function useConversationMessages(input, options) {
|
|
522
544
|
const hasPair = !!input.phoneA && !!input.phoneB;
|
|
523
|
-
const byPair = (0,
|
|
545
|
+
const byPair = (0, import_react5.useQuery)(
|
|
524
546
|
messagesByPhonesRef,
|
|
525
547
|
hasPair ? {
|
|
526
548
|
phoneA: input.phoneA,
|
|
@@ -528,7 +550,7 @@ function useConversationMessages(input, options) {
|
|
|
528
550
|
limit: options == null ? void 0 : options.limit
|
|
529
551
|
} : "skip"
|
|
530
552
|
);
|
|
531
|
-
const byConvo = (0,
|
|
553
|
+
const byConvo = (0, import_react5.useQuery)(
|
|
532
554
|
messagesByConversationIdRef,
|
|
533
555
|
!hasPair && input.conversationId ? { conversationId: input.conversationId, limit: options == null ? void 0 : options.limit } : "skip"
|
|
534
556
|
);
|
|
@@ -536,7 +558,7 @@ function useConversationMessages(input, options) {
|
|
|
536
558
|
}
|
|
537
559
|
|
|
538
560
|
// src/react/notifications.ts
|
|
539
|
-
var
|
|
561
|
+
var import_react7 = require("react");
|
|
540
562
|
|
|
541
563
|
// src/web-push.ts
|
|
542
564
|
function isWebPushSupported() {
|
|
@@ -595,12 +617,12 @@ function loadExpo() {
|
|
|
595
617
|
}
|
|
596
618
|
function useNotifications(options) {
|
|
597
619
|
var _a;
|
|
598
|
-
const [permissionStatus, setPermissionStatus] = (0,
|
|
599
|
-
const [devicePushToken, setDevicePushToken] = (0,
|
|
600
|
-
const expoRef = (0,
|
|
601
|
-
const isWebRef = (0,
|
|
602
|
-
const vapidKeyRef = (0,
|
|
603
|
-
(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)(() => {
|
|
604
626
|
let mounted = true;
|
|
605
627
|
void (() => __async(null, null, function* () {
|
|
606
628
|
var _a2;
|
|
@@ -656,7 +678,7 @@ function useNotifications(options) {
|
|
|
656
678
|
mounted = false;
|
|
657
679
|
};
|
|
658
680
|
}, [options.apiBaseUrl, options.apiKey]);
|
|
659
|
-
const register = (0,
|
|
681
|
+
const register = (0, import_react7.useCallback)(() => __async(null, null, function* () {
|
|
660
682
|
var _a2, _b;
|
|
661
683
|
if (!options.userId) {
|
|
662
684
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -766,7 +788,7 @@ function useNotifications(options) {
|
|
|
766
788
|
options.appVersion,
|
|
767
789
|
options.serviceWorkerPath
|
|
768
790
|
]);
|
|
769
|
-
const unregister = (0,
|
|
791
|
+
const unregister = (0, import_react7.useCallback)(() => __async(null, null, function* () {
|
|
770
792
|
if (!devicePushToken) {
|
|
771
793
|
return;
|
|
772
794
|
}
|
|
@@ -781,7 +803,7 @@ function useNotifications(options) {
|
|
|
781
803
|
});
|
|
782
804
|
setDevicePushToken(null);
|
|
783
805
|
}), [options.apiBaseUrl, options.apiKey, devicePushToken]);
|
|
784
|
-
const addReceivedListener = (0,
|
|
806
|
+
const addReceivedListener = (0, import_react7.useCallback)(
|
|
785
807
|
(listener) => {
|
|
786
808
|
if (isWebRef.current) {
|
|
787
809
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -810,7 +832,7 @@ function useNotifications(options) {
|
|
|
810
832
|
},
|
|
811
833
|
[]
|
|
812
834
|
);
|
|
813
|
-
const addResponseListener = (0,
|
|
835
|
+
const addResponseListener = (0, import_react7.useCallback)(
|
|
814
836
|
(listener) => {
|
|
815
837
|
if (isWebRef.current) {
|
|
816
838
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -839,7 +861,7 @@ function useNotifications(options) {
|
|
|
839
861
|
},
|
|
840
862
|
[]
|
|
841
863
|
);
|
|
842
|
-
const getBadgeCount = (0,
|
|
864
|
+
const getBadgeCount = (0, import_react7.useCallback)(() => __async(null, null, function* () {
|
|
843
865
|
var _a2;
|
|
844
866
|
const expo = expoRef.current;
|
|
845
867
|
if (!(expo == null ? void 0 : expo.getBadgeCountAsync)) {
|
|
@@ -847,7 +869,7 @@ function useNotifications(options) {
|
|
|
847
869
|
}
|
|
848
870
|
return (_a2 = yield expo.getBadgeCountAsync()) != null ? _a2 : 0;
|
|
849
871
|
}), []);
|
|
850
|
-
const setBadgeCount = (0,
|
|
872
|
+
const setBadgeCount = (0, import_react7.useCallback)((count) => __async(null, null, function* () {
|
|
851
873
|
const expo = expoRef.current;
|
|
852
874
|
if (!(expo == null ? void 0 : expo.setBadgeCountAsync)) {
|
|
853
875
|
return;
|
|
@@ -855,7 +877,7 @@ function useNotifications(options) {
|
|
|
855
877
|
yield expo.setBadgeCountAsync(count);
|
|
856
878
|
}), []);
|
|
857
879
|
const autoRegister = options.autoRegister !== false;
|
|
858
|
-
(0,
|
|
880
|
+
(0, import_react7.useEffect)(() => {
|
|
859
881
|
if (!autoRegister) {
|
|
860
882
|
return;
|
|
861
883
|
}
|
|
@@ -913,16 +935,16 @@ function detectPlatform(tokenType) {
|
|
|
913
935
|
}
|
|
914
936
|
|
|
915
937
|
// src/react/patient-family.ts
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
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");
|
|
919
941
|
var SKIP3 = "skip";
|
|
920
942
|
function usePatientFamilyMembers(input) {
|
|
921
943
|
const hasFamilyId = !!(input == null ? void 0 : input.familyId);
|
|
922
944
|
const hasPhoneNumbers = !!((input == null ? void 0 : input.phoneNumbers) && input.phoneNumbers.length > 0);
|
|
923
945
|
const shouldQuery = hasFamilyId || hasPhoneNumbers;
|
|
924
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;
|
|
925
|
-
const result = (0,
|
|
947
|
+
const result = (0, import_react8.useQuery)(
|
|
926
948
|
patientsFamilyMembersRef,
|
|
927
949
|
args
|
|
928
950
|
);
|
|
@@ -937,15 +959,15 @@ function usePatientFamilyMembers(input) {
|
|
|
937
959
|
}
|
|
938
960
|
|
|
939
961
|
// src/react/patient-search.ts
|
|
940
|
-
var
|
|
941
|
-
var
|
|
942
|
-
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");
|
|
943
965
|
var SKIP4 = "skip";
|
|
944
966
|
function usePatientSearch(options) {
|
|
945
967
|
var _a;
|
|
946
968
|
const trimmedQuery = ((_a = options.query) != null ? _a : "").trim();
|
|
947
969
|
const skipped = trimmedQuery.length === 0;
|
|
948
|
-
const result = (0,
|
|
970
|
+
const result = (0, import_react9.useQuery)(
|
|
949
971
|
patientsSearchRef,
|
|
950
972
|
skipped ? SKIP4 : __spreadValues(__spreadValues(__spreadValues({
|
|
951
973
|
query: trimmedQuery
|
|
@@ -962,23 +984,23 @@ function usePatientSearch(options) {
|
|
|
962
984
|
}
|
|
963
985
|
|
|
964
986
|
// src/react/patients-bulk.ts
|
|
965
|
-
var
|
|
966
|
-
var
|
|
967
|
-
var
|
|
968
|
-
var patientsGetByIdsRef = (0,
|
|
969
|
-
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");
|
|
970
992
|
var SKIP5 = "skip";
|
|
971
993
|
function usePatientsByIds(ids) {
|
|
972
|
-
const stableIds = (0,
|
|
994
|
+
const stableIds = (0, import_react11.useMemo)(() => {
|
|
973
995
|
const arr = ids != null ? ids : [];
|
|
974
996
|
return [...new Set(arr)].sort();
|
|
975
997
|
}, [ids]);
|
|
976
998
|
const skipped = stableIds.length === 0;
|
|
977
|
-
const result = (0,
|
|
999
|
+
const result = (0, import_react10.useQuery)(
|
|
978
1000
|
patientsGetByIdsRef,
|
|
979
1001
|
skipped ? SKIP5 : { ids: stableIds }
|
|
980
1002
|
);
|
|
981
|
-
const mapped = (0,
|
|
1003
|
+
const mapped = (0, import_react11.useMemo)(() => {
|
|
982
1004
|
if (result === void 0) return void 0;
|
|
983
1005
|
return Object.fromEntries(
|
|
984
1006
|
result.map((p) => {
|
|
@@ -998,17 +1020,17 @@ function usePatientsByIds(ids) {
|
|
|
998
1020
|
};
|
|
999
1021
|
}
|
|
1000
1022
|
function usePatientsByPhones(phones) {
|
|
1001
|
-
const stableDigits = (0,
|
|
1023
|
+
const stableDigits = (0, import_react11.useMemo)(() => {
|
|
1002
1024
|
const arr = phones != null ? phones : [];
|
|
1003
1025
|
const digits = arr.map((p) => p.replace(/\D+/g, "")).filter((s) => s.length > 0);
|
|
1004
1026
|
return [...new Set(digits)].sort();
|
|
1005
1027
|
}, [phones]);
|
|
1006
1028
|
const skipped = stableDigits.length === 0;
|
|
1007
|
-
const result = (0,
|
|
1029
|
+
const result = (0, import_react10.useQuery)(
|
|
1008
1030
|
patientsGetByPhonesRef,
|
|
1009
1031
|
skipped ? SKIP5 : { phoneDigits: stableDigits }
|
|
1010
1032
|
);
|
|
1011
|
-
const mapped = (0,
|
|
1033
|
+
const mapped = (0, import_react11.useMemo)(() => {
|
|
1012
1034
|
if (result === void 0) return void 0;
|
|
1013
1035
|
return Object.fromEntries(result.map((r) => [r.phoneDigits, r.patient]));
|
|
1014
1036
|
}, [result]);
|
|
@@ -1023,8 +1045,8 @@ function usePatientsByPhones(phones) {
|
|
|
1023
1045
|
}
|
|
1024
1046
|
|
|
1025
1047
|
// src/react/provider.ts
|
|
1026
|
-
var
|
|
1027
|
-
var
|
|
1048
|
+
var import_react12 = require("convex/react");
|
|
1049
|
+
var import_react13 = require("react");
|
|
1028
1050
|
var CONVEX_URLS = {
|
|
1029
1051
|
local: "https://courteous-duck-623.convex.cloud",
|
|
1030
1052
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -1047,19 +1069,19 @@ function TruthProvider({
|
|
|
1047
1069
|
children
|
|
1048
1070
|
}) {
|
|
1049
1071
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
1050
|
-
const client = (0,
|
|
1051
|
-
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);
|
|
1052
1074
|
}
|
|
1053
1075
|
|
|
1054
1076
|
// src/react/reminders.ts
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1057
|
-
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");
|
|
1058
1080
|
var SKIP6 = "skip";
|
|
1059
1081
|
function useRemindersForConversations(conversationIds) {
|
|
1060
1082
|
const ids = conversationIds != null ? conversationIds : [];
|
|
1061
1083
|
const skipped = ids.length === 0;
|
|
1062
|
-
const result = (0,
|
|
1084
|
+
const result = (0, import_react14.useQuery)(
|
|
1063
1085
|
remindersListPendingByConversationIdsRef,
|
|
1064
1086
|
skipped ? SKIP6 : { conversationIds: ids }
|
|
1065
1087
|
);
|
|
@@ -1074,8 +1096,23 @@ function useRemindersForConversations(conversationIds) {
|
|
|
1074
1096
|
};
|
|
1075
1097
|
}
|
|
1076
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
|
+
|
|
1077
1114
|
// src/react/tracking.ts
|
|
1078
|
-
var
|
|
1115
|
+
var import_react17 = require("react");
|
|
1079
1116
|
|
|
1080
1117
|
// src/tracking/tracker.ts
|
|
1081
1118
|
function generateUuidV7() {
|
|
@@ -1270,7 +1307,7 @@ function sleep(ms) {
|
|
|
1270
1307
|
}
|
|
1271
1308
|
|
|
1272
1309
|
// src/react/tracking.ts
|
|
1273
|
-
var TruthTrackingContext = (0,
|
|
1310
|
+
var TruthTrackingContext = (0, import_react17.createContext)(
|
|
1274
1311
|
null
|
|
1275
1312
|
);
|
|
1276
1313
|
function TruthTrackingProvider({
|
|
@@ -1281,7 +1318,7 @@ function TruthTrackingProvider({
|
|
|
1281
1318
|
apiKey = "",
|
|
1282
1319
|
children
|
|
1283
1320
|
}) {
|
|
1284
|
-
const value = (0,
|
|
1321
|
+
const value = (0, import_react17.useMemo)(() => {
|
|
1285
1322
|
const tracker = new Tracker({
|
|
1286
1323
|
apiKey,
|
|
1287
1324
|
environment,
|
|
@@ -1300,10 +1337,10 @@ function TruthTrackingProvider({
|
|
|
1300
1337
|
}
|
|
1301
1338
|
};
|
|
1302
1339
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1303
|
-
return (0,
|
|
1340
|
+
return (0, import_react17.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1304
1341
|
}
|
|
1305
1342
|
function useTruth() {
|
|
1306
|
-
const ctx = (0,
|
|
1343
|
+
const ctx = (0, import_react17.useContext)(TruthTrackingContext);
|
|
1307
1344
|
if (!ctx) {
|
|
1308
1345
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1309
1346
|
}
|
|
@@ -1311,13 +1348,13 @@ function useTruth() {
|
|
|
1311
1348
|
}
|
|
1312
1349
|
|
|
1313
1350
|
// src/react/user-settings.ts
|
|
1314
|
-
var
|
|
1315
|
-
var
|
|
1316
|
-
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");
|
|
1317
1354
|
var SKIP7 = "skip";
|
|
1318
1355
|
function useUserSettings(userId) {
|
|
1319
1356
|
const skip = !userId;
|
|
1320
|
-
const result = (0,
|
|
1357
|
+
const result = (0, import_react18.useQuery)(
|
|
1321
1358
|
userSettingsGetByUserIdRef,
|
|
1322
1359
|
skip ? SKIP7 : { userId }
|
|
1323
1360
|
);
|
|
@@ -1332,13 +1369,13 @@ function useUserSettings(userId) {
|
|
|
1332
1369
|
}
|
|
1333
1370
|
|
|
1334
1371
|
// src/react/voicemail.ts
|
|
1335
|
-
var
|
|
1372
|
+
var import_react19 = require("react");
|
|
1336
1373
|
function useVoicemailUrl(client) {
|
|
1337
|
-
const [url, setUrl] = (0,
|
|
1338
|
-
const [isLoading, setIsLoading] = (0,
|
|
1339
|
-
const [error, setError] = (0,
|
|
1340
|
-
const inFlightRef = (0,
|
|
1341
|
-
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)(
|
|
1342
1379
|
(voicemailLink) => __async(null, null, function* () {
|
|
1343
1380
|
if (inFlightRef.current) return null;
|
|
1344
1381
|
inFlightRef.current = true;
|
|
@@ -1374,10 +1411,12 @@ function useVoicemailUrl(client) {
|
|
|
1374
1411
|
useAppointment,
|
|
1375
1412
|
useAppointmentByElationId,
|
|
1376
1413
|
useAppointments,
|
|
1414
|
+
useConversationById,
|
|
1377
1415
|
useConversationByPhonePair,
|
|
1378
1416
|
useConversationMessages,
|
|
1379
1417
|
useConversationNotes,
|
|
1380
1418
|
useConversationNotesByPhonePair,
|
|
1419
|
+
useConversationTaskMarkSeen,
|
|
1381
1420
|
useConversationTasks,
|
|
1382
1421
|
useConversationTasksByPhonePair,
|
|
1383
1422
|
useConversationTasksForUser,
|