@hipnation-truth/sdk 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +72 -79
- package/dist/react.js +142 -148
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -58,17 +58,16 @@ var react_exports = {};
|
|
|
58
58
|
__export(react_exports, {
|
|
59
59
|
TruthProvider: () => TruthProvider,
|
|
60
60
|
TruthTrackingProvider: () => TruthTrackingProvider,
|
|
61
|
+
useActiveCalls: () => useActiveCalls,
|
|
61
62
|
useAppointment: () => useAppointment,
|
|
62
63
|
useAppointmentByElationId: () => useAppointmentByElationId,
|
|
63
64
|
useAppointments: () => useAppointments,
|
|
64
65
|
useConversationByPhonePair: () => useConversationByPhonePair,
|
|
65
66
|
useConversationMessages: () => useConversationMessages,
|
|
66
|
-
useConversationNotes: () => useConversationNotes,
|
|
67
|
-
useConversationNotesByPhonePair: () => useConversationNotesByPhonePair,
|
|
68
|
-
useConversationTasks: () => useConversationTasks,
|
|
69
|
-
useConversationTasksByPhonePair: () => useConversationTasksByPhonePair,
|
|
70
|
-
useConversationTasksForUser: () => useConversationTasksForUser,
|
|
71
67
|
useConversations: () => useConversations,
|
|
68
|
+
useDialpadCallByCallId: () => useDialpadCallByCallId,
|
|
69
|
+
useDialpadCallLog: () => useDialpadCallLog,
|
|
70
|
+
useDialpadCallsForConversation: () => useDialpadCallsForConversation,
|
|
72
71
|
useMessages: () => useMessages,
|
|
73
72
|
useNotifications: () => useNotifications,
|
|
74
73
|
usePatient: () => usePatient,
|
|
@@ -86,19 +85,13 @@ __export(react_exports, {
|
|
|
86
85
|
});
|
|
87
86
|
module.exports = __toCommonJS(react_exports);
|
|
88
87
|
|
|
89
|
-
// src/react/
|
|
88
|
+
// src/react/calls.ts
|
|
90
89
|
var import_react = require("convex/react");
|
|
91
90
|
var import_server = require("convex/server");
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
var
|
|
96
|
-
var conversationMessagesGetByConversationIdRef = (0, import_server.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
97
|
-
var conversationNotesListForConversationRef = (0, import_server.makeFunctionReference)("conversationNotes:listForConversation");
|
|
98
|
-
var conversationTasksListForConversationRef = (0, import_server.makeFunctionReference)("conversationTasks:listForConversation");
|
|
99
|
-
var conversationNotesListByPhonePairRef = (0, import_server.makeFunctionReference)("conversationNotes:listByPhonePair");
|
|
100
|
-
var conversationTasksListByPhonePairRef = (0, import_server.makeFunctionReference)("conversationTasks:listByPhonePair");
|
|
101
|
-
var conversationTasksListForUserRef = (0, import_server.makeFunctionReference)("conversationTasks:listForUser");
|
|
91
|
+
var listActiveRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:listActive");
|
|
92
|
+
var listForConversationRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:listForConversation");
|
|
93
|
+
var getByCallIdRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:getByCallId");
|
|
94
|
+
var listLogForCallIdRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:listLogForCallId");
|
|
102
95
|
var SKIP = "skip";
|
|
103
96
|
function toResult(value, skipped) {
|
|
104
97
|
if (skipped) {
|
|
@@ -110,40 +103,17 @@ function toResult(value, skipped) {
|
|
|
110
103
|
error: void 0
|
|
111
104
|
};
|
|
112
105
|
}
|
|
113
|
-
function
|
|
114
|
-
var _a, _b;
|
|
115
|
-
const trimmedSearch = (_b = (_a = filters.search) == null ? void 0 : _a.trim()) != null ? _b : "";
|
|
116
|
-
const isSearchMode = trimmedSearch.length > 0;
|
|
117
|
-
const skipped = !filters.userId;
|
|
118
|
-
const listResult = (0, import_react.useQuery)(
|
|
119
|
-
conversationsListForUserRef,
|
|
120
|
-
skipped || isSearchMode ? SKIP : {
|
|
121
|
-
userId: filters.userId,
|
|
122
|
-
limit: filters.limit
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
const searchResult = (0, import_react.useQuery)(
|
|
126
|
-
conversationsSearchForUserRef,
|
|
127
|
-
skipped || !isSearchMode ? SKIP : {
|
|
128
|
-
userId: filters.userId,
|
|
129
|
-
search: trimmedSearch,
|
|
130
|
-
limit: filters.limit
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
return toResult(isSearchMode ? searchResult : listResult, skipped);
|
|
134
|
-
}
|
|
135
|
-
function useConversationByPhonePair(phonePair) {
|
|
136
|
-
const skipped = !phonePair;
|
|
106
|
+
function useActiveCalls(options) {
|
|
137
107
|
const result = (0, import_react.useQuery)(
|
|
138
|
-
|
|
139
|
-
|
|
108
|
+
listActiveRef,
|
|
109
|
+
options != null ? options : {}
|
|
140
110
|
);
|
|
141
|
-
return toResult(result,
|
|
111
|
+
return toResult(result, false);
|
|
142
112
|
}
|
|
143
|
-
function
|
|
113
|
+
function useDialpadCallsForConversation(conversationId, options) {
|
|
144
114
|
const skipped = !conversationId;
|
|
145
115
|
const result = (0, import_react.useQuery)(
|
|
146
|
-
|
|
116
|
+
listForConversationRef,
|
|
147
117
|
skipped ? SKIP : {
|
|
148
118
|
conversationId,
|
|
149
119
|
limit: options == null ? void 0 : options.limit
|
|
@@ -151,132 +121,157 @@ function useMessages(conversationId, options) {
|
|
|
151
121
|
);
|
|
152
122
|
return toResult(result, skipped);
|
|
153
123
|
}
|
|
154
|
-
function
|
|
155
|
-
const skipped = !
|
|
124
|
+
function useDialpadCallByCallId(callId) {
|
|
125
|
+
const skipped = !callId;
|
|
156
126
|
const result = (0, import_react.useQuery)(
|
|
157
|
-
|
|
158
|
-
skipped ? SKIP : {
|
|
127
|
+
getByCallIdRef,
|
|
128
|
+
skipped ? SKIP : { callId }
|
|
159
129
|
);
|
|
160
130
|
return toResult(result, skipped);
|
|
161
131
|
}
|
|
162
|
-
function
|
|
163
|
-
const skipped = !
|
|
132
|
+
function useDialpadCallLog(callId, options) {
|
|
133
|
+
const skipped = !callId;
|
|
164
134
|
const result = (0, import_react.useQuery)(
|
|
165
|
-
|
|
166
|
-
skipped ? SKIP : {
|
|
135
|
+
listLogForCallIdRef,
|
|
136
|
+
skipped ? SKIP : { callId, limit: options == null ? void 0 : options.limit }
|
|
167
137
|
);
|
|
168
138
|
return toResult(result, skipped);
|
|
169
139
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
140
|
+
|
|
141
|
+
// src/react/conversations.ts
|
|
142
|
+
var import_react2 = require("convex/react");
|
|
143
|
+
var import_server2 = require("convex/server");
|
|
144
|
+
var conversationsListForUserRef = (0, import_server2.makeFunctionReference)("conversations:listForUser");
|
|
145
|
+
var conversationsGetUnreadTotalForUserRef = (0, import_server2.makeFunctionReference)("conversations:getUnreadTotalForUser");
|
|
146
|
+
var conversationsGetByPhonePairRef = (0, import_server2.makeFunctionReference)("conversations:getByPhonePair");
|
|
147
|
+
var conversationMessagesGetByConversationIdRef = (0, import_server2.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
148
|
+
var SKIP2 = "skip";
|
|
149
|
+
function toResult2(value, skipped) {
|
|
150
|
+
if (skipped) {
|
|
151
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
data: value,
|
|
155
|
+
loading: value === void 0,
|
|
156
|
+
error: void 0
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function useConversations(filters) {
|
|
160
|
+
const skipped = !filters.userId;
|
|
161
|
+
const result = (0, import_react2.useQuery)(
|
|
162
|
+
conversationsListForUserRef,
|
|
163
|
+
skipped ? SKIP2 : {
|
|
164
|
+
userId: filters.userId,
|
|
165
|
+
limit: filters.limit
|
|
166
|
+
}
|
|
175
167
|
);
|
|
176
|
-
return
|
|
168
|
+
return toResult2(result, skipped);
|
|
177
169
|
}
|
|
178
|
-
function
|
|
170
|
+
function useConversationByPhonePair(phonePair) {
|
|
179
171
|
const skipped = !phonePair;
|
|
180
|
-
const result = (0,
|
|
181
|
-
|
|
182
|
-
skipped ?
|
|
172
|
+
const result = (0, import_react2.useQuery)(
|
|
173
|
+
conversationsGetByPhonePairRef,
|
|
174
|
+
skipped ? SKIP2 : { phonePair }
|
|
183
175
|
);
|
|
184
|
-
return
|
|
176
|
+
return toResult2(result, skipped);
|
|
185
177
|
}
|
|
186
|
-
function
|
|
187
|
-
const skipped = !
|
|
188
|
-
const result = (0,
|
|
189
|
-
|
|
190
|
-
skipped ?
|
|
178
|
+
function useMessages(conversationId, options) {
|
|
179
|
+
const skipped = !conversationId;
|
|
180
|
+
const result = (0, import_react2.useQuery)(
|
|
181
|
+
conversationMessagesGetByConversationIdRef,
|
|
182
|
+
skipped ? SKIP2 : {
|
|
183
|
+
conversationId,
|
|
184
|
+
limit: options == null ? void 0 : options.limit
|
|
185
|
+
}
|
|
191
186
|
);
|
|
192
|
-
return
|
|
187
|
+
return toResult2(result, skipped);
|
|
193
188
|
}
|
|
194
|
-
function
|
|
195
|
-
const skipped = !
|
|
196
|
-
const result = (0,
|
|
197
|
-
|
|
198
|
-
skipped ?
|
|
189
|
+
function useUnreadCount(userId) {
|
|
190
|
+
const skipped = !userId;
|
|
191
|
+
const result = (0, import_react2.useQuery)(
|
|
192
|
+
conversationsGetUnreadTotalForUserRef,
|
|
193
|
+
skipped ? SKIP2 : { userId }
|
|
199
194
|
);
|
|
200
|
-
return
|
|
195
|
+
return toResult2(result, skipped);
|
|
201
196
|
}
|
|
202
197
|
|
|
203
198
|
// src/react/hooks.ts
|
|
204
|
-
var
|
|
205
|
-
var
|
|
206
|
-
var
|
|
207
|
-
var patientsListRef = (0,
|
|
208
|
-
var patientsGetRef = (0,
|
|
209
|
-
var patientsByElationIdRef = (0,
|
|
210
|
-
var patientsByHintIdRef = (0,
|
|
211
|
-
var appointmentsListRef = (0,
|
|
212
|
-
var appointmentsGetRef = (0,
|
|
213
|
-
var appointmentsByElationIdRef = (0,
|
|
199
|
+
var import_react3 = require("convex/react");
|
|
200
|
+
var import_react4 = require("react");
|
|
201
|
+
var import_server3 = require("convex/server");
|
|
202
|
+
var patientsListRef = (0, import_server3.makeFunctionReference)("patients:list");
|
|
203
|
+
var patientsGetRef = (0, import_server3.makeFunctionReference)("patients:get");
|
|
204
|
+
var patientsByElationIdRef = (0, import_server3.makeFunctionReference)("patients:getByElationId");
|
|
205
|
+
var patientsByHintIdRef = (0, import_server3.makeFunctionReference)("patients:getByHintId");
|
|
206
|
+
var appointmentsListRef = (0, import_server3.makeFunctionReference)("appointments:list");
|
|
207
|
+
var appointmentsGetRef = (0, import_server3.makeFunctionReference)("appointments:get");
|
|
208
|
+
var appointmentsByElationIdRef = (0, import_server3.makeFunctionReference)("appointments:getByElationId");
|
|
214
209
|
function usePatients(options) {
|
|
215
|
-
return (0,
|
|
210
|
+
return (0, import_react3.useQuery)(patientsListRef, options != null ? options : {});
|
|
216
211
|
}
|
|
217
212
|
function usePatient(id) {
|
|
218
|
-
return (0,
|
|
213
|
+
return (0, import_react3.useQuery)(patientsGetRef, { id });
|
|
219
214
|
}
|
|
220
215
|
function usePatientByElationId(elationId) {
|
|
221
|
-
return (0,
|
|
216
|
+
return (0, import_react3.useQuery)(patientsByElationIdRef, {
|
|
222
217
|
elationId
|
|
223
218
|
});
|
|
224
219
|
}
|
|
225
220
|
function usePatientByHintId(hintId) {
|
|
226
|
-
return (0,
|
|
221
|
+
return (0, import_react3.useQuery)(patientsByHintIdRef, {
|
|
227
222
|
hintId
|
|
228
223
|
});
|
|
229
224
|
}
|
|
230
225
|
function useAppointments(options) {
|
|
231
|
-
return (0,
|
|
226
|
+
return (0, import_react3.useQuery)(
|
|
232
227
|
appointmentsListRef,
|
|
233
228
|
options != null ? options : {}
|
|
234
229
|
);
|
|
235
230
|
}
|
|
236
231
|
function useAppointment(id) {
|
|
237
|
-
return (0,
|
|
232
|
+
return (0, import_react3.useQuery)(appointmentsGetRef, { id });
|
|
238
233
|
}
|
|
239
234
|
function useAppointmentByElationId(elationId) {
|
|
240
|
-
return (0,
|
|
235
|
+
return (0, import_react3.useQuery)(appointmentsByElationIdRef, {
|
|
241
236
|
elationId
|
|
242
237
|
});
|
|
243
238
|
}
|
|
244
|
-
var physiciansGetByElationIdsRef = (0,
|
|
245
|
-
var physiciansGetByElationIdRef = (0,
|
|
239
|
+
var physiciansGetByElationIdsRef = (0, import_server3.makeFunctionReference)("physicians:getByElationIds");
|
|
240
|
+
var physiciansGetByElationIdRef = (0, import_server3.makeFunctionReference)("physicians:getByElationId");
|
|
246
241
|
function usePhysiciansByElationIds(ids) {
|
|
247
|
-
return (0,
|
|
242
|
+
return (0, import_react3.useQuery)(
|
|
248
243
|
physiciansGetByElationIdsRef,
|
|
249
244
|
ids && ids.length > 0 ? { ids } : "skip"
|
|
250
245
|
);
|
|
251
246
|
}
|
|
252
247
|
function usePhysicianByElationId(id) {
|
|
253
|
-
return (0,
|
|
248
|
+
return (0, import_react3.useQuery)(
|
|
254
249
|
physiciansGetByElationIdRef,
|
|
255
250
|
id !== void 0 ? { id } : "skip"
|
|
256
251
|
);
|
|
257
252
|
}
|
|
258
|
-
var medicationsByPatientRef = (0,
|
|
259
|
-
var problemsByPatientRef = (0,
|
|
260
|
-
var allergiesByPatientRef = (0,
|
|
261
|
-
var appointmentsByPatientRef = (0,
|
|
253
|
+
var medicationsByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getMedicationsByElationPatient");
|
|
254
|
+
var problemsByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getProblemsByElationPatient");
|
|
255
|
+
var allergiesByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getAllergiesByElationPatient");
|
|
256
|
+
var appointmentsByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getAppointmentsByElationPatient");
|
|
262
257
|
function usePatientMedical(elationId, options) {
|
|
263
|
-
const medications = (0,
|
|
258
|
+
const medications = (0, import_react3.useQuery)(
|
|
264
259
|
medicationsByPatientRef,
|
|
265
260
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
266
261
|
);
|
|
267
|
-
const problems = (0,
|
|
262
|
+
const problems = (0, import_react3.useQuery)(
|
|
268
263
|
problemsByPatientRef,
|
|
269
264
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
270
265
|
);
|
|
271
|
-
const allergies = (0,
|
|
266
|
+
const allergies = (0, import_react3.useQuery)(
|
|
272
267
|
allergiesByPatientRef,
|
|
273
268
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
274
269
|
);
|
|
275
|
-
const appointments = (0,
|
|
270
|
+
const appointments = (0, import_react3.useQuery)(
|
|
276
271
|
appointmentsByPatientRef,
|
|
277
272
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
278
273
|
);
|
|
279
|
-
(0,
|
|
274
|
+
(0, import_react4.useEffect)(() => {
|
|
280
275
|
if (elationId === void 0 || (options == null ? void 0 : options.skipRefresh)) {
|
|
281
276
|
return;
|
|
282
277
|
}
|
|
@@ -300,21 +295,21 @@ function usePatientMedical(elationId, options) {
|
|
|
300
295
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
301
296
|
return { medications, problems, allergies, appointments };
|
|
302
297
|
}
|
|
303
|
-
var elationPatientByIdRef = (0,
|
|
304
|
-
var hintPatientByIdRef = (0,
|
|
305
|
-
var pharmacyByNcpdpRef = (0,
|
|
306
|
-
var patientPhotoByIdRef = (0,
|
|
298
|
+
var elationPatientByIdRef = (0, import_server3.makeFunctionReference)("elationPatients:getByElationId");
|
|
299
|
+
var hintPatientByIdRef = (0, import_server3.makeFunctionReference)("hintPatients:getByHintId");
|
|
300
|
+
var pharmacyByNcpdpRef = (0, import_server3.makeFunctionReference)("elationPharmacies:getByNcpdpId");
|
|
301
|
+
var patientPhotoByIdRef = (0, import_server3.makeFunctionReference)("elationPatientPhotos:getByElationPatientId");
|
|
307
302
|
function usePatientBasic(input, options) {
|
|
308
303
|
var _a, _b;
|
|
309
|
-
const elationRow = (0,
|
|
304
|
+
const elationRow = (0, import_react3.useQuery)(
|
|
310
305
|
elationPatientByIdRef,
|
|
311
306
|
input.elationId !== void 0 ? { elationId: input.elationId } : "skip"
|
|
312
307
|
);
|
|
313
|
-
const hintRow = (0,
|
|
308
|
+
const hintRow = (0, import_react3.useQuery)(
|
|
314
309
|
hintPatientByIdRef,
|
|
315
310
|
input.hintId !== void 0 ? { hintId: input.hintId } : "skip"
|
|
316
311
|
);
|
|
317
|
-
(0,
|
|
312
|
+
(0, import_react4.useEffect)(() => {
|
|
318
313
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
319
314
|
return;
|
|
320
315
|
}
|
|
@@ -361,17 +356,17 @@ function usePatientBasic(input, options) {
|
|
|
361
356
|
};
|
|
362
357
|
}
|
|
363
358
|
function usePharmacyByNcpdpId(ncpdpId) {
|
|
364
|
-
return (0,
|
|
359
|
+
return (0, import_react3.useQuery)(
|
|
365
360
|
pharmacyByNcpdpRef,
|
|
366
361
|
ncpdpId ? { ncpdpId } : "skip"
|
|
367
362
|
);
|
|
368
363
|
}
|
|
369
364
|
function usePatientPhoto(elationId, options) {
|
|
370
|
-
const photo = (0,
|
|
365
|
+
const photo = (0, import_react3.useQuery)(
|
|
371
366
|
patientPhotoByIdRef,
|
|
372
367
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
373
368
|
);
|
|
374
|
-
(0,
|
|
369
|
+
(0, import_react4.useEffect)(() => {
|
|
375
370
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
376
371
|
return;
|
|
377
372
|
}
|
|
@@ -398,11 +393,11 @@ function usePatientPhoto(elationId, options) {
|
|
|
398
393
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
399
394
|
return photo;
|
|
400
395
|
}
|
|
401
|
-
var messagesByPhonesRef = (0,
|
|
402
|
-
var messagesByConversationIdRef = (0,
|
|
396
|
+
var messagesByPhonesRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByPhones");
|
|
397
|
+
var messagesByConversationIdRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
403
398
|
function useConversationMessages(input, options) {
|
|
404
399
|
const hasPair = !!input.phoneA && !!input.phoneB;
|
|
405
|
-
const byPair = (0,
|
|
400
|
+
const byPair = (0, import_react3.useQuery)(
|
|
406
401
|
messagesByPhonesRef,
|
|
407
402
|
hasPair ? {
|
|
408
403
|
phoneA: input.phoneA,
|
|
@@ -410,7 +405,7 @@ function useConversationMessages(input, options) {
|
|
|
410
405
|
limit: options == null ? void 0 : options.limit
|
|
411
406
|
} : "skip"
|
|
412
407
|
);
|
|
413
|
-
const byConvo = (0,
|
|
408
|
+
const byConvo = (0, import_react3.useQuery)(
|
|
414
409
|
messagesByConversationIdRef,
|
|
415
410
|
!hasPair && input.conversationId ? { conversationId: input.conversationId, limit: options == null ? void 0 : options.limit } : "skip"
|
|
416
411
|
);
|
|
@@ -418,7 +413,7 @@ function useConversationMessages(input, options) {
|
|
|
418
413
|
}
|
|
419
414
|
|
|
420
415
|
// src/react/notifications.ts
|
|
421
|
-
var
|
|
416
|
+
var import_react5 = require("react");
|
|
422
417
|
|
|
423
418
|
// src/web-push.ts
|
|
424
419
|
function isWebPushSupported() {
|
|
@@ -477,12 +472,12 @@ function loadExpo() {
|
|
|
477
472
|
}
|
|
478
473
|
function useNotifications(options) {
|
|
479
474
|
var _a;
|
|
480
|
-
const [permissionStatus, setPermissionStatus] = (0,
|
|
481
|
-
const [devicePushToken, setDevicePushToken] = (0,
|
|
482
|
-
const expoRef = (0,
|
|
483
|
-
const isWebRef = (0,
|
|
484
|
-
const vapidKeyRef = (0,
|
|
485
|
-
(0,
|
|
475
|
+
const [permissionStatus, setPermissionStatus] = (0, import_react5.useState)("unknown");
|
|
476
|
+
const [devicePushToken, setDevicePushToken] = (0, import_react5.useState)(null);
|
|
477
|
+
const expoRef = (0, import_react5.useRef)(null);
|
|
478
|
+
const isWebRef = (0, import_react5.useRef)(false);
|
|
479
|
+
const vapidKeyRef = (0, import_react5.useRef)((_a = options.vapidPublicKey) != null ? _a : null);
|
|
480
|
+
(0, import_react5.useEffect)(() => {
|
|
486
481
|
let mounted = true;
|
|
487
482
|
void (() => __async(null, null, function* () {
|
|
488
483
|
var _a2;
|
|
@@ -538,7 +533,7 @@ function useNotifications(options) {
|
|
|
538
533
|
mounted = false;
|
|
539
534
|
};
|
|
540
535
|
}, [options.apiBaseUrl, options.apiKey]);
|
|
541
|
-
const register = (0,
|
|
536
|
+
const register = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
542
537
|
var _a2, _b;
|
|
543
538
|
if (!options.userId) {
|
|
544
539
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -648,7 +643,7 @@ function useNotifications(options) {
|
|
|
648
643
|
options.appVersion,
|
|
649
644
|
options.serviceWorkerPath
|
|
650
645
|
]);
|
|
651
|
-
const unregister = (0,
|
|
646
|
+
const unregister = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
652
647
|
if (!devicePushToken) {
|
|
653
648
|
return;
|
|
654
649
|
}
|
|
@@ -663,7 +658,7 @@ function useNotifications(options) {
|
|
|
663
658
|
});
|
|
664
659
|
setDevicePushToken(null);
|
|
665
660
|
}), [options.apiBaseUrl, options.apiKey, devicePushToken]);
|
|
666
|
-
const addReceivedListener = (0,
|
|
661
|
+
const addReceivedListener = (0, import_react5.useCallback)(
|
|
667
662
|
(listener) => {
|
|
668
663
|
if (isWebRef.current) {
|
|
669
664
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -692,7 +687,7 @@ function useNotifications(options) {
|
|
|
692
687
|
},
|
|
693
688
|
[]
|
|
694
689
|
);
|
|
695
|
-
const addResponseListener = (0,
|
|
690
|
+
const addResponseListener = (0, import_react5.useCallback)(
|
|
696
691
|
(listener) => {
|
|
697
692
|
if (isWebRef.current) {
|
|
698
693
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -721,7 +716,7 @@ function useNotifications(options) {
|
|
|
721
716
|
},
|
|
722
717
|
[]
|
|
723
718
|
);
|
|
724
|
-
const getBadgeCount = (0,
|
|
719
|
+
const getBadgeCount = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
725
720
|
var _a2;
|
|
726
721
|
const expo = expoRef.current;
|
|
727
722
|
if (!(expo == null ? void 0 : expo.getBadgeCountAsync)) {
|
|
@@ -729,7 +724,7 @@ function useNotifications(options) {
|
|
|
729
724
|
}
|
|
730
725
|
return (_a2 = yield expo.getBadgeCountAsync()) != null ? _a2 : 0;
|
|
731
726
|
}), []);
|
|
732
|
-
const setBadgeCount = (0,
|
|
727
|
+
const setBadgeCount = (0, import_react5.useCallback)((count) => __async(null, null, function* () {
|
|
733
728
|
const expo = expoRef.current;
|
|
734
729
|
if (!(expo == null ? void 0 : expo.setBadgeCountAsync)) {
|
|
735
730
|
return;
|
|
@@ -737,7 +732,7 @@ function useNotifications(options) {
|
|
|
737
732
|
yield expo.setBadgeCountAsync(count);
|
|
738
733
|
}), []);
|
|
739
734
|
const autoRegister = options.autoRegister !== false;
|
|
740
|
-
(0,
|
|
735
|
+
(0, import_react5.useEffect)(() => {
|
|
741
736
|
if (!autoRegister) {
|
|
742
737
|
return;
|
|
743
738
|
}
|
|
@@ -795,8 +790,8 @@ function detectPlatform(tokenType) {
|
|
|
795
790
|
}
|
|
796
791
|
|
|
797
792
|
// src/react/provider.ts
|
|
798
|
-
var
|
|
799
|
-
var
|
|
793
|
+
var import_react6 = require("convex/react");
|
|
794
|
+
var import_react7 = require("react");
|
|
800
795
|
var CONVEX_URLS = {
|
|
801
796
|
local: "https://courteous-duck-623.convex.cloud",
|
|
802
797
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -819,12 +814,12 @@ function TruthProvider({
|
|
|
819
814
|
children
|
|
820
815
|
}) {
|
|
821
816
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
822
|
-
const client = (0,
|
|
823
|
-
return (0,
|
|
817
|
+
const client = (0, import_react7.useMemo)(() => new import_react6.ConvexReactClient(url), [url]);
|
|
818
|
+
return (0, import_react7.createElement)(import_react6.ConvexProvider, { client }, children);
|
|
824
819
|
}
|
|
825
820
|
|
|
826
821
|
// src/react/tracking.ts
|
|
827
|
-
var
|
|
822
|
+
var import_react8 = require("react");
|
|
828
823
|
|
|
829
824
|
// src/tracking/tracker.ts
|
|
830
825
|
function generateUuidV7() {
|
|
@@ -1019,7 +1014,7 @@ function sleep(ms) {
|
|
|
1019
1014
|
}
|
|
1020
1015
|
|
|
1021
1016
|
// src/react/tracking.ts
|
|
1022
|
-
var TruthTrackingContext = (0,
|
|
1017
|
+
var TruthTrackingContext = (0, import_react8.createContext)(
|
|
1023
1018
|
null
|
|
1024
1019
|
);
|
|
1025
1020
|
function TruthTrackingProvider({
|
|
@@ -1030,7 +1025,7 @@ function TruthTrackingProvider({
|
|
|
1030
1025
|
apiKey = "",
|
|
1031
1026
|
children
|
|
1032
1027
|
}) {
|
|
1033
|
-
const value = (0,
|
|
1028
|
+
const value = (0, import_react8.useMemo)(() => {
|
|
1034
1029
|
const tracker = new Tracker({
|
|
1035
1030
|
apiKey,
|
|
1036
1031
|
environment,
|
|
@@ -1049,10 +1044,10 @@ function TruthTrackingProvider({
|
|
|
1049
1044
|
}
|
|
1050
1045
|
};
|
|
1051
1046
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1052
|
-
return (0,
|
|
1047
|
+
return (0, import_react8.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1053
1048
|
}
|
|
1054
1049
|
function useTruth() {
|
|
1055
|
-
const ctx = (0,
|
|
1050
|
+
const ctx = (0, import_react8.useContext)(TruthTrackingContext);
|
|
1056
1051
|
if (!ctx) {
|
|
1057
1052
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1058
1053
|
}
|
|
@@ -1062,17 +1057,16 @@ function useTruth() {
|
|
|
1062
1057
|
0 && (module.exports = {
|
|
1063
1058
|
TruthProvider,
|
|
1064
1059
|
TruthTrackingProvider,
|
|
1060
|
+
useActiveCalls,
|
|
1065
1061
|
useAppointment,
|
|
1066
1062
|
useAppointmentByElationId,
|
|
1067
1063
|
useAppointments,
|
|
1068
1064
|
useConversationByPhonePair,
|
|
1069
1065
|
useConversationMessages,
|
|
1070
|
-
useConversationNotes,
|
|
1071
|
-
useConversationNotesByPhonePair,
|
|
1072
|
-
useConversationTasks,
|
|
1073
|
-
useConversationTasksByPhonePair,
|
|
1074
|
-
useConversationTasksForUser,
|
|
1075
1066
|
useConversations,
|
|
1067
|
+
useDialpadCallByCallId,
|
|
1068
|
+
useDialpadCallLog,
|
|
1069
|
+
useDialpadCallsForConversation,
|
|
1076
1070
|
useMessages,
|
|
1077
1071
|
useNotifications,
|
|
1078
1072
|
usePatient,
|