@domino-sdk/relay 1.62.0 → 1.65.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 (74) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/dist/{accounts-CCqCKCVx.d.ts → accounts-_lNsiR2k.d.ts} +42 -4
  3. package/dist/{attempt-captures-Cm-5G0PC.d.ts → attempt-captures-BqPggxTU.d.ts} +1 -1
  4. package/dist/authoring.d.ts +54 -20
  5. package/dist/authoring.js +60 -31
  6. package/dist/{automatic-outcomes-pAsOyIVp.d.ts → automatic-outcomes-BzAvfcpd.d.ts} +11 -1
  7. package/dist/avatar.d.ts +1 -1
  8. package/dist/browser.d.ts +10 -10
  9. package/dist/browser.js +12 -13
  10. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  11. package/dist/{catalog--ZIlskAo.d.ts → catalog-ByZMRS7I.d.ts} +21 -10
  12. package/dist/{chunk-XNKSSE32.js → chunk-4NIV4NPV.js} +7 -7
  13. package/dist/chunk-7H4MRVQF.js +199 -0
  14. package/dist/{chunk-UPQPUJOU.js → chunk-CVQZ2YP7.js} +73 -202
  15. package/dist/{chunk-3PYYGFSB.js → chunk-DLABJSBO.js} +3 -3
  16. package/dist/{chunk-Y322OTCH.js → chunk-E22XSC4L.js} +1 -1
  17. package/dist/{chunk-E6IKQHTX.js → chunk-EDNKKVGU.js} +2 -2
  18. package/dist/{chunk-K2KS3JLY.js → chunk-EOUEAOWJ.js} +35 -4
  19. package/dist/{chunk-6WCIWXUV.js → chunk-EUEW2APU.js} +2 -2
  20. package/dist/{chunk-MK425RXJ.js → chunk-HNR6G3GV.js} +2335 -1538
  21. package/dist/{chunk-UW5232GG.js → chunk-KCUUHT2V.js} +5 -5
  22. package/dist/{chunk-CICDIBOF.js → chunk-MPTE7EIV.js} +76 -74
  23. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  24. package/dist/{chunk-GTDW453U.js → chunk-NG4GZ54I.js} +100 -114
  25. package/dist/chunk-R2KZFX6E.js +405 -0
  26. package/dist/{chunk-HTZHBTIL.js → chunk-RD3XJ4DH.js} +208 -376
  27. package/dist/{chunk-5TEYFX6X.js → chunk-SE7XHQFP.js} +2 -2
  28. package/dist/{chunk-CZFXGGEK.js → chunk-U66GUVSG.js} +2 -2
  29. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  30. package/dist/chunk-UZ765UGH.js +18 -0
  31. package/dist/{chunk-GKIFABGN.js → chunk-VBYOAT46.js} +100 -277
  32. package/dist/{chunk-QYPMPWVX.js → chunk-XVZ4YOF2.js} +43 -43
  33. package/dist/{chunk-3KLC4AMA.js → chunk-ZQ3IPCI6.js} +177 -176
  34. package/dist/chunk-ZXGBDLVB.js +1510 -0
  35. package/dist/{client-B-hbHX30.d.ts → client-D7IiwEq2.d.ts} +31 -62
  36. package/dist/{capability-error-DFMwSuSf.d.ts → dashboards-pVfclkyh.d.ts} +14 -294
  37. package/dist/{deployments-M4OHn7G3.d.ts → deployments-Cr1tfqrr.d.ts} +46 -3
  38. package/dist/{identity-integration-3mX6b5iH.d.ts → identity-integration-Ci2vGKtX.d.ts} +67 -2
  39. package/dist/index.d.ts +11 -11
  40. package/dist/index.js +11 -13
  41. package/dist/internal.d.ts +27 -13
  42. package/dist/internal.js +46 -13
  43. package/dist/{analytics-BwAKLi7O.d.ts → limits-pE04y9O2.d.ts} +131 -3
  44. package/dist/{offers-DhAtss4_.d.ts → offers-Hw2P6tcK.d.ts} +3 -2
  45. package/dist/{participant-activity-D-Drp24G.d.ts → participant-activity-DXRq4s6K.d.ts} +1 -0
  46. package/dist/portal-proxy.d.ts +21 -3
  47. package/dist/portal-proxy.js +72 -22
  48. package/dist/react/index.d.ts +29 -15
  49. package/dist/react/index.js +52 -29
  50. package/dist/{pages-B8q8Y_dQ.d.ts → reward-deliveries-BCV8hznc.d.ts} +300 -233
  51. package/dist/runtime/authoring.js +1 -1
  52. package/dist/runtime/chunks/6EBN6IZU.js +1 -0
  53. package/dist/runtime/manifest.json +3 -3
  54. package/dist/runtime/schema.js +1 -1
  55. package/dist/schema.d.ts +197 -19
  56. package/dist/schema.js +126 -124
  57. package/dist/server/index.d.ts +13 -13
  58. package/dist/server/index.js +5701 -6302
  59. package/dist/{sign-in-providers-BkjcDsFF.d.ts → sign-in-providers-BAkGjSXo.d.ts} +7 -2
  60. package/dist/{submission-input-DHGKhXfp.d.ts → submission-input-ChL1aYNH.d.ts} +3 -2
  61. package/dist/{telegram-browser-BCE7zdOb.d.ts → telegram-browser-K27t4TwM.d.ts} +5 -5
  62. package/dist/telegram.d.ts +9 -9
  63. package/dist/telegram.js +2 -2
  64. package/dist/testing.d.ts +229 -27
  65. package/dist/testing.js +146 -105
  66. package/dist/{tracker-data-Hb1uQnk5.d.ts → tracker-data-Bl-qPIvZ.d.ts} +37 -9
  67. package/dist/{transport-DkhX2Cbs.d.ts → transport-DC1m73Tp.d.ts} +40211 -37736
  68. package/dist/{wallet-DTO7SXj7.d.ts → wallet-B7e06v4m.d.ts} +14 -4
  69. package/package.json +1 -1
  70. package/dist/chunk-D26YNACF.js +0 -320
  71. package/dist/chunk-UAKYDVT3.js +0 -565
  72. package/dist/chunk-WSBYWVTZ.js +0 -717
  73. package/dist/chunk-XJFYAXET.js +0 -87
  74. package/dist/runtime/chunks/Y4OAVXFR.js +0 -1
@@ -8,25 +8,24 @@ import {
8
8
  discoverSolanaWallets,
9
9
  readSignInMethods,
10
10
  signInOptionsFrom
11
- } from "../chunk-UW5232GG.js";
11
+ } from "../chunk-KCUUHT2V.js";
12
12
  import {
13
13
  telegramMiniAppInitData
14
14
  } from "../chunk-FWLQ5XCS.js";
15
- import "../chunk-GKIFABGN.js";
15
+ import "../chunk-VBYOAT46.js";
16
16
  import {
17
17
  createRelayAction
18
- } from "../chunk-Y322OTCH.js";
19
- import "../chunk-6WCIWXUV.js";
20
- import "../chunk-CICDIBOF.js";
21
- import "../chunk-D26YNACF.js";
22
- import "../chunk-GTDW453U.js";
23
- import "../chunk-WSBYWVTZ.js";
24
- import "../chunk-KDR2VAJP.js";
25
- import "../chunk-3PYYGFSB.js";
18
+ } from "../chunk-E22XSC4L.js";
19
+ import "../chunk-EUEW2APU.js";
20
+ import "../chunk-UYVJZR33.js";
21
+ import "../chunk-7H4MRVQF.js";
22
+ import "../chunk-DLABJSBO.js";
23
+ import "../chunk-MPTE7EIV.js";
26
24
  import {
27
25
  sessionMember
28
- } from "../chunk-XJFYAXET.js";
29
- import "../chunk-MK425RXJ.js";
26
+ } from "../chunk-R2KZFX6E.js";
27
+ import "../chunk-NG4GZ54I.js";
28
+ import "../chunk-HNR6G3GV.js";
30
29
  import {
31
30
  RelayError,
32
31
  RelayErrorCode,
@@ -34,11 +33,11 @@ import {
34
33
  clientError,
35
34
  isRelayError,
36
35
  isRequestError
37
- } from "../chunk-K2KS3JLY.js";
36
+ } from "../chunk-EOUEAOWJ.js";
38
37
 
39
38
  // src/react/context.ts
40
39
  import { createContext, useContext } from "react";
41
- var StoreContext = createContext(null);
40
+ var StoreContext = /* @__PURE__ */ (() => createContext(null))();
42
41
  function useStore() {
43
42
  const store = useContext(StoreContext);
44
43
  if (!store) {
@@ -120,11 +119,11 @@ var activityChanges = {
120
119
 
121
120
  // src/react/action.ts
122
121
  import { useCallback, useRef, useState } from "react";
123
- var IDLE = Object.freeze({
122
+ var IDLE = /* @__PURE__ */ (() => Object.freeze({
124
123
  status: "idle",
125
124
  data: void 0,
126
125
  error: null
127
- });
126
+ }))();
128
127
  function actionError(cause) {
129
128
  return isRequestError(cause) && !isRelayError(cause) ? new RelayError(cause.message, {
130
129
  kind: cause.kind,
@@ -220,11 +219,11 @@ import {
220
219
  } from "react";
221
220
 
222
221
  // src/react/cache.ts
223
- var LOADING = Object.freeze({
222
+ var LOADING = /* @__PURE__ */ (() => Object.freeze({
224
223
  status: "loading",
225
224
  data: void 0,
226
225
  error: null
227
- });
226
+ }))();
228
227
  var UNUSED_MS = 5 * 6e4;
229
228
  var STALE_MS = 3e4;
230
229
  var relayError = (cause, fallback) => asRelayError(cause, fallback);
@@ -1041,11 +1040,11 @@ function quote(value) {
1041
1040
  }
1042
1041
 
1043
1042
  // src/react/store.ts
1044
- var SIGNED_OUT = Object.freeze({
1043
+ var SIGNED_OUT = /* @__PURE__ */ (() => Object.freeze({
1045
1044
  status: "signed-out",
1046
1045
  data: void 0,
1047
1046
  error: null
1048
- });
1047
+ }))();
1049
1048
  function scopeKey(session) {
1050
1049
  if (!session) {
1051
1050
  return "visitor";
@@ -1135,12 +1134,17 @@ var RelayStore = class {
1135
1134
  /** The wallet the current session signed in with, while the store follows its accounts. */
1136
1135
  #wallet = null;
1137
1136
  #walletSigningOut = false;
1138
- constructor(client, polling = {}) {
1137
+ /** Bumped by each `delivery.updated` the feed brings, so the role deliveries are read again. */
1138
+ #deliveryChanges = 0;
1139
+ /** Whether a wallet sign-in's session ends when the wallet switches account or locks. */
1140
+ #followWallet;
1141
+ constructor(client, polling = {}, { followWallet = true } = {}) {
1139
1142
  this.client = client;
1140
1143
  this.#polling = {
1141
1144
  activityMs: polling.activityMs ?? ACTIVITY_MS,
1142
1145
  snapshotMs: polling.snapshotMs ?? SNAPSHOT_MS
1143
1146
  };
1147
+ this.#followWallet = followWallet;
1144
1148
  }
1145
1149
  /** `refreshSession` with one identity per store, for hooks to hand out as `refresh`. */
1146
1150
  rereadSession = () => this.refreshSession();
@@ -1159,6 +1163,10 @@ var RelayStore = class {
1159
1163
  get experience() {
1160
1164
  return this.#experienceView;
1161
1165
  }
1166
+ /** How many `delivery.updated` events the feed brought; changes when a delivery did. */
1167
+ get deliveryChanges() {
1168
+ return this.#deliveryChanges;
1169
+ }
1162
1170
  /** The first query cache of this mount, the only one a public read's `initialData` seeds. */
1163
1171
  get firstCache() {
1164
1172
  return this.#firstCache;
@@ -1395,6 +1403,9 @@ var RelayStore = class {
1395
1403
  /** Signs out when the wallet `session` signed in with reports another account, or none. */
1396
1404
  #watchWallet(signer, address, session) {
1397
1405
  this.#stopWallet(false);
1406
+ if (!this.#followWallet) {
1407
+ return;
1408
+ }
1398
1409
  const signedIn = address.toLowerCase();
1399
1410
  const watch = { session, stop: () => {
1400
1411
  } };
@@ -1465,6 +1476,10 @@ var RelayStore = class {
1465
1476
  if (keys.size > 0) {
1466
1477
  void this.#scope?.cache.invalidate([...keys.values()]);
1467
1478
  }
1479
+ if (events.some((event) => event.kind === "delivery.updated")) {
1480
+ this.#deliveryChanges += 1;
1481
+ this.#emit();
1482
+ }
1468
1483
  }
1469
1484
  #startObserver() {
1470
1485
  if (this.#observer || !this.#mounted) {
@@ -2132,15 +2147,15 @@ import {
2132
2147
 
2133
2148
  // src/react/use-role-deliveries.ts
2134
2149
  import { useEffect as useEffect3, useState as useState4 } from "react";
2135
- var NONE = Object.freeze([]);
2136
- function useRoleDeliveries(relay, member, completions) {
2150
+ var NONE = /* @__PURE__ */ (() => Object.freeze([]))();
2151
+ function useRoleDeliveries(relay, member, completions, changes = 0) {
2137
2152
  const [state, setState] = useState4(null);
2138
2153
  useEffect3(() => {
2139
2154
  if (!member || !completions) {
2140
2155
  return;
2141
2156
  }
2142
2157
  const watch = watchRoleDeliveries({
2143
- read: async () => (await relay.me.rewardDeliveries()).deliveries,
2158
+ read: async () => (await relay.me.rewardDeliveries()).items,
2144
2159
  onChange: (deliveries) => setState({ member, deliveries })
2145
2160
  });
2146
2161
  const wake = () => {
@@ -2155,13 +2170,13 @@ function useRoleDeliveries(relay, member, completions) {
2155
2170
  window.removeEventListener("focus", wake);
2156
2171
  document.removeEventListener("visibilitychange", wake);
2157
2172
  };
2158
- }, [relay, member, completions]);
2173
+ }, [relay, member, completions, changes]);
2159
2174
  return member && completions && state?.member === member ? state.deliveries : NONE;
2160
2175
  }
2161
2176
 
2162
2177
  // src/react/experience.tsx
2163
2178
  import { jsx } from "react/jsx-runtime";
2164
- var Deliveries = createContext2(Object.freeze([]));
2179
+ var Deliveries = /* @__PURE__ */ (() => createContext2(Object.freeze([])))();
2165
2180
  function useExperienceSnapshot() {
2166
2181
  const store = useStore();
2167
2182
  const get = () => store.experience;
@@ -2175,6 +2190,11 @@ function DeliveriesProvider({ children }) {
2175
2190
  () => store.scope?.member ?? null,
2176
2191
  () => null
2177
2192
  );
2193
+ const changes = useSyncExternalStore3(
2194
+ store.subscribe,
2195
+ () => store.deliveryChanges,
2196
+ () => 0
2197
+ );
2178
2198
  const ready = experience.status === "ready";
2179
2199
  const deliveries = useRoleDeliveries(
2180
2200
  store.client,
@@ -2182,7 +2202,8 @@ function DeliveriesProvider({ children }) {
2182
2202
  ready ? completionMark([
2183
2203
  ...experience.data.quests,
2184
2204
  ...experience.data.collections.flatMap((c) => c.quests)
2185
- ]) : ""
2205
+ ]) : "",
2206
+ changes
2186
2207
  );
2187
2208
  return /* @__PURE__ */ jsx(Deliveries, { value: deliveries, children });
2188
2209
  }
@@ -2203,6 +2224,7 @@ function RelayProvider({
2203
2224
  client,
2204
2225
  baseUrl = "/relay",
2205
2226
  polling,
2227
+ followWallet = true,
2206
2228
  children
2207
2229
  }) {
2208
2230
  const origin = client ? null : baseUrl;
@@ -2211,10 +2233,11 @@ function RelayProvider({
2211
2233
  const store = useMemo4(
2212
2234
  () => new RelayStore(
2213
2235
  client ?? createBrowserRelayClient({ baseUrl: origin ?? baseUrl }),
2214
- { activityMs, snapshotMs }
2236
+ { activityMs, snapshotMs },
2237
+ { followWallet }
2215
2238
  ),
2216
2239
  // A given client ignores `baseUrl`; `polling` is compared by value.
2217
- [client, origin, activityMs, snapshotMs]
2240
+ [client, origin, activityMs, snapshotMs, followWallet]
2218
2241
  );
2219
2242
  useEffect4(() => store.mount(), [store]);
2220
2243
  return /* @__PURE__ */ jsx2(StoreContext, { value: store, children: /* @__PURE__ */ jsx2(DeliveriesProvider, { children }) });