@domino-sdk/relay 1.11.1 → 1.15.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 (53) hide show
  1. package/README.md +1 -0
  2. package/build.mjs +15 -0
  3. package/dist/accounts-5ciAkCMP.d.ts +147 -0
  4. package/dist/{request-error-D_dUPLwo.d.ts → action-DBzILFx9.d.ts} +31 -1
  5. package/dist/attempt-captures-DHwIVoRP.d.ts +285 -0
  6. package/dist/authoring.d.ts +12 -10
  7. package/dist/authoring.js +6 -4
  8. package/dist/{automatic-outcomes-kPIDv6X_.d.ts → automatic-outcomes-BcEn_L46.d.ts} +1 -1
  9. package/dist/browser.d.ts +9 -9
  10. package/dist/browser.js +7 -6
  11. package/dist/capability-error-oTd3eYFH.d.ts +151 -0
  12. package/dist/chunk-2UAVZCMH.js +314 -0
  13. package/dist/{chunk-AGFUDCNM.js → chunk-3PPEXDWR.js} +1 -1
  14. package/dist/chunk-CHD6HHWG.js +485 -0
  15. package/dist/{chunk-T657WO56.js → chunk-LLMJ2SUT.js} +6 -2
  16. package/dist/chunk-NIYCAW2I.js +79 -0
  17. package/dist/{chunk-XK5E4HAS.js → chunk-PJXBW754.js} +80 -28
  18. package/dist/{chunk-PUDL4JBY.js → chunk-PUY35TH3.js} +2 -2
  19. package/dist/chunk-UJACD6K2.js +987 -0
  20. package/dist/chunk-W335CWYJ.js +53 -0
  21. package/dist/{chunk-X7ECZ3AK.js → chunk-XMBM2XD5.js} +1 -1
  22. package/dist/{chunk-2K2QBPAD.js → chunk-ZLYBUM7K.js} +6 -4
  23. package/dist/{client-fUSERMAC.d.ts → client-DFSCmf3H.d.ts} +27 -8
  24. package/dist/{activity-CNiPDPK6.d.ts → deployments-Ci6GyANg.d.ts} +15 -15
  25. package/dist/{groups-BK8ts2yK.d.ts → groups-Bi7lc54m.d.ts} +1 -1
  26. package/dist/{images-aw6W7vFZ.d.ts → images-Cb8QHGjn.d.ts} +1 -1
  27. package/dist/index.d.ts +10 -10
  28. package/dist/index.js +8 -6
  29. package/dist/{capability-error-ty3SqD_b.d.ts → integrations-Cr9EhGI_.d.ts} +1 -149
  30. package/dist/internal.d.ts +11 -4
  31. package/dist/internal.js +8 -3
  32. package/dist/{offers-C2FANzrG.d.ts → offers-Catj06u7.d.ts} +2 -2
  33. package/dist/{pages-Chb6OZSB.d.ts → pages-CpYt56Km.d.ts} +1 -1
  34. package/dist/{participant-activity-DkL3nY5a.d.ts → participant-activity-DYdUUhw2.d.ts} +1 -0
  35. package/dist/portal-proxy.js +1 -1
  36. package/dist/react/index.d.ts +247 -179
  37. package/dist/react/index.js +954 -383
  38. package/dist/{schema-DEM8y8Fm.d.ts → schema-BaVl2VBS.d.ts} +1 -1
  39. package/dist/schema.d.ts +15 -13
  40. package/dist/schema.js +16 -14
  41. package/dist/server/index.d.ts +12 -70916
  42. package/dist/server/index.js +594 -841
  43. package/dist/{sign-in-options-iWOp9puZ.d.ts → sign-in-options-CU1ND6-y.d.ts} +2 -2
  44. package/dist/submission-input-Bi4HipqI.d.ts +146 -0
  45. package/dist/testing.d.ts +641 -0
  46. package/dist/testing.js +1282 -0
  47. package/dist/transport-0ttRwUat.d.ts +73361 -0
  48. package/package.json +6 -2
  49. package/dist/action-9Xl0StBg.d.ts +0 -33
  50. package/dist/chunk-OCXGG75K.js +0 -171
  51. package/dist/chunk-ZFABFKIY.js +0 -1295
  52. package/dist/referral-reward-kinds-M3f0PdiR.d.ts +0 -171
  53. package/dist/submission-input-BbBJTVlT.d.ts +0 -290
@@ -1,20 +1,20 @@
1
- import { b as ParticipantSession, R as RelayEvent, P as ParticipantActivity, M as MemberSummary } from '../participant-activity-DkL3nY5a.js';
2
- import { g as RelayError, R as RelayClient, S as SubmissionDraft } from '../client-fUSERMAC.js';
3
- import { P as Page, j as QuestView, g as QuestOutcomeQuery, e as QuestOutcome } from '../pages-Chb6OZSB.js';
1
+ import { b as ParticipantSession, R as RelayEvent, P as ParticipantActivity, M as MemberSummary } from '../participant-activity-DYdUUhw2.js';
2
+ import { g as RelayError, R as RelayClient, S as SubmissionDraft } from '../client-DFSCmf3H.js';
3
+ import { P as Page, j as QuestView, g as QuestOutcomeQuery, e as QuestOutcome } from '../pages-CpYt56Km.js';
4
4
  import * as react from 'react';
5
5
  import { ReactNode } from 'react';
6
6
  import { J as JSONType } from '../util.d-w9f9t3ua.js';
7
- import { E as Entitlement, a as AttemptStatus, T as TieredRewardReference } from '../schema-DEM8y8Fm.js';
8
- import { a as AuthProvider, A as AccountConnection } from '../submission-input-BbBJTVlT.js';
9
- import { c as SignInMethods, C as CosmosChains, d as SignInOption, f as SignInUnavailable, g as SignInWallet, D as DiscoveredWallet } from '../sign-in-options-iWOp9puZ.js';
10
- export { a as EmailSignInOption, O as OAuthSignInOption, b as SignInIcon, W as WalletSignInOption } from '../sign-in-options-iWOp9puZ.js';
7
+ import { E as Entitlement, a as AttemptStatus, T as TieredRewardReference } from '../schema-BaVl2VBS.js';
8
+ import { a as AuthProvider, A as AccountConnection } from '../accounts-5ciAkCMP.js';
9
+ import { c as SignInMethods, C as CosmosChains, d as SignInOption, f as SignInUnavailable, g as SignInWallet, D as DiscoveredWallet } from '../sign-in-options-CU1ND6-y.js';
10
+ export { a as EmailSignInOption, O as OAuthSignInOption, b as SignInIcon, W as WalletSignInOption } from '../sign-in-options-CU1ND6-y.js';
11
11
  import { f as WalletSigner, d as WalletSignInNetwork, L as LinkedWallet } from '../wallet-CDyo-U4n.js';
12
- import { f as LeaderboardPlacement, b7 as referralSummarySchema, e as LeaderboardPage, i as PointBalances, j as PointEntry, n as PointLedgerReference } from '../groups-BK8ts2yK.js';
12
+ import { f as LeaderboardPlacement, b7 as referralSummarySchema, e as LeaderboardPage, i as PointBalances, j as PointEntry, n as PointLedgerReference } from '../groups-Bi7lc54m.js';
13
13
  import { f as ProfileUpdate, e as ProfileSummary, a as ProfileCompletion, d as ProfileReferral } from '../profiles-BHMVj0kM.js';
14
14
  import { z } from 'zod';
15
- import { O as Offer } from '../offers-C2FANzrG.js';
16
- import '../request-error-D_dUPLwo.js';
17
- import '../action-9Xl0StBg.js';
15
+ import { O as Offer, c as Redemption } from '../offers-Catj06u7.js';
16
+ import '../submission-input-Bi4HipqI.js';
17
+ import '../action-DBzILFx9.js';
18
18
 
19
19
  /**
20
20
  * A query's identity: plain JSON values, outermost group first, such as
@@ -62,8 +62,43 @@ type QueryOptions = {
62
62
  intervalMs?: number;
63
63
  /** Read again when the window regains focus. */
64
64
  refetchOnFocus?: boolean;
65
+ /**
66
+ * `false` reads nothing, and the query stays `loading` (or shows `initialData`) until it is
67
+ * enabled: for a read that waits on another value. A `null` key does the same.
68
+ */
69
+ enabled?: boolean;
70
+ /**
71
+ * How long a value stays fresh: a component that shows it again after nobody did for this long
72
+ * reads it again. Default 30000 ms; `Infinity` never reads again on its account.
73
+ */
74
+ staleMs?: number;
65
75
  };
66
76
 
77
+ /** What `useMemberQuery` also takes: `select` and `suspense`. */
78
+ type MemberQueryOptions<T, U = T> = QueryOptions & {
79
+ /**
80
+ * Derives what the hook returns from the cached value, which stays shared with every component
81
+ * that reads the same key. Pass a stable function: a new one derives again.
82
+ */
83
+ select?: (data: T) => U;
84
+ /**
85
+ * Suspends the component until the first value arrives, for a `<Suspense>` boundary to show its
86
+ * fallback, and throws a failed first read to the nearest error boundary. To try again from the
87
+ * boundary, `invalidate([key])` before resetting it: the failed value is forgotten and the next
88
+ * render reads afresh. A `signed-out` member query returns as usual. On the server, without
89
+ * `initialData`, it throws so that React renders the boundary in the browser instead.
90
+ */
91
+ suspense?: boolean;
92
+ };
93
+ /** What `useRelayQuery` also takes: `initialData`, `select` and `suspense`. */
94
+ type RelayQueryOptions<T, U = T> = MemberQueryOptions<T, U> & {
95
+ /**
96
+ * A value to show before the first read, such as one read during server rendering: it renders
97
+ * on the server and while hydrating, and counts as fresh for `staleMs`. It seeds the cache of
98
+ * the first participant the provider learns of; another participant's cache starts empty.
99
+ */
100
+ initialData?: T | (() => T);
101
+ };
67
102
  /** What every read hook returns: `{ status, data, error, refresh }`. */
68
103
  type Query<T> = QuerySnapshot<T> & {
69
104
  /** Reads again now, replacing a read in flight. Never rejects: a failure lands in `error`. */
@@ -105,22 +140,33 @@ type PageRead<T> = (context: QueryContext & {
105
140
  * relay.leaderboards.list(options)
106
141
  * )
107
142
  * ```
143
+ *
144
+ * A `null` key, or `enabled: false`, reads nothing until the value it depends on is known:
145
+ * `useRelayQuery(board ? ["leaderboards", board] : null, ...)`. `initialData`, `select`,
146
+ * `staleMs` and `suspense` are described on `RelayQueryOptions`.
108
147
  */
109
- declare function useRelayQuery<T>(key: QueryKey, read: QueryRead<T>, options?: QueryOptions): Query<T>;
148
+ declare function useRelayQuery<T>(key: QueryKey | null, read: QueryRead<T>, options?: RelayQueryOptions<T>): Query<T>;
149
+ declare function useRelayQuery<T, U>(key: QueryKey | null, read: QueryRead<T>, options: RelayQueryOptions<T, U> & {
150
+ select: (data: T) => U;
151
+ }): Query<U>;
110
152
  /**
111
153
  * `useRelayQuery` for reads that need a signed-in member. Nothing is read while nobody is signed
112
- * in, and `status` is then `signed-out`.
154
+ * in, and `status` is then `signed-out`. Takes the same options except `initialData`: a member's
155
+ * values come only from reads made with their session.
113
156
  */
114
- declare function useMemberQuery<T>(key: QueryKey, read: QueryRead<T>, options?: QueryOptions): MemberQuery<T>;
157
+ declare function useMemberQuery<T>(key: QueryKey | null, read: QueryRead<T>, options?: MemberQueryOptions<T>): MemberQuery<T>;
158
+ declare function useMemberQuery<T, U>(key: QueryKey | null, read: QueryRead<T>, options: MemberQueryOptions<T, U> & {
159
+ select: (data: T) => U;
160
+ }): MemberQuery<U>;
115
161
  /**
116
162
  * A paged read (`{ cursor }` in, `{ items, nextCursor }` out) as one growing list, for pages a
117
163
  * signed-out visitor can read too. `refresh()` and an invalidation start again from the first
118
164
  * page; a page that arrives after that, or for another key or participant, is dropped rather than
119
- * appended.
165
+ * appended. A `null` key, or `enabled: false`, reads nothing.
120
166
  */
121
- declare function useRelayPages<T>(key: QueryKey, read: PageRead<T>, options?: QueryOptions): PagedQuery<T>;
167
+ declare function useRelayPages<T>(key: QueryKey | null, read: PageRead<T>, options?: QueryOptions): PagedQuery<T>;
122
168
  /** `useRelayPages` for pages that need a signed-in member: `signed-out` while nobody is. */
123
- declare function useMemberPages<T>(key: QueryKey, read: PageRead<T>, options?: QueryOptions): MemberPagedQuery<T>;
169
+ declare function useMemberPages<T>(key: QueryKey | null, read: PageRead<T>, options?: QueryOptions): MemberPagedQuery<T>;
124
170
  /**
125
171
  * Marks cached reads out of date after a change. Each key is a prefix: `[["leaderboards"]]`
126
172
  * reads every leaderboard on screen again and forgets the rest. With no keys, everything.
@@ -129,6 +175,13 @@ declare function useMemberPages<T>(key: QueryKey, read: PageRead<T>, options?: Q
129
175
  * `["experience"]` reads the quest experience again.
130
176
  */
131
177
  declare function useInvalidate(): (keys?: QueryKey[]) => Promise<void>;
178
+ /**
179
+ * Changes a cached value at once, such as an optimistic update before a change answers: pass the
180
+ * new value, or a function of the current one (`undefined` before the first read). A read in
181
+ * flight for the key is cancelled, so it cannot overwrite the change; invalidate the key once the
182
+ * change settles to read the real value. Returns false, changing nothing, for a key nobody reads.
183
+ */
184
+ declare function useSetQueryData(): <T>(key: QueryKey, update: T | ((current: T | undefined) => T)) => boolean;
132
185
  /**
133
186
  * Who is signed in: the session (`data`, null for a signed-out visitor) and its `member`.
134
187
  * Independent of the quest experience: a failing experience read signs nobody out.
@@ -145,25 +198,96 @@ declare function useActivity(options?: {
145
198
  intervalMs?: number;
146
199
  }): MemberQuery<ParticipantActivity>;
147
200
 
201
+ /**
202
+ * How a `run` or `retry` ended. A failure carries its `error`, except when the call was refused
203
+ * because another one was still running.
204
+ */
148
205
  type RelayActionResult<T> = {
149
206
  ok: true;
150
207
  value: T;
151
208
  } | {
152
209
  ok: false;
210
+ error?: RelayError;
153
211
  };
212
+ /** Where a change stands: not started (or reset), running, done, or failed. */
213
+ type MutationStatus = "idle" | "pending" | "success" | "error";
154
214
  /**
155
215
  * One logical mutation at a time, with a key and exact callback retained across uncertain errors.
156
216
  * `run` and `retry` never reject; their result distinguishes success from failure, including a
157
217
  * successful null value. A failure appears in `error`. Pass a client or
158
218
  * session as `scope` to isolate actions when the signed-in member or project changes.
219
+ *
220
+ * `status`, `isPending` and `data` follow the latest call. `reset()` clears them and `error`, except
221
+ * while an uncertain write is retained: the next `run` replays it, and only `settle()` forgets it.
159
222
  */
160
223
  declare function useRelayAction<T = unknown>(scope?: unknown): {
161
224
  run: (task?: (actionId: string) => Promise<T>) => Promise<RelayActionResult<T>>;
162
225
  retry: () => Promise<RelayActionResult<T>>;
163
226
  settle: () => boolean;
227
+ reset: () => void;
228
+ status: MutationStatus;
229
+ isPending: boolean;
230
+ data: T | undefined;
231
+ error: RelayError | null;
232
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
164
233
  busy: boolean;
234
+ };
235
+
236
+ /** What a mutation's function receives besides its variables. */
237
+ type MutationContext = {
238
+ /** The change's idempotency key. It stays the same when an uncertain change is replayed. */
239
+ actionId: string;
240
+ /** The session the cache belongs to: pass it on, so Relay refuses the change for another one. */
241
+ session: string | undefined;
242
+ };
243
+ /**
244
+ * What every mutation hook returns. One change runs at a time, under one key: after an uncertain
245
+ * failure (Relay may have applied it), `mutate` replays that same change with its key instead of
246
+ * starting another, and `error.recovery` says whether a replay is safe. `settle()` forgets it once
247
+ * you have confirmed the outcome another way.
248
+ */
249
+ type Mutation<TData, TVariables = void> = {
250
+ /** Starts the change. Never rejects: a failure lands in `error`. */
251
+ mutate(variables: TVariables): void;
252
+ /** Starts the change and resolves what it returned, or rejects with the `RelayError`. */
253
+ mutateAsync(variables: TVariables): Promise<TData>;
254
+ status: MutationStatus;
255
+ /** True while the change runs. */
256
+ isPending: boolean;
257
+ /** What the last change returned, once it succeeded. */
258
+ data: TData | undefined;
259
+ /** Why the last change failed, until the next one starts or `reset()`. */
165
260
  error: RelayError | null;
261
+ /**
262
+ * Clears `status`, `data` and `error`, as before the first change. Does nothing while a change
263
+ * runs, or while an uncertain one is retained (see `settle()`).
264
+ */
265
+ reset(): void;
266
+ /** Forgets a retained uncertain change once its outcome is known. Refuses (false) while busy. */
267
+ settle(): boolean;
268
+ };
269
+ type MutationOptions<TData, TVariables> = {
270
+ /**
271
+ * The cached reads the change makes out of date, read again after it succeeds and before
272
+ * `mutateAsync` resolves: keys (prefixes, as for `useInvalidate`) or a function of the result.
273
+ */
274
+ invalidates?: QueryKey[] | ((data: TData, variables: TVariables) => QueryKey[]);
166
275
  };
276
+ /**
277
+ * A change through the participant client, for writes no hook covers, with the same shape as the
278
+ * SDK's mutation hooks. `mutation` receives the variables and `{ actionId, session }`: pass the
279
+ * key as the write's `actionId` and the session in its request options.
280
+ *
281
+ * ```tsx
282
+ * const accept = useRelayMutation(
283
+ * (code: string, { actionId, session }) =>
284
+ * relay.referrals.accept({ code, actionId }, { session }),
285
+ * { invalidates: [relayKeys.referrals] }
286
+ * )
287
+ * accept.mutate(code)
288
+ * ```
289
+ */
290
+ declare function useRelayMutation<TData = unknown, TVariables = void>(mutation: (variables: TVariables, context: MutationContext) => Promise<TData>, options?: MutationOptions<TData, TVariables>): Mutation<TData, TVariables>;
167
291
 
168
292
  type Collection = {
169
293
  id: string;
@@ -186,20 +310,38 @@ type ExperienceData = {
186
310
  */
187
311
  declare function questGroups(experience: Pick<ExperienceData, "quests" | "collections">, order?: string[]): Collection[];
188
312
 
313
+ /** How often `RelayProvider` reads for changes. */
314
+ type RelayPolling = {
315
+ /** How often the signed-in member's activity feed is read for new events. Default 5000 ms. */
316
+ activityMs?: number;
317
+ /**
318
+ * How often the whole quest experience is read again, for changes no event announces (a quest
319
+ * published or opening) and in case the feed is missing or failing. Default 30000 ms.
320
+ */
321
+ snapshotMs?: number;
322
+ };
323
+
189
324
  /** The participant client, for calls no hook covers. */
190
325
  declare function useRelay(): RelayClient;
191
326
 
192
327
  /**
193
- * One participant client, one quest observer and one query cache for the whole app.
328
+ * One participant client, one activity feed, one quest observer and one query cache for the whole
329
+ * app.
194
330
  *
195
331
  * `baseUrl` defaults to `/relay`, the participant proxy that `domino dev` and Domino hosting
196
332
  * provide. Pass `client` to share a client created elsewhere. A new `client` or `baseUrl` takes
197
333
  * effect at once: the old observer stops, reads in flight are cancelled, and the hooks start again
198
334
  * from an empty cache. Safe to render on the server; nothing is read until it mounts.
335
+ *
336
+ * While a member is signed in, the provider reads their activity feed every `polling.activityMs`
337
+ * (5 seconds) and reads again only the queries each event changes. It reads the whole quest
338
+ * experience every `polling.snapshotMs` (30 seconds), for changes no event announces and as the
339
+ * fallback when the feed is unavailable. A new `polling` value takes effect like a new client.
199
340
  */
200
- declare function RelayProvider({ client, baseUrl, children, }: {
341
+ declare function RelayProvider({ client, baseUrl, polling, children, }: {
201
342
  client?: RelayClient;
202
343
  baseUrl?: string;
344
+ polling?: RelayPolling;
203
345
  children: ReactNode;
204
346
  }): react.JSX.Element;
205
347
 
@@ -239,7 +381,10 @@ declare const relayKeys: {
239
381
  readonly offers: readonly ["offers"];
240
382
  };
241
383
 
242
- /** Earned tiers and pickup/collection state, scoped to the current session. */
384
+ /**
385
+ * Earned tiers and pickup/collection state, scoped to the current session. Read again when the
386
+ * activity feed reports a tier granted or collected, and every 30 seconds.
387
+ */
243
388
  declare function useEntitlements(options?: QueryOptions): MemberQuery<{
244
389
  items: ({
245
390
  [x: string]: unknown;
@@ -395,7 +540,11 @@ declare function useEntitlements(options?: QueryOptions): MemberQuery<{
395
540
  revision: number;
396
541
  })[];
397
542
  }>;
398
- /** Points, tier entitlements and integration deliveries, including reversed or revoked rewards. */
543
+ /**
544
+ * Points, tier entitlements and integration deliveries, including reversed or revoked rewards.
545
+ * Read again when the activity feed reports points, a tier or a delivery change, and every 30
546
+ * seconds.
547
+ */
399
548
  declare function useDeliveries(options?: QueryOptions): MemberQuery<{
400
549
  items: ({
401
550
  [x: string]: JSONType;
@@ -1059,6 +1208,9 @@ declare function useQuest(observed: QuestView): {
1059
1208
  draft: SubmissionDraft | null;
1060
1209
  notice: QuestNotice;
1061
1210
  error: RelayError | null;
1211
+ /** True while `submit`, `resume`, `retry` or `restart` runs. */
1212
+ isPending: boolean;
1213
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1062
1214
  busy: boolean;
1063
1215
  saved: SavedSubmission;
1064
1216
  /** Review and explicitly restart this terminally retired saved submission. */
@@ -1172,11 +1324,17 @@ declare function useSignInMethods(): Query<SignInMethods>;
1172
1324
  declare function useMe(): MemberQuery<MemberSummary>;
1173
1325
  /**
1174
1326
  * Email codes, OAuth consent and wallet signatures always happen in the participant's browser.
1175
- * The actions keep their identity across renders, and never reject: a failure lands in `error`.
1327
+ * The actions keep their identity across renders, and never reject: a failure lands in `error`,
1328
+ * and `isPending` is true while one runs.
1176
1329
  */
1177
1330
  declare function useSignIn(): {
1331
+ /** True while a sign-in action runs. */
1332
+ isPending: boolean;
1333
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1178
1334
  busy: boolean;
1179
1335
  error: RelayError | null;
1336
+ /** Clears `error`, keeping a code already sent. */
1337
+ reset: () => void;
1180
1338
  /** True once a code was sent and the form should ask for it. */
1181
1339
  codeSent: boolean;
1182
1340
  sendCode: (email: string) => Promise<void>;
@@ -1187,13 +1345,16 @@ declare function useSignIn(): {
1187
1345
  withWallet: (signer: WalletSigner) => Promise<void>;
1188
1346
  };
1189
1347
  /**
1190
- * Signs the participant out. Once Relay confirms, the previous member's cached values are gone and
1191
- * the member hooks report `signed-out`. `signOut` keeps its identity across renders, and rejects
1192
- * when Relay could not sign out.
1348
+ * Signs the participant out: `mutate()`, which never rejects, or `mutateAsync()`, which rejects
1349
+ * when Relay could not sign out; a failure lands in `error`. Once Relay confirms, the previous
1350
+ * member's cached values are gone and the member hooks report `signed-out`; the hook's `status`
1351
+ * starts over at `idle` then, as changes belong to the participant they started for.
1193
1352
  */
1194
- declare function useSignOut(): {
1353
+ declare function useSignOut(): Mutation<void> & {
1354
+ /** @deprecated Use `mutateAsync`, which rejects the same way, or `mutate`. Removed in 2.0.0. */
1355
+ signOut(): Promise<void>;
1356
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1195
1357
  busy: boolean;
1196
- signOut: () => Promise<void>;
1197
1358
  };
1198
1359
  /**
1199
1360
  * Every way a participant can sign in here, as one flat list: the OAuth providers and email Domino
@@ -1219,9 +1380,14 @@ declare function useSignInOptions(input?: {
1219
1380
  unavailable: SignInUnavailable[];
1220
1381
  /** Why the project's methods could not be read; the options are then email alone. */
1221
1382
  methodsError: RelayError | null;
1383
+ /** True while a sign-in action runs. */
1384
+ isPending: boolean;
1385
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1222
1386
  busy: boolean;
1223
1387
  /** Why the last sign-in action failed. */
1224
1388
  error: RelayError | null;
1389
+ /** Clears `error`, keeping an email code already sent. */
1390
+ reset(): void;
1225
1391
  /** True once an email code was sent and the form should ask for it. */
1226
1392
  codeSent: boolean;
1227
1393
  /** Forgets the email code sent, to use another address. */
@@ -1236,14 +1402,17 @@ declare function isConnected(accounts: AccountConnection[] | null | undefined, p
1236
1402
  * Connecting leaves the page for the provider's consent screen and comes back
1237
1403
  * connected. The list is read again when the window regains focus and after
1238
1404
  * a disconnect, in every component that uses it. `connect` and `disconnect`
1239
- * never reject: they resolve whether they succeeded, and a failure lands in
1240
- * `actionError`.
1405
+ * never reject: they resolve whether they succeeded, `isPending` is true while
1406
+ * one runs, and a failure lands in `actionError` until `resetAction()`.
1241
1407
  */
1242
1408
  declare function useAccounts(): {
1243
1409
  connect: (provider: AuthProvider) => Promise<boolean>;
1244
1410
  disconnect: (provider: AuthProvider) => Promise<boolean>;
1411
+ isPending: boolean;
1412
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1245
1413
  busy: boolean;
1246
1414
  actionError: RelayError | null;
1415
+ resetAction: () => void;
1247
1416
  retry: () => Promise<boolean>;
1248
1417
  settle: () => boolean;
1249
1418
  isConnected: (provider: AuthProvider) => boolean;
@@ -1254,8 +1423,11 @@ declare function useAccounts(): {
1254
1423
  } | {
1255
1424
  connect: (provider: AuthProvider) => Promise<boolean>;
1256
1425
  disconnect: (provider: AuthProvider) => Promise<boolean>;
1426
+ isPending: boolean;
1427
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1257
1428
  busy: boolean;
1258
1429
  actionError: RelayError | null;
1430
+ resetAction: () => void;
1259
1431
  retry: () => Promise<boolean>;
1260
1432
  settle: () => boolean;
1261
1433
  isConnected: (provider: AuthProvider) => boolean;
@@ -1266,8 +1438,11 @@ declare function useAccounts(): {
1266
1438
  } | {
1267
1439
  connect: (provider: AuthProvider) => Promise<boolean>;
1268
1440
  disconnect: (provider: AuthProvider) => Promise<boolean>;
1441
+ isPending: boolean;
1442
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1269
1443
  busy: boolean;
1270
1444
  actionError: RelayError | null;
1445
+ resetAction: () => void;
1271
1446
  retry: () => Promise<boolean>;
1272
1447
  settle: () => boolean;
1273
1448
  isConnected: (provider: AuthProvider) => boolean;
@@ -1278,8 +1453,11 @@ declare function useAccounts(): {
1278
1453
  } | {
1279
1454
  connect: (provider: AuthProvider) => Promise<boolean>;
1280
1455
  disconnect: (provider: AuthProvider) => Promise<boolean>;
1456
+ isPending: boolean;
1457
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1281
1458
  busy: boolean;
1282
1459
  actionError: RelayError | null;
1460
+ resetAction: () => void;
1283
1461
  retry: () => Promise<boolean>;
1284
1462
  settle: () => boolean;
1285
1463
  isConnected: (provider: AuthProvider) => boolean;
@@ -1301,14 +1479,18 @@ declare function useAccounts(): {
1301
1479
  * Linking asks the wallet to sign a one-time message. The list is read again
1302
1480
  * when the window regains focus and after a link or unlink, in every component
1303
1481
  * that uses it. `link` and `unlink` never reject: they resolve whether they
1304
- * succeeded, and a failure lands in `actionError`.
1482
+ * succeeded, `isPending` is true while one runs, and a failure lands in
1483
+ * `actionError` until `resetAction()`.
1305
1484
  */
1306
1485
  declare function useWallets(): {
1307
1486
  /** Links the wallet to the member the list was read for; another session is refused. */
1308
1487
  link: (signer: WalletSigner) => Promise<boolean>;
1309
1488
  unlink: (wallet: Pick<LinkedWallet, "chain" | "address">) => Promise<boolean>;
1489
+ isPending: boolean;
1490
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1310
1491
  busy: boolean;
1311
1492
  actionError: RelayError | null;
1493
+ resetAction: () => void;
1312
1494
  retry: () => Promise<boolean>;
1313
1495
  settle: () => boolean;
1314
1496
  status: "loading";
@@ -1319,8 +1501,11 @@ declare function useWallets(): {
1319
1501
  /** Links the wallet to the member the list was read for; another session is refused. */
1320
1502
  link: (signer: WalletSigner) => Promise<boolean>;
1321
1503
  unlink: (wallet: Pick<LinkedWallet, "chain" | "address">) => Promise<boolean>;
1504
+ isPending: boolean;
1505
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1322
1506
  busy: boolean;
1323
1507
  actionError: RelayError | null;
1508
+ resetAction: () => void;
1324
1509
  retry: () => Promise<boolean>;
1325
1510
  settle: () => boolean;
1326
1511
  status: "error";
@@ -1331,8 +1516,11 @@ declare function useWallets(): {
1331
1516
  /** Links the wallet to the member the list was read for; another session is refused. */
1332
1517
  link: (signer: WalletSigner) => Promise<boolean>;
1333
1518
  unlink: (wallet: Pick<LinkedWallet, "chain" | "address">) => Promise<boolean>;
1519
+ isPending: boolean;
1520
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1334
1521
  busy: boolean;
1335
1522
  actionError: RelayError | null;
1523
+ resetAction: () => void;
1336
1524
  retry: () => Promise<boolean>;
1337
1525
  settle: () => boolean;
1338
1526
  status: "signed-out";
@@ -1343,8 +1531,11 @@ declare function useWallets(): {
1343
1531
  /** Links the wallet to the member the list was read for; another session is refused. */
1344
1532
  link: (signer: WalletSigner) => Promise<boolean>;
1345
1533
  unlink: (wallet: Pick<LinkedWallet, "chain" | "address">) => Promise<boolean>;
1534
+ isPending: boolean;
1535
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1346
1536
  busy: boolean;
1347
1537
  actionError: RelayError | null;
1538
+ resetAction: () => void;
1348
1539
  retry: () => Promise<boolean>;
1349
1540
  settle: () => boolean;
1350
1541
  status: "ready";
@@ -1392,15 +1583,18 @@ declare function useSignInWallets(networks: readonly WalletSignInNetwork[] | nul
1392
1583
  * Read again when the window regains focus and after a change, in every component that uses it,
1393
1584
  * with the leaderboards that show the name. Each change is bound to the session the profile was
1394
1585
  * read with: a session that changed in between is refused rather than applied to another member.
1395
- * `update` and `uploadAvatar` never reject: they resolve true once saved, and a failure lands in
1396
- * `actionError`.
1586
+ * `update` and `uploadAvatar` never reject: they resolve true once saved, `isPending` is true while
1587
+ * one runs, and a failure lands in `actionError` until `resetAction()`.
1397
1588
  */
1398
1589
  declare function useMyProfile(): {
1399
1590
  update: (input: ProfileUpdate) => Promise<boolean>;
1400
1591
  /** Uploads a JPEG, PNG or WebP of at most 5 MB as the avatar. */
1401
1592
  uploadAvatar: (file: Blob) => Promise<boolean>;
1593
+ isPending: boolean;
1594
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1402
1595
  busy: boolean;
1403
1596
  actionError: RelayError | null;
1597
+ resetAction: () => void;
1404
1598
  retry: () => Promise<boolean>;
1405
1599
  settle: () => boolean;
1406
1600
  status: "loading";
@@ -1411,8 +1605,11 @@ declare function useMyProfile(): {
1411
1605
  update: (input: ProfileUpdate) => Promise<boolean>;
1412
1606
  /** Uploads a JPEG, PNG or WebP of at most 5 MB as the avatar. */
1413
1607
  uploadAvatar: (file: Blob) => Promise<boolean>;
1608
+ isPending: boolean;
1609
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1414
1610
  busy: boolean;
1415
1611
  actionError: RelayError | null;
1612
+ resetAction: () => void;
1416
1613
  retry: () => Promise<boolean>;
1417
1614
  settle: () => boolean;
1418
1615
  status: "error";
@@ -1423,8 +1620,11 @@ declare function useMyProfile(): {
1423
1620
  update: (input: ProfileUpdate) => Promise<boolean>;
1424
1621
  /** Uploads a JPEG, PNG or WebP of at most 5 MB as the avatar. */
1425
1622
  uploadAvatar: (file: Blob) => Promise<boolean>;
1623
+ isPending: boolean;
1624
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1426
1625
  busy: boolean;
1427
1626
  actionError: RelayError | null;
1627
+ resetAction: () => void;
1428
1628
  retry: () => Promise<boolean>;
1429
1629
  settle: () => boolean;
1430
1630
  status: "signed-out";
@@ -1435,8 +1635,11 @@ declare function useMyProfile(): {
1435
1635
  update: (input: ProfileUpdate) => Promise<boolean>;
1436
1636
  /** Uploads a JPEG, PNG or WebP of at most 5 MB as the avatar. */
1437
1637
  uploadAvatar: (file: Blob) => Promise<boolean>;
1638
+ isPending: boolean;
1639
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1438
1640
  busy: boolean;
1439
1641
  actionError: RelayError | null;
1642
+ resetAction: () => void;
1440
1643
  retry: () => Promise<boolean>;
1441
1644
  settle: () => boolean;
1442
1645
  status: "ready";
@@ -1602,153 +1805,18 @@ declare function useQuestOutcomes(query?: Omit<QuestOutcomeQuery, "cursor">): Me
1602
1805
 
1603
1806
  /** Offers with stock and availability for the current participant, or public availability. */
1604
1807
  declare function useOffers(): Query<Offer[]>;
1605
- /** Redeem an offer, then refresh offers and point balances. */
1606
- declare function useRedeemOffer(): {
1607
- redeem: (offer: string) => Promise<{
1608
- status: "fulfilled";
1609
- id: string;
1610
- offer: string;
1611
- member: string;
1612
- reservation: string;
1613
- price: {
1614
- kind: "points";
1615
- balance: string;
1616
- amount: number;
1617
- };
1618
- reward: {
1619
- kind: "tier";
1620
- reward: {
1621
- id: string;
1622
- title: string;
1623
- tiers: {
1624
- id: string;
1625
- title: string;
1626
- }[];
1627
- inventory: {
1628
- kind: "untracked";
1629
- };
1630
- fulfillment: {
1631
- kind: "staff-handover";
1632
- } | {
1633
- kind: "automatic";
1634
- };
1635
- };
1636
- tier: string;
1637
- };
1638
- entitlement: string;
1639
- revision: number;
1640
- redeemedAt: number;
1641
- } | {
1642
- status: "canceled";
1643
- canceledAt: number;
1644
- reason: string;
1645
- id: string;
1646
- offer: string;
1647
- member: string;
1648
- reservation: string;
1649
- price: {
1650
- kind: "points";
1651
- balance: string;
1652
- amount: number;
1653
- };
1654
- reward: {
1655
- kind: "tier";
1656
- reward: {
1657
- id: string;
1658
- title: string;
1659
- tiers: {
1660
- id: string;
1661
- title: string;
1662
- }[];
1663
- inventory: {
1664
- kind: "untracked";
1665
- };
1666
- fulfillment: {
1667
- kind: "staff-handover";
1668
- } | {
1669
- kind: "automatic";
1670
- };
1671
- };
1672
- tier: string;
1673
- };
1674
- entitlement: string;
1675
- revision: number;
1676
- redeemedAt: number;
1677
- } | null>;
1678
- retry: () => Promise<{
1679
- status: "fulfilled";
1680
- id: string;
1681
- offer: string;
1682
- member: string;
1683
- reservation: string;
1684
- price: {
1685
- kind: "points";
1686
- balance: string;
1687
- amount: number;
1688
- };
1689
- reward: {
1690
- kind: "tier";
1691
- reward: {
1692
- id: string;
1693
- title: string;
1694
- tiers: {
1695
- id: string;
1696
- title: string;
1697
- }[];
1698
- inventory: {
1699
- kind: "untracked";
1700
- };
1701
- fulfillment: {
1702
- kind: "staff-handover";
1703
- } | {
1704
- kind: "automatic";
1705
- };
1706
- };
1707
- tier: string;
1708
- };
1709
- entitlement: string;
1710
- revision: number;
1711
- redeemedAt: number;
1712
- } | {
1713
- status: "canceled";
1714
- canceledAt: number;
1715
- reason: string;
1716
- id: string;
1717
- offer: string;
1718
- member: string;
1719
- reservation: string;
1720
- price: {
1721
- kind: "points";
1722
- balance: string;
1723
- amount: number;
1724
- };
1725
- reward: {
1726
- kind: "tier";
1727
- reward: {
1728
- id: string;
1729
- title: string;
1730
- tiers: {
1731
- id: string;
1732
- title: string;
1733
- }[];
1734
- inventory: {
1735
- kind: "untracked";
1736
- };
1737
- fulfillment: {
1738
- kind: "staff-handover";
1739
- } | {
1740
- kind: "automatic";
1741
- };
1742
- };
1743
- tier: string;
1744
- };
1745
- entitlement: string;
1746
- revision: number;
1747
- redeemedAt: number;
1748
- } | null>;
1749
- settle: () => boolean;
1808
+ /**
1809
+ * Redeems an offer, then reads offers and point balances again: `mutate(offer)` or
1810
+ * `mutateAsync(offer)`, with `isPending`, `error`, `data` (the redemption) and `reset()`. After an
1811
+ * uncertain failure, `mutate` replays the same redemption with its key rather than spending again.
1812
+ */
1813
+ declare function useRedeemOffer(): Mutation<Redemption, string> & {
1814
+ /** @deprecated Use `mutate` or `mutateAsync`. Resolves the redemption, or null on failure. Removed in 2.0.0. */
1815
+ redeem(offer: string): Promise<Redemption | null>;
1816
+ /** @deprecated Use `mutate`, which replays a retained redemption. Removed in 2.0.0. */
1817
+ retry(): Promise<Redemption | null>;
1818
+ /** @deprecated Use `isPending`. Removed in 2.0.0. */
1750
1819
  busy: boolean;
1751
- error: RelayError | null;
1752
1820
  };
1753
1821
 
1754
1822
  /**
@@ -1768,4 +1836,4 @@ declare function usePointLedgers(): Query<PointLedgerReference[]>;
1768
1836
  */
1769
1837
  declare function useTieredRewards(): Query<TieredRewardReference[]>;
1770
1838
 
1771
- export { type Collection, CosmosChains, DiscoveredWallet, type ExperienceData, type Invitation, type KnownQuestStatusCode, type KnownRoleDeliveryStatus, type MemberPagedQuery, type MemberQuery, type MemberSnapshot, type OAuthProvider, Page, type PageLoader, type PageRead, type PagedQuery, type Query, type QueryContext, type QueryKey, type QueryOptions, type QueryRead, type QuerySnapshot, type QuestInput, type QuestNotice, type QuestStatus, type QuestStatusCode, type QuestStatusText, type QuestTone, type ReferralSummary, type RelayActionResult, RelayClient, RelayProvider, type RoleDelivery, type RoleDeliveryStatus, type SavedSubmission, SignInMethods, SignInOption, SignInUnavailable, SignInWallet, canRepeat, canSubmit, captureReferralCode, completionCountText, isAutomatic, isConnected, isFinished, progressOf, questGroups, questStatus, questStatusText, relayKeys, roleDeliveryLabel, roleDeliveryStatus, useAccounts, useActivity, useBalances, useDeliveries, useEntitlements, useExperience, useInvalidate, useInvitation, useLeaderboard, useLeaderboardPlacement, useMe, useMemberPages, useMemberQuery, useMyProfile, useOffers, usePointHistory, usePointLedgers, useProfile, useProfileCompletions, useProfileReferral, useQuest, useQuestOutcomes, useRedeemOffer, useReferralSummary, useRelay, useRelayAction, useRelayPages, useRelayQuery, useSession, useSignIn, useSignInMethods, useSignInOptions, useSignInWallets, useSignOut, useTieredRewards, useWalletDiscovery, useWallets };
1839
+ export { type Collection, CosmosChains, DiscoveredWallet, type ExperienceData, type Invitation, type KnownQuestStatusCode, type KnownRoleDeliveryStatus, type MemberPagedQuery, type MemberQuery, type MemberQueryOptions, type MemberSnapshot, type Mutation, type MutationContext, type MutationOptions, type MutationStatus, type OAuthProvider, Page, type PageLoader, type PageRead, type PagedQuery, type Query, type QueryContext, type QueryKey, type QueryOptions, type QueryRead, type QuerySnapshot, type QuestInput, type QuestNotice, type QuestStatus, type QuestStatusCode, type QuestStatusText, type QuestTone, type ReferralSummary, type RelayActionResult, RelayClient, type RelayPolling, RelayProvider, type RelayQueryOptions, type RoleDelivery, type RoleDeliveryStatus, type SavedSubmission, SignInMethods, SignInOption, SignInUnavailable, SignInWallet, canRepeat, canSubmit, captureReferralCode, completionCountText, isAutomatic, isConnected, isFinished, progressOf, questGroups, questStatus, questStatusText, relayKeys, roleDeliveryLabel, roleDeliveryStatus, useAccounts, useActivity, useBalances, useDeliveries, useEntitlements, useExperience, useInvalidate, useInvitation, useLeaderboard, useLeaderboardPlacement, useMe, useMemberPages, useMemberQuery, useMyProfile, useOffers, usePointHistory, usePointLedgers, useProfile, useProfileCompletions, useProfileReferral, useQuest, useQuestOutcomes, useRedeemOffer, useReferralSummary, useRelay, useRelayAction, useRelayMutation, useRelayPages, useRelayQuery, useSession, useSetQueryData, useSignIn, useSignInMethods, useSignInOptions, useSignInWallets, useSignOut, useTieredRewards, useWalletDiscovery, useWallets };