@domino-sdk/relay 1.0.0-next.2 → 1.0.0-next.34

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 (61) hide show
  1. package/README.md +13 -1
  2. package/build.mjs +18 -1
  3. package/dist/activity-B8k9Sa_a.d.ts +9112 -0
  4. package/dist/authoring.d.ts +1355 -182
  5. package/dist/authoring.js +658 -225
  6. package/dist/automatic-outcomes-B1xrETxm.d.ts +758 -0
  7. package/dist/avatar.d.ts +29 -0
  8. package/dist/avatar.js +21 -0
  9. package/dist/browser-J7tUpXxy.d.ts +4154 -0
  10. package/dist/browser.d.ts +11 -4580
  11. package/dist/browser.js +8 -6
  12. package/dist/capability-error-DNMwKmlL.d.ts +458 -0
  13. package/dist/chunk-36HTX2BM.js +1223 -0
  14. package/dist/chunk-6QJ3LADK.js +112 -0
  15. package/dist/chunk-BGGKNIRP.js +171 -0
  16. package/dist/chunk-EYH5RDIE.js +496 -0
  17. package/dist/chunk-GQKYAQM6.js +84 -0
  18. package/dist/chunk-GUP7YRR4.js +42 -0
  19. package/dist/chunk-GZ6FJAXN.js +1659 -0
  20. package/dist/chunk-JON5SESL.js +2986 -0
  21. package/dist/chunk-MC6V6VMG.js +49 -0
  22. package/dist/chunk-NPGENI7K.js +37 -0
  23. package/dist/chunk-V7UKZLHA.js +35 -0
  24. package/dist/chunk-VFHHLN6A.js +284 -0
  25. package/dist/chunk-WJSSJ7AF.js +151 -0
  26. package/dist/{chunk-VH4OQ5VX.js → chunk-XFMSUPNS.js} +26 -5
  27. package/dist/{chunk-FDWRBMB3.js → chunk-ZVIRG24J.js} +150 -33
  28. package/dist/client-XiuFnug_.d.ts +4262 -0
  29. package/dist/groups-Ck-OxzjD.d.ts +2449 -0
  30. package/dist/identity-integration-GxAHdKR2.d.ts +58 -0
  31. package/dist/images-Dv-P5VBw.d.ts +234 -0
  32. package/dist/index.d.ts +15 -13115
  33. package/dist/index.js +30 -689
  34. package/dist/internal.d.ts +159 -0
  35. package/dist/internal.js +79 -0
  36. package/dist/offers-Cy-e4o5x.d.ts +431 -0
  37. package/dist/outcomes-kVB-Juzs.d.ts +4902 -0
  38. package/dist/pages-BBYD21IE.d.ts +359 -0
  39. package/dist/participant-rewards-3duLb8YJ.d.ts +668 -0
  40. package/dist/portal-proxy.js +26 -9
  41. package/dist/profiles-D2aFcOxu.d.ts +297 -0
  42. package/dist/react/index.d.ts +3378 -3318
  43. package/dist/react/index.js +1635 -783
  44. package/dist/request-error-DWduJCGV.d.ts +62 -0
  45. package/dist/schema-DfJzH2ci.d.ts +5644 -0
  46. package/dist/schema.d.ts +15 -3388
  47. package/dist/schema.js +790 -3
  48. package/dist/server/index.d.ts +81498 -0
  49. package/dist/server/index.js +2520 -0
  50. package/dist/streaks-CWyq8Px5.d.ts +71 -0
  51. package/dist/submission-input-BZkm6ohU.d.ts +290 -0
  52. package/dist/units-CwgsPB_r.d.ts +9 -0
  53. package/dist/vite.d.ts +1 -1
  54. package/dist/vite.js +1 -0
  55. package/dist/wallet-YssWxGg8.d.ts +228 -0
  56. package/package.json +24 -5
  57. package/dist/chunk-4KNTMNXA.js +0 -1847
  58. package/dist/chunk-B76BAJ25.js +0 -624
  59. package/dist/chunk-NKGJEYZM.js +0 -1833
  60. package/dist/chunk-ONDBQSMU.js +0 -373
  61. package/dist/submission-input-JDwq3EVK.d.ts +0 -4986
@@ -0,0 +1,4262 @@
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';
7
+ import { z } from 'zod';
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';
10
+
11
+ /** What happened, as in every Domino client error (see `RequestError`). */
12
+ type RelayErrorKind = RequestErrorKind;
13
+ type KnownRelayErrorCode = (typeof RelayErrorCode)[keyof typeof RelayErrorCode];
14
+ /**
15
+ * The machine-readable codes this SDK knows. `RelayError.code` is an open string: Relay can add
16
+ * codes, and the error keeps a code this SDK does not list, with the server's message.
17
+ */
18
+ declare const RelayErrorCode: {
19
+ /** The call needs a signed-in member. */
20
+ readonly NotSignedIn: "not-signed-in";
21
+ /** The session changed since the app read it (the `session` option). Reload before retrying. */
22
+ readonly StaleSession: "stale-session";
23
+ /** The input failed validation before it was sent. */
24
+ readonly InvalidInput: "invalid-input";
25
+ /** Relay's answer was not JSON or not the expected shape (kind `invalid-response`). */
26
+ readonly InvalidResponse: "invalid-response";
27
+ /** The transport failed, before a response or while reading its body (kind `network`). */
28
+ readonly Network: "network";
29
+ /** The client's deadline elapsed (kind `timeout`). */
30
+ readonly Timeout: "timeout";
31
+ /** The caller cancelled the request (kind `aborted`). */
32
+ readonly Aborted: "aborted";
33
+ /** A quest or collection the call named is not in the member's experience. */
34
+ readonly NotFound: "not-found";
35
+ /** The quest has no failed attempt the member can retry. */
36
+ readonly RetryUnavailable: "retry-unavailable";
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
+ */
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";
44
+ /** The saved submission is in a state that does not allow this action. */
45
+ readonly SubmissionConflict: "submission-conflict";
46
+ /** The quest changed since the member saw it; review it before submitting again. */
47
+ readonly QuestUpdated: "quest-updated";
48
+ /** Wait for the deferred attempt before submitting another action. */
49
+ readonly AttemptPending: "attempt-pending";
50
+ /** The quiz changed since the member answered it. */
51
+ readonly StaleQuiz: "stale-quiz";
52
+ /** Relay refused the submitted evidence. */
53
+ readonly InvalidSubmission: "invalid-submission";
54
+ /** A page cursor Relay cannot read; start again from the first page. */
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";
76
+ /** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
77
+ readonly WalletSigner: "wallet-signer";
78
+ };
79
+ /** A known code, or one a newer Relay sends. */
80
+ type RelayErrorCode = KnownRelayErrorCode | (string & {});
81
+ type RelayErrorDetails = RequestErrorDetails & {
82
+ code?: RelayErrorCode;
83
+ missing?: MissingPrerequisite[];
84
+ };
85
+ declare const relayErrorBrand: unique symbol;
86
+ /** Whether `value` is a `RelayError` from any copy of the SDK. Prefer it to `instanceof`. */
87
+ declare function isRelayError(value: unknown): value is RelayError;
88
+ /** Every error the participant client throws: the shared `RequestError` fields, and `missing`. */
89
+ declare class RelayError extends RequestError {
90
+ readonly name: string;
91
+ readonly [relayErrorBrand] = true;
92
+ readonly code: RelayErrorCode | undefined;
93
+ /** Prerequisites the member does not currently meet, when Relay refused for that reason. */
94
+ readonly missing: MissingPrerequisite[];
95
+ constructor(message: string, details: RelayErrorDetails);
96
+ }
97
+
98
+ type SubmissionStatus = {
99
+ kind: "empty";
100
+ } | {
101
+ kind: "needs-review";
102
+ } | {
103
+ kind: "pending";
104
+ stage: "upload" | "claim";
105
+ } | {
106
+ kind: "submitted";
107
+ attempt: string;
108
+ };
109
+ type Handle = {
110
+ status(): Promise<SubmissionStatus>;
111
+ resume(): Promise<Attempt>;
112
+ discard(): Promise<void>;
113
+ };
114
+ type PhotoSubmission = Handle & {
115
+ submit(file: File): Promise<Attempt>;
116
+ };
117
+ type QuizSubmission = Handle & {
118
+ submit(answers: QuizEvidence["answers"], options?: {
119
+ release: string;
120
+ }): Promise<Attempt>;
121
+ };
122
+ type ValueSubmission = Handle & {
123
+ submit(value: string): Promise<Attempt>;
124
+ };
125
+ type ClaimSubmission = Handle & {
126
+ submit(): Promise<Attempt>;
127
+ };
128
+ /** Stores structured-clone values. Writes must finish durably before resolving.
129
+ * exclusive must serialize all writers to a key, including across browser tabs. */
130
+ interface SubmissionStore {
131
+ read(key: string): Promise<unknown>;
132
+ write(key: string, value: unknown): Promise<void>;
133
+ exclusive<T>(key: string, task: () => Promise<T>): Promise<T>;
134
+ }
135
+ type SubmissionDraft = {
136
+ kind: "photo";
137
+ file: Blob;
138
+ } | QuizEvidence | ValueEvidence | {
139
+ kind: "none";
140
+ };
141
+ /**
142
+ * The quest or quiz changed since the member saw it, so Relay admitted nothing. `draft` holds what
143
+ * the member entered, to show again once they review the quest.
144
+ */
145
+ declare class QuestUpdatedError extends RelayError {
146
+ readonly draft: SubmissionDraft | null;
147
+ readonly name: string;
148
+ constructor(message: string, code: "quest-updated" | "stale-quiz", draft: SubmissionDraft | null,
149
+ /** The HTTP error Relay answered with; omitted when a saved review state is replayed. */
150
+ source?: RelayError);
151
+ }
152
+
153
+ type ProgressObservation<T = MemberProgress> = {
154
+ kind: "loading";
155
+ } | {
156
+ kind: "session";
157
+ session: ParticipantSession | null;
158
+ } | {
159
+ kind: "ready";
160
+ session: ParticipantSession;
161
+ progress: T;
162
+ } | {
163
+ kind: "error";
164
+ error: Error;
165
+ };
166
+ type ProgressObserver = {
167
+ refresh(): Promise<void>;
168
+ dispose(): void;
169
+ };
170
+
171
+ type QuestActionResult = {
172
+ kind: "submitted";
173
+ attempt: Attempt;
174
+ } | {
175
+ kind: "quest-updated";
176
+ latest: QuestView;
177
+ originalDraft: SubmissionDraft | null;
178
+ draft: SubmissionDraft | null;
179
+ };
180
+ type ActiveController = {
181
+ view: QuestView;
182
+ status(): Promise<SubmissionStatus>;
183
+ resume(): Promise<QuestActionResult>;
184
+ discard(): Promise<void>;
185
+ };
186
+ type QuestController = (ActiveController & {
187
+ kind: "text" | "url";
188
+ submit(value: string): Promise<QuestActionResult>;
189
+ }) | (ActiveController & {
190
+ kind: "status";
191
+ }) | (ActiveController & {
192
+ kind: "photo";
193
+ submit(file: File): Promise<QuestActionResult>;
194
+ }) | (ActiveController & {
195
+ kind: "quiz";
196
+ submit(answers: Record<string, string>): Promise<QuestActionResult>;
197
+ }) | (ActiveController & {
198
+ kind: "claim";
199
+ submit(): Promise<QuestActionResult>;
200
+ });
201
+
202
+ /** Options every participant client method takes as its last argument. */
203
+ type RelayRequestOptions = {
204
+ /**
205
+ * The session ID the app read (`auth.session()`). Relay refuses the call with a `RelayError`
206
+ * whose code is `stale-session` if the member's session changed since. Calls Relay binds to a
207
+ * session (wallet linking, collection passes, retries) read the current session when omitted.
208
+ */
209
+ session?: string;
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
+ */
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;
220
+ };
221
+ type RelayClientOptions = {
222
+ baseUrl: string;
223
+ token?: string;
224
+ submissionStore?: SubmissionStore;
225
+ organization?: string;
226
+ project?: string;
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;
233
+ };
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
+ };
360
+ referrals: {
361
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
362
+ id: string;
363
+ title: string;
364
+ enabled: boolean;
365
+ qualification: {
366
+ kind: "signup";
367
+ } | {
368
+ kind: "quest";
369
+ quest: string;
370
+ } | {
371
+ kind: "external";
372
+ };
373
+ rewards: {
374
+ inviter: ({
375
+ kind: "tier";
376
+ reward: {
377
+ id: string;
378
+ title: string;
379
+ tiers: {
380
+ id: string;
381
+ title: string;
382
+ }[];
383
+ inventory: {
384
+ kind: "untracked";
385
+ };
386
+ fulfillment: {
387
+ kind: "staff-handover";
388
+ } | {
389
+ kind: "automatic";
390
+ };
391
+ };
392
+ tier: string;
393
+ } | {
394
+ kind: "points";
395
+ balance: string;
396
+ amount: number;
397
+ })[];
398
+ invitee: ({
399
+ kind: "tier";
400
+ reward: {
401
+ id: string;
402
+ title: string;
403
+ tiers: {
404
+ id: string;
405
+ title: string;
406
+ }[];
407
+ inventory: {
408
+ kind: "untracked";
409
+ };
410
+ fulfillment: {
411
+ kind: "staff-handover";
412
+ } | {
413
+ kind: "automatic";
414
+ };
415
+ };
416
+ tier: string;
417
+ } | {
418
+ kind: "points";
419
+ balance: string;
420
+ amount: number;
421
+ })[];
422
+ };
423
+ milestones: {
424
+ id: string;
425
+ count: number;
426
+ rewards: ({
427
+ kind: "tier";
428
+ reward: {
429
+ id: string;
430
+ title: string;
431
+ tiers: {
432
+ id: string;
433
+ title: string;
434
+ }[];
435
+ inventory: {
436
+ kind: "untracked";
437
+ };
438
+ fulfillment: {
439
+ kind: "staff-handover";
440
+ } | {
441
+ kind: "automatic";
442
+ };
443
+ };
444
+ tier: string;
445
+ } | {
446
+ kind: "points";
447
+ balance: string;
448
+ amount: number;
449
+ })[];
450
+ }[];
451
+ bonuses: {
452
+ id: string;
453
+ balance: string;
454
+ basisPoints: number;
455
+ external: boolean;
456
+ quests?: string[] | undefined;
457
+ durationDays?: number | undefined;
458
+ maxPoints?: number | undefined;
459
+ }[];
460
+ key?: string | undefined;
461
+ inviterGroup?: string | undefined;
462
+ }[]>;
463
+ summary: (requestOptions?: RelayRequestOptions) => Promise<{
464
+ code: string;
465
+ attributed: number;
466
+ programs: {
467
+ definition: {
468
+ id: string;
469
+ title: string;
470
+ enabled: boolean;
471
+ qualification: {
472
+ kind: "signup";
473
+ } | {
474
+ kind: "quest";
475
+ quest: string;
476
+ } | {
477
+ kind: "external";
478
+ };
479
+ rewards: {
480
+ inviter: ({
481
+ kind: "tier";
482
+ reward: {
483
+ id: string;
484
+ title: string;
485
+ tiers: {
486
+ id: string;
487
+ title: string;
488
+ }[];
489
+ inventory: {
490
+ kind: "untracked";
491
+ };
492
+ fulfillment: {
493
+ kind: "staff-handover";
494
+ } | {
495
+ kind: "automatic";
496
+ };
497
+ };
498
+ tier: string;
499
+ } | {
500
+ kind: "points";
501
+ balance: string;
502
+ amount: number;
503
+ })[];
504
+ invitee: ({
505
+ kind: "tier";
506
+ reward: {
507
+ id: string;
508
+ title: string;
509
+ tiers: {
510
+ id: string;
511
+ title: string;
512
+ }[];
513
+ inventory: {
514
+ kind: "untracked";
515
+ };
516
+ fulfillment: {
517
+ kind: "staff-handover";
518
+ } | {
519
+ kind: "automatic";
520
+ };
521
+ };
522
+ tier: string;
523
+ } | {
524
+ kind: "points";
525
+ balance: string;
526
+ amount: number;
527
+ })[];
528
+ };
529
+ milestones: {
530
+ id: string;
531
+ count: number;
532
+ rewards: ({
533
+ kind: "tier";
534
+ reward: {
535
+ id: string;
536
+ title: string;
537
+ tiers: {
538
+ id: string;
539
+ title: string;
540
+ }[];
541
+ inventory: {
542
+ kind: "untracked";
543
+ };
544
+ fulfillment: {
545
+ kind: "staff-handover";
546
+ } | {
547
+ kind: "automatic";
548
+ };
549
+ };
550
+ tier: string;
551
+ } | {
552
+ kind: "points";
553
+ balance: string;
554
+ amount: number;
555
+ })[];
556
+ }[];
557
+ bonuses: {
558
+ id: string;
559
+ balance: string;
560
+ basisPoints: number;
561
+ external: boolean;
562
+ quests?: string[] | undefined;
563
+ durationDays?: number | undefined;
564
+ maxPoints?: number | undefined;
565
+ }[];
566
+ key?: string | undefined;
567
+ inviterGroup?: string | undefined;
568
+ };
569
+ qualified: number;
570
+ milestones: {
571
+ id: string;
572
+ count: number;
573
+ reached: boolean;
574
+ }[];
575
+ }[];
576
+ accounts: {
577
+ id: string;
578
+ program: string;
579
+ kind: "fixed" | "milestone" | "bonus";
580
+ balance: string;
581
+ earned: number;
582
+ settled: number;
583
+ outstanding: number;
584
+ }[];
585
+ }>;
586
+ /** The member's referral point history, newest first. */
587
+ history: (query?: PageQuery, requestOptions?: RelayRequestOptions) => Promise<{
588
+ items: {
589
+ id: number;
590
+ program: string;
591
+ balance: string;
592
+ amount: number;
593
+ at: number;
594
+ reason: string;
595
+ }[];
596
+ nextCursor: string | null;
597
+ }>;
598
+ accept: (value: z.input<typeof referralAcceptSchema>, requestOptions?: RelayRequestOptions) => Promise<{
599
+ ok: true;
600
+ }>;
601
+ };
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
+ };
627
+ };
628
+ earnedTier: string;
629
+ tier: string;
630
+ revision: number;
631
+ } | {
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;
640
+ id: 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;
650
+ };
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;
1115
+ } | {
1116
+ source: "generated";
1117
+ seed: string;
1118
+ };
1119
+ } | null;
1120
+ member?: string | undefined;
1121
+ } | null;
1122
+ nearby: {
1123
+ participant: string;
1124
+ name: string;
1125
+ score: number;
1126
+ rank: number;
1127
+ profile: {
1128
+ id: string;
1129
+ name: string;
1130
+ avatar: {
1131
+ source: "upload";
1132
+ url: string;
1133
+ seed: string;
1134
+ } | {
1135
+ source: "account";
1136
+ provider: "discord" | "google" | "x";
1137
+ url: string;
1138
+ seed: string;
1139
+ } | {
1140
+ source: "generated";
1141
+ seed: string;
1142
+ };
1143
+ } | null;
1144
+ member?: string | undefined;
1145
+ }[];
1146
+ nextCursor: string | null;
1147
+ }>;
1148
+ /**
1149
+ * A profile's current rank and score on `board` (`profile.id` from a leaderboard row or
1150
+ * `profiles.mine()`). Needs the board's access, like `standings`; a profile this viewer
1151
+ * cannot see is a 404, as in `profiles.get`.
1152
+ */
1153
+ placement: (board: string, profile: string, requestOptions?: RelayRequestOptions) => Promise<{
1154
+ leaderboard: string;
1155
+ title: string;
1156
+ profile: string;
1157
+ rank: number | null;
1158
+ score: number | null;
1159
+ total: number;
1160
+ key?: string | undefined;
1161
+ }>;
1162
+ };
1163
+ /**
1164
+ * Participant profiles: the display name and avatar other participants see where the project
1165
+ * enables profiles in Console. Render an avatar with `avatarSrc(profile.avatar)` from
1166
+ * `@domino-sdk/relay/avatar`.
1167
+ */
1168
+ profiles: {
1169
+ /** The signed-in member's own profile, whatever the project shows to others. */
1170
+ mine: (requestOptions?: RelayRequestOptions) => Promise<{
1171
+ id: string;
1172
+ name: string;
1173
+ avatar: {
1174
+ source: "upload";
1175
+ url: string;
1176
+ seed: string;
1177
+ } | {
1178
+ source: "account";
1179
+ provider: "discord" | "google" | "x";
1180
+ url: string;
1181
+ seed: string;
1182
+ } | {
1183
+ source: "generated";
1184
+ seed: string;
1185
+ };
1186
+ displayName: string | null;
1187
+ avatarChoice: "default" | "account" | "upload" | "generated";
1188
+ avatarProvider: "discord" | "google" | "x" | null;
1189
+ hidden: boolean;
1190
+ locked: boolean;
1191
+ visibility: "private" | "participants" | "public";
1192
+ options: {
1193
+ provider: "discord" | "google" | "x";
1194
+ name: string | null;
1195
+ imageUrl: string | null;
1196
+ }[];
1197
+ }>;
1198
+ /**
1199
+ * Changes the member's own name, avatar choice or visibility; omitted fields stay, and null
1200
+ * returns to the default.
1201
+ */
1202
+ update: (value: z.input<typeof profileUpdateSchema>, requestOptions?: RelayRequestOptions) => Promise<{
1203
+ id: string;
1204
+ name: string;
1205
+ avatar: {
1206
+ source: "upload";
1207
+ url: string;
1208
+ seed: string;
1209
+ } | {
1210
+ source: "account";
1211
+ provider: "discord" | "google" | "x";
1212
+ url: string;
1213
+ seed: string;
1214
+ } | {
1215
+ source: "generated";
1216
+ seed: string;
1217
+ };
1218
+ displayName: string | null;
1219
+ avatarChoice: "default" | "account" | "upload" | "generated";
1220
+ avatarProvider: "discord" | "google" | "x" | null;
1221
+ hidden: boolean;
1222
+ locked: boolean;
1223
+ visibility: "private" | "participants" | "public";
1224
+ options: {
1225
+ provider: "discord" | "google" | "x";
1226
+ name: string | null;
1227
+ imageUrl: string | null;
1228
+ }[];
1229
+ }>;
1230
+ /**
1231
+ * Uploads a JPEG, PNG or WebP of at most 5 MB as the member's avatar. The server crops it to
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.
1234
+ */
1235
+ uploadAvatar: (file: Blob, requestOptions?: RelayRequestOptions & {
1236
+ uploadId?: string;
1237
+ }) => Promise<{
1238
+ id: string;
1239
+ name: string;
1240
+ avatar: {
1241
+ source: "upload";
1242
+ url: string;
1243
+ seed: string;
1244
+ } | {
1245
+ source: "account";
1246
+ provider: "discord" | "google" | "x";
1247
+ url: string;
1248
+ seed: string;
1249
+ } | {
1250
+ source: "generated";
1251
+ seed: string;
1252
+ };
1253
+ displayName: string | null;
1254
+ avatarChoice: "default" | "account" | "upload" | "generated";
1255
+ avatarProvider: "discord" | "google" | "x" | null;
1256
+ hidden: boolean;
1257
+ locked: boolean;
1258
+ visibility: "private" | "participants" | "public";
1259
+ options: {
1260
+ provider: "discord" | "google" | "x";
1261
+ name: string | null;
1262
+ imageUrl: string | null;
1263
+ }[];
1264
+ }>;
1265
+ /**
1266
+ * A profile's name and avatar by its public ID (`profile.id` from a leaderboard row or
1267
+ * `mine()`). A profile that is missing, hidden or not visible to this viewer is a 404.
1268
+ */
1269
+ get: (profile: string, requestOptions?: RelayRequestOptions) => Promise<{
1270
+ id: string;
1271
+ name: string;
1272
+ avatar: {
1273
+ source: "upload";
1274
+ url: string;
1275
+ seed: string;
1276
+ } | {
1277
+ source: "account";
1278
+ provider: "discord" | "google" | "x";
1279
+ url: string;
1280
+ seed: string;
1281
+ } | {
1282
+ source: "generated";
1283
+ seed: string;
1284
+ };
1285
+ }>;
1286
+ /**
1287
+ * A page of the profile's completions of quests that show on profiles, most recently
1288
+ * completed first.
1289
+ */
1290
+ completions: (profile: string, query?: ProfileCompletionQuery, requestOptions?: RelayRequestOptions) => Promise<{
1291
+ items: {
1292
+ quest: string;
1293
+ title: string;
1294
+ completions: number;
1295
+ lastCompletedAt: number | null;
1296
+ key?: string | undefined;
1297
+ }[];
1298
+ nextCursor: string | null;
1299
+ }>;
1300
+ /**
1301
+ * The profile's invited and qualified counts and milestones in one referral program. Needs
1302
+ * a signed-in participant, as referral programs do.
1303
+ */
1304
+ referral: (profile: string, program: string, requestOptions?: RelayRequestOptions) => Promise<{
1305
+ program: string;
1306
+ title: string;
1307
+ invited: number;
1308
+ qualified: number;
1309
+ milestones: {
1310
+ id: string;
1311
+ count: number;
1312
+ reached: boolean;
1313
+ }[];
1314
+ key?: string | undefined;
1315
+ }>;
1316
+ };
1317
+ quests: {
1318
+ get: (id: string, requestOptions?: RelayRequestOptions) => Promise<{
1319
+ quest: string;
1320
+ title: string;
1321
+ presentation: {
1322
+ quiz?: {
1323
+ id: string;
1324
+ prompt: string;
1325
+ choices: {
1326
+ id: string;
1327
+ label: string;
1328
+ }[];
1329
+ }[] | undefined;
1330
+ instructions?: string | undefined;
1331
+ video?: {
1332
+ url: string;
1333
+ poster?: string | undefined;
1334
+ captions?: {
1335
+ url: string;
1336
+ language: string;
1337
+ label: string;
1338
+ } | undefined;
1339
+ } | undefined;
1340
+ };
1341
+ connections: ("discord" | "google" | "apple" | "x")[];
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
+ } | {
1364
+ kind: "automatic";
1365
+ tracker?: {
1366
+ tracker: string;
1367
+ source: string;
1368
+ on: "new-record" | "new-observation" | "data-changed";
1369
+ beneficiary: string;
1370
+ where?: {
1371
+ path: string;
1372
+ gt?: number | {
1373
+ setting: string;
1374
+ } | undefined;
1375
+ gte?: number | {
1376
+ setting: string;
1377
+ } | undefined;
1378
+ lt?: number | {
1379
+ setting: string;
1380
+ } | undefined;
1381
+ lte?: number | {
1382
+ setting: string;
1383
+ } | undefined;
1384
+ } | {
1385
+ path: string;
1386
+ equals: string | number | boolean;
1387
+ } | ({
1388
+ path: string;
1389
+ gt?: number | {
1390
+ setting: string;
1391
+ } | undefined;
1392
+ gte?: number | {
1393
+ setting: string;
1394
+ } | undefined;
1395
+ lt?: number | {
1396
+ setting: string;
1397
+ } | undefined;
1398
+ lte?: number | {
1399
+ setting: string;
1400
+ } | undefined;
1401
+ } | {
1402
+ path: string;
1403
+ equals: string | number | boolean;
1404
+ })[] | undefined;
1405
+ enrollment?: "none" | "required" | undefined;
1406
+ since?: "activation" | "window" | "enrollment" | undefined;
1407
+ historical?: "staff" | "claim" | "automatic" | undefined;
1408
+ content?: true | undefined;
1409
+ } | undefined;
1410
+ };
1411
+ availability: {
1412
+ kind: "available";
1413
+ input: "text" | "none" | "url" | "quiz" | "photo";
1414
+ } | {
1415
+ kind: "completed";
1416
+ } | {
1417
+ kind: "locked";
1418
+ missing: ({
1419
+ kind: "completion";
1420
+ quest: string;
1421
+ title: string;
1422
+ scope: "ever";
1423
+ } | {
1424
+ kind: "completion";
1425
+ quest: string;
1426
+ title: string;
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;
1445
+ } | {
1446
+ kind: "staff-required";
1447
+ } | {
1448
+ kind: "automatic";
1449
+ } | {
1450
+ kind: "checking";
1451
+ attempt: string;
1452
+ } | {
1453
+ kind: "needs-review";
1454
+ attempt: string;
1455
+ } | {
1456
+ kind: "retryable";
1457
+ attempt: string;
1458
+ };
1459
+ completed: boolean;
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
+ } | {
1478
+ kind: "streak";
1479
+ days: number;
1480
+ } | {
1481
+ kind: "once";
1482
+ } | {
1483
+ kind: "keyed";
1484
+ };
1485
+ progress: {
1486
+ current: number;
1487
+ target: number;
1488
+ reason: string;
1489
+ } | null;
1490
+ completionCount: number;
1491
+ visibility: "visible" | "hidden";
1492
+ missing: ({
1493
+ kind: "completion";
1494
+ quest: string;
1495
+ title: string;
1496
+ scope: "ever";
1497
+ } | {
1498
+ kind: "completion";
1499
+ quest: string;
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;
1537
+ }[];
1538
+ attempt: {
1539
+ id: string;
1540
+ release: string;
1541
+ quest: string;
1542
+ member: string;
1543
+ evidence: string | null;
1544
+ status: AttemptStatus;
1545
+ reason: string | null;
1546
+ retries: number;
1547
+ generation: number;
1548
+ completion: string | null;
1549
+ reviewRewards: ({
1550
+ kind: "tier";
1551
+ reward: {
1552
+ id: string;
1553
+ title: string;
1554
+ tiers: {
1555
+ id: string;
1556
+ title: string;
1557
+ }[];
1558
+ inventory: {
1559
+ kind: "untracked";
1560
+ };
1561
+ fulfillment: {
1562
+ kind: "staff-handover";
1563
+ } | {
1564
+ kind: "automatic";
1565
+ };
1566
+ };
1567
+ tier: string;
1568
+ } | {
1569
+ kind: "integration";
1570
+ provider: "discord";
1571
+ action: "grant-role";
1572
+ roleId: string;
1573
+ } | {
1574
+ kind: "points";
1575
+ balance: string;
1576
+ amount: number;
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;
1588
+ requestedReview: boolean;
1589
+ createdAt: number;
1590
+ input?: {
1591
+ kind: "text";
1592
+ value: string;
1593
+ } | {
1594
+ kind: "url";
1595
+ value: string;
1596
+ } | {
1597
+ kind: "quiz";
1598
+ answers: {
1599
+ [k: string]: string;
1600
+ };
1601
+ release?: string | undefined;
1602
+ } | undefined;
1603
+ } | null;
1604
+ release: string;
1605
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
1606
+ lifecycle: "paused" | "active" | "archived";
1607
+ rewards: ({
1608
+ kind: "points";
1609
+ label: string;
1610
+ amount: number;
1611
+ ledger: {
1612
+ id: string;
1613
+ key: string | null;
1614
+ name: string;
1615
+ };
1616
+ } | {
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;
1919
+ reward: {
1920
+ [x: string]: unknown;
1921
+ id: string;
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
+ };
1936
+ };
1937
+ earnedTier: string;
1938
+ tier: string;
1939
+ revision: number;
1940
+ } | {
1941
+ status: "unsupported";
1942
+ reportedStatus: string;
1943
+ id: string;
1944
+ member: string;
1945
+ reward: {
1946
+ [x: string]: unknown;
1947
+ id: string;
1948
+ title: string;
1949
+ tiers: {
1950
+ [x: string]: unknown;
1951
+ id: string;
1952
+ title: string;
1953
+ }[];
1954
+ inventory: {
1955
+ [x: string]: unknown;
1956
+ kind: string;
1957
+ };
1958
+ fulfillment: {
1959
+ [x: string]: unknown;
1960
+ kind: string;
1961
+ };
1962
+ };
1963
+ earnedTier: string;
1964
+ tier: string;
1965
+ revision: number;
1966
+ })[];
1967
+ member: string;
1968
+ quests: {
1969
+ quest: string;
1970
+ title: string;
1971
+ presentation: {
1972
+ quiz?: {
1973
+ id: string;
1974
+ prompt: string;
1975
+ choices: {
1976
+ id: string;
1977
+ label: string;
1978
+ }[];
1979
+ }[] | undefined;
1980
+ instructions?: string | undefined;
1981
+ video?: {
1982
+ url: string;
1983
+ poster?: string | undefined;
1984
+ captions?: {
1985
+ url: string;
1986
+ language: string;
1987
+ label: string;
1988
+ } | undefined;
1989
+ } | undefined;
1990
+ };
1991
+ connections: ("discord" | "google" | "apple" | "x")[];
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
+ } | {
2014
+ kind: "automatic";
2015
+ tracker?: {
2016
+ tracker: string;
2017
+ source: string;
2018
+ on: "new-record" | "new-observation" | "data-changed";
2019
+ beneficiary: string;
2020
+ where?: {
2021
+ path: string;
2022
+ gt?: number | {
2023
+ setting: string;
2024
+ } | undefined;
2025
+ gte?: number | {
2026
+ setting: string;
2027
+ } | undefined;
2028
+ lt?: number | {
2029
+ setting: string;
2030
+ } | undefined;
2031
+ lte?: number | {
2032
+ setting: string;
2033
+ } | undefined;
2034
+ } | {
2035
+ path: string;
2036
+ equals: string | number | boolean;
2037
+ } | ({
2038
+ path: string;
2039
+ gt?: number | {
2040
+ setting: string;
2041
+ } | undefined;
2042
+ gte?: number | {
2043
+ setting: string;
2044
+ } | undefined;
2045
+ lt?: number | {
2046
+ setting: string;
2047
+ } | undefined;
2048
+ lte?: number | {
2049
+ setting: string;
2050
+ } | undefined;
2051
+ } | {
2052
+ path: string;
2053
+ equals: string | number | boolean;
2054
+ })[] | undefined;
2055
+ enrollment?: "none" | "required" | undefined;
2056
+ since?: "activation" | "window" | "enrollment" | undefined;
2057
+ historical?: "staff" | "claim" | "automatic" | undefined;
2058
+ content?: true | undefined;
2059
+ } | undefined;
2060
+ };
2061
+ availability: {
2062
+ kind: "available";
2063
+ input: "text" | "none" | "url" | "quiz" | "photo";
2064
+ } | {
2065
+ kind: "completed";
2066
+ } | {
2067
+ kind: "locked";
2068
+ missing: ({
2069
+ kind: "completion";
2070
+ quest: string;
2071
+ title: string;
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;
2095
+ } | {
2096
+ kind: "staff-required";
2097
+ } | {
2098
+ kind: "automatic";
2099
+ } | {
2100
+ kind: "checking";
2101
+ attempt: string;
2102
+ } | {
2103
+ kind: "needs-review";
2104
+ attempt: string;
2105
+ } | {
2106
+ kind: "retryable";
2107
+ attempt: string;
2108
+ };
2109
+ completed: boolean;
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
+ } | {
2128
+ kind: "streak";
2129
+ days: number;
2130
+ } | {
2131
+ kind: "once";
2132
+ } | {
2133
+ kind: "keyed";
2134
+ };
2135
+ progress: {
2136
+ current: number;
2137
+ target: number;
2138
+ reason: string;
2139
+ } | null;
2140
+ completionCount: number;
2141
+ visibility: "visible" | "hidden";
2142
+ missing: ({
2143
+ kind: "completion";
2144
+ quest: string;
2145
+ title: string;
2146
+ scope: "ever";
2147
+ } | {
2148
+ kind: "completion";
2149
+ quest: string;
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;
2187
+ }[];
2188
+ attempt: {
2189
+ id: string;
2190
+ release: string;
2191
+ quest: string;
2192
+ member: string;
2193
+ evidence: string | null;
2194
+ status: AttemptStatus;
2195
+ reason: string | null;
2196
+ retries: number;
2197
+ generation: number;
2198
+ completion: string | null;
2199
+ reviewRewards: ({
2200
+ kind: "tier";
2201
+ reward: {
2202
+ id: string;
2203
+ title: string;
2204
+ tiers: {
2205
+ id: string;
2206
+ title: string;
2207
+ }[];
2208
+ inventory: {
2209
+ kind: "untracked";
2210
+ };
2211
+ fulfillment: {
2212
+ kind: "staff-handover";
2213
+ } | {
2214
+ kind: "automatic";
2215
+ };
2216
+ };
2217
+ tier: string;
2218
+ } | {
2219
+ kind: "integration";
2220
+ provider: "discord";
2221
+ action: "grant-role";
2222
+ roleId: string;
2223
+ } | {
2224
+ kind: "points";
2225
+ balance: string;
2226
+ amount: number;
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;
2238
+ requestedReview: boolean;
2239
+ createdAt: number;
2240
+ input?: {
2241
+ kind: "text";
2242
+ value: string;
2243
+ } | {
2244
+ kind: "url";
2245
+ value: string;
2246
+ } | {
2247
+ kind: "quiz";
2248
+ answers: {
2249
+ [k: string]: string;
2250
+ };
2251
+ release?: string | undefined;
2252
+ } | undefined;
2253
+ } | null;
2254
+ release: string;
2255
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
2256
+ lifecycle: "paused" | "active" | "archived";
2257
+ rewards: ({
2258
+ kind: "points";
2259
+ label: string;
2260
+ amount: number;
2261
+ ledger: {
2262
+ id: string;
2263
+ key: string | null;
2264
+ name: string;
2265
+ };
2266
+ } | {
2267
+ kind: "tier";
2268
+ label: string;
2269
+ reward: {
2270
+ id: string;
2271
+ key: string | null;
2272
+ title: string;
2273
+ };
2274
+ tier: string;
2275
+ } | {
2276
+ kind: "integration";
2277
+ label: string;
2278
+ })[];
2279
+ key?: string | undefined;
2280
+ streak?: {
2281
+ goal: number;
2282
+ current: number;
2283
+ best: number;
2284
+ today: string;
2285
+ todayQualified: boolean;
2286
+ timeZone: string;
2287
+ nextBoundary: number;
2288
+ pendingTimeZone: {
2289
+ timeZone: string;
2290
+ effectiveAt: number;
2291
+ } | null;
2292
+ days: {
2293
+ day: number;
2294
+ date: string;
2295
+ timeZone: string;
2296
+ occurredAt: number;
2297
+ }[];
2298
+ milestone: {
2299
+ status: "pending";
2300
+ } | {
2301
+ status: "awarded";
2302
+ completion: string;
2303
+ achievedAt: number;
2304
+ } | {
2305
+ status: "budget-exhausted";
2306
+ budget: string;
2307
+ achievedAt: number;
2308
+ };
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;
2344
+ }[];
2345
+ collections: {
2346
+ id: string;
2347
+ title: string;
2348
+ quests: {
2349
+ quest: string;
2350
+ title: string;
2351
+ presentation: {
2352
+ quiz?: {
2353
+ id: string;
2354
+ prompt: string;
2355
+ choices: {
2356
+ id: string;
2357
+ label: string;
2358
+ }[];
2359
+ }[] | undefined;
2360
+ instructions?: string | undefined;
2361
+ video?: {
2362
+ url: string;
2363
+ poster?: string | undefined;
2364
+ captions?: {
2365
+ url: string;
2366
+ language: string;
2367
+ label: string;
2368
+ } | undefined;
2369
+ } | undefined;
2370
+ };
2371
+ connections: ("discord" | "google" | "apple" | "x")[];
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
+ } | {
2394
+ kind: "automatic";
2395
+ tracker?: {
2396
+ tracker: string;
2397
+ source: string;
2398
+ on: "new-record" | "new-observation" | "data-changed";
2399
+ beneficiary: string;
2400
+ where?: {
2401
+ path: string;
2402
+ gt?: number | {
2403
+ setting: string;
2404
+ } | undefined;
2405
+ gte?: number | {
2406
+ setting: string;
2407
+ } | undefined;
2408
+ lt?: number | {
2409
+ setting: string;
2410
+ } | undefined;
2411
+ lte?: number | {
2412
+ setting: string;
2413
+ } | undefined;
2414
+ } | {
2415
+ path: string;
2416
+ equals: string | number | boolean;
2417
+ } | ({
2418
+ path: string;
2419
+ gt?: number | {
2420
+ setting: string;
2421
+ } | undefined;
2422
+ gte?: number | {
2423
+ setting: string;
2424
+ } | undefined;
2425
+ lt?: number | {
2426
+ setting: string;
2427
+ } | undefined;
2428
+ lte?: number | {
2429
+ setting: string;
2430
+ } | undefined;
2431
+ } | {
2432
+ path: string;
2433
+ equals: string | number | boolean;
2434
+ })[] | undefined;
2435
+ enrollment?: "none" | "required" | undefined;
2436
+ since?: "activation" | "window" | "enrollment" | undefined;
2437
+ historical?: "staff" | "claim" | "automatic" | undefined;
2438
+ content?: true | undefined;
2439
+ } | undefined;
2440
+ };
2441
+ availability: {
2442
+ kind: "available";
2443
+ input: "text" | "none" | "url" | "quiz" | "photo";
2444
+ } | {
2445
+ kind: "completed";
2446
+ } | {
2447
+ kind: "locked";
2448
+ missing: ({
2449
+ kind: "completion";
2450
+ quest: string;
2451
+ title: string;
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;
2475
+ } | {
2476
+ kind: "staff-required";
2477
+ } | {
2478
+ kind: "automatic";
2479
+ } | {
2480
+ kind: "checking";
2481
+ attempt: string;
2482
+ } | {
2483
+ kind: "needs-review";
2484
+ attempt: string;
2485
+ } | {
2486
+ kind: "retryable";
2487
+ attempt: string;
2488
+ };
2489
+ completed: boolean;
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
+ } | {
2508
+ kind: "streak";
2509
+ days: number;
2510
+ } | {
2511
+ kind: "once";
2512
+ } | {
2513
+ kind: "keyed";
2514
+ };
2515
+ progress: {
2516
+ current: number;
2517
+ target: number;
2518
+ reason: string;
2519
+ } | null;
2520
+ completionCount: number;
2521
+ visibility: "visible" | "hidden";
2522
+ missing: ({
2523
+ kind: "completion";
2524
+ quest: string;
2525
+ title: string;
2526
+ scope: "ever";
2527
+ } | {
2528
+ kind: "completion";
2529
+ quest: string;
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;
2567
+ }[];
2568
+ attempt: {
2569
+ id: string;
2570
+ release: string;
2571
+ quest: string;
2572
+ member: string;
2573
+ evidence: string | null;
2574
+ status: AttemptStatus;
2575
+ reason: string | null;
2576
+ retries: number;
2577
+ generation: number;
2578
+ completion: string | null;
2579
+ reviewRewards: ({
2580
+ kind: "tier";
2581
+ reward: {
2582
+ id: string;
2583
+ title: string;
2584
+ tiers: {
2585
+ id: string;
2586
+ title: string;
2587
+ }[];
2588
+ inventory: {
2589
+ kind: "untracked";
2590
+ };
2591
+ fulfillment: {
2592
+ kind: "staff-handover";
2593
+ } | {
2594
+ kind: "automatic";
2595
+ };
2596
+ };
2597
+ tier: string;
2598
+ } | {
2599
+ kind: "integration";
2600
+ provider: "discord";
2601
+ action: "grant-role";
2602
+ roleId: string;
2603
+ } | {
2604
+ kind: "points";
2605
+ balance: string;
2606
+ amount: number;
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;
2618
+ requestedReview: boolean;
2619
+ createdAt: number;
2620
+ input?: {
2621
+ kind: "text";
2622
+ value: string;
2623
+ } | {
2624
+ kind: "url";
2625
+ value: string;
2626
+ } | {
2627
+ kind: "quiz";
2628
+ answers: {
2629
+ [k: string]: string;
2630
+ };
2631
+ release?: string | undefined;
2632
+ } | undefined;
2633
+ } | null;
2634
+ release: string;
2635
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
2636
+ lifecycle: "paused" | "active" | "archived";
2637
+ rewards: ({
2638
+ kind: "points";
2639
+ label: string;
2640
+ amount: number;
2641
+ ledger: {
2642
+ id: string;
2643
+ key: string | null;
2644
+ name: string;
2645
+ };
2646
+ } | {
2647
+ kind: "tier";
2648
+ label: string;
2649
+ reward: {
2650
+ id: string;
2651
+ key: string | null;
2652
+ title: string;
2653
+ };
2654
+ tier: string;
2655
+ } | {
2656
+ kind: "integration";
2657
+ label: string;
2658
+ })[];
2659
+ key?: string | undefined;
2660
+ streak?: {
2661
+ goal: number;
2662
+ current: number;
2663
+ best: number;
2664
+ today: string;
2665
+ todayQualified: boolean;
2666
+ timeZone: string;
2667
+ nextBoundary: number;
2668
+ pendingTimeZone: {
2669
+ timeZone: string;
2670
+ effectiveAt: number;
2671
+ } | null;
2672
+ days: {
2673
+ day: number;
2674
+ date: string;
2675
+ timeZone: string;
2676
+ occurredAt: number;
2677
+ }[];
2678
+ milestone: {
2679
+ status: "pending";
2680
+ } | {
2681
+ status: "awarded";
2682
+ completion: string;
2683
+ achievedAt: number;
2684
+ } | {
2685
+ status: "budget-exhausted";
2686
+ budget: string;
2687
+ achievedAt: number;
2688
+ };
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;
2724
+ }[];
2725
+ key?: string | undefined;
2726
+ }[];
2727
+ }>;
2728
+ collection: (id: string, requestOptions?: RelayRequestOptions) => Promise<{
2729
+ id: string;
2730
+ title: string;
2731
+ quests: {
2732
+ quest: string;
2733
+ title: string;
2734
+ presentation: {
2735
+ quiz?: {
2736
+ id: string;
2737
+ prompt: string;
2738
+ choices: {
2739
+ id: string;
2740
+ label: string;
2741
+ }[];
2742
+ }[] | undefined;
2743
+ instructions?: string | undefined;
2744
+ video?: {
2745
+ url: string;
2746
+ poster?: string | undefined;
2747
+ captions?: {
2748
+ url: string;
2749
+ language: string;
2750
+ label: string;
2751
+ } | undefined;
2752
+ } | undefined;
2753
+ };
2754
+ connections: ("discord" | "google" | "apple" | "x")[];
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
+ } | {
2777
+ kind: "automatic";
2778
+ tracker?: {
2779
+ tracker: string;
2780
+ source: string;
2781
+ on: "new-record" | "new-observation" | "data-changed";
2782
+ beneficiary: string;
2783
+ where?: {
2784
+ path: string;
2785
+ gt?: number | {
2786
+ setting: string;
2787
+ } | undefined;
2788
+ gte?: number | {
2789
+ setting: string;
2790
+ } | undefined;
2791
+ lt?: number | {
2792
+ setting: string;
2793
+ } | undefined;
2794
+ lte?: number | {
2795
+ setting: string;
2796
+ } | undefined;
2797
+ } | {
2798
+ path: string;
2799
+ equals: string | number | boolean;
2800
+ } | ({
2801
+ path: string;
2802
+ gt?: number | {
2803
+ setting: string;
2804
+ } | undefined;
2805
+ gte?: number | {
2806
+ setting: string;
2807
+ } | undefined;
2808
+ lt?: number | {
2809
+ setting: string;
2810
+ } | undefined;
2811
+ lte?: number | {
2812
+ setting: string;
2813
+ } | undefined;
2814
+ } | {
2815
+ path: string;
2816
+ equals: string | number | boolean;
2817
+ })[] | undefined;
2818
+ enrollment?: "none" | "required" | undefined;
2819
+ since?: "activation" | "window" | "enrollment" | undefined;
2820
+ historical?: "staff" | "claim" | "automatic" | undefined;
2821
+ content?: true | undefined;
2822
+ } | undefined;
2823
+ };
2824
+ availability: {
2825
+ kind: "available";
2826
+ input: "text" | "none" | "url" | "quiz" | "photo";
2827
+ } | {
2828
+ kind: "completed";
2829
+ } | {
2830
+ kind: "locked";
2831
+ missing: ({
2832
+ kind: "completion";
2833
+ quest: string;
2834
+ title: string;
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;
2858
+ } | {
2859
+ kind: "staff-required";
2860
+ } | {
2861
+ kind: "automatic";
2862
+ } | {
2863
+ kind: "checking";
2864
+ attempt: string;
2865
+ } | {
2866
+ kind: "needs-review";
2867
+ attempt: string;
2868
+ } | {
2869
+ kind: "retryable";
2870
+ attempt: string;
2871
+ };
2872
+ completed: boolean;
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
+ } | {
2891
+ kind: "streak";
2892
+ days: number;
2893
+ } | {
2894
+ kind: "once";
2895
+ } | {
2896
+ kind: "keyed";
2897
+ };
2898
+ progress: {
2899
+ current: number;
2900
+ target: number;
2901
+ reason: string;
2902
+ } | null;
2903
+ completionCount: number;
2904
+ visibility: "visible" | "hidden";
2905
+ missing: ({
2906
+ kind: "completion";
2907
+ quest: string;
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;
2950
+ }[];
2951
+ attempt: {
2952
+ id: string;
2953
+ release: string;
2954
+ quest: string;
2955
+ member: string;
2956
+ evidence: string | null;
2957
+ status: AttemptStatus;
2958
+ reason: string | null;
2959
+ retries: number;
2960
+ generation: number;
2961
+ completion: string | null;
2962
+ reviewRewards: ({
2963
+ kind: "tier";
2964
+ reward: {
2965
+ id: string;
2966
+ title: string;
2967
+ tiers: {
2968
+ id: string;
2969
+ title: string;
2970
+ }[];
2971
+ inventory: {
2972
+ kind: "untracked";
2973
+ };
2974
+ fulfillment: {
2975
+ kind: "staff-handover";
2976
+ } | {
2977
+ kind: "automatic";
2978
+ };
2979
+ };
2980
+ tier: string;
2981
+ } | {
2982
+ kind: "integration";
2983
+ provider: "discord";
2984
+ action: "grant-role";
2985
+ roleId: string;
2986
+ } | {
2987
+ kind: "points";
2988
+ balance: string;
2989
+ amount: number;
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;
3001
+ requestedReview: boolean;
3002
+ createdAt: number;
3003
+ input?: {
3004
+ kind: "text";
3005
+ value: string;
3006
+ } | {
3007
+ kind: "url";
3008
+ value: string;
3009
+ } | {
3010
+ kind: "quiz";
3011
+ answers: {
3012
+ [k: string]: string;
3013
+ };
3014
+ release?: string | undefined;
3015
+ } | undefined;
3016
+ } | null;
3017
+ release: string;
3018
+ interaction: "text" | "staff" | "claim" | "automatic" | "url" | "quiz" | "photo";
3019
+ lifecycle: "paused" | "active" | "archived";
3020
+ rewards: ({
3021
+ kind: "points";
3022
+ label: string;
3023
+ amount: number;
3024
+ ledger: {
3025
+ id: string;
3026
+ key: string | null;
3027
+ name: string;
3028
+ };
3029
+ } | {
3030
+ kind: "tier";
3031
+ label: string;
3032
+ reward: {
3033
+ id: string;
3034
+ key: string | null;
3035
+ title: string;
3036
+ };
3037
+ tier: string;
3038
+ } | {
3039
+ kind: "integration";
3040
+ label: string;
3041
+ })[];
3042
+ key?: string | undefined;
3043
+ streak?: {
3044
+ goal: number;
3045
+ current: number;
3046
+ best: number;
3047
+ today: string;
3048
+ todayQualified: boolean;
3049
+ timeZone: string;
3050
+ nextBoundary: number;
3051
+ pendingTimeZone: {
3052
+ timeZone: string;
3053
+ effectiveAt: number;
3054
+ } | null;
3055
+ days: {
3056
+ day: number;
3057
+ date: string;
3058
+ timeZone: string;
3059
+ occurredAt: number;
3060
+ }[];
3061
+ milestone: {
3062
+ status: "pending";
3063
+ } | {
3064
+ status: "awarded";
3065
+ completion: string;
3066
+ achievedAt: number;
3067
+ } | {
3068
+ status: "budget-exhausted";
3069
+ budget: string;
3070
+ achievedAt: number;
3071
+ };
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;
3107
+ }[];
3108
+ key?: string | undefined;
3109
+ }>;
3110
+ open: (view: QuestView) => Promise<QuestController>;
3111
+ observe: (listener: (value: ProgressObservation<z.infer<typeof questExperienceSchema>>) => void, observeOptions?: {
3112
+ intervalMs?: number;
3113
+ maxBackoffMs?: number;
3114
+ }) => ProgressObserver;
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
+ };
3134
+ /** The signed-in member's linked Solana, EVM and Cosmos wallets for this project. */
3135
+ wallets: {
3136
+ list: (requestOptions?: RelayRequestOptions) => Promise<{
3137
+ chain: "solana" | "eip155" | "cosmos";
3138
+ network: `cosmos:${string}` | null;
3139
+ address: string;
3140
+ verifiedAt: number;
3141
+ revision: number;
3142
+ signIn: boolean;
3143
+ }[]>;
3144
+ challenge: (value: z.input<typeof walletAddressInputSchema>, requestOptions?: RelayRequestOptions) => Promise<{
3145
+ id: string;
3146
+ purpose: "link" | "sign-in";
3147
+ chain: "solana" | "eip155" | "cosmos";
3148
+ network: `cosmos:${string}` | null;
3149
+ address: string;
3150
+ message: string;
3151
+ expiresAt: number;
3152
+ }>;
3153
+ verify: (value: z.input<typeof walletSignatureSchema>, requestOptions?: RelayRequestOptions) => Promise<{
3154
+ chain: "solana" | "eip155" | "cosmos";
3155
+ network: `cosmos:${string}` | null;
3156
+ address: string;
3157
+ verifiedAt: number;
3158
+ revision: number;
3159
+ signIn: boolean;
3160
+ }>;
3161
+ /** The address stays bound to this member: another member still cannot link it. */
3162
+ unlink: (wallet: Pick<LinkedWallet, "chain" | "address">, requestOptions?: RelayRequestOptions) => Promise<{
3163
+ ok: true;
3164
+ }>;
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
+ */
3170
+ link: (signer: WalletSigner, requestOptions?: RelayRequestOptions) => Promise<{
3171
+ chain: "solana" | "eip155" | "cosmos";
3172
+ network: `cosmos:${string}` | null;
3173
+ address: string;
3174
+ verifiedAt: number;
3175
+ revision: number;
3176
+ signIn: boolean;
3177
+ }>;
3178
+ };
3179
+ auth: {
3180
+ providers: (requestOptions?: RelayRequestOptions) => Promise<{
3181
+ providers: {
3182
+ provider: "discord" | "google" | "apple" | "x";
3183
+ configured: boolean;
3184
+ }[];
3185
+ email: boolean;
3186
+ wallets: ("solana" | "eip155" | "cosmos")[];
3187
+ demo: boolean;
3188
+ }>;
3189
+ start: (provider: AuthProvider, mode: "sign-in" | "connect", requestOptions?: RelayRequestOptions) => Promise<{
3190
+ url: string;
3191
+ }>;
3192
+ emailStart: (email: string, requestOptions?: RelayRequestOptions) => Promise<{
3193
+ challenge: string;
3194
+ }>;
3195
+ emailVerify: (challenge: string, code: string, requestOptions?: RelayRequestOptions) => Promise<{
3196
+ id: string;
3197
+ principal: {
3198
+ kind: "member";
3199
+ member: string;
3200
+ } | {
3201
+ kind: "staff";
3202
+ subject: string;
3203
+ } | {
3204
+ kind: "operator";
3205
+ subject: string;
3206
+ } | {
3207
+ kind: string;
3208
+ };
3209
+ expiresAt: number;
3210
+ organization: string;
3211
+ project: string;
3212
+ environment: "test" | "live";
3213
+ }>;
3214
+ /**
3215
+ * Sign in, or sign up, with a Solana, EVM or Cosmos wallet where the project enabled it
3216
+ * (`providers().wallets`). A wallet the member linked while signed in cannot sign in.
3217
+ */
3218
+ wallet: {
3219
+ /** A sign-in challenge for the wallet's address; binds the flow to this browser. */
3220
+ start: (value: z.input<typeof walletAddressInputSchema>, requestOptions?: RelayRequestOptions) => Promise<{
3221
+ id: string;
3222
+ purpose: "link" | "sign-in";
3223
+ chain: "solana" | "eip155" | "cosmos";
3224
+ network: `cosmos:${string}` | null;
3225
+ address: string;
3226
+ message: string;
3227
+ expiresAt: number;
3228
+ }>;
3229
+ /** Verifies the signed challenge and starts the session. Not retried: start again instead. */
3230
+ verify: (proof: z.input<typeof walletSignatureSchema>, requestOptions?: RelayRequestOptions) => Promise<{
3231
+ id: string;
3232
+ principal: {
3233
+ kind: "member";
3234
+ member: string;
3235
+ } | {
3236
+ kind: "staff";
3237
+ subject: string;
3238
+ } | {
3239
+ kind: "operator";
3240
+ subject: string;
3241
+ } | {
3242
+ kind: string;
3243
+ };
3244
+ expiresAt: number;
3245
+ organization: string;
3246
+ project: string;
3247
+ environment: "test" | "live";
3248
+ }>;
3249
+ /**
3250
+ * Asks the signer for its address, signs the challenge and starts the session. Rejects with
3251
+ * an `http` `RelayError` (status 403) when the project has not enabled this wallet family.
3252
+ */
3253
+ signIn: (signer: WalletSigner, requestOptions?: RelayRequestOptions) => Promise<{
3254
+ id: string;
3255
+ principal: {
3256
+ kind: "member";
3257
+ member: string;
3258
+ } | {
3259
+ kind: "staff";
3260
+ subject: string;
3261
+ } | {
3262
+ kind: "operator";
3263
+ subject: string;
3264
+ } | {
3265
+ kind: string;
3266
+ };
3267
+ expiresAt: number;
3268
+ organization: string;
3269
+ project: string;
3270
+ environment: "test" | "live";
3271
+ }>;
3272
+ };
3273
+ /** The member's connected sign-in accounts, one per provider. */
3274
+ accounts: (requestOptions?: RelayRequestOptions) => Promise<{
3275
+ provider: "discord" | "google" | "apple" | "x";
3276
+ configured: boolean;
3277
+ status: "disconnected" | "connected" | "reconnect";
3278
+ subject: string | null;
3279
+ revision: number;
3280
+ }[]>;
3281
+ disconnect: (provider: AuthProvider, requestOptions?: RelayRequestOptions) => Promise<{
3282
+ ok: boolean;
3283
+ }>;
3284
+ session: (requestOptions?: RelayRequestOptions) => Promise<{
3285
+ id: string;
3286
+ principal: {
3287
+ kind: "member";
3288
+ member: string;
3289
+ } | {
3290
+ kind: "staff";
3291
+ subject: string;
3292
+ } | {
3293
+ kind: "operator";
3294
+ subject: string;
3295
+ } | {
3296
+ kind: string;
3297
+ };
3298
+ expiresAt: number;
3299
+ organization: string;
3300
+ project: string;
3301
+ environment: "test" | "live";
3302
+ } | null>;
3303
+ signOut: (requestOptions?: RelayRequestOptions) => Promise<{
3304
+ ok: boolean;
3305
+ }>;
3306
+ /** Local development only. Existing hosted apps use createParticipantBackend from /portal-proxy. */
3307
+ exchange: (value: z.input<typeof exchangeSchema>, requestOptions?: RelayRequestOptions) => Promise<{
3308
+ token: string;
3309
+ session: {
3310
+ id: string;
3311
+ principal: {
3312
+ kind: "member";
3313
+ member: string;
3314
+ } | {
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;
3385
+ } | {
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
+ };
3405
+ /** The signed-in member, and the seed of their generated avatar: `defaultAvatar(avatarSeed)`. */
3406
+ get: (requestOptions?: RelayRequestOptions) => Promise<{
3407
+ member: string;
3408
+ avatarSeed: string;
3409
+ }>;
3410
+ observeProgress: (listener: (value: ProgressObservation) => void, observeOptions?: {
3411
+ intervalMs?: number;
3412
+ maxBackoffMs?: number;
3413
+ }) => ProgressObserver;
3414
+ submission: {
3415
+ (quest: string, options?: {
3416
+ input: "photo";
3417
+ release?: string;
3418
+ recoverPrevious?: boolean;
3419
+ repeatable?: boolean;
3420
+ }): Promise<PhotoSubmission>;
3421
+ (quest: string, options: {
3422
+ input: "quiz";
3423
+ release?: string;
3424
+ recoverPrevious?: boolean;
3425
+ repeatable?: boolean;
3426
+ }): Promise<QuizSubmission>;
3427
+ (quest: string, options: {
3428
+ input: "none";
3429
+ release?: string;
3430
+ recoverPrevious?: boolean;
3431
+ repeatable?: boolean;
3432
+ }): Promise<ClaimSubmission>;
3433
+ (quest: string, options: {
3434
+ input: "text" | "url";
3435
+ release?: string;
3436
+ recoverPrevious?: boolean;
3437
+ repeatable?: boolean;
3438
+ }): Promise<ValueSubmission>;
3439
+ };
3440
+ collectionPass: (entitlement: string, requestOptions?: RelayRequestOptions) => Promise<{
3441
+ code: string;
3442
+ expiresAt: number;
3443
+ entitlement: string;
3444
+ }>;
3445
+ progress: (requestOptions?: RelayRequestOptions) => Promise<{
3446
+ member: string;
3447
+ quests: {
3448
+ quest: string;
3449
+ title: string;
3450
+ presentation: {
3451
+ quiz?: {
3452
+ id: string;
3453
+ prompt: string;
3454
+ choices: {
3455
+ id: string;
3456
+ label: string;
3457
+ }[];
3458
+ }[] | undefined;
3459
+ instructions?: string | undefined;
3460
+ video?: {
3461
+ url: string;
3462
+ poster?: string | undefined;
3463
+ captions?: {
3464
+ url: string;
3465
+ language: string;
3466
+ label: string;
3467
+ } | undefined;
3468
+ } | undefined;
3469
+ };
3470
+ connections: ("discord" | "google" | "apple" | "x")[];
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
+ } | {
3493
+ kind: "automatic";
3494
+ tracker?: {
3495
+ tracker: string;
3496
+ source: string;
3497
+ on: "new-record" | "new-observation" | "data-changed";
3498
+ beneficiary: string;
3499
+ where?: {
3500
+ path: string;
3501
+ gt?: number | {
3502
+ setting: string;
3503
+ } | undefined;
3504
+ gte?: number | {
3505
+ setting: string;
3506
+ } | undefined;
3507
+ lt?: number | {
3508
+ setting: string;
3509
+ } | undefined;
3510
+ lte?: number | {
3511
+ setting: string;
3512
+ } | undefined;
3513
+ } | {
3514
+ path: string;
3515
+ equals: string | number | boolean;
3516
+ } | ({
3517
+ path: string;
3518
+ gt?: number | {
3519
+ setting: string;
3520
+ } | undefined;
3521
+ gte?: number | {
3522
+ setting: string;
3523
+ } | undefined;
3524
+ lt?: number | {
3525
+ setting: string;
3526
+ } | undefined;
3527
+ lte?: number | {
3528
+ setting: string;
3529
+ } | undefined;
3530
+ } | {
3531
+ path: string;
3532
+ equals: string | number | boolean;
3533
+ })[] | undefined;
3534
+ enrollment?: "none" | "required" | undefined;
3535
+ since?: "activation" | "window" | "enrollment" | undefined;
3536
+ historical?: "staff" | "claim" | "automatic" | undefined;
3537
+ content?: true | undefined;
3538
+ } | undefined;
3539
+ };
3540
+ availability: {
3541
+ kind: "available";
3542
+ input: "text" | "none" | "url" | "quiz" | "photo";
3543
+ } | {
3544
+ kind: "completed";
3545
+ } | {
3546
+ kind: "locked";
3547
+ missing: ({
3548
+ kind: "completion";
3549
+ quest: string;
3550
+ title: string;
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;
3574
+ } | {
3575
+ kind: "staff-required";
3576
+ } | {
3577
+ kind: "automatic";
3578
+ } | {
3579
+ kind: "checking";
3580
+ attempt: string;
3581
+ } | {
3582
+ kind: "needs-review";
3583
+ attempt: string;
3584
+ } | {
3585
+ kind: "retryable";
3586
+ attempt: string;
3587
+ };
3588
+ completed: boolean;
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
+ } | {
3607
+ kind: "streak";
3608
+ days: number;
3609
+ } | {
3610
+ kind: "once";
3611
+ } | {
3612
+ kind: "keyed";
3613
+ };
3614
+ progress: {
3615
+ current: number;
3616
+ target: number;
3617
+ reason: string;
3618
+ } | null;
3619
+ completionCount: number;
3620
+ visibility: "visible" | "hidden";
3621
+ missing: ({
3622
+ kind: "completion";
3623
+ quest: string;
3624
+ title: string;
3625
+ scope: "ever";
3626
+ } | {
3627
+ kind: "completion";
3628
+ quest: string;
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;
3666
+ }[];
3667
+ attempt: {
3668
+ id: string;
3669
+ release: string;
3670
+ quest: string;
3671
+ member: string;
3672
+ evidence: string | null;
3673
+ status: AttemptStatus;
3674
+ reason: string | null;
3675
+ retries: number;
3676
+ generation: number;
3677
+ completion: string | null;
3678
+ reviewRewards: ({
3679
+ kind: "tier";
3680
+ reward: {
3681
+ id: string;
3682
+ title: string;
3683
+ tiers: {
3684
+ id: string;
3685
+ title: string;
3686
+ }[];
3687
+ inventory: {
3688
+ kind: "untracked";
3689
+ };
3690
+ fulfillment: {
3691
+ kind: "staff-handover";
3692
+ } | {
3693
+ kind: "automatic";
3694
+ };
3695
+ };
3696
+ tier: string;
3697
+ } | {
3698
+ kind: "integration";
3699
+ provider: "discord";
3700
+ action: "grant-role";
3701
+ roleId: string;
3702
+ } | {
3703
+ kind: "points";
3704
+ balance: string;
3705
+ amount: number;
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;
3717
+ requestedReview: boolean;
3718
+ createdAt: number;
3719
+ input?: {
3720
+ kind: "text";
3721
+ value: string;
3722
+ } | {
3723
+ kind: "url";
3724
+ value: string;
3725
+ } | {
3726
+ kind: "quiz";
3727
+ answers: {
3728
+ [k: string]: string;
3729
+ };
3730
+ release?: string | undefined;
3731
+ } | undefined;
3732
+ } | null;
3733
+ key?: string | undefined;
3734
+ release?: string | undefined;
3735
+ streak?: {
3736
+ goal: number;
3737
+ current: number;
3738
+ best: number;
3739
+ today: string;
3740
+ todayQualified: boolean;
3741
+ timeZone: string;
3742
+ nextBoundary: number;
3743
+ pendingTimeZone: {
3744
+ timeZone: string;
3745
+ effectiveAt: number;
3746
+ } | null;
3747
+ days: {
3748
+ day: number;
3749
+ date: string;
3750
+ timeZone: string;
3751
+ occurredAt: number;
3752
+ }[];
3753
+ milestone: {
3754
+ status: "pending";
3755
+ } | {
3756
+ status: "awarded";
3757
+ completion: string;
3758
+ achievedAt: number;
3759
+ } | {
3760
+ status: "budget-exhausted";
3761
+ budget: string;
3762
+ achievedAt: number;
3763
+ };
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;
3799
+ }[];
3800
+ entitlements: ({
3801
+ [x: string]: unknown;
3802
+ status: "available";
3803
+ id: string;
3804
+ member: string;
3805
+ reward: {
3806
+ [x: string]: unknown;
3807
+ id: string;
3808
+ title: string;
3809
+ tiers: {
3810
+ [x: string]: unknown;
3811
+ id: string;
3812
+ title: string;
3813
+ }[];
3814
+ inventory: {
3815
+ [x: string]: unknown;
3816
+ kind: string;
3817
+ };
3818
+ fulfillment: {
3819
+ [x: string]: unknown;
3820
+ kind: string;
3821
+ };
3822
+ };
3823
+ earnedTier: string;
3824
+ tier: string;
3825
+ revision: number;
3826
+ } | {
3827
+ [x: string]: unknown;
3828
+ status: "handing-over";
3829
+ handover: string;
3830
+ startedAt: number;
3831
+ id: string;
3832
+ member: string;
3833
+ reward: {
3834
+ [x: string]: unknown;
3835
+ id: string;
3836
+ title: string;
3837
+ tiers: {
3838
+ [x: string]: unknown;
3839
+ id: string;
3840
+ title: string;
3841
+ }[];
3842
+ inventory: {
3843
+ [x: string]: unknown;
3844
+ kind: string;
3845
+ };
3846
+ fulfillment: {
3847
+ [x: string]: unknown;
3848
+ kind: string;
3849
+ };
3850
+ };
3851
+ earnedTier: string;
3852
+ tier: string;
3853
+ revision: number;
3854
+ allocation?: {
3855
+ [x: string]: unknown;
3856
+ item: string;
3857
+ label: string;
3858
+ } | undefined;
3859
+ } | {
3860
+ [x: string]: unknown;
3861
+ status: "collected";
3862
+ handover: string;
3863
+ startedAt: number;
3864
+ collectedAt: number;
3865
+ id: string;
3866
+ member: string;
3867
+ reward: {
3868
+ [x: string]: unknown;
3869
+ id: string;
3870
+ title: string;
3871
+ tiers: {
3872
+ [x: string]: unknown;
3873
+ id: string;
3874
+ title: string;
3875
+ }[];
3876
+ inventory: {
3877
+ [x: string]: unknown;
3878
+ kind: string;
3879
+ };
3880
+ fulfillment: {
3881
+ [x: string]: unknown;
3882
+ kind: string;
3883
+ };
3884
+ };
3885
+ earnedTier: string;
3886
+ tier: string;
3887
+ revision: number;
3888
+ allocation?: {
3889
+ [x: string]: unknown;
3890
+ item: string;
3891
+ label: string;
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;
3952
+ })[];
3953
+ }>;
3954
+ rewardDeliveries: (requestOptions?: RelayRequestOptions) => Promise<{
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;
3981
+ id: string;
3982
+ quest: string;
3983
+ completion: string;
3984
+ member: string;
3985
+ provider: "discord";
3986
+ action: RewardDeliveryAction;
3987
+ roleId: string;
3988
+ status: "pending" | "failed" | "delivered";
3989
+ attempts: number;
3990
+ nextAt: number;
3991
+ lastError: string | null;
3992
+ createdAt: number;
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;
4028
+ }[];
4029
+ nextCursor: string | null;
4030
+ }>;
4031
+ /** Claims a quest for the signed-in member. Quest controllers (`quests.open`) call this. */
4032
+ claim: (value: Omit<z.input<typeof submitSchema>, "member">, requestOptions?: RelayRequestOptions) => Promise<{
4033
+ id: string;
4034
+ release: string;
4035
+ quest: string;
4036
+ member: string;
4037
+ evidence: string | null;
4038
+ status: AttemptStatus;
4039
+ reason: string | null;
4040
+ retries: number;
4041
+ generation: number;
4042
+ completion: string | null;
4043
+ reviewRewards: ({
4044
+ kind: "tier";
4045
+ reward: {
4046
+ id: string;
4047
+ title: string;
4048
+ tiers: {
4049
+ id: string;
4050
+ title: string;
4051
+ }[];
4052
+ inventory: {
4053
+ kind: "untracked";
4054
+ };
4055
+ fulfillment: {
4056
+ kind: "staff-handover";
4057
+ } | {
4058
+ kind: "automatic";
4059
+ };
4060
+ };
4061
+ tier: string;
4062
+ } | {
4063
+ kind: "integration";
4064
+ provider: "discord";
4065
+ action: "grant-role";
4066
+ roleId: string;
4067
+ } | {
4068
+ kind: "points";
4069
+ balance: string;
4070
+ amount: number;
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;
4082
+ requestedReview: boolean;
4083
+ createdAt: number;
4084
+ input?: {
4085
+ kind: "text";
4086
+ value: string;
4087
+ } | {
4088
+ kind: "url";
4089
+ value: string;
4090
+ } | {
4091
+ kind: "quiz";
4092
+ answers: {
4093
+ [k: string]: string;
4094
+ };
4095
+ release?: string | undefined;
4096
+ } | undefined;
4097
+ }>;
4098
+ /** Uploads a photo as the signed-in member's evidence. */
4099
+ upload: (file: Blob, requestOptions?: RelayRequestOptions) => Promise<{
4100
+ id: string;
4101
+ member: string;
4102
+ type: "image/jpeg" | "image/png";
4103
+ size: number;
4104
+ }>;
4105
+ };
4106
+ evidence: {
4107
+ download(id: string, requestOptions?: RelayRequestOptions): Promise<Blob>;
4108
+ };
4109
+ engagement: {
4110
+ /** The member's engagement settlements for one post under one rule, newest first. */
4111
+ page: (query: z.input<typeof engagementPageQuerySchema>, requestOptions?: RelayRequestOptions) => Promise<{
4112
+ rule: {
4113
+ version: string;
4114
+ definition: {
4115
+ key: string;
4116
+ qualifiedBy: string;
4117
+ balance: string;
4118
+ metrics: string[];
4119
+ baseline: "historical";
4120
+ maxAgeMs: number;
4121
+ budgets: {
4122
+ scope: "member" | "project";
4123
+ period: "lifetime" | "day" | "week" | "month";
4124
+ limit: number;
4125
+ }[];
4126
+ };
4127
+ publishedAt: number;
4128
+ };
4129
+ account: {
4130
+ member: string;
4131
+ earned: number;
4132
+ accounted: number;
4133
+ paid: number;
4134
+ excluded: number;
4135
+ pending: number;
4136
+ counters: Record<string, number>;
4137
+ baseline: Record<string, number>;
4138
+ observation: string | null;
4139
+ nextSettlementAt: number | null;
4140
+ reason: string | null;
4141
+ } | null;
4142
+ items: {
4143
+ id: string;
4144
+ day: string;
4145
+ observation: string;
4146
+ qualification: string;
4147
+ earned: number;
4148
+ growth: number;
4149
+ paid: number;
4150
+ excluded: number;
4151
+ entry: string | null;
4152
+ createdAt: number;
4153
+ }[];
4154
+ nextCursor: string | null;
4155
+ }>;
4156
+ /** The formula boundaries the member's settlements for one post crossed, newest first. */
4157
+ boundaries: (query: z.input<typeof engagementPageQuerySchema>, requestOptions?: RelayRequestOptions) => Promise<{
4158
+ current: {
4159
+ version: string;
4160
+ definition: {
4161
+ key: string;
4162
+ qualifiedBy: string;
4163
+ balance: string;
4164
+ metrics: string[];
4165
+ baseline: "historical";
4166
+ maxAgeMs: number;
4167
+ budgets: {
4168
+ scope: "member" | "project";
4169
+ period: "lifetime" | "day" | "week" | "month";
4170
+ limit: number;
4171
+ }[];
4172
+ };
4173
+ publishedAt: number;
4174
+ } | null;
4175
+ requested: {
4176
+ version: string;
4177
+ definition: {
4178
+ key: string;
4179
+ qualifiedBy: string;
4180
+ balance: string;
4181
+ metrics: string[];
4182
+ baseline: "historical";
4183
+ maxAgeMs: number;
4184
+ budgets: {
4185
+ scope: "member" | "project";
4186
+ period: "lifetime" | "day" | "week" | "month";
4187
+ limit: number;
4188
+ }[];
4189
+ };
4190
+ publishedAt: number;
4191
+ };
4192
+ items: {
4193
+ from: string;
4194
+ to: string;
4195
+ baseline: Record<string, number>;
4196
+ observedAt: number;
4197
+ settlement: {
4198
+ id: string;
4199
+ day: string;
4200
+ observation: string;
4201
+ qualification: string;
4202
+ earned: number;
4203
+ growth: number;
4204
+ paid: number;
4205
+ excluded: number;
4206
+ entry: string | null;
4207
+ createdAt: number;
4208
+ };
4209
+ }[];
4210
+ nextCursor: string | null;
4211
+ }>;
4212
+ };
4213
+ content: {
4214
+ performance: (query: z.input<typeof contentPerformanceQuerySchema>, requestOptions?: RelayRequestOptions) => Promise<{
4215
+ current: {
4216
+ state: "pending" | "superseded" | "qualified" | "unqualified" | "needs-review" | "failed" | "content-pending" | "content-unqualified" | "waiting";
4217
+ reason: string | null;
4218
+ contentAttempt: string;
4219
+ attempt: string | null;
4220
+ reward: {
4221
+ attempt: string | null;
4222
+ completion: string | null;
4223
+ state: "excluded" | "unresolved" | "awarded";
4224
+ };
4225
+ };
4226
+ items: {
4227
+ attempt: string;
4228
+ contentAttempt: string;
4229
+ observation: string;
4230
+ observedAt: number;
4231
+ metrics: Record<string, number>;
4232
+ state: "pending" | "superseded" | "qualified" | "unqualified" | "needs-review" | "failed";
4233
+ reason: string | null;
4234
+ }[];
4235
+ nextCursor: string | null;
4236
+ }>;
4237
+ qualifications: (query: z.input<typeof contentQualificationQuerySchema>, requestOptions?: RelayRequestOptions) => Promise<{
4238
+ items: {
4239
+ quest: string;
4240
+ content: string;
4241
+ member: string;
4242
+ release: string;
4243
+ attempt: string;
4244
+ revision: string;
4245
+ observation: string;
4246
+ current: boolean;
4247
+ state: "pending" | "superseded" | "qualified" | "unqualified" | "needs-review" | "failed" | "stale" | "blocked" | "unavailable";
4248
+ reason: string | null;
4249
+ reward: {
4250
+ attempt: string | null;
4251
+ completion: string | null;
4252
+ state: "excluded" | "unresolved" | "awarded";
4253
+ };
4254
+ }[];
4255
+ nextCursor: string | null;
4256
+ }>;
4257
+ };
4258
+ };
4259
+ /** The participant client `createRelayClient` returns. */
4260
+ type RelayClient = ReturnType<typeof createRelayClient>;
4261
+
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 };