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