@hipnation-truth/sdk 0.26.7 → 0.26.8
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/react.js +52 -53
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -122,7 +122,6 @@ __export(react_exports, {
|
|
|
122
122
|
module.exports = __toCommonJS(react_exports);
|
|
123
123
|
|
|
124
124
|
// src/react/calls.ts
|
|
125
|
-
var import_react3 = require("convex/react");
|
|
126
125
|
var import_server2 = require("convex/server");
|
|
127
126
|
|
|
128
127
|
// src/react/offline/use-persistent-query.ts
|
|
@@ -2505,7 +2504,7 @@ function toResult(value, skipped) {
|
|
|
2505
2504
|
}
|
|
2506
2505
|
function useActiveCalls(options) {
|
|
2507
2506
|
const ready = useConvexQueriesReady();
|
|
2508
|
-
const result = (
|
|
2507
|
+
const result = usePersistentQuery(listActiveRef, ready ? options != null ? options : {} : "skip");
|
|
2509
2508
|
return toResult(result, false);
|
|
2510
2509
|
}
|
|
2511
2510
|
function useDialpadCallsForConversation(conversationId, options) {
|
|
@@ -2557,7 +2556,7 @@ function useConversationById(id) {
|
|
|
2557
2556
|
|
|
2558
2557
|
// src/react/conversations.ts
|
|
2559
2558
|
var import_server4 = require("convex/server");
|
|
2560
|
-
var
|
|
2559
|
+
var import_react3 = require("react");
|
|
2561
2560
|
var conversationsListForUserRef = (0, import_server4.makeFunctionReference)("conversations:listForUser");
|
|
2562
2561
|
var conversationsSearchForUserRef = (0, import_server4.makeFunctionReference)("conversations:searchForUser");
|
|
2563
2562
|
var conversationsGetUnreadTotalForUserRef = (0, import_server4.makeFunctionReference)("conversations:getUnreadTotalForUser");
|
|
@@ -2644,7 +2643,7 @@ function useUnreadAggregate(userId, options) {
|
|
|
2644
2643
|
}
|
|
2645
2644
|
function useMemoizedPhones(phones) {
|
|
2646
2645
|
const key = phones ? [...phones].sort().join("|") : "";
|
|
2647
|
-
return (0,
|
|
2646
|
+
return (0, import_react3.useMemo)(
|
|
2648
2647
|
() => (phones == null ? void 0 : phones.length) ? [...phones].sort() : void 0,
|
|
2649
2648
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2650
2649
|
[key]
|
|
@@ -2692,7 +2691,7 @@ function useConversationTasksByPhonePair(phonePair) {
|
|
|
2692
2691
|
}
|
|
2693
2692
|
|
|
2694
2693
|
// src/react/hooks.ts
|
|
2695
|
-
var
|
|
2694
|
+
var import_react4 = require("react");
|
|
2696
2695
|
var import_server5 = require("convex/server");
|
|
2697
2696
|
var patientsListRef = (0, import_server5.makeFunctionReference)("patients:list");
|
|
2698
2697
|
var patientsGetRef = (0, import_server5.makeFunctionReference)("patients:get");
|
|
@@ -2792,7 +2791,7 @@ function usePatientMedical(elationId, options) {
|
|
|
2792
2791
|
appointmentsByPatientRef,
|
|
2793
2792
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
2794
2793
|
);
|
|
2795
|
-
(0,
|
|
2794
|
+
(0, import_react4.useEffect)(() => {
|
|
2796
2795
|
if (elationId === void 0 || (options == null ? void 0 : options.skipRefresh)) {
|
|
2797
2796
|
return;
|
|
2798
2797
|
}
|
|
@@ -2830,7 +2829,7 @@ function usePatientBasic(input, options) {
|
|
|
2830
2829
|
hintPatientByIdRef,
|
|
2831
2830
|
input.hintId !== void 0 ? { hintId: input.hintId } : "skip"
|
|
2832
2831
|
);
|
|
2833
|
-
(0,
|
|
2832
|
+
(0, import_react4.useEffect)(() => {
|
|
2834
2833
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
2835
2834
|
return;
|
|
2836
2835
|
}
|
|
@@ -2886,7 +2885,7 @@ function usePatientPhoto(elationId, options) {
|
|
|
2886
2885
|
patientPhotoByIdRef,
|
|
2887
2886
|
elationId !== void 0 ? { elationPatientId: elationId } : "skip"
|
|
2888
2887
|
);
|
|
2889
|
-
(0,
|
|
2888
|
+
(0, import_react4.useEffect)(() => {
|
|
2890
2889
|
if (options == null ? void 0 : options.skipRefresh) {
|
|
2891
2890
|
return;
|
|
2892
2891
|
}
|
|
@@ -2929,7 +2928,7 @@ function useConversationMessages(input, options) {
|
|
|
2929
2928
|
}
|
|
2930
2929
|
|
|
2931
2930
|
// src/react/notifications.ts
|
|
2932
|
-
var
|
|
2931
|
+
var import_react5 = require("react");
|
|
2933
2932
|
function loadExpo() {
|
|
2934
2933
|
return __async(this, null, function* () {
|
|
2935
2934
|
try {
|
|
@@ -2944,12 +2943,12 @@ function useNotifications(options) {
|
|
|
2944
2943
|
const sdkContext = useTruthSdkContext();
|
|
2945
2944
|
const apiBaseUrl = (_b = (_a = options.apiBaseUrl) != null ? _a : sdkContext == null ? void 0 : sdkContext.apiBaseUrl) != null ? _b : "";
|
|
2946
2945
|
const apiKey = (_d = (_c = options.apiKey) != null ? _c : sdkContext == null ? void 0 : sdkContext.apiKey) != null ? _d : "";
|
|
2947
|
-
const [permissionStatus, setPermissionStatus] = (0,
|
|
2948
|
-
const [devicePushToken, setDevicePushToken] = (0,
|
|
2949
|
-
const expoRef = (0,
|
|
2950
|
-
const isWebRef = (0,
|
|
2951
|
-
const vapidKeyRef = (0,
|
|
2952
|
-
(0,
|
|
2946
|
+
const [permissionStatus, setPermissionStatus] = (0, import_react5.useState)("unknown");
|
|
2947
|
+
const [devicePushToken, setDevicePushToken] = (0, import_react5.useState)(null);
|
|
2948
|
+
const expoRef = (0, import_react5.useRef)(null);
|
|
2949
|
+
const isWebRef = (0, import_react5.useRef)(false);
|
|
2950
|
+
const vapidKeyRef = (0, import_react5.useRef)((_e = options.vapidPublicKey) != null ? _e : null);
|
|
2951
|
+
(0, import_react5.useEffect)(() => {
|
|
2953
2952
|
let mounted = true;
|
|
2954
2953
|
void (() => __async(null, null, function* () {
|
|
2955
2954
|
var _a2;
|
|
@@ -3005,7 +3004,7 @@ function useNotifications(options) {
|
|
|
3005
3004
|
mounted = false;
|
|
3006
3005
|
};
|
|
3007
3006
|
}, [apiBaseUrl, apiKey]);
|
|
3008
|
-
const register = (0,
|
|
3007
|
+
const register = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
3009
3008
|
var _a2, _b2;
|
|
3010
3009
|
if (!options.userId) {
|
|
3011
3010
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -3118,7 +3117,7 @@ function useNotifications(options) {
|
|
|
3118
3117
|
options.appVersion,
|
|
3119
3118
|
options.serviceWorkerPath
|
|
3120
3119
|
]);
|
|
3121
|
-
const unregister = (0,
|
|
3120
|
+
const unregister = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
3122
3121
|
if (!devicePushToken) {
|
|
3123
3122
|
return;
|
|
3124
3123
|
}
|
|
@@ -3133,7 +3132,7 @@ function useNotifications(options) {
|
|
|
3133
3132
|
});
|
|
3134
3133
|
setDevicePushToken(null);
|
|
3135
3134
|
}), [apiBaseUrl, apiKey, devicePushToken]);
|
|
3136
|
-
const addReceivedListener = (0,
|
|
3135
|
+
const addReceivedListener = (0, import_react5.useCallback)(
|
|
3137
3136
|
(listener) => {
|
|
3138
3137
|
if (isWebRef.current) {
|
|
3139
3138
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -3162,7 +3161,7 @@ function useNotifications(options) {
|
|
|
3162
3161
|
},
|
|
3163
3162
|
[]
|
|
3164
3163
|
);
|
|
3165
|
-
const addResponseListener = (0,
|
|
3164
|
+
const addResponseListener = (0, import_react5.useCallback)(
|
|
3166
3165
|
(listener) => {
|
|
3167
3166
|
if (isWebRef.current) {
|
|
3168
3167
|
if (typeof navigator === "undefined" || !("serviceWorker" in navigator)) {
|
|
@@ -3191,7 +3190,7 @@ function useNotifications(options) {
|
|
|
3191
3190
|
},
|
|
3192
3191
|
[]
|
|
3193
3192
|
);
|
|
3194
|
-
const getBadgeCount = (0,
|
|
3193
|
+
const getBadgeCount = (0, import_react5.useCallback)(() => __async(null, null, function* () {
|
|
3195
3194
|
var _a2;
|
|
3196
3195
|
const expo = expoRef.current;
|
|
3197
3196
|
if (!(expo == null ? void 0 : expo.getBadgeCountAsync)) {
|
|
@@ -3199,7 +3198,7 @@ function useNotifications(options) {
|
|
|
3199
3198
|
}
|
|
3200
3199
|
return (_a2 = yield expo.getBadgeCountAsync()) != null ? _a2 : 0;
|
|
3201
3200
|
}), []);
|
|
3202
|
-
const setBadgeCount = (0,
|
|
3201
|
+
const setBadgeCount = (0, import_react5.useCallback)((count) => __async(null, null, function* () {
|
|
3203
3202
|
const expo = expoRef.current;
|
|
3204
3203
|
if (!(expo == null ? void 0 : expo.setBadgeCountAsync)) {
|
|
3205
3204
|
return;
|
|
@@ -3207,7 +3206,7 @@ function useNotifications(options) {
|
|
|
3207
3206
|
yield expo.setBadgeCountAsync(count);
|
|
3208
3207
|
}), []);
|
|
3209
3208
|
const autoRegister = options.autoRegister !== false;
|
|
3210
|
-
(0,
|
|
3209
|
+
(0, import_react5.useEffect)(() => {
|
|
3211
3210
|
if (!autoRegister) {
|
|
3212
3211
|
return;
|
|
3213
3212
|
}
|
|
@@ -3244,7 +3243,7 @@ function useNotificationsActions() {
|
|
|
3244
3243
|
const sdkContext = useTruthSdkContext();
|
|
3245
3244
|
const apiBaseUrl = (_a = sdkContext == null ? void 0 : sdkContext.apiBaseUrl) != null ? _a : "";
|
|
3246
3245
|
const apiKey = (_b = sdkContext == null ? void 0 : sdkContext.apiKey) != null ? _b : "";
|
|
3247
|
-
const post = (0,
|
|
3246
|
+
const post = (0, import_react5.useCallback)(
|
|
3248
3247
|
(path, body) => __async(null, null, function* () {
|
|
3249
3248
|
if (!apiBaseUrl || !apiKey) {
|
|
3250
3249
|
throw new Error(
|
|
@@ -3270,7 +3269,7 @@ function useNotificationsActions() {
|
|
|
3270
3269
|
}),
|
|
3271
3270
|
[apiBaseUrl, apiKey]
|
|
3272
3271
|
);
|
|
3273
|
-
const get = (0,
|
|
3272
|
+
const get = (0, import_react5.useCallback)(
|
|
3274
3273
|
(path) => __async(null, null, function* () {
|
|
3275
3274
|
const res = yield fetch(`${apiBaseUrl}/api${path}`, {
|
|
3276
3275
|
method: "GET",
|
|
@@ -3286,21 +3285,21 @@ function useNotificationsActions() {
|
|
|
3286
3285
|
}),
|
|
3287
3286
|
[apiBaseUrl, apiKey]
|
|
3288
3287
|
);
|
|
3289
|
-
const send = (0,
|
|
3288
|
+
const send = (0, import_react5.useCallback)(
|
|
3290
3289
|
(input) => post("/notifications/send", input),
|
|
3291
3290
|
[post]
|
|
3292
3291
|
);
|
|
3293
|
-
const schedule = (0,
|
|
3292
|
+
const schedule = (0, import_react5.useCallback)(
|
|
3294
3293
|
(input) => post("/notifications/schedule", input),
|
|
3295
3294
|
[post]
|
|
3296
3295
|
);
|
|
3297
|
-
const getPreferences = (0,
|
|
3296
|
+
const getPreferences = (0, import_react5.useCallback)(
|
|
3298
3297
|
(userId) => get(
|
|
3299
3298
|
`/notifications/preferences/${encodeURIComponent(userId)}`
|
|
3300
3299
|
),
|
|
3301
3300
|
[get]
|
|
3302
3301
|
);
|
|
3303
|
-
const updatePreferences = (0,
|
|
3302
|
+
const updatePreferences = (0, import_react5.useCallback)(
|
|
3304
3303
|
(userId, prefs) => post(
|
|
3305
3304
|
`/notifications/preferences/${encodeURIComponent(userId)}`,
|
|
3306
3305
|
prefs
|
|
@@ -3383,12 +3382,12 @@ function usePatientSearch(options) {
|
|
|
3383
3382
|
|
|
3384
3383
|
// src/react/patients-bulk.ts
|
|
3385
3384
|
var import_server8 = require("convex/server");
|
|
3386
|
-
var
|
|
3385
|
+
var import_react6 = require("react");
|
|
3387
3386
|
var patientsGetByIdsRef = (0, import_server8.makeFunctionReference)("patients:getByIds");
|
|
3388
3387
|
var patientsGetByPhonesRef = (0, import_server8.makeFunctionReference)("patients:getByPhones");
|
|
3389
3388
|
var SKIP5 = "skip";
|
|
3390
3389
|
function usePatientsByIds(ids) {
|
|
3391
|
-
const stableIds = (0,
|
|
3390
|
+
const stableIds = (0, import_react6.useMemo)(() => {
|
|
3392
3391
|
const arr = ids != null ? ids : [];
|
|
3393
3392
|
return [...new Set(arr)].sort();
|
|
3394
3393
|
}, [ids]);
|
|
@@ -3397,7 +3396,7 @@ function usePatientsByIds(ids) {
|
|
|
3397
3396
|
patientsGetByIdsRef,
|
|
3398
3397
|
skipped ? SKIP5 : { ids: stableIds }
|
|
3399
3398
|
);
|
|
3400
|
-
const mapped = (0,
|
|
3399
|
+
const mapped = (0, import_react6.useMemo)(() => {
|
|
3401
3400
|
if (result === void 0) {
|
|
3402
3401
|
return void 0;
|
|
3403
3402
|
}
|
|
@@ -3419,7 +3418,7 @@ function usePatientsByIds(ids) {
|
|
|
3419
3418
|
};
|
|
3420
3419
|
}
|
|
3421
3420
|
function usePatientsByPhones(phones) {
|
|
3422
|
-
const stableDigits = (0,
|
|
3421
|
+
const stableDigits = (0, import_react6.useMemo)(() => {
|
|
3423
3422
|
const arr = phones != null ? phones : [];
|
|
3424
3423
|
const digits = arr.map((p) => p.replace(/\D+/g, "")).filter((s) => s.length > 0);
|
|
3425
3424
|
return [...new Set(digits)].sort();
|
|
@@ -3429,7 +3428,7 @@ function usePatientsByPhones(phones) {
|
|
|
3429
3428
|
patientsGetByPhonesRef,
|
|
3430
3429
|
skipped ? SKIP5 : { phoneDigits: stableDigits }
|
|
3431
3430
|
);
|
|
3432
|
-
const mapped = (0,
|
|
3431
|
+
const mapped = (0, import_react6.useMemo)(() => {
|
|
3433
3432
|
if (result === void 0) {
|
|
3434
3433
|
return void 0;
|
|
3435
3434
|
}
|
|
@@ -3468,23 +3467,23 @@ function useRemindersForConversations(conversationIds) {
|
|
|
3468
3467
|
}
|
|
3469
3468
|
|
|
3470
3469
|
// src/react/tasks.ts
|
|
3471
|
-
var
|
|
3470
|
+
var import_react7 = require("convex/react");
|
|
3472
3471
|
var import_server10 = require("convex/server");
|
|
3473
|
-
var
|
|
3472
|
+
var import_react8 = require("react");
|
|
3474
3473
|
var conversationTasksMarkSeenRef = (0, import_server10.makeFunctionReference)("conversationTasks:markSeen");
|
|
3475
3474
|
function useConversationTaskMarkSeen() {
|
|
3476
|
-
const mutate = (0,
|
|
3475
|
+
const mutate = (0, import_react7.useMutation)(
|
|
3477
3476
|
conversationTasksMarkSeenRef
|
|
3478
3477
|
);
|
|
3479
|
-
return (0,
|
|
3478
|
+
return (0, import_react8.useCallback)(
|
|
3480
3479
|
(taskId, userId) => mutate({ taskId, userId }),
|
|
3481
3480
|
[mutate]
|
|
3482
3481
|
);
|
|
3483
3482
|
}
|
|
3484
3483
|
|
|
3485
3484
|
// src/react/tracking.ts
|
|
3486
|
-
var
|
|
3487
|
-
var TruthTrackingContext = (0,
|
|
3485
|
+
var import_react9 = require("react");
|
|
3486
|
+
var TruthTrackingContext = (0, import_react9.createContext)(
|
|
3488
3487
|
null
|
|
3489
3488
|
);
|
|
3490
3489
|
function TruthTrackingProvider({
|
|
@@ -3497,7 +3496,7 @@ function TruthTrackingProvider({
|
|
|
3497
3496
|
}) {
|
|
3498
3497
|
var _a, _b;
|
|
3499
3498
|
const resolvedApiKey = (_b = apiKey != null ? apiKey : typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.EXPO_PUBLIC_TRUTH_API_KEY : void 0) != null ? _b : "";
|
|
3500
|
-
const value = (0,
|
|
3499
|
+
const value = (0, import_react9.useMemo)(() => {
|
|
3501
3500
|
const tracker = new Tracker({
|
|
3502
3501
|
apiKey: resolvedApiKey,
|
|
3503
3502
|
environment,
|
|
@@ -3516,10 +3515,10 @@ function TruthTrackingProvider({
|
|
|
3516
3515
|
}
|
|
3517
3516
|
};
|
|
3518
3517
|
}, [resolvedApiKey, environment, source, sourceVersion, tenantId]);
|
|
3519
|
-
return (0,
|
|
3518
|
+
return (0, import_react9.createElement)(TruthTrackingContext.Provider, { value }, children);
|
|
3520
3519
|
}
|
|
3521
3520
|
function useTruth() {
|
|
3522
|
-
const ctx = (0,
|
|
3521
|
+
const ctx = (0, import_react9.useContext)(TruthTrackingContext);
|
|
3523
3522
|
if (!ctx) {
|
|
3524
3523
|
throw new Error("useTruth must be used within a TruthTrackingProvider");
|
|
3525
3524
|
}
|
|
@@ -3547,15 +3546,15 @@ function useUserSettings(userId) {
|
|
|
3547
3546
|
}
|
|
3548
3547
|
|
|
3549
3548
|
// src/react/users.ts
|
|
3550
|
-
var
|
|
3549
|
+
var import_react10 = require("react");
|
|
3551
3550
|
function useUserSync(input) {
|
|
3552
3551
|
var _a, _b, _c, _d;
|
|
3553
3552
|
const sdkContext = useTruthSdkContext();
|
|
3554
3553
|
const apiBaseUrl = (_b = (_a = input.apiBaseUrl) != null ? _a : sdkContext == null ? void 0 : sdkContext.apiBaseUrl) != null ? _b : "";
|
|
3555
3554
|
const apiKey = (_d = (_c = input.apiKey) != null ? _c : sdkContext == null ? void 0 : sdkContext.apiKey) != null ? _d : "";
|
|
3556
|
-
const [status, setStatus] = (0,
|
|
3557
|
-
const [error, setError] = (0,
|
|
3558
|
-
const lastKeyRef = (0,
|
|
3555
|
+
const [status, setStatus] = (0, import_react10.useState)("idle");
|
|
3556
|
+
const [error, setError] = (0, import_react10.useState)(null);
|
|
3557
|
+
const lastKeyRef = (0, import_react10.useRef)(null);
|
|
3559
3558
|
const sync = () => __async(null, null, function* () {
|
|
3560
3559
|
if (!input.userId) {
|
|
3561
3560
|
return { ok: false, reason: "missing_userId" };
|
|
@@ -3598,7 +3597,7 @@ function useUserSync(input) {
|
|
|
3598
3597
|
return { ok: false, reason: message };
|
|
3599
3598
|
}
|
|
3600
3599
|
});
|
|
3601
|
-
(0,
|
|
3600
|
+
(0, import_react10.useEffect)(() => {
|
|
3602
3601
|
var _a2, _b2, _c2, _d2, _e;
|
|
3603
3602
|
if (!input.userId) {
|
|
3604
3603
|
return;
|
|
@@ -3637,13 +3636,13 @@ function useUserSync(input) {
|
|
|
3637
3636
|
}
|
|
3638
3637
|
|
|
3639
3638
|
// src/react/voicemail.ts
|
|
3640
|
-
var
|
|
3639
|
+
var import_react11 = require("react");
|
|
3641
3640
|
function useVoicemailUrl(client) {
|
|
3642
|
-
const [url, setUrl] = (0,
|
|
3643
|
-
const [isLoading, setIsLoading] = (0,
|
|
3644
|
-
const [error, setError] = (0,
|
|
3645
|
-
const inFlightRef = (0,
|
|
3646
|
-
const fetchUrl = (0,
|
|
3641
|
+
const [url, setUrl] = (0, import_react11.useState)(null);
|
|
3642
|
+
const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
|
|
3643
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
3644
|
+
const inFlightRef = (0, import_react11.useRef)(false);
|
|
3645
|
+
const fetchUrl = (0, import_react11.useCallback)(
|
|
3647
3646
|
(voicemailLink) => __async(null, null, function* () {
|
|
3648
3647
|
if (inFlightRef.current) {
|
|
3649
3648
|
return null;
|