@domino-sdk/relay 1.24.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{accounts-B31dWEYD.d.ts → accounts-DRPENuZe.d.ts} +1 -1
  2. package/dist/{attempt-captures-JDIgz2lY.d.ts → attempt-captures-BPMbTDYG.d.ts} +2 -2
  3. package/dist/authoring.d.ts +56 -56
  4. package/dist/authoring.js +7 -7
  5. package/dist/{automatic-outcomes-T9lEIvTj.d.ts → automatic-outcomes-CGAxTwEj.d.ts} +2 -2
  6. package/dist/avatar.d.ts +2 -2
  7. package/dist/browser.d.ts +10 -10
  8. package/dist/browser.js +10 -10
  9. package/dist/{capability-error-oTd3eYFH.d.ts → capability-error-CvSZaif2.d.ts} +1 -1
  10. package/dist/{chunk-B4EZ76WX.js → chunk-22QERRAG.js} +3 -3
  11. package/dist/{chunk-MC6V6VMG.js → chunk-4OC7REYX.js} +1 -1
  12. package/dist/{chunk-MO2FASX4.js → chunk-5FQ2BNG2.js} +1 -1
  13. package/dist/{chunk-UCZGXYCN.js → chunk-6YLULKQM.js} +10 -10
  14. package/dist/{chunk-6UFXPKLA.js → chunk-BVEWY2ZL.js} +99 -39
  15. package/dist/{chunk-MRU7GX2V.js → chunk-C3KL5SGM.js} +21 -8
  16. package/dist/{chunk-WOGCRDFT.js → chunk-CCTZIHWN.js} +1 -1
  17. package/dist/{chunk-G75JVB4D.js → chunk-DDA7G23P.js} +3 -3
  18. package/dist/{chunk-USVER53M.js → chunk-DP4YWFMY.js} +7 -0
  19. package/dist/{chunk-W33PYWYQ.js → chunk-JNBNL7FE.js} +2 -2
  20. package/dist/{chunk-AXQYGVOP.js → chunk-LPURBE7D.js} +1 -1
  21. package/dist/{chunk-GB26FIZT.js → chunk-MNL5NSC4.js} +8 -8
  22. package/dist/{chunk-JUQ2GNMD.js → chunk-PNCLJOUD.js} +2 -2
  23. package/dist/{chunk-NXWPYO6U.js → chunk-V4FGPIR3.js} +47 -16
  24. package/dist/{chunk-VT7355QN.js → chunk-VP63H7IE.js} +2 -2
  25. package/dist/{chunk-ENBQ6UEE.js → chunk-W2HGXOZ5.js} +3 -3
  26. package/dist/{chunk-E7MVYASS.js → chunk-W7PDXGYB.js} +1 -1
  27. package/dist/{chunk-PLELWE5L.js → chunk-ZLYVOLU2.js} +595 -147
  28. package/dist/{client-HG0uMG0Q.d.ts → client-D4WMWeWC.d.ts} +123 -58
  29. package/dist/{deployments-BFl_dOgc.d.ts → deployments-r5RxhZ9x.d.ts} +110 -110
  30. package/dist/{groups-CfyRewkJ.d.ts → groups-BNUhmxYY.d.ts} +26 -3
  31. package/dist/{images-DwNmzqWv.d.ts → images-PPPTL2Ct.d.ts} +2 -2
  32. package/dist/index.d.ts +13 -13
  33. package/dist/index.js +12 -10
  34. package/dist/{integrations-BMNtARU_.d.ts → integrations-CllF-kWg.d.ts} +1 -1
  35. package/dist/internal.d.ts +10 -10
  36. package/dist/internal.js +9 -9
  37. package/dist/{offers-CEwkAGsB.d.ts → offers-CdB5jnRl.d.ts} +3 -3
  38. package/dist/{pages-D1xrbGJl.d.ts → pages-BUmWkUu2.d.ts} +17 -3
  39. package/dist/{participant-activity-DYdUUhw2.d.ts → participant-activity-BPZiW7m7.d.ts} +1 -1
  40. package/dist/{participant-rewards-3duLb8YJ.d.ts → participant-rewards-BcWkBRn_.d.ts} +1 -1
  41. package/dist/portal-proxy.js +4 -4
  42. package/dist/{profiles-D29SS12z.d.ts → profiles-BHuQdzsW.d.ts} +1 -1
  43. package/dist/react/index.d.ts +13 -13
  44. package/dist/react/index.js +16 -15
  45. package/dist/{schema-D57mhL2q.d.ts → schema-lmOnv5C5.d.ts} +164 -2
  46. package/dist/schema.d.ts +380 -381
  47. package/dist/schema.js +22 -8
  48. package/dist/server/index.d.ts +10 -10
  49. package/dist/server/index.js +978 -723
  50. package/dist/{streaks-CWyq8Px5.d.ts → streaks-0YuipsUQ.d.ts} +1 -1
  51. package/dist/{submission-input-DjXg0o-r.d.ts → submission-input-DdvTz7ac.d.ts} +3 -3
  52. package/dist/{telegram-browser-DaP0Rawg.d.ts → telegram-browser-SK3KxXBL.d.ts} +13 -5
  53. package/dist/testing.d.ts +8 -8
  54. package/dist/testing.js +15 -15
  55. package/dist/{transport-M8ouWh7j.d.ts → transport-BNdKQ_m4.d.ts} +6150 -3299
  56. package/dist/{wallet-CDyo-U4n.d.ts → wallet-t7uNDg9p.d.ts} +1 -1
  57. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- import { aZ as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, a6 as engagementPageQuerySchema } from './groups-CfyRewkJ.js';
2
- import { j as QuestView, k as ResponseSchema, a as PageQuery, c as QuestEnrollmentInput, Q as QuestClaimInput, g as QuestOutcomeQuery, _ as questExperienceSchema, l as RewardDeliveryAction, F as contentQualificationQuerySchema } from './pages-D1xrbGJl.js';
3
- import { M as MissingPrerequisite, V as ValueEvidence } from './submission-input-DjXg0o-r.js';
1
+ import { b0 as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, a7 as engagementPageQuerySchema } from './groups-BNUhmxYY.js';
2
+ import { j as QuestView, k as ResponseSchema, a as PageQuery, c as QuestEnrollmentInput, Q as QuestClaimInput, g as QuestOutcomeQuery, $ as questExperienceSchema, l as RewardDeliveryAction, G as contentQualificationQuerySchema } from './pages-BUmWkUu2.js';
3
+ import { M as MissingPrerequisite, V as ValueEvidence } from './submission-input-DdvTz7ac.js';
4
4
  import { a as RequestError, b as RequestErrorDetails, c as RequestErrorKind, e as createRelayAction, O as OptionalActionId } from './action-DBzILFx9.js';
5
- import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, cg as submitSchema, be as contentPerformanceQuerySchema } from './schema-D57mhL2q.js';
6
- import { b as ParticipantSession, d as exchangeSchema, R as RelayEvent, P as ParticipantActivity } from './participant-activity-DYdUUhw2.js';
7
- import { z } from 'zod';
8
- import { a as AuthProvider } from './accounts-B31dWEYD.js';
9
- import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-D29SS12z.js';
10
- import { y as walletAddressInputSchema, I as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-CDyo-U4n.js';
5
+ import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, co as submitSchema, bj as contentPerformanceQuerySchema } from './schema-lmOnv5C5.js';
6
+ import { b as ParticipantSession, d as exchangeSchema, R as RelayEvent, P as ParticipantActivity } from './participant-activity-BPZiW7m7.js';
7
+ import * as z from 'zod';
8
+ import { a as AuthProvider } from './accounts-DRPENuZe.js';
9
+ import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-BHuQdzsW.js';
10
+ import { y as walletAddressInputSchema, I as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-t7uNDg9p.js';
11
11
 
12
12
  /** What happened, as in every Domino client error (see `RequestError`). */
13
13
  type RelayErrorKind = RequestErrorKind;
@@ -45,6 +45,11 @@ declare const RelayErrorCode: {
45
45
  readonly SubmissionStorageQuota: "submission-storage-quota";
46
46
  /** The saved submission is in a state that does not allow this action. */
47
47
  readonly SubmissionConflict: "submission-conflict";
48
+ /**
49
+ * The saved submission's operation belongs to a retired contract and cannot continue. Show the
50
+ * current quest and let the member `discard()` it before submitting again.
51
+ */
52
+ readonly OperationRetired: "operation-retired";
48
53
  /** The quest changed since the member saw it; review it before submitting again. */
49
54
  readonly QuestUpdated: "quest-updated";
50
55
  /** Wait for the deferred attempt before submitting another action. */
@@ -75,6 +80,8 @@ declare const RelayErrorCode: {
75
80
  readonly OfferOutOfStock: "offer-out-of-stock";
76
81
  /** The participant's available point balance is below the offer price. */
77
82
  readonly InsufficientPoints: "insufficient-points";
83
+ /** The client's `getToken` failed before anything was sent; `cause` is its own error. */
84
+ readonly Credential: "credential";
78
85
  /** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
79
86
  readonly WalletSigner: "wallet-signer";
80
87
  /** The member has not met the quest's prerequisites; `missing` lists them. */
@@ -135,27 +142,50 @@ type SubmissionStatus = {
135
142
  kind: "submitted";
136
143
  attempt: string;
137
144
  };
145
+ /**
146
+ * Cancellation and a deadline for one submission call, which may read the session, upload, claim
147
+ * and retry. A cancelled or timed-out call keeps its saved progress: `resume()` continues it, and
148
+ * a write already sent stays `uncertain`, as with any call.
149
+ *
150
+ * @compat input
151
+ */
152
+ type SubmissionCallOptions = {
153
+ /** Cancels the call, which rejects with a `RelayError` of kind `aborted`. */
154
+ signal?: AbortSignal;
155
+ /**
156
+ * The whole call's deadline in milliseconds, covering every request it sends. Without it each
157
+ * request has the client's `timeout`.
158
+ */
159
+ timeout?: number;
160
+ };
138
161
  type Handle = {
139
- status(): Promise<SubmissionStatus>;
140
- resume(): Promise<Attempt>;
141
- discard(): Promise<void>;
162
+ status(options?: SubmissionCallOptions): Promise<SubmissionStatus>;
163
+ resume(options?: SubmissionCallOptions): Promise<Attempt>;
164
+ discard(options?: SubmissionCallOptions): Promise<void>;
142
165
  };
166
+ /** @compat sealed */
143
167
  type PhotoSubmission = Handle & {
144
- submit(file: File): Promise<Attempt>;
168
+ submit(file: File, options?: SubmissionCallOptions): Promise<Attempt>;
145
169
  };
170
+ /** @compat sealed */
146
171
  type QuizSubmission = Handle & {
147
172
  submit(answers: QuizEvidence["answers"], options?: {
148
- release: string;
149
- }): Promise<Attempt>;
173
+ release?: string;
174
+ } & SubmissionCallOptions): Promise<Attempt>;
150
175
  };
176
+ /** @compat sealed */
151
177
  type ValueSubmission = Handle & {
152
- submit(value: string): Promise<Attempt>;
178
+ submit(value: string, options?: SubmissionCallOptions): Promise<Attempt>;
153
179
  };
180
+ /** @compat sealed */
154
181
  type ClaimSubmission = Handle & {
155
- submit(): Promise<Attempt>;
182
+ submit(options?: SubmissionCallOptions): Promise<Attempt>;
156
183
  };
157
- /** Stores structured-clone values. Writes must finish durably before resolving.
158
- * exclusive must serialize all writers to a key, including across browser tabs. */
184
+ /**
185
+ * Stores structured-clone values. Writes must finish durably before resolving. exclusive must
186
+ * serialize all writers to a key, including across browser tabs. Since Relay keeps submissions,
187
+ * the SDK only reads it to finish a submission an older SDK version saved.
188
+ */
159
189
  interface SubmissionStore {
160
190
  read(key: string): Promise<unknown>;
161
191
  write(key: string, value: unknown): Promise<void>;
@@ -190,26 +220,27 @@ type QuestActionResult = {
190
220
  originalDraft: SubmissionDraft | null;
191
221
  draft: SubmissionDraft | null;
192
222
  };
223
+ /** Each method takes `signal` and `timeout` for the whole call, as a submission handle does. */
193
224
  type ActiveController = {
194
225
  view: QuestView;
195
- status(): Promise<SubmissionStatus>;
196
- resume(): Promise<QuestActionResult>;
197
- discard(): Promise<void>;
226
+ status(options?: SubmissionCallOptions): Promise<SubmissionStatus>;
227
+ resume(options?: SubmissionCallOptions): Promise<QuestActionResult>;
228
+ discard(options?: SubmissionCallOptions): Promise<void>;
198
229
  };
199
230
  type QuestController = (ActiveController & {
200
231
  kind: "text" | "url";
201
- submit(value: string): Promise<QuestActionResult>;
232
+ submit(value: string, options?: SubmissionCallOptions): Promise<QuestActionResult>;
202
233
  }) | (ActiveController & {
203
234
  kind: "status";
204
235
  }) | (ActiveController & {
205
236
  kind: "photo";
206
- submit(file: File): Promise<QuestActionResult>;
237
+ submit(file: File, options?: SubmissionCallOptions): Promise<QuestActionResult>;
207
238
  }) | (ActiveController & {
208
239
  kind: "quiz";
209
- submit(answers: Record<string, string>): Promise<QuestActionResult>;
240
+ submit(answers: Record<string, string>, options?: SubmissionCallOptions): Promise<QuestActionResult>;
210
241
  }) | (ActiveController & {
211
242
  kind: "claim";
212
- submit(): Promise<QuestActionResult>;
243
+ submit(options?: SubmissionCallOptions): Promise<QuestActionResult>;
213
244
  });
214
245
 
215
246
  type ProgressObservation<T = MemberProgress> = {
@@ -256,7 +287,24 @@ type RelayRequestOptions = {
256
287
  /** @compat input */
257
288
  type RelayClientOptions = {
258
289
  baseUrl: string;
290
+ /** A bearer token sent with every call. Use `getToken` instead for one that changes. */
259
291
  token?: string;
292
+ /**
293
+ * Reads the bearer token before each attempt, within the call's deadline and signal; `null`
294
+ * sends none. A failure rejects the call with a `client` `RelayError` (kind `network` for a
295
+ * `TypeError`) whose code is `credential`, before anything is sent. Not with `token`.
296
+ */
297
+ getToken?: () => Promise<string | null>;
298
+ /**
299
+ * The `fetch` every call sends with, such as a test double, a proxy's or an edge runtime's own.
300
+ * Defaults to the global `fetch`.
301
+ */
302
+ fetch?: typeof fetch;
303
+ /**
304
+ * Headers sent with every call. The client's own headers (authorization, scope, session, CSRF
305
+ * and content type) replace one of the same name.
306
+ */
307
+ headers?: Record<string, string>;
260
308
  submissionStore?: SubmissionStore;
261
309
  organization?: string;
262
310
  project?: string;
@@ -267,6 +315,25 @@ type RelayClientOptions = {
267
315
  */
268
316
  timeout?: number;
269
317
  };
318
+ /**
319
+ * What `auth.start` takes: the provider, and whether to sign in (or sign up) or link it to the
320
+ * signed-in member.
321
+ *
322
+ * @compat input
323
+ */
324
+ type AuthStartInput = {
325
+ provider: AuthProvider;
326
+ mode: "sign-in" | "connect";
327
+ };
328
+ /**
329
+ * What `auth.emailVerify` takes: `emailStart`'s challenge and the code the member typed.
330
+ *
331
+ * @compat input
332
+ */
333
+ type EmailVerification = {
334
+ challenge: string;
335
+ code: string;
336
+ };
270
337
  /** @compat input */
271
338
  type RelayResponseOptions = RelayRequestOptions & {
272
339
  method?: "GET" | "POST";
@@ -338,7 +405,7 @@ declare function relayClient(options: RelayClientOptions): {
338
405
  key?: string | undefined;
339
406
  }[]>;
340
407
  /** Redeems one offer. Persist `actionId` to retry after an uncertain result. */
341
- redeem: (offer: string, input?: {
408
+ redeem: (offer: string, value?: {
342
409
  actionId?: string;
343
410
  }, requestOptions?: RelayRequestOptions) => Promise<{
344
411
  status: "fulfilled";
@@ -3397,31 +3464,21 @@ declare function relayClient(options: RelayClientOptions): {
3397
3464
  miniApp: boolean;
3398
3465
  } | undefined;
3399
3466
  }>;
3400
- start: (provider: AuthProvider, mode: "sign-in" | "connect", requestOptions?: RelayRequestOptions) => Promise<{
3401
- url: string;
3402
- }>;
3467
+ start: {
3468
+ (start: AuthStartInput, requestOptions?: RelayRequestOptions): Promise<{
3469
+ url: string;
3470
+ }>;
3471
+ (provider: AuthProvider, mode: "sign-in" | "connect", requestOptions?: RelayRequestOptions): Promise<{
3472
+ url: string;
3473
+ }>;
3474
+ };
3403
3475
  emailStart: (email: string, requestOptions?: RelayRequestOptions) => Promise<{
3404
3476
  challenge: string;
3405
3477
  }>;
3406
- emailVerify: (challenge: string, code: string, requestOptions?: RelayRequestOptions) => Promise<{
3407
- id: string;
3408
- principal: {
3409
- kind: "member";
3410
- member: string;
3411
- } | {
3412
- kind: "staff";
3413
- subject: string;
3414
- } | {
3415
- kind: "operator";
3416
- subject: string;
3417
- } | {
3418
- kind: string;
3419
- };
3420
- expiresAt: number;
3421
- organization: string;
3422
- project: string;
3423
- environment: "test" | "live";
3424
- }>;
3478
+ emailVerify: {
3479
+ (verification: EmailVerification, requestOptions?: RelayRequestOptions): Promise<ParticipantSession>;
3480
+ (challenge: string, code: string, requestOptions?: RelayRequestOptions): Promise<ParticipantSession>;
3481
+ };
3425
3482
  /**
3426
3483
  * Sign in, or sign up, with a Solana, EVM or Cosmos wallet where the project enabled it
3427
3484
  * (`providers().wallets`). A wallet the member linked while signed in cannot sign in.
@@ -3703,29 +3760,37 @@ declare function relayClient(options: RelayClientOptions): {
3703
3760
  retryMs?: number;
3704
3761
  }) => ProgressObserver;
3705
3762
  submission: {
3706
- (quest: string, options?: {
3707
- input: "photo";
3763
+ (quest: string, options?: Omit<{
3764
+ input: "photo" | "quiz" | "none" | "text" | "url";
3708
3765
  release?: string;
3709
3766
  recoverPrevious?: boolean;
3710
3767
  repeatable?: boolean;
3768
+ }, "input"> & {
3769
+ input: "photo";
3711
3770
  }): Promise<PhotoSubmission>;
3712
- (quest: string, options: {
3713
- input: "quiz";
3771
+ (quest: string, options: Omit<{
3772
+ input: "photo" | "quiz" | "none" | "text" | "url";
3714
3773
  release?: string;
3715
3774
  recoverPrevious?: boolean;
3716
3775
  repeatable?: boolean;
3776
+ }, "input"> & {
3777
+ input: "quiz";
3717
3778
  }): Promise<QuizSubmission>;
3718
- (quest: string, options: {
3719
- input: "none";
3779
+ (quest: string, options: Omit<{
3780
+ input: "photo" | "quiz" | "none" | "text" | "url";
3720
3781
  release?: string;
3721
3782
  recoverPrevious?: boolean;
3722
3783
  repeatable?: boolean;
3784
+ }, "input"> & {
3785
+ input: "none";
3723
3786
  }): Promise<ClaimSubmission>;
3724
- (quest: string, options: {
3725
- input: "text" | "url";
3787
+ (quest: string, options: Omit<{
3788
+ input: "photo" | "quiz" | "none" | "text" | "url";
3726
3789
  release?: string;
3727
3790
  recoverPrevious?: boolean;
3728
3791
  repeatable?: boolean;
3792
+ }, "input"> & {
3793
+ input: "text" | "url";
3729
3794
  }): Promise<ValueSubmission>;
3730
3795
  };
3731
3796
  collectionPass: (entitlement: string, requestOptions?: RelayRequestOptions) => Promise<{
@@ -4586,4 +4651,4 @@ declare function relayClient(options: RelayClientOptions): {
4586
4651
  interface RelayClient extends ReturnType<typeof relayClient> {
4587
4652
  }
4588
4653
 
4589
- 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 RelayResponseOptions as l, type SubmissionStatus as m, type SubmissionStore as n, createRelayClient as o, isRelayError as p };
4654
+ export { type AuthStartInput as A, type ClaimSubmission as C, type EmailVerification as E, type KnownRelayErrorCode as K, type PhotoSubmission as P, type QuestActionResult as Q, type RelayClient as R, type SubmissionCallOptions 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 RelayResponseOptions as l, type SubmissionDraft as m, type SubmissionStatus as n, type SubmissionStore as o, createRelayClient as p, isRelayError as q };