@hipnation-truth/sdk 0.15.2 → 0.16.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 +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 +1479 -38
- package/dist/react.js +183 -11
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -84,14 +84,20 @@ __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,
|
|
90
93
|
usePharmacyByNcpdpId: () => usePharmacyByNcpdpId,
|
|
91
94
|
usePhysicianByElationId: () => usePhysicianByElationId,
|
|
92
95
|
usePhysiciansByElationIds: () => usePhysiciansByElationIds,
|
|
96
|
+
useRemindersForConversations: () => useRemindersForConversations,
|
|
93
97
|
useTruth: () => useTruth,
|
|
94
|
-
useUnreadCount: () => useUnreadCount
|
|
98
|
+
useUnreadCount: () => useUnreadCount,
|
|
99
|
+
useUserSettings: () => useUserSettings,
|
|
100
|
+
useVoicemailUrl: () => useVoicemailUrl
|
|
95
101
|
});
|
|
96
102
|
module.exports = __toCommonJS(react_exports);
|
|
97
103
|
|
|
@@ -881,9 +887,94 @@ function detectPlatform(tokenType) {
|
|
|
881
887
|
return "unknown";
|
|
882
888
|
}
|
|
883
889
|
|
|
884
|
-
// src/react/
|
|
890
|
+
// src/react/patient-family.ts
|
|
885
891
|
var import_react6 = require("convex/react");
|
|
886
|
-
var
|
|
892
|
+
var import_server4 = require("convex/server");
|
|
893
|
+
var patientsFamilyMembersRef = (0, import_server4.makeFunctionReference)("patients:listFamilyMembers");
|
|
894
|
+
var SKIP3 = "skip";
|
|
895
|
+
function usePatientFamilyMembers(input) {
|
|
896
|
+
const hasFamilyId = !!(input == null ? void 0 : input.familyId);
|
|
897
|
+
const hasPhoneNumbers = !!((input == null ? void 0 : input.phoneNumbers) && input.phoneNumbers.length > 0);
|
|
898
|
+
const shouldQuery = hasFamilyId || hasPhoneNumbers;
|
|
899
|
+
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;
|
|
900
|
+
const result = (0, import_react6.useQuery)(
|
|
901
|
+
patientsFamilyMembersRef,
|
|
902
|
+
args
|
|
903
|
+
);
|
|
904
|
+
if (!shouldQuery) {
|
|
905
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
906
|
+
}
|
|
907
|
+
return {
|
|
908
|
+
data: result,
|
|
909
|
+
loading: result === void 0,
|
|
910
|
+
error: void 0
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// src/react/patient-search.ts
|
|
915
|
+
var import_react7 = require("convex/react");
|
|
916
|
+
var import_server5 = require("convex/server");
|
|
917
|
+
var patientsSearchRef = (0, import_server5.makeFunctionReference)("patients:search");
|
|
918
|
+
var SKIP4 = "skip";
|
|
919
|
+
function usePatientSearch(options) {
|
|
920
|
+
var _a;
|
|
921
|
+
const trimmedQuery = ((_a = options.query) != null ? _a : "").trim();
|
|
922
|
+
const skipped = trimmedQuery.length === 0;
|
|
923
|
+
const result = (0, import_react7.useQuery)(
|
|
924
|
+
patientsSearchRef,
|
|
925
|
+
skipped ? SKIP4 : __spreadValues(__spreadValues(__spreadValues({
|
|
926
|
+
query: trimmedQuery
|
|
927
|
+
}, options.officeId ? { officeId: options.officeId } : {}), options.mode ? { mode: options.mode } : {}), options.limit !== void 0 ? { limit: options.limit } : {})
|
|
928
|
+
);
|
|
929
|
+
if (skipped) {
|
|
930
|
+
return { data: void 0, loading: false, error: void 0 };
|
|
931
|
+
}
|
|
932
|
+
return {
|
|
933
|
+
data: result,
|
|
934
|
+
loading: result === void 0,
|
|
935
|
+
error: void 0
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// src/react/patients-bulk.ts
|
|
940
|
+
var import_react8 = require("convex/react");
|
|
941
|
+
var import_server6 = require("convex/server");
|
|
942
|
+
var import_react9 = require("react");
|
|
943
|
+
var patientsGetByIdsRef = (0, import_server6.makeFunctionReference)("patients:getByIds");
|
|
944
|
+
var SKIP5 = "skip";
|
|
945
|
+
function usePatientsByIds(ids) {
|
|
946
|
+
const stableIds = (0, import_react9.useMemo)(() => {
|
|
947
|
+
const arr = ids != null ? ids : [];
|
|
948
|
+
return [...new Set(arr)].sort();
|
|
949
|
+
}, [ids]);
|
|
950
|
+
const skipped = stableIds.length === 0;
|
|
951
|
+
const result = (0, import_react8.useQuery)(
|
|
952
|
+
patientsGetByIdsRef,
|
|
953
|
+
skipped ? SKIP5 : { ids: stableIds }
|
|
954
|
+
);
|
|
955
|
+
const mapped = (0, import_react9.useMemo)(() => {
|
|
956
|
+
if (result === void 0) return void 0;
|
|
957
|
+
return Object.fromEntries(
|
|
958
|
+
result.map((p) => {
|
|
959
|
+
var _a, _b;
|
|
960
|
+
const id = (_b = (_a = p.id) != null ? _a : p._id) != null ? _b : "";
|
|
961
|
+
return [String(id), p];
|
|
962
|
+
})
|
|
963
|
+
);
|
|
964
|
+
}, [result]);
|
|
965
|
+
if (skipped) {
|
|
966
|
+
return { data: {}, loading: false, error: void 0 };
|
|
967
|
+
}
|
|
968
|
+
return {
|
|
969
|
+
data: mapped,
|
|
970
|
+
loading: mapped === void 0,
|
|
971
|
+
error: void 0
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// src/react/provider.ts
|
|
976
|
+
var import_react10 = require("convex/react");
|
|
977
|
+
var import_react11 = require("react");
|
|
887
978
|
var CONVEX_URLS = {
|
|
888
979
|
local: "https://courteous-duck-623.convex.cloud",
|
|
889
980
|
staging: "https://courteous-duck-623.convex.cloud",
|
|
@@ -906,12 +997,35 @@ function TruthProvider({
|
|
|
906
997
|
children
|
|
907
998
|
}) {
|
|
908
999
|
const url = resolveConvexUrl(environment, convexUrl);
|
|
909
|
-
const client = (0,
|
|
910
|
-
return (0,
|
|
1000
|
+
const client = (0, import_react11.useMemo)(() => new import_react10.ConvexReactClient(url), [url]);
|
|
1001
|
+
return (0, import_react11.createElement)(import_react10.ConvexProvider, { client }, children);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
// src/react/reminders.ts
|
|
1005
|
+
var import_react12 = require("convex/react");
|
|
1006
|
+
var import_server7 = require("convex/server");
|
|
1007
|
+
var remindersListPendingByConversationIdsRef = (0, import_server7.makeFunctionReference)("reminders:listPendingByConversationIds");
|
|
1008
|
+
var SKIP6 = "skip";
|
|
1009
|
+
function useRemindersForConversations(conversationIds) {
|
|
1010
|
+
const ids = conversationIds != null ? conversationIds : [];
|
|
1011
|
+
const skipped = ids.length === 0;
|
|
1012
|
+
const result = (0, import_react12.useQuery)(
|
|
1013
|
+
remindersListPendingByConversationIdsRef,
|
|
1014
|
+
skipped ? SKIP6 : { conversationIds: ids }
|
|
1015
|
+
);
|
|
1016
|
+
const mapped = result === void 0 ? void 0 : Object.fromEntries(result.map((r) => [r.conversationId, r]));
|
|
1017
|
+
if (skipped) {
|
|
1018
|
+
return { data: {}, loading: false, error: void 0 };
|
|
1019
|
+
}
|
|
1020
|
+
return {
|
|
1021
|
+
data: mapped,
|
|
1022
|
+
loading: mapped === void 0,
|
|
1023
|
+
error: void 0
|
|
1024
|
+
};
|
|
911
1025
|
}
|
|
912
1026
|
|
|
913
1027
|
// src/react/tracking.ts
|
|
914
|
-
var
|
|
1028
|
+
var import_react13 = require("react");
|
|
915
1029
|
|
|
916
1030
|
// src/tracking/tracker.ts
|
|
917
1031
|
function generateUuidV7() {
|
|
@@ -1106,7 +1220,7 @@ function sleep(ms) {
|
|
|
1106
1220
|
}
|
|
1107
1221
|
|
|
1108
1222
|
// src/react/tracking.ts
|
|
1109
|
-
var TruthTrackingContext = (0,
|
|
1223
|
+
var TruthTrackingContext = (0, import_react13.createContext)(
|
|
1110
1224
|
null
|
|
1111
1225
|
);
|
|
1112
1226
|
function TruthTrackingProvider({
|
|
@@ -1117,7 +1231,7 @@ function TruthTrackingProvider({
|
|
|
1117
1231
|
apiKey = "",
|
|
1118
1232
|
children
|
|
1119
1233
|
}) {
|
|
1120
|
-
const value = (0,
|
|
1234
|
+
const value = (0, import_react13.useMemo)(() => {
|
|
1121
1235
|
const tracker = new Tracker({
|
|
1122
1236
|
apiKey,
|
|
1123
1237
|
environment,
|
|
@@ -1136,15 +1250,67 @@ function TruthTrackingProvider({
|
|
|
1136
1250
|
}
|
|
1137
1251
|
};
|
|
1138
1252
|
}, [apiKey, environment, source, sourceVersion, tenantId]);
|
|
1139
|
-
return (0,
|
|
1253
|
+
return (0, import_react13.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
1140
1254
|
}
|
|
1141
1255
|
function useTruth() {
|
|
1142
|
-
const ctx = (0,
|
|
1256
|
+
const ctx = (0, import_react13.useContext)(TruthTrackingContext);
|
|
1143
1257
|
if (!ctx) {
|
|
1144
1258
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
1145
1259
|
}
|
|
1146
1260
|
return ctx;
|
|
1147
1261
|
}
|
|
1262
|
+
|
|
1263
|
+
// src/react/user-settings.ts
|
|
1264
|
+
var import_react14 = require("convex/react");
|
|
1265
|
+
var import_server8 = require("convex/server");
|
|
1266
|
+
var userSettingsGetByUserIdRef = (0, import_server8.makeFunctionReference)("userSettings:getByUserId");
|
|
1267
|
+
var SKIP7 = "skip";
|
|
1268
|
+
function useUserSettings(userId) {
|
|
1269
|
+
const skip = !userId;
|
|
1270
|
+
const result = (0, import_react14.useQuery)(
|
|
1271
|
+
userSettingsGetByUserIdRef,
|
|
1272
|
+
skip ? SKIP7 : { userId }
|
|
1273
|
+
);
|
|
1274
|
+
if (skip) {
|
|
1275
|
+
return { data: null, loading: false, error: void 0 };
|
|
1276
|
+
}
|
|
1277
|
+
return {
|
|
1278
|
+
data: result != null ? result : null,
|
|
1279
|
+
loading: result === void 0,
|
|
1280
|
+
error: void 0
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
// src/react/voicemail.ts
|
|
1285
|
+
var import_react15 = require("react");
|
|
1286
|
+
function useVoicemailUrl(client) {
|
|
1287
|
+
const [url, setUrl] = (0, import_react15.useState)(null);
|
|
1288
|
+
const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
|
|
1289
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
1290
|
+
const inFlightRef = (0, import_react15.useRef)(false);
|
|
1291
|
+
const fetchUrl = (0, import_react15.useCallback)(
|
|
1292
|
+
(voicemailLink) => __async(null, null, function* () {
|
|
1293
|
+
if (inFlightRef.current) return null;
|
|
1294
|
+
inFlightRef.current = true;
|
|
1295
|
+
setIsLoading(true);
|
|
1296
|
+
setError(null);
|
|
1297
|
+
try {
|
|
1298
|
+
const result = yield client.messages.getVoicemailUrl(voicemailLink);
|
|
1299
|
+
setUrl(result.url);
|
|
1300
|
+
return result.url;
|
|
1301
|
+
} catch (err) {
|
|
1302
|
+
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
1303
|
+
setError(msg);
|
|
1304
|
+
return null;
|
|
1305
|
+
} finally {
|
|
1306
|
+
setIsLoading(false);
|
|
1307
|
+
inFlightRef.current = false;
|
|
1308
|
+
}
|
|
1309
|
+
}),
|
|
1310
|
+
[client]
|
|
1311
|
+
);
|
|
1312
|
+
return { fetchUrl, url, isLoading, error };
|
|
1313
|
+
}
|
|
1148
1314
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1149
1315
|
0 && (module.exports = {
|
|
1150
1316
|
ACTIVE_CALL_STATES,
|
|
@@ -1175,13 +1341,19 @@ function useTruth() {
|
|
|
1175
1341
|
usePatientBasic,
|
|
1176
1342
|
usePatientByElationId,
|
|
1177
1343
|
usePatientByHintId,
|
|
1344
|
+
usePatientFamilyMembers,
|
|
1178
1345
|
usePatientMedical,
|
|
1179
1346
|
usePatientPhoto,
|
|
1347
|
+
usePatientSearch,
|
|
1180
1348
|
usePatients,
|
|
1349
|
+
usePatientsByIds,
|
|
1181
1350
|
usePharmacyByNcpdpId,
|
|
1182
1351
|
usePhysicianByElationId,
|
|
1183
1352
|
usePhysiciansByElationIds,
|
|
1353
|
+
useRemindersForConversations,
|
|
1184
1354
|
useTruth,
|
|
1185
|
-
useUnreadCount
|
|
1355
|
+
useUnreadCount,
|
|
1356
|
+
useUserSettings,
|
|
1357
|
+
useVoicemailUrl
|
|
1186
1358
|
});
|
|
1187
1359
|
//# sourceMappingURL=react.js.map
|