@hipnation-truth/sdk 0.26.19 → 0.27.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 CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as convex_browser from 'convex/browser';
2
2
  import { ConvexHttpClient } from 'convex/browser';
3
+ import { z } from 'zod';
3
4
 
4
5
  /**
5
6
  * Appointment interfaces for the Truth SDK.
@@ -208,7 +209,6 @@ declare class AttachmentsError extends Error {
208
209
  }
209
210
  declare class AttachmentsResource {
210
211
  private readonly baseUrl;
211
- private readonly apiKey;
212
212
  private readonly auth;
213
213
  private readonly convex;
214
214
  constructor(apiBaseUrl: string, apiKey: string, convexClient: ConvexHttpClient, getAuthToken?: AuthTokenFetcher);
@@ -473,7 +473,6 @@ interface VoicemailAuthResponse {
473
473
  }
474
474
  declare class DialpadResource {
475
475
  private readonly baseUrl;
476
- private readonly apiKey;
477
476
  private readonly auth;
478
477
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
479
478
  /**
@@ -539,7 +538,6 @@ declare class DialpadResource {
539
538
  declare class MessagesResource {
540
539
  readonly dialpad: DialpadResource;
541
540
  private readonly baseUrl;
542
- private readonly apiKey;
543
541
  private readonly auth;
544
542
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
545
543
  /**
@@ -685,7 +683,6 @@ interface PushConversationToElationResult {
685
683
  }
686
684
  declare class NotesResource {
687
685
  private readonly baseUrl;
688
- private readonly apiKey;
689
686
  private readonly auth;
690
687
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
691
688
  /** 30s upstream timeout — Elation API has occasional slow hops; we
@@ -831,7 +828,6 @@ declare class NotificationsError extends Error {
831
828
  }
832
829
  declare class NotificationsResource {
833
830
  private readonly baseUrl;
834
- private readonly apiKey;
835
831
  private readonly auth;
836
832
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
837
833
  private post;
@@ -917,7 +913,6 @@ declare class PatientDetailsError extends Error {
917
913
  }
918
914
  declare class PatientDetailsResource {
919
915
  private readonly baseUrl;
920
- private readonly apiKey;
921
916
  private readonly auth;
922
917
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
923
918
  private post;
@@ -1123,6 +1118,124 @@ declare class RemindersResource {
1123
1118
  listByConversation(conversationId: string): Promise<Reminder[]>;
1124
1119
  }
1125
1120
 
1121
+ /**
1122
+ * ReportsResource — member activation report from truth.
1123
+ *
1124
+ * Accesses the Truth API at GET /reports/member-activation,
1125
+ * authenticated with X-API-Key + user JWT (verifiedUserProcedure).
1126
+ *
1127
+ * Replaces the broker pattern: frontend calls truth directly via SDK,
1128
+ * no comhub hop.
1129
+ */
1130
+
1131
+ declare const reportSchema: z.ZodObject<{
1132
+ synthetic: z.ZodBoolean;
1133
+ generatedAt: z.ZodString;
1134
+ employers: z.ZodArray<z.ZodObject<{
1135
+ id: z.ZodString;
1136
+ name: z.ZodString;
1137
+ activeMembers: z.ZodNumber;
1138
+ }, z.core.$strip>>;
1139
+ selected: z.ZodNullable<z.ZodObject<{
1140
+ employerId: z.ZodString;
1141
+ employerName: z.ZodString;
1142
+ kpis: z.ZodObject<{
1143
+ active: z.ZodNumber;
1144
+ linked: z.ZodNumber;
1145
+ activated: z.ZodNumber;
1146
+ needsOutreach: z.ZodNumber;
1147
+ scheduled: z.ZodNumber;
1148
+ needsReview: z.ZodNumber;
1149
+ dataIssue: z.ZodNumber;
1150
+ activationRate: z.ZodNumber;
1151
+ }, z.core.$strip>;
1152
+ coverage: z.ZodObject<{
1153
+ active: z.ZodNumber;
1154
+ linked: z.ZodNumber;
1155
+ unlinked: z.ZodNumber;
1156
+ pct: z.ZodNumber;
1157
+ }, z.core.$strip>;
1158
+ breakdown: z.ZodArray<z.ZodObject<{
1159
+ status: z.ZodEnum<{
1160
+ data: "data";
1161
+ activated: "activated";
1162
+ outreach: "outreach";
1163
+ scheduled: "scheduled";
1164
+ review: "review";
1165
+ }>;
1166
+ label: z.ZodString;
1167
+ count: z.ZodNumber;
1168
+ pct: z.ZodNumber;
1169
+ }, z.core.$strip>>;
1170
+ aging: z.ZodArray<z.ZodObject<{
1171
+ bucket: z.ZodString;
1172
+ total: z.ZodNumber;
1173
+ outreach: z.ZodNumber;
1174
+ scheduled: z.ZodNumber;
1175
+ review: z.ZodNumber;
1176
+ }, z.core.$strip>>;
1177
+ doctors: z.ZodArray<z.ZodObject<{
1178
+ name: z.ZodString;
1179
+ counts: z.ZodObject<{
1180
+ outreach: z.ZodNumber;
1181
+ scheduled: z.ZodNumber;
1182
+ review: z.ZodNumber;
1183
+ data: z.ZodNumber;
1184
+ }, z.core.$strip>;
1185
+ members: z.ZodArray<z.ZodObject<{
1186
+ elationId: z.ZodString;
1187
+ name: z.ZodString;
1188
+ doctor: z.ZodNullable<z.ZodString>;
1189
+ status: z.ZodEnum<{
1190
+ data: "data";
1191
+ activated: "activated";
1192
+ outreach: "outreach";
1193
+ scheduled: "scheduled";
1194
+ review: "review";
1195
+ }>;
1196
+ membershipStart: z.ZodString;
1197
+ daysSinceMembershipStart: z.ZodNumber;
1198
+ activationDate: z.ZodNullable<z.ZodString>;
1199
+ futureApptDate: z.ZodNullable<z.ZodString>;
1200
+ reason: z.ZodNullable<z.ZodString>;
1201
+ hasLink: z.ZodBoolean;
1202
+ }, z.core.$strip>>;
1203
+ }, z.core.$strip>>;
1204
+ }, z.core.$strip>>;
1205
+ pending: z.ZodBoolean;
1206
+ }, z.core.$strip>;
1207
+ type MemberActivationReport = z.infer<typeof reportSchema>;
1208
+ declare class ReportsError extends Error {
1209
+ readonly status: number;
1210
+ /**
1211
+ * Wraps a failed reports HTTP call with the operation name and status
1212
+ * code so callers can branch on `status` without re-parsing the message.
1213
+ * Falls back to a generated message when the server response body is
1214
+ * empty or unreadable.
1215
+ */
1216
+ constructor(operation: string, status: number, message?: string);
1217
+ }
1218
+ declare class ReportsResource {
1219
+ private readonly baseUrl;
1220
+ private readonly auth;
1221
+ /**
1222
+ * Captures the Truth API base URL and the auth inputs (API key + optional
1223
+ * user-token fetcher) needed to authenticate every request this resource
1224
+ * makes.
1225
+ */
1226
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
1227
+ /**
1228
+ * Fetches the member activation report from GET /reports/member-activation,
1229
+ * optionally scoped to a single employer. Requires the user JWT (not just
1230
+ * the API key) since the server hardens this route to
1231
+ * `verifiedUserProcedure` for PHI access — throws via `ReportsError` on a
1232
+ * non-OK response, including the response body (truncated) when present.
1233
+ */
1234
+ memberActivation(params?: {
1235
+ employerId?: string;
1236
+ }): Promise<MemberActivationReport>;
1237
+ }
1238
+
1126
1239
  type TaskStatus = "open" | "in_progress" | "resolved" | "cancelled";
1127
1240
  interface Task {
1128
1241
  _id: string;
@@ -1246,7 +1359,6 @@ declare class TranslationError extends Error {
1246
1359
  }
1247
1360
  declare class TranslationResource {
1248
1361
  private readonly baseUrl;
1249
- private readonly apiKey;
1250
1362
  private readonly auth;
1251
1363
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
1252
1364
  private post;
@@ -1675,6 +1787,8 @@ declare class TruthClient {
1675
1787
  readonly patientDetails: PatientDetailsResource;
1676
1788
  /** Attachments — presigned S3 upload/download + Convex metadata */
1677
1789
  readonly attachments: AttachmentsResource;
1790
+ /** Reports — member activation report (Truth API) */
1791
+ readonly reports: ReportsResource;
1678
1792
  /** Notes — push formatted notes to Elation */
1679
1793
  readonly notes: NotesResource;
1680
1794
  /** Physicians (Convex-backed cache from Elation) */
@@ -1691,8 +1805,18 @@ declare class TruthClient {
1691
1805
  private _vapidPublicKey;
1692
1806
  private _webPushReady;
1693
1807
  private readonly _serviceWorkerPath;
1808
+ /**
1809
+ * Builds the Convex client and event tracker from `config`, then wires up
1810
+ * every resource (patients, appointments, EHR proxy, reports, etc.) so
1811
+ * each shares the same Convex connection / API base URL / auth token
1812
+ * fetcher. When running in a browser that supports web push and the
1813
+ * caller hasn't opted out, kicks off best-effort service-worker
1814
+ * registration and push subscription in the background.
1815
+ */
1694
1816
  constructor(config: TruthClientConfig);
1817
+ /** The VAPID public key fetched during web-push init, or `null` until `webPushReady` resolves (or if push is unsupported/disabled). */
1695
1818
  get vapidPublicKey(): string | null;
1819
+ /** Resolves once background web-push initialization (service worker registration + subscription) finishes; `null` if it was never started (SSR, unsupported browser, or opted out via config). */
1696
1820
  get webPushReady(): Promise<void> | null;
1697
1821
  /**
1698
1822
  * When a Clerk token fetcher is configured (publishable-key clients),
@@ -1702,6 +1826,14 @@ declare class TruthClient {
1702
1826
  * → resolve immediately (secret-key path is unaffected).
1703
1827
  */
1704
1828
  private waitForAuthToken;
1829
+ /**
1830
+ * Best-effort web-push bootstrap: waits for auth (if configured), fetches
1831
+ * the VAPID key, registers the service worker, subscribes to push, and
1832
+ * registers the device with a placeholder `__pending__` userId (the
1833
+ * backend reconciles this once the real user is known). Any failure
1834
+ * along the way is swallowed — push notifications are opportunistic and
1835
+ * must never break client construction.
1836
+ */
1705
1837
  private initWebPush;
1706
1838
  /**
1707
1839
  * The resolved Truth API base URL for this environment.
@@ -1849,4 +1981,4 @@ declare function subscriptionToJSON(sub: PushSubscription): {
1849
1981
  };
1850
1982
  declare function onServiceWorkerMessage(type: string, callback: (payload: unknown) => void): () => void;
1851
1983
 
1852
- export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, type AuthTokenFetcher, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type CancelScheduledNotificationResult, type ConversationAddress, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type ConversationTaskPriority, type ConversationTaskStatus, ConversationsError, ConversationsResource, type CreateConversationNoteInput, type CreateConversationTaskInput, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationPlatform, type NotificationPreferences, type NotificationSentPayload, NotificationsError, NotificationsResource, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushEventPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type RegisterDeviceInput, type RegisterDeviceResult, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, SECURITY_EVENTS, type ScheduleNotificationInput, type ScheduleNotificationResult, type ScheduleReminderInput, type ScheduleReminderResult, type ScheduledJobStatus, type ScheduledNotification, type SecurityAccessDeniedPayload, type SecurityEventType, type SendConversationMessageInput, type SendConversationMessageResult, type SendNotificationInput, type SendNotificationResult, type SendSmsParams, type SendSmsResponse, type SetConversationTaskStatusInput, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UnregisterDeviceInput, type UpdateNotificationsInput, type UpdateNotificationsResult, type UpdatePreferencesInput, type UpdateTaskStatusInput, type UserSettings, UserSettingsResource, type VoicemailAuthResponse, type WebPushConfig, generateUuidV7, isWebPushSupported, onServiceWorkerMessage, registerServiceWorker, subscribeToPush, subscriptionToJSON };
1984
+ export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, type AuthTokenFetcher, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type CancelScheduledNotificationResult, type ConversationAddress, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type ConversationTaskPriority, type ConversationTaskStatus, ConversationsError, ConversationsResource, type CreateConversationNoteInput, type CreateConversationTaskInput, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, type MemberActivationReport, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationPlatform, type NotificationPreferences, type NotificationSentPayload, NotificationsError, NotificationsResource, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushEventPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type RegisterDeviceInput, type RegisterDeviceResult, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, ReportsError, ReportsResource, SECURITY_EVENTS, type ScheduleNotificationInput, type ScheduleNotificationResult, type ScheduleReminderInput, type ScheduleReminderResult, type ScheduledJobStatus, type ScheduledNotification, type SecurityAccessDeniedPayload, type SecurityEventType, type SendConversationMessageInput, type SendConversationMessageResult, type SendNotificationInput, type SendNotificationResult, type SendSmsParams, type SendSmsResponse, type SetConversationTaskStatusInput, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UnregisterDeviceInput, type UpdateNotificationsInput, type UpdateNotificationsResult, type UpdatePreferencesInput, type UpdateTaskStatusInput, type UserSettings, UserSettingsResource, type VoicemailAuthResponse, type WebPushConfig, generateUuidV7, isWebPushSupported, onServiceWorkerMessage, registerServiceWorker, subscribeToPush, subscriptionToJSON };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as convex_browser from 'convex/browser';
2
2
  import { ConvexHttpClient } from 'convex/browser';
3
+ import { z } from 'zod';
3
4
 
4
5
  /**
5
6
  * Appointment interfaces for the Truth SDK.
@@ -208,7 +209,6 @@ declare class AttachmentsError extends Error {
208
209
  }
209
210
  declare class AttachmentsResource {
210
211
  private readonly baseUrl;
211
- private readonly apiKey;
212
212
  private readonly auth;
213
213
  private readonly convex;
214
214
  constructor(apiBaseUrl: string, apiKey: string, convexClient: ConvexHttpClient, getAuthToken?: AuthTokenFetcher);
@@ -473,7 +473,6 @@ interface VoicemailAuthResponse {
473
473
  }
474
474
  declare class DialpadResource {
475
475
  private readonly baseUrl;
476
- private readonly apiKey;
477
476
  private readonly auth;
478
477
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
479
478
  /**
@@ -539,7 +538,6 @@ declare class DialpadResource {
539
538
  declare class MessagesResource {
540
539
  readonly dialpad: DialpadResource;
541
540
  private readonly baseUrl;
542
- private readonly apiKey;
543
541
  private readonly auth;
544
542
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
545
543
  /**
@@ -685,7 +683,6 @@ interface PushConversationToElationResult {
685
683
  }
686
684
  declare class NotesResource {
687
685
  private readonly baseUrl;
688
- private readonly apiKey;
689
686
  private readonly auth;
690
687
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
691
688
  /** 30s upstream timeout — Elation API has occasional slow hops; we
@@ -831,7 +828,6 @@ declare class NotificationsError extends Error {
831
828
  }
832
829
  declare class NotificationsResource {
833
830
  private readonly baseUrl;
834
- private readonly apiKey;
835
831
  private readonly auth;
836
832
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
837
833
  private post;
@@ -917,7 +913,6 @@ declare class PatientDetailsError extends Error {
917
913
  }
918
914
  declare class PatientDetailsResource {
919
915
  private readonly baseUrl;
920
- private readonly apiKey;
921
916
  private readonly auth;
922
917
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
923
918
  private post;
@@ -1123,6 +1118,124 @@ declare class RemindersResource {
1123
1118
  listByConversation(conversationId: string): Promise<Reminder[]>;
1124
1119
  }
1125
1120
 
1121
+ /**
1122
+ * ReportsResource — member activation report from truth.
1123
+ *
1124
+ * Accesses the Truth API at GET /reports/member-activation,
1125
+ * authenticated with X-API-Key + user JWT (verifiedUserProcedure).
1126
+ *
1127
+ * Replaces the broker pattern: frontend calls truth directly via SDK,
1128
+ * no comhub hop.
1129
+ */
1130
+
1131
+ declare const reportSchema: z.ZodObject<{
1132
+ synthetic: z.ZodBoolean;
1133
+ generatedAt: z.ZodString;
1134
+ employers: z.ZodArray<z.ZodObject<{
1135
+ id: z.ZodString;
1136
+ name: z.ZodString;
1137
+ activeMembers: z.ZodNumber;
1138
+ }, z.core.$strip>>;
1139
+ selected: z.ZodNullable<z.ZodObject<{
1140
+ employerId: z.ZodString;
1141
+ employerName: z.ZodString;
1142
+ kpis: z.ZodObject<{
1143
+ active: z.ZodNumber;
1144
+ linked: z.ZodNumber;
1145
+ activated: z.ZodNumber;
1146
+ needsOutreach: z.ZodNumber;
1147
+ scheduled: z.ZodNumber;
1148
+ needsReview: z.ZodNumber;
1149
+ dataIssue: z.ZodNumber;
1150
+ activationRate: z.ZodNumber;
1151
+ }, z.core.$strip>;
1152
+ coverage: z.ZodObject<{
1153
+ active: z.ZodNumber;
1154
+ linked: z.ZodNumber;
1155
+ unlinked: z.ZodNumber;
1156
+ pct: z.ZodNumber;
1157
+ }, z.core.$strip>;
1158
+ breakdown: z.ZodArray<z.ZodObject<{
1159
+ status: z.ZodEnum<{
1160
+ data: "data";
1161
+ activated: "activated";
1162
+ outreach: "outreach";
1163
+ scheduled: "scheduled";
1164
+ review: "review";
1165
+ }>;
1166
+ label: z.ZodString;
1167
+ count: z.ZodNumber;
1168
+ pct: z.ZodNumber;
1169
+ }, z.core.$strip>>;
1170
+ aging: z.ZodArray<z.ZodObject<{
1171
+ bucket: z.ZodString;
1172
+ total: z.ZodNumber;
1173
+ outreach: z.ZodNumber;
1174
+ scheduled: z.ZodNumber;
1175
+ review: z.ZodNumber;
1176
+ }, z.core.$strip>>;
1177
+ doctors: z.ZodArray<z.ZodObject<{
1178
+ name: z.ZodString;
1179
+ counts: z.ZodObject<{
1180
+ outreach: z.ZodNumber;
1181
+ scheduled: z.ZodNumber;
1182
+ review: z.ZodNumber;
1183
+ data: z.ZodNumber;
1184
+ }, z.core.$strip>;
1185
+ members: z.ZodArray<z.ZodObject<{
1186
+ elationId: z.ZodString;
1187
+ name: z.ZodString;
1188
+ doctor: z.ZodNullable<z.ZodString>;
1189
+ status: z.ZodEnum<{
1190
+ data: "data";
1191
+ activated: "activated";
1192
+ outreach: "outreach";
1193
+ scheduled: "scheduled";
1194
+ review: "review";
1195
+ }>;
1196
+ membershipStart: z.ZodString;
1197
+ daysSinceMembershipStart: z.ZodNumber;
1198
+ activationDate: z.ZodNullable<z.ZodString>;
1199
+ futureApptDate: z.ZodNullable<z.ZodString>;
1200
+ reason: z.ZodNullable<z.ZodString>;
1201
+ hasLink: z.ZodBoolean;
1202
+ }, z.core.$strip>>;
1203
+ }, z.core.$strip>>;
1204
+ }, z.core.$strip>>;
1205
+ pending: z.ZodBoolean;
1206
+ }, z.core.$strip>;
1207
+ type MemberActivationReport = z.infer<typeof reportSchema>;
1208
+ declare class ReportsError extends Error {
1209
+ readonly status: number;
1210
+ /**
1211
+ * Wraps a failed reports HTTP call with the operation name and status
1212
+ * code so callers can branch on `status` without re-parsing the message.
1213
+ * Falls back to a generated message when the server response body is
1214
+ * empty or unreadable.
1215
+ */
1216
+ constructor(operation: string, status: number, message?: string);
1217
+ }
1218
+ declare class ReportsResource {
1219
+ private readonly baseUrl;
1220
+ private readonly auth;
1221
+ /**
1222
+ * Captures the Truth API base URL and the auth inputs (API key + optional
1223
+ * user-token fetcher) needed to authenticate every request this resource
1224
+ * makes.
1225
+ */
1226
+ constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
1227
+ /**
1228
+ * Fetches the member activation report from GET /reports/member-activation,
1229
+ * optionally scoped to a single employer. Requires the user JWT (not just
1230
+ * the API key) since the server hardens this route to
1231
+ * `verifiedUserProcedure` for PHI access — throws via `ReportsError` on a
1232
+ * non-OK response, including the response body (truncated) when present.
1233
+ */
1234
+ memberActivation(params?: {
1235
+ employerId?: string;
1236
+ }): Promise<MemberActivationReport>;
1237
+ }
1238
+
1126
1239
  type TaskStatus = "open" | "in_progress" | "resolved" | "cancelled";
1127
1240
  interface Task {
1128
1241
  _id: string;
@@ -1246,7 +1359,6 @@ declare class TranslationError extends Error {
1246
1359
  }
1247
1360
  declare class TranslationResource {
1248
1361
  private readonly baseUrl;
1249
- private readonly apiKey;
1250
1362
  private readonly auth;
1251
1363
  constructor(apiBaseUrl: string, apiKey: string, getAuthToken?: AuthTokenFetcher);
1252
1364
  private post;
@@ -1675,6 +1787,8 @@ declare class TruthClient {
1675
1787
  readonly patientDetails: PatientDetailsResource;
1676
1788
  /** Attachments — presigned S3 upload/download + Convex metadata */
1677
1789
  readonly attachments: AttachmentsResource;
1790
+ /** Reports — member activation report (Truth API) */
1791
+ readonly reports: ReportsResource;
1678
1792
  /** Notes — push formatted notes to Elation */
1679
1793
  readonly notes: NotesResource;
1680
1794
  /** Physicians (Convex-backed cache from Elation) */
@@ -1691,8 +1805,18 @@ declare class TruthClient {
1691
1805
  private _vapidPublicKey;
1692
1806
  private _webPushReady;
1693
1807
  private readonly _serviceWorkerPath;
1808
+ /**
1809
+ * Builds the Convex client and event tracker from `config`, then wires up
1810
+ * every resource (patients, appointments, EHR proxy, reports, etc.) so
1811
+ * each shares the same Convex connection / API base URL / auth token
1812
+ * fetcher. When running in a browser that supports web push and the
1813
+ * caller hasn't opted out, kicks off best-effort service-worker
1814
+ * registration and push subscription in the background.
1815
+ */
1694
1816
  constructor(config: TruthClientConfig);
1817
+ /** The VAPID public key fetched during web-push init, or `null` until `webPushReady` resolves (or if push is unsupported/disabled). */
1695
1818
  get vapidPublicKey(): string | null;
1819
+ /** Resolves once background web-push initialization (service worker registration + subscription) finishes; `null` if it was never started (SSR, unsupported browser, or opted out via config). */
1696
1820
  get webPushReady(): Promise<void> | null;
1697
1821
  /**
1698
1822
  * When a Clerk token fetcher is configured (publishable-key clients),
@@ -1702,6 +1826,14 @@ declare class TruthClient {
1702
1826
  * → resolve immediately (secret-key path is unaffected).
1703
1827
  */
1704
1828
  private waitForAuthToken;
1829
+ /**
1830
+ * Best-effort web-push bootstrap: waits for auth (if configured), fetches
1831
+ * the VAPID key, registers the service worker, subscribes to push, and
1832
+ * registers the device with a placeholder `__pending__` userId (the
1833
+ * backend reconciles this once the real user is known). Any failure
1834
+ * along the way is swallowed — push notifications are opportunistic and
1835
+ * must never break client construction.
1836
+ */
1705
1837
  private initWebPush;
1706
1838
  /**
1707
1839
  * The resolved Truth API base URL for this environment.
@@ -1849,4 +1981,4 @@ declare function subscriptionToJSON(sub: PushSubscription): {
1849
1981
  };
1850
1982
  declare function onServiceWorkerMessage(type: string, callback: (payload: unknown) => void): () => void;
1851
1983
 
1852
- export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, type AuthTokenFetcher, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type CancelScheduledNotificationResult, type ConversationAddress, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type ConversationTaskPriority, type ConversationTaskStatus, ConversationsError, ConversationsResource, type CreateConversationNoteInput, type CreateConversationTaskInput, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationPlatform, type NotificationPreferences, type NotificationSentPayload, NotificationsError, NotificationsResource, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushEventPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type RegisterDeviceInput, type RegisterDeviceResult, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, SECURITY_EVENTS, type ScheduleNotificationInput, type ScheduleNotificationResult, type ScheduleReminderInput, type ScheduleReminderResult, type ScheduledJobStatus, type ScheduledNotification, type SecurityAccessDeniedPayload, type SecurityEventType, type SendConversationMessageInput, type SendConversationMessageResult, type SendNotificationInput, type SendNotificationResult, type SendSmsParams, type SendSmsResponse, type SetConversationTaskStatusInput, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UnregisterDeviceInput, type UpdateNotificationsInput, type UpdateNotificationsResult, type UpdatePreferencesInput, type UpdateTaskStatusInput, type UserSettings, UserSettingsResource, type VoicemailAuthResponse, type WebPushConfig, generateUuidV7, isWebPushSupported, onServiceWorkerMessage, registerServiceWorker, subscribeToPush, subscriptionToJSON };
1984
+ export { AUTH_EVENTS, type ActorContext, type Appointment, type AppointmentListOptions, AppointmentResource, type Attachment, AttachmentsError, AttachmentsResource, type AuthEventType, type AuthLoginFailedPayload, type AuthLoginSucceededPayload, type AuthTokenFetcher, CALL_EVENTS, CONVERSATION_EVENTS, type CallConnectedPayload, type CallEndedPayload, type CallEventType, type CallInitiatedPayload, type CallMissedPayload, type CallStatusResponse, type CancelScheduledNotificationResult, type ConversationAddress, type ConversationAttachmentDownloadedPayload, type ConversationAttachmentUploadedPayload, type ConversationCreatedPayload, type ConversationEventType, type ConversationMarkedReadPayload, type ConversationMessageReceivedPayload, type ConversationMessageSentPayload, type ConversationTaskPriority, type ConversationTaskStatus, ConversationsError, ConversationsResource, type CreateConversationNoteInput, type CreateConversationTaskInput, type CreateTaskInput, type CreateUploadUrlInput, type CreateUploadUrlResult, type DetectionResult, type DialpadNumberInfo, DialpadProxyError, DialpadResource, type DialpadUser, ENVIRONMENTS, EVENT_TYPES, EhrProviderProxy, EhrProxyError, EhrResource, type Environment, type EventActor, type EventCompliance, type EventEnvelope, type EventPayloadMap, type EventSubject, type EventType, type GetDownloadUrlResult, type InitiateCallResponse, type MemberActivationReport, MessagesResource, NOTIFICATION_EVENTS, type NonVisitNoteBullet, NotesError, NotesResource, type NotificationDeliveredPayload, type NotificationEventType, type NotificationOpenedPayload, type NotificationPlatform, type NotificationPreferences, type NotificationSentPayload, NotificationsError, NotificationsResource, PROVIDER_EVENTS, type PaginatedResult, type Patient, type PatientBasicDetailsResult, PatientDetailsError, type PatientDetailsInput, PatientDetailsResource, type PatientDetailsResult, type PatientListOptions, type PatientMedicalDetailsResult, PatientResource, type Physician, PhysiciansResource, type ProviderEventType, type ProviderSyncFailedPayload, type ProviderSyncStartedPayload, type ProviderSyncSucceededPayload, type PushEventPayload, type PushNoteToElationInput, type PushNoteToElationResult, REMINDER_EVENTS, type RecordAttachmentInput, type RegisterDeviceInput, type RegisterDeviceResult, type Reminder, type ReminderEventType, type ReminderScheduledPayload, type ReminderStatus, type ReminderTriggeredPayload, RemindersResource, ReportsError, ReportsResource, SECURITY_EVENTS, type ScheduleNotificationInput, type ScheduleNotificationResult, type ScheduleReminderInput, type ScheduleReminderResult, type ScheduledJobStatus, type ScheduledNotification, type SecurityAccessDeniedPayload, type SecurityEventType, type SendConversationMessageInput, type SendConversationMessageResult, type SendNotificationInput, type SendNotificationResult, type SendSmsParams, type SendSmsResponse, type SetConversationTaskStatusInput, TASK_EVENTS, TRANSLATION_EVENTS, type Task, type TaskAssignedPayload, type TaskCreatedPayload, type TaskEventType, type TaskStatus, type TaskStatusChangedPayload, TasksResource, type TrackOptions, Tracker, type TranslateBatchInput, type TranslateTextInput, type TranslationCompletedPayload, TranslationError, type TranslationEventType, type TranslationRequestedPayload, TranslationResource, type TranslationResult, TruthClient, type TruthClientConfig, type UnregisterDeviceInput, type UpdateNotificationsInput, type UpdateNotificationsResult, type UpdatePreferencesInput, type UpdateTaskStatusInput, type UserSettings, UserSettingsResource, type VoicemailAuthResponse, type WebPushConfig, generateUuidV7, isWebPushSupported, onServiceWorkerMessage, registerServiceWorker, subscribeToPush, subscriptionToJSON };