@hipnation-truth/sdk 0.18.0 → 0.20.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/react.d.ts CHANGED
@@ -82,6 +82,16 @@ interface ConversationListItem {
82
82
  patientId: string | null;
83
83
  /** ISO timestamp of the most recent message in the conversation. */
84
84
  lastMessageAt: string;
85
+ /**
86
+ * Denormalized preview of the most recent message, for the inbox list +
87
+ * right-panel snippet (so the UI shows the message instead of a literal
88
+ * "Conversation"). Populated by the write path + a one-off backfill.
89
+ */
90
+ lastMessageText: string | null;
91
+ /** `"sms" | "call" | "voicemail"` — drives the preview's icon/label. */
92
+ lastMessageKind: string | null;
93
+ /** `"inbound" | "outbound"` of the previewed message. */
94
+ lastDirection: string | null;
85
95
  /** Caller's unread count for this conversation. */
86
96
  unreadCount: number;
87
97
  /** ISO timestamp of when the caller last marked the conversation read. */
@@ -155,6 +165,11 @@ interface ConversationTaskRow {
155
165
  interface ConversationTaskForUserRow extends ConversationTaskRow {
156
166
  /** Normalized `(patient_phone | provider_phone)` for the task's conversation. */
157
167
  phonePair: string | null;
168
+ /**
169
+ * Resolved patient display name. `null` when the conversation has no
170
+ * linked patient — callers fall back to formatting `phonePair`.
171
+ */
172
+ patientName: string | null;
158
173
  /**
159
174
  * Set of user ids who have seen this task (opened the detail panel).
160
175
  * Replaces the Hasura `event_activities.seen` boolean — use
@@ -181,6 +196,8 @@ interface ConversationMessageRow {
181
196
  toNumber: string | null;
182
197
  voicemailLink: string | null;
183
198
  duration: number | null;
199
+ /** Voicemail/call transcript — Dialpad delivers `{ text }` (B5). */
200
+ transcript: unknown | null;
184
201
  text: string | null;
185
202
  mms: boolean;
186
203
  mmsUrl: string | null;
@@ -639,6 +656,8 @@ interface ConversationMessage {
639
656
  toNumber: string | null;
640
657
  voicemailLink: string | null;
641
658
  duration: number | null;
659
+ /** Voicemail/call transcript — Dialpad delivers `{ text }` (B5). */
660
+ transcript: unknown | null;
642
661
  text: string | null;
643
662
  mms: boolean;
644
663
  mmsUrl: string | null;
@@ -929,6 +948,8 @@ interface PatientSearchResult {
929
948
  /** Hint patient id — present when the row originates from Hint. */
930
949
  hintId: string | undefined;
931
950
  firstName: string;
951
+ /** Middle name — surfaced so the picker renders the full legal name (B9). */
952
+ middleName: string | undefined;
932
953
  lastName: string;
933
954
  /** ISO date string (YYYY-MM-DD) — undefined when not available. */
934
955
  dob: string | undefined;
package/dist/react.js CHANGED
@@ -2390,6 +2390,10 @@ function TruthProvider({
2390
2390
  const convexClient = (0, import_react6.useMemo)(() => new import_react5.ConvexReactClient(url), [url]);
2391
2391
  const truthClient = (0, import_react6.useMemo)(
2392
2392
  () => new TruthClient({
2393
+ // Pin the resource client to the SAME deployment the React hooks
2394
+ // use; without this it falls back to CONVEX_URLS[environment] and a
2395
+ // caller-supplied `convexUrl` would split hooks vs. client methods.
2396
+ convexUrl: url,
2393
2397
  apiKey: resolvedApiKey,
2394
2398
  environment,
2395
2399
  apiBaseUrl: resolvedApiBaseUrl,
@@ -2399,6 +2403,7 @@ function TruthProvider({
2399
2403
  autoInitServiceWorker: false
2400
2404
  }),
2401
2405
  [
2406
+ url,
2402
2407
  resolvedApiKey,
2403
2408
  resolvedApiBaseUrl,
2404
2409
  environment,
@@ -2413,6 +2418,8 @@ function TruthProvider({
2413
2418
  if (_activeClient === truthClient) {
2414
2419
  _activeClient = null;
2415
2420
  }
2421
+ void truthClient.destroy().catch(() => {
2422
+ });
2416
2423
  };
2417
2424
  }, [truthClient]);
2418
2425
  const sdkContext = (0, import_react6.useMemo)(
@@ -2799,6 +2806,9 @@ function useNotifications(options) {
2799
2806
  return { ok: false, reason: "no_native_token" };
2800
2807
  }
2801
2808
  setDevicePushToken(nativeToken);
2809
+ if (!apiBaseUrl || !apiKey) {
2810
+ return { ok: false, reason: "missing_truth_config" };
2811
+ }
2802
2812
  const res = yield fetch(
2803
2813
  `${apiBaseUrl}/api/notifications/devices/register`,
2804
2814
  {
@@ -2960,6 +2970,11 @@ function useNotificationsActions() {
2960
2970
  const apiKey = (_b = sdkContext == null ? void 0 : sdkContext.apiKey) != null ? _b : "";
2961
2971
  const post = (0, import_react9.useCallback)(
2962
2972
  (path, body) => __async(null, null, function* () {
2973
+ if (!apiBaseUrl || !apiKey) {
2974
+ throw new Error(
2975
+ "useNotificationsActions: missing apiBaseUrl/apiKey \u2014 wrap in <TruthProvider> or pass options"
2976
+ );
2977
+ }
2963
2978
  const res = yield fetch(`${apiBaseUrl}/api${path}`, {
2964
2979
  method: "POST",
2965
2980
  headers: {
@@ -3318,6 +3333,11 @@ function useUserSync(input) {
3318
3333
  return;
3319
3334
  }
3320
3335
  const key = [
3336
+ // Include the resolved config so a first mount with missing creds
3337
+ // (sync no-ops as "missing_truth_config") doesn't pin the key and
3338
+ // permanently skip the valid retry once creds arrive.
3339
+ apiBaseUrl,
3340
+ apiKey,
3321
3341
  input.userId,
3322
3342
  (_a2 = input.email) != null ? _a2 : "",
3323
3343
  (_b2 = input.name) != null ? _b2 : "",