@domino-sdk/relay 1.62.0 → 1.63.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 +120 -0
  2. package/dist/{accounts-CCqCKCVx.d.ts → accounts-nz3mzfRQ.d.ts} +21 -3
  3. package/dist/{attempt-captures-Cm-5G0PC.d.ts → attempt-captures-DMi8oR9T.d.ts} +1 -1
  4. package/dist/authoring.d.ts +54 -20
  5. package/dist/authoring.js +58 -24
  6. package/dist/{automatic-outcomes-pAsOyIVp.d.ts → automatic-outcomes-C_LLQU1p.d.ts} +11 -1
  7. package/dist/avatar.d.ts +1 -1
  8. package/dist/browser.d.ts +9 -9
  9. package/dist/browser.js +15 -13
  10. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  11. package/dist/{catalog--ZIlskAo.d.ts → catalog-BaTOKpNw.d.ts} +21 -10
  12. package/dist/{chunk-3PYYGFSB.js → chunk-3RFP6GT5.js} +3 -3
  13. package/dist/{chunk-HTZHBTIL.js → chunk-4GQW43UU.js} +193 -357
  14. package/dist/{chunk-D26YNACF.js → chunk-4NOFSGAL.js} +56 -56
  15. package/dist/{chunk-UW5232GG.js → chunk-5XLZ34PV.js} +5 -5
  16. package/dist/{chunk-QYPMPWVX.js → chunk-7X67QLPB.js} +43 -43
  17. package/dist/{chunk-5TEYFX6X.js → chunk-7Z4SZ6YM.js} +2 -2
  18. package/dist/{chunk-Y322OTCH.js → chunk-AQOL3SK5.js} +1 -1
  19. package/dist/{chunk-CICDIBOF.js → chunk-EHUSD3O2.js} +76 -72
  20. package/dist/chunk-FO2LCZTL.js +19 -0
  21. package/dist/{chunk-3KLC4AMA.js → chunk-FU5CGNTR.js} +135 -173
  22. package/dist/{chunk-K2KS3JLY.js → chunk-GLH6MEI2.js} +7 -2
  23. package/dist/chunk-ICXZZNPS.js +199 -0
  24. package/dist/{chunk-MK425RXJ.js → chunk-ID3BZXFZ.js} +709 -640
  25. package/dist/{chunk-UAKYDVT3.js → chunk-KP2MCX3R.js} +111 -89
  26. package/dist/{chunk-GKIFABGN.js → chunk-LZWXCBUB.js} +74 -247
  27. package/dist/{chunk-6WCIWXUV.js → chunk-MTKRIQEU.js} +2 -2
  28. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  29. package/dist/{chunk-XJFYAXET.js → chunk-N4BDKS6Y.js} +19 -19
  30. package/dist/{chunk-E6IKQHTX.js → chunk-N4LNEGQX.js} +2 -2
  31. package/dist/chunk-NQDEWJWE.js +554 -0
  32. package/dist/{chunk-GTDW453U.js → chunk-QR6HH4DI.js} +100 -114
  33. package/dist/chunk-TLSQETTY.js +41 -0
  34. package/dist/{chunk-CZFXGGEK.js → chunk-U66GUVSG.js} +2 -2
  35. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  36. package/dist/chunk-UZ765UGH.js +18 -0
  37. package/dist/{chunk-XNKSSE32.js → chunk-VWQGWGCH.js} +7 -7
  38. package/dist/{chunk-WSBYWVTZ.js → chunk-W7YSMSGC.js} +166 -158
  39. package/dist/{client-B-hbHX30.d.ts → client-DHmG7rn6.d.ts} +25 -61
  40. package/dist/{capability-error-DFMwSuSf.d.ts → dashboards-CLemT6kj.d.ts} +14 -294
  41. package/dist/{deployments-M4OHn7G3.d.ts → deployments-DTULi7dF.d.ts} +46 -3
  42. package/dist/{identity-integration-3mX6b5iH.d.ts → identity-integration-DOeNZaxF.d.ts} +32 -2
  43. package/dist/index.d.ts +10 -10
  44. package/dist/index.js +13 -11
  45. package/dist/internal.d.ts +27 -13
  46. package/dist/internal.js +41 -13
  47. package/dist/{analytics-BwAKLi7O.d.ts → limits-kNzYdZ00.d.ts} +124 -3
  48. package/dist/{offers-DhAtss4_.d.ts → offers-CYeN_I0Y.d.ts} +3 -2
  49. package/dist/portal-proxy.d.ts +19 -3
  50. package/dist/portal-proxy.js +64 -22
  51. package/dist/react/index.d.ts +21 -14
  52. package/dist/react/index.js +55 -29
  53. package/dist/{pages-B8q8Y_dQ.d.ts → reward-deliveries-drp-x1G-.d.ts} +300 -233
  54. package/dist/runtime/authoring.js +1 -1
  55. package/dist/runtime/chunks/UGDV5W4N.js +1 -0
  56. package/dist/runtime/manifest.json +3 -3
  57. package/dist/runtime/schema.js +1 -1
  58. package/dist/schema.d.ts +193 -18
  59. package/dist/schema.js +31 -26
  60. package/dist/server/index.d.ts +13 -13
  61. package/dist/server/index.js +5885 -6224
  62. package/dist/{sign-in-providers-BkjcDsFF.d.ts → sign-in-providers-B1Q9eDRm.d.ts} +7 -2
  63. package/dist/{submission-input-DHGKhXfp.d.ts → submission-input-DZCbjQUH.d.ts} +3 -2
  64. package/dist/{telegram-browser-BCE7zdOb.d.ts → telegram-browser-NL0Asmsi.d.ts} +4 -4
  65. package/dist/telegram.d.ts +8 -8
  66. package/dist/telegram.js +2 -2
  67. package/dist/testing.d.ts +228 -26
  68. package/dist/testing.js +137 -92
  69. package/dist/{tracker-data-Hb1uQnk5.d.ts → tracker-data-esm3WG8R.d.ts} +34 -8
  70. package/dist/{transport-DkhX2Cbs.d.ts → transport-Czht_irp.d.ts} +41259 -39835
  71. package/dist/{wallet-DTO7SXj7.d.ts → wallet-B7e06v4m.d.ts} +14 -4
  72. package/package.json +1 -1
  73. package/dist/chunk-UPQPUJOU.js +0 -457
  74. package/dist/runtime/chunks/Y4OAVXFR.js +0 -1
@@ -8,25 +8,27 @@ import {
8
8
  discoverSolanaWallets,
9
9
  readSignInMethods,
10
10
  signInOptionsFrom
11
- } from "../chunk-UW5232GG.js";
11
+ } from "../chunk-5XLZ34PV.js";
12
12
  import {
13
13
  telegramMiniAppInitData
14
14
  } from "../chunk-FWLQ5XCS.js";
15
- import "../chunk-GKIFABGN.js";
15
+ import "../chunk-LZWXCBUB.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-AQOL3SK5.js";
19
+ import "../chunk-MTKRIQEU.js";
20
+ import "../chunk-EHUSD3O2.js";
21
+ import "../chunk-4NOFSGAL.js";
22
+ import "../chunk-QR6HH4DI.js";
23
+ import "../chunk-W7YSMSGC.js";
24
+ import "../chunk-UYVJZR33.js";
25
+ import "../chunk-ICXZZNPS.js";
26
+ import "../chunk-FO2LCZTL.js";
27
+ import "../chunk-3RFP6GT5.js";
26
28
  import {
27
29
  sessionMember
28
- } from "../chunk-XJFYAXET.js";
29
- import "../chunk-MK425RXJ.js";
30
+ } from "../chunk-N4BDKS6Y.js";
31
+ import "../chunk-ID3BZXFZ.js";
30
32
  import {
31
33
  RelayError,
32
34
  RelayErrorCode,
@@ -34,11 +36,11 @@ import {
34
36
  clientError,
35
37
  isRelayError,
36
38
  isRequestError
37
- } from "../chunk-K2KS3JLY.js";
39
+ } from "../chunk-GLH6MEI2.js";
38
40
 
39
41
  // src/react/context.ts
40
42
  import { createContext, useContext } from "react";
41
- var StoreContext = createContext(null);
43
+ var StoreContext = /* @__PURE__ */ (() => createContext(null))();
42
44
  function useStore() {
43
45
  const store = useContext(StoreContext);
44
46
  if (!store) {
@@ -120,11 +122,11 @@ var activityChanges = {
120
122
 
121
123
  // src/react/action.ts
122
124
  import { useCallback, useRef, useState } from "react";
123
- var IDLE = Object.freeze({
125
+ var IDLE = /* @__PURE__ */ (() => Object.freeze({
124
126
  status: "idle",
125
127
  data: void 0,
126
128
  error: null
127
- });
129
+ }))();
128
130
  function actionError(cause) {
129
131
  return isRequestError(cause) && !isRelayError(cause) ? new RelayError(cause.message, {
130
132
  kind: cause.kind,
@@ -220,11 +222,11 @@ import {
220
222
  } from "react";
221
223
 
222
224
  // src/react/cache.ts
223
- var LOADING = Object.freeze({
225
+ var LOADING = /* @__PURE__ */ (() => Object.freeze({
224
226
  status: "loading",
225
227
  data: void 0,
226
228
  error: null
227
- });
229
+ }))();
228
230
  var UNUSED_MS = 5 * 6e4;
229
231
  var STALE_MS = 3e4;
230
232
  var relayError = (cause, fallback) => asRelayError(cause, fallback);
@@ -1041,11 +1043,11 @@ function quote(value) {
1041
1043
  }
1042
1044
 
1043
1045
  // src/react/store.ts
1044
- var SIGNED_OUT = Object.freeze({
1046
+ var SIGNED_OUT = /* @__PURE__ */ (() => Object.freeze({
1045
1047
  status: "signed-out",
1046
1048
  data: void 0,
1047
1049
  error: null
1048
- });
1050
+ }))();
1049
1051
  function scopeKey(session) {
1050
1052
  if (!session) {
1051
1053
  return "visitor";
@@ -1135,12 +1137,17 @@ var RelayStore = class {
1135
1137
  /** The wallet the current session signed in with, while the store follows its accounts. */
1136
1138
  #wallet = null;
1137
1139
  #walletSigningOut = false;
1138
- constructor(client, polling = {}) {
1140
+ /** Bumped by each `delivery.updated` the feed brings, so the role deliveries are read again. */
1141
+ #deliveryChanges = 0;
1142
+ /** Whether a wallet sign-in's session ends when the wallet switches account or locks. */
1143
+ #followWallet;
1144
+ constructor(client, polling = {}, { followWallet = true } = {}) {
1139
1145
  this.client = client;
1140
1146
  this.#polling = {
1141
1147
  activityMs: polling.activityMs ?? ACTIVITY_MS,
1142
1148
  snapshotMs: polling.snapshotMs ?? SNAPSHOT_MS
1143
1149
  };
1150
+ this.#followWallet = followWallet;
1144
1151
  }
1145
1152
  /** `refreshSession` with one identity per store, for hooks to hand out as `refresh`. */
1146
1153
  rereadSession = () => this.refreshSession();
@@ -1159,6 +1166,10 @@ var RelayStore = class {
1159
1166
  get experience() {
1160
1167
  return this.#experienceView;
1161
1168
  }
1169
+ /** How many `delivery.updated` events the feed brought; changes when a delivery did. */
1170
+ get deliveryChanges() {
1171
+ return this.#deliveryChanges;
1172
+ }
1162
1173
  /** The first query cache of this mount, the only one a public read's `initialData` seeds. */
1163
1174
  get firstCache() {
1164
1175
  return this.#firstCache;
@@ -1395,6 +1406,9 @@ var RelayStore = class {
1395
1406
  /** Signs out when the wallet `session` signed in with reports another account, or none. */
1396
1407
  #watchWallet(signer, address, session) {
1397
1408
  this.#stopWallet(false);
1409
+ if (!this.#followWallet) {
1410
+ return;
1411
+ }
1398
1412
  const signedIn = address.toLowerCase();
1399
1413
  const watch = { session, stop: () => {
1400
1414
  } };
@@ -1465,6 +1479,10 @@ var RelayStore = class {
1465
1479
  if (keys.size > 0) {
1466
1480
  void this.#scope?.cache.invalidate([...keys.values()]);
1467
1481
  }
1482
+ if (events.some((event) => event.kind === "delivery.updated")) {
1483
+ this.#deliveryChanges += 1;
1484
+ this.#emit();
1485
+ }
1468
1486
  }
1469
1487
  #startObserver() {
1470
1488
  if (this.#observer || !this.#mounted) {
@@ -2132,15 +2150,15 @@ import {
2132
2150
 
2133
2151
  // src/react/use-role-deliveries.ts
2134
2152
  import { useEffect as useEffect3, useState as useState4 } from "react";
2135
- var NONE = Object.freeze([]);
2136
- function useRoleDeliveries(relay, member, completions) {
2153
+ var NONE = /* @__PURE__ */ (() => Object.freeze([]))();
2154
+ function useRoleDeliveries(relay, member, completions, changes = 0) {
2137
2155
  const [state, setState] = useState4(null);
2138
2156
  useEffect3(() => {
2139
2157
  if (!member || !completions) {
2140
2158
  return;
2141
2159
  }
2142
2160
  const watch = watchRoleDeliveries({
2143
- read: async () => (await relay.me.rewardDeliveries()).deliveries,
2161
+ read: async () => (await relay.me.rewardDeliveries()).items,
2144
2162
  onChange: (deliveries) => setState({ member, deliveries })
2145
2163
  });
2146
2164
  const wake = () => {
@@ -2155,13 +2173,13 @@ function useRoleDeliveries(relay, member, completions) {
2155
2173
  window.removeEventListener("focus", wake);
2156
2174
  document.removeEventListener("visibilitychange", wake);
2157
2175
  };
2158
- }, [relay, member, completions]);
2176
+ }, [relay, member, completions, changes]);
2159
2177
  return member && completions && state?.member === member ? state.deliveries : NONE;
2160
2178
  }
2161
2179
 
2162
2180
  // src/react/experience.tsx
2163
2181
  import { jsx } from "react/jsx-runtime";
2164
- var Deliveries = createContext2(Object.freeze([]));
2182
+ var Deliveries = /* @__PURE__ */ (() => createContext2(Object.freeze([])))();
2165
2183
  function useExperienceSnapshot() {
2166
2184
  const store = useStore();
2167
2185
  const get = () => store.experience;
@@ -2175,6 +2193,11 @@ function DeliveriesProvider({ children }) {
2175
2193
  () => store.scope?.member ?? null,
2176
2194
  () => null
2177
2195
  );
2196
+ const changes = useSyncExternalStore3(
2197
+ store.subscribe,
2198
+ () => store.deliveryChanges,
2199
+ () => 0
2200
+ );
2178
2201
  const ready = experience.status === "ready";
2179
2202
  const deliveries = useRoleDeliveries(
2180
2203
  store.client,
@@ -2182,7 +2205,8 @@ function DeliveriesProvider({ children }) {
2182
2205
  ready ? completionMark([
2183
2206
  ...experience.data.quests,
2184
2207
  ...experience.data.collections.flatMap((c) => c.quests)
2185
- ]) : ""
2208
+ ]) : "",
2209
+ changes
2186
2210
  );
2187
2211
  return /* @__PURE__ */ jsx(Deliveries, { value: deliveries, children });
2188
2212
  }
@@ -2203,6 +2227,7 @@ function RelayProvider({
2203
2227
  client,
2204
2228
  baseUrl = "/relay",
2205
2229
  polling,
2230
+ followWallet = true,
2206
2231
  children
2207
2232
  }) {
2208
2233
  const origin = client ? null : baseUrl;
@@ -2211,10 +2236,11 @@ function RelayProvider({
2211
2236
  const store = useMemo4(
2212
2237
  () => new RelayStore(
2213
2238
  client ?? createBrowserRelayClient({ baseUrl: origin ?? baseUrl }),
2214
- { activityMs, snapshotMs }
2239
+ { activityMs, snapshotMs },
2240
+ { followWallet }
2215
2241
  ),
2216
2242
  // A given client ignores `baseUrl`; `polling` is compared by value.
2217
- [client, origin, activityMs, snapshotMs]
2243
+ [client, origin, activityMs, snapshotMs, followWallet]
2218
2244
  );
2219
2245
  useEffect4(() => store.mount(), [store]);
2220
2246
  return /* @__PURE__ */ jsx2(StoreContext, { value: store, children: /* @__PURE__ */ jsx2(DeliveriesProvider, { children }) });