@hipnation-truth/sdk 0.10.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 +73 -64
- package/dist/react.js +144 -139
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -58,16 +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
67
|
useConversations: () => useConversations,
|
|
68
|
+
useDialpadCallByCallId: () => useDialpadCallByCallId,
|
|
69
|
+
useDialpadCallLog: () => useDialpadCallLog,
|
|
70
|
+
useDialpadCallsForConversation: () => useDialpadCallsForConversation,
|
|
71
71
|
useMessages: () => useMessages,
|
|
72
72
|
useNotifications: () => useNotifications,
|
|
73
73
|
usePatient: () => usePatient,
|
|
@@ -85,18 +85,13 @@ __export(react_exports, {
|
|
|
85
85
|
});
|
|
86
86
|
module.exports = __toCommonJS(react_exports);
|
|
87
87
|
|
|
88
|
-
// src/react/
|
|
88
|
+
// src/react/calls.ts
|
|
89
89
|
var import_react = require("convex/react");
|
|
90
90
|
var import_server = require("convex/server");
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
var conversationMessagesGetByConversationIdRef = (0, import_server.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
96
|
-
var conversationNotesListForConversationRef = (0, import_server.makeFunctionReference)("conversationNotes:listForConversation");
|
|
97
|
-
var conversationTasksListForConversationRef = (0, import_server.makeFunctionReference)("conversationTasks:listForConversation");
|
|
98
|
-
var conversationNotesListByPhonePairRef = (0, import_server.makeFunctionReference)("conversationNotes:listByPhonePair");
|
|
99
|
-
var conversationTasksListByPhonePairRef = (0, import_server.makeFunctionReference)("conversationTasks:listByPhonePair");
|
|
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");
|
|
100
95
|
var SKIP = "skip";
|
|
101
96
|
function toResult(value, skipped) {
|
|
102
97
|
if (skipped) {
|
|
@@ -108,40 +103,17 @@ function toResult(value, skipped) {
|
|
|
108
103
|
error: void 0
|
|
109
104
|
};
|
|
110
105
|
}
|
|
111
|
-
function
|
|
112
|
-
var _a, _b;
|
|
113
|
-
const trimmedSearch = (_b = (_a = filters.search) == null ? void 0 : _a.trim()) != null ? _b : "";
|
|
114
|
-
const isSearchMode = trimmedSearch.length > 0;
|
|
115
|
-
const skipped = !filters.userId;
|
|
116
|
-
const listResult = (0, import_react.useQuery)(
|
|
117
|
-
conversationsListForUserRef,
|
|
118
|
-
skipped || isSearchMode ? SKIP : {
|
|
119
|
-
userId: filters.userId,
|
|
120
|
-
limit: filters.limit
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
const searchResult = (0, import_react.useQuery)(
|
|
124
|
-
conversationsSearchForUserRef,
|
|
125
|
-
skipped || !isSearchMode ? SKIP : {
|
|
126
|
-
userId: filters.userId,
|
|
127
|
-
search: trimmedSearch,
|
|
128
|
-
limit: filters.limit
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
return toResult(isSearchMode ? searchResult : listResult, skipped);
|
|
132
|
-
}
|
|
133
|
-
function useConversationByPhonePair(phonePair) {
|
|
134
|
-
const skipped = !phonePair;
|
|
106
|
+
function useActiveCalls(options) {
|
|
135
107
|
const result = (0, import_react.useQuery)(
|
|
136
|
-
|
|
137
|
-
|
|
108
|
+
listActiveRef,
|
|
109
|
+
options != null ? options : {}
|
|
138
110
|
);
|
|
139
|
-
return toResult(result,
|
|
111
|
+
return toResult(result, false);
|
|
140
112
|
}
|
|
141
|
-
function
|
|
113
|
+
function useDialpadCallsForConversation(conversationId, options) {
|
|
142
114
|
const skipped = !conversationId;
|
|
143
115
|
const result = (0, import_react.useQuery)(
|
|
144
|
-
|
|
116
|
+
listForConversationRef,
|
|
145
117
|
skipped ? SKIP : {
|
|
146
118
|
conversationId,
|
|
147
119
|
limit: options == null ? void 0 : options.limit
|
|
@@ -149,124 +121,157 @@ function useMessages(conversationId, options) {
|
|
|
149
121
|
);
|
|
150
122
|
return toResult(result, skipped);
|
|
151
123
|
}
|
|
152
|
-
function
|
|
153
|
-
const skipped = !
|
|
124
|
+
function useDialpadCallByCallId(callId) {
|
|
125
|
+
const skipped = !callId;
|
|
154
126
|
const result = (0, import_react.useQuery)(
|
|
155
|
-
|
|
156
|
-
skipped ? SKIP : {
|
|
127
|
+
getByCallIdRef,
|
|
128
|
+
skipped ? SKIP : { callId }
|
|
157
129
|
);
|
|
158
130
|
return toResult(result, skipped);
|
|
159
131
|
}
|
|
160
|
-
function
|
|
161
|
-
const skipped = !
|
|
132
|
+
function useDialpadCallLog(callId, options) {
|
|
133
|
+
const skipped = !callId;
|
|
162
134
|
const result = (0, import_react.useQuery)(
|
|
163
|
-
|
|
164
|
-
skipped ? SKIP : {
|
|
135
|
+
listLogForCallIdRef,
|
|
136
|
+
skipped ? SKIP : { callId, limit: options == null ? void 0 : options.limit }
|
|
165
137
|
);
|
|
166
138
|
return toResult(result, skipped);
|
|
167
139
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
+
}
|
|
173
167
|
);
|
|
174
|
-
return
|
|
168
|
+
return toResult2(result, skipped);
|
|
175
169
|
}
|
|
176
|
-
function
|
|
170
|
+
function useConversationByPhonePair(phonePair) {
|
|
177
171
|
const skipped = !phonePair;
|
|
178
|
-
const result = (0,
|
|
179
|
-
|
|
180
|
-
skipped ?
|
|
172
|
+
const result = (0, import_react2.useQuery)(
|
|
173
|
+
conversationsGetByPhonePairRef,
|
|
174
|
+
skipped ? SKIP2 : { phonePair }
|
|
181
175
|
);
|
|
182
|
-
return
|
|
176
|
+
return toResult2(result, skipped);
|
|
183
177
|
}
|
|
184
|
-
function
|
|
185
|
-
const skipped = !
|
|
186
|
-
const result = (0,
|
|
187
|
-
|
|
188
|
-
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
|
+
}
|
|
189
186
|
);
|
|
190
|
-
return
|
|
187
|
+
return toResult2(result, skipped);
|
|
188
|
+
}
|
|
189
|
+
function useUnreadCount(userId) {
|
|
190
|
+
const skipped = !userId;
|
|
191
|
+
const result = (0, import_react2.useQuery)(
|
|
192
|
+
conversationsGetUnreadTotalForUserRef,
|
|
193
|
+
skipped ? SKIP2 : { userId }
|
|
194
|
+
);
|
|
195
|
+
return toResult2(result, skipped);
|
|
191
196
|
}
|
|
192
197
|
|
|
193
198
|
// src/react/hooks.ts
|
|
194
|
-
var
|
|
195
|
-
var
|
|
196
|
-
var
|
|
197
|
-
var patientsListRef = (0,
|
|
198
|
-
var patientsGetRef = (0,
|
|
199
|
-
var patientsByElationIdRef = (0,
|
|
200
|
-
var patientsByHintIdRef = (0,
|
|
201
|
-
var appointmentsListRef = (0,
|
|
202
|
-
var appointmentsGetRef = (0,
|
|
203
|
-
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");
|
|
204
209
|
function usePatients(options) {
|
|
205
|
-
return (0,
|
|
210
|
+
return (0, import_react3.useQuery)(patientsListRef, options != null ? options : {});
|
|
206
211
|
}
|
|
207
212
|
function usePatient(id) {
|
|
208
|
-
return (0,
|
|
213
|
+
return (0, import_react3.useQuery)(patientsGetRef, { id });
|
|
209
214
|
}
|
|
210
215
|
function usePatientByElationId(elationId) {
|
|
211
|
-
return (0,
|
|
216
|
+
return (0, import_react3.useQuery)(patientsByElationIdRef, {
|
|
212
217
|
elationId
|
|
213
218
|
});
|
|
214
219
|
}
|
|
215
220
|
function usePatientByHintId(hintId) {
|
|
216
|
-
return (0,
|
|
221
|
+
return (0, import_react3.useQuery)(patientsByHintIdRef, {
|
|
217
222
|
hintId
|
|
218
223
|
});
|
|
219
224
|
}
|
|
220
225
|
function useAppointments(options) {
|
|
221
|
-
return (0,
|
|
226
|
+
return (0, import_react3.useQuery)(
|
|
222
227
|
appointmentsListRef,
|
|
223
228
|
options != null ? options : {}
|
|
224
229
|
);
|
|
225
230
|
}
|
|
226
231
|
function useAppointment(id) {
|
|
227
|
-
return (0,
|
|
232
|
+
return (0, import_react3.useQuery)(appointmentsGetRef, { id });
|
|
228
233
|
}
|
|
229
234
|
function useAppointmentByElationId(elationId) {
|
|
230
|
-
return (0,
|
|
235
|
+
return (0, import_react3.useQuery)(appointmentsByElationIdRef, {
|
|
231
236
|
elationId
|
|
232
237
|
});
|
|
233
238
|
}
|
|
234
|
-
var physiciansGetByElationIdsRef = (0,
|
|
235
|
-
var physiciansGetByElationIdRef = (0,
|
|
239
|
+
var physiciansGetByElationIdsRef = (0, import_server3.makeFunctionReference)("physicians:getByElationIds");
|
|
240
|
+
var physiciansGetByElationIdRef = (0, import_server3.makeFunctionReference)("physicians:getByElationId");
|
|
236
241
|
function usePhysiciansByElationIds(ids) {
|
|
237
|
-
return (0,
|
|
242
|
+
return (0, import_react3.useQuery)(
|
|
238
243
|
physiciansGetByElationIdsRef,
|
|
239
244
|
ids && ids.length > 0 ? { ids } : "skip"
|
|
240
245
|
);
|
|
241
246
|
}
|
|
242
247
|
function usePhysicianByElationId(id) {
|
|
243
|
-
return (0,
|
|
248
|
+
return (0, import_react3.useQuery)(
|
|
244
249
|
physiciansGetByElationIdRef,
|
|
245
250
|
id !== void 0 ? { id } : "skip"
|
|
246
251
|
);
|
|
247
252
|
}
|
|
248
|
-
var medicationsByPatientRef = (0,
|
|
249
|
-
var problemsByPatientRef = (0,
|
|
250
|
-
var allergiesByPatientRef = (0,
|
|
251
|
-
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");
|
|
252
257
|
function usePatientMedical(elationId, options) {
|
|
253
|
-
const medications = (0,
|
|
258
|
+
const medications = (0, import_react3.useQuery)(
|
|
254
259
|
medicationsByPatientRef,
|
|
255
260
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
256
261
|
);
|
|
257
|
-
const problems = (0,
|
|
262
|
+
const problems = (0, import_react3.useQuery)(
|
|
258
263
|
problemsByPatientRef,
|
|
259
264
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
260
265
|
);
|
|
261
|
-
const allergies = (0,
|
|
266
|
+
const allergies = (0, import_react3.useQuery)(
|
|
262
267
|
allergiesByPatientRef,
|
|
263
268
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
264
269
|
);
|
|
265
|
-
const appointments = (0,
|
|
270
|
+
const appointments = (0, import_react3.useQuery)(
|
|
266
271
|
appointmentsByPatientRef,
|
|
267
272
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
268
273
|
);
|
|
269
|
-
(0,
|
|
274
|
+
(0, import_react4.useEffect)(() => {
|
|
270
275
|
if (elationId === void 0 || (options == null ? void 0 : options.skipRefresh)) {
|
|
271
276
|
return;
|
|
272
277
|
}
|
|
@@ -290,21 +295,21 @@ function usePatientMedical(elationId, options) {
|
|
|
290
295
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
291
296
|
return { medications, problems, allergies, appointments };
|
|
292
297
|
}
|
|
293
|
-
var elationPatientByIdRef = (0,
|
|
294
|
-
var hintPatientByIdRef = (0,
|
|
295
|
-
var pharmacyByNcpdpRef = (0,
|
|
296
|
-
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");
|
|
297
302
|
function usePatientBasic(input, options) {
|
|
298
303
|
var _a, _b;
|
|
299
|
-
const elationRow = (0,
|
|
304
|
+
const elationRow = (0, import_react3.useQuery)(
|
|
300
305
|
elationPatientByIdRef,
|
|
301
306
|
input.elationId !== void 0 ? { elationId: input.elationId } : "skip"
|
|
302
307
|
);
|
|
303
|
-
const hintRow = (0,
|
|
308
|
+
const hintRow = (0, import_react3.useQuery)(
|
|
304
309
|
hintPatientByIdRef,
|
|
305
310
|
input.hintId !== void 0 ? { hintId: input.hintId } : "skip"
|
|
306
311
|
);
|
|
307
|
-
(0,
|
|
312
|
+
(0, import_react4.useEffect)(() => {
|
|
308
313
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
309
314
|
return;
|
|
310
315
|
}
|
|
@@ -351,17 +356,17 @@ function usePatientBasic(input, options) {
|
|
|
351
356
|
};
|
|
352
357
|
}
|
|
353
358
|
function usePharmacyByNcpdpId(ncpdpId) {
|
|
354
|
-
return (0,
|
|
359
|
+
return (0, import_react3.useQuery)(
|
|
355
360
|
pharmacyByNcpdpRef,
|
|
356
361
|
ncpdpId ? { ncpdpId } : "skip"
|
|
357
362
|
);
|
|
358
363
|
}
|
|
359
364
|
function usePatientPhoto(elationId, options) {
|
|
360
|
-
const photo = (0,
|
|
365
|
+
const photo = (0, import_react3.useQuery)(
|
|
361
366
|
patientPhotoByIdRef,
|
|
362
367
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
363
368
|
);
|
|
364
|
-
(0,
|
|
369
|
+
(0, import_react4.useEffect)(() => {
|
|
365
370
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
366
371
|
return;
|
|
367
372
|
}
|
|
@@ -388,11 +393,11 @@ function usePatientPhoto(elationId, options) {
|
|
|
388
393
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
389
394
|
return photo;
|
|
390
395
|
}
|
|
391
|
-
var messagesByPhonesRef = (0,
|
|
392
|
-
var messagesByConversationIdRef = (0,
|
|
396
|
+
var messagesByPhonesRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByPhones");
|
|
397
|
+
var messagesByConversationIdRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
393
398
|
function useConversationMessages(input, options) {
|
|
394
399
|
const hasPair = !!input.phoneA && !!input.phoneB;
|
|
395
|
-
const byPair = (0,
|
|
400
|
+
const byPair = (0, import_react3.useQuery)(
|
|
396
401
|
messagesByPhonesRef,
|
|
397
402
|
hasPair ? {
|
|
398
403
|
phoneA: input.phoneA,
|
|
@@ -400,7 +405,7 @@ function useConversationMessages(input, options) {
|
|
|
400
405
|
limit: options == null ? void 0 : options.limit
|
|
401
406
|
} : "skip"
|
|
402
407
|
);
|
|
403
|
-
const byConvo = (0,
|
|
408
|
+
const byConvo = (0, import_react3.useQuery)(
|
|
404
409
|
messagesByConversationIdRef,
|
|
405
410
|
!hasPair && input.conversationId ? { conversationId: input.conversationId, limit: options == null ? void 0 : options.limit } : "skip"
|
|
406
411
|
);
|
|
@@ -408,7 +413,7 @@ function useConversationMessages(input, options) {
|
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
// src/react/notifications.ts
|
|
411
|
-
var
|
|
416
|
+
var import_react5 = require("react");
|
|
412
417
|
|
|
413
418
|
// src/web-push.ts
|
|
414
419
|
function isWebPushSupported() {
|
|
@@ -467,12 +472,12 @@ function loadExpo() {
|
|
|
467
472
|
}
|
|
468
473
|
function useNotifications(options) {
|
|
469
474
|
var _a;
|
|
470
|
-
const [permissionStatus, setPermissionStatus] = (0,
|
|
471
|
-
const [devicePushToken, setDevicePushToken] = (0,
|
|
472
|
-
const expoRef = (0,
|
|
473
|
-
const isWebRef = (0,
|
|
474
|
-
const vapidKeyRef = (0,
|
|
475
|
-
(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)(() => {
|
|
476
481
|
let mounted = true;
|
|
477
482
|
void (() => __async(null, null, function* () {
|
|
478
483
|
var _a2;
|
|
@@ -528,7 +533,7 @@ function useNotifications(options) {
|
|
|
528
533
|
mounted = false;
|
|
529
534
|
};
|
|
530
535
|
}, [options.apiBaseUrl, options.apiKey]);
|
|
531
|
-
const register = (0,
|
|
536
|
+
const register = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
532
537
|
var _a2, _b;
|
|
533
538
|
if (!options.userId) {
|
|
534
539
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -638,7 +643,7 @@ function useNotifications(options) {
|
|
|
638
643
|
options.appVersion,
|
|
639
644
|
options.serviceWorkerPath
|
|
640
645
|
]);
|
|
641
|
-
const unregister = (0,
|
|
646
|
+
const unregister = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
642
647
|
if (!devicePushToken) {
|
|
643
648
|
return;
|
|
644
649
|
}
|
|
@@ -653,7 +658,7 @@ function useNotifications(options) {
|
|
|
653
658
|
});
|
|
654
659
|
setDevicePushToken(null);
|
|
655
660
|
}), [options.apiBaseUrl, options.apiKey, devicePushToken]);
|
|
656
|
-
const addReceivedListener = (0,
|
|
661
|
+
const addReceivedListener = (0, import_react5.useCallback)(
|
|
657
662
|
(listener) => {
|
|
658
663
|
if (isWebRef.current) {
|
|
659
664
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -682,7 +687,7 @@ function useNotifications(options) {
|
|
|
682
687
|
},
|
|
683
688
|
[]
|
|
684
689
|
);
|
|
685
|
-
const addResponseListener = (0,
|
|
690
|
+
const addResponseListener = (0, import_react5.useCallback)(
|
|
686
691
|
(listener) => {
|
|
687
692
|
if (isWebRef.current) {
|
|
688
693
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -711,7 +716,7 @@ function useNotifications(options) {
|
|
|
711
716
|
},
|
|
712
717
|
[]
|
|
713
718
|
);
|
|
714
|
-
const getBadgeCount = (0,
|
|
719
|
+
const getBadgeCount = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
715
720
|
var _a2;
|
|
716
721
|
const expo = expoRef.current;
|
|
717
722
|
if (!(expo == null ? void 0 : expo.getBadgeCountAsync)) {
|
|
@@ -719,7 +724,7 @@ function useNotifications(options) {
|
|
|
719
724
|
}
|
|
720
725
|
return (_a2 = yield expo.getBadgeCountAsync()) != null ? _a2 : 0;
|
|
721
726
|
}), []);
|
|
722
|
-
const setBadgeCount = (0,
|
|
727
|
+
const setBadgeCount = (0, import_react5.useCallback)((count) => __async(null, null, function* () {
|
|
723
728
|
const expo = expoRef.current;
|
|
724
729
|
if (!(expo == null ? void 0 : expo.setBadgeCountAsync)) {
|
|
725
730
|
return;
|
|
@@ -727,7 +732,7 @@ function useNotifications(options) {
|
|
|
727
732
|
yield expo.setBadgeCountAsync(count);
|
|
728
733
|
}), []);
|
|
729
734
|
const autoRegister = options.autoRegister !== false;
|
|
730
|
-
(0,
|
|
735
|
+
(0, import_react5.useEffect)(() => {
|
|
731
736
|
if (!autoRegister) {
|
|
732
737
|
return;
|
|
733
738
|
}
|
|
@@ -785,8 +790,8 @@ function detectPlatform(tokenType) {
|
|
|
785
790
|
}
|
|
786
791
|
|
|
787
792
|
// src/react/provider.ts
|
|
788
|
-
var
|
|
789
|
-
var
|
|
793
|
+
var import_react6 = require("convex/react");
|
|
794
|
+
var import_react7 = require("react");
|
|
790
795
|
var CONVEX_URLS = {
|
|
791
796
|
local: "https://courteous-duck-623.convex.cloud",
|
|
792
797
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -809,12 +814,12 @@ function TruthProvider({
|
|
|
809
814
|
children
|
|
810
815
|
}) {
|
|
811
816
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
812
|
-
const client = (0,
|
|
813
|
-
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);
|
|
814
819
|
}
|
|
815
820
|
|
|
816
821
|
// src/react/tracking.ts
|
|
817
|
-
var
|
|
822
|
+
var import_react8 = require("react");
|
|
818
823
|
|
|
819
824
|
// src/tracking/tracker.ts
|
|
820
825
|
function generateUuidV7() {
|
|
@@ -1009,7 +1014,7 @@ function sleep(ms) {
|
|
|
1009
1014
|
}
|
|
1010
1015
|
|
|
1011
1016
|
// src/react/tracking.ts
|
|
1012
|
-
var TruthTrackingContext = (0,
|
|
1017
|
+
var TruthTrackingContext = (0, import_react8.createContext)(
|
|
1013
1018
|
null
|
|
1014
1019
|
);
|
|
1015
1020
|
function TruthTrackingProvider({
|
|
@@ -1020,7 +1025,7 @@ function TruthTrackingProvider({
|
|
|
1020
1025
|
apiKey = "",
|
|
1021
1026
|
children
|
|
1022
1027
|
}) {
|
|
1023
|
-
const value = (0,
|
|
1028
|
+
const value = (0, import_react8.useMemo)(() => {
|
|
1024
1029
|
const tracker = new Tracker({
|
|
1025
1030
|
apiKey,
|
|
1026
1031
|
environment,
|
|
@@ -1039,10 +1044,10 @@ function TruthTrackingProvider({
|
|
|
1039
1044
|
}
|
|
1040
1045
|
};
|
|
1041
1046
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1042
|
-
return (0,
|
|
1047
|
+
return (0, import_react8.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1043
1048
|
}
|
|
1044
1049
|
function useTruth() {
|
|
1045
|
-
const ctx = (0,
|
|
1050
|
+
const ctx = (0, import_react8.useContext)(TruthTrackingContext);
|
|
1046
1051
|
if (!ctx) {
|
|
1047
1052
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1048
1053
|
}
|
|
@@ -1052,16 +1057,16 @@ function useTruth() {
|
|
|
1052
1057
|
0 && (module.exports = {
|
|
1053
1058
|
TruthProvider,
|
|
1054
1059
|
TruthTrackingProvider,
|
|
1060
|
+
useActiveCalls,
|
|
1055
1061
|
useAppointment,
|
|
1056
1062
|
useAppointmentByElationId,
|
|
1057
1063
|
useAppointments,
|
|
1058
1064
|
useConversationByPhonePair,
|
|
1059
1065
|
useConversationMessages,
|
|
1060
|
-
useConversationNotes,
|
|
1061
|
-
useConversationNotesByPhonePair,
|
|
1062
|
-
useConversationTasks,
|
|
1063
|
-
useConversationTasksByPhonePair,
|
|
1064
1066
|
useConversations,
|
|
1067
|
+
useDialpadCallByCallId,
|
|
1068
|
+
useDialpadCallLog,
|
|
1069
|
+
useDialpadCallsForConversation,
|
|
1065
1070
|
useMessages,
|
|
1066
1071
|
useNotifications,
|
|
1067
1072
|
usePatient,
|