@hipnation-truth/sdk 0.15.3 → 0.16.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 +90 -2
- package/dist/index.d.ts +90 -2
- package/dist/index.js +121 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +1437 -33
- package/dist/react.js +191 -17
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -84,15 +84,21 @@ __export(react_exports, {
|
|
|
84
84
|
usePatientBasic: () => usePatientBasic,
|
|
85
85
|
usePatientByElationId: () => usePatientByElationId,
|
|
86
86
|
usePatientByHintId: () => usePatientByHintId,
|
|
87
|
+
usePatientFamilyMembers: () => usePatientFamilyMembers,
|
|
87
88
|
usePatientMedical: () => usePatientMedical,
|
|
88
89
|
usePatientPhoto: () => usePatientPhoto,
|
|
90
|
+
usePatientSearch: () => usePatientSearch,
|
|
89
91
|
usePatients: () => usePatients,
|
|
92
|
+
usePatientsByIds: () => usePatientsByIds,
|
|
93
|
+
usePatientsByPhones: () => usePatientsByPhones,
|
|
90
94
|
usePharmacyByNcpdpId: () => usePharmacyByNcpdpId,
|
|
91
95
|
usePhysicianByElationId: () => usePhysicianByElationId,
|
|
92
96
|
usePhysiciansByElationIds: () => usePhysiciansByElationIds,
|
|
93
97
|
useRemindersForConversations: () => useRemindersForConversations,
|
|
94
98
|
useTruth: () => useTruth,
|
|
95
|
-
useUnreadCount: () => useUnreadCount
|
|
99
|
+
useUnreadCount: () => useUnreadCount,
|
|
100
|
+
useUserSettings: () => useUserSettings,
|
|
101
|
+
useVoicemailUrl: () => useVoicemailUrl
|
|
96
102
|
});
|
|
97
103
|
module.exports = __toCommonJS(react_exports);
|
|
98
104
|
|
|
@@ -882,9 +888,119 @@ function detectPlatform(tokenType) {
|
|
|
882
888
|
return "unknown";
|
|
883
889
|
}
|
|
884
890
|
|
|
885
|
-
// src/react/
|
|
891
|
+
// src/react/patient-family.ts
|
|
886
892
|
var import_react6 = require("convex/react");
|
|
887
|
-
var
|
|
893
|
+
var import_server4 = require("convex/server");
|
|
894
|
+
var patientsFamilyMembersRef = (0, import_server4.makeFunctionReference)("patients:listFamilyMembers");
|
|
895
|
+
var SKIP3 = "skip";
|
|
896
|
+
function usePatientFamilyMembers(input) {
|
|
897
|
+
const hasFamilyId = !!(input == null ? void 0 : input.familyId);
|
|
898
|
+
const hasPhoneNumbers = !!((input == null ? void 0 : input.phoneNumbers) && input.phoneNumbers.length > 0);
|
|
899
|
+
const shouldQuery = hasFamilyId || hasPhoneNumbers;
|
|
900
|
+
const args = shouldQuery ? __spreadValues(__spreadValues(__spreadValues({}, (input == null ? void 0 : input.familyId) ? { familyId: input.familyId } : {}), (input == null ? void 0 : input.phoneNumbers) && input.phoneNumbers.length > 0 ? { phoneNumbers: input.phoneNumbers } : {}), (input == null ? void 0 : input.excludeHintId) ? { excludeHintId: input.excludeHintId } : {}) : SKIP3;
|
|
901
|
+
const result = (0, import_react6.useQuery)(
|
|
902
|
+
patientsFamilyMembersRef,
|
|
903
|
+
args
|
|
904
|
+
);
|
|
905
|
+
if (!shouldQuery) {
|
|
906
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
907
|
+
}
|
|
908
|
+
return {
|
|
909
|
+
data: result,
|
|
910
|
+
loading: result === void 0,
|
|
911
|
+
error: void 0
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// src/react/patient-search.ts
|
|
916
|
+
var import_react7 = require("convex/react");
|
|
917
|
+
var import_server5 = require("convex/server");
|
|
918
|
+
var patientsSearchRef = (0, import_server5.makeFunctionReference)("patients:search");
|
|
919
|
+
var SKIP4 = "skip";
|
|
920
|
+
function usePatientSearch(options) {
|
|
921
|
+
var _a;
|
|
922
|
+
const trimmedQuery = ((_a = options.query) != null ? _a : "").trim();
|
|
923
|
+
const skipped = trimmedQuery.length === 0;
|
|
924
|
+
const result = (0, import_react7.useQuery)(
|
|
925
|
+
patientsSearchRef,
|
|
926
|
+
skipped ? SKIP4 : __spreadValues(__spreadValues(__spreadValues({
|
|
927
|
+
query: trimmedQuery
|
|
928
|
+
}, options.officeId ? { officeId: options.officeId } : {}), options.mode ? { mode: options.mode } : {}), options.limit !== void 0 ? { limit: options.limit } : {})
|
|
929
|
+
);
|
|
930
|
+
if (skipped) {
|
|
931
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
932
|
+
}
|
|
933
|
+
return {
|
|
934
|
+
data: result,
|
|
935
|
+
loading: result === void 0,
|
|
936
|
+
error: void 0
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
// src/react/patients-bulk.ts
|
|
941
|
+
var import_react8 = require("convex/react");
|
|
942
|
+
var import_server6 = require("convex/server");
|
|
943
|
+
var import_react9 = require("react");
|
|
944
|
+
var patientsGetByIdsRef = (0, import_server6.makeFunctionReference)("patients:getByIds");
|
|
945
|
+
var patientsGetByPhonesRef = (0, import_server6.makeFunctionReference)("patients:getByPhones");
|
|
946
|
+
var SKIP5 = "skip";
|
|
947
|
+
function usePatientsByIds(ids) {
|
|
948
|
+
const stableIds = (0, import_react9.useMemo)(() => {
|
|
949
|
+
const arr = ids != null ? ids : [];
|
|
950
|
+
return [...new Set(arr)].sort();
|
|
951
|
+
}, [ids]);
|
|
952
|
+
const skipped = stableIds.length === 0;
|
|
953
|
+
const result = (0, import_react8.useQuery)(
|
|
954
|
+
patientsGetByIdsRef,
|
|
955
|
+
skipped ? SKIP5 : { ids: stableIds }
|
|
956
|
+
);
|
|
957
|
+
const mapped = (0, import_react9.useMemo)(() => {
|
|
958
|
+
if (result === void 0) return void 0;
|
|
959
|
+
return Object.fromEntries(
|
|
960
|
+
result.map((p) => {
|
|
961
|
+
var _a, _b;
|
|
962
|
+
const id = (_b = (_a = p.id) != null ? _a : p._id) != null ? _b : "";
|
|
963
|
+
return [String(id), p];
|
|
964
|
+
})
|
|
965
|
+
);
|
|
966
|
+
}, [result]);
|
|
967
|
+
if (skipped) {
|
|
968
|
+
return { data: {}, loading: false, error: void 0 };
|
|
969
|
+
}
|
|
970
|
+
return {
|
|
971
|
+
data: mapped,
|
|
972
|
+
loading: mapped === void 0,
|
|
973
|
+
error: void 0
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
function usePatientsByPhones(phones) {
|
|
977
|
+
const stableDigits = (0, import_react9.useMemo)(() => {
|
|
978
|
+
const arr = phones != null ? phones : [];
|
|
979
|
+
const digits = arr.map((p) => p.replace(/\D+/g, "")).filter((s) => s.length > 0);
|
|
980
|
+
return [...new Set(digits)].sort();
|
|
981
|
+
}, [phones]);
|
|
982
|
+
const skipped = stableDigits.length === 0;
|
|
983
|
+
const result = (0, import_react8.useQuery)(
|
|
984
|
+
patientsGetByPhonesRef,
|
|
985
|
+
skipped ? SKIP5 : { phoneDigits: stableDigits }
|
|
986
|
+
);
|
|
987
|
+
const mapped = (0, import_react9.useMemo)(() => {
|
|
988
|
+
if (result === void 0) return void 0;
|
|
989
|
+
return Object.fromEntries(result.map((r) => [r.phoneDigits, r.patient]));
|
|
990
|
+
}, [result]);
|
|
991
|
+
if (skipped) {
|
|
992
|
+
return { data: {}, loading: false, error: void 0 };
|
|
993
|
+
}
|
|
994
|
+
return {
|
|
995
|
+
data: mapped,
|
|
996
|
+
loading: mapped === void 0,
|
|
997
|
+
error: void 0
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// src/react/provider.ts
|
|
1002
|
+
var import_react10 = require("convex/react");
|
|
1003
|
+
var import_react11 = require("react");
|
|
888
1004
|
var CONVEX_URLS = {
|
|
889
1005
|
local: "https://courteous-duck-623.convex.cloud",
|
|
890
1006
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -907,21 +1023,21 @@ function TruthProvider({
|
|
|
907
1023
|
children
|
|
908
1024
|
}) {
|
|
909
1025
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
910
|
-
const client = (0,
|
|
911
|
-
return (0,
|
|
1026
|
+
const client = (0, import_react11.useMemo)(() => new import_react10.ConvexReactClient(url), [url]);
|
|
1027
|
+
return (0, import_react11.createElement)(import_react10.ConvexProvider, { client }, children);
|
|
912
1028
|
}
|
|
913
1029
|
|
|
914
1030
|
// src/react/reminders.ts
|
|
915
|
-
var
|
|
916
|
-
var
|
|
917
|
-
var remindersListPendingByConversationIdsRef = (0,
|
|
918
|
-
var
|
|
1031
|
+
var import_react12 = require("convex/react");
|
|
1032
|
+
var import_server7 = require("convex/server");
|
|
1033
|
+
var remindersListPendingByConversationIdsRef = (0, import_server7.makeFunctionReference)("reminders:listPendingByConversationIds");
|
|
1034
|
+
var SKIP6 = "skip";
|
|
919
1035
|
function useRemindersForConversations(conversationIds) {
|
|
920
1036
|
const ids = conversationIds != null ? conversationIds : [];
|
|
921
1037
|
const skipped = ids.length === 0;
|
|
922
|
-
const result = (0,
|
|
1038
|
+
const result = (0, import_react12.useQuery)(
|
|
923
1039
|
remindersListPendingByConversationIdsRef,
|
|
924
|
-
skipped ?
|
|
1040
|
+
skipped ? SKIP6 : { conversationIds: ids }
|
|
925
1041
|
);
|
|
926
1042
|
const mapped = result === void 0 ? void 0 : Object.fromEntries(result.map((r) => [r.conversationId, r]));
|
|
927
1043
|
if (skipped) {
|
|
@@ -935,7 +1051,7 @@ function useRemindersForConversations(conversationIds) {
|
|
|
935
1051
|
}
|
|
936
1052
|
|
|
937
1053
|
// src/react/tracking.ts
|
|
938
|
-
var
|
|
1054
|
+
var import_react13 = require("react");
|
|
939
1055
|
|
|
940
1056
|
// src/tracking/tracker.ts
|
|
941
1057
|
function generateUuidV7() {
|
|
@@ -1130,7 +1246,7 @@ function sleep(ms) {
|
|
|
1130
1246
|
}
|
|
1131
1247
|
|
|
1132
1248
|
// src/react/tracking.ts
|
|
1133
|
-
var TruthTrackingContext = (0,
|
|
1249
|
+
var TruthTrackingContext = (0, import_react13.createContext)(
|
|
1134
1250
|
null
|
|
1135
1251
|
);
|
|
1136
1252
|
function TruthTrackingProvider({
|
|
@@ -1141,7 +1257,7 @@ function TruthTrackingProvider({
|
|
|
1141
1257
|
apiKey = "",
|
|
1142
1258
|
children
|
|
1143
1259
|
}) {
|
|
1144
|
-
const value = (0,
|
|
1260
|
+
const value = (0, import_react13.useMemo)(() => {
|
|
1145
1261
|
const tracker = new Tracker({
|
|
1146
1262
|
apiKey,
|
|
1147
1263
|
environment,
|
|
@@ -1160,15 +1276,67 @@ function TruthTrackingProvider({
|
|
|
1160
1276
|
}
|
|
1161
1277
|
};
|
|
1162
1278
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1163
|
-
return (0,
|
|
1279
|
+
return (0, import_react13.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1164
1280
|
}
|
|
1165
1281
|
function useTruth() {
|
|
1166
|
-
const ctx = (0,
|
|
1282
|
+
const ctx = (0, import_react13.useContext)(TruthTrackingContext);
|
|
1167
1283
|
if (!ctx) {
|
|
1168
1284
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1169
1285
|
}
|
|
1170
1286
|
return ctx;
|
|
1171
1287
|
}
|
|
1288
|
+
|
|
1289
|
+
// src/react/user-settings.ts
|
|
1290
|
+
var import_react14 = require("convex/react");
|
|
1291
|
+
var import_server8 = require("convex/server");
|
|
1292
|
+
var userSettingsGetByUserIdRef = (0, import_server8.makeFunctionReference)("userSettings:getByUserId");
|
|
1293
|
+
var SKIP7 = "skip";
|
|
1294
|
+
function useUserSettings(userId) {
|
|
1295
|
+
const skip = !userId;
|
|
1296
|
+
const result = (0, import_react14.useQuery)(
|
|
1297
|
+
userSettingsGetByUserIdRef,
|
|
1298
|
+
skip ? SKIP7 : { userId }
|
|
1299
|
+
);
|
|
1300
|
+
if (skip) {
|
|
1301
|
+
return { data: null, loading: false, error: void 0 };
|
|
1302
|
+
}
|
|
1303
|
+
return {
|
|
1304
|
+
data: result != null ? result : null,
|
|
1305
|
+
loading: result === void 0,
|
|
1306
|
+
error: void 0
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
// src/react/voicemail.ts
|
|
1311
|
+
var import_react15 = require("react");
|
|
1312
|
+
function useVoicemailUrl(client) {
|
|
1313
|
+
const [url, setUrl] = (0, import_react15.useState)(null);
|
|
1314
|
+
const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
|
|
1315
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
1316
|
+
const inFlightRef = (0, import_react15.useRef)(false);
|
|
1317
|
+
const fetchUrl = (0, import_react15.useCallback)(
|
|
1318
|
+
(voicemailLink) => __async(null, null, function* () {
|
|
1319
|
+
if (inFlightRef.current) return null;
|
|
1320
|
+
inFlightRef.current = true;
|
|
1321
|
+
setIsLoading(true);
|
|
1322
|
+
setError(null);
|
|
1323
|
+
try {
|
|
1324
|
+
const result = yield client.messages.getVoicemailUrl(voicemailLink);
|
|
1325
|
+
setUrl(result.url);
|
|
1326
|
+
return result.url;
|
|
1327
|
+
} catch (err) {
|
|
1328
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
1329
|
+
setError(msg);
|
|
1330
|
+
return null;
|
|
1331
|
+
} finally {
|
|
1332
|
+
setIsLoading(false);
|
|
1333
|
+
inFlightRef.current = false;
|
|
1334
|
+
}
|
|
1335
|
+
}),
|
|
1336
|
+
[client]
|
|
1337
|
+
);
|
|
1338
|
+
return { fetchUrl, url, isLoading, error };
|
|
1339
|
+
}
|
|
1172
1340
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1173
1341
|
0 && (module.exports = {
|
|
1174
1342
|
ACTIVE_CALL_STATES,
|
|
@@ -1199,14 +1367,20 @@ function useTruth() {
|
|
|
1199
1367
|
usePatientBasic,
|
|
1200
1368
|
usePatientByElationId,
|
|
1201
1369
|
usePatientByHintId,
|
|
1370
|
+
usePatientFamilyMembers,
|
|
1202
1371
|
usePatientMedical,
|
|
1203
1372
|
usePatientPhoto,
|
|
1373
|
+
usePatientSearch,
|
|
1204
1374
|
usePatients,
|
|
1375
|
+
usePatientsByIds,
|
|
1376
|
+
usePatientsByPhones,
|
|
1205
1377
|
usePharmacyByNcpdpId,
|
|
1206
1378
|
usePhysicianByElationId,
|
|
1207
1379
|
usePhysiciansByElationIds,
|
|
1208
1380
|
useRemindersForConversations,
|
|
1209
1381
|
useTruth,
|
|
1210
|
-
useUnreadCount
|
|
1382
|
+
useUnreadCount,
|
|
1383
|
+
useUserSettings,
|
|
1384
|
+
useVoicemailUrl
|
|
1211
1385
|
});
|
|
1212
1386
|
//# sourceMappingURL=react.js.map
|