@fytkit/sdk 3.4.0 → 3.5.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.ts CHANGED
@@ -12,6 +12,9 @@ import { ZodDate } from 'zod';
12
12
  import { ZodDefault } from 'zod';
13
13
  import { ZodDiscriminatedUnion } from 'zod';
14
14
  import { ZodEnum } from 'zod';
15
+ import { ZodGUID } from 'zod';
16
+ import { ZodISODate } from 'zod';
17
+ import { ZodISODateTime } from 'zod';
15
18
  import { ZodLiteral } from 'zod';
16
19
  import { ZodNullable } from 'zod';
17
20
  import { ZodNumber } from 'zod';
@@ -23,6 +26,12 @@ import { ZodString } from 'zod';
23
26
  import { ZodTransform } from 'zod';
24
27
  import { ZodUnion } from 'zod';
25
28
 
29
+ declare const activeDeveloperAppBrand: unique symbol;
30
+
31
+ declare type ActiveDeveloperAppId = string & {
32
+ readonly [activeDeveloperAppBrand]: true;
33
+ };
34
+
26
35
  declare interface ApiKeyContext {
27
36
  readonly trainerId: string;
28
37
  readonly clientId?: string;
@@ -30,6 +39,7 @@ declare interface ApiKeyContext {
30
39
  readonly clientEntitlements: ClientEntitlements;
31
40
  readonly authMode: "session" | "api-key" | "dev-app";
32
41
  readonly appAllowedOrigins?: readonly string[];
42
+ readonly impersonatedBy: string | null;
33
43
  }
34
44
 
35
45
  /** Auth-state events emitted on `onAuthStateChange`. */
@@ -54,15 +64,22 @@ export declare type AuthState = {
54
64
  };
55
65
 
56
66
  /**
57
- * Member-facing plan features. Each code maps 1:1 onto a premium content
58
- * domain gated by the public API (`src/server/public-api/content-gating.ts`).
59
- * A trainer toggles these per pricing tier; a member's active subscription
60
- * grants the codes attached to the tier they bought.
67
+ * Member-facing plan features. A trainer toggles these per pricing tier; a
68
+ * member's active subscription grants the codes attached to the tier they
69
+ * bought (a legacy subscription with no tier grants them all).
70
+ *
71
+ * - `premium_*` codes each map 1:1 onto a premium content domain gated by the
72
+ * public API (`src/server/public-api/content-gating.ts`).
73
+ * - `coaching_*` codes gate coaching features (D3, epic #461):
74
+ * `coaching_checkins` gates weekly check-ins (#463), and
75
+ * `coaching_messages` gates member-initiated messaging (#465). Staff can
76
+ * always message a member, and a member without `coaching_messages` may
77
+ * still answer a conversation staff started (D2).
61
78
  *
62
79
  * Distinct from `catalogue.ts`, which is the *trainer*-side entitlement
63
80
  * catalogue driven by the trainer's fytkit subscription.
64
81
  */
65
- declare type ClientEntitlementCode = "premium_workouts" | "premium_programs" | "premium_nutrition" | "premium_recipes" | "premium_articles";
82
+ declare type ClientEntitlementCode = "premium_workouts" | "premium_programs" | "premium_nutrition" | "premium_recipes" | "premium_articles" | "coaching_checkins" | "coaching_messages";
66
83
 
67
84
  declare type ClientEntitlements = readonly ClientEntitlementCode[] | "all";
68
85
 
@@ -134,8 +151,11 @@ export declare interface FytkitClient {
134
151
  regenerateBackupCodes: (input: {
135
152
  password: string;
136
153
  }) => Promise<readonly string[]>;
137
- /** With `revokeOtherSessions: true` every other device is signed out and
138
- * the calling session is rotated — the SDK swaps its stored token. */
154
+ /** With `revokeOtherSessions: true` every other session of the account
155
+ * ends, wherever it is held: fytkit's own apps and other developer apps
156
+ * included, not only this app's (a password change is an account-security
157
+ * event). The calling session is rotated too, and the SDK swaps its stored
158
+ * token. */
139
159
  changePassword: (input: {
140
160
  currentPassword: string;
141
161
  newPassword: string;
@@ -146,10 +166,20 @@ export declare interface FytkitClient {
146
166
  changeEmail: (input: {
147
167
  newEmail: string;
148
168
  }) => Promise<void>;
169
+ /** The trainee's unexpired sessions issued through this app, plus the
170
+ * calling one. Sessions in fytkit's own apps, in other developer apps, and
171
+ * from before sessions were bound to apps are never listed. */
149
172
  listSessions: () => Promise<readonly SessionInfo[]>;
173
+ /** Signs out one session `listSessions` returns. Any other `revokeId`
174
+ * (another app's or a first-party session, or an unknown id) rejects with
175
+ * `{ kind: "not_found" }`; the calling session rejects with a 400 (use
176
+ * `signOut`). */
150
177
  revokeSession: (input: {
151
178
  revokeId: string;
152
179
  }) => Promise<void>;
180
+ /** Signs out every session `listSessions` returns except the calling one:
181
+ * the trainee's other devices on this app. Their sessions elsewhere are
182
+ * untouched; `changePassword` with `revokeOtherSessions: true` ends those. */
153
183
  revokeOtherSessions: () => Promise<void>;
154
184
  /** Permanently closes the member's account (cancels their subscriptions,
155
185
  * anonymises their data, deletes the login) after re-verifying the email
@@ -174,6 +204,17 @@ export declare interface FytkitClient {
174
204
  readonly sessionLogs: PublicApi["sessionLog"];
175
205
  readonly progression: PublicApi["progression"];
176
206
  readonly bodyMetrics: PublicApi["bodyMetric"];
207
+ /** Weekly or fortnightly check-ins; needs a plan with `coaching_checkins`. */
208
+ readonly checkIns: PublicApi["checkin"];
209
+ /**
210
+ * The trainee's conversation with their trainer's coaches. Starting one
211
+ * needs a plan with `coaching_messages`; any trainee may answer a coach.
212
+ * `realtimeToken` is a 15-minute token for live updates over Supabase
213
+ * Realtime, and names the one private topic it may join; use
214
+ * `subscribeToMessages`, which joins it, renews the token and says when
215
+ * to poll instead.
216
+ */
217
+ readonly messages: PublicApi["message"];
177
218
  readonly progress: PublicApi["progress"];
178
219
  readonly media: PublicApi["media"];
179
220
  readonly appConfig: PublicApi["appConfig"];
@@ -191,7 +232,16 @@ export declare interface FytkitClientOptions {
191
232
  readonly fetch?: typeof fetch;
192
233
  }
193
234
 
194
- /** Normalized error shape — the SDK never throws raw network/orpc errors. */
235
+ /**
236
+ * Normalized error shape — the SDK never throws raw network/orpc errors.
237
+ *
238
+ * `refusal` (on `forbidden`, `conflict`, `not_found`, `rate_limited`,
239
+ * `validation` and `server`) is the server's structured refusal when it
240
+ * named a reason: a
241
+ * coaching or checkout refusal such as `already_submitted` or
242
+ * `daily_limit`, with the rest of the data it sent (`FytkitRefusal`). Read a
243
+ * known reason's data typed with `refusalData`.
244
+ */
195
245
  export declare type FytkitError = {
196
246
  readonly kind: "auth_required";
197
247
  readonly message?: string;
@@ -199,6 +249,7 @@ export declare type FytkitError = {
199
249
  readonly kind: "forbidden";
200
250
  readonly reason: string;
201
251
  readonly code?: FytkitErrorCode;
252
+ readonly refusal?: FytkitRefusal;
202
253
  } | {
203
254
  readonly kind: "payment_required";
204
255
  readonly message: string;
@@ -206,19 +257,24 @@ export declare type FytkitError = {
206
257
  readonly kind: "conflict";
207
258
  readonly message: string;
208
259
  readonly enrollmentId?: string;
260
+ readonly refusal?: FytkitRefusal;
209
261
  } | {
210
262
  readonly kind: "not_found";
263
+ readonly refusal?: FytkitRefusal;
211
264
  } | {
212
265
  readonly kind: "rate_limited";
213
266
  readonly retryAfter: number;
267
+ readonly refusal?: FytkitRefusal;
214
268
  } | {
215
269
  readonly kind: "validation";
216
270
  readonly issues: readonly unknown[];
271
+ readonly refusal?: FytkitRefusal;
217
272
  } | {
218
273
  readonly kind: "server";
219
274
  readonly status: number;
220
275
  readonly message?: string;
221
276
  readonly code?: FytkitErrorCode;
277
+ readonly refusal?: FytkitRefusal;
222
278
  } | {
223
279
  readonly kind: "network";
224
280
  };
@@ -241,6 +297,229 @@ export declare type FytkitError = {
241
297
  */
242
298
  export declare type FytkitErrorCode = "reauth_required" | "invalid_password" | "invalid_code" | (string & {});
243
299
 
300
+ /**
301
+ * The server's structured refusal on a `FytkitError`: why it said no and
302
+ * what it sent with that. Present only when the server named a reason.
303
+ */
304
+ export declare interface FytkitRefusal {
305
+ /** The machine-readable reason (see `FytkitRefusalReason`). */
306
+ readonly reason: FytkitRefusalReason;
307
+ /** The rest of the error's data, without `reason`. */
308
+ readonly data: Readonly<Record<string, unknown>>;
309
+ }
310
+
311
+ /**
312
+ * What each known reason's `refusal.data` holds, for `refusalData`. The
313
+ * server documents these shapes; the SDK does not check them at runtime, as
314
+ * it trusts every other response shape. An empty record is a refusal that
315
+ * sends nothing beyond its reason.
316
+ */
317
+ export declare interface FytkitRefusalDataByReason {
318
+ /** A coaching feature the member's plan lacks. */
319
+ readonly entitlement_required: {
320
+ readonly entitlement: "coaching_checkins";
321
+ /** On `checkIns.current` only: whether to offer check-ins at all. */
322
+ readonly member?: {
323
+ readonly scheduled: boolean;
324
+ readonly hasCheckins: boolean;
325
+ };
326
+ } | {
327
+ readonly entitlement: "coaching_messages";
328
+ readonly eligibility: "upgrade_required" | "wait_for_coach";
329
+ };
330
+ /** The check-in already sent for this period. */
331
+ readonly already_submitted: {
332
+ readonly checkinId: string;
333
+ readonly submittedAt: string;
334
+ };
335
+ /** The check-in the coach reviewed, so it is locked. */
336
+ readonly reviewed: {
337
+ readonly checkinId: string;
338
+ };
339
+ /** The coach changed the questions; read `checkIns.current` again. */
340
+ readonly questions_changed: Readonly<Record<string, never>>;
341
+ /** The member has no check-in schedule. */
342
+ readonly not_scheduled: Readonly<Record<string, never>>;
343
+ /** `opensOn` is a calendar date, `YYYY-MM-DD`. */
344
+ readonly not_open: {
345
+ readonly opensOn: string;
346
+ };
347
+ /** `currentPeriodStart` is a calendar date, `YYYY-MM-DD`. */
348
+ readonly not_current_period: {
349
+ readonly currentPeriodStart: string;
350
+ };
351
+ /** Answers that don't fit their questions, by question (null: the whole check-in). */
352
+ readonly invalid_answers: {
353
+ readonly issues: readonly {
354
+ readonly questionId: string | null;
355
+ readonly message: string;
356
+ }[];
357
+ };
358
+ /** Photos that can't be added to the check-in; upload them again. */
359
+ readonly invalid_photos: {
360
+ readonly uploadIds: readonly string[];
361
+ };
362
+ /** Photos that can't be sent with the message; upload them again. */
363
+ readonly invalid_attachments: {
364
+ readonly uploadIds: readonly string[];
365
+ };
366
+ /** 20 messages a minute. */
367
+ readonly per_minute_limit: FytkitRefusalRetryAt;
368
+ /** 300 messages a day, until midnight in the studio's time zone. */
369
+ readonly daily_limit: FytkitRefusalRetryAt;
370
+ /** 20 photos requested but not yet sent. */
371
+ readonly too_many_pending_uploads: FytkitRefusalRetryAt;
372
+ /** The member already has an active subscription. */
373
+ readonly already_subscribed: Readonly<Record<string, never>>;
374
+ /** The member's last payment failed and the old subscription is still live. */
375
+ readonly payment_issue: Readonly<Record<string, never>>;
376
+ /** The studio is full. Nothing beyond the reason: the refusal carries no figures. */
377
+ readonly max_clients: Readonly<Record<string, never>>;
378
+ /** The member has no billing account at this studio. */
379
+ readonly no_billing_account: Readonly<Record<string, never>>;
380
+ /** The studio has no connected payments account. */
381
+ readonly no_connected_account: Readonly<Record<string, never>>;
382
+ /** The studio hasn't set up its billing portal. */
383
+ readonly portal_unavailable: Readonly<Record<string, never>>;
384
+ }
385
+
386
+ /**
387
+ * Machine-readable reasons the server attaches to a refusal, as
388
+ * `refusal.reason` on a `FytkitError`. Branch on these rather than on message
389
+ * text. The union is open: the server may add reasons without a breaking SDK
390
+ * release, so always keep a fallback branch.
391
+ *
392
+ * Check-ins (`checkIns.*`):
393
+ * - `"entitlement_required"` (`forbidden`, 403): the member's plan lacks
394
+ * `coaching_checkins`. On `checkIns.current` the data also says whether the
395
+ * member is scheduled and has sent check-ins before (`member`).
396
+ * - `"already_submitted"` (`conflict`, 409): this period already has a
397
+ * check-in, `checkinId`; open or edit it instead.
398
+ * - `"reviewed"` (`conflict`, 409): the coach reviewed it, so it is locked.
399
+ * - `"questions_changed"` (`conflict`, 409): the coach changed the questions;
400
+ * read `checkIns.current` again.
401
+ * - `"not_scheduled"`, `"not_open"` (with `opensOn`), `"not_current_period"`
402
+ * (with `currentPeriodStart`), `"invalid_photos"` (with `uploadIds`)
403
+ * (`server`, 400).
404
+ * - `"invalid_answers"` (`validation`, 400): `issues` by question.
405
+ *
406
+ * Messages (`messages.*`):
407
+ * - `"entitlement_required"` (`forbidden`, 403): the member may not send now;
408
+ * `eligibility` says whether they need an upgrade (`"upgrade_required"`) or
409
+ * should wait for a coach to reply (`"wait_for_coach"`).
410
+ * - `"invalid_attachments"` (`server`, 400): `uploadIds` that can't be sent.
411
+ * - `"per_minute_limit"`, `"daily_limit"` (`rate_limited`, 429): with `limit`
412
+ * and `retryAt`, when sending is allowed again.
413
+ *
414
+ * Photo uploads (`checkIns.requestPhotoUpload`,
415
+ * `messages.requestAttachmentUpload`):
416
+ * - `"too_many_pending_uploads"` (`rate_limited`, 429): with `limit` and
417
+ * `retryAt`.
418
+ *
419
+ * Subscription checkout (`subscription.createCheckout`):
420
+ * - `"already_subscribed"`, `"payment_issue"` (`conflict`, 409).
421
+ * - `"max_clients"` (`forbidden`, 403): the studio is full and takes no new
422
+ * paying members. The server names this one by its quota (`quotaCode`)
423
+ * and sends nothing else with it; the SDK reports it as a reason like the
424
+ * rest, with no data.
425
+ *
426
+ * Billing portal (`subscription.createPortal`):
427
+ * - `"no_billing_account"` (`not_found`, 404): the member never started a
428
+ * paid plan here; hide "Manage billing".
429
+ * - `"no_connected_account"`, `"portal_unavailable"` (`server`, 400): the
430
+ * studio's billing isn't set up; send the member to their coach.
431
+ */
432
+ export declare type FytkitRefusalReason = "entitlement_required" | "already_submitted" | "reviewed" | "questions_changed" | "not_scheduled" | "not_open" | "not_current_period" | "invalid_answers" | "invalid_photos" | "invalid_attachments" | "per_minute_limit" | "daily_limit" | "too_many_pending_uploads" | "already_subscribed" | "payment_issue" | "max_clients" | "no_billing_account" | "no_connected_account" | "portal_unavailable" | (string & {});
433
+
434
+ /** When a limited action is allowed again, as the 429 refusals send it. */
435
+ export declare interface FytkitRefusalRetryAt {
436
+ /** The limit that was reached. */
437
+ readonly limit: number;
438
+ /** ISO 8601 instant when the limit lifts. */
439
+ readonly retryAt: string;
440
+ /** Milliseconds from the refusal until `retryAt`; also the error's `retryAfter`. */
441
+ readonly retryAfterMs?: number;
442
+ }
443
+
444
+ /**
445
+ * How often to poll while the status is `connecting` or `fallback`: the open
446
+ * conversation every 10 seconds, the unread count every 60. Polling spends
447
+ * the app's shared per-minute request budget, so stop while `live`.
448
+ */
449
+ export declare const MESSAGES_FALLBACK_POLL_MS: {
450
+ readonly conversation: 10000;
451
+ readonly unreadCount: 60000;
452
+ };
453
+
454
+ /** An auth-state event, as `auth.onAuthStateChange` reports it; only `type` is read. */
455
+ export declare interface MessagesRealtimeAuthEvent {
456
+ /** `signed_in`, `signed_out`, `session_refreshed` or `signed_out_due_to_token_reuse`. */
457
+ readonly type: string;
458
+ }
459
+
460
+ /** `messages.realtimeToken`'s `data`: a token and the private topic it admits. */
461
+ export declare interface MessagesRealtimeGrant {
462
+ /** A Supabase Realtime token for the signed-in trainee, valid until `expiresAt`. */
463
+ readonly token: string;
464
+ /** When the token expires (ISO 8601), 15 minutes after it was issued. */
465
+ readonly expiresAt: string;
466
+ /** The only private topic the token may join: `member:<client id>`. */
467
+ readonly topic: string;
468
+ }
469
+
470
+ /** The calls the subscription needs. A `FytkitClient` is one. */
471
+ export declare interface MessagesRealtimeSource {
472
+ /** `appConfig.get`, for the Realtime connection settings. */
473
+ readonly appConfig: {
474
+ get(): PromiseLike<{
475
+ readonly data: {
476
+ readonly realtime: RealtimeConnection;
477
+ };
478
+ }>;
479
+ };
480
+ /** `messages.realtimeToken`, for the token and its topic. */
481
+ readonly messages: {
482
+ realtimeToken(input: Record<string, never>): PromiseLike<{
483
+ readonly data: MessagesRealtimeGrant;
484
+ }>;
485
+ };
486
+ /**
487
+ * `auth.onAuthStateChange`, optional. When present, a sign-out on the
488
+ * client (`signed_out`, `signed_out_due_to_token_reuse`) ends the
489
+ * subscription at once with `refused`, rather than at its next renewal:
490
+ * the trainee's channel never outlives their session on this client.
491
+ */
492
+ readonly auth?: {
493
+ onAuthStateChange(listener: (event: MessagesRealtimeAuthEvent) => void): () => void;
494
+ };
495
+ }
496
+
497
+ /**
498
+ * How the conversation is kept current:
499
+ * - `connecting`: before the first answer either way, and while it moves to
500
+ * another trainee's channel. Poll meanwhile.
501
+ * - `live`: the channel is joined; changes arrive as `onChange`. Stop polling.
502
+ * - `fallback`: Realtime is unavailable. Poll at
503
+ * {@link MESSAGES_FALLBACK_POLL_MS}. For now, and `live` may follow, when
504
+ * the token or the connection settings couldn't be fetched (retried every
505
+ * minute), or the channel errored or timed out (supabase-js joins it
506
+ * again by itself), or Realtime closed it (a Realtime restart, a token
507
+ * that expired before its renewal landed: the subscription joins a fresh
508
+ * channel after 5 seconds, then 15, then every minute, with a new token
509
+ * first if the one it holds has expired). For good, and polling carries
510
+ * on, when the server has no live updates to offer (a token without
511
+ * `topic`, no connection settings, or `appConfig.get` refused) or the
512
+ * factory threw.
513
+ * - `refused`: the token request was refused (`auth_required`,
514
+ * `forbidden`, `not_found` or `validation`), asking again won't change
515
+ * that, and nearly always because there is no trainee to listen for
516
+ * (signed out, account closed, a trainer previewing the portal); or the
517
+ * `FytkitClient` passed in signed out. Final: the subscription has
518
+ * stopped and asks nothing more; the conversation reads are refused the
519
+ * same way.
520
+ */
521
+ export declare type MessagesRealtimeStatus = "connecting" | "live" | "fallback" | "refused";
522
+
244
523
  export declare type PublicApi = RouterClient<PublicRouter>;
245
524
 
246
525
  declare type PublicRouter = typeof publicRouter;
@@ -257,12 +536,13 @@ declare const publicRouter: {
257
536
  headers: Headers;
258
537
  }, {
259
538
  trainerId: string;
260
- appId: string;
539
+ appId: ActiveDeveloperAppId;
261
540
  clientId: string | undefined;
262
541
  hasActiveSubscription: boolean;
263
542
  clientEntitlements: ClientEntitlements;
264
543
  authMode: "dev-app";
265
544
  appAllowedOrigins: readonly string[];
545
+ impersonatedBy: string | null;
266
546
  }>, ZodObject< {
267
547
  email: ZodString;
268
548
  password: ZodString;
@@ -289,12 +569,13 @@ declare const publicRouter: {
289
569
  headers: Headers;
290
570
  }, {
291
571
  trainerId: string;
292
- appId: string;
572
+ appId: ActiveDeveloperAppId;
293
573
  clientId: string | undefined;
294
574
  hasActiveSubscription: boolean;
295
575
  clientEntitlements: ClientEntitlements;
296
576
  authMode: "dev-app";
297
577
  appAllowedOrigins: readonly string[];
578
+ impersonatedBy: string | null;
298
579
  }>, ZodObject< {
299
580
  email: ZodString;
300
581
  password: ZodString;
@@ -329,12 +610,13 @@ declare const publicRouter: {
329
610
  headers: Headers;
330
611
  }, {
331
612
  trainerId: string;
332
- appId: string;
613
+ appId: ActiveDeveloperAppId;
333
614
  clientId: string | undefined;
334
615
  hasActiveSubscription: boolean;
335
616
  clientEntitlements: ClientEntitlements;
336
617
  authMode: "dev-app";
337
618
  appAllowedOrigins: readonly string[];
619
+ impersonatedBy: string | null;
338
620
  }>, ZodObject< {
339
621
  token: ZodString;
340
622
  }, $strip>, ZodObject< {
@@ -352,12 +634,13 @@ declare const publicRouter: {
352
634
  headers: Headers;
353
635
  }, {
354
636
  trainerId: string;
355
- appId: string;
637
+ appId: ActiveDeveloperAppId;
356
638
  clientId: string | undefined;
357
639
  hasActiveSubscription: boolean;
358
640
  clientEntitlements: ClientEntitlements;
359
641
  authMode: "dev-app";
360
642
  appAllowedOrigins: readonly string[];
643
+ impersonatedBy: string | null;
361
644
  }>, ZodObject< {
362
645
  token: ZodString;
363
646
  }, $strip>, ZodObject< {
@@ -382,12 +665,13 @@ declare const publicRouter: {
382
665
  headers: Headers;
383
666
  }, {
384
667
  trainerId: string;
385
- appId: string;
668
+ appId: ActiveDeveloperAppId;
386
669
  clientId: string | undefined;
387
670
  hasActiveSubscription: boolean;
388
671
  clientEntitlements: ClientEntitlements;
389
672
  authMode: "dev-app";
390
673
  appAllowedOrigins: readonly string[];
674
+ impersonatedBy: string | null;
391
675
  }>, ZodObject< {
392
676
  email: ZodString;
393
677
  }, $strip>, ZodObject< {
@@ -405,12 +689,13 @@ declare const publicRouter: {
405
689
  headers: Headers;
406
690
  }, {
407
691
  trainerId: string;
408
- appId: string;
692
+ appId: ActiveDeveloperAppId;
409
693
  clientId: string | undefined;
410
694
  hasActiveSubscription: boolean;
411
695
  clientEntitlements: ClientEntitlements;
412
696
  authMode: "dev-app";
413
697
  appAllowedOrigins: readonly string[];
698
+ impersonatedBy: string | null;
414
699
  }>, ZodObject< {
415
700
  token: ZodString;
416
701
  password: ZodString;
@@ -429,12 +714,13 @@ declare const publicRouter: {
429
714
  headers: Headers;
430
715
  }, {
431
716
  trainerId: string;
432
- appId: string;
717
+ appId: ActiveDeveloperAppId;
433
718
  clientId: string | undefined;
434
719
  hasActiveSubscription: boolean;
435
720
  clientEntitlements: ClientEntitlements;
436
721
  authMode: "dev-app";
437
722
  appAllowedOrigins: readonly string[];
723
+ impersonatedBy: string | null;
438
724
  }>, ZodObject< {
439
725
  token: ZodString;
440
726
  }, $strip>, ZodObject< {
@@ -452,12 +738,13 @@ declare const publicRouter: {
452
738
  headers: Headers;
453
739
  }, {
454
740
  trainerId: string;
455
- appId: string;
741
+ appId: ActiveDeveloperAppId;
456
742
  clientId: string | undefined;
457
743
  hasActiveSubscription: boolean;
458
744
  clientEntitlements: ClientEntitlements;
459
745
  authMode: "dev-app";
460
746
  appAllowedOrigins: readonly string[];
747
+ impersonatedBy: string | null;
461
748
  }>, ZodObject< {
462
749
  password: ZodString;
463
750
  }, $strip>, ZodObject< {
@@ -476,12 +763,13 @@ declare const publicRouter: {
476
763
  headers: Headers;
477
764
  }, {
478
765
  trainerId: string;
479
- appId: string;
766
+ appId: ActiveDeveloperAppId;
480
767
  clientId: string | undefined;
481
768
  hasActiveSubscription: boolean;
482
769
  clientEntitlements: ClientEntitlements;
483
770
  authMode: "dev-app";
484
771
  appAllowedOrigins: readonly string[];
772
+ impersonatedBy: string | null;
485
773
  }>, ZodObject< {
486
774
  code: ZodString;
487
775
  }, $strip>, ZodObject< {
@@ -500,12 +788,13 @@ declare const publicRouter: {
500
788
  headers: Headers;
501
789
  }, {
502
790
  trainerId: string;
503
- appId: string;
791
+ appId: ActiveDeveloperAppId;
504
792
  clientId: string | undefined;
505
793
  hasActiveSubscription: boolean;
506
794
  clientEntitlements: ClientEntitlements;
507
795
  authMode: "dev-app";
508
796
  appAllowedOrigins: readonly string[];
797
+ impersonatedBy: string | null;
509
798
  }>, ZodObject< {
510
799
  password: ZodString;
511
800
  }, $strip>, ZodObject< {
@@ -523,12 +812,13 @@ declare const publicRouter: {
523
812
  headers: Headers;
524
813
  }, {
525
814
  trainerId: string;
526
- appId: string;
815
+ appId: ActiveDeveloperAppId;
527
816
  clientId: string | undefined;
528
817
  hasActiveSubscription: boolean;
529
818
  clientEntitlements: ClientEntitlements;
530
819
  authMode: "dev-app";
531
820
  appAllowedOrigins: readonly string[];
821
+ impersonatedBy: string | null;
532
822
  }>, ZodObject< {
533
823
  password: ZodString;
534
824
  }, $strip>, ZodObject< {
@@ -546,12 +836,13 @@ declare const publicRouter: {
546
836
  headers: Headers;
547
837
  }, {
548
838
  trainerId: string;
549
- appId: string;
839
+ appId: ActiveDeveloperAppId;
550
840
  clientId: string | undefined;
551
841
  hasActiveSubscription: boolean;
552
842
  clientEntitlements: ClientEntitlements;
553
843
  authMode: "dev-app";
554
844
  appAllowedOrigins: readonly string[];
845
+ impersonatedBy: string | null;
555
846
  }>, ZodObject< {
556
847
  token: ZodString;
557
848
  code: ZodString;
@@ -577,12 +868,13 @@ declare const publicRouter: {
577
868
  headers: Headers;
578
869
  }, {
579
870
  trainerId: string;
580
- appId: string;
871
+ appId: ActiveDeveloperAppId;
581
872
  clientId: string | undefined;
582
873
  hasActiveSubscription: boolean;
583
874
  clientEntitlements: ClientEntitlements;
584
875
  authMode: "dev-app";
585
876
  appAllowedOrigins: readonly string[];
877
+ impersonatedBy: string | null;
586
878
  }>, ZodObject< {
587
879
  token: ZodString;
588
880
  code: ZodString;
@@ -608,12 +900,13 @@ declare const publicRouter: {
608
900
  headers: Headers;
609
901
  }, {
610
902
  trainerId: string;
611
- appId: string;
903
+ appId: ActiveDeveloperAppId;
612
904
  clientId: string | undefined;
613
905
  hasActiveSubscription: boolean;
614
906
  clientEntitlements: ClientEntitlements;
615
907
  authMode: "dev-app";
616
908
  appAllowedOrigins: readonly string[];
909
+ impersonatedBy: string | null;
617
910
  }>, ZodObject< {
618
911
  token: ZodString;
619
912
  }, $strip>, ZodObject< {
@@ -631,12 +924,13 @@ declare const publicRouter: {
631
924
  headers: Headers;
632
925
  }, {
633
926
  trainerId: string;
634
- appId: string;
927
+ appId: ActiveDeveloperAppId;
635
928
  clientId: string | undefined;
636
929
  hasActiveSubscription: boolean;
637
930
  clientEntitlements: ClientEntitlements;
638
931
  authMode: "dev-app";
639
932
  appAllowedOrigins: readonly string[];
933
+ impersonatedBy: string | null;
640
934
  }>, ZodObject< {
641
935
  token: ZodString;
642
936
  code: ZodString;
@@ -662,12 +956,13 @@ declare const publicRouter: {
662
956
  headers: Headers;
663
957
  }, {
664
958
  trainerId: string;
665
- appId: string;
959
+ appId: ActiveDeveloperAppId;
666
960
  clientId: string | undefined;
667
961
  hasActiveSubscription: boolean;
668
962
  clientEntitlements: ClientEntitlements;
669
963
  authMode: "dev-app";
670
964
  appAllowedOrigins: readonly string[];
965
+ impersonatedBy: string | null;
671
966
  }>, ZodOptional<ZodObject< {}, $strip>>, ZodObject< {
672
967
  data: ZodObject< {
673
968
  twoFactorEnabled: ZodBoolean;
@@ -685,12 +980,13 @@ declare const publicRouter: {
685
980
  headers: Headers;
686
981
  }, {
687
982
  trainerId: string;
688
- appId: string;
983
+ appId: ActiveDeveloperAppId;
689
984
  clientId: string | undefined;
690
985
  hasActiveSubscription: boolean;
691
986
  clientEntitlements: ClientEntitlements;
692
987
  authMode: "dev-app";
693
988
  appAllowedOrigins: readonly string[];
989
+ impersonatedBy: string | null;
694
990
  }>, ZodObject< {
695
991
  currentPassword: ZodString;
696
992
  newPassword: ZodString;
@@ -711,12 +1007,13 @@ declare const publicRouter: {
711
1007
  headers: Headers;
712
1008
  }, {
713
1009
  trainerId: string;
714
- appId: string;
1010
+ appId: ActiveDeveloperAppId;
715
1011
  clientId: string | undefined;
716
1012
  hasActiveSubscription: boolean;
717
1013
  clientEntitlements: ClientEntitlements;
718
1014
  authMode: "dev-app";
719
1015
  appAllowedOrigins: readonly string[];
1016
+ impersonatedBy: string | null;
720
1017
  }>, ZodObject< {
721
1018
  newEmail: ZodString;
722
1019
  }, $strip>, ZodObject< {
@@ -734,12 +1031,13 @@ declare const publicRouter: {
734
1031
  headers: Headers;
735
1032
  }, {
736
1033
  trainerId: string;
737
- appId: string;
1034
+ appId: ActiveDeveloperAppId;
738
1035
  clientId: string | undefined;
739
1036
  hasActiveSubscription: boolean;
740
1037
  clientEntitlements: ClientEntitlements;
741
1038
  authMode: "dev-app";
742
1039
  appAllowedOrigins: readonly string[];
1040
+ impersonatedBy: string | null;
743
1041
  }>, ZodObject< {
744
1042
  confirmEmail: ZodString;
745
1043
  password: ZodString;
@@ -758,12 +1056,13 @@ declare const publicRouter: {
758
1056
  headers: Headers;
759
1057
  }, {
760
1058
  trainerId: string;
761
- appId: string;
1059
+ appId: ActiveDeveloperAppId;
762
1060
  clientId: string | undefined;
763
1061
  hasActiveSubscription: boolean;
764
1062
  clientEntitlements: ClientEntitlements;
765
1063
  authMode: "dev-app";
766
1064
  appAllowedOrigins: readonly string[];
1065
+ impersonatedBy: string | null;
767
1066
  }>, ZodOptional<ZodObject< {}, $strip>>, ZodObject< {
768
1067
  data: ZodArray<ZodObject< {
769
1068
  revokeId: ZodString;
@@ -784,12 +1083,13 @@ declare const publicRouter: {
784
1083
  headers: Headers;
785
1084
  }, {
786
1085
  trainerId: string;
787
- appId: string;
1086
+ appId: ActiveDeveloperAppId;
788
1087
  clientId: string | undefined;
789
1088
  hasActiveSubscription: boolean;
790
1089
  clientEntitlements: ClientEntitlements;
791
1090
  authMode: "dev-app";
792
1091
  appAllowedOrigins: readonly string[];
1092
+ impersonatedBy: string | null;
793
1093
  }>, ZodObject< {
794
1094
  revokeId: ZodString;
795
1095
  }, $strip>, ZodObject< {
@@ -807,12 +1107,13 @@ declare const publicRouter: {
807
1107
  headers: Headers;
808
1108
  }, {
809
1109
  trainerId: string;
810
- appId: string;
1110
+ appId: ActiveDeveloperAppId;
811
1111
  clientId: string | undefined;
812
1112
  hasActiveSubscription: boolean;
813
1113
  clientEntitlements: ClientEntitlements;
814
1114
  authMode: "dev-app";
815
1115
  appAllowedOrigins: readonly string[];
1116
+ impersonatedBy: string | null;
816
1117
  }>, ZodOptional<ZodObject< {}, $strip>>, ZodObject< {
817
1118
  data: ZodObject< {
818
1119
  success: ZodLiteral<true>;
@@ -2267,8 +2568,8 @@ declare const publicRouter: {
2267
2568
  self: "self";
2268
2569
  }>;
2269
2570
  status: ZodEnum< {
2270
- completed: "completed";
2271
2571
  active: "active";
2572
+ completed: "completed";
2272
2573
  removed: "removed";
2273
2574
  }>;
2274
2575
  enrolledAt: ZodString;
@@ -2332,7 +2633,7 @@ declare const publicRouter: {
2332
2633
  id: string;
2333
2634
  programId: string;
2334
2635
  source: "trainer" | "self";
2335
- status: "completed" | "active" | "removed";
2636
+ status: "active" | "completed" | "removed";
2336
2637
  enrolledAt: string;
2337
2638
  };
2338
2639
  }, {
@@ -2340,7 +2641,7 @@ declare const publicRouter: {
2340
2641
  id: string;
2341
2642
  programId: string;
2342
2643
  source: "trainer" | "self";
2343
- status: "completed" | "active" | "removed";
2644
+ status: "active" | "completed" | "removed";
2344
2645
  enrolledAt: string;
2345
2646
  };
2346
2647
  }>, Record<never, never>, Record<never, never>>;
@@ -2490,6 +2791,11 @@ declare const publicRouter: {
2490
2791
  rpe: ZodNullable<ZodNumber>;
2491
2792
  notes: ZodNullable<ZodString>;
2492
2793
  }, $strip>>;
2794
+ feedback: ZodOptional<ZodObject< {
2795
+ reviewed: ZodBoolean;
2796
+ commentCount: ZodNumber;
2797
+ unseen: ZodBoolean;
2798
+ }, $strip>>;
2493
2799
  }, $strip>>;
2494
2800
  }, $strip>, Record<never, never>, Record<never, never>>;
2495
2801
  create: DecoratedProcedure<MergedInitialContext< {
@@ -2679,6 +2985,70 @@ declare const publicRouter: {
2679
2985
  deleted: boolean;
2680
2986
  };
2681
2987
  }>, Record<never, never>, Record<never, never>>;
2988
+ getFeedback: DecoratedProcedure<MergedInitialContext< {
2989
+ headers: Headers;
2990
+ } & Record<never, never>, {
2991
+ headers: Headers;
2992
+ } & Record<never, never>, {
2993
+ headers: Headers;
2994
+ }>, MergedCurrentContext< {
2995
+ headers: Headers;
2996
+ }, ApiKeyContext>, ZodObject< {
2997
+ id: ZodString;
2998
+ }, $strip>, ZodObject< {
2999
+ data: ZodObject< {
3000
+ sessionLogId: ZodString;
3001
+ review: ZodNullable<ZodObject< {
3002
+ reviewedAt: ZodString;
3003
+ reviewerName: ZodString;
3004
+ }, $strip>>;
3005
+ comments: ZodArray<ZodObject< {
3006
+ id: ZodString;
3007
+ setId: ZodNullable<ZodString>;
3008
+ authorName: ZodString;
3009
+ body: ZodString;
3010
+ createdAt: ZodString;
3011
+ }, $strip>>;
3012
+ reactions: ZodArray<ZodObject< {
3013
+ kind: ZodEnum< {
3014
+ strong: "strong";
3015
+ fire: "fire";
3016
+ nice: "nice";
3017
+ trophy: "trophy";
3018
+ }>;
3019
+ staffName: ZodString;
3020
+ }, $strip>>;
3021
+ }, $strip>;
3022
+ }, $strip>, Record<never, never>, Record<never, never>>;
3023
+ markFeedbackSeen: DecoratedProcedure<MergedInitialContext< {
3024
+ headers: Headers;
3025
+ } & Record<never, never>, {
3026
+ headers: Headers;
3027
+ } & Record<never, never>, {
3028
+ headers: Headers;
3029
+ }>, MergedCurrentContext< {
3030
+ headers: Headers;
3031
+ }, ApiKeyContext>, ZodObject< {
3032
+ id: ZodString;
3033
+ }, $strip>, ZodObject< {
3034
+ data: ZodObject< {
3035
+ sessionLogId: ZodString;
3036
+ seenAt: ZodNullable<ZodString>;
3037
+ }, $strip>;
3038
+ }, $strip>, Record<never, never>, Record<never, never>>;
3039
+ unseenFeedbackCount: DecoratedProcedure<MergedInitialContext< {
3040
+ headers: Headers;
3041
+ } & Record<never, never>, {
3042
+ headers: Headers;
3043
+ } & Record<never, never>, {
3044
+ headers: Headers;
3045
+ }>, MergedCurrentContext< {
3046
+ headers: Headers;
3047
+ }, ApiKeyContext>, ZodObject< {}, $strip>, ZodObject< {
3048
+ data: ZodObject< {
3049
+ count: ZodNumber;
3050
+ }, $strip>;
3051
+ }, $strip>, Record<never, never>, Record<never, never>>;
2682
3052
  };
2683
3053
  progression: {
2684
3054
  getHistory: DecoratedProcedure<MergedInitialContext< {
@@ -2826,6 +3196,1189 @@ declare const publicRouter: {
2826
3196
  }, $strip>;
2827
3197
  }, $strip>, Record<never, never>, Record<never, never>>;
2828
3198
  };
3199
+ checkin: {
3200
+ current: DecoratedProcedure<MergedInitialContext< {
3201
+ headers: Headers;
3202
+ } & Record<never, never>, {
3203
+ headers: Headers;
3204
+ } & Record<never, never>, {
3205
+ headers: Headers;
3206
+ }>, MergedCurrentContext< {
3207
+ headers: Headers;
3208
+ }, ApiKeyContext>, ZodObject< {}, $strip>, ZodObject< {
3209
+ data: ZodDiscriminatedUnion<[ZodObject< {
3210
+ kind: ZodLiteral<"unscheduled">;
3211
+ history: ZodObject< {
3212
+ hasCheckins: ZodBoolean;
3213
+ unseenReplies: ZodNumber;
3214
+ }, $strip>;
3215
+ }, $strip>, ZodObject< {
3216
+ kind: ZodLiteral<"preview">;
3217
+ template: ZodNullable<ZodObject< {
3218
+ id: ZodGUID;
3219
+ name: ZodString;
3220
+ }, $strip>>;
3221
+ questions: ZodArray<ZodObject< {
3222
+ id: ZodGUID;
3223
+ order: ZodNumber;
3224
+ prompt: ZodString;
3225
+ helpText: ZodNullable<ZodString>;
3226
+ required: ZodBoolean;
3227
+ config: ZodDiscriminatedUnion<[ZodObject< {
3228
+ type: ZodLiteral<"scale">;
3229
+ min: ZodLiteral<1>;
3230
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3231
+ lowLabel: ZodOptional<ZodString>;
3232
+ highLabel: ZodOptional<ZodString>;
3233
+ }, $strip>, ZodObject< {
3234
+ type: ZodLiteral<"number">;
3235
+ unit: ZodOptional<ZodString>;
3236
+ min: ZodOptional<ZodNumber>;
3237
+ max: ZodOptional<ZodNumber>;
3238
+ }, $strip>, ZodObject< {
3239
+ type: ZodLiteral<"text">;
3240
+ multiline: ZodBoolean;
3241
+ maxLength: ZodNumber;
3242
+ }, $strip>, ZodObject< {
3243
+ type: ZodLiteral<"bodyweight">;
3244
+ }, $strip>, ZodObject< {
3245
+ type: ZodLiteral<"photos">;
3246
+ maxPhotos: ZodNumber;
3247
+ }, $strip>, ZodObject< {
3248
+ type: ZodLiteral<"yes_no">;
3249
+ }, $strip>], "type">;
3250
+ }, $strip>>;
3251
+ }, $strip>, ZodObject< {
3252
+ kind: ZodLiteral<"scheduled">;
3253
+ cadence: ZodEnum< {
3254
+ weekly: "weekly";
3255
+ fortnightly: "fortnightly";
3256
+ }>;
3257
+ dueDay: ZodEnum< {
3258
+ mon: "mon";
3259
+ sun: "sun";
3260
+ tue: "tue";
3261
+ wed: "wed";
3262
+ thu: "thu";
3263
+ fri: "fri";
3264
+ sat: "sat";
3265
+ }>;
3266
+ template: ZodObject< {
3267
+ id: ZodGUID;
3268
+ name: ZodString;
3269
+ }, $strip>;
3270
+ status: ZodDiscriminatedUnion<[ZodObject< {
3271
+ status: ZodLiteral<"upcoming">;
3272
+ period: ZodObject< {
3273
+ periodStart: ZodISODate;
3274
+ periodEnd: ZodISODate;
3275
+ opensOn: ZodISODate;
3276
+ dueOn: ZodISODate;
3277
+ }, $strip>;
3278
+ }, $strip>, ZodObject< {
3279
+ status: ZodLiteral<"due">;
3280
+ period: ZodObject< {
3281
+ periodStart: ZodISODate;
3282
+ periodEnd: ZodISODate;
3283
+ opensOn: ZodISODate;
3284
+ dueOn: ZodISODate;
3285
+ }, $strip>;
3286
+ }, $strip>, ZodObject< {
3287
+ status: ZodLiteral<"overdue">;
3288
+ period: ZodObject< {
3289
+ periodStart: ZodISODate;
3290
+ periodEnd: ZodISODate;
3291
+ opensOn: ZodISODate;
3292
+ dueOn: ZodISODate;
3293
+ }, $strip>;
3294
+ daysLate: ZodNumber;
3295
+ }, $strip>, ZodObject< {
3296
+ status: ZodLiteral<"missed">;
3297
+ period: ZodObject< {
3298
+ periodStart: ZodISODate;
3299
+ periodEnd: ZodISODate;
3300
+ opensOn: ZodISODate;
3301
+ dueOn: ZodISODate;
3302
+ }, $strip>;
3303
+ }, $strip>, ZodObject< {
3304
+ status: ZodLiteral<"submitted">;
3305
+ period: ZodObject< {
3306
+ periodStart: ZodISODate;
3307
+ periodEnd: ZodISODate;
3308
+ opensOn: ZodISODate;
3309
+ dueOn: ZodISODate;
3310
+ }, $strip>;
3311
+ checkinId: ZodGUID;
3312
+ }, $strip>, ZodObject< {
3313
+ status: ZodLiteral<"reviewed">;
3314
+ period: ZodObject< {
3315
+ periodStart: ZodISODate;
3316
+ periodEnd: ZodISODate;
3317
+ opensOn: ZodISODate;
3318
+ dueOn: ZodISODate;
3319
+ }, $strip>;
3320
+ checkinId: ZodGUID;
3321
+ }, $strip>], "status">;
3322
+ next: ZodObject< {
3323
+ periodStart: ZodISODate;
3324
+ periodEnd: ZodISODate;
3325
+ opensOn: ZodISODate;
3326
+ dueOn: ZodISODate;
3327
+ }, $strip>;
3328
+ questions: ZodArray<ZodObject< {
3329
+ id: ZodGUID;
3330
+ order: ZodNumber;
3331
+ prompt: ZodString;
3332
+ helpText: ZodNullable<ZodString>;
3333
+ required: ZodBoolean;
3334
+ config: ZodDiscriminatedUnion<[ZodObject< {
3335
+ type: ZodLiteral<"scale">;
3336
+ min: ZodLiteral<1>;
3337
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3338
+ lowLabel: ZodOptional<ZodString>;
3339
+ highLabel: ZodOptional<ZodString>;
3340
+ }, $strip>, ZodObject< {
3341
+ type: ZodLiteral<"number">;
3342
+ unit: ZodOptional<ZodString>;
3343
+ min: ZodOptional<ZodNumber>;
3344
+ max: ZodOptional<ZodNumber>;
3345
+ }, $strip>, ZodObject< {
3346
+ type: ZodLiteral<"text">;
3347
+ multiline: ZodBoolean;
3348
+ maxLength: ZodNumber;
3349
+ }, $strip>, ZodObject< {
3350
+ type: ZodLiteral<"bodyweight">;
3351
+ }, $strip>, ZodObject< {
3352
+ type: ZodLiteral<"photos">;
3353
+ maxPhotos: ZodNumber;
3354
+ }, $strip>, ZodObject< {
3355
+ type: ZodLiteral<"yes_no">;
3356
+ }, $strip>], "type">;
3357
+ }, $strip>>;
3358
+ submission: ZodNullable<ZodObject< {
3359
+ checkin: ZodDiscriminatedUnion<[ZodObject< {
3360
+ status: ZodLiteral<"submitted">;
3361
+ id: ZodGUID;
3362
+ clientId: ZodGUID;
3363
+ periodStart: ZodISODate;
3364
+ periodEnd: ZodISODate;
3365
+ dueOn: ZodISODate;
3366
+ template: ZodObject< {
3367
+ id: ZodGUID;
3368
+ name: ZodString;
3369
+ }, $strip>;
3370
+ submittedAt: ZodString;
3371
+ updatedAt: ZodString;
3372
+ }, $strip>, ZodObject< {
3373
+ status: ZodLiteral<"reviewed">;
3374
+ reviewedAt: ZodString;
3375
+ reviewerName: ZodString;
3376
+ reply: ZodNullable<ZodObject< {
3377
+ body: ZodString;
3378
+ repliedAt: ZodString;
3379
+ memberSeenAt: ZodNullable<ZodString>;
3380
+ }, $strip>>;
3381
+ id: ZodGUID;
3382
+ clientId: ZodGUID;
3383
+ periodStart: ZodISODate;
3384
+ periodEnd: ZodISODate;
3385
+ dueOn: ZodISODate;
3386
+ template: ZodObject< {
3387
+ id: ZodGUID;
3388
+ name: ZodString;
3389
+ }, $strip>;
3390
+ submittedAt: ZodString;
3391
+ updatedAt: ZodString;
3392
+ }, $strip>], "status">;
3393
+ answers: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3394
+ type: ZodLiteral<"scale">;
3395
+ config: ZodObject< {
3396
+ type: ZodLiteral<"scale">;
3397
+ min: ZodLiteral<1>;
3398
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3399
+ lowLabel: ZodOptional<ZodString>;
3400
+ highLabel: ZodOptional<ZodString>;
3401
+ }, $strip>;
3402
+ value: ZodNumber;
3403
+ questionId: ZodGUID;
3404
+ order: ZodNumber;
3405
+ prompt: ZodString;
3406
+ }, $strip>, ZodObject< {
3407
+ type: ZodLiteral<"number">;
3408
+ config: ZodObject< {
3409
+ type: ZodLiteral<"number">;
3410
+ unit: ZodOptional<ZodString>;
3411
+ min: ZodOptional<ZodNumber>;
3412
+ max: ZodOptional<ZodNumber>;
3413
+ }, $strip>;
3414
+ value: ZodNumber;
3415
+ questionId: ZodGUID;
3416
+ order: ZodNumber;
3417
+ prompt: ZodString;
3418
+ }, $strip>, ZodObject< {
3419
+ type: ZodLiteral<"text">;
3420
+ config: ZodObject< {
3421
+ type: ZodLiteral<"text">;
3422
+ multiline: ZodBoolean;
3423
+ maxLength: ZodNumber;
3424
+ }, $strip>;
3425
+ value: ZodString;
3426
+ questionId: ZodGUID;
3427
+ order: ZodNumber;
3428
+ prompt: ZodString;
3429
+ }, $strip>, ZodObject< {
3430
+ type: ZodLiteral<"bodyweight">;
3431
+ config: ZodObject< {
3432
+ type: ZodLiteral<"bodyweight">;
3433
+ }, $strip>;
3434
+ weightKg: ZodNumber;
3435
+ questionId: ZodGUID;
3436
+ order: ZodNumber;
3437
+ prompt: ZodString;
3438
+ }, $strip>, ZodObject< {
3439
+ type: ZodLiteral<"photos">;
3440
+ config: ZodObject< {
3441
+ type: ZodLiteral<"photos">;
3442
+ maxPhotos: ZodNumber;
3443
+ }, $strip>;
3444
+ photos: ZodArray<ZodObject< {
3445
+ uploadId: ZodGUID;
3446
+ url: ZodString;
3447
+ width: ZodNumber;
3448
+ height: ZodNumber;
3449
+ }, $strip>>;
3450
+ questionId: ZodGUID;
3451
+ order: ZodNumber;
3452
+ prompt: ZodString;
3453
+ }, $strip>, ZodObject< {
3454
+ type: ZodLiteral<"yes_no">;
3455
+ config: ZodObject< {
3456
+ type: ZodLiteral<"yes_no">;
3457
+ }, $strip>;
3458
+ value: ZodBoolean;
3459
+ questionId: ZodGUID;
3460
+ order: ZodNumber;
3461
+ prompt: ZodString;
3462
+ }, $strip>], "type">>;
3463
+ }, $strip>>;
3464
+ history: ZodObject< {
3465
+ hasCheckins: ZodBoolean;
3466
+ unseenReplies: ZodNumber;
3467
+ }, $strip>;
3468
+ today: ZodISODate;
3469
+ closesAt: ZodISODateTime;
3470
+ }, $strip>], "kind">;
3471
+ }, $strip>, Record<never, never>, Record<never, never>>;
3472
+ list: DecoratedProcedure<MergedInitialContext< {
3473
+ headers: Headers;
3474
+ } & Record<never, never>, {
3475
+ headers: Headers;
3476
+ } & Record<never, never>, {
3477
+ headers: Headers;
3478
+ }>, MergedCurrentContext< {
3479
+ headers: Headers;
3480
+ }, ApiKeyContext>, ZodObject< {
3481
+ cursor: ZodOptional<ZodISODate>;
3482
+ limit: ZodDefault<ZodNumber>;
3483
+ }, $strip>, ZodObject< {
3484
+ data: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3485
+ status: ZodLiteral<"submitted">;
3486
+ id: ZodGUID;
3487
+ clientId: ZodGUID;
3488
+ periodStart: ZodISODate;
3489
+ periodEnd: ZodISODate;
3490
+ dueOn: ZodISODate;
3491
+ template: ZodObject< {
3492
+ id: ZodGUID;
3493
+ name: ZodString;
3494
+ }, $strip>;
3495
+ submittedAt: ZodString;
3496
+ updatedAt: ZodString;
3497
+ bodyweightKg: ZodNullable<ZodNumber>;
3498
+ photoCount: ZodNumber;
3499
+ }, $strip>, ZodObject< {
3500
+ status: ZodLiteral<"reviewed">;
3501
+ reviewedAt: ZodString;
3502
+ reviewerName: ZodString;
3503
+ reply: ZodNullable<ZodObject< {
3504
+ body: ZodString;
3505
+ repliedAt: ZodString;
3506
+ memberSeenAt: ZodNullable<ZodString>;
3507
+ }, $strip>>;
3508
+ id: ZodGUID;
3509
+ clientId: ZodGUID;
3510
+ periodStart: ZodISODate;
3511
+ periodEnd: ZodISODate;
3512
+ dueOn: ZodISODate;
3513
+ template: ZodObject< {
3514
+ id: ZodGUID;
3515
+ name: ZodString;
3516
+ }, $strip>;
3517
+ submittedAt: ZodString;
3518
+ updatedAt: ZodString;
3519
+ bodyweightKg: ZodNullable<ZodNumber>;
3520
+ photoCount: ZodNumber;
3521
+ }, $strip>, ZodObject< {
3522
+ status: ZodLiteral<"missed">;
3523
+ period: ZodObject< {
3524
+ periodStart: ZodISODate;
3525
+ periodEnd: ZodISODate;
3526
+ opensOn: ZodISODate;
3527
+ dueOn: ZodISODate;
3528
+ }, $strip>;
3529
+ }, $strip>], "status">>;
3530
+ meta: ZodObject< {
3531
+ nextCursor: ZodNullable<ZodISODate>;
3532
+ limit: ZodNumber;
3533
+ }, $strip>;
3534
+ }, $strip>, Record<never, never>, Record<never, never>>;
3535
+ get: DecoratedProcedure<MergedInitialContext< {
3536
+ headers: Headers;
3537
+ } & Record<never, never>, {
3538
+ headers: Headers;
3539
+ } & Record<never, never>, {
3540
+ headers: Headers;
3541
+ }>, MergedCurrentContext< {
3542
+ headers: Headers;
3543
+ }, ApiKeyContext>, ZodObject< {
3544
+ id: ZodString;
3545
+ }, $strip>, ZodObject< {
3546
+ data: ZodObject< {
3547
+ checkin: ZodDiscriminatedUnion<[ZodObject< {
3548
+ status: ZodLiteral<"submitted">;
3549
+ id: ZodGUID;
3550
+ clientId: ZodGUID;
3551
+ periodStart: ZodISODate;
3552
+ periodEnd: ZodISODate;
3553
+ dueOn: ZodISODate;
3554
+ template: ZodObject< {
3555
+ id: ZodGUID;
3556
+ name: ZodString;
3557
+ }, $strip>;
3558
+ submittedAt: ZodString;
3559
+ updatedAt: ZodString;
3560
+ }, $strip>, ZodObject< {
3561
+ status: ZodLiteral<"reviewed">;
3562
+ reviewedAt: ZodString;
3563
+ reviewerName: ZodString;
3564
+ reply: ZodNullable<ZodObject< {
3565
+ body: ZodString;
3566
+ repliedAt: ZodString;
3567
+ memberSeenAt: ZodNullable<ZodString>;
3568
+ }, $strip>>;
3569
+ id: ZodGUID;
3570
+ clientId: ZodGUID;
3571
+ periodStart: ZodISODate;
3572
+ periodEnd: ZodISODate;
3573
+ dueOn: ZodISODate;
3574
+ template: ZodObject< {
3575
+ id: ZodGUID;
3576
+ name: ZodString;
3577
+ }, $strip>;
3578
+ submittedAt: ZodString;
3579
+ updatedAt: ZodString;
3580
+ }, $strip>], "status">;
3581
+ answers: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3582
+ type: ZodLiteral<"scale">;
3583
+ config: ZodObject< {
3584
+ type: ZodLiteral<"scale">;
3585
+ min: ZodLiteral<1>;
3586
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3587
+ lowLabel: ZodOptional<ZodString>;
3588
+ highLabel: ZodOptional<ZodString>;
3589
+ }, $strip>;
3590
+ value: ZodNumber;
3591
+ questionId: ZodGUID;
3592
+ order: ZodNumber;
3593
+ prompt: ZodString;
3594
+ }, $strip>, ZodObject< {
3595
+ type: ZodLiteral<"number">;
3596
+ config: ZodObject< {
3597
+ type: ZodLiteral<"number">;
3598
+ unit: ZodOptional<ZodString>;
3599
+ min: ZodOptional<ZodNumber>;
3600
+ max: ZodOptional<ZodNumber>;
3601
+ }, $strip>;
3602
+ value: ZodNumber;
3603
+ questionId: ZodGUID;
3604
+ order: ZodNumber;
3605
+ prompt: ZodString;
3606
+ }, $strip>, ZodObject< {
3607
+ type: ZodLiteral<"text">;
3608
+ config: ZodObject< {
3609
+ type: ZodLiteral<"text">;
3610
+ multiline: ZodBoolean;
3611
+ maxLength: ZodNumber;
3612
+ }, $strip>;
3613
+ value: ZodString;
3614
+ questionId: ZodGUID;
3615
+ order: ZodNumber;
3616
+ prompt: ZodString;
3617
+ }, $strip>, ZodObject< {
3618
+ type: ZodLiteral<"bodyweight">;
3619
+ config: ZodObject< {
3620
+ type: ZodLiteral<"bodyweight">;
3621
+ }, $strip>;
3622
+ weightKg: ZodNumber;
3623
+ questionId: ZodGUID;
3624
+ order: ZodNumber;
3625
+ prompt: ZodString;
3626
+ }, $strip>, ZodObject< {
3627
+ type: ZodLiteral<"photos">;
3628
+ config: ZodObject< {
3629
+ type: ZodLiteral<"photos">;
3630
+ maxPhotos: ZodNumber;
3631
+ }, $strip>;
3632
+ photos: ZodArray<ZodObject< {
3633
+ uploadId: ZodGUID;
3634
+ url: ZodString;
3635
+ width: ZodNumber;
3636
+ height: ZodNumber;
3637
+ }, $strip>>;
3638
+ questionId: ZodGUID;
3639
+ order: ZodNumber;
3640
+ prompt: ZodString;
3641
+ }, $strip>, ZodObject< {
3642
+ type: ZodLiteral<"yes_no">;
3643
+ config: ZodObject< {
3644
+ type: ZodLiteral<"yes_no">;
3645
+ }, $strip>;
3646
+ value: ZodBoolean;
3647
+ questionId: ZodGUID;
3648
+ order: ZodNumber;
3649
+ prompt: ZodString;
3650
+ }, $strip>], "type">>;
3651
+ questions: ZodNullable<ZodArray<ZodObject< {
3652
+ id: ZodGUID;
3653
+ order: ZodNumber;
3654
+ prompt: ZodString;
3655
+ helpText: ZodNullable<ZodString>;
3656
+ required: ZodBoolean;
3657
+ config: ZodDiscriminatedUnion<[ZodObject< {
3658
+ type: ZodLiteral<"scale">;
3659
+ min: ZodLiteral<1>;
3660
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3661
+ lowLabel: ZodOptional<ZodString>;
3662
+ highLabel: ZodOptional<ZodString>;
3663
+ }, $strip>, ZodObject< {
3664
+ type: ZodLiteral<"number">;
3665
+ unit: ZodOptional<ZodString>;
3666
+ min: ZodOptional<ZodNumber>;
3667
+ max: ZodOptional<ZodNumber>;
3668
+ }, $strip>, ZodObject< {
3669
+ type: ZodLiteral<"text">;
3670
+ multiline: ZodBoolean;
3671
+ maxLength: ZodNumber;
3672
+ }, $strip>, ZodObject< {
3673
+ type: ZodLiteral<"bodyweight">;
3674
+ }, $strip>, ZodObject< {
3675
+ type: ZodLiteral<"photos">;
3676
+ maxPhotos: ZodNumber;
3677
+ }, $strip>, ZodObject< {
3678
+ type: ZodLiteral<"yes_no">;
3679
+ }, $strip>], "type">;
3680
+ }, $strip>>>;
3681
+ }, $strip>;
3682
+ }, $strip>, Record<never, never>, Record<never, never>>;
3683
+ submit: DecoratedProcedure<MergedInitialContext< {
3684
+ headers: Headers;
3685
+ } & Record<never, never>, {
3686
+ headers: Headers;
3687
+ } & Record<never, never>, {
3688
+ headers: Headers;
3689
+ }>, MergedCurrentContext< {
3690
+ headers: Headers;
3691
+ }, ApiKeyContext>, ZodObject< {
3692
+ periodStart: ZodISODate;
3693
+ answers: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3694
+ type: ZodLiteral<"scale">;
3695
+ value: ZodNumber;
3696
+ questionId: ZodString;
3697
+ }, $strip>, ZodObject< {
3698
+ type: ZodLiteral<"number">;
3699
+ value: ZodNumber;
3700
+ questionId: ZodString;
3701
+ }, $strip>, ZodObject< {
3702
+ type: ZodLiteral<"text">;
3703
+ value: ZodString;
3704
+ questionId: ZodString;
3705
+ }, $strip>, ZodObject< {
3706
+ type: ZodLiteral<"bodyweight">;
3707
+ weight: ZodNumber;
3708
+ unit: ZodEnum< {
3709
+ lb: "lb";
3710
+ kg: "kg";
3711
+ }>;
3712
+ questionId: ZodString;
3713
+ }, $strip>, ZodObject< {
3714
+ type: ZodLiteral<"photos">;
3715
+ uploadIds: ZodArray<ZodString>;
3716
+ questionId: ZodString;
3717
+ }, $strip>, ZodObject< {
3718
+ type: ZodLiteral<"yes_no">;
3719
+ value: ZodBoolean;
3720
+ questionId: ZodString;
3721
+ }, $strip>], "type">>;
3722
+ }, $strip>, ZodObject< {
3723
+ data: ZodObject< {
3724
+ checkin: ZodDiscriminatedUnion<[ZodObject< {
3725
+ status: ZodLiteral<"submitted">;
3726
+ id: ZodGUID;
3727
+ clientId: ZodGUID;
3728
+ periodStart: ZodISODate;
3729
+ periodEnd: ZodISODate;
3730
+ dueOn: ZodISODate;
3731
+ template: ZodObject< {
3732
+ id: ZodGUID;
3733
+ name: ZodString;
3734
+ }, $strip>;
3735
+ submittedAt: ZodString;
3736
+ updatedAt: ZodString;
3737
+ }, $strip>, ZodObject< {
3738
+ status: ZodLiteral<"reviewed">;
3739
+ reviewedAt: ZodString;
3740
+ reviewerName: ZodString;
3741
+ reply: ZodNullable<ZodObject< {
3742
+ body: ZodString;
3743
+ repliedAt: ZodString;
3744
+ memberSeenAt: ZodNullable<ZodString>;
3745
+ }, $strip>>;
3746
+ id: ZodGUID;
3747
+ clientId: ZodGUID;
3748
+ periodStart: ZodISODate;
3749
+ periodEnd: ZodISODate;
3750
+ dueOn: ZodISODate;
3751
+ template: ZodObject< {
3752
+ id: ZodGUID;
3753
+ name: ZodString;
3754
+ }, $strip>;
3755
+ submittedAt: ZodString;
3756
+ updatedAt: ZodString;
3757
+ }, $strip>], "status">;
3758
+ answers: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3759
+ type: ZodLiteral<"scale">;
3760
+ config: ZodObject< {
3761
+ type: ZodLiteral<"scale">;
3762
+ min: ZodLiteral<1>;
3763
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3764
+ lowLabel: ZodOptional<ZodString>;
3765
+ highLabel: ZodOptional<ZodString>;
3766
+ }, $strip>;
3767
+ value: ZodNumber;
3768
+ questionId: ZodGUID;
3769
+ order: ZodNumber;
3770
+ prompt: ZodString;
3771
+ }, $strip>, ZodObject< {
3772
+ type: ZodLiteral<"number">;
3773
+ config: ZodObject< {
3774
+ type: ZodLiteral<"number">;
3775
+ unit: ZodOptional<ZodString>;
3776
+ min: ZodOptional<ZodNumber>;
3777
+ max: ZodOptional<ZodNumber>;
3778
+ }, $strip>;
3779
+ value: ZodNumber;
3780
+ questionId: ZodGUID;
3781
+ order: ZodNumber;
3782
+ prompt: ZodString;
3783
+ }, $strip>, ZodObject< {
3784
+ type: ZodLiteral<"text">;
3785
+ config: ZodObject< {
3786
+ type: ZodLiteral<"text">;
3787
+ multiline: ZodBoolean;
3788
+ maxLength: ZodNumber;
3789
+ }, $strip>;
3790
+ value: ZodString;
3791
+ questionId: ZodGUID;
3792
+ order: ZodNumber;
3793
+ prompt: ZodString;
3794
+ }, $strip>, ZodObject< {
3795
+ type: ZodLiteral<"bodyweight">;
3796
+ config: ZodObject< {
3797
+ type: ZodLiteral<"bodyweight">;
3798
+ }, $strip>;
3799
+ weightKg: ZodNumber;
3800
+ questionId: ZodGUID;
3801
+ order: ZodNumber;
3802
+ prompt: ZodString;
3803
+ }, $strip>, ZodObject< {
3804
+ type: ZodLiteral<"photos">;
3805
+ config: ZodObject< {
3806
+ type: ZodLiteral<"photos">;
3807
+ maxPhotos: ZodNumber;
3808
+ }, $strip>;
3809
+ photos: ZodArray<ZodObject< {
3810
+ uploadId: ZodGUID;
3811
+ url: ZodString;
3812
+ width: ZodNumber;
3813
+ height: ZodNumber;
3814
+ }, $strip>>;
3815
+ questionId: ZodGUID;
3816
+ order: ZodNumber;
3817
+ prompt: ZodString;
3818
+ }, $strip>, ZodObject< {
3819
+ type: ZodLiteral<"yes_no">;
3820
+ config: ZodObject< {
3821
+ type: ZodLiteral<"yes_no">;
3822
+ }, $strip>;
3823
+ value: ZodBoolean;
3824
+ questionId: ZodGUID;
3825
+ order: ZodNumber;
3826
+ prompt: ZodString;
3827
+ }, $strip>], "type">>;
3828
+ questions: ZodNullable<ZodArray<ZodObject< {
3829
+ id: ZodGUID;
3830
+ order: ZodNumber;
3831
+ prompt: ZodString;
3832
+ helpText: ZodNullable<ZodString>;
3833
+ required: ZodBoolean;
3834
+ config: ZodDiscriminatedUnion<[ZodObject< {
3835
+ type: ZodLiteral<"scale">;
3836
+ min: ZodLiteral<1>;
3837
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3838
+ lowLabel: ZodOptional<ZodString>;
3839
+ highLabel: ZodOptional<ZodString>;
3840
+ }, $strip>, ZodObject< {
3841
+ type: ZodLiteral<"number">;
3842
+ unit: ZodOptional<ZodString>;
3843
+ min: ZodOptional<ZodNumber>;
3844
+ max: ZodOptional<ZodNumber>;
3845
+ }, $strip>, ZodObject< {
3846
+ type: ZodLiteral<"text">;
3847
+ multiline: ZodBoolean;
3848
+ maxLength: ZodNumber;
3849
+ }, $strip>, ZodObject< {
3850
+ type: ZodLiteral<"bodyweight">;
3851
+ }, $strip>, ZodObject< {
3852
+ type: ZodLiteral<"photos">;
3853
+ maxPhotos: ZodNumber;
3854
+ }, $strip>, ZodObject< {
3855
+ type: ZodLiteral<"yes_no">;
3856
+ }, $strip>], "type">;
3857
+ }, $strip>>>;
3858
+ }, $strip>;
3859
+ }, $strip>, Record<never, never>, Record<never, never>>;
3860
+ update: DecoratedProcedure<MergedInitialContext< {
3861
+ headers: Headers;
3862
+ } & Record<never, never>, {
3863
+ headers: Headers;
3864
+ } & Record<never, never>, {
3865
+ headers: Headers;
3866
+ }>, MergedCurrentContext< {
3867
+ headers: Headers;
3868
+ }, ApiKeyContext>, ZodObject< {
3869
+ id: ZodString;
3870
+ answers: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3871
+ type: ZodLiteral<"scale">;
3872
+ value: ZodNumber;
3873
+ questionId: ZodString;
3874
+ }, $strip>, ZodObject< {
3875
+ type: ZodLiteral<"number">;
3876
+ value: ZodNumber;
3877
+ questionId: ZodString;
3878
+ }, $strip>, ZodObject< {
3879
+ type: ZodLiteral<"text">;
3880
+ value: ZodString;
3881
+ questionId: ZodString;
3882
+ }, $strip>, ZodObject< {
3883
+ type: ZodLiteral<"bodyweight">;
3884
+ weight: ZodNumber;
3885
+ unit: ZodEnum< {
3886
+ lb: "lb";
3887
+ kg: "kg";
3888
+ }>;
3889
+ questionId: ZodString;
3890
+ }, $strip>, ZodObject< {
3891
+ type: ZodLiteral<"photos">;
3892
+ uploadIds: ZodArray<ZodString>;
3893
+ questionId: ZodString;
3894
+ }, $strip>, ZodObject< {
3895
+ type: ZodLiteral<"yes_no">;
3896
+ value: ZodBoolean;
3897
+ questionId: ZodString;
3898
+ }, $strip>], "type">>;
3899
+ }, $strip>, ZodObject< {
3900
+ data: ZodObject< {
3901
+ checkin: ZodDiscriminatedUnion<[ZodObject< {
3902
+ status: ZodLiteral<"submitted">;
3903
+ id: ZodGUID;
3904
+ clientId: ZodGUID;
3905
+ periodStart: ZodISODate;
3906
+ periodEnd: ZodISODate;
3907
+ dueOn: ZodISODate;
3908
+ template: ZodObject< {
3909
+ id: ZodGUID;
3910
+ name: ZodString;
3911
+ }, $strip>;
3912
+ submittedAt: ZodString;
3913
+ updatedAt: ZodString;
3914
+ }, $strip>, ZodObject< {
3915
+ status: ZodLiteral<"reviewed">;
3916
+ reviewedAt: ZodString;
3917
+ reviewerName: ZodString;
3918
+ reply: ZodNullable<ZodObject< {
3919
+ body: ZodString;
3920
+ repliedAt: ZodString;
3921
+ memberSeenAt: ZodNullable<ZodString>;
3922
+ }, $strip>>;
3923
+ id: ZodGUID;
3924
+ clientId: ZodGUID;
3925
+ periodStart: ZodISODate;
3926
+ periodEnd: ZodISODate;
3927
+ dueOn: ZodISODate;
3928
+ template: ZodObject< {
3929
+ id: ZodGUID;
3930
+ name: ZodString;
3931
+ }, $strip>;
3932
+ submittedAt: ZodString;
3933
+ updatedAt: ZodString;
3934
+ }, $strip>], "status">;
3935
+ answers: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
3936
+ type: ZodLiteral<"scale">;
3937
+ config: ZodObject< {
3938
+ type: ZodLiteral<"scale">;
3939
+ min: ZodLiteral<1>;
3940
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
3941
+ lowLabel: ZodOptional<ZodString>;
3942
+ highLabel: ZodOptional<ZodString>;
3943
+ }, $strip>;
3944
+ value: ZodNumber;
3945
+ questionId: ZodGUID;
3946
+ order: ZodNumber;
3947
+ prompt: ZodString;
3948
+ }, $strip>, ZodObject< {
3949
+ type: ZodLiteral<"number">;
3950
+ config: ZodObject< {
3951
+ type: ZodLiteral<"number">;
3952
+ unit: ZodOptional<ZodString>;
3953
+ min: ZodOptional<ZodNumber>;
3954
+ max: ZodOptional<ZodNumber>;
3955
+ }, $strip>;
3956
+ value: ZodNumber;
3957
+ questionId: ZodGUID;
3958
+ order: ZodNumber;
3959
+ prompt: ZodString;
3960
+ }, $strip>, ZodObject< {
3961
+ type: ZodLiteral<"text">;
3962
+ config: ZodObject< {
3963
+ type: ZodLiteral<"text">;
3964
+ multiline: ZodBoolean;
3965
+ maxLength: ZodNumber;
3966
+ }, $strip>;
3967
+ value: ZodString;
3968
+ questionId: ZodGUID;
3969
+ order: ZodNumber;
3970
+ prompt: ZodString;
3971
+ }, $strip>, ZodObject< {
3972
+ type: ZodLiteral<"bodyweight">;
3973
+ config: ZodObject< {
3974
+ type: ZodLiteral<"bodyweight">;
3975
+ }, $strip>;
3976
+ weightKg: ZodNumber;
3977
+ questionId: ZodGUID;
3978
+ order: ZodNumber;
3979
+ prompt: ZodString;
3980
+ }, $strip>, ZodObject< {
3981
+ type: ZodLiteral<"photos">;
3982
+ config: ZodObject< {
3983
+ type: ZodLiteral<"photos">;
3984
+ maxPhotos: ZodNumber;
3985
+ }, $strip>;
3986
+ photos: ZodArray<ZodObject< {
3987
+ uploadId: ZodGUID;
3988
+ url: ZodString;
3989
+ width: ZodNumber;
3990
+ height: ZodNumber;
3991
+ }, $strip>>;
3992
+ questionId: ZodGUID;
3993
+ order: ZodNumber;
3994
+ prompt: ZodString;
3995
+ }, $strip>, ZodObject< {
3996
+ type: ZodLiteral<"yes_no">;
3997
+ config: ZodObject< {
3998
+ type: ZodLiteral<"yes_no">;
3999
+ }, $strip>;
4000
+ value: ZodBoolean;
4001
+ questionId: ZodGUID;
4002
+ order: ZodNumber;
4003
+ prompt: ZodString;
4004
+ }, $strip>], "type">>;
4005
+ questions: ZodNullable<ZodArray<ZodObject< {
4006
+ id: ZodGUID;
4007
+ order: ZodNumber;
4008
+ prompt: ZodString;
4009
+ helpText: ZodNullable<ZodString>;
4010
+ required: ZodBoolean;
4011
+ config: ZodDiscriminatedUnion<[ZodObject< {
4012
+ type: ZodLiteral<"scale">;
4013
+ min: ZodLiteral<1>;
4014
+ max: ZodUnion<readonly [ZodLiteral<5>, ZodLiteral<10>]>;
4015
+ lowLabel: ZodOptional<ZodString>;
4016
+ highLabel: ZodOptional<ZodString>;
4017
+ }, $strip>, ZodObject< {
4018
+ type: ZodLiteral<"number">;
4019
+ unit: ZodOptional<ZodString>;
4020
+ min: ZodOptional<ZodNumber>;
4021
+ max: ZodOptional<ZodNumber>;
4022
+ }, $strip>, ZodObject< {
4023
+ type: ZodLiteral<"text">;
4024
+ multiline: ZodBoolean;
4025
+ maxLength: ZodNumber;
4026
+ }, $strip>, ZodObject< {
4027
+ type: ZodLiteral<"bodyweight">;
4028
+ }, $strip>, ZodObject< {
4029
+ type: ZodLiteral<"photos">;
4030
+ maxPhotos: ZodNumber;
4031
+ }, $strip>, ZodObject< {
4032
+ type: ZodLiteral<"yes_no">;
4033
+ }, $strip>], "type">;
4034
+ }, $strip>>>;
4035
+ }, $strip>;
4036
+ }, $strip>, Record<never, never>, Record<never, never>>;
4037
+ markReplySeen: DecoratedProcedure<MergedInitialContext< {
4038
+ headers: Headers;
4039
+ } & Record<never, never>, {
4040
+ headers: Headers;
4041
+ } & Record<never, never>, {
4042
+ headers: Headers;
4043
+ }>, MergedCurrentContext< {
4044
+ headers: Headers;
4045
+ }, ApiKeyContext>, ZodObject< {
4046
+ id: ZodString;
4047
+ }, $strip>, ZodObject< {
4048
+ data: ZodObject< {
4049
+ checkinId: ZodGUID;
4050
+ seenAt: ZodNullable<ZodString>;
4051
+ }, $strip>;
4052
+ }, $strip>, Record<never, never>, Record<never, never>>;
4053
+ requestPhotoUpload: DecoratedProcedure<MergedInitialContext< {
4054
+ headers: Headers;
4055
+ } & Record<never, never>, {
4056
+ headers: Headers;
4057
+ } & Record<never, never>, {
4058
+ headers: Headers;
4059
+ }>, MergedCurrentContext< {
4060
+ headers: Headers;
4061
+ }, ApiKeyContext>, ZodObject< {
4062
+ contentType: ZodEnum< {
4063
+ "image/webp": "image/webp";
4064
+ "image/jpeg": "image/jpeg";
4065
+ "image/png": "image/png";
4066
+ }>;
4067
+ fileSize: ZodNumber;
4068
+ width: ZodNumber;
4069
+ height: ZodNumber;
4070
+ }, $strip>, ZodObject< {
4071
+ data: ZodObject< {
4072
+ uploadId: ZodString;
4073
+ uploadUrl: ZodString;
4074
+ }, $strip>;
4075
+ }, $strip>, Record<never, never>, Record<never, never>>;
4076
+ };
4077
+ message: {
4078
+ list: DecoratedProcedure<MergedInitialContext< {
4079
+ headers: Headers;
4080
+ } & Record<never, never>, {
4081
+ headers: Headers;
4082
+ } & Record<never, never>, {
4083
+ headers: Headers;
4084
+ }>, MergedCurrentContext< {
4085
+ headers: Headers;
4086
+ }, ApiKeyContext>, ZodObject< {
4087
+ before: ZodOptional<ZodString>;
4088
+ limit: ZodDefault<ZodNumber>;
4089
+ }, $strip>, ZodObject< {
4090
+ data: ZodArray<ZodDiscriminatedUnion<[ZodObject< {
4091
+ status: ZodLiteral<"sent">;
4092
+ id: ZodGUID;
4093
+ sender: ZodDiscriminatedUnion<[ZodObject< {
4094
+ kind: ZodLiteral<"staff">;
4095
+ name: ZodString;
4096
+ }, $strip>, ZodObject< {
4097
+ kind: ZodLiteral<"member">;
4098
+ }, $strip>, ZodObject< {
4099
+ kind: ZodLiteral<"system">;
4100
+ }, $strip>, ZodObject< {
4101
+ kind: ZodLiteral<"assistant">;
4102
+ label: ZodLiteral<"Sent automatically">;
4103
+ writtenWithAi: ZodBoolean;
4104
+ }, $strip>], "kind">;
4105
+ body: ZodString;
4106
+ context: ZodNullable<ZodDiscriminatedUnion<[ZodObject< {
4107
+ kind: ZodLiteral<"session_log">;
4108
+ sessionLogId: ZodGUID;
4109
+ title: ZodString;
4110
+ startedAt: ZodString;
4111
+ }, $strip>, ZodObject< {
4112
+ kind: ZodLiteral<"checkin">;
4113
+ checkinId: ZodGUID;
4114
+ periodStart: ZodISODate;
4115
+ periodEnd: ZodISODate;
4116
+ }, $strip>, ZodObject< {
4117
+ kind: ZodLiteral<"unavailable">;
4118
+ was: ZodEnum< {
4119
+ checkin: "checkin";
4120
+ session_log: "session_log";
4121
+ }>;
4122
+ }, $strip>], "kind">>;
4123
+ attachments: ZodArray<ZodObject< {
4124
+ uploadId: ZodGUID;
4125
+ url: ZodString;
4126
+ width: ZodNumber;
4127
+ height: ZodNumber;
4128
+ }, $strip>>;
4129
+ createdAt: ZodString;
4130
+ clientRequestId: ZodNullable<ZodGUID>;
4131
+ }, $strip>, ZodObject< {
4132
+ status: ZodLiteral<"deleted">;
4133
+ id: ZodGUID;
4134
+ sender: ZodDiscriminatedUnion<[ZodObject< {
4135
+ kind: ZodLiteral<"staff">;
4136
+ name: ZodString;
4137
+ }, $strip>, ZodObject< {
4138
+ kind: ZodLiteral<"member">;
4139
+ }, $strip>, ZodObject< {
4140
+ kind: ZodLiteral<"system">;
4141
+ }, $strip>, ZodObject< {
4142
+ kind: ZodLiteral<"assistant">;
4143
+ label: ZodLiteral<"Sent automatically">;
4144
+ writtenWithAi: ZodBoolean;
4145
+ }, $strip>], "kind">;
4146
+ createdAt: ZodString;
4147
+ deletedAt: ZodString;
4148
+ }, $strip>], "status">>;
4149
+ meta: ZodObject< {
4150
+ nextBefore: ZodNullable<ZodGUID>;
4151
+ limit: ZodNumber;
4152
+ }, $strip>;
4153
+ sendEligibility: ZodDiscriminatedUnion<[ZodObject< {
4154
+ kind: ZodLiteral<"entitled">;
4155
+ }, $strip>, ZodObject< {
4156
+ kind: ZodLiteral<"reply_allowed">;
4157
+ staffName: ZodString;
4158
+ }, $strip>, ZodObject< {
4159
+ kind: ZodLiteral<"wait_for_coach">;
4160
+ }, $strip>, ZodObject< {
4161
+ kind: ZodLiteral<"upgrade_required">;
4162
+ }, $strip>], "kind">;
4163
+ }, $strip>, Record<never, never>, Record<never, never>>;
4164
+ send: DecoratedProcedure<MergedInitialContext< {
4165
+ headers: Headers;
4166
+ } & Record<never, never>, {
4167
+ headers: Headers;
4168
+ } & Record<never, never>, {
4169
+ headers: Headers;
4170
+ }>, MergedCurrentContext< {
4171
+ headers: Headers;
4172
+ }, ApiKeyContext>, ZodObject< {
4173
+ body: ZodString;
4174
+ clientRequestId: ZodString;
4175
+ attachmentUploadIds: ZodDefault<ZodArray<ZodString>>;
4176
+ context: ZodOptional<ZodDiscriminatedUnion<[ZodObject< {
4177
+ kind: ZodLiteral<"session_log">;
4178
+ sessionLogId: ZodString;
4179
+ }, $strip>, ZodObject< {
4180
+ kind: ZodLiteral<"checkin">;
4181
+ checkinId: ZodString;
4182
+ }, $strip>], "kind">>;
4183
+ }, $strip>, ZodObject< {
4184
+ data: ZodDiscriminatedUnion<[ZodObject< {
4185
+ status: ZodLiteral<"sent">;
4186
+ id: ZodGUID;
4187
+ sender: ZodDiscriminatedUnion<[ZodObject< {
4188
+ kind: ZodLiteral<"staff">;
4189
+ name: ZodString;
4190
+ }, $strip>, ZodObject< {
4191
+ kind: ZodLiteral<"member">;
4192
+ }, $strip>, ZodObject< {
4193
+ kind: ZodLiteral<"system">;
4194
+ }, $strip>, ZodObject< {
4195
+ kind: ZodLiteral<"assistant">;
4196
+ label: ZodLiteral<"Sent automatically">;
4197
+ writtenWithAi: ZodBoolean;
4198
+ }, $strip>], "kind">;
4199
+ body: ZodString;
4200
+ context: ZodNullable<ZodDiscriminatedUnion<[ZodObject< {
4201
+ kind: ZodLiteral<"session_log">;
4202
+ sessionLogId: ZodGUID;
4203
+ title: ZodString;
4204
+ startedAt: ZodString;
4205
+ }, $strip>, ZodObject< {
4206
+ kind: ZodLiteral<"checkin">;
4207
+ checkinId: ZodGUID;
4208
+ periodStart: ZodISODate;
4209
+ periodEnd: ZodISODate;
4210
+ }, $strip>, ZodObject< {
4211
+ kind: ZodLiteral<"unavailable">;
4212
+ was: ZodEnum< {
4213
+ checkin: "checkin";
4214
+ session_log: "session_log";
4215
+ }>;
4216
+ }, $strip>], "kind">>;
4217
+ attachments: ZodArray<ZodObject< {
4218
+ uploadId: ZodGUID;
4219
+ url: ZodString;
4220
+ width: ZodNumber;
4221
+ height: ZodNumber;
4222
+ }, $strip>>;
4223
+ createdAt: ZodString;
4224
+ clientRequestId: ZodNullable<ZodGUID>;
4225
+ }, $strip>, ZodObject< {
4226
+ status: ZodLiteral<"deleted">;
4227
+ id: ZodGUID;
4228
+ sender: ZodDiscriminatedUnion<[ZodObject< {
4229
+ kind: ZodLiteral<"staff">;
4230
+ name: ZodString;
4231
+ }, $strip>, ZodObject< {
4232
+ kind: ZodLiteral<"member">;
4233
+ }, $strip>, ZodObject< {
4234
+ kind: ZodLiteral<"system">;
4235
+ }, $strip>, ZodObject< {
4236
+ kind: ZodLiteral<"assistant">;
4237
+ label: ZodLiteral<"Sent automatically">;
4238
+ writtenWithAi: ZodBoolean;
4239
+ }, $strip>], "kind">;
4240
+ createdAt: ZodString;
4241
+ deletedAt: ZodString;
4242
+ }, $strip>], "status">;
4243
+ }, $strip>, Record<never, never>, Record<never, never>>;
4244
+ requestAttachmentUpload: DecoratedProcedure<MergedInitialContext< {
4245
+ headers: Headers;
4246
+ } & Record<never, never>, {
4247
+ headers: Headers;
4248
+ } & Record<never, never>, {
4249
+ headers: Headers;
4250
+ }>, MergedCurrentContext< {
4251
+ headers: Headers;
4252
+ }, ApiKeyContext>, ZodObject< {
4253
+ contentType: ZodEnum< {
4254
+ "image/webp": "image/webp";
4255
+ "image/jpeg": "image/jpeg";
4256
+ "image/png": "image/png";
4257
+ }>;
4258
+ fileSize: ZodNumber;
4259
+ width: ZodNumber;
4260
+ height: ZodNumber;
4261
+ }, $strip>, ZodObject< {
4262
+ data: ZodObject< {
4263
+ uploadId: ZodString;
4264
+ uploadUrl: ZodString;
4265
+ }, $strip>;
4266
+ }, $strip>, Record<never, never>, Record<never, never>>;
4267
+ markRead: DecoratedProcedure<MergedInitialContext< {
4268
+ headers: Headers;
4269
+ } & Record<never, never>, {
4270
+ headers: Headers;
4271
+ } & Record<never, never>, {
4272
+ headers: Headers;
4273
+ }>, MergedCurrentContext< {
4274
+ headers: Headers;
4275
+ }, ApiKeyContext>, ZodObject< {
4276
+ upTo: ZodOptional<ZodString>;
4277
+ }, $strip>, ZodObject< {
4278
+ data: ZodObject< {
4279
+ lastReadAt: ZodNullable<ZodISODateTime>;
4280
+ }, $strip>;
4281
+ }, $strip>, Record<never, never>, Record<never, never>>;
4282
+ delete: DecoratedProcedure<MergedInitialContext< {
4283
+ headers: Headers;
4284
+ } & Record<never, never>, {
4285
+ headers: Headers;
4286
+ } & Record<never, never>, {
4287
+ headers: Headers;
4288
+ }>, MergedCurrentContext< {
4289
+ headers: Headers;
4290
+ }, ApiKeyContext>, ZodObject< {
4291
+ id: ZodString;
4292
+ }, $strip>, ZodObject< {
4293
+ data: ZodDiscriminatedUnion<[ZodObject< {
4294
+ status: ZodLiteral<"sent">;
4295
+ id: ZodGUID;
4296
+ sender: ZodDiscriminatedUnion<[ZodObject< {
4297
+ kind: ZodLiteral<"staff">;
4298
+ name: ZodString;
4299
+ }, $strip>, ZodObject< {
4300
+ kind: ZodLiteral<"member">;
4301
+ }, $strip>, ZodObject< {
4302
+ kind: ZodLiteral<"system">;
4303
+ }, $strip>, ZodObject< {
4304
+ kind: ZodLiteral<"assistant">;
4305
+ label: ZodLiteral<"Sent automatically">;
4306
+ writtenWithAi: ZodBoolean;
4307
+ }, $strip>], "kind">;
4308
+ body: ZodString;
4309
+ context: ZodNullable<ZodDiscriminatedUnion<[ZodObject< {
4310
+ kind: ZodLiteral<"session_log">;
4311
+ sessionLogId: ZodGUID;
4312
+ title: ZodString;
4313
+ startedAt: ZodString;
4314
+ }, $strip>, ZodObject< {
4315
+ kind: ZodLiteral<"checkin">;
4316
+ checkinId: ZodGUID;
4317
+ periodStart: ZodISODate;
4318
+ periodEnd: ZodISODate;
4319
+ }, $strip>, ZodObject< {
4320
+ kind: ZodLiteral<"unavailable">;
4321
+ was: ZodEnum< {
4322
+ checkin: "checkin";
4323
+ session_log: "session_log";
4324
+ }>;
4325
+ }, $strip>], "kind">>;
4326
+ attachments: ZodArray<ZodObject< {
4327
+ uploadId: ZodGUID;
4328
+ url: ZodString;
4329
+ width: ZodNumber;
4330
+ height: ZodNumber;
4331
+ }, $strip>>;
4332
+ createdAt: ZodString;
4333
+ clientRequestId: ZodNullable<ZodGUID>;
4334
+ }, $strip>, ZodObject< {
4335
+ status: ZodLiteral<"deleted">;
4336
+ id: ZodGUID;
4337
+ sender: ZodDiscriminatedUnion<[ZodObject< {
4338
+ kind: ZodLiteral<"staff">;
4339
+ name: ZodString;
4340
+ }, $strip>, ZodObject< {
4341
+ kind: ZodLiteral<"member">;
4342
+ }, $strip>, ZodObject< {
4343
+ kind: ZodLiteral<"system">;
4344
+ }, $strip>, ZodObject< {
4345
+ kind: ZodLiteral<"assistant">;
4346
+ label: ZodLiteral<"Sent automatically">;
4347
+ writtenWithAi: ZodBoolean;
4348
+ }, $strip>], "kind">;
4349
+ createdAt: ZodString;
4350
+ deletedAt: ZodString;
4351
+ }, $strip>], "status">;
4352
+ }, $strip>, Record<never, never>, Record<never, never>>;
4353
+ unreadCount: DecoratedProcedure<MergedInitialContext< {
4354
+ headers: Headers;
4355
+ } & Record<never, never>, {
4356
+ headers: Headers;
4357
+ } & Record<never, never>, {
4358
+ headers: Headers;
4359
+ }>, MergedCurrentContext< {
4360
+ headers: Headers;
4361
+ }, ApiKeyContext>, ZodObject< {}, $strip>, ZodObject< {
4362
+ data: ZodObject< {
4363
+ unread: ZodNumber;
4364
+ }, $strip>;
4365
+ }, $strip>, Record<never, never>, Record<never, never>>;
4366
+ realtimeToken: DecoratedProcedure<MergedInitialContext< {
4367
+ headers: Headers;
4368
+ } & Record<never, never>, {
4369
+ headers: Headers;
4370
+ } & Record<never, never>, {
4371
+ headers: Headers;
4372
+ }>, MergedCurrentContext< {
4373
+ headers: Headers;
4374
+ }, ApiKeyContext>, ZodObject< {}, $strip>, ZodObject< {
4375
+ data: ZodObject< {
4376
+ token: ZodString;
4377
+ expiresAt: ZodISODateTime;
4378
+ topic: ZodString;
4379
+ }, $strip>;
4380
+ }, $strip>, Record<never, never>, Record<never, never>>;
4381
+ };
2829
4382
  progress: {
2830
4383
  getAdherence: DecoratedProcedure<MergedInitialContext< {
2831
4384
  headers: Headers;
@@ -2976,6 +4529,10 @@ declare const publicRouter: {
2976
4529
  servicesId: ZodNullable<ZodString>;
2977
4530
  }, $strip>;
2978
4531
  }, $strip>;
4532
+ realtime: ZodObject< {
4533
+ url: ZodString;
4534
+ anonKey: ZodString;
4535
+ }, $strip>;
2979
4536
  }, $strip>;
2980
4537
  }, $strip>, Record<never, never>, Record<never, never>>;
2981
4538
  };
@@ -3008,6 +4565,8 @@ declare const publicRouter: {
3008
4565
  premium_nutrition: "premium_nutrition";
3009
4566
  premium_recipes: "premium_recipes";
3010
4567
  premium_articles: "premium_articles";
4568
+ coaching_checkins: "coaching_checkins";
4569
+ coaching_messages: "coaching_messages";
3011
4570
  }>;
3012
4571
  label: ZodString;
3013
4572
  }, $strip>>;
@@ -3028,14 +4587,14 @@ declare const publicRouter: {
3028
4587
  subscription: ZodNullable<ZodObject< {
3029
4588
  plan: ZodEnum< {
3030
4589
  free: "free";
3031
- premium: "premium";
3032
4590
  basic: "basic";
4591
+ premium: "premium";
3033
4592
  }>;
3034
4593
  planId: ZodNullable<ZodString>;
3035
4594
  planName: ZodNullable<ZodString>;
3036
4595
  status: ZodEnum< {
3037
- active: "active";
3038
4596
  cancelled: "cancelled";
4597
+ active: "active";
3039
4598
  past_due: "past_due";
3040
4599
  }>;
3041
4600
  interval: ZodNullable<ZodEnum< {
@@ -3053,6 +4612,8 @@ declare const publicRouter: {
3053
4612
  premium_nutrition: "premium_nutrition";
3054
4613
  premium_recipes: "premium_recipes";
3055
4614
  premium_articles: "premium_articles";
4615
+ coaching_checkins: "coaching_checkins";
4616
+ coaching_messages: "coaching_messages";
3056
4617
  }>>]>;
3057
4618
  }, $strip>;
3058
4619
  }, $strip>, Record<never, never>, Record<never, never>>;
@@ -3092,14 +4653,14 @@ declare const publicRouter: {
3092
4653
  subscription: ZodNullable<ZodObject< {
3093
4654
  plan: ZodEnum< {
3094
4655
  free: "free";
3095
- premium: "premium";
3096
4656
  basic: "basic";
4657
+ premium: "premium";
3097
4658
  }>;
3098
4659
  planId: ZodNullable<ZodString>;
3099
4660
  planName: ZodNullable<ZodString>;
3100
4661
  status: ZodEnum< {
3101
- active: "active";
3102
4662
  cancelled: "cancelled";
4663
+ active: "active";
3103
4664
  past_due: "past_due";
3104
4665
  }>;
3105
4666
  interval: ZodNullable<ZodEnum< {
@@ -3117,6 +4678,8 @@ declare const publicRouter: {
3117
4678
  premium_nutrition: "premium_nutrition";
3118
4679
  premium_recipes: "premium_recipes";
3119
4680
  premium_articles: "premium_articles";
4681
+ coaching_checkins: "coaching_checkins";
4682
+ coaching_messages: "coaching_messages";
3120
4683
  }>>]>;
3121
4684
  confirmed: ZodBoolean;
3122
4685
  }, $strip>;
@@ -3139,6 +4702,84 @@ declare const publicRouter: {
3139
4702
  };
3140
4703
  };
3141
4704
 
4705
+ /**
4706
+ * The part of a supabase-js `RealtimeChannel` the subscription uses. A
4707
+ * channel that reports `CLOSED` is finished: supabase-js removes it from its
4708
+ * socket and never joins it again.
4709
+ */
4710
+ export declare interface RealtimeChannelLike {
4711
+ /** Listens for one Broadcast event on the channel. */
4712
+ on(type: "broadcast", filter: {
4713
+ readonly event: string;
4714
+ }, callback: (message: unknown) => void): RealtimeChannelLike;
4715
+ /** Joins the channel; `status` is `SUBSCRIBED`, `CHANNEL_ERROR`, `TIMED_OUT` or `CLOSED`. */
4716
+ subscribe(callback: (status: string, error?: Error) => void): RealtimeChannelLike;
4717
+ }
4718
+
4719
+ /**
4720
+ * Creates a new Supabase client for the subscription, with
4721
+ * `@supabase/supabase-js` 2.87.1 or later:
4722
+ *
4723
+ * ```ts
4724
+ * ({ url, anonKey }) =>
4725
+ * createClient(url, anonKey, {
4726
+ * auth: { persistSession: false, autoRefreshToken: false, detectSessionInUrl: false },
4727
+ * })
4728
+ * ```
4729
+ *
4730
+ * The client carries the trainee's Realtime token and nothing else, so its
4731
+ * auth stays off: no stored session, no refresh, and no sign-in read from
4732
+ * your page's URL that could replace the token. Return a new client on every
4733
+ * call: the subscription sets its own token on the client's socket and
4734
+ * disconnects it when it ends, so a client the app uses for anything else
4735
+ * would lose both. A factory that throws ends the subscription with
4736
+ * `fallback`.
4737
+ */
4738
+ export declare type RealtimeClientFactory = (connection: RealtimeConnection) => RealtimeClientLike;
4739
+
4740
+ /**
4741
+ * The part of a supabase-js `SupabaseClient` the subscription uses.
4742
+ * `@supabase/supabase-js` 2.87.1 or later: earlier clients swap the token the
4743
+ * subscription sets for the anon key on the next heartbeat.
4744
+ */
4745
+ export declare interface RealtimeClientLike {
4746
+ /** Creates a channel on `name`; the subscription always asks for a private one. */
4747
+ channel(name: string, options: {
4748
+ readonly config: {
4749
+ readonly private: true;
4750
+ };
4751
+ }): RealtimeChannelLike;
4752
+ /** Leaves and forgets a channel. */
4753
+ removeChannel(channel: RealtimeChannelLike): unknown;
4754
+ /** The client's Realtime socket: `setAuth(token)` hands it the token. */
4755
+ readonly realtime: {
4756
+ setAuth(token: string): Promise<void>;
4757
+ disconnect(): void;
4758
+ };
4759
+ }
4760
+
4761
+ /** fytkit's public Supabase Realtime settings, from `appConfig.get` (`data.realtime`). */
4762
+ export declare interface RealtimeConnection {
4763
+ /** The Supabase project URL. */
4764
+ readonly url: string;
4765
+ /** The project's public anon key. Safe to ship in an app. */
4766
+ readonly anonKey: string;
4767
+ }
4768
+
4769
+ /**
4770
+ * The data of `error`'s refusal when its reason is `reason`, typed for that
4771
+ * reason; null when `error` is not a `FytkitError`, carries no refusal, or
4772
+ * was refused for another reason.
4773
+ *
4774
+ * ```ts
4775
+ * catch (err) {
4776
+ * const sent = refusalData(err, "already_submitted");
4777
+ * if (sent) return openCheckIn(sent.checkinId);
4778
+ * }
4779
+ * ```
4780
+ */
4781
+ export declare function refusalData<R extends keyof FytkitRefusalDataByReason>(error: unknown, reason: R): FytkitRefusalDataByReason[R] | null;
4782
+
3142
4783
  /** Which second factors the signed-in user has configured. */
3143
4784
  export declare interface SecurityStatus {
3144
4785
  readonly twoFactorEnabled: boolean;
@@ -3157,8 +4798,12 @@ export declare interface Session {
3157
4798
  }
3158
4799
 
3159
4800
  /**
3160
- * One signed-in device/session from `auth.listSessions`. `revokeId` is an
3161
- * opaque identifier (never the bearer token) — pass it to `auth.revokeSession`.
4801
+ * One signed-in device/session from `auth.listSessions`: a session of the
4802
+ * trainee's issued through this app, or the calling session (`isCurrent`).
4803
+ * The trainee's sessions in fytkit's own apps and in other developer apps are
4804
+ * never listed. `revokeId` is an opaque identifier (never the bearer token);
4805
+ * pass it to `auth.revokeSession`. `ipAddress` and `userAgent` are what the
4806
+ * server recorded when the session was created.
3162
4807
  */
3163
4808
  export declare interface SessionInfo {
3164
4809
  readonly revokeId: string;
@@ -3184,6 +4829,59 @@ export declare type SignInResult = {
3184
4829
  readonly challenge: TwoFactorChallenge;
3185
4830
  };
3186
4831
 
4832
+ /**
4833
+ * Subscribes to changes in the signed-in trainee's conversation over
4834
+ * Supabase Realtime, and returns a function that ends the subscription.
4835
+ *
4836
+ * It fetches a token (`messages.realtimeToken`) and the connection settings
4837
+ * (`appConfig.get`), creates a client with `options.realtime`, hands the
4838
+ * socket the token, and joins the private topic the token names. The token
4839
+ * is renewed a minute before it expires, on the open channel; a renewed
4840
+ * token for another topic (another trainee signed in on the same client)
4841
+ * leaves that channel and its client and joins the new topic on a new one.
4842
+ * A channel Realtime closes is joined afresh on the same client after a
4843
+ * wait (5 seconds, 15, then every minute), with the token handed to the
4844
+ * socket again first, or a new one if it has expired. Requests that fail
4845
+ * for now are retried every minute; a refused token (`auth_required`,
4846
+ * `forbidden`, `not_found`, `validation`) ends the subscription with
4847
+ * `refused`.
4848
+ *
4849
+ * `onChange` carries no data: read the conversation and the unread count
4850
+ * again. Poll while the status is `connecting` or `fallback`. Needs
4851
+ * `@supabase/supabase-js` 2.87.1 or later (see {@link RealtimeClientFactory}).
4852
+ *
4853
+ * @example
4854
+ * ```ts
4855
+ * import { createClient } from "@supabase/supabase-js";
4856
+ * import { MESSAGES_FALLBACK_POLL_MS, subscribeToMessages } from "@fytkit/sdk";
4857
+ *
4858
+ * const unsubscribe = subscribeToMessages(fytkit, {
4859
+ * // A client for the subscription alone, carrying the trainee's token only.
4860
+ * realtime: ({ url, anonKey }) =>
4861
+ * createClient(url, anonKey, {
4862
+ * auth: { persistSession: false, autoRefreshToken: false, detectSessionInUrl: false },
4863
+ * }),
4864
+ * onChange: () => refreshConversation(),
4865
+ * onStatus: (status) => setPolling(status === "connecting" || status === "fallback"),
4866
+ * });
4867
+ * ```
4868
+ */
4869
+ export declare function subscribeToMessages(client: MessagesRealtimeSource, options: SubscribeToMessagesOptions): () => void;
4870
+
4871
+ /** What {@link subscribeToMessages} needs besides the client. */
4872
+ export declare interface SubscribeToMessagesOptions {
4873
+ /** Creates the Supabase client the subscription owns. See {@link RealtimeClientFactory}. */
4874
+ readonly realtime: RealtimeClientFactory;
4875
+ /**
4876
+ * The conversation may have changed: read `messages.list` and
4877
+ * `messages.unreadCount` again. Also called on every (re)join, since
4878
+ * changes while the channel was down were not heard.
4879
+ */
4880
+ readonly onChange: () => void;
4881
+ /** Each change of {@link MessagesRealtimeStatus}, starting with `connecting`. */
4882
+ readonly onStatus?: (status: MessagesRealtimeStatus) => void;
4883
+ }
4884
+
3187
4885
  /** Pluggable storage so the SDK runs in browser, SSR, and tests. */
3188
4886
  export declare interface TokenStorage {
3189
4887
  readonly get: () => Session | null | Promise<Session | null>;