@hipnation-truth/sdk 0.26.15 → 0.26.17
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 +39 -2
- package/dist/react.js +83 -5
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -191,6 +191,17 @@ interface ConversationTaskForUserRow extends ConversationTaskRow {
|
|
|
191
191
|
* `seenBy.includes(userId)` to derive the per-user boolean.
|
|
192
192
|
*/
|
|
193
193
|
seenBy: string[];
|
|
194
|
+
/** Persisted archive state (replaces the dropped Hasura `is_archived`). */
|
|
195
|
+
archived: boolean;
|
|
196
|
+
/** ISO timestamp the task was archived, else null. */
|
|
197
|
+
archivedAt: string | null;
|
|
198
|
+
/**
|
|
199
|
+
* Email of whoever made the most recent change (create / status / priority /
|
|
200
|
+
* assignment / archive). The task-notification surfaces read this to SKIP
|
|
201
|
+
* self-changes — the Convex-native replacement for the legacy Hasura
|
|
202
|
+
* `*_changed_by` attribution.
|
|
203
|
+
*/
|
|
204
|
+
lastChangeBy: string | null;
|
|
194
205
|
/**
|
|
195
206
|
* Which backend table the task lives in:
|
|
196
207
|
* - `"conversation"` — `conversationTasks`, tied to a conversation.
|
|
@@ -734,6 +745,15 @@ declare function useConversationMessages(input: {
|
|
|
734
745
|
* - addReceivedListener / addResponseListener — re-exports of expo's
|
|
735
746
|
* - getBadgeCount / setBadgeCount — re-exports of expo's
|
|
736
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
|
+
*
|
|
737
757
|
* Web push (VAPID subscription) lands in Phase 3.
|
|
738
758
|
*/
|
|
739
759
|
type PermissionStatus = "granted" | "denied" | "undetermined" | "unknown";
|
|
@@ -2160,7 +2180,21 @@ interface ScheduleReminderInput {
|
|
|
2160
2180
|
conversationId: string;
|
|
2161
2181
|
remindAt: string | Date;
|
|
2162
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
|
+
*/
|
|
2163
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;
|
|
2164
2198
|
}
|
|
2165
2199
|
interface ScheduleReminderResult {
|
|
2166
2200
|
reminderId: string;
|
|
@@ -2241,8 +2275,11 @@ interface ConversationTaskMarkSeenInput {
|
|
|
2241
2275
|
* TasksResource — create, update status, list, get tasks.
|
|
2242
2276
|
*
|
|
2243
2277
|
* Backed by Convex. Replaces CommHub's createTaskWithNotification +
|
|
2244
|
-
* updateTaskStatusWithNotification actions.
|
|
2245
|
-
* 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.
|
|
2246
2283
|
*/
|
|
2247
2284
|
|
|
2248
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;
|
|
@@ -3110,6 +3137,7 @@ function useNotifications(options) {
|
|
|
3110
3137
|
const expoRef = (0, import_react6.useRef)(null);
|
|
3111
3138
|
const isWebRef = (0, import_react6.useRef)(false);
|
|
3112
3139
|
const vapidKeyRef = (0, import_react6.useRef)((_e = options.vapidPublicKey) != null ? _e : null);
|
|
3140
|
+
const prevUserIdRef = (0, import_react6.useRef)(void 0);
|
|
3113
3141
|
(0, import_react6.useEffect)(() => {
|
|
3114
3142
|
let mounted = true;
|
|
3115
3143
|
void (() => __async(null, null, function* () {
|
|
@@ -3368,6 +3396,56 @@ function useNotifications(options) {
|
|
|
3368
3396
|
yield expo.setBadgeCountAsync(count);
|
|
3369
3397
|
}), []);
|
|
3370
3398
|
const autoRegister = options.autoRegister !== false;
|
|
3399
|
+
(0, import_react6.useEffect)(() => {
|
|
3400
|
+
if (!autoRegister) {
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
if (isWebRef.current) {
|
|
3404
|
+
return;
|
|
3405
|
+
}
|
|
3406
|
+
let cancelled = false;
|
|
3407
|
+
let remove;
|
|
3408
|
+
void (() => __async(null, null, function* () {
|
|
3409
|
+
var _a2;
|
|
3410
|
+
const expo = (_a2 = expoRef.current) != null ? _a2 : yield loadExpo();
|
|
3411
|
+
expoRef.current = expo;
|
|
3412
|
+
if (cancelled || !(expo == null ? void 0 : expo.addPushTokenListener)) {
|
|
3413
|
+
return;
|
|
3414
|
+
}
|
|
3415
|
+
const sub = expo.addPushTokenListener((devicePushTokenEvent) => {
|
|
3416
|
+
if (cancelled) {
|
|
3417
|
+
return;
|
|
3418
|
+
}
|
|
3419
|
+
const data = devicePushTokenEvent == null ? void 0 : devicePushTokenEvent.data;
|
|
3420
|
+
if (typeof data !== "string" || !data) {
|
|
3421
|
+
return;
|
|
3422
|
+
}
|
|
3423
|
+
setDevicePushToken(data);
|
|
3424
|
+
if (options.userId) {
|
|
3425
|
+
void register();
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
remove = () => {
|
|
3429
|
+
var _a3;
|
|
3430
|
+
return (_a3 = sub == null ? void 0 : sub.remove) == null ? void 0 : _a3.call(sub);
|
|
3431
|
+
};
|
|
3432
|
+
}))();
|
|
3433
|
+
return () => {
|
|
3434
|
+
cancelled = true;
|
|
3435
|
+
remove == null ? void 0 : remove();
|
|
3436
|
+
};
|
|
3437
|
+
}, [autoRegister, options.userId, register]);
|
|
3438
|
+
(0, import_react6.useEffect)(() => {
|
|
3439
|
+
const prev = prevUserIdRef.current;
|
|
3440
|
+
prevUserIdRef.current = options.userId;
|
|
3441
|
+
if (!autoRegister) {
|
|
3442
|
+
return;
|
|
3443
|
+
}
|
|
3444
|
+
if (!options.userId || prev) {
|
|
3445
|
+
return;
|
|
3446
|
+
}
|
|
3447
|
+
void register();
|
|
3448
|
+
}, [options.userId, autoRegister, register]);
|
|
3371
3449
|
(0, import_react6.useEffect)(() => {
|
|
3372
3450
|
if (!autoRegister) {
|
|
3373
3451
|
return;
|