@hipnation-truth/sdk 0.26.16 → 0.26.18
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 +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +32 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -5
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +28 -2
- package/dist/react.js +87 -16
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -745,6 +745,15 @@ declare function useConversationMessages(input: {
|
|
|
745
745
|
* - addReceivedListener / addResponseListener — re-exports of expo's
|
|
746
746
|
* - getBadgeCount / setBadgeCount — re-exports of expo's
|
|
747
747
|
*
|
|
748
|
+
* Fresh-install registration (FIX #2): the hook installs a native
|
|
749
|
+
* `Notifications.addPushTokenListener` so a device token that arrives AFTER
|
|
750
|
+
* the initial mount (the OS registers for APNs/FCM asynchronously on a first
|
|
751
|
+
* install) still triggers registration — no app relaunch required. It also
|
|
752
|
+
* re-registers when `userId` transitions from null/undefined → a value, so a
|
|
753
|
+
* login right after install attributes the device to the user. The public hook
|
|
754
|
+
* API is unchanged — mounting the hook (with `autoRegister` left at its default
|
|
755
|
+
* `true`) is all the client needs; there is no new method to call.
|
|
756
|
+
*
|
|
748
757
|
* Web push (VAPID subscription) lands in Phase 3.
|
|
749
758
|
*/
|
|
750
759
|
type PermissionStatus = "granted" | "denied" | "undetermined" | "unknown";
|
|
@@ -2171,7 +2180,21 @@ interface ScheduleReminderInput {
|
|
|
2171
2180
|
conversationId: string;
|
|
2172
2181
|
remindAt: string | Date;
|
|
2173
2182
|
note?: string;
|
|
2183
|
+
/**
|
|
2184
|
+
* Who scheduled the reminder. May be the end user's email — the backend
|
|
2185
|
+
* translates it to a Clerk id for push targeting. Prefer also passing
|
|
2186
|
+
* `createdByClerkId` when known so the reminder push lands on the right
|
|
2187
|
+
* device-bearing identity.
|
|
2188
|
+
*/
|
|
2174
2189
|
createdBy: string;
|
|
2190
|
+
/**
|
|
2191
|
+
* Optional pre-resolved Clerk id of the creator. Push devices + the push
|
|
2192
|
+
* tenancy gate are keyed by Clerk id, so passing it lets the reminder push
|
|
2193
|
+
* (and its conversation deep-link) target the right identity directly
|
|
2194
|
+
* instead of relying on an email→user lookup at fire time. When omitted the
|
|
2195
|
+
* backend resolves it from `createdBy`.
|
|
2196
|
+
*/
|
|
2197
|
+
createdByClerkId?: string;
|
|
2175
2198
|
}
|
|
2176
2199
|
interface ScheduleReminderResult {
|
|
2177
2200
|
reminderId: string;
|
|
@@ -2252,8 +2275,11 @@ interface ConversationTaskMarkSeenInput {
|
|
|
2252
2275
|
* TasksResource — create, update status, list, get tasks.
|
|
2253
2276
|
*
|
|
2254
2277
|
* Backed by Convex. Replaces CommHub's createTaskWithNotification +
|
|
2255
|
-
* updateTaskStatusWithNotification actions.
|
|
2256
|
-
* is emitted
|
|
2278
|
+
* updateTaskStatusWithNotification actions. The push notification side-effect
|
|
2279
|
+
* is NOT emitted via Kinesis: the Convex task mutation enqueues a
|
|
2280
|
+
* `notificationJobs` row and schedules `notificationScheduler.runJob`, which
|
|
2281
|
+
* HTTP-fetches the Truth Lambda push endpoint (Truth API → Convex scheduler →
|
|
2282
|
+
* push). See apps/web/convex/lib/taskPush.ts.
|
|
2257
2283
|
*/
|
|
2258
2284
|
|
|
2259
2285
|
declare class TasksResource {
|
package/dist/react.js
CHANGED
|
@@ -314,7 +314,14 @@ var AttachmentsResource = class {
|
|
|
314
314
|
return __async(this, null, function* () {
|
|
315
315
|
const res = yield fetch(`${this.baseUrl}/api${path}`, {
|
|
316
316
|
method: "POST",
|
|
317
|
-
|
|
317
|
+
// PHI (patient photos / MMS media) — REQUIRE the user JWT. The server
|
|
318
|
+
// hardens these routes to `verifiedUserProcedure`, so degrading to
|
|
319
|
+
// key-only would 401. `requireUserToken` retries across the Clerk-
|
|
320
|
+
// hydration gap and throws rather than silently sending key-only.
|
|
321
|
+
headers: yield buildAuthHeaders(this.auth, {
|
|
322
|
+
json: true,
|
|
323
|
+
requireUserToken: true
|
|
324
|
+
}),
|
|
318
325
|
body: JSON.stringify(body)
|
|
319
326
|
});
|
|
320
327
|
if (!res.ok) {
|
|
@@ -1030,7 +1037,13 @@ var EhrProviderProxy = class {
|
|
|
1030
1037
|
}
|
|
1031
1038
|
const response = yield fetch(url.toString(), {
|
|
1032
1039
|
method,
|
|
1033
|
-
|
|
1040
|
+
// PHI (EHR/Elation proxy) — REQUIRE the user JWT. The server hardens the
|
|
1041
|
+
// EHR proxy routes to `verifiedUserProcedure`, so degrading to key-only
|
|
1042
|
+
// would 401.
|
|
1043
|
+
headers: yield buildAuthHeaders(this.auth, {
|
|
1044
|
+
json: body !== void 0,
|
|
1045
|
+
requireUserToken: true
|
|
1046
|
+
}),
|
|
1034
1047
|
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1035
1048
|
});
|
|
1036
1049
|
if (!response.ok) {
|
|
@@ -1123,7 +1136,12 @@ var _NotesResource = class _NotesResource {
|
|
|
1123
1136
|
try {
|
|
1124
1137
|
res = yield fetch(`${this.baseUrl}/api${path}`, {
|
|
1125
1138
|
method: "POST",
|
|
1126
|
-
|
|
1139
|
+
// PHI (clinical notes) — REQUIRE the user JWT. The server hardens these
|
|
1140
|
+
// routes to `verifiedUserProcedure`, so degrading to key-only would 401.
|
|
1141
|
+
headers: yield buildAuthHeaders(this.auth, {
|
|
1142
|
+
json: true,
|
|
1143
|
+
requireUserToken: true
|
|
1144
|
+
}),
|
|
1127
1145
|
body: JSON.stringify(body),
|
|
1128
1146
|
signal: controller.signal
|
|
1129
1147
|
});
|
|
@@ -1366,7 +1384,15 @@ var PatientDetailsResource = class {
|
|
|
1366
1384
|
return __async(this, null, function* () {
|
|
1367
1385
|
const res = yield fetch(`${this.baseUrl}/api${path}`, {
|
|
1368
1386
|
method: "POST",
|
|
1369
|
-
|
|
1387
|
+
// PHI (patient chart) — REQUIRE the user JWT. The server hardens these
|
|
1388
|
+
// routes to `verifiedUserProcedure`, so degrading to key-only would 401.
|
|
1389
|
+
// `requireUserToken` retries token resolution across the Clerk-hydration
|
|
1390
|
+
// gap and throws a clear auth error if none is obtainable, rather than
|
|
1391
|
+
// silently sending key-only.
|
|
1392
|
+
headers: yield buildAuthHeaders(this.auth, {
|
|
1393
|
+
json: true,
|
|
1394
|
+
requireUserToken: true
|
|
1395
|
+
}),
|
|
1370
1396
|
body: JSON.stringify(body)
|
|
1371
1397
|
});
|
|
1372
1398
|
if (!res.ok) {
|
|
@@ -1603,7 +1629,8 @@ var RemindersResource = class {
|
|
|
1603
1629
|
conversationId: input.conversationId,
|
|
1604
1630
|
remindAt,
|
|
1605
1631
|
note: input.note,
|
|
1606
|
-
createdBy: input.createdBy
|
|
1632
|
+
createdBy: input.createdBy,
|
|
1633
|
+
createdByClerkId: input.createdByClerkId
|
|
1607
1634
|
}
|
|
1608
1635
|
);
|
|
1609
1636
|
return result;
|
|
@@ -2908,17 +2935,10 @@ var allergiesByPatientRef = (0, import_server5.makeFunctionReference)("medicalRe
|
|
|
2908
2935
|
var appointmentsByPatientRef = (0, import_server5.makeFunctionReference)("medicalRecords:getAppointmentsByElationPatient");
|
|
2909
2936
|
function postPatientRefresh(url, apiKey, getAuthToken, body, signal) {
|
|
2910
2937
|
return __async(this, null, function* () {
|
|
2911
|
-
const headers =
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
try {
|
|
2916
|
-
const token = yield getAuthToken == null ? void 0 : getAuthToken();
|
|
2917
|
-
if (token) {
|
|
2918
|
-
headers.Authorization = `Bearer ${token}`;
|
|
2919
|
-
}
|
|
2920
|
-
} catch (e) {
|
|
2921
|
-
}
|
|
2938
|
+
const headers = yield buildAuthHeaders(
|
|
2939
|
+
{ apiKey, getAuthToken },
|
|
2940
|
+
{ json: true, requireUserToken: true }
|
|
2941
|
+
);
|
|
2922
2942
|
yield fetch(url, {
|
|
2923
2943
|
method: "POST",
|
|
2924
2944
|
headers,
|
|
@@ -3110,6 +3130,7 @@ function useNotifications(options) {
|
|
|
3110
3130
|
const expoRef = (0, import_react6.useRef)(null);
|
|
3111
3131
|
const isWebRef = (0, import_react6.useRef)(false);
|
|
3112
3132
|
const vapidKeyRef = (0, import_react6.useRef)((_e = options.vapidPublicKey) != null ? _e : null);
|
|
3133
|
+
const prevUserIdRef = (0, import_react6.useRef)(void 0);
|
|
3113
3134
|
(0, import_react6.useEffect)(() => {
|
|
3114
3135
|
let mounted = true;
|
|
3115
3136
|
void (() => __async(null, null, function* () {
|
|
@@ -3368,6 +3389,56 @@ function useNotifications(options) {
|
|
|
3368
3389
|
yield expo.setBadgeCountAsync(count);
|
|
3369
3390
|
}), []);
|
|
3370
3391
|
const autoRegister = options.autoRegister !== false;
|
|
3392
|
+
(0, import_react6.useEffect)(() => {
|
|
3393
|
+
if (!autoRegister) {
|
|
3394
|
+
return;
|
|
3395
|
+
}
|
|
3396
|
+
if (isWebRef.current) {
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3399
|
+
let cancelled = false;
|
|
3400
|
+
let remove;
|
|
3401
|
+
void (() => __async(null, null, function* () {
|
|
3402
|
+
var _a2;
|
|
3403
|
+
const expo = (_a2 = expoRef.current) != null ? _a2 : yield loadExpo();
|
|
3404
|
+
expoRef.current = expo;
|
|
3405
|
+
if (cancelled || !(expo == null ? void 0 : expo.addPushTokenListener)) {
|
|
3406
|
+
return;
|
|
3407
|
+
}
|
|
3408
|
+
const sub = expo.addPushTokenListener((devicePushTokenEvent) => {
|
|
3409
|
+
if (cancelled) {
|
|
3410
|
+
return;
|
|
3411
|
+
}
|
|
3412
|
+
const data = devicePushTokenEvent == null ? void 0 : devicePushTokenEvent.data;
|
|
3413
|
+
if (typeof data !== "string" || !data) {
|
|
3414
|
+
return;
|
|
3415
|
+
}
|
|
3416
|
+
setDevicePushToken(data);
|
|
3417
|
+
if (options.userId) {
|
|
3418
|
+
void register();
|
|
3419
|
+
}
|
|
3420
|
+
});
|
|
3421
|
+
remove = () => {
|
|
3422
|
+
var _a3;
|
|
3423
|
+
return (_a3 = sub == null ? void 0 : sub.remove) == null ? void 0 : _a3.call(sub);
|
|
3424
|
+
};
|
|
3425
|
+
}))();
|
|
3426
|
+
return () => {
|
|
3427
|
+
cancelled = true;
|
|
3428
|
+
remove == null ? void 0 : remove();
|
|
3429
|
+
};
|
|
3430
|
+
}, [autoRegister, options.userId, register]);
|
|
3431
|
+
(0, import_react6.useEffect)(() => {
|
|
3432
|
+
const prev = prevUserIdRef.current;
|
|
3433
|
+
prevUserIdRef.current = options.userId;
|
|
3434
|
+
if (!autoRegister) {
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
if (!options.userId || prev) {
|
|
3438
|
+
return;
|
|
3439
|
+
}
|
|
3440
|
+
void register();
|
|
3441
|
+
}, [options.userId, autoRegister, register]);
|
|
3371
3442
|
(0, import_react6.useEffect)(() => {
|
|
3372
3443
|
if (!autoRegister) {
|
|
3373
3444
|
return;
|