@hipnation-truth/sdk 0.11.0 → 0.13.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 +95 -79
- package/dist/react.js +177 -148
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -56,19 +56,23 @@ var __async = (__this, __arguments, generator) => {
|
|
|
56
56
|
// src/react.ts
|
|
57
57
|
var react_exports = {};
|
|
58
58
|
__export(react_exports, {
|
|
59
|
+
ACTIVE_CALL_STATES: () => ACTIVE_CALL_STATES,
|
|
60
|
+
CONNECTED_CALL_STATES: () => CONNECTED_CALL_STATES,
|
|
61
|
+
DialpadCallState: () => DialpadCallState,
|
|
62
|
+
RINGING_CALL_STATES: () => RINGING_CALL_STATES,
|
|
63
|
+
TERMINAL_CALL_STATES: () => TERMINAL_CALL_STATES,
|
|
59
64
|
TruthProvider: () => TruthProvider,
|
|
60
65
|
TruthTrackingProvider: () => TruthTrackingProvider,
|
|
66
|
+
useActiveCalls: () => useActiveCalls,
|
|
61
67
|
useAppointment: () => useAppointment,
|
|
62
68
|
useAppointmentByElationId: () => useAppointmentByElationId,
|
|
63
69
|
useAppointments: () => useAppointments,
|
|
64
70
|
useConversationByPhonePair: () => useConversationByPhonePair,
|
|
65
71
|
useConversationMessages: () => useConversationMessages,
|
|
66
|
-
useConversationNotes: () => useConversationNotes,
|
|
67
|
-
useConversationNotesByPhonePair: () => useConversationNotesByPhonePair,
|
|
68
|
-
useConversationTasks: () => useConversationTasks,
|
|
69
|
-
useConversationTasksByPhonePair: () => useConversationTasksByPhonePair,
|
|
70
|
-
useConversationTasksForUser: () => useConversationTasksForUser,
|
|
71
72
|
useConversations: () => useConversations,
|
|
73
|
+
useDialpadCallByCallId: () => useDialpadCallByCallId,
|
|
74
|
+
useDialpadCallLog: () => useDialpadCallLog,
|
|
75
|
+
useDialpadCallsForConversation: () => useDialpadCallsForConversation,
|
|
72
76
|
useMessages: () => useMessages,
|
|
73
77
|
useNotifications: () => useNotifications,
|
|
74
78
|
usePatient: () => usePatient,
|
|
@@ -86,19 +90,38 @@ __export(react_exports, {
|
|
|
86
90
|
});
|
|
87
91
|
module.exports = __toCommonJS(react_exports);
|
|
88
92
|
|
|
89
|
-
// src/react/
|
|
93
|
+
// src/react/calls.ts
|
|
90
94
|
var import_react = require("convex/react");
|
|
91
95
|
var import_server = require("convex/server");
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var
|
|
96
|
+
var DialpadCallState = {
|
|
97
|
+
Calling: "calling",
|
|
98
|
+
Ringing: "ringing",
|
|
99
|
+
Connected: "connected",
|
|
100
|
+
Hold: "hold",
|
|
101
|
+
Hangup: "hangup",
|
|
102
|
+
Missed: "missed",
|
|
103
|
+
VoicemailUploaded: "voicemail_uploaded"
|
|
104
|
+
};
|
|
105
|
+
var RINGING_CALL_STATES = /* @__PURE__ */ new Set([
|
|
106
|
+
DialpadCallState.Calling,
|
|
107
|
+
DialpadCallState.Ringing
|
|
108
|
+
]);
|
|
109
|
+
var CONNECTED_CALL_STATES = /* @__PURE__ */ new Set([
|
|
110
|
+
DialpadCallState.Connected
|
|
111
|
+
]);
|
|
112
|
+
var ACTIVE_CALL_STATES = /* @__PURE__ */ new Set([
|
|
113
|
+
...RINGING_CALL_STATES,
|
|
114
|
+
...CONNECTED_CALL_STATES
|
|
115
|
+
]);
|
|
116
|
+
var TERMINAL_CALL_STATES = /* @__PURE__ */ new Set([
|
|
117
|
+
DialpadCallState.Hangup,
|
|
118
|
+
DialpadCallState.Missed,
|
|
119
|
+
DialpadCallState.VoicemailUploaded
|
|
120
|
+
]);
|
|
121
|
+
var listActiveRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:listActive");
|
|
122
|
+
var listForConversationRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:listForConversation");
|
|
123
|
+
var getByCallIdRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:getByCallId");
|
|
124
|
+
var listLogForCallIdRef = (0, import_server.makeFunctionReference)("dialpadCallEvents:listLogForCallId");
|
|
102
125
|
var SKIP = "skip";
|
|
103
126
|
function toResult(value, skipped) {
|
|
104
127
|
if (skipped) {
|
|
@@ -110,40 +133,17 @@ function toResult(value, skipped) {
|
|
|
110
133
|
error: void 0
|
|
111
134
|
};
|
|
112
135
|
}
|
|
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;
|
|
136
|
+
function useActiveCalls(options) {
|
|
137
137
|
const result = (0, import_react.useQuery)(
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
listActiveRef,
|
|
139
|
+
options != null ? options : {}
|
|
140
140
|
);
|
|
141
|
-
return toResult(result,
|
|
141
|
+
return toResult(result, false);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function useDialpadCallsForConversation(conversationId, options) {
|
|
144
144
|
const skipped = !conversationId;
|
|
145
145
|
const result = (0, import_react.useQuery)(
|
|
146
|
-
|
|
146
|
+
listForConversationRef,
|
|
147
147
|
skipped ? SKIP : {
|
|
148
148
|
conversationId,
|
|
149
149
|
limit: options == null ? void 0 : options.limit
|
|
@@ -151,132 +151,157 @@ function useMessages(conversationId, options) {
|
|
|
151
151
|
);
|
|
152
152
|
return toResult(result, skipped);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
const skipped = !
|
|
154
|
+
function useDialpadCallByCallId(callId) {
|
|
155
|
+
const skipped = !callId;
|
|
156
156
|
const result = (0, import_react.useQuery)(
|
|
157
|
-
|
|
158
|
-
skipped ? SKIP : {
|
|
157
|
+
getByCallIdRef,
|
|
158
|
+
skipped ? SKIP : { callId }
|
|
159
159
|
);
|
|
160
160
|
return toResult(result, skipped);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const skipped = !
|
|
162
|
+
function useDialpadCallLog(callId, options) {
|
|
163
|
+
const skipped = !callId;
|
|
164
164
|
const result = (0, import_react.useQuery)(
|
|
165
|
-
|
|
166
|
-
skipped ? SKIP : {
|
|
165
|
+
listLogForCallIdRef,
|
|
166
|
+
skipped ? SKIP : { callId, limit: options == null ? void 0 : options.limit }
|
|
167
167
|
);
|
|
168
168
|
return toResult(result, skipped);
|
|
169
169
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
|
|
171
|
+
// src/react/conversations.ts
|
|
172
|
+
var import_react2 = require("convex/react");
|
|
173
|
+
var import_server2 = require("convex/server");
|
|
174
|
+
var conversationsListForUserRef = (0, import_server2.makeFunctionReference)("conversations:listForUser");
|
|
175
|
+
var conversationsGetUnreadTotalForUserRef = (0, import_server2.makeFunctionReference)("conversations:getUnreadTotalForUser");
|
|
176
|
+
var conversationsGetByPhonePairRef = (0, import_server2.makeFunctionReference)("conversations:getByPhonePair");
|
|
177
|
+
var conversationMessagesGetByConversationIdRef = (0, import_server2.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
178
|
+
var SKIP2 = "skip";
|
|
179
|
+
function toResult2(value, skipped) {
|
|
180
|
+
if (skipped) {
|
|
181
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
data: value,
|
|
185
|
+
loading: value === void 0,
|
|
186
|
+
error: void 0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function useConversations(filters) {
|
|
190
|
+
const skipped = !filters.userId;
|
|
191
|
+
const result = (0, import_react2.useQuery)(
|
|
192
|
+
conversationsListForUserRef,
|
|
193
|
+
skipped ? SKIP2 : {
|
|
194
|
+
userId: filters.userId,
|
|
195
|
+
limit: filters.limit
|
|
196
|
+
}
|
|
175
197
|
);
|
|
176
|
-
return
|
|
198
|
+
return toResult2(result, skipped);
|
|
177
199
|
}
|
|
178
|
-
function
|
|
200
|
+
function useConversationByPhonePair(phonePair) {
|
|
179
201
|
const skipped = !phonePair;
|
|
180
|
-
const result = (0,
|
|
181
|
-
|
|
182
|
-
skipped ?
|
|
202
|
+
const result = (0, import_react2.useQuery)(
|
|
203
|
+
conversationsGetByPhonePairRef,
|
|
204
|
+
skipped ? SKIP2 : { phonePair }
|
|
183
205
|
);
|
|
184
|
-
return
|
|
206
|
+
return toResult2(result, skipped);
|
|
185
207
|
}
|
|
186
|
-
function
|
|
187
|
-
const skipped = !
|
|
188
|
-
const result = (0,
|
|
189
|
-
|
|
190
|
-
skipped ?
|
|
208
|
+
function useMessages(conversationId, options) {
|
|
209
|
+
const skipped = !conversationId;
|
|
210
|
+
const result = (0, import_react2.useQuery)(
|
|
211
|
+
conversationMessagesGetByConversationIdRef,
|
|
212
|
+
skipped ? SKIP2 : {
|
|
213
|
+
conversationId,
|
|
214
|
+
limit: options == null ? void 0 : options.limit
|
|
215
|
+
}
|
|
191
216
|
);
|
|
192
|
-
return
|
|
217
|
+
return toResult2(result, skipped);
|
|
193
218
|
}
|
|
194
|
-
function
|
|
195
|
-
const skipped = !
|
|
196
|
-
const result = (0,
|
|
197
|
-
|
|
198
|
-
skipped ?
|
|
219
|
+
function useUnreadCount(userId) {
|
|
220
|
+
const skipped = !userId;
|
|
221
|
+
const result = (0, import_react2.useQuery)(
|
|
222
|
+
conversationsGetUnreadTotalForUserRef,
|
|
223
|
+
skipped ? SKIP2 : { userId }
|
|
199
224
|
);
|
|
200
|
-
return
|
|
225
|
+
return toResult2(result, skipped);
|
|
201
226
|
}
|
|
202
227
|
|
|
203
228
|
// 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,
|
|
229
|
+
var import_react3 = require("convex/react");
|
|
230
|
+
var import_react4 = require("react");
|
|
231
|
+
var import_server3 = require("convex/server");
|
|
232
|
+
var patientsListRef = (0, import_server3.makeFunctionReference)("patients:list");
|
|
233
|
+
var patientsGetRef = (0, import_server3.makeFunctionReference)("patients:get");
|
|
234
|
+
var patientsByElationIdRef = (0, import_server3.makeFunctionReference)("patients:getByElationId");
|
|
235
|
+
var patientsByHintIdRef = (0, import_server3.makeFunctionReference)("patients:getByHintId");
|
|
236
|
+
var appointmentsListRef = (0, import_server3.makeFunctionReference)("appointments:list");
|
|
237
|
+
var appointmentsGetRef = (0, import_server3.makeFunctionReference)("appointments:get");
|
|
238
|
+
var appointmentsByElationIdRef = (0, import_server3.makeFunctionReference)("appointments:getByElationId");
|
|
214
239
|
function usePatients(options) {
|
|
215
|
-
return (0,
|
|
240
|
+
return (0, import_react3.useQuery)(patientsListRef, options != null ? options : {});
|
|
216
241
|
}
|
|
217
242
|
function usePatient(id) {
|
|
218
|
-
return (0,
|
|
243
|
+
return (0, import_react3.useQuery)(patientsGetRef, { id });
|
|
219
244
|
}
|
|
220
245
|
function usePatientByElationId(elationId) {
|
|
221
|
-
return (0,
|
|
246
|
+
return (0, import_react3.useQuery)(patientsByElationIdRef, {
|
|
222
247
|
elationId
|
|
223
248
|
});
|
|
224
249
|
}
|
|
225
250
|
function usePatientByHintId(hintId) {
|
|
226
|
-
return (0,
|
|
251
|
+
return (0, import_react3.useQuery)(patientsByHintIdRef, {
|
|
227
252
|
hintId
|
|
228
253
|
});
|
|
229
254
|
}
|
|
230
255
|
function useAppointments(options) {
|
|
231
|
-
return (0,
|
|
256
|
+
return (0, import_react3.useQuery)(
|
|
232
257
|
appointmentsListRef,
|
|
233
258
|
options != null ? options : {}
|
|
234
259
|
);
|
|
235
260
|
}
|
|
236
261
|
function useAppointment(id) {
|
|
237
|
-
return (0,
|
|
262
|
+
return (0, import_react3.useQuery)(appointmentsGetRef, { id });
|
|
238
263
|
}
|
|
239
264
|
function useAppointmentByElationId(elationId) {
|
|
240
|
-
return (0,
|
|
265
|
+
return (0, import_react3.useQuery)(appointmentsByElationIdRef, {
|
|
241
266
|
elationId
|
|
242
267
|
});
|
|
243
268
|
}
|
|
244
|
-
var physiciansGetByElationIdsRef = (0,
|
|
245
|
-
var physiciansGetByElationIdRef = (0,
|
|
269
|
+
var physiciansGetByElationIdsRef = (0, import_server3.makeFunctionReference)("physicians:getByElationIds");
|
|
270
|
+
var physiciansGetByElationIdRef = (0, import_server3.makeFunctionReference)("physicians:getByElationId");
|
|
246
271
|
function usePhysiciansByElationIds(ids) {
|
|
247
|
-
return (0,
|
|
272
|
+
return (0, import_react3.useQuery)(
|
|
248
273
|
physiciansGetByElationIdsRef,
|
|
249
274
|
ids && ids.length > 0 ? { ids } : "skip"
|
|
250
275
|
);
|
|
251
276
|
}
|
|
252
277
|
function usePhysicianByElationId(id) {
|
|
253
|
-
return (0,
|
|
278
|
+
return (0, import_react3.useQuery)(
|
|
254
279
|
physiciansGetByElationIdRef,
|
|
255
280
|
id !== void 0 ? { id } : "skip"
|
|
256
281
|
);
|
|
257
282
|
}
|
|
258
|
-
var medicationsByPatientRef = (0,
|
|
259
|
-
var problemsByPatientRef = (0,
|
|
260
|
-
var allergiesByPatientRef = (0,
|
|
261
|
-
var appointmentsByPatientRef = (0,
|
|
283
|
+
var medicationsByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getMedicationsByElationPatient");
|
|
284
|
+
var problemsByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getProblemsByElationPatient");
|
|
285
|
+
var allergiesByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getAllergiesByElationPatient");
|
|
286
|
+
var appointmentsByPatientRef = (0, import_server3.makeFunctionReference)("medicalRecords:getAppointmentsByElationPatient");
|
|
262
287
|
function usePatientMedical(elationId, options) {
|
|
263
|
-
const medications = (0,
|
|
288
|
+
const medications = (0, import_react3.useQuery)(
|
|
264
289
|
medicationsByPatientRef,
|
|
265
290
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
266
291
|
);
|
|
267
|
-
const problems = (0,
|
|
292
|
+
const problems = (0, import_react3.useQuery)(
|
|
268
293
|
problemsByPatientRef,
|
|
269
294
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
270
295
|
);
|
|
271
|
-
const allergies = (0,
|
|
296
|
+
const allergies = (0, import_react3.useQuery)(
|
|
272
297
|
allergiesByPatientRef,
|
|
273
298
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
274
299
|
);
|
|
275
|
-
const appointments = (0,
|
|
300
|
+
const appointments = (0, import_react3.useQuery)(
|
|
276
301
|
appointmentsByPatientRef,
|
|
277
302
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
278
303
|
);
|
|
279
|
-
(0,
|
|
304
|
+
(0, import_react4.useEffect)(() => {
|
|
280
305
|
if (elationId === void 0 || (options == null ? void 0 : options.skipRefresh)) {
|
|
281
306
|
return;
|
|
282
307
|
}
|
|
@@ -300,21 +325,21 @@ function usePatientMedical(elationId, options) {
|
|
|
300
325
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
301
326
|
return { medications, problems, allergies, appointments };
|
|
302
327
|
}
|
|
303
|
-
var elationPatientByIdRef = (0,
|
|
304
|
-
var hintPatientByIdRef = (0,
|
|
305
|
-
var pharmacyByNcpdpRef = (0,
|
|
306
|
-
var patientPhotoByIdRef = (0,
|
|
328
|
+
var elationPatientByIdRef = (0, import_server3.makeFunctionReference)("elationPatients:getByElationId");
|
|
329
|
+
var hintPatientByIdRef = (0, import_server3.makeFunctionReference)("hintPatients:getByHintId");
|
|
330
|
+
var pharmacyByNcpdpRef = (0, import_server3.makeFunctionReference)("elationPharmacies:getByNcpdpId");
|
|
331
|
+
var patientPhotoByIdRef = (0, import_server3.makeFunctionReference)("elationPatientPhotos:getByElationPatientId");
|
|
307
332
|
function usePatientBasic(input, options) {
|
|
308
333
|
var _a, _b;
|
|
309
|
-
const elationRow = (0,
|
|
334
|
+
const elationRow = (0, import_react3.useQuery)(
|
|
310
335
|
elationPatientByIdRef,
|
|
311
336
|
input.elationId !== void 0 ? { elationId: input.elationId } : "skip"
|
|
312
337
|
);
|
|
313
|
-
const hintRow = (0,
|
|
338
|
+
const hintRow = (0, import_react3.useQuery)(
|
|
314
339
|
hintPatientByIdRef,
|
|
315
340
|
input.hintId !== void 0 ? { hintId: input.hintId } : "skip"
|
|
316
341
|
);
|
|
317
|
-
(0,
|
|
342
|
+
(0, import_react4.useEffect)(() => {
|
|
318
343
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
319
344
|
return;
|
|
320
345
|
}
|
|
@@ -361,17 +386,17 @@ function usePatientBasic(input, options) {
|
|
|
361
386
|
};
|
|
362
387
|
}
|
|
363
388
|
function usePharmacyByNcpdpId(ncpdpId) {
|
|
364
|
-
return (0,
|
|
389
|
+
return (0, import_react3.useQuery)(
|
|
365
390
|
pharmacyByNcpdpRef,
|
|
366
391
|
ncpdpId ? { ncpdpId } : "skip"
|
|
367
392
|
);
|
|
368
393
|
}
|
|
369
394
|
function usePatientPhoto(elationId, options) {
|
|
370
|
-
const photo = (0,
|
|
395
|
+
const photo = (0, import_react3.useQuery)(
|
|
371
396
|
patientPhotoByIdRef,
|
|
372
397
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
373
398
|
);
|
|
374
|
-
(0,
|
|
399
|
+
(0, import_react4.useEffect)(() => {
|
|
375
400
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
376
401
|
return;
|
|
377
402
|
}
|
|
@@ -398,11 +423,11 @@ function usePatientPhoto(elationId, options) {
|
|
|
398
423
|
}, [elationId, options == null ? void 0 : options.apiBaseUrl, options == null ? void 0 : options.apiKey, options == null ? void 0 : options.skipRefresh]);
|
|
399
424
|
return photo;
|
|
400
425
|
}
|
|
401
|
-
var messagesByPhonesRef = (0,
|
|
402
|
-
var messagesByConversationIdRef = (0,
|
|
426
|
+
var messagesByPhonesRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByPhones");
|
|
427
|
+
var messagesByConversationIdRef = (0, import_server3.makeFunctionReference)("conversationMessages:getByConversationId");
|
|
403
428
|
function useConversationMessages(input, options) {
|
|
404
429
|
const hasPair = !!input.phoneA && !!input.phoneB;
|
|
405
|
-
const byPair = (0,
|
|
430
|
+
const byPair = (0, import_react3.useQuery)(
|
|
406
431
|
messagesByPhonesRef,
|
|
407
432
|
hasPair ? {
|
|
408
433
|
phoneA: input.phoneA,
|
|
@@ -410,7 +435,7 @@ function useConversationMessages(input, options) {
|
|
|
410
435
|
limit: options == null ? void 0 : options.limit
|
|
411
436
|
} : "skip"
|
|
412
437
|
);
|
|
413
|
-
const byConvo = (0,
|
|
438
|
+
const byConvo = (0, import_react3.useQuery)(
|
|
414
439
|
messagesByConversationIdRef,
|
|
415
440
|
!hasPair && input.conversationId ? { conversationId: input.conversationId, limit: options == null ? void 0 : options.limit } : "skip"
|
|
416
441
|
);
|
|
@@ -418,7 +443,7 @@ function useConversationMessages(input, options) {
|
|
|
418
443
|
}
|
|
419
444
|
|
|
420
445
|
// src/react/notifications.ts
|
|
421
|
-
var
|
|
446
|
+
var import_react5 = require("react");
|
|
422
447
|
|
|
423
448
|
// src/web-push.ts
|
|
424
449
|
function isWebPushSupported() {
|
|
@@ -477,12 +502,12 @@ function loadExpo() {
|
|
|
477
502
|
}
|
|
478
503
|
function useNotifications(options) {
|
|
479
504
|
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,
|
|
505
|
+
const [permissionStatus, setPermissionStatus] = (0, import_react5.useState)("unknown");
|
|
506
|
+
const [devicePushToken, setDevicePushToken] = (0, import_react5.useState)(null);
|
|
507
|
+
const expoRef = (0, import_react5.useRef)(null);
|
|
508
|
+
const isWebRef = (0, import_react5.useRef)(false);
|
|
509
|
+
const vapidKeyRef = (0, import_react5.useRef)((_a = options.vapidPublicKey) != null ? _a : null);
|
|
510
|
+
(0, import_react5.useEffect)(() => {
|
|
486
511
|
let mounted = true;
|
|
487
512
|
void (() => __async(null, null, function* () {
|
|
488
513
|
var _a2;
|
|
@@ -538,7 +563,7 @@ function useNotifications(options) {
|
|
|
538
563
|
mounted = false;
|
|
539
564
|
};
|
|
540
565
|
}, [options.apiBaseUrl, options.apiKey]);
|
|
541
|
-
const register = (0,
|
|
566
|
+
const register = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
542
567
|
var _a2, _b;
|
|
543
568
|
if (!options.userId) {
|
|
544
569
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -648,7 +673,7 @@ function useNotifications(options) {
|
|
|
648
673
|
options.appVersion,
|
|
649
674
|
options.serviceWorkerPath
|
|
650
675
|
]);
|
|
651
|
-
const unregister = (0,
|
|
676
|
+
const unregister = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
652
677
|
if (!devicePushToken) {
|
|
653
678
|
return;
|
|
654
679
|
}
|
|
@@ -663,7 +688,7 @@ function useNotifications(options) {
|
|
|
663
688
|
});
|
|
664
689
|
setDevicePushToken(null);
|
|
665
690
|
}), [options.apiBaseUrl, options.apiKey, devicePushToken]);
|
|
666
|
-
const addReceivedListener = (0,
|
|
691
|
+
const addReceivedListener = (0, import_react5.useCallback)(
|
|
667
692
|
(listener) => {
|
|
668
693
|
if (isWebRef.current) {
|
|
669
694
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -692,7 +717,7 @@ function useNotifications(options) {
|
|
|
692
717
|
},
|
|
693
718
|
[]
|
|
694
719
|
);
|
|
695
|
-
const addResponseListener = (0,
|
|
720
|
+
const addResponseListener = (0, import_react5.useCallback)(
|
|
696
721
|
(listener) => {
|
|
697
722
|
if (isWebRef.current) {
|
|
698
723
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -721,7 +746,7 @@ function useNotifications(options) {
|
|
|
721
746
|
},
|
|
722
747
|
[]
|
|
723
748
|
);
|
|
724
|
-
const getBadgeCount = (0,
|
|
749
|
+
const getBadgeCount = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
725
750
|
var _a2;
|
|
726
751
|
const expo = expoRef.current;
|
|
727
752
|
if (!(expo == null ? void 0 : expo.getBadgeCountAsync)) {
|
|
@@ -729,7 +754,7 @@ function useNotifications(options) {
|
|
|
729
754
|
}
|
|
730
755
|
return (_a2 = yield expo.getBadgeCountAsync()) != null ? _a2 : 0;
|
|
731
756
|
}), []);
|
|
732
|
-
const setBadgeCount = (0,
|
|
757
|
+
const setBadgeCount = (0, import_react5.useCallback)((count) => __async(null, null, function* () {
|
|
733
758
|
const expo = expoRef.current;
|
|
734
759
|
if (!(expo == null ? void 0 : expo.setBadgeCountAsync)) {
|
|
735
760
|
return;
|
|
@@ -737,7 +762,7 @@ function useNotifications(options) {
|
|
|
737
762
|
yield expo.setBadgeCountAsync(count);
|
|
738
763
|
}), []);
|
|
739
764
|
const autoRegister = options.autoRegister !== false;
|
|
740
|
-
(0,
|
|
765
|
+
(0, import_react5.useEffect)(() => {
|
|
741
766
|
if (!autoRegister) {
|
|
742
767
|
return;
|
|
743
768
|
}
|
|
@@ -795,8 +820,8 @@ function detectPlatform(tokenType) {
|
|
|
795
820
|
}
|
|
796
821
|
|
|
797
822
|
// src/react/provider.ts
|
|
798
|
-
var
|
|
799
|
-
var
|
|
823
|
+
var import_react6 = require("convex/react");
|
|
824
|
+
var import_react7 = require("react");
|
|
800
825
|
var CONVEX_URLS = {
|
|
801
826
|
local: "https://courteous-duck-623.convex.cloud",
|
|
802
827
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -819,12 +844,12 @@ function TruthProvider({
|
|
|
819
844
|
children
|
|
820
845
|
}) {
|
|
821
846
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
822
|
-
const client = (0,
|
|
823
|
-
return (0,
|
|
847
|
+
const client = (0, import_react7.useMemo)(() => new import_react6.ConvexReactClient(url), [url]);
|
|
848
|
+
return (0, import_react7.createElement)(import_react6.ConvexProvider, { client }, children);
|
|
824
849
|
}
|
|
825
850
|
|
|
826
851
|
// src/react/tracking.ts
|
|
827
|
-
var
|
|
852
|
+
var import_react8 = require("react");
|
|
828
853
|
|
|
829
854
|
// src/tracking/tracker.ts
|
|
830
855
|
function generateUuidV7() {
|
|
@@ -1019,7 +1044,7 @@ function sleep(ms) {
|
|
|
1019
1044
|
}
|
|
1020
1045
|
|
|
1021
1046
|
// src/react/tracking.ts
|
|
1022
|
-
var TruthTrackingContext = (0,
|
|
1047
|
+
var TruthTrackingContext = (0, import_react8.createContext)(
|
|
1023
1048
|
null
|
|
1024
1049
|
);
|
|
1025
1050
|
function TruthTrackingProvider({
|
|
@@ -1030,7 +1055,7 @@ function TruthTrackingProvider({
|
|
|
1030
1055
|
apiKey = "",
|
|
1031
1056
|
children
|
|
1032
1057
|
}) {
|
|
1033
|
-
const value = (0,
|
|
1058
|
+
const value = (0, import_react8.useMemo)(() => {
|
|
1034
1059
|
const tracker = new Tracker({
|
|
1035
1060
|
apiKey,
|
|
1036
1061
|
environment,
|
|
@@ -1049,10 +1074,10 @@ function TruthTrackingProvider({
|
|
|
1049
1074
|
}
|
|
1050
1075
|
};
|
|
1051
1076
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1052
|
-
return (0,
|
|
1077
|
+
return (0, import_react8.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1053
1078
|
}
|
|
1054
1079
|
function useTruth() {
|
|
1055
|
-
const ctx = (0,
|
|
1080
|
+
const ctx = (0, import_react8.useContext)(TruthTrackingContext);
|
|
1056
1081
|
if (!ctx) {
|
|
1057
1082
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1058
1083
|
}
|
|
@@ -1060,19 +1085,23 @@ function useTruth() {
|
|
|
1060
1085
|
}
|
|
1061
1086
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1062
1087
|
0 && (module.exports = {
|
|
1088
|
+
ACTIVE_CALL_STATES,
|
|
1089
|
+
CONNECTED_CALL_STATES,
|
|
1090
|
+
DialpadCallState,
|
|
1091
|
+
RINGING_CALL_STATES,
|
|
1092
|
+
TERMINAL_CALL_STATES,
|
|
1063
1093
|
TruthProvider,
|
|
1064
1094
|
TruthTrackingProvider,
|
|
1095
|
+
useActiveCalls,
|
|
1065
1096
|
useAppointment,
|
|
1066
1097
|
useAppointmentByElationId,
|
|
1067
1098
|
useAppointments,
|
|
1068
1099
|
useConversationByPhonePair,
|
|
1069
1100
|
useConversationMessages,
|
|
1070
|
-
useConversationNotes,
|
|
1071
|
-
useConversationNotesByPhonePair,
|
|
1072
|
-
useConversationTasks,
|
|
1073
|
-
useConversationTasksByPhonePair,
|
|
1074
|
-
useConversationTasksForUser,
|
|
1075
1101
|
useConversations,
|
|
1102
|
+
useDialpadCallByCallId,
|
|
1103
|
+
useDialpadCallLog,
|
|
1104
|
+
useDialpadCallsForConversation,
|
|
1076
1105
|
useMessages,
|
|
1077
1106
|
useNotifications,
|
|
1078
1107
|
usePatient,
|