@domino-sdk/relay 1.0.0-next.9 → 1.0.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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/dist/activity-DeKJsRry.d.ts +9112 -0
  3. package/dist/authoring.d.ts +1027 -233
  4. package/dist/authoring.js +478 -277
  5. package/dist/automatic-outcomes-B1xrETxm.d.ts +758 -0
  6. package/dist/avatar.d.ts +2 -2
  7. package/dist/browser-DFe7sWSN.d.ts +4154 -0
  8. package/dist/browser.d.ts +11 -2613
  9. package/dist/browser.js +8 -6
  10. package/dist/{integrations-Ba5TtqTv.d.ts → capability-error-DNMwKmlL.d.ts} +124 -76
  11. package/dist/{chunk-PHU5VDLR.js → chunk-36HTX2BM.js} +389 -169
  12. package/dist/chunk-6QJ3LADK.js +112 -0
  13. package/dist/{chunk-4LBUTHD6.js → chunk-BGGKNIRP.js} +1 -1
  14. package/dist/chunk-EYH5RDIE.js +496 -0
  15. package/dist/chunk-GQKYAQM6.js +84 -0
  16. package/dist/chunk-GUP7YRR4.js +42 -0
  17. package/dist/{chunk-X2F2RAR3.js → chunk-GZ6FJAXN.js} +380 -128
  18. package/dist/chunk-JON5SESL.js +2986 -0
  19. package/dist/chunk-MC6V6VMG.js +49 -0
  20. package/dist/chunk-NPGENI7K.js +37 -0
  21. package/dist/chunk-VFHHLN6A.js +284 -0
  22. package/dist/chunk-WJSSJ7AF.js +151 -0
  23. package/dist/{chunk-7Q4BGGT6.js → chunk-XFMSUPNS.js} +1 -1
  24. package/dist/{chunk-P6FK43GG.js → chunk-ZVIRG24J.js} +145 -42
  25. package/dist/{client-CT4-S5vc.d.ts → client-XiuFnug_.d.ts} +2161 -615
  26. package/dist/{submission-input-0OOGaq8c.d.ts → groups-Ck-OxzjD.d.ts} +916 -1139
  27. package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
  28. package/dist/images-Dv-P5VBw.d.ts +234 -0
  29. package/dist/index.d.ts +13 -9
  30. package/dist/index.js +17 -6
  31. package/dist/internal.d.ts +82 -44
  32. package/dist/internal.js +43 -89
  33. package/dist/offers-Cy-e4o5x.d.ts +431 -0
  34. package/dist/{pages-D3titw5B.d.ts → outcomes-kVB-Juzs.d.ts} +2157 -1448
  35. package/dist/pages-BBYD21IE.d.ts +359 -0
  36. package/dist/participant-rewards-3duLb8YJ.d.ts +668 -0
  37. package/dist/portal-proxy.js +22 -4
  38. package/dist/{profiles-DDMFBRKe.d.ts → profiles-D2aFcOxu.d.ts} +15 -15
  39. package/dist/react/index.d.ts +3038 -1029
  40. package/dist/react/index.js +1627 -779
  41. package/dist/request-error-DWduJCGV.d.ts +62 -0
  42. package/dist/schema-DfJzH2ci.d.ts +5644 -0
  43. package/dist/schema.d.ts +15 -4168
  44. package/dist/schema.js +310 -81
  45. package/dist/server/index.d.ts +81498 -0
  46. package/dist/server/index.js +2520 -0
  47. package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
  48. package/dist/submission-input-BZkm6ohU.d.ts +290 -0
  49. package/dist/vite.d.ts +1 -1
  50. package/dist/vite.js +1 -0
  51. package/dist/{wallet-BGOfFkG9.d.ts → wallet-YssWxGg8.d.ts} +35 -38
  52. package/package.json +8 -2
  53. package/dist/chunk-QR7ZA2BJ.js +0 -257
  54. package/dist/chunk-YYD4QUBO.js +0 -2348
  55. package/dist/chunk-ZWY3R6B3.js +0 -26
  56. package/dist/collection-BGneJ6Bk.d.ts +0 -114
  57. package/dist/images-BTgk6OmC.d.ts +0 -1564
  58. package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
  59. package/dist/schema-Di3aLSiK.d.ts +0 -3532
@@ -1,60 +1,12 @@
1
- import { V as ValueEvidence, i as referralAcceptSchema, d as LeaderboardQuery, a as AuthProvider, j as engagementPageQuerySchema, k as contentQualificationQuerySchema, m as contentAdmissionQuerySchema, n as contentEnrollmentInputSchema, o as contentReleaseInputSchema } from './submission-input-0OOGaq8c.js';
2
- import { b as QuizEvidence, A as Attempt, M as MemberProgress, s as submitSchema, g as contentPerformanceQuerySchema } from './schema-Di3aLSiK.js';
3
- import { c as ParticipantSession, e as QuestView, a as PageQuery, q as questExperienceSchema, f as exchangeSchema } from './pages-D3titw5B.js';
1
+ import { aG as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, V as engagementPageQuerySchema } from './groups-Ck-OxzjD.js';
2
+ import { i as QuestView, b as QuestEnrollmentInput, Q as QuestClaimInput, f as QuestOutcomeQuery, P as questExperienceSchema, n as RewardDeliveryAction, A as contentQualificationQuerySchema } from './outcomes-kVB-Juzs.js';
3
+ import { M as MissingPrerequisite, V as ValueEvidence, a as AuthProvider } from './submission-input-BZkm6ohU.js';
4
+ import { R as RequestError, a as RequestErrorDetails, b as RequestErrorKind } from './request-error-DWduJCGV.js';
5
+ import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, bI as submitSchema, aI as contentPerformanceQuerySchema } from './schema-DfJzH2ci.js';
6
+ import { d as ParticipantSession, a as PageQuery, g as exchangeSchema, R as RelayEvent, b as ParticipantActivity } from './pages-BBYD21IE.js';
4
7
  import { z } from 'zod';
5
- import { p as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-DDMFBRKe.js';
6
- import { w as walletAddressInputSchema, l as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-BGOfFkG9.js';
7
-
8
- /**
9
- * The request-error core every Domino client error extends: the participant `RelayError` and the
10
- * management client's error share these fields, so one handler serves both.
11
- *
12
- * `kind` says what happened:
13
- *
14
- * - `http`: the server answered with an error status.
15
- * - `network`: the transport failed, including a response body cut off after its headers.
16
- * - `timeout`: the client's deadline passed.
17
- * - `aborted`: the caller cancelled the request.
18
- * - `invalid-response`: a 2xx answer that is not JSON, or not the shape this SDK version expects.
19
- * - `client`: the client refused the call without sending it, such as for invalid input.
20
- */
21
- type RequestErrorKind = "http" | "network" | "timeout" | "aborted" | "invalid-response" | "client";
22
- /**
23
- * What to do when `uncertain` is true. `replay`: sending the call again with the same
24
- * `operationId` is safe, because the server applies it at most once. `reconcile`: read the state
25
- * first, since repeating the call could apply it twice.
26
- */
27
- type RequestRecovery = "replay" | "reconcile";
28
- type RequestErrorDetails = {
29
- kind: RequestErrorKind;
30
- /** True only when a write may have been applied. Reads are never uncertain. */
31
- uncertain?: boolean;
32
- /** The HTTP status, whenever response headers arrived. Never invented. */
33
- status?: number;
34
- /** A machine-readable code: open, so a newer server's codes are kept. */
35
- code?: string;
36
- /** The call's idempotency or action ID, to replay it with. */
37
- operationId?: string;
38
- cause?: unknown;
39
- };
40
- declare const requestErrorBrand: unique symbol;
41
- /**
42
- * Whether `value` is a `RequestError` from any copy of the SDK. Prefer it to `instanceof`, which
43
- * fails when an app bundles two copies of the package.
44
- */
45
- declare function isRequestError(value: unknown): value is RequestError;
46
- declare class RequestError extends Error {
47
- readonly name: string;
48
- readonly [requestErrorBrand] = true;
49
- readonly kind: RequestErrorKind;
50
- readonly uncertain: boolean;
51
- readonly status: number | undefined;
52
- readonly code: string | undefined;
53
- readonly operationId: string | undefined;
54
- /** `replay` when there is an `operationId`, else `reconcile`; only when `uncertain`. */
55
- readonly recovery: RequestRecovery | undefined;
56
- constructor(message: string, details: RequestErrorDetails);
57
- }
8
+ import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-D2aFcOxu.js';
9
+ import { y as walletAddressInputSchema, I as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-YssWxGg8.js';
58
10
 
59
11
  /** What happened, as in every Domino client error (see `RequestError`). */
60
12
  type RelayErrorKind = RequestErrorKind;
@@ -82,18 +34,45 @@ declare const RelayErrorCode: {
82
34
  readonly NotFound: "not-found";
83
35
  /** The quest has no failed attempt the member can retry. */
84
36
  readonly RetryUnavailable: "retry-unavailable";
85
- /** Durable submission storage is missing, blocked or unreadable. */
37
+ /**
38
+ * Durable submission storage is missing, blocked or unreadable. Nothing was lost: call the
39
+ * handle's `status()` or `resume()` again once storage is available.
40
+ */
86
41
  readonly SubmissionStorage: "submission-storage";
42
+ /** Browser storage is full, so submission progress was not saved. Free space, then resume. */
43
+ readonly SubmissionStorageQuota: "submission-storage-quota";
87
44
  /** The saved submission is in a state that does not allow this action. */
88
45
  readonly SubmissionConflict: "submission-conflict";
89
46
  /** The quest changed since the member saw it; review it before submitting again. */
90
47
  readonly QuestUpdated: "quest-updated";
48
+ /** Wait for the deferred attempt before submitting another action. */
49
+ readonly AttemptPending: "attempt-pending";
91
50
  /** The quiz changed since the member answered it. */
92
51
  readonly StaleQuiz: "stale-quiz";
93
52
  /** Relay refused the submitted evidence. */
94
53
  readonly InvalidSubmission: "invalid-submission";
95
54
  /** A page cursor Relay cannot read; start again from the first page. */
96
55
  readonly InvalidCursor: "invalid-cursor";
56
+ /** No point ledger in the project has the key or ID the call named. */
57
+ readonly PointLedgerNotFound: "point-ledger-not-found";
58
+ /** The member has not joined this project, so it holds no points here. */
59
+ readonly NotJoined: "not-joined";
60
+ /** The quest or campaign is not open at this time. */
61
+ readonly OutsideWindow: "outside-window";
62
+ /** The signed-in member must enroll in the campaign first. */
63
+ readonly EnrollmentRequired: "enrollment-required";
64
+ /** The quest's current reward budget has no remaining capacity. */
65
+ readonly BudgetExhausted: "budget-exhausted";
66
+ /** No published offer has the key or ID the call named. */
67
+ readonly OfferNotFound: "offer-not-found";
68
+ /** The operator paused this offer. */
69
+ readonly OfferPaused: "offer-paused";
70
+ /** This member has already used the offer's allowed number of redemptions. */
71
+ readonly OfferLimitReached: "offer-limit-reached";
72
+ /** No declared units remain. */
73
+ readonly OfferOutOfStock: "offer-out-of-stock";
74
+ /** The participant's available point balance is below the offer price. */
75
+ readonly InsufficientPoints: "insufficient-points";
97
76
  /** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
98
77
  readonly WalletSigner: "wallet-signer";
99
78
  };
@@ -101,10 +80,7 @@ declare const RelayErrorCode: {
101
80
  type RelayErrorCode = KnownRelayErrorCode | (string & {});
102
81
  type RelayErrorDetails = RequestErrorDetails & {
103
82
  code?: RelayErrorCode;
104
- missing?: {
105
- quest: string;
106
- title: string;
107
- }[];
83
+ missing?: MissingPrerequisite[];
108
84
  };
109
85
  declare const relayErrorBrand: unique symbol;
110
86
  /** Whether `value` is a `RelayError` from any copy of the SDK. Prefer it to `instanceof`. */
@@ -114,11 +90,8 @@ declare class RelayError extends RequestError {
114
90
  readonly name: string;
115
91
  readonly [relayErrorBrand] = true;
116
92
  readonly code: RelayErrorCode | undefined;
117
- /** Prerequisite quests the member has not completed, when Relay refused for that reason. */
118
- readonly missing: {
119
- quest: string;
120
- title: string;
121
- }[];
93
+ /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
94
+ readonly missing: MissingPrerequisite[];
122
95
  constructor(message: string, details: RelayErrorDetails);
123
96
  }
124
97
 
@@ -234,8 +207,16 @@ type RelayRequestOptions = {
234
207
  * session (wallet linking, collection passes, retries) read the current session when omitted.
235
208
  */
236
209
  session?: string;
237
- /** Cancels the call, which rejects with a `RelayError` of kind `aborted`. */
210
+ /**
211
+ * Cancels the call, which rejects with a `RelayError` of kind `aborted`. Cancelling stops any
212
+ * retry; a write already sent stays `uncertain`, since Relay may have applied it.
213
+ */
238
214
  signal?: AbortSignal;
215
+ /**
216
+ * The call's deadline in milliseconds, covering every attempt, the waits between them and the
217
+ * answer's body. Replaces the client's `timeout` for this call.
218
+ */
219
+ timeout?: number;
239
220
  };
240
221
  type RelayClientOptions = {
241
222
  baseUrl: string;
@@ -244,8 +225,138 @@ type RelayClientOptions = {
244
225
  organization?: string;
245
226
  project?: string;
246
227
  environment?: "test" | "live";
228
+ /**
229
+ * Each call's deadline in milliseconds, covering retries and the answer's body; a call's own
230
+ * `timeout` replaces it. Defaults to 15 seconds.
231
+ */
232
+ timeout?: number;
247
233
  };
248
234
  declare function createRelayClient(options: RelayClientOptions): {
235
+ offers: {
236
+ /** Offers available to this participant, including stock and per-member availability. */
237
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
238
+ id: string;
239
+ title: string;
240
+ price: {
241
+ kind: "points";
242
+ balance: string;
243
+ amount: number;
244
+ };
245
+ reward: {
246
+ kind: "tier";
247
+ reward: {
248
+ id: string;
249
+ title: string;
250
+ tiers: {
251
+ id: string;
252
+ title: string;
253
+ }[];
254
+ inventory: {
255
+ kind: "untracked";
256
+ };
257
+ fulfillment: {
258
+ kind: "staff-handover";
259
+ } | {
260
+ kind: "automatic";
261
+ };
262
+ };
263
+ tier: string;
264
+ };
265
+ stock: number;
266
+ limit: {
267
+ perMember: number;
268
+ };
269
+ enabled: boolean;
270
+ revision: number;
271
+ available: number;
272
+ redeemed: number;
273
+ availability: {
274
+ kind: "available";
275
+ remaining: number;
276
+ } | {
277
+ kind: "out-of-stock";
278
+ } | {
279
+ kind: "limit-reached";
280
+ } | {
281
+ kind: "paused";
282
+ };
283
+ key?: string | undefined;
284
+ }[]>;
285
+ /** Redeems one offer. Persist `actionId` to retry after an uncertain result. */
286
+ redeem: (offer: string, input?: {
287
+ actionId?: string;
288
+ }, requestOptions?: RelayRequestOptions) => Promise<{
289
+ status: "fulfilled";
290
+ id: string;
291
+ offer: string;
292
+ member: string;
293
+ reservation: string;
294
+ price: {
295
+ kind: "points";
296
+ balance: string;
297
+ amount: number;
298
+ };
299
+ reward: {
300
+ kind: "tier";
301
+ reward: {
302
+ id: string;
303
+ title: string;
304
+ tiers: {
305
+ id: string;
306
+ title: string;
307
+ }[];
308
+ inventory: {
309
+ kind: "untracked";
310
+ };
311
+ fulfillment: {
312
+ kind: "staff-handover";
313
+ } | {
314
+ kind: "automatic";
315
+ };
316
+ };
317
+ tier: string;
318
+ };
319
+ entitlement: string;
320
+ revision: number;
321
+ redeemedAt: number;
322
+ } | {
323
+ status: "canceled";
324
+ canceledAt: number;
325
+ reason: string;
326
+ id: string;
327
+ offer: string;
328
+ member: string;
329
+ reservation: string;
330
+ price: {
331
+ kind: "points";
332
+ balance: string;
333
+ amount: number;
334
+ };
335
+ reward: {
336
+ kind: "tier";
337
+ reward: {
338
+ id: string;
339
+ title: string;
340
+ tiers: {
341
+ id: string;
342
+ title: string;
343
+ }[];
344
+ inventory: {
345
+ kind: "untracked";
346
+ };
347
+ fulfillment: {
348
+ kind: "staff-handover";
349
+ } | {
350
+ kind: "automatic";
351
+ };
352
+ };
353
+ tier: string;
354
+ };
355
+ entitlement: string;
356
+ revision: number;
357
+ redeemedAt: number;
358
+ }>;
359
+ };
249
360
  referrals: {
250
361
  list: (requestOptions?: RelayRequestOptions) => Promise<{
251
362
  id: string;
@@ -274,6 +385,8 @@ declare function createRelayClient(options: RelayClientOptions): {
274
385
  };
275
386
  fulfillment: {
276
387
  kind: "staff-handover";
388
+ } | {
389
+ kind: "automatic";
277
390
  };
278
391
  };
279
392
  tier: string;
@@ -296,6 +409,8 @@ declare function createRelayClient(options: RelayClientOptions): {
296
409
  };
297
410
  fulfillment: {
298
411
  kind: "staff-handover";
412
+ } | {
413
+ kind: "automatic";
299
414
  };
300
415
  };
301
416
  tier: string;
@@ -322,6 +437,8 @@ declare function createRelayClient(options: RelayClientOptions): {
322
437
  };
323
438
  fulfillment: {
324
439
  kind: "staff-handover";
440
+ } | {
441
+ kind: "automatic";
325
442
  };
326
443
  };
327
444
  tier: string;
@@ -374,6 +491,8 @@ declare function createRelayClient(options: RelayClientOptions): {
374
491
  };
375
492
  fulfillment: {
376
493
  kind: "staff-handover";
494
+ } | {
495
+ kind: "automatic";
377
496
  };
378
497
  };
379
498
  tier: string;
@@ -396,6 +515,8 @@ declare function createRelayClient(options: RelayClientOptions): {
396
515
  };
397
516
  fulfillment: {
398
517
  kind: "staff-handover";
518
+ } | {
519
+ kind: "automatic";
399
520
  };
400
521
  };
401
522
  tier: string;
@@ -422,6 +543,8 @@ declare function createRelayClient(options: RelayClientOptions): {
422
543
  };
423
544
  fulfillment: {
424
545
  kind: "staff-handover";
546
+ } | {
547
+ kind: "automatic";
425
548
  };
426
549
  };
427
550
  tier: string;
@@ -476,125 +599,519 @@ declare function createRelayClient(options: RelayClientOptions): {
476
599
  ok: true;
477
600
  }>;
478
601
  };
479
- tieredRewards: {
480
- /**
481
- * The project's tiered rewards with their keys. Entitlements and reward
482
- * definitions name them by ID: use this to find the ID for a key.
483
- */
484
- list: (requestOptions?: RelayRequestOptions) => Promise<{
485
- id: string;
486
- key: string | null;
487
- }[]>;
488
- };
489
- pointLedgers: {
490
- /**
491
- * The project's point ledgers with their keys and names. Reads return
492
- * ledger IDs: use this to find the ID for a key, or a ledger's name.
493
- */
494
- list: (requestOptions?: RelayRequestOptions) => Promise<{
495
- id: string;
496
- key: string | null;
497
- name: string;
498
- }[]>;
499
- };
500
- leaderboards: {
501
- list: (requestOptions?: RelayRequestOptions) => Promise<{
502
- id: string;
503
- title: string;
504
- balance: string;
505
- score: {
506
- kind: "balance";
507
- } | {
508
- window: {
509
- kind: "fixed";
510
- start: number;
511
- end: number;
512
- } | {
513
- kind: "all-time";
514
- } | {
515
- kind: "rolling";
516
- days: number;
517
- } | {
518
- kind: "calendar";
519
- period: "day" | "week" | "month";
520
- timeZone: string;
602
+ rewards: {
603
+ /** The signed-in member's earned rewards, including pickup allocation and collection state. */
604
+ entitlements: (options?: RelayRequestOptions) => Promise<{
605
+ items: ({
606
+ [x: string]: unknown;
607
+ status: "available";
608
+ id: string;
609
+ member: string;
610
+ reward: {
611
+ [x: string]: unknown;
612
+ id: string;
613
+ title: string;
614
+ tiers: {
615
+ [x: string]: unknown;
616
+ id: string;
617
+ title: string;
618
+ }[];
619
+ inventory: {
620
+ [x: string]: unknown;
621
+ kind: string;
622
+ };
623
+ fulfillment: {
624
+ [x: string]: unknown;
625
+ kind: string;
626
+ };
521
627
  };
522
- kind: "earned";
523
- quests?: string[] | undefined;
628
+ earnedTier: string;
629
+ tier: string;
630
+ revision: number;
524
631
  } | {
525
- kind: "net";
526
- window: {
527
- kind: "fixed";
528
- start: number;
529
- end: number;
530
- } | {
531
- kind: "all-time";
532
- } | {
533
- kind: "rolling";
534
- days: number;
535
- } | {
536
- kind: "calendar";
537
- period: "day" | "week" | "month";
538
- timeZone: string;
539
- };
540
- };
541
- access: "participants" | "public";
542
- key?: string | undefined;
543
- group?: string | undefined;
544
- }[]>;
545
- standings: (board: string, query?: LeaderboardQuery, requestOptions?: RelayRequestOptions) => Promise<{
546
- leaderboard: string;
547
- title: string;
548
- version: string;
549
- calculation: "balance" | "earned" | "net";
550
- period: {
551
- start: number | null;
552
- end: number | null;
553
- };
554
- calculatedAt: number;
555
- lastEntryAt: number | null;
556
- total: number;
557
- items: {
558
- participant: string;
559
- name: string;
560
- score: number;
561
- rank: number;
562
- profile: {
632
+ [x: string]: unknown;
633
+ status: "handing-over";
634
+ handover: string;
635
+ startedAt: number;
636
+ id: string;
637
+ member: string;
638
+ reward: {
639
+ [x: string]: unknown;
563
640
  id: string;
564
- name: string;
565
- avatar: {
566
- source: "upload";
567
- url: string;
568
- seed: string;
569
- } | {
570
- source: "account";
571
- provider: "google" | "x" | "discord";
572
- url: string;
573
- seed: string;
574
- } | {
575
- source: "generated";
576
- seed: string;
641
+ title: string;
642
+ tiers: {
643
+ [x: string]: unknown;
644
+ id: string;
645
+ title: string;
646
+ }[];
647
+ inventory: {
648
+ [x: string]: unknown;
649
+ kind: string;
577
650
  };
578
- } | null;
579
- member?: string | undefined;
580
- }[];
581
- me: {
582
- participant: string;
583
- name: string;
584
- score: number;
585
- rank: number;
586
- profile: {
587
- id: string;
588
- name: string;
589
- avatar: {
590
- source: "upload";
591
- url: string;
592
- seed: string;
593
- } | {
594
- source: "account";
595
- provider: "google" | "x" | "discord";
596
- url: string;
597
- seed: string;
651
+ fulfillment: {
652
+ [x: string]: unknown;
653
+ kind: string;
654
+ };
655
+ };
656
+ earnedTier: string;
657
+ tier: string;
658
+ revision: number;
659
+ allocation?: {
660
+ [x: string]: unknown;
661
+ item: string;
662
+ label: string;
663
+ } | undefined;
664
+ } | {
665
+ [x: string]: unknown;
666
+ status: "collected";
667
+ handover: string;
668
+ startedAt: number;
669
+ collectedAt: number;
670
+ id: string;
671
+ member: string;
672
+ reward: {
673
+ [x: string]: unknown;
674
+ id: string;
675
+ title: string;
676
+ tiers: {
677
+ [x: string]: unknown;
678
+ id: string;
679
+ title: string;
680
+ }[];
681
+ inventory: {
682
+ [x: string]: unknown;
683
+ kind: string;
684
+ };
685
+ fulfillment: {
686
+ [x: string]: unknown;
687
+ kind: string;
688
+ };
689
+ };
690
+ earnedTier: string;
691
+ tier: string;
692
+ revision: number;
693
+ allocation?: {
694
+ [x: string]: unknown;
695
+ item: string;
696
+ label: string;
697
+ } | undefined;
698
+ recovery?: {
699
+ completion: string;
700
+ reason: string;
701
+ flaggedAt: number;
702
+ remainingTier: string | null;
703
+ } | undefined;
704
+ } | {
705
+ [x: string]: unknown;
706
+ status: "void";
707
+ voidedAt: number;
708
+ id: string;
709
+ member: string;
710
+ reward: {
711
+ [x: string]: unknown;
712
+ id: string;
713
+ title: string;
714
+ tiers: {
715
+ [x: string]: unknown;
716
+ id: string;
717
+ title: string;
718
+ }[];
719
+ inventory: {
720
+ [x: string]: unknown;
721
+ kind: string;
722
+ };
723
+ fulfillment: {
724
+ [x: string]: unknown;
725
+ kind: string;
726
+ };
727
+ };
728
+ earnedTier: string;
729
+ tier: string;
730
+ revision: number;
731
+ } | {
732
+ status: "unsupported";
733
+ reportedStatus: string;
734
+ id: string;
735
+ member: string;
736
+ reward: {
737
+ [x: string]: unknown;
738
+ id: string;
739
+ title: string;
740
+ tiers: {
741
+ [x: string]: unknown;
742
+ id: string;
743
+ title: string;
744
+ }[];
745
+ inventory: {
746
+ [x: string]: unknown;
747
+ kind: string;
748
+ };
749
+ fulfillment: {
750
+ [x: string]: unknown;
751
+ kind: string;
752
+ };
753
+ };
754
+ earnedTier: string;
755
+ tier: string;
756
+ revision: number;
757
+ })[];
758
+ }>;
759
+ /** Point awards, current tier entitlements, and integration delivery states. */
760
+ deliveries: (options?: RelayRequestOptions) => Promise<{
761
+ items: ({
762
+ [x: string]: z.core.util.JSONType;
763
+ kind: "points";
764
+ ledger: {
765
+ id: string;
766
+ key: string | null;
767
+ name: string;
768
+ };
769
+ amount: number;
770
+ reversed: number;
771
+ id: string;
772
+ status: string;
773
+ at: number | null;
774
+ quest: string | null;
775
+ completion: string | null;
776
+ } | {
777
+ [x: string]: unknown;
778
+ kind: "tier";
779
+ entitlement: {
780
+ [x: string]: unknown;
781
+ status: "available";
782
+ id: string;
783
+ member: string;
784
+ reward: {
785
+ [x: string]: unknown;
786
+ id: string;
787
+ title: string;
788
+ tiers: {
789
+ [x: string]: unknown;
790
+ id: string;
791
+ title: string;
792
+ }[];
793
+ inventory: {
794
+ [x: string]: unknown;
795
+ kind: string;
796
+ };
797
+ fulfillment: {
798
+ [x: string]: unknown;
799
+ kind: string;
800
+ };
801
+ };
802
+ earnedTier: string;
803
+ tier: string;
804
+ revision: number;
805
+ } | {
806
+ [x: string]: unknown;
807
+ status: "handing-over";
808
+ handover: string;
809
+ startedAt: number;
810
+ id: string;
811
+ member: string;
812
+ reward: {
813
+ [x: string]: unknown;
814
+ id: string;
815
+ title: string;
816
+ tiers: {
817
+ [x: string]: unknown;
818
+ id: string;
819
+ title: string;
820
+ }[];
821
+ inventory: {
822
+ [x: string]: unknown;
823
+ kind: string;
824
+ };
825
+ fulfillment: {
826
+ [x: string]: unknown;
827
+ kind: string;
828
+ };
829
+ };
830
+ earnedTier: string;
831
+ tier: string;
832
+ revision: number;
833
+ allocation?: {
834
+ [x: string]: unknown;
835
+ item: string;
836
+ label: string;
837
+ } | undefined;
838
+ } | {
839
+ [x: string]: unknown;
840
+ status: "collected";
841
+ handover: string;
842
+ startedAt: number;
843
+ collectedAt: number;
844
+ id: string;
845
+ member: string;
846
+ reward: {
847
+ [x: string]: unknown;
848
+ id: string;
849
+ title: string;
850
+ tiers: {
851
+ [x: string]: unknown;
852
+ id: string;
853
+ title: string;
854
+ }[];
855
+ inventory: {
856
+ [x: string]: unknown;
857
+ kind: string;
858
+ };
859
+ fulfillment: {
860
+ [x: string]: unknown;
861
+ kind: string;
862
+ };
863
+ };
864
+ earnedTier: string;
865
+ tier: string;
866
+ revision: number;
867
+ allocation?: {
868
+ [x: string]: unknown;
869
+ item: string;
870
+ label: string;
871
+ } | undefined;
872
+ recovery?: {
873
+ completion: string;
874
+ reason: string;
875
+ flaggedAt: number;
876
+ remainingTier: string | null;
877
+ } | undefined;
878
+ } | {
879
+ [x: string]: unknown;
880
+ status: "void";
881
+ voidedAt: number;
882
+ id: string;
883
+ member: string;
884
+ reward: {
885
+ [x: string]: unknown;
886
+ id: string;
887
+ title: string;
888
+ tiers: {
889
+ [x: string]: unknown;
890
+ id: string;
891
+ title: string;
892
+ }[];
893
+ inventory: {
894
+ [x: string]: unknown;
895
+ kind: string;
896
+ };
897
+ fulfillment: {
898
+ [x: string]: unknown;
899
+ kind: string;
900
+ };
901
+ };
902
+ earnedTier: string;
903
+ tier: string;
904
+ revision: number;
905
+ } | {
906
+ status: "unsupported";
907
+ reportedStatus: string;
908
+ id: string;
909
+ member: string;
910
+ reward: {
911
+ [x: string]: unknown;
912
+ id: string;
913
+ title: string;
914
+ tiers: {
915
+ [x: string]: unknown;
916
+ id: string;
917
+ title: string;
918
+ }[];
919
+ inventory: {
920
+ [x: string]: unknown;
921
+ kind: string;
922
+ };
923
+ fulfillment: {
924
+ [x: string]: unknown;
925
+ kind: string;
926
+ };
927
+ };
928
+ earnedTier: string;
929
+ tier: string;
930
+ revision: number;
931
+ };
932
+ id: string;
933
+ status: string;
934
+ at: number | null;
935
+ quest: string | null;
936
+ completion: string | null;
937
+ } | {
938
+ [x: string]: z.core.util.JSONType | undefined;
939
+ kind: "integration";
940
+ provider: string;
941
+ action: string;
942
+ deliveredAt: number | null;
943
+ revokedAt: number | null;
944
+ reconciliation: {
945
+ [x: string]: z.core.util.JSONType;
946
+ status: string;
947
+ ownership: string;
948
+ at: number;
949
+ } | null;
950
+ id: string;
951
+ status: string;
952
+ at: number | null;
953
+ quest: string | null;
954
+ completion: string | null;
955
+ roleId?: string | undefined;
956
+ } | {
957
+ kind: "unknown";
958
+ reportedKind: string;
959
+ id: string;
960
+ status: string;
961
+ at: number | null;
962
+ quest: string | null;
963
+ completion: string | null;
964
+ })[];
965
+ }>;
966
+ };
967
+ tieredRewards: {
968
+ /**
969
+ * The project's tiered rewards with their keys. Entitlements and reward
970
+ * definitions name them by ID: use this to find the ID for a key.
971
+ */
972
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
973
+ id: string;
974
+ key: string | null;
975
+ }[]>;
976
+ };
977
+ pointLedgers: {
978
+ /**
979
+ * The project's point ledgers with their keys and names. Reads return
980
+ * ledger IDs: use this to find the ID for a key, or a ledger's name.
981
+ */
982
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
983
+ id: string;
984
+ key: string | null;
985
+ name: string;
986
+ }[]>;
987
+ };
988
+ leaderboards: {
989
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
990
+ id: string;
991
+ title: string;
992
+ balance: string;
993
+ score: {
994
+ kind: "balance";
995
+ } | {
996
+ window: {
997
+ kind: "fixed";
998
+ start: number;
999
+ end: number;
1000
+ } | {
1001
+ kind: "all-time";
1002
+ } | {
1003
+ kind: "rolling";
1004
+ days: number;
1005
+ } | {
1006
+ kind: "calendar";
1007
+ period: "day" | "week" | "month";
1008
+ };
1009
+ kind: "earned";
1010
+ quests?: string[] | undefined;
1011
+ } | {
1012
+ kind: "net";
1013
+ window: {
1014
+ kind: "fixed";
1015
+ start: number;
1016
+ end: number;
1017
+ } | {
1018
+ kind: "all-time";
1019
+ } | {
1020
+ kind: "rolling";
1021
+ days: number;
1022
+ } | {
1023
+ kind: "calendar";
1024
+ period: "day" | "week" | "month";
1025
+ };
1026
+ };
1027
+ access: "participants" | "public";
1028
+ key?: string | undefined;
1029
+ group?: string | undefined;
1030
+ settle?: {
1031
+ at: "window-end";
1032
+ ties: "shared" | "earliest";
1033
+ prizes: {
1034
+ ranks: [number, number];
1035
+ rewards: ({
1036
+ kind: "tier";
1037
+ reward: {
1038
+ id: string;
1039
+ title: string;
1040
+ tiers: {
1041
+ id: string;
1042
+ title: string;
1043
+ }[];
1044
+ inventory: {
1045
+ kind: "untracked";
1046
+ };
1047
+ fulfillment: {
1048
+ kind: "staff-handover";
1049
+ } | {
1050
+ kind: "automatic";
1051
+ };
1052
+ };
1053
+ tier: string;
1054
+ } | {
1055
+ kind: "points";
1056
+ balance: string;
1057
+ amount: number;
1058
+ })[];
1059
+ }[];
1060
+ } | undefined;
1061
+ }[]>;
1062
+ standings: (board: string, query?: LeaderboardQuery, requestOptions?: RelayRequestOptions) => Promise<{
1063
+ leaderboard: string;
1064
+ title: string;
1065
+ version: string;
1066
+ calculation: "balance" | "earned" | "net";
1067
+ period: {
1068
+ start: number | null;
1069
+ end: number | null;
1070
+ };
1071
+ calculatedAt: number;
1072
+ lastEntryAt: number | null;
1073
+ total: number;
1074
+ items: {
1075
+ participant: string;
1076
+ name: string;
1077
+ score: number;
1078
+ rank: number;
1079
+ profile: {
1080
+ id: string;
1081
+ name: string;
1082
+ avatar: {
1083
+ source: "upload";
1084
+ url: string;
1085
+ seed: string;
1086
+ } | {
1087
+ source: "account";
1088
+ provider: "discord" | "google" | "x";
1089
+ url: string;
1090
+ seed: string;
1091
+ } | {
1092
+ source: "generated";
1093
+ seed: string;
1094
+ };
1095
+ } | null;
1096
+ member?: string | undefined;
1097
+ }[];
1098
+ me: {
1099
+ participant: string;
1100
+ name: string;
1101
+ score: number;
1102
+ rank: number;
1103
+ profile: {
1104
+ id: string;
1105
+ name: string;
1106
+ avatar: {
1107
+ source: "upload";
1108
+ url: string;
1109
+ seed: string;
1110
+ } | {
1111
+ source: "account";
1112
+ provider: "discord" | "google" | "x";
1113
+ url: string;
1114
+ seed: string;
598
1115
  } | {
599
1116
  source: "generated";
600
1117
  seed: string;
@@ -616,7 +1133,7 @@ declare function createRelayClient(options: RelayClientOptions): {
616
1133
  seed: string;
617
1134
  } | {
618
1135
  source: "account";
619
- provider: "google" | "x" | "discord";
1136
+ provider: "discord" | "google" | "x";
620
1137
  url: string;
621
1138
  seed: string;
622
1139
  } | {
@@ -659,7 +1176,7 @@ declare function createRelayClient(options: RelayClientOptions): {
659
1176
  seed: string;
660
1177
  } | {
661
1178
  source: "account";
662
- provider: "google" | "x" | "discord";
1179
+ provider: "discord" | "google" | "x";
663
1180
  url: string;
664
1181
  seed: string;
665
1182
  } | {
@@ -668,12 +1185,12 @@ declare function createRelayClient(options: RelayClientOptions): {
668
1185
  };
669
1186
  displayName: string | null;
670
1187
  avatarChoice: "default" | "account" | "upload" | "generated";
671
- avatarProvider: "google" | "x" | "discord" | null;
1188
+ avatarProvider: "discord" | "google" | "x" | null;
672
1189
  hidden: boolean;
673
1190
  locked: boolean;
674
1191
  visibility: "private" | "participants" | "public";
675
1192
  options: {
676
- provider: "google" | "x" | "discord";
1193
+ provider: "discord" | "google" | "x";
677
1194
  name: string | null;
678
1195
  imageUrl: string | null;
679
1196
  }[];
@@ -691,7 +1208,7 @@ declare function createRelayClient(options: RelayClientOptions): {
691
1208
  seed: string;
692
1209
  } | {
693
1210
  source: "account";
694
- provider: "google" | "x" | "discord";
1211
+ provider: "discord" | "google" | "x";
695
1212
  url: string;
696
1213
  seed: string;
697
1214
  } | {
@@ -700,19 +1217,20 @@ declare function createRelayClient(options: RelayClientOptions): {
700
1217
  };
701
1218
  displayName: string | null;
702
1219
  avatarChoice: "default" | "account" | "upload" | "generated";
703
- avatarProvider: "google" | "x" | "discord" | null;
1220
+ avatarProvider: "discord" | "google" | "x" | null;
704
1221
  hidden: boolean;
705
1222
  locked: boolean;
706
1223
  visibility: "private" | "participants" | "public";
707
1224
  options: {
708
- provider: "google" | "x" | "discord";
1225
+ provider: "discord" | "google" | "x";
709
1226
  name: string | null;
710
1227
  imageUrl: string | null;
711
1228
  }[];
712
1229
  }>;
713
1230
  /**
714
1231
  * Uploads a JPEG, PNG or WebP of at most 5 MB as the member's avatar. The server crops it to
715
- * a 512×512 WebP without metadata. Retrying with the same `uploadId` is idempotent.
1232
+ * a 512×512 WebP without metadata. The client never resends it: retrying with the same
1233
+ * `uploadId` and file stores no second picture, but only before another upload replaces it.
716
1234
  */
717
1235
  uploadAvatar: (file: Blob, requestOptions?: RelayRequestOptions & {
718
1236
  uploadId?: string;
@@ -725,7 +1243,7 @@ declare function createRelayClient(options: RelayClientOptions): {
725
1243
  seed: string;
726
1244
  } | {
727
1245
  source: "account";
728
- provider: "google" | "x" | "discord";
1246
+ provider: "discord" | "google" | "x";
729
1247
  url: string;
730
1248
  seed: string;
731
1249
  } | {
@@ -734,12 +1252,12 @@ declare function createRelayClient(options: RelayClientOptions): {
734
1252
  };
735
1253
  displayName: string | null;
736
1254
  avatarChoice: "default" | "account" | "upload" | "generated";
737
- avatarProvider: "google" | "x" | "discord" | null;
1255
+ avatarProvider: "discord" | "google" | "x" | null;
738
1256
  hidden: boolean;
739
1257
  locked: boolean;
740
1258
  visibility: "private" | "participants" | "public";
741
1259
  options: {
742
- provider: "google" | "x" | "discord";
1260
+ provider: "discord" | "google" | "x";
743
1261
  name: string | null;
744
1262
  imageUrl: string | null;
745
1263
  }[];
@@ -757,7 +1275,7 @@ declare function createRelayClient(options: RelayClientOptions): {
757
1275
  seed: string;
758
1276
  } | {
759
1277
  source: "account";
760
- provider: "google" | "x" | "discord";
1278
+ provider: "discord" | "google" | "x";
761
1279
  url: string;
762
1280
  seed: string;
763
1281
  } | {
@@ -820,28 +1338,35 @@ declare function createRelayClient(options: RelayClientOptions): {
820
1338
  } | undefined;
821
1339
  } | undefined;
822
1340
  };
823
- connections: ("google" | "apple" | "x" | "discord")[];
1341
+ connections: ("discord" | "google" | "apple" | "x")[];
824
1342
  trigger: {
1343
+ kind: "manual";
1344
+ input: "text";
1345
+ constraints: {
1346
+ required: boolean;
1347
+ minLength: number;
1348
+ maxLength: number;
1349
+ };
1350
+ actor?: "member" | "staff" | undefined;
1351
+ } | {
1352
+ kind: "manual";
1353
+ input: "url";
1354
+ constraints: {
1355
+ required: boolean;
1356
+ allowedHosts?: string[] | undefined;
1357
+ };
1358
+ actor?: "member" | "staff" | undefined;
1359
+ } | {
1360
+ kind: "manual";
1361
+ input: "none" | "quiz" | "photo";
1362
+ actor?: "member" | "staff" | undefined;
1363
+ } | {
825
1364
  kind: "automatic";
826
- observation?: {
827
- source: string;
828
- type: string;
829
- } | undefined;
830
- content?: {
831
- tracker: string;
832
- window: {
833
- start: number;
834
- end?: number | undefined;
835
- };
836
- enrollment: "required" | "none";
837
- posts: "after-enrollment" | "since-start";
838
- historical: "automatic" | "claim" | "staff";
839
- } | undefined;
840
1365
  tracker?: {
841
1366
  tracker: string;
842
- source: "custom" | "x-search";
1367
+ source: string;
1368
+ on: "new-record" | "new-observation" | "data-changed";
843
1369
  beneficiary: string;
844
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
845
1370
  where?: {
846
1371
  path: string;
847
1372
  gt?: number | {
@@ -877,48 +1402,50 @@ declare function createRelayClient(options: RelayClientOptions): {
877
1402
  path: string;
878
1403
  equals: string | number | boolean;
879
1404
  })[] | undefined;
1405
+ enrollment?: "none" | "required" | undefined;
1406
+ since?: "activation" | "window" | "enrollment" | undefined;
1407
+ historical?: "staff" | "claim" | "automatic" | undefined;
1408
+ content?: true | undefined;
880
1409
  } | undefined;
881
- } | {
882
- kind: "manual";
883
- input: "text";
884
- constraints: {
885
- required: boolean;
886
- minLength: number;
887
- maxLength: number;
888
- };
889
- actor?: "member" | "staff" | undefined;
890
- } | {
891
- kind: "manual";
892
- input: "url";
893
- constraints: {
894
- required: boolean;
895
- allowedHosts?: string[] | undefined;
896
- };
897
- actor?: "member" | "staff" | undefined;
898
- } | {
899
- kind: "manual";
900
- input: "none" | "quiz" | "photo";
901
- actor?: "member" | "staff" | undefined;
902
1410
  };
903
1411
  availability: {
904
1412
  kind: "available";
905
- input: "text" | "url" | "none" | "quiz" | "photo";
1413
+ input: "text" | "none" | "url" | "quiz" | "photo";
906
1414
  } | {
907
1415
  kind: "completed";
908
1416
  } | {
909
1417
  kind: "locked";
910
- missing: {
1418
+ missing: ({
1419
+ kind: "completion";
1420
+ quest: string;
1421
+ title: string;
1422
+ scope: "ever";
1423
+ } | {
1424
+ kind: "completion";
911
1425
  quest: string;
912
1426
  title: string;
913
- }[];
1427
+ scope: "period";
1428
+ period: "day" | "week" | "month";
1429
+ resetsAt: number;
1430
+ } | {
1431
+ kind: "balance";
1432
+ balance: string;
1433
+ title: string;
1434
+ minimum: number;
1435
+ current: number;
1436
+ } | {
1437
+ kind: "group";
1438
+ group: string;
1439
+ title: string;
1440
+ })[];
1441
+ } | {
1442
+ kind: "blocked";
1443
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
1444
+ resetsAt?: number | undefined;
914
1445
  } | {
915
1446
  kind: "staff-required";
916
1447
  } | {
917
1448
  kind: "automatic";
918
- observation?: {
919
- source: string;
920
- type: string;
921
- } | undefined;
922
1449
  } | {
923
1450
  kind: "checking";
924
1451
  attempt: string;
@@ -931,19 +1458,82 @@ declare function createRelayClient(options: RelayClientOptions): {
931
1458
  };
932
1459
  completed: boolean;
933
1460
  completion: {
1461
+ kind: "progress";
1462
+ goal: {
1463
+ kind: "count";
1464
+ count: number;
1465
+ };
1466
+ window: {
1467
+ kind: "lifetime";
1468
+ } | {
1469
+ kind: "calendar";
1470
+ period: "day" | "week" | "month";
1471
+ latenessMs: number;
1472
+ } | {
1473
+ kind: "rolling";
1474
+ durationMs: number;
1475
+ };
1476
+ repeat: "repeat" | "once";
1477
+ } | {
934
1478
  kind: "streak";
935
1479
  days: number;
936
- timeZone: string;
937
1480
  } | {
938
1481
  kind: "once";
939
1482
  } | {
940
1483
  kind: "keyed";
941
1484
  };
1485
+ progress: {
1486
+ current: number;
1487
+ target: number;
1488
+ reason: string;
1489
+ } | null;
942
1490
  completionCount: number;
943
1491
  visibility: "visible" | "hidden";
944
- missing: {
1492
+ missing: ({
1493
+ kind: "completion";
1494
+ quest: string;
1495
+ title: string;
1496
+ scope: "ever";
1497
+ } | {
1498
+ kind: "completion";
945
1499
  quest: string;
946
1500
  title: string;
1501
+ scope: "period";
1502
+ period: "day" | "week" | "month";
1503
+ resetsAt: number;
1504
+ } | {
1505
+ kind: "balance";
1506
+ balance: string;
1507
+ title: string;
1508
+ minimum: number;
1509
+ current: number;
1510
+ } | {
1511
+ kind: "group";
1512
+ group: string;
1513
+ title: string;
1514
+ })[];
1515
+ campaign: {
1516
+ key: string;
1517
+ title: string;
1518
+ enrollment: "none" | "required";
1519
+ enrolledAt: number | null;
1520
+ withdrawnAt: number | null;
1521
+ withdrawalReason: string | null;
1522
+ window?: {
1523
+ from: number;
1524
+ until: number;
1525
+ } | undefined;
1526
+ } | null;
1527
+ window: {
1528
+ from: number;
1529
+ until: number;
1530
+ } | null;
1531
+ budgets: {
1532
+ id: string;
1533
+ scope: "member" | "project";
1534
+ period: "lifetime" | "day" | "week" | "month";
1535
+ remaining: number;
1536
+ resetsAt: number | null;
947
1537
  }[];
948
1538
  attempt: {
949
1539
  id: string;
@@ -951,7 +1541,7 @@ declare function createRelayClient(options: RelayClientOptions): {
951
1541
  quest: string;
952
1542
  member: string;
953
1543
  evidence: string | null;
954
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
1544
+ status: AttemptStatus;
955
1545
  reason: string | null;
956
1546
  retries: number;
957
1547
  generation: number;
@@ -970,19 +1560,31 @@ declare function createRelayClient(options: RelayClientOptions): {
970
1560
  };
971
1561
  fulfillment: {
972
1562
  kind: "staff-handover";
1563
+ } | {
1564
+ kind: "automatic";
973
1565
  };
974
1566
  };
975
1567
  tier: string;
976
- } | {
977
- kind: "points";
978
- balance: string;
979
- amount: number;
980
1568
  } | {
981
1569
  kind: "integration";
982
1570
  provider: "discord";
983
1571
  action: "grant-role";
984
1572
  roleId: string;
1573
+ } | {
1574
+ kind: "points";
1575
+ balance: string;
1576
+ amount: number;
985
1577
  })[] | null;
1578
+ evaluationRun: number;
1579
+ deferCount: number;
1580
+ deferUntil: number | null;
1581
+ nextEvaluationAt: number | null;
1582
+ code: string | null;
1583
+ progress: {
1584
+ current: number;
1585
+ target: number;
1586
+ reason: string;
1587
+ } | null;
986
1588
  requestedReview: boolean;
987
1589
  createdAt: number;
988
1590
  input?: {
@@ -1000,7 +1602,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1000
1602
  } | undefined;
1001
1603
  } | null;
1002
1604
  release: string;
1003
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
1605
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1004
1606
  lifecycle: "paused" | "active" | "archived";
1005
1607
  rewards: ({
1006
1608
  kind: "points";
@@ -1012,106 +1614,356 @@ declare function createRelayClient(options: RelayClientOptions): {
1012
1614
  name: string;
1013
1615
  };
1014
1616
  } | {
1015
- kind: "tier";
1016
- label: string;
1617
+ kind: "tier";
1618
+ label: string;
1619
+ reward: {
1620
+ id: string;
1621
+ key: string | null;
1622
+ title: string;
1623
+ };
1624
+ tier: string;
1625
+ } | {
1626
+ kind: "integration";
1627
+ label: string;
1628
+ })[];
1629
+ key?: string | undefined;
1630
+ streak?: {
1631
+ goal: number;
1632
+ current: number;
1633
+ best: number;
1634
+ today: string;
1635
+ todayQualified: boolean;
1636
+ timeZone: string;
1637
+ nextBoundary: number;
1638
+ pendingTimeZone: {
1639
+ timeZone: string;
1640
+ effectiveAt: number;
1641
+ } | null;
1642
+ days: {
1643
+ day: number;
1644
+ date: string;
1645
+ timeZone: string;
1646
+ occurredAt: number;
1647
+ }[];
1648
+ milestone: {
1649
+ status: "pending";
1650
+ } | {
1651
+ status: "awarded";
1652
+ completion: string;
1653
+ achievedAt: number;
1654
+ } | {
1655
+ status: "budget-exhausted";
1656
+ budget: string;
1657
+ achievedAt: number;
1658
+ };
1659
+ } | null | undefined;
1660
+ counter?: {
1661
+ goal: number;
1662
+ current: number;
1663
+ window: {
1664
+ key: string;
1665
+ start: number | null;
1666
+ end: number | null;
1667
+ };
1668
+ repeat: "repeat" | "once";
1669
+ settled: number;
1670
+ latest: {
1671
+ id: string;
1672
+ ordinal: number;
1673
+ achievedAt: number;
1674
+ window: string;
1675
+ status: "revoked";
1676
+ completion: string;
1677
+ revokedAt: number;
1678
+ } | {
1679
+ id: string;
1680
+ ordinal: number;
1681
+ achievedAt: number;
1682
+ window: string;
1683
+ status: "awarded";
1684
+ completion: string;
1685
+ } | {
1686
+ id: string;
1687
+ ordinal: number;
1688
+ achievedAt: number;
1689
+ window: string;
1690
+ status: "budget-exhausted";
1691
+ budget: string;
1692
+ } | null;
1693
+ } | null | undefined;
1694
+ }>;
1695
+ /**
1696
+ * Enrolls the signed-in member in a quest whose tracker trigger requires enrollment. Activity
1697
+ * counts from then on; earlier activity is historical, or skipped with `before-enrollment`
1698
+ * on a quest that counts from enrollment. Enrolling again returns the first enrollment.
1699
+ */
1700
+ enroll: (value: QuestEnrollmentInput, requestOptions?: RelayRequestOptions) => Promise<{
1701
+ quest: string;
1702
+ member: string;
1703
+ enrolledAt: number;
1704
+ }>;
1705
+ /**
1706
+ * Claims one of the signed-in member's outcomes skipped as `historical`, on a quest whose
1707
+ * historical policy is `"claim"` (`outcome.claimable`). Relay decides it again with
1708
+ * historical activity released and returns the outcome; a rule that still fails rejects
1709
+ * with a `RelayError` whose code is that rule's skip code.
1710
+ */
1711
+ claim: (value: QuestClaimInput, requestOptions?: RelayRequestOptions) => Promise<{
1712
+ quest: string;
1713
+ tracker: string | null;
1714
+ record: string | null;
1715
+ observedAt: number | null;
1716
+ state: "admitted" | "skipped";
1717
+ code: TrackerSkipCode | null;
1718
+ reason: string | null;
1719
+ attempt: string | null;
1720
+ claimable: boolean;
1721
+ createdAt: number;
1722
+ updatedAt: number;
1723
+ automatic?: string | undefined;
1724
+ }>;
1725
+ /**
1726
+ * Why automatic quests did or did not run for the signed-in member's activity, newest first:
1727
+ * each admission, and each skip with its stable code.
1728
+ */
1729
+ outcomes: (query?: QuestOutcomeQuery, requestOptions?: RelayRequestOptions) => Promise<{
1730
+ items: {
1731
+ quest: string;
1732
+ tracker: string | null;
1733
+ record: string | null;
1734
+ observedAt: number | null;
1735
+ state: "admitted" | "skipped";
1736
+ code: TrackerSkipCode | null;
1737
+ reason: string | null;
1738
+ attempt: string | null;
1739
+ claimable: boolean;
1740
+ createdAt: number;
1741
+ updatedAt: number;
1742
+ automatic?: string | undefined;
1743
+ }[];
1744
+ nextCursor: string | null;
1745
+ }>;
1746
+ /** Retries verification of the quest's failed attempt. */
1747
+ retry: (view: QuestView, requestOptions?: RelayRequestOptions) => Promise<{
1748
+ id: string;
1749
+ release: string;
1750
+ quest: string;
1751
+ member: string;
1752
+ evidence: string | null;
1753
+ status: AttemptStatus;
1754
+ reason: string | null;
1755
+ retries: number;
1756
+ generation: number;
1757
+ completion: string | null;
1758
+ reviewRewards: ({
1759
+ kind: "tier";
1760
+ reward: {
1761
+ id: string;
1762
+ title: string;
1763
+ tiers: {
1764
+ id: string;
1765
+ title: string;
1766
+ }[];
1767
+ inventory: {
1768
+ kind: "untracked";
1769
+ };
1770
+ fulfillment: {
1771
+ kind: "staff-handover";
1772
+ } | {
1773
+ kind: "automatic";
1774
+ };
1775
+ };
1776
+ tier: string;
1777
+ } | {
1778
+ kind: "integration";
1779
+ provider: "discord";
1780
+ action: "grant-role";
1781
+ roleId: string;
1782
+ } | {
1783
+ kind: "points";
1784
+ balance: string;
1785
+ amount: number;
1786
+ })[] | null;
1787
+ evaluationRun: number;
1788
+ deferCount: number;
1789
+ deferUntil: number | null;
1790
+ nextEvaluationAt: number | null;
1791
+ code: string | null;
1792
+ progress: {
1793
+ current: number;
1794
+ target: number;
1795
+ reason: string;
1796
+ } | null;
1797
+ requestedReview: boolean;
1798
+ createdAt: number;
1799
+ input?: {
1800
+ kind: "text";
1801
+ value: string;
1802
+ } | {
1803
+ kind: "url";
1804
+ value: string;
1805
+ } | {
1806
+ kind: "quiz";
1807
+ answers: {
1808
+ [k: string]: string;
1809
+ };
1810
+ release?: string | undefined;
1811
+ } | undefined;
1812
+ }>;
1813
+ experience: (requestOptions?: RelayRequestOptions) => Promise<{
1814
+ entitlements: ({
1815
+ [x: string]: unknown;
1816
+ status: "available";
1817
+ id: string;
1818
+ member: string;
1819
+ reward: {
1820
+ [x: string]: unknown;
1821
+ id: string;
1822
+ title: string;
1823
+ tiers: {
1824
+ [x: string]: unknown;
1825
+ id: string;
1826
+ title: string;
1827
+ }[];
1828
+ inventory: {
1829
+ [x: string]: unknown;
1830
+ kind: string;
1831
+ };
1832
+ fulfillment: {
1833
+ [x: string]: unknown;
1834
+ kind: string;
1835
+ };
1836
+ };
1837
+ earnedTier: string;
1838
+ tier: string;
1839
+ revision: number;
1840
+ } | {
1841
+ [x: string]: unknown;
1842
+ status: "handing-over";
1843
+ handover: string;
1844
+ startedAt: number;
1845
+ id: string;
1846
+ member: string;
1847
+ reward: {
1848
+ [x: string]: unknown;
1849
+ id: string;
1850
+ title: string;
1851
+ tiers: {
1852
+ [x: string]: unknown;
1853
+ id: string;
1854
+ title: string;
1855
+ }[];
1856
+ inventory: {
1857
+ [x: string]: unknown;
1858
+ kind: string;
1859
+ };
1860
+ fulfillment: {
1861
+ [x: string]: unknown;
1862
+ kind: string;
1863
+ };
1864
+ };
1865
+ earnedTier: string;
1866
+ tier: string;
1867
+ revision: number;
1868
+ allocation?: {
1869
+ [x: string]: unknown;
1870
+ item: string;
1871
+ label: string;
1872
+ } | undefined;
1873
+ } | {
1874
+ [x: string]: unknown;
1875
+ status: "collected";
1876
+ handover: string;
1877
+ startedAt: number;
1878
+ collectedAt: number;
1879
+ id: string;
1880
+ member: string;
1881
+ reward: {
1882
+ [x: string]: unknown;
1883
+ id: string;
1884
+ title: string;
1885
+ tiers: {
1886
+ [x: string]: unknown;
1887
+ id: string;
1888
+ title: string;
1889
+ }[];
1890
+ inventory: {
1891
+ [x: string]: unknown;
1892
+ kind: string;
1893
+ };
1894
+ fulfillment: {
1895
+ [x: string]: unknown;
1896
+ kind: string;
1897
+ };
1898
+ };
1899
+ earnedTier: string;
1900
+ tier: string;
1901
+ revision: number;
1902
+ allocation?: {
1903
+ [x: string]: unknown;
1904
+ item: string;
1905
+ label: string;
1906
+ } | undefined;
1907
+ recovery?: {
1908
+ completion: string;
1909
+ reason: string;
1910
+ flaggedAt: number;
1911
+ remainingTier: string | null;
1912
+ } | undefined;
1913
+ } | {
1914
+ [x: string]: unknown;
1915
+ status: "void";
1916
+ voidedAt: number;
1917
+ id: string;
1918
+ member: string;
1017
1919
  reward: {
1920
+ [x: string]: unknown;
1018
1921
  id: string;
1019
- key: string | null;
1020
1922
  title: string;
1923
+ tiers: {
1924
+ [x: string]: unknown;
1925
+ id: string;
1926
+ title: string;
1927
+ }[];
1928
+ inventory: {
1929
+ [x: string]: unknown;
1930
+ kind: string;
1931
+ };
1932
+ fulfillment: {
1933
+ [x: string]: unknown;
1934
+ kind: string;
1935
+ };
1021
1936
  };
1937
+ earnedTier: string;
1022
1938
  tier: string;
1939
+ revision: number;
1023
1940
  } | {
1024
- kind: "integration";
1025
- label: string;
1026
- })[];
1027
- key?: string | undefined;
1028
- streak?: {
1029
- goal: number;
1030
- current: number;
1031
- best: number;
1032
- today: string;
1033
- todayQualified: boolean;
1034
- timeZone: string;
1035
- nextBoundary: number;
1036
- pendingTimeZone: {
1037
- timeZone: string;
1038
- effectiveAt: number;
1039
- } | null;
1040
- days: {
1041
- day: number;
1042
- date: string;
1043
- timeZone: string;
1044
- occurredAt: number;
1045
- }[];
1046
- milestone: {
1047
- status: "pending";
1048
- } | {
1049
- status: "awarded";
1050
- completion: string;
1051
- achievedAt: number;
1052
- } | {
1053
- status: "budget-exhausted";
1054
- budget: string;
1055
- achievedAt: number;
1056
- };
1057
- } | null | undefined;
1058
- }>;
1059
- /** Retries verification of the quest's failed attempt. */
1060
- retry: (view: QuestView, requestOptions?: RelayRequestOptions) => Promise<{
1061
- id: string;
1062
- release: string;
1063
- quest: string;
1064
- member: string;
1065
- evidence: string | null;
1066
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
1067
- reason: string | null;
1068
- retries: number;
1069
- generation: number;
1070
- completion: string | null;
1071
- reviewRewards: ({
1072
- kind: "tier";
1941
+ status: "unsupported";
1942
+ reportedStatus: string;
1943
+ id: string;
1944
+ member: string;
1073
1945
  reward: {
1946
+ [x: string]: unknown;
1074
1947
  id: string;
1075
1948
  title: string;
1076
1949
  tiers: {
1950
+ [x: string]: unknown;
1077
1951
  id: string;
1078
1952
  title: string;
1079
1953
  }[];
1080
1954
  inventory: {
1081
- kind: "untracked";
1955
+ [x: string]: unknown;
1956
+ kind: string;
1082
1957
  };
1083
1958
  fulfillment: {
1084
- kind: "staff-handover";
1959
+ [x: string]: unknown;
1960
+ kind: string;
1085
1961
  };
1086
1962
  };
1963
+ earnedTier: string;
1087
1964
  tier: string;
1088
- } | {
1089
- kind: "points";
1090
- balance: string;
1091
- amount: number;
1092
- } | {
1093
- kind: "integration";
1094
- provider: "discord";
1095
- action: "grant-role";
1096
- roleId: string;
1097
- })[] | null;
1098
- requestedReview: boolean;
1099
- createdAt: number;
1100
- input?: {
1101
- kind: "text";
1102
- value: string;
1103
- } | {
1104
- kind: "url";
1105
- value: string;
1106
- } | {
1107
- kind: "quiz";
1108
- answers: {
1109
- [k: string]: string;
1110
- };
1111
- release?: string | undefined;
1112
- } | undefined;
1113
- }>;
1114
- experience: (requestOptions?: RelayRequestOptions) => Promise<{
1965
+ revision: number;
1966
+ })[];
1115
1967
  member: string;
1116
1968
  quests: {
1117
1969
  quest: string;
@@ -1136,28 +1988,35 @@ declare function createRelayClient(options: RelayClientOptions): {
1136
1988
  } | undefined;
1137
1989
  } | undefined;
1138
1990
  };
1139
- connections: ("google" | "apple" | "x" | "discord")[];
1991
+ connections: ("discord" | "google" | "apple" | "x")[];
1140
1992
  trigger: {
1993
+ kind: "manual";
1994
+ input: "text";
1995
+ constraints: {
1996
+ required: boolean;
1997
+ minLength: number;
1998
+ maxLength: number;
1999
+ };
2000
+ actor?: "member" | "staff" | undefined;
2001
+ } | {
2002
+ kind: "manual";
2003
+ input: "url";
2004
+ constraints: {
2005
+ required: boolean;
2006
+ allowedHosts?: string[] | undefined;
2007
+ };
2008
+ actor?: "member" | "staff" | undefined;
2009
+ } | {
2010
+ kind: "manual";
2011
+ input: "none" | "quiz" | "photo";
2012
+ actor?: "member" | "staff" | undefined;
2013
+ } | {
1141
2014
  kind: "automatic";
1142
- observation?: {
1143
- source: string;
1144
- type: string;
1145
- } | undefined;
1146
- content?: {
1147
- tracker: string;
1148
- window: {
1149
- start: number;
1150
- end?: number | undefined;
1151
- };
1152
- enrollment: "required" | "none";
1153
- posts: "after-enrollment" | "since-start";
1154
- historical: "automatic" | "claim" | "staff";
1155
- } | undefined;
1156
2015
  tracker?: {
1157
2016
  tracker: string;
1158
- source: "custom" | "x-search";
2017
+ source: string;
2018
+ on: "new-record" | "new-observation" | "data-changed";
1159
2019
  beneficiary: string;
1160
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
1161
2020
  where?: {
1162
2021
  path: string;
1163
2022
  gt?: number | {
@@ -1193,48 +2052,50 @@ declare function createRelayClient(options: RelayClientOptions): {
1193
2052
  path: string;
1194
2053
  equals: string | number | boolean;
1195
2054
  })[] | undefined;
2055
+ enrollment?: "none" | "required" | undefined;
2056
+ since?: "activation" | "window" | "enrollment" | undefined;
2057
+ historical?: "staff" | "claim" | "automatic" | undefined;
2058
+ content?: true | undefined;
1196
2059
  } | undefined;
1197
- } | {
1198
- kind: "manual";
1199
- input: "text";
1200
- constraints: {
1201
- required: boolean;
1202
- minLength: number;
1203
- maxLength: number;
1204
- };
1205
- actor?: "member" | "staff" | undefined;
1206
- } | {
1207
- kind: "manual";
1208
- input: "url";
1209
- constraints: {
1210
- required: boolean;
1211
- allowedHosts?: string[] | undefined;
1212
- };
1213
- actor?: "member" | "staff" | undefined;
1214
- } | {
1215
- kind: "manual";
1216
- input: "none" | "quiz" | "photo";
1217
- actor?: "member" | "staff" | undefined;
1218
2060
  };
1219
2061
  availability: {
1220
2062
  kind: "available";
1221
- input: "text" | "url" | "none" | "quiz" | "photo";
2063
+ input: "text" | "none" | "url" | "quiz" | "photo";
1222
2064
  } | {
1223
2065
  kind: "completed";
1224
2066
  } | {
1225
2067
  kind: "locked";
1226
- missing: {
2068
+ missing: ({
2069
+ kind: "completion";
1227
2070
  quest: string;
1228
2071
  title: string;
1229
- }[];
2072
+ scope: "ever";
2073
+ } | {
2074
+ kind: "completion";
2075
+ quest: string;
2076
+ title: string;
2077
+ scope: "period";
2078
+ period: "day" | "week" | "month";
2079
+ resetsAt: number;
2080
+ } | {
2081
+ kind: "balance";
2082
+ balance: string;
2083
+ title: string;
2084
+ minimum: number;
2085
+ current: number;
2086
+ } | {
2087
+ kind: "group";
2088
+ group: string;
2089
+ title: string;
2090
+ })[];
2091
+ } | {
2092
+ kind: "blocked";
2093
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
2094
+ resetsAt?: number | undefined;
1230
2095
  } | {
1231
2096
  kind: "staff-required";
1232
2097
  } | {
1233
2098
  kind: "automatic";
1234
- observation?: {
1235
- source: string;
1236
- type: string;
1237
- } | undefined;
1238
2099
  } | {
1239
2100
  kind: "checking";
1240
2101
  attempt: string;
@@ -1247,19 +2108,82 @@ declare function createRelayClient(options: RelayClientOptions): {
1247
2108
  };
1248
2109
  completed: boolean;
1249
2110
  completion: {
2111
+ kind: "progress";
2112
+ goal: {
2113
+ kind: "count";
2114
+ count: number;
2115
+ };
2116
+ window: {
2117
+ kind: "lifetime";
2118
+ } | {
2119
+ kind: "calendar";
2120
+ period: "day" | "week" | "month";
2121
+ latenessMs: number;
2122
+ } | {
2123
+ kind: "rolling";
2124
+ durationMs: number;
2125
+ };
2126
+ repeat: "repeat" | "once";
2127
+ } | {
1250
2128
  kind: "streak";
1251
2129
  days: number;
1252
- timeZone: string;
1253
2130
  } | {
1254
2131
  kind: "once";
1255
2132
  } | {
1256
2133
  kind: "keyed";
1257
2134
  };
2135
+ progress: {
2136
+ current: number;
2137
+ target: number;
2138
+ reason: string;
2139
+ } | null;
1258
2140
  completionCount: number;
1259
2141
  visibility: "visible" | "hidden";
1260
- missing: {
2142
+ missing: ({
2143
+ kind: "completion";
2144
+ quest: string;
2145
+ title: string;
2146
+ scope: "ever";
2147
+ } | {
2148
+ kind: "completion";
1261
2149
  quest: string;
1262
2150
  title: string;
2151
+ scope: "period";
2152
+ period: "day" | "week" | "month";
2153
+ resetsAt: number;
2154
+ } | {
2155
+ kind: "balance";
2156
+ balance: string;
2157
+ title: string;
2158
+ minimum: number;
2159
+ current: number;
2160
+ } | {
2161
+ kind: "group";
2162
+ group: string;
2163
+ title: string;
2164
+ })[];
2165
+ campaign: {
2166
+ key: string;
2167
+ title: string;
2168
+ enrollment: "none" | "required";
2169
+ enrolledAt: number | null;
2170
+ withdrawnAt: number | null;
2171
+ withdrawalReason: string | null;
2172
+ window?: {
2173
+ from: number;
2174
+ until: number;
2175
+ } | undefined;
2176
+ } | null;
2177
+ window: {
2178
+ from: number;
2179
+ until: number;
2180
+ } | null;
2181
+ budgets: {
2182
+ id: string;
2183
+ scope: "member" | "project";
2184
+ period: "lifetime" | "day" | "week" | "month";
2185
+ remaining: number;
2186
+ resetsAt: number | null;
1263
2187
  }[];
1264
2188
  attempt: {
1265
2189
  id: string;
@@ -1267,7 +2191,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1267
2191
  quest: string;
1268
2192
  member: string;
1269
2193
  evidence: string | null;
1270
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
2194
+ status: AttemptStatus;
1271
2195
  reason: string | null;
1272
2196
  retries: number;
1273
2197
  generation: number;
@@ -1286,19 +2210,31 @@ declare function createRelayClient(options: RelayClientOptions): {
1286
2210
  };
1287
2211
  fulfillment: {
1288
2212
  kind: "staff-handover";
2213
+ } | {
2214
+ kind: "automatic";
1289
2215
  };
1290
2216
  };
1291
2217
  tier: string;
1292
- } | {
1293
- kind: "points";
1294
- balance: string;
1295
- amount: number;
1296
2218
  } | {
1297
2219
  kind: "integration";
1298
2220
  provider: "discord";
1299
2221
  action: "grant-role";
1300
2222
  roleId: string;
2223
+ } | {
2224
+ kind: "points";
2225
+ balance: string;
2226
+ amount: number;
1301
2227
  })[] | null;
2228
+ evaluationRun: number;
2229
+ deferCount: number;
2230
+ deferUntil: number | null;
2231
+ nextEvaluationAt: number | null;
2232
+ code: string | null;
2233
+ progress: {
2234
+ current: number;
2235
+ target: number;
2236
+ reason: string;
2237
+ } | null;
1302
2238
  requestedReview: boolean;
1303
2239
  createdAt: number;
1304
2240
  input?: {
@@ -1316,7 +2252,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1316
2252
  } | undefined;
1317
2253
  } | null;
1318
2254
  release: string;
1319
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
2255
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1320
2256
  lifecycle: "paused" | "active" | "archived";
1321
2257
  rewards: ({
1322
2258
  kind: "points";
@@ -1371,6 +2307,40 @@ declare function createRelayClient(options: RelayClientOptions): {
1371
2307
  achievedAt: number;
1372
2308
  };
1373
2309
  } | null | undefined;
2310
+ counter?: {
2311
+ goal: number;
2312
+ current: number;
2313
+ window: {
2314
+ key: string;
2315
+ start: number | null;
2316
+ end: number | null;
2317
+ };
2318
+ repeat: "repeat" | "once";
2319
+ settled: number;
2320
+ latest: {
2321
+ id: string;
2322
+ ordinal: number;
2323
+ achievedAt: number;
2324
+ window: string;
2325
+ status: "revoked";
2326
+ completion: string;
2327
+ revokedAt: number;
2328
+ } | {
2329
+ id: string;
2330
+ ordinal: number;
2331
+ achievedAt: number;
2332
+ window: string;
2333
+ status: "awarded";
2334
+ completion: string;
2335
+ } | {
2336
+ id: string;
2337
+ ordinal: number;
2338
+ achievedAt: number;
2339
+ window: string;
2340
+ status: "budget-exhausted";
2341
+ budget: string;
2342
+ } | null;
2343
+ } | null | undefined;
1374
2344
  }[];
1375
2345
  collections: {
1376
2346
  id: string;
@@ -1398,28 +2368,35 @@ declare function createRelayClient(options: RelayClientOptions): {
1398
2368
  } | undefined;
1399
2369
  } | undefined;
1400
2370
  };
1401
- connections: ("google" | "apple" | "x" | "discord")[];
2371
+ connections: ("discord" | "google" | "apple" | "x")[];
1402
2372
  trigger: {
2373
+ kind: "manual";
2374
+ input: "text";
2375
+ constraints: {
2376
+ required: boolean;
2377
+ minLength: number;
2378
+ maxLength: number;
2379
+ };
2380
+ actor?: "member" | "staff" | undefined;
2381
+ } | {
2382
+ kind: "manual";
2383
+ input: "url";
2384
+ constraints: {
2385
+ required: boolean;
2386
+ allowedHosts?: string[] | undefined;
2387
+ };
2388
+ actor?: "member" | "staff" | undefined;
2389
+ } | {
2390
+ kind: "manual";
2391
+ input: "none" | "quiz" | "photo";
2392
+ actor?: "member" | "staff" | undefined;
2393
+ } | {
1403
2394
  kind: "automatic";
1404
- observation?: {
1405
- source: string;
1406
- type: string;
1407
- } | undefined;
1408
- content?: {
1409
- tracker: string;
1410
- window: {
1411
- start: number;
1412
- end?: number | undefined;
1413
- };
1414
- enrollment: "required" | "none";
1415
- posts: "after-enrollment" | "since-start";
1416
- historical: "automatic" | "claim" | "staff";
1417
- } | undefined;
1418
2395
  tracker?: {
1419
2396
  tracker: string;
1420
- source: "custom" | "x-search";
2397
+ source: string;
2398
+ on: "new-record" | "new-observation" | "data-changed";
1421
2399
  beneficiary: string;
1422
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
1423
2400
  where?: {
1424
2401
  path: string;
1425
2402
  gt?: number | {
@@ -1455,48 +2432,50 @@ declare function createRelayClient(options: RelayClientOptions): {
1455
2432
  path: string;
1456
2433
  equals: string | number | boolean;
1457
2434
  })[] | undefined;
2435
+ enrollment?: "none" | "required" | undefined;
2436
+ since?: "activation" | "window" | "enrollment" | undefined;
2437
+ historical?: "staff" | "claim" | "automatic" | undefined;
2438
+ content?: true | undefined;
1458
2439
  } | undefined;
1459
- } | {
1460
- kind: "manual";
1461
- input: "text";
1462
- constraints: {
1463
- required: boolean;
1464
- minLength: number;
1465
- maxLength: number;
1466
- };
1467
- actor?: "member" | "staff" | undefined;
1468
- } | {
1469
- kind: "manual";
1470
- input: "url";
1471
- constraints: {
1472
- required: boolean;
1473
- allowedHosts?: string[] | undefined;
1474
- };
1475
- actor?: "member" | "staff" | undefined;
1476
- } | {
1477
- kind: "manual";
1478
- input: "none" | "quiz" | "photo";
1479
- actor?: "member" | "staff" | undefined;
1480
2440
  };
1481
2441
  availability: {
1482
2442
  kind: "available";
1483
- input: "text" | "url" | "none" | "quiz" | "photo";
2443
+ input: "text" | "none" | "url" | "quiz" | "photo";
1484
2444
  } | {
1485
2445
  kind: "completed";
1486
2446
  } | {
1487
2447
  kind: "locked";
1488
- missing: {
2448
+ missing: ({
2449
+ kind: "completion";
1489
2450
  quest: string;
1490
2451
  title: string;
1491
- }[];
2452
+ scope: "ever";
2453
+ } | {
2454
+ kind: "completion";
2455
+ quest: string;
2456
+ title: string;
2457
+ scope: "period";
2458
+ period: "day" | "week" | "month";
2459
+ resetsAt: number;
2460
+ } | {
2461
+ kind: "balance";
2462
+ balance: string;
2463
+ title: string;
2464
+ minimum: number;
2465
+ current: number;
2466
+ } | {
2467
+ kind: "group";
2468
+ group: string;
2469
+ title: string;
2470
+ })[];
2471
+ } | {
2472
+ kind: "blocked";
2473
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
2474
+ resetsAt?: number | undefined;
1492
2475
  } | {
1493
2476
  kind: "staff-required";
1494
2477
  } | {
1495
2478
  kind: "automatic";
1496
- observation?: {
1497
- source: string;
1498
- type: string;
1499
- } | undefined;
1500
2479
  } | {
1501
2480
  kind: "checking";
1502
2481
  attempt: string;
@@ -1509,19 +2488,82 @@ declare function createRelayClient(options: RelayClientOptions): {
1509
2488
  };
1510
2489
  completed: boolean;
1511
2490
  completion: {
2491
+ kind: "progress";
2492
+ goal: {
2493
+ kind: "count";
2494
+ count: number;
2495
+ };
2496
+ window: {
2497
+ kind: "lifetime";
2498
+ } | {
2499
+ kind: "calendar";
2500
+ period: "day" | "week" | "month";
2501
+ latenessMs: number;
2502
+ } | {
2503
+ kind: "rolling";
2504
+ durationMs: number;
2505
+ };
2506
+ repeat: "repeat" | "once";
2507
+ } | {
1512
2508
  kind: "streak";
1513
2509
  days: number;
1514
- timeZone: string;
1515
2510
  } | {
1516
2511
  kind: "once";
1517
2512
  } | {
1518
2513
  kind: "keyed";
1519
2514
  };
2515
+ progress: {
2516
+ current: number;
2517
+ target: number;
2518
+ reason: string;
2519
+ } | null;
1520
2520
  completionCount: number;
1521
2521
  visibility: "visible" | "hidden";
1522
- missing: {
2522
+ missing: ({
2523
+ kind: "completion";
2524
+ quest: string;
2525
+ title: string;
2526
+ scope: "ever";
2527
+ } | {
2528
+ kind: "completion";
1523
2529
  quest: string;
1524
2530
  title: string;
2531
+ scope: "period";
2532
+ period: "day" | "week" | "month";
2533
+ resetsAt: number;
2534
+ } | {
2535
+ kind: "balance";
2536
+ balance: string;
2537
+ title: string;
2538
+ minimum: number;
2539
+ current: number;
2540
+ } | {
2541
+ kind: "group";
2542
+ group: string;
2543
+ title: string;
2544
+ })[];
2545
+ campaign: {
2546
+ key: string;
2547
+ title: string;
2548
+ enrollment: "none" | "required";
2549
+ enrolledAt: number | null;
2550
+ withdrawnAt: number | null;
2551
+ withdrawalReason: string | null;
2552
+ window?: {
2553
+ from: number;
2554
+ until: number;
2555
+ } | undefined;
2556
+ } | null;
2557
+ window: {
2558
+ from: number;
2559
+ until: number;
2560
+ } | null;
2561
+ budgets: {
2562
+ id: string;
2563
+ scope: "member" | "project";
2564
+ period: "lifetime" | "day" | "week" | "month";
2565
+ remaining: number;
2566
+ resetsAt: number | null;
1525
2567
  }[];
1526
2568
  attempt: {
1527
2569
  id: string;
@@ -1529,7 +2571,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1529
2571
  quest: string;
1530
2572
  member: string;
1531
2573
  evidence: string | null;
1532
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
2574
+ status: AttemptStatus;
1533
2575
  reason: string | null;
1534
2576
  retries: number;
1535
2577
  generation: number;
@@ -1548,19 +2590,31 @@ declare function createRelayClient(options: RelayClientOptions): {
1548
2590
  };
1549
2591
  fulfillment: {
1550
2592
  kind: "staff-handover";
2593
+ } | {
2594
+ kind: "automatic";
1551
2595
  };
1552
2596
  };
1553
2597
  tier: string;
1554
- } | {
1555
- kind: "points";
1556
- balance: string;
1557
- amount: number;
1558
2598
  } | {
1559
2599
  kind: "integration";
1560
2600
  provider: "discord";
1561
2601
  action: "grant-role";
1562
2602
  roleId: string;
2603
+ } | {
2604
+ kind: "points";
2605
+ balance: string;
2606
+ amount: number;
1563
2607
  })[] | null;
2608
+ evaluationRun: number;
2609
+ deferCount: number;
2610
+ deferUntil: number | null;
2611
+ nextEvaluationAt: number | null;
2612
+ code: string | null;
2613
+ progress: {
2614
+ current: number;
2615
+ target: number;
2616
+ reason: string;
2617
+ } | null;
1564
2618
  requestedReview: boolean;
1565
2619
  createdAt: number;
1566
2620
  input?: {
@@ -1578,7 +2632,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1578
2632
  } | undefined;
1579
2633
  } | null;
1580
2634
  release: string;
1581
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
2635
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1582
2636
  lifecycle: "paused" | "active" | "archived";
1583
2637
  rewards: ({
1584
2638
  kind: "points";
@@ -1633,6 +2687,40 @@ declare function createRelayClient(options: RelayClientOptions): {
1633
2687
  achievedAt: number;
1634
2688
  };
1635
2689
  } | null | undefined;
2690
+ counter?: {
2691
+ goal: number;
2692
+ current: number;
2693
+ window: {
2694
+ key: string;
2695
+ start: number | null;
2696
+ end: number | null;
2697
+ };
2698
+ repeat: "repeat" | "once";
2699
+ settled: number;
2700
+ latest: {
2701
+ id: string;
2702
+ ordinal: number;
2703
+ achievedAt: number;
2704
+ window: string;
2705
+ status: "revoked";
2706
+ completion: string;
2707
+ revokedAt: number;
2708
+ } | {
2709
+ id: string;
2710
+ ordinal: number;
2711
+ achievedAt: number;
2712
+ window: string;
2713
+ status: "awarded";
2714
+ completion: string;
2715
+ } | {
2716
+ id: string;
2717
+ ordinal: number;
2718
+ achievedAt: number;
2719
+ window: string;
2720
+ status: "budget-exhausted";
2721
+ budget: string;
2722
+ } | null;
2723
+ } | null | undefined;
1636
2724
  }[];
1637
2725
  key?: string | undefined;
1638
2726
  }[];
@@ -1663,28 +2751,35 @@ declare function createRelayClient(options: RelayClientOptions): {
1663
2751
  } | undefined;
1664
2752
  } | undefined;
1665
2753
  };
1666
- connections: ("google" | "apple" | "x" | "discord")[];
2754
+ connections: ("discord" | "google" | "apple" | "x")[];
1667
2755
  trigger: {
2756
+ kind: "manual";
2757
+ input: "text";
2758
+ constraints: {
2759
+ required: boolean;
2760
+ minLength: number;
2761
+ maxLength: number;
2762
+ };
2763
+ actor?: "member" | "staff" | undefined;
2764
+ } | {
2765
+ kind: "manual";
2766
+ input: "url";
2767
+ constraints: {
2768
+ required: boolean;
2769
+ allowedHosts?: string[] | undefined;
2770
+ };
2771
+ actor?: "member" | "staff" | undefined;
2772
+ } | {
2773
+ kind: "manual";
2774
+ input: "none" | "quiz" | "photo";
2775
+ actor?: "member" | "staff" | undefined;
2776
+ } | {
1668
2777
  kind: "automatic";
1669
- observation?: {
1670
- source: string;
1671
- type: string;
1672
- } | undefined;
1673
- content?: {
1674
- tracker: string;
1675
- window: {
1676
- start: number;
1677
- end?: number | undefined;
1678
- };
1679
- enrollment: "required" | "none";
1680
- posts: "after-enrollment" | "since-start";
1681
- historical: "automatic" | "claim" | "staff";
1682
- } | undefined;
1683
2778
  tracker?: {
1684
2779
  tracker: string;
1685
- source: "custom" | "x-search";
2780
+ source: string;
2781
+ on: "new-record" | "new-observation" | "data-changed";
1686
2782
  beneficiary: string;
1687
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
1688
2783
  where?: {
1689
2784
  path: string;
1690
2785
  gt?: number | {
@@ -1720,48 +2815,50 @@ declare function createRelayClient(options: RelayClientOptions): {
1720
2815
  path: string;
1721
2816
  equals: string | number | boolean;
1722
2817
  })[] | undefined;
2818
+ enrollment?: "none" | "required" | undefined;
2819
+ since?: "activation" | "window" | "enrollment" | undefined;
2820
+ historical?: "staff" | "claim" | "automatic" | undefined;
2821
+ content?: true | undefined;
1723
2822
  } | undefined;
1724
- } | {
1725
- kind: "manual";
1726
- input: "text";
1727
- constraints: {
1728
- required: boolean;
1729
- minLength: number;
1730
- maxLength: number;
1731
- };
1732
- actor?: "member" | "staff" | undefined;
1733
- } | {
1734
- kind: "manual";
1735
- input: "url";
1736
- constraints: {
1737
- required: boolean;
1738
- allowedHosts?: string[] | undefined;
1739
- };
1740
- actor?: "member" | "staff" | undefined;
1741
- } | {
1742
- kind: "manual";
1743
- input: "none" | "quiz" | "photo";
1744
- actor?: "member" | "staff" | undefined;
1745
2823
  };
1746
2824
  availability: {
1747
2825
  kind: "available";
1748
- input: "text" | "url" | "none" | "quiz" | "photo";
2826
+ input: "text" | "none" | "url" | "quiz" | "photo";
1749
2827
  } | {
1750
2828
  kind: "completed";
1751
2829
  } | {
1752
2830
  kind: "locked";
1753
- missing: {
2831
+ missing: ({
2832
+ kind: "completion";
1754
2833
  quest: string;
1755
2834
  title: string;
1756
- }[];
2835
+ scope: "ever";
2836
+ } | {
2837
+ kind: "completion";
2838
+ quest: string;
2839
+ title: string;
2840
+ scope: "period";
2841
+ period: "day" | "week" | "month";
2842
+ resetsAt: number;
2843
+ } | {
2844
+ kind: "balance";
2845
+ balance: string;
2846
+ title: string;
2847
+ minimum: number;
2848
+ current: number;
2849
+ } | {
2850
+ kind: "group";
2851
+ group: string;
2852
+ title: string;
2853
+ })[];
2854
+ } | {
2855
+ kind: "blocked";
2856
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
2857
+ resetsAt?: number | undefined;
1757
2858
  } | {
1758
2859
  kind: "staff-required";
1759
2860
  } | {
1760
2861
  kind: "automatic";
1761
- observation?: {
1762
- source: string;
1763
- type: string;
1764
- } | undefined;
1765
2862
  } | {
1766
2863
  kind: "checking";
1767
2864
  attempt: string;
@@ -1774,19 +2871,82 @@ declare function createRelayClient(options: RelayClientOptions): {
1774
2871
  };
1775
2872
  completed: boolean;
1776
2873
  completion: {
2874
+ kind: "progress";
2875
+ goal: {
2876
+ kind: "count";
2877
+ count: number;
2878
+ };
2879
+ window: {
2880
+ kind: "lifetime";
2881
+ } | {
2882
+ kind: "calendar";
2883
+ period: "day" | "week" | "month";
2884
+ latenessMs: number;
2885
+ } | {
2886
+ kind: "rolling";
2887
+ durationMs: number;
2888
+ };
2889
+ repeat: "repeat" | "once";
2890
+ } | {
1777
2891
  kind: "streak";
1778
2892
  days: number;
1779
- timeZone: string;
1780
2893
  } | {
1781
2894
  kind: "once";
1782
2895
  } | {
1783
2896
  kind: "keyed";
1784
2897
  };
2898
+ progress: {
2899
+ current: number;
2900
+ target: number;
2901
+ reason: string;
2902
+ } | null;
1785
2903
  completionCount: number;
1786
2904
  visibility: "visible" | "hidden";
1787
- missing: {
2905
+ missing: ({
2906
+ kind: "completion";
1788
2907
  quest: string;
1789
2908
  title: string;
2909
+ scope: "ever";
2910
+ } | {
2911
+ kind: "completion";
2912
+ quest: string;
2913
+ title: string;
2914
+ scope: "period";
2915
+ period: "day" | "week" | "month";
2916
+ resetsAt: number;
2917
+ } | {
2918
+ kind: "balance";
2919
+ balance: string;
2920
+ title: string;
2921
+ minimum: number;
2922
+ current: number;
2923
+ } | {
2924
+ kind: "group";
2925
+ group: string;
2926
+ title: string;
2927
+ })[];
2928
+ campaign: {
2929
+ key: string;
2930
+ title: string;
2931
+ enrollment: "none" | "required";
2932
+ enrolledAt: number | null;
2933
+ withdrawnAt: number | null;
2934
+ withdrawalReason: string | null;
2935
+ window?: {
2936
+ from: number;
2937
+ until: number;
2938
+ } | undefined;
2939
+ } | null;
2940
+ window: {
2941
+ from: number;
2942
+ until: number;
2943
+ } | null;
2944
+ budgets: {
2945
+ id: string;
2946
+ scope: "member" | "project";
2947
+ period: "lifetime" | "day" | "week" | "month";
2948
+ remaining: number;
2949
+ resetsAt: number | null;
1790
2950
  }[];
1791
2951
  attempt: {
1792
2952
  id: string;
@@ -1794,7 +2954,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1794
2954
  quest: string;
1795
2955
  member: string;
1796
2956
  evidence: string | null;
1797
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
2957
+ status: AttemptStatus;
1798
2958
  reason: string | null;
1799
2959
  retries: number;
1800
2960
  generation: number;
@@ -1813,19 +2973,31 @@ declare function createRelayClient(options: RelayClientOptions): {
1813
2973
  };
1814
2974
  fulfillment: {
1815
2975
  kind: "staff-handover";
2976
+ } | {
2977
+ kind: "automatic";
1816
2978
  };
1817
2979
  };
1818
2980
  tier: string;
1819
- } | {
1820
- kind: "points";
1821
- balance: string;
1822
- amount: number;
1823
2981
  } | {
1824
2982
  kind: "integration";
1825
2983
  provider: "discord";
1826
2984
  action: "grant-role";
1827
2985
  roleId: string;
2986
+ } | {
2987
+ kind: "points";
2988
+ balance: string;
2989
+ amount: number;
1828
2990
  })[] | null;
2991
+ evaluationRun: number;
2992
+ deferCount: number;
2993
+ deferUntil: number | null;
2994
+ nextEvaluationAt: number | null;
2995
+ code: string | null;
2996
+ progress: {
2997
+ current: number;
2998
+ target: number;
2999
+ reason: string;
3000
+ } | null;
1829
3001
  requestedReview: boolean;
1830
3002
  createdAt: number;
1831
3003
  input?: {
@@ -1843,7 +3015,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1843
3015
  } | undefined;
1844
3016
  } | null;
1845
3017
  release: string;
1846
- interaction: "text" | "url" | "automatic" | "claim" | "staff" | "quiz" | "photo";
3018
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1847
3019
  lifecycle: "paused" | "active" | "archived";
1848
3020
  rewards: ({
1849
3021
  kind: "points";
@@ -1898,6 +3070,40 @@ declare function createRelayClient(options: RelayClientOptions): {
1898
3070
  achievedAt: number;
1899
3071
  };
1900
3072
  } | null | undefined;
3073
+ counter?: {
3074
+ goal: number;
3075
+ current: number;
3076
+ window: {
3077
+ key: string;
3078
+ start: number | null;
3079
+ end: number | null;
3080
+ };
3081
+ repeat: "repeat" | "once";
3082
+ settled: number;
3083
+ latest: {
3084
+ id: string;
3085
+ ordinal: number;
3086
+ achievedAt: number;
3087
+ window: string;
3088
+ status: "revoked";
3089
+ completion: string;
3090
+ revokedAt: number;
3091
+ } | {
3092
+ id: string;
3093
+ ordinal: number;
3094
+ achievedAt: number;
3095
+ window: string;
3096
+ status: "awarded";
3097
+ completion: string;
3098
+ } | {
3099
+ id: string;
3100
+ ordinal: number;
3101
+ achievedAt: number;
3102
+ window: string;
3103
+ status: "budget-exhausted";
3104
+ budget: string;
3105
+ } | null;
3106
+ } | null | undefined;
1901
3107
  }[];
1902
3108
  key?: string | undefined;
1903
3109
  }>;
@@ -1907,6 +3113,24 @@ declare function createRelayClient(options: RelayClientOptions): {
1907
3113
  maxBackoffMs?: number;
1908
3114
  }) => ProgressObserver;
1909
3115
  };
3116
+ campaigns: {
3117
+ /** Enrolls the signed-in member once in every quest of a campaign that requires it. */
3118
+ enroll: (value: CampaignEnrollmentInput, requestOptions?: RelayRequestOptions) => Promise<{
3119
+ campaign: string;
3120
+ member: string;
3121
+ enrolledAt: number;
3122
+ withdrawnAt: number | null;
3123
+ withdrawalReason: string | null;
3124
+ }>;
3125
+ /** Pauses the signed-in member's campaign enrollment without erasing its history. */
3126
+ withdraw: (value: CampaignWithdrawalInput, requestOptions?: RelayRequestOptions) => Promise<{
3127
+ campaign: string;
3128
+ member: string;
3129
+ enrolledAt: number;
3130
+ withdrawnAt: number | null;
3131
+ withdrawalReason: string | null;
3132
+ }>;
3133
+ };
1910
3134
  /** The signed-in member's linked Solana, EVM and Cosmos wallets for this project. */
1911
3135
  wallets: {
1912
3136
  list: (requestOptions?: RelayRequestOptions) => Promise<{
@@ -1938,7 +3162,11 @@ declare function createRelayClient(options: RelayClientOptions): {
1938
3162
  unlink: (wallet: Pick<LinkedWallet, "chain" | "address">, requestOptions?: RelayRequestOptions) => Promise<{
1939
3163
  ok: true;
1940
3164
  }>;
1941
- /** Asks the signer for its address, signs the returned challenge, and links the wallet. */
3165
+ /**
3166
+ * Asks the signer for its address, signs the returned challenge, and links the wallet. The
3167
+ * session read and the challenge share one deadline, and the verification gets its own:
3168
+ * the time the member takes in the wallet counts against neither.
3169
+ */
1942
3170
  link: (signer: WalletSigner, requestOptions?: RelayRequestOptions) => Promise<{
1943
3171
  chain: "solana" | "eip155" | "cosmos";
1944
3172
  network: `cosmos:${string}` | null;
@@ -1951,7 +3179,7 @@ declare function createRelayClient(options: RelayClientOptions): {
1951
3179
  auth: {
1952
3180
  providers: (requestOptions?: RelayRequestOptions) => Promise<{
1953
3181
  providers: {
1954
- provider: "google" | "apple" | "x" | "discord";
3182
+ provider: "discord" | "google" | "apple" | "x";
1955
3183
  configured: boolean;
1956
3184
  }[];
1957
3185
  email: boolean;
@@ -2044,7 +3272,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2044
3272
  };
2045
3273
  /** The member's connected sign-in accounts, one per provider. */
2046
3274
  accounts: (requestOptions?: RelayRequestOptions) => Promise<{
2047
- provider: "google" | "apple" | "x" | "discord";
3275
+ provider: "discord" | "google" | "apple" | "x";
2048
3276
  configured: boolean;
2049
3277
  status: "disconnected" | "connected" | "reconnect";
2050
3278
  subject: string | null;
@@ -2084,20 +3312,96 @@ declare function createRelayClient(options: RelayClientOptions): {
2084
3312
  kind: "member";
2085
3313
  member: string;
2086
3314
  } | {
2087
- kind: "staff";
2088
- subject: string;
3315
+ kind: "staff";
3316
+ subject: string;
3317
+ } | {
3318
+ kind: "operator";
3319
+ subject: string;
3320
+ };
3321
+ expiresAt: number;
3322
+ organization: string;
3323
+ project: string;
3324
+ environment: "test" | "live";
3325
+ };
3326
+ }>;
3327
+ };
3328
+ me: {
3329
+ activity: {
3330
+ list: (query?: {
3331
+ cursor?: string;
3332
+ limit?: number;
3333
+ }, options?: RelayRequestOptions) => Promise<{
3334
+ member: string;
3335
+ items: ({
3336
+ kind: "attempt.accepted";
3337
+ quest: string;
3338
+ attempt: string;
3339
+ completion: string | null;
3340
+ id: string;
3341
+ at: number;
3342
+ } | {
3343
+ kind: "attempt.rejected";
3344
+ quest: string;
3345
+ attempt: string;
3346
+ completion: string | null;
3347
+ id: string;
3348
+ at: number;
3349
+ } | {
3350
+ kind: "attempt.review";
3351
+ quest: string;
3352
+ attempt: string;
3353
+ completion: string | null;
3354
+ id: string;
3355
+ at: number;
3356
+ } | {
3357
+ kind: "points.awarded";
3358
+ entry: string;
3359
+ ledger: string;
3360
+ amount: number;
3361
+ quest: string | null;
3362
+ completion: string | null;
3363
+ id: string;
3364
+ at: number;
3365
+ } | {
3366
+ kind: "entitlement.granted";
3367
+ entitlement: string;
3368
+ tier: string;
3369
+ status: string;
3370
+ id: string;
3371
+ at: number;
3372
+ } | {
3373
+ kind: "entitlement.collected";
3374
+ entitlement: string;
3375
+ id: string;
3376
+ at: number;
3377
+ } | {
3378
+ kind: "delivery.updated";
3379
+ delivery: string;
3380
+ quest: string;
3381
+ completion: string;
3382
+ status: string;
3383
+ id: string;
3384
+ at: number;
2089
3385
  } | {
2090
- kind: "operator";
2091
- subject: string;
2092
- };
2093
- expiresAt: number;
2094
- organization: string;
2095
- project: string;
2096
- environment: "test" | "live";
2097
- };
2098
- }>;
2099
- };
2100
- me: {
3386
+ kind: "referral.qualified";
3387
+ program: string;
3388
+ id: string;
3389
+ at: number;
3390
+ } | {
3391
+ kind: "unknown";
3392
+ reportedKind: string;
3393
+ id: string;
3394
+ at: number;
3395
+ })[];
3396
+ nextCursor: string;
3397
+ }>;
3398
+ observe: (listener: (event: RelayEvent) => void, options?: {
3399
+ cursor?: string;
3400
+ intervalMs?: number;
3401
+ maxBackoffMs?: number;
3402
+ onState?: (state: ProgressObservation<ParticipantActivity>) => void;
3403
+ }) => ProgressObserver;
3404
+ };
2101
3405
  /** The signed-in member, and the seed of their generated avatar: `defaultAvatar(avatarSeed)`. */
2102
3406
  get: (requestOptions?: RelayRequestOptions) => Promise<{
2103
3407
  member: string;
@@ -2163,28 +3467,35 @@ declare function createRelayClient(options: RelayClientOptions): {
2163
3467
  } | undefined;
2164
3468
  } | undefined;
2165
3469
  };
2166
- connections: ("google" | "apple" | "x" | "discord")[];
3470
+ connections: ("discord" | "google" | "apple" | "x")[];
2167
3471
  trigger: {
3472
+ kind: "manual";
3473
+ input: "text";
3474
+ constraints: {
3475
+ required: boolean;
3476
+ minLength: number;
3477
+ maxLength: number;
3478
+ };
3479
+ actor?: "member" | "staff" | undefined;
3480
+ } | {
3481
+ kind: "manual";
3482
+ input: "url";
3483
+ constraints: {
3484
+ required: boolean;
3485
+ allowedHosts?: string[] | undefined;
3486
+ };
3487
+ actor?: "member" | "staff" | undefined;
3488
+ } | {
3489
+ kind: "manual";
3490
+ input: "none" | "quiz" | "photo";
3491
+ actor?: "member" | "staff" | undefined;
3492
+ } | {
2168
3493
  kind: "automatic";
2169
- observation?: {
2170
- source: string;
2171
- type: string;
2172
- } | undefined;
2173
- content?: {
2174
- tracker: string;
2175
- window: {
2176
- start: number;
2177
- end?: number | undefined;
2178
- };
2179
- enrollment: "required" | "none";
2180
- posts: "after-enrollment" | "since-start";
2181
- historical: "automatic" | "claim" | "staff";
2182
- } | undefined;
2183
3494
  tracker?: {
2184
3495
  tracker: string;
2185
- source: "custom" | "x-search";
3496
+ source: string;
3497
+ on: "new-record" | "new-observation" | "data-changed";
2186
3498
  beneficiary: string;
2187
- on?: "new-record" | "new-observation" | "data-changed" | undefined;
2188
3499
  where?: {
2189
3500
  path: string;
2190
3501
  gt?: number | {
@@ -2220,48 +3531,50 @@ declare function createRelayClient(options: RelayClientOptions): {
2220
3531
  path: string;
2221
3532
  equals: string | number | boolean;
2222
3533
  })[] | undefined;
3534
+ enrollment?: "none" | "required" | undefined;
3535
+ since?: "activation" | "window" | "enrollment" | undefined;
3536
+ historical?: "staff" | "claim" | "automatic" | undefined;
3537
+ content?: true | undefined;
2223
3538
  } | undefined;
2224
- } | {
2225
- kind: "manual";
2226
- input: "text";
2227
- constraints: {
2228
- required: boolean;
2229
- minLength: number;
2230
- maxLength: number;
2231
- };
2232
- actor?: "member" | "staff" | undefined;
2233
- } | {
2234
- kind: "manual";
2235
- input: "url";
2236
- constraints: {
2237
- required: boolean;
2238
- allowedHosts?: string[] | undefined;
2239
- };
2240
- actor?: "member" | "staff" | undefined;
2241
- } | {
2242
- kind: "manual";
2243
- input: "none" | "quiz" | "photo";
2244
- actor?: "member" | "staff" | undefined;
2245
3539
  };
2246
3540
  availability: {
2247
3541
  kind: "available";
2248
- input: "text" | "url" | "none" | "quiz" | "photo";
3542
+ input: "text" | "none" | "url" | "quiz" | "photo";
2249
3543
  } | {
2250
3544
  kind: "completed";
2251
3545
  } | {
2252
3546
  kind: "locked";
2253
- missing: {
3547
+ missing: ({
3548
+ kind: "completion";
2254
3549
  quest: string;
2255
3550
  title: string;
2256
- }[];
3551
+ scope: "ever";
3552
+ } | {
3553
+ kind: "completion";
3554
+ quest: string;
3555
+ title: string;
3556
+ scope: "period";
3557
+ period: "day" | "week" | "month";
3558
+ resetsAt: number;
3559
+ } | {
3560
+ kind: "balance";
3561
+ balance: string;
3562
+ title: string;
3563
+ minimum: number;
3564
+ current: number;
3565
+ } | {
3566
+ kind: "group";
3567
+ group: string;
3568
+ title: string;
3569
+ })[];
3570
+ } | {
3571
+ kind: "blocked";
3572
+ reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
3573
+ resetsAt?: number | undefined;
2257
3574
  } | {
2258
3575
  kind: "staff-required";
2259
3576
  } | {
2260
3577
  kind: "automatic";
2261
- observation?: {
2262
- source: string;
2263
- type: string;
2264
- } | undefined;
2265
3578
  } | {
2266
3579
  kind: "checking";
2267
3580
  attempt: string;
@@ -2274,19 +3587,82 @@ declare function createRelayClient(options: RelayClientOptions): {
2274
3587
  };
2275
3588
  completed: boolean;
2276
3589
  completion: {
3590
+ kind: "progress";
3591
+ goal: {
3592
+ kind: "count";
3593
+ count: number;
3594
+ };
3595
+ window: {
3596
+ kind: "lifetime";
3597
+ } | {
3598
+ kind: "calendar";
3599
+ period: "day" | "week" | "month";
3600
+ latenessMs: number;
3601
+ } | {
3602
+ kind: "rolling";
3603
+ durationMs: number;
3604
+ };
3605
+ repeat: "repeat" | "once";
3606
+ } | {
2277
3607
  kind: "streak";
2278
3608
  days: number;
2279
- timeZone: string;
2280
3609
  } | {
2281
3610
  kind: "once";
2282
3611
  } | {
2283
3612
  kind: "keyed";
2284
3613
  };
3614
+ progress: {
3615
+ current: number;
3616
+ target: number;
3617
+ reason: string;
3618
+ } | null;
2285
3619
  completionCount: number;
2286
3620
  visibility: "visible" | "hidden";
2287
- missing: {
3621
+ missing: ({
3622
+ kind: "completion";
3623
+ quest: string;
3624
+ title: string;
3625
+ scope: "ever";
3626
+ } | {
3627
+ kind: "completion";
2288
3628
  quest: string;
2289
3629
  title: string;
3630
+ scope: "period";
3631
+ period: "day" | "week" | "month";
3632
+ resetsAt: number;
3633
+ } | {
3634
+ kind: "balance";
3635
+ balance: string;
3636
+ title: string;
3637
+ minimum: number;
3638
+ current: number;
3639
+ } | {
3640
+ kind: "group";
3641
+ group: string;
3642
+ title: string;
3643
+ })[];
3644
+ campaign: {
3645
+ key: string;
3646
+ title: string;
3647
+ enrollment: "none" | "required";
3648
+ enrolledAt: number | null;
3649
+ withdrawnAt: number | null;
3650
+ withdrawalReason: string | null;
3651
+ window?: {
3652
+ from: number;
3653
+ until: number;
3654
+ } | undefined;
3655
+ } | null;
3656
+ window: {
3657
+ from: number;
3658
+ until: number;
3659
+ } | null;
3660
+ budgets: {
3661
+ id: string;
3662
+ scope: "member" | "project";
3663
+ period: "lifetime" | "day" | "week" | "month";
3664
+ remaining: number;
3665
+ resetsAt: number | null;
2290
3666
  }[];
2291
3667
  attempt: {
2292
3668
  id: string;
@@ -2294,7 +3670,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2294
3670
  quest: string;
2295
3671
  member: string;
2296
3672
  evidence: string | null;
2297
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
3673
+ status: AttemptStatus;
2298
3674
  reason: string | null;
2299
3675
  retries: number;
2300
3676
  generation: number;
@@ -2313,19 +3689,31 @@ declare function createRelayClient(options: RelayClientOptions): {
2313
3689
  };
2314
3690
  fulfillment: {
2315
3691
  kind: "staff-handover";
3692
+ } | {
3693
+ kind: "automatic";
2316
3694
  };
2317
3695
  };
2318
3696
  tier: string;
2319
- } | {
2320
- kind: "points";
2321
- balance: string;
2322
- amount: number;
2323
3697
  } | {
2324
3698
  kind: "integration";
2325
3699
  provider: "discord";
2326
3700
  action: "grant-role";
2327
3701
  roleId: string;
3702
+ } | {
3703
+ kind: "points";
3704
+ balance: string;
3705
+ amount: number;
2328
3706
  })[] | null;
3707
+ evaluationRun: number;
3708
+ deferCount: number;
3709
+ deferUntil: number | null;
3710
+ nextEvaluationAt: number | null;
3711
+ code: string | null;
3712
+ progress: {
3713
+ current: number;
3714
+ target: number;
3715
+ reason: string;
3716
+ } | null;
2329
3717
  requestedReview: boolean;
2330
3718
  createdAt: number;
2331
3719
  input?: {
@@ -2374,56 +3762,102 @@ declare function createRelayClient(options: RelayClientOptions): {
2374
3762
  achievedAt: number;
2375
3763
  };
2376
3764
  } | null | undefined;
3765
+ counter?: {
3766
+ goal: number;
3767
+ current: number;
3768
+ window: {
3769
+ key: string;
3770
+ start: number | null;
3771
+ end: number | null;
3772
+ };
3773
+ repeat: "repeat" | "once";
3774
+ settled: number;
3775
+ latest: {
3776
+ id: string;
3777
+ ordinal: number;
3778
+ achievedAt: number;
3779
+ window: string;
3780
+ status: "revoked";
3781
+ completion: string;
3782
+ revokedAt: number;
3783
+ } | {
3784
+ id: string;
3785
+ ordinal: number;
3786
+ achievedAt: number;
3787
+ window: string;
3788
+ status: "awarded";
3789
+ completion: string;
3790
+ } | {
3791
+ id: string;
3792
+ ordinal: number;
3793
+ achievedAt: number;
3794
+ window: string;
3795
+ status: "budget-exhausted";
3796
+ budget: string;
3797
+ } | null;
3798
+ } | null | undefined;
2377
3799
  }[];
2378
3800
  entitlements: ({
3801
+ [x: string]: unknown;
2379
3802
  status: "available";
2380
3803
  id: string;
2381
3804
  member: string;
2382
3805
  reward: {
3806
+ [x: string]: unknown;
2383
3807
  id: string;
2384
3808
  title: string;
2385
3809
  tiers: {
3810
+ [x: string]: unknown;
2386
3811
  id: string;
2387
3812
  title: string;
2388
3813
  }[];
2389
3814
  inventory: {
2390
- kind: "untracked";
3815
+ [x: string]: unknown;
3816
+ kind: string;
2391
3817
  };
2392
3818
  fulfillment: {
2393
- kind: "staff-handover";
3819
+ [x: string]: unknown;
3820
+ kind: string;
2394
3821
  };
2395
3822
  };
2396
3823
  earnedTier: string;
2397
3824
  tier: string;
2398
3825
  revision: number;
2399
3826
  } | {
3827
+ [x: string]: unknown;
2400
3828
  status: "handing-over";
2401
3829
  handover: string;
2402
3830
  startedAt: number;
2403
3831
  id: string;
2404
3832
  member: string;
2405
3833
  reward: {
3834
+ [x: string]: unknown;
2406
3835
  id: string;
2407
3836
  title: string;
2408
3837
  tiers: {
3838
+ [x: string]: unknown;
2409
3839
  id: string;
2410
3840
  title: string;
2411
3841
  }[];
2412
3842
  inventory: {
2413
- kind: "untracked";
3843
+ [x: string]: unknown;
3844
+ kind: string;
2414
3845
  };
2415
3846
  fulfillment: {
2416
- kind: "staff-handover";
3847
+ [x: string]: unknown;
3848
+ kind: string;
2417
3849
  };
2418
3850
  };
2419
3851
  earnedTier: string;
2420
3852
  tier: string;
2421
3853
  revision: number;
2422
3854
  allocation?: {
3855
+ [x: string]: unknown;
2423
3856
  item: string;
2424
3857
  label: string;
2425
3858
  } | undefined;
2426
3859
  } | {
3860
+ [x: string]: unknown;
2427
3861
  status: "collected";
2428
3862
  handover: string;
2429
3863
  startedAt: number;
@@ -2431,36 +3865,125 @@ declare function createRelayClient(options: RelayClientOptions): {
2431
3865
  id: string;
2432
3866
  member: string;
2433
3867
  reward: {
3868
+ [x: string]: unknown;
2434
3869
  id: string;
2435
3870
  title: string;
2436
3871
  tiers: {
3872
+ [x: string]: unknown;
2437
3873
  id: string;
2438
3874
  title: string;
2439
3875
  }[];
2440
3876
  inventory: {
2441
- kind: "untracked";
3877
+ [x: string]: unknown;
3878
+ kind: string;
2442
3879
  };
2443
3880
  fulfillment: {
2444
- kind: "staff-handover";
3881
+ [x: string]: unknown;
3882
+ kind: string;
2445
3883
  };
2446
3884
  };
2447
3885
  earnedTier: string;
2448
3886
  tier: string;
2449
3887
  revision: number;
2450
3888
  allocation?: {
3889
+ [x: string]: unknown;
2451
3890
  item: string;
2452
3891
  label: string;
2453
3892
  } | undefined;
3893
+ recovery?: {
3894
+ completion: string;
3895
+ reason: string;
3896
+ flaggedAt: number;
3897
+ remainingTier: string | null;
3898
+ } | undefined;
3899
+ } | {
3900
+ [x: string]: unknown;
3901
+ status: "void";
3902
+ voidedAt: number;
3903
+ id: string;
3904
+ member: string;
3905
+ reward: {
3906
+ [x: string]: unknown;
3907
+ id: string;
3908
+ title: string;
3909
+ tiers: {
3910
+ [x: string]: unknown;
3911
+ id: string;
3912
+ title: string;
3913
+ }[];
3914
+ inventory: {
3915
+ [x: string]: unknown;
3916
+ kind: string;
3917
+ };
3918
+ fulfillment: {
3919
+ [x: string]: unknown;
3920
+ kind: string;
3921
+ };
3922
+ };
3923
+ earnedTier: string;
3924
+ tier: string;
3925
+ revision: number;
3926
+ } | {
3927
+ status: "unsupported";
3928
+ reportedStatus: string;
3929
+ id: string;
3930
+ member: string;
3931
+ reward: {
3932
+ [x: string]: unknown;
3933
+ id: string;
3934
+ title: string;
3935
+ tiers: {
3936
+ [x: string]: unknown;
3937
+ id: string;
3938
+ title: string;
3939
+ }[];
3940
+ inventory: {
3941
+ [x: string]: unknown;
3942
+ kind: string;
3943
+ };
3944
+ fulfillment: {
3945
+ [x: string]: unknown;
3946
+ kind: string;
3947
+ };
3948
+ };
3949
+ earnedTier: string;
3950
+ tier: string;
3951
+ revision: number;
2454
3952
  })[];
2455
3953
  }>;
2456
3954
  rewardDeliveries: (requestOptions?: RelayRequestOptions) => Promise<{
2457
- deliveries: {
3955
+ deliveries: ({
3956
+ [x: string]: z.core.util.JSONType | undefined;
3957
+ id: string;
3958
+ quest: string;
3959
+ completion: string;
3960
+ member: string;
3961
+ action: RewardDeliveryAction;
3962
+ attempts: number;
3963
+ nextAt: number;
3964
+ lastError: string | null;
3965
+ createdAt: number;
3966
+ deliveredAt: number | null;
3967
+ provider: string;
3968
+ status: string;
3969
+ dispatchedAt?: number | null | undefined;
3970
+ revokedAt?: number | null | undefined;
3971
+ roleId?: string | undefined;
3972
+ reconciliation?: {
3973
+ [x: string]: z.core.util.JSONType;
3974
+ status: string;
3975
+ ownership: string;
3976
+ at: number;
3977
+ reason: string | null;
3978
+ } | null | undefined;
3979
+ } | {
3980
+ [x: string]: z.core.util.JSONType | undefined;
2458
3981
  id: string;
2459
3982
  quest: string;
2460
3983
  completion: string;
2461
3984
  member: string;
2462
3985
  provider: "discord";
2463
- action: "grant-role";
3986
+ action: RewardDeliveryAction;
2464
3987
  roleId: string;
2465
3988
  status: "pending" | "failed" | "delivered";
2466
3989
  attempts: number;
@@ -2468,7 +3991,42 @@ declare function createRelayClient(options: RelayClientOptions): {
2468
3991
  lastError: string | null;
2469
3992
  createdAt: number;
2470
3993
  deliveredAt: number | null;
3994
+ dispatchedAt?: number | null | undefined;
3995
+ revokedAt?: number | null | undefined;
3996
+ reconciliation?: {
3997
+ status: "pending" | "removed" | "failed" | "preserved" | "granted";
3998
+ ownership: "external" | "unclaimed" | "relay";
3999
+ at: number;
4000
+ reason: string | null;
4001
+ } | null | undefined;
4002
+ })[];
4003
+ }>;
4004
+ /**
4005
+ * `{ items }`: the member's balance in each of the project's point ledgers, in the project's
4006
+ * ledger order, zero in a ledger they have no entries in.
4007
+ */
4008
+ balances: (requestOptions?: RelayRequestOptions) => Promise<{
4009
+ items: {
4010
+ ledger: {
4011
+ id: string;
4012
+ key: string | null;
4013
+ name: string;
4014
+ };
4015
+ balance: number;
4016
+ available: number;
4017
+ }[];
4018
+ }>;
4019
+ /** The member's own entries in one ledger, by key or ID, most recently recorded first. */
4020
+ pointHistory: (query: PointHistoryQuery, requestOptions?: RelayRequestOptions) => Promise<{
4021
+ items: {
4022
+ id: string;
4023
+ amount: number;
4024
+ kind: PointEntryKind;
4025
+ at: number;
4026
+ quest: string | null;
4027
+ reverses: string | null;
2471
4028
  }[];
4029
+ nextCursor: string | null;
2472
4030
  }>;
2473
4031
  /** Claims a quest for the signed-in member. Quest controllers (`quests.open`) call this. */
2474
4032
  claim: (value: Omit<z.input<typeof submitSchema>, "member">, requestOptions?: RelayRequestOptions) => Promise<{
@@ -2477,7 +4035,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2477
4035
  quest: string;
2478
4036
  member: string;
2479
4037
  evidence: string | null;
2480
- status: "needs-review" | "failed" | "queued" | "evaluating" | "accepted" | "progressed" | "rejected";
4038
+ status: AttemptStatus;
2481
4039
  reason: string | null;
2482
4040
  retries: number;
2483
4041
  generation: number;
@@ -2496,19 +4054,31 @@ declare function createRelayClient(options: RelayClientOptions): {
2496
4054
  };
2497
4055
  fulfillment: {
2498
4056
  kind: "staff-handover";
4057
+ } | {
4058
+ kind: "automatic";
2499
4059
  };
2500
4060
  };
2501
4061
  tier: string;
2502
- } | {
2503
- kind: "points";
2504
- balance: string;
2505
- amount: number;
2506
4062
  } | {
2507
4063
  kind: "integration";
2508
4064
  provider: "discord";
2509
4065
  action: "grant-role";
2510
4066
  roleId: string;
4067
+ } | {
4068
+ kind: "points";
4069
+ balance: string;
4070
+ amount: number;
2511
4071
  })[] | null;
4072
+ evaluationRun: number;
4073
+ deferCount: number;
4074
+ deferUntil: number | null;
4075
+ nextEvaluationAt: number | null;
4076
+ code: string | null;
4077
+ progress: {
4078
+ current: number;
4079
+ target: number;
4080
+ reason: string;
4081
+ } | null;
2512
4082
  requestedReview: boolean;
2513
4083
  createdAt: number;
2514
4084
  input?: {
@@ -2545,14 +4115,14 @@ declare function createRelayClient(options: RelayClientOptions): {
2545
4115
  key: string;
2546
4116
  qualifiedBy: string;
2547
4117
  balance: string;
2548
- metrics: ("likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks")[];
4118
+ metrics: string[];
2549
4119
  baseline: "historical";
2550
4120
  maxAgeMs: number;
2551
- budget: {
2552
- projectDaily?: number | undefined;
2553
- memberDaily?: number | undefined;
2554
- projectLifetime?: number | undefined;
2555
- };
4121
+ budgets: {
4122
+ scope: "member" | "project";
4123
+ period: "lifetime" | "day" | "week" | "month";
4124
+ limit: number;
4125
+ }[];
2556
4126
  };
2557
4127
  publishedAt: number;
2558
4128
  };
@@ -2563,8 +4133,8 @@ declare function createRelayClient(options: RelayClientOptions): {
2563
4133
  paid: number;
2564
4134
  excluded: number;
2565
4135
  pending: number;
2566
- counters: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
2567
- baseline: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
4136
+ counters: Record<string, number>;
4137
+ baseline: Record<string, number>;
2568
4138
  observation: string | null;
2569
4139
  nextSettlementAt: number | null;
2570
4140
  reason: string | null;
@@ -2591,14 +4161,14 @@ declare function createRelayClient(options: RelayClientOptions): {
2591
4161
  key: string;
2592
4162
  qualifiedBy: string;
2593
4163
  balance: string;
2594
- metrics: ("likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks")[];
4164
+ metrics: string[];
2595
4165
  baseline: "historical";
2596
4166
  maxAgeMs: number;
2597
- budget: {
2598
- projectDaily?: number | undefined;
2599
- memberDaily?: number | undefined;
2600
- projectLifetime?: number | undefined;
2601
- };
4167
+ budgets: {
4168
+ scope: "member" | "project";
4169
+ period: "lifetime" | "day" | "week" | "month";
4170
+ limit: number;
4171
+ }[];
2602
4172
  };
2603
4173
  publishedAt: number;
2604
4174
  } | null;
@@ -2608,21 +4178,21 @@ declare function createRelayClient(options: RelayClientOptions): {
2608
4178
  key: string;
2609
4179
  qualifiedBy: string;
2610
4180
  balance: string;
2611
- metrics: ("likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks")[];
4181
+ metrics: string[];
2612
4182
  baseline: "historical";
2613
4183
  maxAgeMs: number;
2614
- budget: {
2615
- projectDaily?: number | undefined;
2616
- memberDaily?: number | undefined;
2617
- projectLifetime?: number | undefined;
2618
- };
4184
+ budgets: {
4185
+ scope: "member" | "project";
4186
+ period: "lifetime" | "day" | "week" | "month";
4187
+ limit: number;
4188
+ }[];
2619
4189
  };
2620
4190
  publishedAt: number;
2621
4191
  };
2622
4192
  items: {
2623
4193
  from: string;
2624
4194
  to: string;
2625
- baseline: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
4195
+ baseline: Record<string, number>;
2626
4196
  observedAt: number;
2627
4197
  settlement: {
2628
4198
  id: string;
@@ -2658,7 +4228,7 @@ declare function createRelayClient(options: RelayClientOptions): {
2658
4228
  contentAttempt: string;
2659
4229
  observation: string;
2660
4230
  observedAt: number;
2661
- metrics: Partial<Record<"likes" | "replies" | "reposts" | "quotes" | "views" | "bookmarks", number>>;
4231
+ metrics: Record<string, number>;
2662
4232
  state: "pending" | "superseded" | "qualified" | "unqualified" | "needs-review" | "failed";
2663
4233
  reason: string | null;
2664
4234
  }[];
@@ -2684,33 +4254,9 @@ declare function createRelayClient(options: RelayClientOptions): {
2684
4254
  }[];
2685
4255
  nextCursor: string | null;
2686
4256
  }>;
2687
- admissions: (query: z.input<typeof contentAdmissionQuerySchema>, requestOptions?: RelayRequestOptions) => Promise<{
2688
- items: {
2689
- quest: string;
2690
- content: string;
2691
- release: string;
2692
- state: "pending" | "excluded" | "admitted";
2693
- reason: string | null;
2694
- attempt: string | null;
2695
- }[];
2696
- nextCursor: string | null;
2697
- }>;
2698
- enroll: (value: z.input<typeof contentEnrollmentInputSchema>, requestOptions?: RelayRequestOptions) => Promise<{
2699
- quest: string;
2700
- member: string;
2701
- enrolledAt: number;
2702
- }>;
2703
- claim: (value: z.input<typeof contentReleaseInputSchema>, requestOptions?: RelayRequestOptions) => Promise<{
2704
- quest: string;
2705
- content: string;
2706
- release: string;
2707
- state: "pending" | "excluded" | "admitted";
2708
- reason: string | null;
2709
- attempt: string | null;
2710
- }>;
2711
4257
  };
2712
4258
  };
2713
4259
  /** The participant client `createRelayClient` returns. */
2714
4260
  type RelayClient = ReturnType<typeof createRelayClient>;
2715
4261
 
2716
- export { type ClaimSubmission as C, type KnownRelayErrorCode as K, type PhotoSubmission as P, type QuestActionResult as Q, type RelayClient as R, type SubmissionDraft as S, type ValueSubmission as V, type ProgressObservation as a, type ProgressObserver as b, type QuestController as c, QuestUpdatedError as d, type QuizSubmission as e, type RelayClientOptions as f, RelayError as g, RelayErrorCode as h, type RelayErrorDetails as i, type RelayErrorKind as j, type RelayRequestOptions as k, RequestError as l, type RequestErrorDetails as m, type RequestErrorKind as n, type RequestRecovery as o, type SubmissionStatus as p, type SubmissionStore as q, createRelayClient as r, isRelayError as s, isRequestError as t };
4262
+ export { type ClaimSubmission as C, type KnownRelayErrorCode as K, type PhotoSubmission as P, type QuestActionResult as Q, type RelayClient as R, type SubmissionDraft as S, type ValueSubmission as V, type ProgressObservation as a, type ProgressObserver as b, type QuestController as c, QuestUpdatedError as d, type QuizSubmission as e, type RelayClientOptions as f, RelayError as g, RelayErrorCode as h, type RelayErrorDetails as i, type RelayErrorKind as j, type RelayRequestOptions as k, type SubmissionStatus as l, type SubmissionStore as m, createRelayClient as n, isRelayError as o };