@domino-sdk/relay 1.59.0 → 1.61.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 (61) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/{accounts-CVonEkdb.d.ts → accounts-DoabriBX.d.ts} +4 -1
  3. package/dist/{integrations-DrbKQSTD.d.ts → announcements-CHx3-HBw.d.ts} +48 -42
  4. package/dist/{attempt-captures-DBj-rxak.d.ts → attempt-captures-DYnJVkfg.d.ts} +1 -1
  5. package/dist/authoring.d.ts +161 -29
  6. package/dist/authoring.js +116 -36
  7. package/dist/{automatic-outcomes-FS9okvBP.d.ts → automatic-outcomes-If88LR9f.d.ts} +1 -1
  8. package/dist/avatar.d.ts +1 -1
  9. package/dist/browser.d.ts +19 -10
  10. package/dist/browser.js +12 -10
  11. package/dist/{capability-error-DDJl0LY-.d.ts → capability-error-DufwG3G0.d.ts} +21 -1
  12. package/dist/{chunk-2LKGAL63.js → chunk-24I4R732.js} +39 -2
  13. package/dist/{chunk-UEMLYPKJ.js → chunk-3Y3L2F54.js} +34 -5
  14. package/dist/{chunk-YRSU2X2P.js → chunk-5I54XBK2.js} +2 -2
  15. package/dist/{chunk-KBCTII6C.js → chunk-7A4J67ZL.js} +1 -1
  16. package/dist/{chunk-LDLOB2UZ.js → chunk-DHXDBAJF.js} +4 -4
  17. package/dist/{chunk-W42KMMH5.js → chunk-DYXDZFKA.js} +5 -2
  18. package/dist/{chunk-TZJT5CRF.js → chunk-EN3M5Z4J.js} +1 -1
  19. package/dist/{chunk-IBROKMFV.js → chunk-L77O64I4.js} +1 -1
  20. package/dist/{chunk-EQF4ID47.js → chunk-PPB7HALD.js} +12 -2
  21. package/dist/{chunk-KYUQEZZA.js → chunk-QEAS4ZGS.js} +1 -1
  22. package/dist/{chunk-6U5WWH3W.js → chunk-QNUHWK7R.js} +9 -4
  23. package/dist/{chunk-YMWRLAAP.js → chunk-RHBS5FJL.js} +8 -2
  24. package/dist/chunk-SE4PFJPT.js +247 -0
  25. package/dist/{chunk-577DG2IT.js → chunk-SKGTNTLF.js} +12 -12
  26. package/dist/{chunk-M2JQPDUX.js → chunk-VURRFVNP.js} +9 -9
  27. package/dist/{chunk-R4S6BFOH.js → chunk-XBV2CK2H.js} +1 -1
  28. package/dist/{chunk-AWWCEP7F.js → chunk-ZDJLPN4L.js} +815 -592
  29. package/dist/{client-3b9HjSzZ.d.ts → client-C51w7fMb.d.ts} +12 -7
  30. package/dist/{deployments-BydFVj4Q.d.ts → deployments-kWoHFaqj.d.ts} +786 -2
  31. package/dist/{groups-CFuTfFqG.d.ts → groups-CqcA2Ycs.d.ts} +4 -1
  32. package/dist/index.d.ts +10 -10
  33. package/dist/index.js +9 -9
  34. package/dist/{analytics-URV-mxjH.d.ts → integrations-B3y36OaB.d.ts} +55 -1
  35. package/dist/internal.d.ts +11 -11
  36. package/dist/internal.js +8 -8
  37. package/dist/{offers-DAfe1O3_.d.ts → offers-BoV4ryUc.d.ts} +3 -2
  38. package/dist/{pages-ChDVLrgR.d.ts → pages-K7-KjSXw.d.ts} +147 -2
  39. package/dist/{participant-activity-iciCEs_8.d.ts → participant-activity-DHL8QYks.d.ts} +4 -0
  40. package/dist/portal-proxy.js +3 -3
  41. package/dist/react/index.d.ts +20 -15
  42. package/dist/react/index.js +143 -14
  43. package/dist/runtime/authoring.js +1 -1
  44. package/dist/runtime/chunks/5QVFB4TU.js +1 -0
  45. package/dist/runtime/manifest.json +3 -3
  46. package/dist/runtime/schema.js +1 -1
  47. package/dist/{schema-BA0nRRlt.d.ts → schema-CZ6Rj0ZF.d.ts} +142 -2
  48. package/dist/schema.d.ts +113 -18
  49. package/dist/schema.js +37 -21
  50. package/dist/server/index.d.ts +11 -11
  51. package/dist/server/index.js +346 -41
  52. package/dist/{submission-input-DxQ6RnKo.d.ts → submission-input-C54Q8yAD.d.ts} +2 -2
  53. package/dist/{telegram-browser-o3OIxGrJ.d.ts → telegram-browser-BUceZIGZ.d.ts} +7 -4
  54. package/dist/testing.d.ts +7 -7
  55. package/dist/testing.js +8 -8
  56. package/dist/{transport-D_Eqf78J.d.ts → transport-BrX9pIGN.d.ts} +5374 -62
  57. package/dist/{wallet-B06zvDXp.d.ts → wallet-CIqFoxdm.d.ts} +8 -1
  58. package/dist/{x-C28SNifw.d.ts → x-D1PGi8Sq.d.ts} +2 -2
  59. package/package.json +1 -1
  60. package/dist/chunk-XGXDINGM.js +0 -357
  61. package/dist/runtime/chunks/BG43KQ2T.js +0 -1
package/dist/authoring.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  tiktokVideoMetrics,
9
9
  youtubeShortBodySchema,
10
10
  youtubeShortMetrics
11
- } from "./chunk-W42KMMH5.js";
11
+ } from "./chunk-DYXDZFKA.js";
12
12
  import {
13
13
  CapabilityError,
14
14
  capabilityErrorCodes
@@ -17,7 +17,7 @@ import {
17
17
  sourceDataSchema,
18
18
  sourceRoles,
19
19
  validateQuestShape
20
- } from "./chunk-YMWRLAAP.js";
20
+ } from "./chunk-RHBS5FJL.js";
21
21
  import {
22
22
  badgeDeclarationSchema,
23
23
  defineOffer,
@@ -25,14 +25,15 @@ import {
25
25
  engagementScoreInputSchema,
26
26
  engagementScoreSchema,
27
27
  leaderboardAuthoringSchema,
28
+ parseDefinition,
28
29
  referralAuthoringSchema
29
- } from "./chunk-UEMLYPKJ.js";
30
+ } from "./chunk-3Y3L2F54.js";
30
31
  import {
31
- pointLedgerDeclarationSchema,
32
- telegramMessageDataSchema,
33
- telegramReactionDataSchema
34
- } from "./chunk-XGXDINGM.js";
32
+ pointLedgerDeclarationSchema
33
+ } from "./chunk-SE4PFJPT.js";
35
34
  import {
35
+ announcementSchema,
36
+ authorBudgetSchema,
36
37
  authoringKey,
37
38
  badgeReward,
38
39
  balanceAtLeast,
@@ -51,6 +52,7 @@ import {
51
52
  defaultTriggerMode,
52
53
  defineCampaign,
53
54
  defineGroup,
55
+ discordAnnouncementSchema,
54
56
  discordMessagesSourceSchema,
55
57
  discordReactionsSourceSchema,
56
58
  discordRewardSchema,
@@ -73,6 +75,7 @@ import {
73
75
  maxWalletEventLookback,
74
76
  maxWalletTransactionLookback,
75
77
  maxWalletTransactions,
78
+ parseAnnouncementTemplate,
76
79
  parseContractCall,
77
80
  parseContractEvent,
78
81
  parseContractFunction,
@@ -96,7 +99,10 @@ import {
96
99
  sourceContent,
97
100
  sourceIdentities,
98
101
  streakPolicySchema,
102
+ telegramAnnouncementSchema,
103
+ telegramMessageDataSchema,
99
104
  telegramMessagesNamespace,
105
+ telegramReactionDataSchema,
100
106
  telegramReactionsNamespace,
101
107
  textOptionsSchema,
102
108
  textSettingSchema,
@@ -115,15 +121,21 @@ import {
115
121
  whereSettings,
116
122
  xSearchSourceSchema,
117
123
  youtubeShortsNamespace
118
- } from "./chunk-AWWCEP7F.js";
124
+ } from "./chunk-ZDJLPN4L.js";
119
125
 
120
126
  // src/builders.ts
121
127
  import * as z from "zod";
122
128
  function defineBadge(input) {
123
- return resourceHandle("badge", badgeDeclarationSchema.parse(input));
129
+ return resourceHandle(
130
+ "badge",
131
+ parseDefinition("Badge", badgeDeclarationSchema, input)
132
+ );
124
133
  }
125
134
  function defineLedger(input) {
126
- return resourceHandle("ledger", pointLedgerDeclarationSchema.parse(input));
135
+ return resourceHandle(
136
+ "ledger",
137
+ parseDefinition("Point ledger", pointLedgerDeclarationSchema, input)
138
+ );
127
139
  }
128
140
  function defineEngagementReward(input) {
129
141
  const { target, ledger, ...config } = input;
@@ -165,7 +177,7 @@ var questCompleted = (quest) => ({
165
177
  });
166
178
  function defineReferral(input) {
167
179
  const { qualification, inviterGroup, milestones, bonuses, ...properties } = input;
168
- const definition = referralAuthoringSchema.parse({
180
+ const definition = parseDefinition("Referral", referralAuthoringSchema, {
169
181
  ...properties,
170
182
  qualification: qualification.kind === "quest" ? { kind: "quest", quest: qualification.quest.key } : qualification,
171
183
  ...inviterGroup ? { inviterGroup: identifier.parse(inviterGroup.key) } : {},
@@ -188,24 +200,28 @@ function earned(options = {}) {
188
200
  function defineLeaderboard(input) {
189
201
  const { ledger, group, score, settle, ...properties } = input;
190
202
  const pool = settle?.pool;
191
- const definition = leaderboardAuthoringSchema.parse({
192
- ...properties,
193
- ...settle ? {
194
- settle: {
195
- ...settle,
196
- prizes: settle.prizes ?? [],
197
- ...pool ? {
198
- pool: {
199
- ...pool,
200
- ...pool.ledger === void 0 ? {} : { ledger: ledgerKey(pool.ledger) }
201
- }
202
- } : {}
203
- }
204
- } : {},
205
- balance: ledgerKey(ledger),
206
- ...group ? { group: identifier.parse(group.key) } : {},
207
- score: score?.kind === "earned" ? { ...score, quests: score.quests?.map((quest) => quest.key) } : score
208
- });
203
+ const definition = parseDefinition(
204
+ "Leaderboard",
205
+ leaderboardAuthoringSchema,
206
+ {
207
+ ...properties,
208
+ ...settle ? {
209
+ settle: {
210
+ ...settle,
211
+ prizes: settle.prizes ?? [],
212
+ ...pool ? {
213
+ pool: {
214
+ ...pool,
215
+ ...pool.ledger === void 0 ? {} : { ledger: ledgerKey(pool.ledger) }
216
+ }
217
+ } : {}
218
+ }
219
+ } : {},
220
+ balance: ledgerKey(ledger),
221
+ ...group ? { group: identifier.parse(group.key) } : {},
222
+ score: score?.kind === "earned" ? { ...score, quests: score.quests?.map((quest) => quest.key) } : score
223
+ }
224
+ );
209
225
  return resourceHandle("leaderboard", definition);
210
226
  }
211
227
  var x = {
@@ -272,7 +288,7 @@ function isZodSchema(value) {
272
288
  function defineTracker(input) {
273
289
  return resourceHandle(
274
290
  "tracker",
275
- trackerDefinitionSchema.parse(input)
291
+ parseDefinition("Tracker", trackerDefinitionSchema, input)
276
292
  );
277
293
  }
278
294
  function messages(options = {}) {
@@ -292,6 +308,19 @@ var discord = {
292
308
  action: "grant-role",
293
309
  roleId
294
310
  }),
311
+ /**
312
+ * An announcement Domino's bot posts in a channel of the project's Discord server when a
313
+ * completion pays, such as `"{beneficiary} got +{points} XP from {author}"`. Placeholders are
314
+ * `announcementPlaceholders`; `{beneficiary}` and `{author}` mention linked Discord accounts.
315
+ * Pass it in the quest's `announcements`, and declare the `discord` integration.
316
+ */
317
+ postMessage(options) {
318
+ return discordAnnouncementSchema.parse({
319
+ provider: "discord",
320
+ action: "post-message",
321
+ ...options
322
+ });
323
+ },
295
324
  messages,
296
325
  reactions,
297
326
  roles(options = {}) {
@@ -301,15 +330,34 @@ var discord = {
301
330
  assignable: options.assignable ?? false
302
331
  });
303
332
  },
333
+ /**
334
+ * A channel of the project's Discord server, for a resource setting. With `postable: true`,
335
+ * Console lists channels Domino's bot cannot post in as unavailable, as an announcement's
336
+ * channel needs.
337
+ */
304
338
  channels(options = {}) {
305
339
  return resourceSourceSchema.parse({
306
340
  provider: "discord",
307
341
  resource: "channel",
308
- types: options.types ?? ["text", "announcement"]
342
+ types: options.types ?? ["text", "announcement"],
343
+ ...options.postable ? { postable: true } : {}
309
344
  });
310
345
  }
311
346
  };
312
347
  var telegram = {
348
+ /**
349
+ * An announcement Domino's bot posts in a connected chat when a completion pays, such as
350
+ * `"{beneficiary} got +{points} XP from {author}"`. Name the chat with `settings.telegramChat()`.
351
+ * Placeholders are `announcementPlaceholders`; `{beneficiary}` and `{author}` mention Telegram
352
+ * accounts. Pass it in the quest's `announcements`.
353
+ */
354
+ postMessage(options) {
355
+ return telegramAnnouncementSchema.parse({
356
+ provider: "telegram",
357
+ action: "post-message",
358
+ ...options
359
+ });
360
+ },
313
361
  messages() {
314
362
  return customSource(telegramMessagesNamespace, {
315
363
  identities: ["member"],
@@ -801,14 +849,17 @@ function content(input) {
801
849
  }
802
850
  return trackerTrigger({ ...input, content: true }, "content");
803
851
  }
804
- var budget = (definition) => {
852
+ function defineBudget(definition) {
805
853
  const { key: _, cost, ...properties } = definition;
806
- return budgetSchema.parse({
854
+ const parsed = {
807
855
  ...properties,
808
856
  id: authoringKey(definition),
809
857
  cost: typeof cost === "number" ? cost : { balance: ledgerKey(cost.ledger) }
810
- });
811
- };
858
+ };
859
+ return properties.scope === "author" ? authorBudgetSchema.parse(parsed) : budgetSchema.parse(parsed);
860
+ }
861
+ var budget = defineBudget;
862
+ var authorBudgets = (budgets = []) => budgets.filter((value) => value.scope === "author");
812
863
  var keyed = (key) => ({
813
864
  kind: "keyed",
814
865
  key
@@ -928,11 +979,13 @@ function questBuilder(template) {
928
979
  "A quest needs a completion, such as once(), keyed(...), streak(...) or progress(...)"
929
980
  );
930
981
  }
982
+ const author = authorBudgets(definition.budgets);
931
983
  validateQuestShape(
932
984
  {
933
985
  trigger: definition.trigger,
934
986
  completion: completion ?? { kind: "keyed" },
935
987
  requires: definition.requires ?? [],
988
+ authorBudgets: author,
936
989
  performance: definition.performance ? contentPerformancePolicySchema.parse({
937
990
  metrics: definition.performance.metrics,
938
991
  maxAgeMs: definition.performance.maxAgeMs
@@ -992,10 +1045,33 @@ function questBuilder(template) {
992
1045
  const rewards = rewardBundleSchema.parse(
993
1046
  typeof definition.rewards === "function" ? definition.rewards({ settings: settings2 }) : definition.rewards
994
1047
  );
1048
+ const announcements = z3.array(announcementSchema).max(3, "A quest posts at most three announcements").parse(
1049
+ (typeof definition.announcements === "function" ? definition.announcements({ settings: settings2 }) : definition.announcements) ?? []
1050
+ );
1051
+ const trackerTrigger3 = definition.trigger.kind === "automatic" && definition.trigger.tracker !== void 0;
1052
+ for (const announcement of announcements) {
1053
+ const parsed = parseAnnouncementTemplate(announcement.text);
1054
+ const usesAuthor = "segments" in parsed && parsed.segments.some(
1055
+ (segment) => segment.kind === "placeholder" && segment.name === "author"
1056
+ );
1057
+ if (!trackerTrigger3 && usesAuthor) {
1058
+ throw new Error(
1059
+ "An announcement names {author} only on a quest with an automatic tracker trigger"
1060
+ );
1061
+ }
1062
+ if (!trackerTrigger3 && announcement.replyToTriggeringMessage) {
1063
+ throw new Error(
1064
+ "An announcement replies to the triggering message only on a quest with an automatic tracker trigger"
1065
+ );
1066
+ }
1067
+ }
995
1068
  const required = [
996
1069
  ...rewards.flatMap(
997
1070
  (reward) => reward.kind === "integration" ? [reward.provider] : []
998
1071
  ),
1072
+ ...announcements.flatMap(
1073
+ (announcement) => announcement.provider === "discord" ? ["discord"] : []
1074
+ ),
999
1075
  ...Object.values(fields).flatMap(
1000
1076
  (field) => field.kind === "resource" && field.source.provider !== "domino" ? [field.source.provider] : []
1001
1077
  )
@@ -1013,6 +1089,7 @@ function questBuilder(template) {
1013
1089
  fields,
1014
1090
  values,
1015
1091
  rewards,
1092
+ ...announcements.length ? { announcements } : {},
1016
1093
  humanReview: definition.review?.({ settings: settings2 })?.enabled ?? true,
1017
1094
  trigger: definition.trigger,
1018
1095
  ...definition.performance ? {
@@ -1031,7 +1108,10 @@ function questBuilder(template) {
1031
1108
  } : completion.kind === "streak" ? completion : { kind: completion.kind },
1032
1109
  visibility: definition.visibility ?? "visible",
1033
1110
  profile: definition.profile ?? { visible: false },
1034
- budgets: definition.budgets ?? [],
1111
+ budgets: (definition.budgets ?? []).filter(
1112
+ (value) => value.scope !== "author"
1113
+ ),
1114
+ ...author.length ? { authorBudgets: author } : {},
1035
1115
  requires: definition.requires ?? [],
1036
1116
  ...definition.campaign ? { campaign: definition.campaign } : {},
1037
1117
  ...definition.availability ? { availability: definition.availability } : {},
@@ -1,5 +1,5 @@
1
1
  import * as z from 'zod';
2
- import { a as AttemptStatus } from './schema-BA0nRRlt.js';
2
+ import { a as AttemptStatus } from './schema-CZ6Rj0ZF.js';
3
3
 
4
4
  declare const collectionCodeSchema: z.ZodString;
5
5
  declare const collectionPassSchema: z.ZodObject<{
package/dist/avatar.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { P as ProfileAvatar, L as LinkedWallet } from './wallet-B06zvDXp.js';
1
+ import { P as ProfileAvatar, L as LinkedWallet } from './wallet-CIqFoxdm.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
package/dist/browser.d.ts CHANGED
@@ -1,15 +1,24 @@
1
- import { o as SubmissionStore, f as RelayClientOptions, R as RelayClient } from './client-3b9HjSzZ.js';
2
- export { C as CosmosChains, D as DiscoveredWallet, E as Eip1193Provider, a as EmailSignInOption, K as KeplrLike, O as OAuthSignInOption, S as SignInClient, b as SignInIcon, c as SignInMethods, d as SignInOption, e as SignInOptions, f as SignInUnavailable, g as SignInWallet, h as SolanaInjectedProvider, i as StandardWallet, j as StandardWalletAccount, T as TelegramSignInOption, W as WalletSignInOption, k as cosmosChainList, l as cosmosSigner, m as discoverCosmosWallets, n as discoverEvmWallets, o as discoverSignInWallets, p as discoverSolanaWallets, q as evmSigner, s as signInOptions, r as solanaSigner, t as telegramMiniAppInitData, w as walletStandardSolanaSigner } from './telegram-browser-o3OIxGrJ.js';
1
+ import { o as SubmissionStore, f as RelayClientOptions, R as RelayClient } from './client-C51w7fMb.js';
2
+ export { C as CosmosChains, D as DiscoveredWallet, E as Eip1193Provider, a as EmailSignInOption, K as KeplrLike, O as OAuthSignInOption, S as SignInClient, b as SignInIcon, c as SignInMethods, d as SignInOption, e as SignInOptions, f as SignInUnavailable, g as SignInWallet, h as SolanaInjectedProvider, i as StandardWallet, j as StandardWalletAccount, T as TelegramSignInOption, W as WalletSignInOption, k as cosmosChainList, l as cosmosSigner, m as discoverCosmosWallets, n as discoverEvmWallets, o as discoverSignInWallets, p as discoverSolanaWallets, q as evmSigner, s as signInOptions, r as solanaSigner, t as telegramMiniAppInitData, w as walletStandardSolanaSigner } from './telegram-browser-BUceZIGZ.js';
3
3
  export { H as HostEnvironment, g as getHostEnvironment } from './host-environment-FN4zg3hw.js';
4
- import './schema-BA0nRRlt.js';
4
+ import { M as MemberSummary } from './participant-activity-DHL8QYks.js';
5
+ import './schema-CZ6Rj0ZF.js';
5
6
  import 'zod';
6
- import './wallet-B06zvDXp.js';
7
- import './pages-ChDVLrgR.js';
8
- import './submission-input-DxQ6RnKo.js';
9
- import './groups-CFuTfFqG.js';
7
+ import './wallet-CIqFoxdm.js';
8
+ import './pages-K7-KjSXw.js';
9
+ import './submission-input-C54Q8yAD.js';
10
+ import './groups-CqcA2Ycs.js';
10
11
  import './action-DBzILFx9.js';
11
- import './participant-activity-iciCEs_8.js';
12
- import './accounts-CVonEkdb.js';
12
+ import './accounts-DoabriBX.js';
13
+
14
+ /**
15
+ * The member's time at the real instant `at` (default now), in epoch milliseconds: what an app
16
+ * compares campaign phases and quest dates against, so it shows what Relay judges on. Applies
17
+ * `me.clock.offsetMs` from `GET /v1/me`, which moves when the staging toolbar moves a test member's
18
+ * clock; read `/v1/me` again on `domino:test-state-changed`. Without `clock` (a Relay older than
19
+ * it) the member's time is real time.
20
+ */
21
+ declare function memberTime(me: Pick<MemberSummary, "clock">, at?: number): number;
13
22
 
14
23
  /** Browser client with durable submission recovery; safe to construct during SSR. */
15
24
  declare function createBrowserRelayClient(options: RelayClientOptions): RelayClient;
@@ -21,4 +30,4 @@ declare function createBrowserRelayClient(options: RelayClientOptions): RelayCli
21
30
  */
22
31
  declare function browserSubmissionStore(): SubmissionStore;
23
32
 
24
- export { browserSubmissionStore, createBrowserRelayClient };
33
+ export { browserSubmissionStore, createBrowserRelayClient, memberTime };
package/dist/browser.js CHANGED
@@ -8,23 +8,24 @@ import {
8
8
  discoverSignInWallets,
9
9
  discoverSolanaWallets,
10
10
  evmSigner,
11
+ memberTime,
11
12
  signInOptions,
12
13
  solanaSigner,
13
14
  telegramMiniAppInitData,
14
15
  walletStandardSolanaSigner
15
- } from "./chunk-2LKGAL63.js";
16
- import "./chunk-577DG2IT.js";
17
- import "./chunk-KYUQEZZA.js";
18
- import "./chunk-6U5WWH3W.js";
19
- import "./chunk-UEMLYPKJ.js";
20
- import "./chunk-XGXDINGM.js";
16
+ } from "./chunk-24I4R732.js";
17
+ import "./chunk-SKGTNTLF.js";
18
+ import "./chunk-QEAS4ZGS.js";
19
+ import "./chunk-QNUHWK7R.js";
20
+ import "./chunk-3Y3L2F54.js";
21
+ import "./chunk-SE4PFJPT.js";
21
22
  import {
22
23
  getHostEnvironment
23
24
  } from "./chunk-KDR2VAJP.js";
24
- import "./chunk-R4S6BFOH.js";
25
- import "./chunk-TZJT5CRF.js";
26
- import "./chunk-EQF4ID47.js";
27
- import "./chunk-AWWCEP7F.js";
25
+ import "./chunk-XBV2CK2H.js";
26
+ import "./chunk-EN3M5Z4J.js";
27
+ import "./chunk-PPB7HALD.js";
28
+ import "./chunk-ZDJLPN4L.js";
28
29
  export {
29
30
  browserSubmissionStore,
30
31
  cosmosChainList,
@@ -36,6 +37,7 @@ export {
36
37
  discoverSolanaWallets,
37
38
  evmSigner,
38
39
  getHostEnvironment,
40
+ memberTime,
39
41
  signInOptions,
40
42
  solanaSigner,
41
43
  telegramMiniAppInitData,
@@ -51,6 +51,26 @@ declare const budgetSchema: z.ZodObject<{
51
51
  }, z.core.$strict>]>;
52
52
  }, z.core.$strict>;
53
53
  type Budget = z.infer<typeof budgetSchema>;
54
+ /**
55
+ * A budget counted per tracker record author: the account that caused the record, such as a
56
+ * reaction's reactor, whether or not it belongs to a member. It caps what one person gives when a
57
+ * quest pays someone else. Only quests with a tracker trigger take one, in their `authorBudgets`.
58
+ */
59
+ declare const authorBudgetSchema: z.ZodObject<{
60
+ id: z.ZodString;
61
+ period: z.ZodEnum<{
62
+ lifetime: "lifetime";
63
+ day: "day";
64
+ week: "week";
65
+ month: "month";
66
+ }>;
67
+ limit: z.ZodNumber;
68
+ cost: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
69
+ balance: z.ZodString;
70
+ }, z.core.$strict>]>;
71
+ scope: z.ZodLiteral<"author">;
72
+ }, z.core.$strict>;
73
+ type AuthorBudget = z.infer<typeof authorBudgetSchema>;
54
74
  /**
55
75
  * One of the member's accepted, unrevoked quest completions, as `ctx.member.completions()` reads
56
76
  * it. `quest` is the quest's key and `key` the completion key. `completedAt` is when it was
@@ -136,4 +156,4 @@ declare class CapabilityError extends Error {
136
156
  static from(failure: CapabilityFailure): CapabilityError;
137
157
  }
138
158
 
139
- export { type Budget as B, CapabilityError as C, type KnownCapabilityErrorCode as K, type MemberCompletion as M, type CapabilityErrorCode as a, type CapabilityFailure as b, capabilityErrorCodes as c, budgetSchema as d, capabilityFailureSchema as e, completionKeySchema as f, completionPolicySchema as g, memberCompletionSchema as h, maxMemberCompletions as m };
159
+ export { type AuthorBudget as A, type Budget as B, CapabilityError as C, type KnownCapabilityErrorCode as K, type MemberCompletion as M, type CapabilityErrorCode as a, type CapabilityFailure as b, capabilityErrorCodes as c, authorBudgetSchema as d, budgetSchema as e, capabilityFailureSchema as f, completionKeySchema as g, completionPolicySchema as h, maxMemberCompletions as i, memberCompletionSchema as m };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createRelayClient
3
- } from "./chunk-577DG2IT.js";
3
+ } from "./chunk-SKGTNTLF.js";
4
4
  import {
5
5
  RelayErrorCode,
6
6
  asRelayError,
7
7
  clientError,
8
8
  cosmosChain
9
- } from "./chunk-AWWCEP7F.js";
9
+ } from "./chunk-ZDJLPN4L.js";
10
10
 
11
11
  // src/base58.ts
12
12
  var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@@ -78,6 +78,37 @@ function evmSigner(provider, info = {}) {
78
78
  throw new Error("The wallet returned no signature.");
79
79
  }
80
80
  return { signature };
81
+ },
82
+ watchAccounts(listener) {
83
+ let stopped = false;
84
+ let heard = false;
85
+ const report = (accounts) => {
86
+ if (!stopped && Array.isArray(accounts)) {
87
+ listener(
88
+ accounts.filter(
89
+ (account) => typeof account === "string"
90
+ )
91
+ );
92
+ }
93
+ };
94
+ const changed = (accounts) => {
95
+ heard = true;
96
+ report(accounts);
97
+ };
98
+ provider.on?.("accountsChanged", changed);
99
+ provider.request({ method: "eth_accounts" }).then(
100
+ (accounts) => {
101
+ if (!heard) {
102
+ report(accounts);
103
+ }
104
+ },
105
+ () => {
106
+ }
107
+ );
108
+ return () => {
109
+ stopped = true;
110
+ provider.removeListener?.("accountsChanged", changed);
111
+ };
81
112
  }
82
113
  };
83
114
  }
@@ -520,6 +551,11 @@ function telegramMiniAppInitData() {
520
551
  return new URLSearchParams(hash.replace(/^#/, "")).get("tgWebAppData") || null;
521
552
  }
522
553
 
554
+ // src/member-time.ts
555
+ function memberTime(me, at = Date.now()) {
556
+ return at + (me.clock?.offsetMs ?? 0);
557
+ }
558
+
523
559
  // src/browser.ts
524
560
  function createBrowserRelayClient(options) {
525
561
  return createRelayClient({
@@ -699,6 +735,7 @@ export {
699
735
  readSignInMethods,
700
736
  signInOptions,
701
737
  telegramMiniAppInitData,
738
+ memberTime,
702
739
  createBrowserRelayClient,
703
740
  browserSubmissionStore
704
741
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  pointEntrySchema,
3
3
  profileSummarySchema
4
- } from "./chunk-XGXDINGM.js";
4
+ } from "./chunk-SE4PFJPT.js";
5
5
  import {
6
6
  authoringIdentityShape,
7
7
  calendarPeriodSchema,
@@ -18,7 +18,7 @@ import {
18
18
  responseShape,
19
19
  rewardKey,
20
20
  tierRewardSchema
21
- } from "./chunk-AWWCEP7F.js";
21
+ } from "./chunk-ZDJLPN4L.js";
22
22
 
23
23
  // src/badges.ts
24
24
  import * as z from "zod";
@@ -683,7 +683,9 @@ var referralRelationshipSchema = z4.object({
683
683
  member: identifier,
684
684
  inviter: identifier,
685
685
  acceptedAt: amount2,
686
- suspended: z4.boolean()
686
+ suspended: z4.boolean(),
687
+ /** The member import that recorded this referral, or null when the friend accepted an invitation. */
688
+ import: identifier.nullable().optional()
687
689
  });
688
690
  var referralAccountSchema = z4.object({
689
691
  id: identifier,
@@ -728,7 +730,9 @@ var referralManagementSchema = z4.object({
728
730
  member: identifier,
729
731
  program: identifier,
730
732
  qualified: z4.boolean(),
731
- qualifiedAt: amount2
733
+ qualifiedAt: amount2,
734
+ /** The member import that recorded this qualification, which paid no reward, or null. */
735
+ import: identifier.nullable().optional()
732
736
  })
733
737
  ),
734
738
  accounts: z4.array(
@@ -747,6 +751,22 @@ var referralManagementSchema = z4.object({
747
751
  next: amount2.nullable()
748
752
  });
749
753
 
754
+ // src/definition-error.ts
755
+ function issueText(issues) {
756
+ return issues.map(
757
+ (issue) => issue.path.length ? issue.path.map(String).join(".") + ": " + issue.message : issue.message
758
+ ).join("; ");
759
+ }
760
+ function parseDefinition(kind, schema, input) {
761
+ const parsed = schema.safeParse(input);
762
+ if (parsed.success) {
763
+ return parsed.data;
764
+ }
765
+ const key = typeof input === "object" && input !== null && "key" in input && typeof input.key === "string" ? ` "${input.key}"` : "";
766
+ parsed.error.message = `${kind}${key} is invalid: ${issueText(parsed.error.issues)}`;
767
+ throw parsed.error;
768
+ }
769
+
750
770
  // src/offers.ts
751
771
  import * as z5 from "zod";
752
772
  var quantity = z5.number().int().safe().nonnegative();
@@ -798,6 +818,11 @@ var offerSchema = responseShape(
798
818
  available: quantity,
799
819
  redeemed: quantity,
800
820
  availability: offerAvailabilitySchema,
821
+ /**
822
+ * When an operator archived the offer, or `null`. Only management reads carry it and list an
823
+ * archived offer; it refuses new redemptions with `offer-paused` until it is restored.
824
+ */
825
+ archivedAt: z5.number().int().nonnegative().nullable().optional(),
801
826
  /**
802
827
  * The prerequisites the signed-in member has not met yet, so an app can show the offer locked
803
828
  * and why. Empty when nothing is missing or the read has no member; redeeming while it is not
@@ -855,7 +880,10 @@ var redemptionCancellationSchema = z5.object({
855
880
  reason: z5.string().trim().min(1).max(500)
856
881
  }).strict();
857
882
  function defineOffer(input) {
858
- return resourceHandle("offer", offerAuthoringSchema.parse(input));
883
+ return resourceHandle(
884
+ "offer",
885
+ parseDefinition("Offer", offerAuthoringSchema, input)
886
+ );
859
887
  }
860
888
 
861
889
  export {
@@ -936,6 +964,7 @@ export {
936
964
  referralSummarySchema,
937
965
  referralHistorySchema,
938
966
  referralManagementSchema,
967
+ parseDefinition,
939
968
  offerPriceSchema,
940
969
  offerLimitSchema,
941
970
  offerDefinitionSchema,
@@ -4,10 +4,10 @@ import {
4
4
  imageFieldsSchema,
5
5
  imageInspectionSchema,
6
6
  imageSightingsSchema
7
- } from "./chunk-IBROKMFV.js";
7
+ } from "./chunk-L77O64I4.js";
8
8
  import {
9
9
  photoResultSchema
10
- } from "./chunk-AWWCEP7F.js";
10
+ } from "./chunk-ZDJLPN4L.js";
11
11
 
12
12
  // src/image-results.ts
13
13
  import * as z from "zod";
@@ -8,7 +8,7 @@ import {
8
8
  rewardBundleSchema,
9
9
  settingsValuesSchema,
10
10
  trackerTriggerContextSchema
11
- } from "./chunk-AWWCEP7F.js";
11
+ } from "./chunk-ZDJLPN4L.js";
12
12
 
13
13
  // src/server/attempt-captures.ts
14
14
  import * as z from "zod";
@@ -4,20 +4,20 @@ import {
4
4
  retryAfter,
5
5
  retrying,
6
6
  validTimeout
7
- } from "./chunk-R4S6BFOH.js";
7
+ } from "./chunk-XBV2CK2H.js";
8
8
  import {
9
9
  clientIdentity
10
- } from "./chunk-TZJT5CRF.js";
10
+ } from "./chunk-EN3M5Z4J.js";
11
11
  import {
12
12
  authScopeSchema
13
- } from "./chunk-EQF4ID47.js";
13
+ } from "./chunk-PPB7HALD.js";
14
14
  import {
15
15
  RequestError,
16
16
  appIdentityKindSchema,
17
17
  isRequestError,
18
18
  knownResponse,
19
19
  openIdentityKindSchema
20
- } from "./chunk-AWWCEP7F.js";
20
+ } from "./chunk-ZDJLPN4L.js";
21
21
 
22
22
  // src/configuration.ts
23
23
  function questConfiguration(release) {
@@ -1,8 +1,11 @@
1
+ import {
2
+ parseDefinition
3
+ } from "./chunk-3Y3L2F54.js";
1
4
  import {
2
5
  identifier,
3
6
  resourceHandle,
4
7
  responseShape
5
- } from "./chunk-AWWCEP7F.js";
8
+ } from "./chunk-ZDJLPN4L.js";
6
9
 
7
10
  // src/youtube.ts
8
11
  import * as z from "zod";
@@ -648,7 +651,7 @@ var dashboardPreviewSchema = responseShape(
648
651
  );
649
652
  var keyOf = (reference) => typeof reference === "string" ? reference : reference.key;
650
653
  function defineDashboard(input) {
651
- const authored = dashboardAuthoringSchema.parse({
654
+ const authored = parseDefinition("Dashboard", dashboardAuthoringSchema, {
652
655
  ...input,
653
656
  sections: input.sections.map((section) => ({
654
657
  ...section,
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var name = "@domino-sdk/relay";
3
- var version = "1.59.0";
3
+ var version = "1.61.0";
4
4
 
5
5
  // src/client-identity.ts
6
6
  function clientIdentity() {