@domino-sdk/relay 1.0.0-next.10 → 1.0.0-next.13
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.
- package/dist/authoring.d.ts +39 -36
- package/dist/authoring.js +10 -3
- package/dist/avatar.d.ts +2 -2
- package/dist/browser.d.ts +153 -129
- package/dist/browser.js +6 -6
- package/dist/{pages-D3titw5B.d.ts → catalog-C85V1NgW.d.ts} +178 -216
- package/dist/{chunk-ZWY3R6B3.js → chunk-6A2V4L3T.js} +4 -0
- package/dist/{chunk-YYD4QUBO.js → chunk-CRNQP7NV.js} +550 -470
- package/dist/{chunk-X2F2RAR3.js → chunk-EZWNGI5B.js} +23 -4
- package/dist/{chunk-7Q4BGGT6.js → chunk-FXYJ4OMX.js} +1 -1
- package/dist/{chunk-4LBUTHD6.js → chunk-II7DRZSL.js} +1 -1
- package/dist/chunk-KS33GOUL.js +83 -0
- package/dist/{chunk-QR7ZA2BJ.js → chunk-M64XHC42.js} +48 -4
- package/dist/chunk-MNQI35OG.js +100 -0
- package/dist/{chunk-PHU5VDLR.js → chunk-OA2KMQVZ.js} +41 -26
- package/dist/{chunk-P6FK43GG.js → chunk-WQ24ILGO.js} +140 -41
- package/dist/{client-CT4-S5vc.d.ts → client-Bf9PNUIi.d.ts} +61 -80
- package/dist/deployments-CNCP0JnD.d.ts +4250 -0
- package/dist/identity-integration-CBR8l3ju.d.ts +37 -0
- package/dist/images-BG4pdO4y.d.ts +234 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.js +8 -5
- package/dist/{integrations-Ba5TtqTv.d.ts → integrations-EjQzIApL.d.ts} +1 -88
- package/dist/internal.d.ts +7 -38
- package/dist/internal.js +15 -88
- package/dist/observations-CQ6IcNuQ.d.ts +90 -0
- package/dist/pages-KYK1L60W.d.ts +152 -0
- package/dist/portal-proxy.js +5 -4
- package/dist/{profiles-DDMFBRKe.d.ts → profiles-BtOXMGcC.d.ts} +1 -1
- package/dist/react/index.d.ts +150 -31
- package/dist/react/index.js +149 -11
- package/dist/{submission-input-0OOGaq8c.d.ts → referrals-KQfP4pBf.d.ts} +189 -182
- package/dist/request-error-VnTiMXc3.d.ts +52 -0
- package/dist/{schema-Di3aLSiK.d.ts → schema-BF_TQsmT.d.ts} +338 -47
- package/dist/schema.d.ts +14 -4126
- package/dist/schema.js +46 -40
- package/dist/server/index.d.ts +19445 -0
- package/dist/server/index.js +1884 -0
- package/dist/{streaks-CwGReWGt.d.ts → streaks-CWyq8Px5.d.ts} +2 -4
- package/dist/submission-input-CccwAl5Z.d.ts +83 -0
- package/dist/{images-BTgk6OmC.d.ts → trackers-W7nRdRr7.d.ts} +1 -232
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +1 -0
- package/dist/{wallet-BGOfFkG9.d.ts → wallet-BtiG0Xhr.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/point-ledgers-iS00Z_v0.d.ts +0 -37
package/dist/react/index.js
CHANGED
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
discoverSolanaWallets,
|
|
9
9
|
readSignInMethods,
|
|
10
10
|
signInOptionsFrom
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-WQ24ILGO.js";
|
|
12
|
+
import "../chunk-EZWNGI5B.js";
|
|
13
|
+
import "../chunk-M64XHC42.js";
|
|
14
14
|
import {
|
|
15
15
|
RelayError,
|
|
16
16
|
RelayErrorCode
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-OA2KMQVZ.js";
|
|
18
18
|
import {
|
|
19
19
|
sessionMember
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-FXYJ4OMX.js";
|
|
21
|
+
import "../chunk-CRNQP7NV.js";
|
|
22
22
|
|
|
23
23
|
// src/react/provider.tsx
|
|
24
24
|
import { useState as useState3 } from "react";
|
|
@@ -185,7 +185,7 @@ function questStatus(view) {
|
|
|
185
185
|
minute: "2-digit",
|
|
186
186
|
timeZoneName: "short"
|
|
187
187
|
}).format(streak.nextBoundary);
|
|
188
|
-
const progress = streak.todayQualified ? `Today counts. Your next
|
|
188
|
+
const progress = streak.todayQualified ? `Today counts. Your next 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.`;
|
|
189
189
|
return {
|
|
190
190
|
tone: rejection ? "attention" : streak.todayQualified ? "waiting" : "open",
|
|
191
191
|
label: `${streak.current} / ${streak.goal} days`,
|
|
@@ -1269,12 +1269,148 @@ function useLeaderboard(board, options = {}) {
|
|
|
1269
1269
|
return { ...state, refresh };
|
|
1270
1270
|
}
|
|
1271
1271
|
|
|
1272
|
-
// src/react/
|
|
1273
|
-
import { useCallback as useCallback8, useEffect as useEffect10, useState as useState11 } from "react";
|
|
1274
|
-
|
|
1272
|
+
// src/react/balances.ts
|
|
1273
|
+
import { useCallback as useCallback8, useEffect as useEffect10, useRef as useRef5, useState as useState11 } from "react";
|
|
1274
|
+
var signedOut = (cause) => cause instanceof RelayError && cause.status === 401;
|
|
1275
|
+
var messageOf = (cause, fallback) => cause instanceof Error && cause.message ? cause.message : fallback;
|
|
1276
|
+
function useCompletions() {
|
|
1277
|
+
const { experience, member } = useExperience();
|
|
1278
|
+
const mark = experience.status === "ready" ? completionMark([
|
|
1279
|
+
...experience.quests,
|
|
1280
|
+
...experience.collections.flatMap((c) => c.quests)
|
|
1281
|
+
]) : "";
|
|
1282
|
+
return { member, mark };
|
|
1283
|
+
}
|
|
1284
|
+
function useBalances() {
|
|
1275
1285
|
const relay = useRelay();
|
|
1286
|
+
const { member, mark } = useCompletions();
|
|
1276
1287
|
const [state, setState] = useState11({ status: "loading" });
|
|
1288
|
+
const generation = useRef5(0);
|
|
1277
1289
|
const refresh = useCallback8(async () => {
|
|
1290
|
+
const current = ++generation.current;
|
|
1291
|
+
try {
|
|
1292
|
+
const { items } = await relay.me.balances();
|
|
1293
|
+
if (current === generation.current) {
|
|
1294
|
+
setState({ status: "ready", items, stale: null });
|
|
1295
|
+
}
|
|
1296
|
+
} catch (cause) {
|
|
1297
|
+
if (current !== generation.current) {
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
if (signedOut(cause)) {
|
|
1301
|
+
setState({ status: "signed-out" });
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
const message = messageOf(cause, "Could not load your points.");
|
|
1305
|
+
setState(
|
|
1306
|
+
(previous) => previous.status === "ready" ? { ...previous, stale: message } : { status: "error", message }
|
|
1307
|
+
);
|
|
1308
|
+
}
|
|
1309
|
+
}, [relay]);
|
|
1310
|
+
const shown = useRef5(null);
|
|
1311
|
+
useEffect10(() => {
|
|
1312
|
+
if (shown.current !== null && shown.current !== member) {
|
|
1313
|
+
setState({ status: "loading" });
|
|
1314
|
+
}
|
|
1315
|
+
shown.current = member;
|
|
1316
|
+
void refresh();
|
|
1317
|
+
}, [refresh, member, mark]);
|
|
1318
|
+
return { ...state, refresh };
|
|
1319
|
+
}
|
|
1320
|
+
function usePointHistory(ledger) {
|
|
1321
|
+
const relay = useRelay();
|
|
1322
|
+
const { member, mark } = useCompletions();
|
|
1323
|
+
const [state, setState] = useState11({ status: "loading" });
|
|
1324
|
+
const shown = useRef5(null);
|
|
1325
|
+
const cursor = useRef5(null);
|
|
1326
|
+
const generation = useRef5(0);
|
|
1327
|
+
const paging = useRef5({ ready: false, busy: false });
|
|
1328
|
+
const load = useCallback8(
|
|
1329
|
+
async (first) => {
|
|
1330
|
+
if (first) {
|
|
1331
|
+
generation.current++;
|
|
1332
|
+
paging.current = { ready: false, busy: false };
|
|
1333
|
+
} else {
|
|
1334
|
+
if (!paging.current.ready || paging.current.busy || cursor.current === null) {
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
paging.current.busy = true;
|
|
1338
|
+
setState(
|
|
1339
|
+
(previous) => previous.status === "ready" ? { ...previous, loading: true, error: null } : previous
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
const current = generation.current;
|
|
1343
|
+
const own = paging.current;
|
|
1344
|
+
try {
|
|
1345
|
+
const page = await relay.me.pointHistory({
|
|
1346
|
+
ledger,
|
|
1347
|
+
...!first && cursor.current ? { cursor: cursor.current } : {}
|
|
1348
|
+
});
|
|
1349
|
+
if (current !== generation.current) {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
cursor.current = page.nextCursor;
|
|
1353
|
+
own.ready = true;
|
|
1354
|
+
setState((previous) => ({
|
|
1355
|
+
status: "ready",
|
|
1356
|
+
items: !first && previous.status === "ready" ? [...previous.items, ...page.items] : page.items,
|
|
1357
|
+
more: page.nextCursor !== null,
|
|
1358
|
+
loading: false,
|
|
1359
|
+
error: null
|
|
1360
|
+
}));
|
|
1361
|
+
} catch (cause) {
|
|
1362
|
+
if (current !== generation.current) {
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
if (first && signedOut(cause)) {
|
|
1366
|
+
setState({ status: "signed-out" });
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
const code = cause instanceof RelayError ? cause.code : void 0;
|
|
1370
|
+
if (first && code === RelayErrorCode.PointLedgerNotFound) {
|
|
1371
|
+
setState({ status: "missing" });
|
|
1372
|
+
return;
|
|
1373
|
+
}
|
|
1374
|
+
if (first && code === RelayErrorCode.NotJoined) {
|
|
1375
|
+
setState({ status: "not-joined" });
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
1378
|
+
const message = messageOf(cause, "Could not load your point history.");
|
|
1379
|
+
setState(
|
|
1380
|
+
(previous) => !first && previous.status === "ready" ? { ...previous, loading: false, error: message } : { status: "error", message }
|
|
1381
|
+
);
|
|
1382
|
+
} finally {
|
|
1383
|
+
own.busy = false;
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
[relay, ledger]
|
|
1387
|
+
);
|
|
1388
|
+
useEffect10(() => {
|
|
1389
|
+
const previous = shown.current;
|
|
1390
|
+
if (previous && (previous.ledger !== ledger || previous.member !== null && previous.member !== member)) {
|
|
1391
|
+
setState({ status: "loading" });
|
|
1392
|
+
}
|
|
1393
|
+
shown.current = { member, ledger };
|
|
1394
|
+
cursor.current = null;
|
|
1395
|
+
void load(true);
|
|
1396
|
+
return () => {
|
|
1397
|
+
generation.current++;
|
|
1398
|
+
};
|
|
1399
|
+
}, [load, ledger, member, mark]);
|
|
1400
|
+
return {
|
|
1401
|
+
...state,
|
|
1402
|
+
refresh: () => load(true),
|
|
1403
|
+
/** Appends the next page; does nothing while a page loads or when there is none. */
|
|
1404
|
+
loadMore: () => load(false)
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
// src/react/references.ts
|
|
1409
|
+
import { useCallback as useCallback9, useEffect as useEffect11, useState as useState12 } from "react";
|
|
1410
|
+
function useReferences(read, failure) {
|
|
1411
|
+
const relay = useRelay();
|
|
1412
|
+
const [state, setState] = useState12({ status: "loading" });
|
|
1413
|
+
const refresh = useCallback9(async () => {
|
|
1278
1414
|
try {
|
|
1279
1415
|
setState({ status: "ready", items: await read(relay) });
|
|
1280
1416
|
} catch (cause) {
|
|
@@ -1284,7 +1420,7 @@ function useReferences(read, failure) {
|
|
|
1284
1420
|
});
|
|
1285
1421
|
}
|
|
1286
1422
|
}, [relay, read, failure]);
|
|
1287
|
-
|
|
1423
|
+
useEffect11(() => {
|
|
1288
1424
|
void refresh();
|
|
1289
1425
|
}, [refresh]);
|
|
1290
1426
|
return { ...state, refresh };
|
|
@@ -1318,12 +1454,14 @@ export {
|
|
|
1318
1454
|
runsSilently,
|
|
1319
1455
|
sanitizeDeliveries,
|
|
1320
1456
|
useAccounts,
|
|
1457
|
+
useBalances,
|
|
1321
1458
|
useExperience,
|
|
1322
1459
|
useInvitation,
|
|
1323
1460
|
useLeaderboard,
|
|
1324
1461
|
useLeaderboardPlacement,
|
|
1325
1462
|
useMe,
|
|
1326
1463
|
useMyProfile,
|
|
1464
|
+
usePointHistory,
|
|
1327
1465
|
usePointLedgers,
|
|
1328
1466
|
useProfile,
|
|
1329
1467
|
useProfileCompletions,
|