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

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.
@@ -4,7 +4,7 @@ import * as zod from 'zod';
4
4
  import { z } from 'zod';
5
5
  import { ProfileUpdate, ProfileCompletionQuery, QuestView, QuestController, ProgressObservation, questExperienceSchema, ProgressObserver, ExchangeInput, PhotoSubmission, QuizSubmission, ClaimSubmission, ValueSubmission, SubmissionDraft, ProfileCompletion, ProfileSummary, PointLedgerReference } from '../index.js';
6
6
  export { avatarSrc, defaultAvatar, walletAvatarSeed } from '../index.js';
7
- import { M as referralAcceptSchema, N as LeaderboardQuery, P as WalletAddressInput, Q as walletSignatureSchema, L as LinkedWallet, R as WalletSigner, V as walletChallengeInputSchema, Y as walletProofSchema, Z as AuthProvider, _ as WalletSignature, $ as engagementPageQuerySchema, a0 as contentQualificationQuerySchema, a1 as contentAdmissionQuerySchema, a2 as contentEnrollmentInputSchema, a3 as contentReleaseInputSchema, a4 as AccountConnection, a5 as WalletSignInNetwork, a6 as referralSummarySchema, a7 as LeaderboardPage } from '../submission-input-JDwq3EVK.js';
7
+ import { M as referralAcceptSchema, N as LeaderboardQuery, P as WalletAddressInput, Q as walletSignatureSchema, L as LinkedWallet, R as WalletSigner, V as walletChallengeInputSchema, Y as walletProofSchema, Z as AuthProvider, _ as WalletSignature, $ as engagementPageQuerySchema, a0 as contentQualificationQuerySchema, a1 as contentAdmissionQuerySchema, a2 as contentEnrollmentInputSchema, a3 as contentReleaseInputSchema, a4 as AccountConnection, a5 as WalletSignInNetwork, a6 as referralSummarySchema, a7 as LeaderboardPage } from '../submission-input-CZDukyb3.js';
8
8
  import { SubmitInput, ReleaseInput, beginHandoverSchema, contentPerformanceQuerySchema, TieredRewardReference } from '../schema.js';
9
9
  import { createBrowserRelayClient, SignInMethods, CosmosChains, SignInOption, SignInUnavailable, SignInWallet, DiscoveredWallet } from '../browser.js';
10
10
  export { EmailSignInOption, OAuthSignInOption, SignInIcon, WalletSignInOption } from '../browser.js';
@@ -165,13 +165,16 @@ function questStatus(view) {
165
165
  };
166
166
  }
167
167
  const availability = view.availability;
168
- if (view.streak && availability.kind !== "locked") {
168
+ const ownSubmission = view.trigger.kind === "manual" && view.trigger.actor !== "staff";
169
+ const submissionFirst = ownSubmission && (availability.kind === "checking" || availability.kind === "needs-review" || availability.kind === "retryable");
170
+ if (view.streak && availability.kind !== "locked" && !submissionFirst) {
169
171
  const streak = view.streak;
172
+ const rejection = ownSubmission && view.attempt?.status === "rejected" ? sentence(view.attempt.reason ?? "That submission wasn't accepted.") : null;
170
173
  if (streak.milestone.status === "budget-exhausted") {
171
174
  return {
172
175
  tone: "attention",
173
176
  label: "Milestone reached",
174
- detail: "Your qualifying days are saved. This milestone's reward budget was exhausted."
177
+ detail: rejection ?? "Your qualifying days are saved. This milestone's reward budget was exhausted."
175
178
  };
176
179
  }
177
180
  const deadline = new Intl.DateTimeFormat("en", {
@@ -182,10 +185,11 @@ function questStatus(view) {
182
185
  minute: "2-digit",
183
186
  timeZoneName: "short"
184
187
  }).format(streak.nextBoundary);
188
+ const progress = streak.todayQualified ? `Today counts. Your next community day starts ${deadline}. Best streak: ${streak.best} days.` : `Complete today's activity before ${deadline} ${streak.current ? "to keep your streak" : "to start your streak"}. Best streak: ${streak.best} days.`;
185
189
  return {
186
- tone: streak.todayQualified ? "waiting" : "open",
190
+ tone: rejection ? "attention" : streak.todayQualified ? "waiting" : "open",
187
191
  label: `${streak.current} / ${streak.goal} days`,
188
- detail: streak.todayQualified ? `Today counts. Your next community day starts ${deadline}. Best streak: ${streak.best} days.` : `Complete today's activity before ${deadline} ${streak.current ? "to keep your streak" : "to start your streak"}. Best streak: ${streak.best} days.`
192
+ detail: rejection ? `${rejection} ${progress}` : progress
189
193
  };
190
194
  }
191
195
  if (runsSilently(view) && availability.kind !== "locked") {
@@ -264,6 +268,10 @@ function progressOf(quests) {
264
268
  done: counted.filter(isFinished).length
265
269
  };
266
270
  }
271
+ function sentence(text) {
272
+ const trimmed = text.trim();
273
+ return /[.!?]$/.test(trimmed) ? trimmed : `${trimmed}.`;
274
+ }
267
275
  function list(items) {
268
276
  return new Intl.ListFormat("en", { type: "conjunction" }).format(
269
277
  items.map((item) => `\u201C${item}\u201D`)
@@ -2115,6 +2115,12 @@ interface ImageReader {
2115
2115
  values: Extracted<F>;
2116
2116
  reason: string;
2117
2117
  }>;
2118
+ /**
2119
+ * Records the image for this attempt, then counts other participants' recorded images within
2120
+ * `maxDistance`. The record is written when `seen` runs, not when the attempt is decided, so it
2121
+ * stays even if the attempt is rejected: concurrent submissions of one photo must see each
2122
+ * other. Replays reuse the captured result.
2123
+ */
2118
2124
  seen(image: ImageReference, options?: {
2119
2125
  maxDistance?: number;
2120
2126
  }): Promise<ImageSightings>;
@@ -2127,7 +2133,13 @@ declare const streakPolicySchema: z.ZodObject<{
2127
2133
  timeZone: z.ZodString;
2128
2134
  }, z.core.$strict>;
2129
2135
  type StreakPolicy = z.infer<typeof streakPolicySchema>;
2130
- /** One milestone per quest. Multiple qualifying actions occupy one community day. */
2136
+ /**
2137
+ * One milestone per quest, after `days` consecutive community days with an accepted attempt.
2138
+ * Multiple accepted attempts occupy one day. The day comes from the attempt's trusted occurrence
2139
+ * time: a tracker record's (or observation's) `occurredAt` for `automatic({ tracker })`, and the
2140
+ * submission's admission time for `manual()`, so a manual streak counts the days a member
2141
+ * submitted. Not available on content quests or prerequisite-only `automatic()`.
2142
+ */
2131
2143
  declare const streak: (options: Omit<StreakPolicy, "kind">) => StreakPolicy;
2132
2144
  declare const streakProgressSchema: z.ZodObject<{
2133
2145
  goal: z.ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domino-sdk/relay",
3
- "version": "1.0.0-next.2",
3
+ "version": "1.0.0-next.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -43,7 +43,7 @@
43
43
  "zod": "4.3.6"
44
44
  },
45
45
  "peerDependencies": {
46
- "react": ">=19"
46
+ "react": "^19.0.0"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "react": {