@domino-sdk/relay 1.5.2 → 1.7.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.
- package/dist/{activity-DeKJsRry.d.ts → activity-Br6vyYze.d.ts} +147 -116
- package/dist/authoring.d.ts +59 -47
- package/dist/authoring.js +3 -3
- package/dist/{automatic-outcomes-B1xrETxm.d.ts → automatic-outcomes-C1Q9LrDb.d.ts} +224 -13
- package/dist/browser.d.ts +22 -10
- package/dist/browser.js +6 -6
- package/dist/{capability-error-DNMwKmlL.d.ts → capability-error-Bv996M-h.d.ts} +2 -0
- package/dist/{chunk-GQKYAQM6.js → chunk-23QJ7WH4.js} +1 -1
- package/dist/{chunk-WJSSJ7AF.js → chunk-5ECM6AWV.js} +24 -4
- package/dist/{chunk-XFMSUPNS.js → chunk-6ON4RMEN.js} +1 -1
- package/dist/{chunk-VFHHLN6A.js → chunk-6RBF3UDA.js} +49 -6
- package/dist/chunk-AXRMT33W.js +112 -0
- package/dist/{chunk-24AFCBZN.js → chunk-BFZHJA2B.js} +2 -2
- package/dist/{chunk-EYH5RDIE.js → chunk-C25TDFHN.js} +4 -2
- package/dist/{chunk-36HTX2BM.js → chunk-GMPPLZKH.js} +61 -4
- package/dist/{chunk-BGGKNIRP.js → chunk-JW4G3SY5.js} +1 -1
- package/dist/{chunk-JON5SESL.js → chunk-KGJSKGKI.js} +84 -6
- package/dist/{chunk-DGWMLN35.js → chunk-ZOUEEK5L.js} +16 -5
- package/dist/{client-gqnRUHpC.d.ts → client-pfml_XAa.d.ts} +88 -41
- package/dist/{groups-Ck-OxzjD.d.ts → groups-BpWEqaPn.d.ts} +175 -3
- package/dist/{images-Dv-P5VBw.d.ts → images-BaKYd0fl.d.ts} +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +5 -5
- package/dist/internal.d.ts +6 -113
- package/dist/internal.js +18 -24
- package/dist/{offers-Cy-e4o5x.d.ts → offers-CYtal8jO.d.ts} +3 -2
- package/dist/{outcomes-kVB-Juzs.d.ts → pages-CixTNnF4.d.ts} +142 -99
- package/dist/{pages-BBYD21IE.d.ts → participant-activity-DkL3nY5a.d.ts} +1 -14
- package/dist/portal-proxy.js +48 -36
- package/dist/react/index.d.ts +25 -3949
- package/dist/react/index.js +8 -7
- package/dist/referral-reward-kinds-ClxAuCGx.d.ts +171 -0
- package/dist/{request-error-DWduJCGV.d.ts → request-error-D_dUPLwo.d.ts} +5 -0
- package/dist/{schema-DfJzH2ci.d.ts → schema-CQydLqw4.d.ts} +122 -37
- package/dist/schema.d.ts +10 -10
- package/dist/schema.js +48 -6
- package/dist/server/index.d.ts +9673 -66110
- package/dist/server/index.js +1048 -550
- package/dist/sign-in-options-CtXUFV7E.d.ts +202 -0
- package/dist/{submission-input-BZkm6ohU.d.ts → submission-input-CLefHTrj.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/browser-D_3s8B5e.d.ts +0 -4154
- package/dist/chunk-GUP7YRR4.js +0 -42
- package/dist/identity-integration-GxAHdKR2.d.ts +0 -58
|
@@ -390,7 +390,7 @@ function literalsOf(schema) {
|
|
|
390
390
|
}
|
|
391
391
|
function matches(schema, value, at, budget) {
|
|
392
392
|
charge(budget, 1);
|
|
393
|
-
const issue = (
|
|
393
|
+
const issue = (reason2) => ({ at, reason: reason2 });
|
|
394
394
|
if (schema.const !== void 0 && value !== schema.const) {
|
|
395
395
|
return issue(() => `expected ${JSON.stringify(schema.const)}`);
|
|
396
396
|
}
|
|
@@ -1078,7 +1078,7 @@ var trackerSkipCodes = [
|
|
|
1078
1078
|
"prerequisites-incomplete"
|
|
1079
1079
|
];
|
|
1080
1080
|
var trackerOutcomeSchema = z6.discriminatedUnion("state", [
|
|
1081
|
-
z6.
|
|
1081
|
+
z6.object({
|
|
1082
1082
|
...trackerOutcomeFields,
|
|
1083
1083
|
state: z6.literal("admitted"),
|
|
1084
1084
|
code: z6.null(),
|
|
@@ -1088,19 +1088,21 @@ var trackerOutcomeSchema = z6.discriminatedUnion("state", [
|
|
|
1088
1088
|
/** The admitted attempt. Its evaluation, decision and rewards live on the attempt. */
|
|
1089
1089
|
attempt: identifier
|
|
1090
1090
|
}),
|
|
1091
|
-
z6.
|
|
1091
|
+
z6.object({
|
|
1092
1092
|
...trackerOutcomeFields,
|
|
1093
1093
|
state: z6.literal("skipped"),
|
|
1094
1094
|
/** Why the observation was skipped, as one of `trackerSkipCodes`. */
|
|
1095
1095
|
code: z6.string().min(1),
|
|
1096
1096
|
/** Why the observation was skipped, for people. */
|
|
1097
1097
|
reason: z6.string(),
|
|
1098
|
+
/** Which window refused admission when `code` is `outside-window`. */
|
|
1099
|
+
window: z6.enum(["tracker", "quest"]).optional(),
|
|
1098
1100
|
/** The attributed member, when attribution got that far. */
|
|
1099
1101
|
member: identifier.nullable(),
|
|
1100
1102
|
attempt: identifier.nullable()
|
|
1101
1103
|
})
|
|
1102
1104
|
]);
|
|
1103
|
-
var
|
|
1105
|
+
var trackerOutcomeFilters = {
|
|
1104
1106
|
/** Quest key or ID. */
|
|
1105
1107
|
quest: identifier.optional(),
|
|
1106
1108
|
record: externalId.optional(),
|
|
@@ -1108,7 +1110,18 @@ var trackerOutcomeQuerySchema = z6.strictObject({
|
|
|
1108
1110
|
state: z6.enum(["admitted", "skipped"]).optional(),
|
|
1109
1111
|
/** Only skips with this code, such as `unlinked-account`. */
|
|
1110
1112
|
code: z6.string().min(1).max(100).optional(),
|
|
1111
|
-
limit: z6.coerce.number().int().min(1).max(100).default(25)
|
|
1113
|
+
limit: z6.coerce.number().int().min(1).max(100).default(25)
|
|
1114
|
+
};
|
|
1115
|
+
var trackerTriggerOutcomeQuerySchema = z6.strictObject({
|
|
1116
|
+
...trackerOutcomeFilters,
|
|
1117
|
+
cursor: pageCursorSchema.optional()
|
|
1118
|
+
});
|
|
1119
|
+
var trackerTriggerOutcomePageSchema = z6.object({
|
|
1120
|
+
items: z6.array(trackerOutcomeSchema).max(100),
|
|
1121
|
+
nextCursor: pageCursorSchema.nullable()
|
|
1122
|
+
});
|
|
1123
|
+
var trackerOutcomeQuerySchema = z6.strictObject({
|
|
1124
|
+
...trackerOutcomeFilters,
|
|
1112
1125
|
/** Opaque cursor from `next`: older outcomes. */
|
|
1113
1126
|
before: z6.string().max(512).optional()
|
|
1114
1127
|
});
|
|
@@ -1829,6 +1842,9 @@ var resourceOptionsSchema = z16.object({
|
|
|
1829
1842
|
disabledReason: z16.string().optional()
|
|
1830
1843
|
})
|
|
1831
1844
|
),
|
|
1845
|
+
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
1846
|
+
nextCursor: z16.string().nullable().default(null),
|
|
1847
|
+
/** @deprecated Use `nextCursor`. Removed in 2.0.0. */
|
|
1832
1848
|
cursor: z16.string().nullable()
|
|
1833
1849
|
});
|
|
1834
1850
|
|
|
@@ -2017,6 +2033,37 @@ function defineGroup(input) {
|
|
|
2017
2033
|
function projectGroupKey(group) {
|
|
2018
2034
|
return identifier.parse(group.key);
|
|
2019
2035
|
}
|
|
2036
|
+
var groupTitle = z21.string().trim().min(1).max(120);
|
|
2037
|
+
var reason = z21.string().trim().min(1).max(1e3);
|
|
2038
|
+
var timestamp5 = z21.number().int().nonnegative().max(864e13);
|
|
2039
|
+
var createGroupSchema = z21.object({ actionId: identifier, key: identifier, title: groupTitle }).strict();
|
|
2040
|
+
var updateGroupSchema = z21.object({ title: groupTitle }).strict();
|
|
2041
|
+
var addGroupMemberSchema = z21.object({ actionId: identifier, member: identifier, reason }).strict();
|
|
2042
|
+
var removeGroupMemberSchema = z21.object({ actionId: identifier, reason }).strict();
|
|
2043
|
+
var groupPageQuerySchema = z21.strictObject({
|
|
2044
|
+
cursor: pageCursorSchema.optional(),
|
|
2045
|
+
/** Items per page, 1–100; the default is 50. */
|
|
2046
|
+
limit: z21.number().int().min(1).max(100).optional()
|
|
2047
|
+
});
|
|
2048
|
+
var managedGroupSchema = z21.object({
|
|
2049
|
+
key: identifier,
|
|
2050
|
+
title: z21.string(),
|
|
2051
|
+
members: z21.number().int().nonnegative(),
|
|
2052
|
+
createdAt: timestamp5,
|
|
2053
|
+
archivedAt: timestamp5.nullable()
|
|
2054
|
+
});
|
|
2055
|
+
var groupPageSchema = z21.object({
|
|
2056
|
+
items: z21.array(managedGroupSchema),
|
|
2057
|
+
nextCursor: pageCursorSchema.nullable()
|
|
2058
|
+
});
|
|
2059
|
+
var groupMemberSchema = z21.object({
|
|
2060
|
+
member: identifier,
|
|
2061
|
+
addedAt: timestamp5.nullable()
|
|
2062
|
+
});
|
|
2063
|
+
var groupMemberPageSchema = z21.object({
|
|
2064
|
+
items: z21.array(groupMemberSchema),
|
|
2065
|
+
nextCursor: pageCursorSchema.nullable()
|
|
2066
|
+
});
|
|
2020
2067
|
|
|
2021
2068
|
// src/prerequisites.ts
|
|
2022
2069
|
import { z as z22 } from "zod";
|
|
@@ -2339,6 +2386,7 @@ var submitSchema = z23.object({
|
|
|
2339
2386
|
evidence: identifier.optional(),
|
|
2340
2387
|
input: submissionEvidenceSchema.optional(),
|
|
2341
2388
|
release: identifier.optional(),
|
|
2389
|
+
/** @deprecated Relay refuses a submission that sets it to `true` and ignores `false`. Removed in 2.0.0. */
|
|
2342
2390
|
faultAfterReview: z23.boolean().optional()
|
|
2343
2391
|
}).strict();
|
|
2344
2392
|
var AttemptStatus = {
|
|
@@ -2545,11 +2593,24 @@ var entitlementCorrectionSchema = z23.object({
|
|
|
2545
2593
|
revision: z23.number().int().positive(),
|
|
2546
2594
|
reason: z23.string().trim().min(1).max(500)
|
|
2547
2595
|
}).strict();
|
|
2596
|
+
var CompletionSourceKind = {
|
|
2597
|
+
Quest: "quest",
|
|
2598
|
+
Leaderboard: "leaderboard"
|
|
2599
|
+
};
|
|
2600
|
+
var completionSourceKindSchema = z23.string().min(1).max(64);
|
|
2601
|
+
var completionSourceSchema = z23.object({
|
|
2602
|
+
kind: completionSourceKindSchema,
|
|
2603
|
+
id: identifier
|
|
2604
|
+
});
|
|
2548
2605
|
var completionRecordSchema = z23.object({
|
|
2606
|
+
/** The occurrence the completion consumed. For a leaderboard prize, the settlement ID. */
|
|
2549
2607
|
key: z23.string().default("once"),
|
|
2550
2608
|
id: identifier,
|
|
2609
|
+
/** The quest ID, or the board ID when `source.kind` is `leaderboard`. */
|
|
2551
2610
|
quest: identifier,
|
|
2552
|
-
member: identifier
|
|
2611
|
+
member: identifier,
|
|
2612
|
+
/** What paid the completion. `source.id` repeats `quest`. */
|
|
2613
|
+
source: completionSourceSchema.optional()
|
|
2553
2614
|
});
|
|
2554
2615
|
var questAvailabilitySchema = z23.discriminatedUnion("kind", [
|
|
2555
2616
|
z23.object({
|
|
@@ -2571,6 +2632,8 @@ var questAvailabilitySchema = z23.discriminatedUnion("kind", [
|
|
|
2571
2632
|
"outside-window",
|
|
2572
2633
|
"enrollment-required"
|
|
2573
2634
|
]),
|
|
2635
|
+
/** Which window refused admission when `reason` is `outside-window`. */
|
|
2636
|
+
window: z23.enum(["tracker", "quest"]).optional(),
|
|
2574
2637
|
resetsAt: z23.number().int().safe().optional()
|
|
2575
2638
|
}).strict(),
|
|
2576
2639
|
z23.object({ kind: z23.literal("staff-required") }).strict(),
|
|
@@ -2643,6 +2706,8 @@ var evidenceSchema = z23.object({
|
|
|
2643
2706
|
var errorSchema = z23.object({
|
|
2644
2707
|
error: z23.string(),
|
|
2645
2708
|
code: z23.string().optional(),
|
|
2709
|
+
/** Which window refused admission when `code` is `outside-window`. */
|
|
2710
|
+
window: z23.enum(["tracker", "quest"]).optional(),
|
|
2646
2711
|
missing: z23.array(missingPrerequisiteSchema).optional()
|
|
2647
2712
|
});
|
|
2648
2713
|
var staffDecisionSchema = z23.object({
|
|
@@ -2805,6 +2870,8 @@ export {
|
|
|
2805
2870
|
trackerIngestResultSchema,
|
|
2806
2871
|
trackerSkipCodes,
|
|
2807
2872
|
trackerOutcomeSchema,
|
|
2873
|
+
trackerTriggerOutcomeQuerySchema,
|
|
2874
|
+
trackerTriggerOutcomePageSchema,
|
|
2808
2875
|
trackerOutcomeQuerySchema,
|
|
2809
2876
|
trackerOutcomePageSchema,
|
|
2810
2877
|
trackerOutcomeRetrySchema,
|
|
@@ -2906,6 +2973,15 @@ export {
|
|
|
2906
2973
|
projectGroupSchema,
|
|
2907
2974
|
defineGroup,
|
|
2908
2975
|
projectGroupKey,
|
|
2976
|
+
createGroupSchema,
|
|
2977
|
+
updateGroupSchema,
|
|
2978
|
+
addGroupMemberSchema,
|
|
2979
|
+
removeGroupMemberSchema,
|
|
2980
|
+
groupPageQuerySchema,
|
|
2981
|
+
managedGroupSchema,
|
|
2982
|
+
groupPageSchema,
|
|
2983
|
+
groupMemberSchema,
|
|
2984
|
+
groupMemberPageSchema,
|
|
2909
2985
|
completionPrerequisiteSchema,
|
|
2910
2986
|
balancePrerequisiteSchema,
|
|
2911
2987
|
groupPrerequisiteSchema,
|
|
@@ -2963,6 +3039,8 @@ export {
|
|
|
2963
3039
|
beginHandoverSchema,
|
|
2964
3040
|
confirmHandoverSchema,
|
|
2965
3041
|
entitlementCorrectionSchema,
|
|
3042
|
+
CompletionSourceKind,
|
|
3043
|
+
completionSourceSchema,
|
|
2966
3044
|
completionRecordSchema,
|
|
2967
3045
|
questAvailabilitySchema,
|
|
2968
3046
|
questBudgetViewSchema,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
questOutcomeQuerySchema,
|
|
13
13
|
questOutcomeSchema,
|
|
14
14
|
rewardDeliveriesSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-C25TDFHN.js";
|
|
16
16
|
import {
|
|
17
17
|
AVATAR_UPLOAD_LIMIT,
|
|
18
18
|
RelayError,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
walletSignInNetworksSchema,
|
|
52
52
|
walletSignatureSchema,
|
|
53
53
|
walletUnlinkInputSchema
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-GMPPLZKH.js";
|
|
55
55
|
import {
|
|
56
56
|
PARTICIPANT_TIMEOUT,
|
|
57
57
|
lifetime,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
memberSummarySchema,
|
|
66
66
|
participantSessionSchema,
|
|
67
67
|
sessionMember
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-6ON4RMEN.js";
|
|
69
69
|
import {
|
|
70
70
|
accountConnectionSchema,
|
|
71
71
|
attemptSchema,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
tieredRewardReferenceSchema,
|
|
89
89
|
validateSubmissionValue,
|
|
90
90
|
valueEvidenceSchema
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-KGJSKGKI.js";
|
|
92
92
|
|
|
93
93
|
// src/submissions.ts
|
|
94
94
|
import { z } from "zod";
|
|
@@ -746,9 +746,11 @@ function questActions(submission, latest) {
|
|
|
746
746
|
// src/client.ts
|
|
747
747
|
function errorBody(value) {
|
|
748
748
|
const body = value !== null && typeof value === "object" ? value : {};
|
|
749
|
+
const window = body.window === "tracker" ? "tracker" : body.window === "quest" ? "quest" : void 0;
|
|
749
750
|
return {
|
|
750
751
|
message: typeof body.error === "string" && body.error.trim() ? body.error : void 0,
|
|
751
752
|
code: typeof body.code === "string" && body.code.trim() ? body.code : void 0,
|
|
753
|
+
window,
|
|
752
754
|
missing: Array.isArray(body.missing) ? body.missing.flatMap((entry) => {
|
|
753
755
|
const parsed = missingPrerequisiteSchema.safeParse(entry);
|
|
754
756
|
return parsed.success ? [parsed.data] : [];
|
|
@@ -836,6 +838,9 @@ function interrupted(call, life, error, stage) {
|
|
|
836
838
|
);
|
|
837
839
|
}
|
|
838
840
|
function createRelayClient(options) {
|
|
841
|
+
return relayClient(options);
|
|
842
|
+
}
|
|
843
|
+
function relayClient(options) {
|
|
839
844
|
if (options.timeout !== void 0 && !validTimeout(options.timeout)) {
|
|
840
845
|
throw invalidTimeout();
|
|
841
846
|
}
|
|
@@ -897,11 +902,12 @@ function createRelayClient(options) {
|
|
|
897
902
|
value = JSON.parse(text);
|
|
898
903
|
} catch {
|
|
899
904
|
}
|
|
900
|
-
const { message, code, missing } = errorBody(value);
|
|
905
|
+
const { message, code, window, missing } = errorBody(value);
|
|
901
906
|
throw new RelayError(message ?? `Request failed (${response.status})`, {
|
|
902
907
|
kind: "http",
|
|
903
908
|
status: response.status,
|
|
904
909
|
code,
|
|
910
|
+
window,
|
|
905
911
|
missing,
|
|
906
912
|
operationId: call.operationId,
|
|
907
913
|
replaySafe: call.replaySafe,
|
|
@@ -1634,6 +1640,11 @@ function createRelayClient(options) {
|
|
|
1634
1640
|
})
|
|
1635
1641
|
},
|
|
1636
1642
|
evidence: {
|
|
1643
|
+
/**
|
|
1644
|
+
* @deprecated Never reachable through participant gates: Relay does not serve evidence back
|
|
1645
|
+
* to members, so this always fails with 404. Reviewers download evidence through the
|
|
1646
|
+
* management API. Removed in 2.0.0.
|
|
1647
|
+
*/
|
|
1637
1648
|
async download(id, requestOptions) {
|
|
1638
1649
|
const call = { options: requestOptions };
|
|
1639
1650
|
return exchange(
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { M as MissingPrerequisite, V as ValueEvidence, a as AuthProvider } from './submission-input-
|
|
4
|
-
import { R as RequestError, a as RequestErrorDetails, b as RequestErrorKind } from './request-error-
|
|
5
|
-
import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode,
|
|
6
|
-
import {
|
|
1
|
+
import { aW as referralAcceptSchema, g as LeaderboardQuery, b as CampaignEnrollmentInput, d as CampaignWithdrawalInput, m as PointHistoryQuery, k as PointEntryKind, a2 as engagementPageQuerySchema } from './groups-BpWEqaPn.js';
|
|
2
|
+
import { j as QuestView, a as PageQuery, c as QuestEnrollmentInput, Q as QuestClaimInput, g as QuestOutcomeQuery, V as questExperienceSchema, o as RewardDeliveryAction, B as contentQualificationQuerySchema } from './pages-CixTNnF4.js';
|
|
3
|
+
import { M as MissingPrerequisite, V as ValueEvidence, a as AuthProvider } from './submission-input-CLefHTrj.js';
|
|
4
|
+
import { R as RequestError, a as RequestErrorDetails, b as RequestErrorKind } from './request-error-D_dUPLwo.js';
|
|
5
|
+
import { f as QuizEvidence, A as Attempt, M as MemberProgress, a as AttemptStatus, h as TrackerSkipCode, bW as submitSchema, aW as contentPerformanceQuerySchema } from './schema-CQydLqw4.js';
|
|
6
|
+
import { b as ParticipantSession, d as exchangeSchema, R as RelayEvent, P as ParticipantActivity } from './participant-activity-DkL3nY5a.js';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { F as profileUpdateSchema, c as ProfileCompletionQuery } from './profiles-D2aFcOxu.js';
|
|
9
9
|
import { y as walletAddressInputSchema, I as walletSignatureSchema, L as LinkedWallet, f as WalletSigner } from './wallet-YssWxGg8.js';
|
|
10
10
|
|
|
11
11
|
/** What happened, as in every Domino client error (see `RequestError`). */
|
|
12
12
|
type RelayErrorKind = RequestErrorKind;
|
|
13
|
+
/** @compat open */
|
|
13
14
|
type KnownRelayErrorCode = (typeof RelayErrorCode)[keyof typeof RelayErrorCode];
|
|
14
15
|
/**
|
|
15
16
|
* The machine-readable codes this SDK knows. `RelayError.code` is an open string: Relay can add
|
|
@@ -75,21 +76,47 @@ declare const RelayErrorCode: {
|
|
|
75
76
|
readonly InsufficientPoints: "insufficient-points";
|
|
76
77
|
/** A wallet signer failed or the member refused to sign; `cause` is the wallet's own error. */
|
|
77
78
|
readonly WalletSigner: "wallet-signer";
|
|
79
|
+
/** The member has not met the quest's prerequisites; `missing` lists them. */
|
|
80
|
+
readonly PrerequisitesIncomplete: "prerequisites-incomplete";
|
|
81
|
+
/** The quest is archived or retired: it takes no new participation. */
|
|
82
|
+
readonly QuestClosed: "quest-closed";
|
|
83
|
+
/** An operator paused the quest. */
|
|
84
|
+
readonly QuestPaused: "quest-paused";
|
|
85
|
+
/** An operator locked the member's profile; hiding it is still allowed. */
|
|
86
|
+
readonly ProfileLocked: "profile-locked";
|
|
87
|
+
/** No member in the project has the invitation code the member accepted. */
|
|
88
|
+
readonly InvitationNotFound: "invitation-not-found";
|
|
89
|
+
/** The email sign-in code is wrong; the member can type it again. */
|
|
90
|
+
readonly InvalidCode: "invalid-code";
|
|
91
|
+
/** The email sign-in code expired, was used or had too many attempts; request another. */
|
|
92
|
+
readonly CodeExpired: "code-expired";
|
|
93
|
+
/** The wallet sign-in challenge expired, was used or changed; start sign-in again. */
|
|
94
|
+
readonly ChallengeExpired: "challenge-expired";
|
|
95
|
+
/** Too many requests; `retryAfter` says how long to wait when Relay knows. */
|
|
96
|
+
readonly RateLimited: "rate-limited";
|
|
78
97
|
};
|
|
79
98
|
/** A known code, or one a newer Relay sends. */
|
|
80
99
|
type RelayErrorCode = KnownRelayErrorCode | (string & {});
|
|
81
100
|
type RelayErrorDetails = RequestErrorDetails & {
|
|
82
101
|
code?: RelayErrorCode;
|
|
102
|
+
/** Which window refused admission when `code` is `outside-window`. */
|
|
103
|
+
window?: "tracker" | "quest";
|
|
83
104
|
missing?: MissingPrerequisite[];
|
|
84
105
|
};
|
|
85
106
|
declare const relayErrorBrand: unique symbol;
|
|
86
107
|
/** Whether `value` is a `RelayError` from any copy of the SDK. Prefer it to `instanceof`. */
|
|
87
108
|
declare function isRelayError(value: unknown): value is RelayError;
|
|
88
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Every error the participant client throws: the shared `RequestError` fields, and `missing`.
|
|
111
|
+
*
|
|
112
|
+
* @compat sealed
|
|
113
|
+
*/
|
|
89
114
|
declare class RelayError extends RequestError {
|
|
90
115
|
readonly name: string;
|
|
91
116
|
readonly [relayErrorBrand] = true;
|
|
92
117
|
readonly code: RelayErrorCode | undefined;
|
|
118
|
+
/** Which window refused admission when `code` is `outside-window`. */
|
|
119
|
+
readonly window: "tracker" | "quest" | undefined;
|
|
93
120
|
/** Prerequisites the member does not currently meet, when Relay refused for that reason. */
|
|
94
121
|
readonly missing: MissingPrerequisite[];
|
|
95
122
|
constructor(message: string, details: RelayErrorDetails);
|
|
@@ -142,6 +169,8 @@ type SubmissionDraft = {
|
|
|
142
169
|
/**
|
|
143
170
|
* The quest or quiz changed since the member saw it, so Relay admitted nothing. `draft` holds what
|
|
144
171
|
* the member entered, to show again once they review the quest.
|
|
172
|
+
*
|
|
173
|
+
* @compat sealed
|
|
145
174
|
*/
|
|
146
175
|
declare class QuestUpdatedError extends RelayError {
|
|
147
176
|
readonly draft: SubmissionDraft | null;
|
|
@@ -151,24 +180,6 @@ declare class QuestUpdatedError extends RelayError {
|
|
|
151
180
|
source?: RelayError);
|
|
152
181
|
}
|
|
153
182
|
|
|
154
|
-
type ProgressObservation<T = MemberProgress> = {
|
|
155
|
-
kind: "loading";
|
|
156
|
-
} | {
|
|
157
|
-
kind: "session";
|
|
158
|
-
session: ParticipantSession | null;
|
|
159
|
-
} | {
|
|
160
|
-
kind: "ready";
|
|
161
|
-
session: ParticipantSession;
|
|
162
|
-
progress: T;
|
|
163
|
-
} | {
|
|
164
|
-
kind: "error";
|
|
165
|
-
error: Error;
|
|
166
|
-
};
|
|
167
|
-
type ProgressObserver = {
|
|
168
|
-
refresh(): Promise<void>;
|
|
169
|
-
dispose(): void;
|
|
170
|
-
};
|
|
171
|
-
|
|
172
183
|
type QuestActionResult = {
|
|
173
184
|
kind: "submitted";
|
|
174
185
|
attempt: Attempt;
|
|
@@ -200,7 +211,29 @@ type QuestController = (ActiveController & {
|
|
|
200
211
|
submit(): Promise<QuestActionResult>;
|
|
201
212
|
});
|
|
202
213
|
|
|
203
|
-
|
|
214
|
+
type ProgressObservation<T = MemberProgress> = {
|
|
215
|
+
kind: "loading";
|
|
216
|
+
} | {
|
|
217
|
+
kind: "session";
|
|
218
|
+
session: ParticipantSession | null;
|
|
219
|
+
} | {
|
|
220
|
+
kind: "ready";
|
|
221
|
+
session: ParticipantSession;
|
|
222
|
+
progress: T;
|
|
223
|
+
} | {
|
|
224
|
+
kind: "error";
|
|
225
|
+
error: Error;
|
|
226
|
+
};
|
|
227
|
+
type ProgressObserver = {
|
|
228
|
+
refresh(): Promise<void>;
|
|
229
|
+
dispose(): void;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Options every participant client method takes as its last argument.
|
|
234
|
+
*
|
|
235
|
+
* @compat input
|
|
236
|
+
*/
|
|
204
237
|
type RelayRequestOptions = {
|
|
205
238
|
/**
|
|
206
239
|
* The session ID the app read (`auth.session()`). Relay refuses the call with a `RelayError`
|
|
@@ -219,6 +252,7 @@ type RelayRequestOptions = {
|
|
|
219
252
|
*/
|
|
220
253
|
timeout?: number;
|
|
221
254
|
};
|
|
255
|
+
/** @compat input */
|
|
222
256
|
type RelayClientOptions = {
|
|
223
257
|
baseUrl: string;
|
|
224
258
|
token?: string;
|
|
@@ -232,7 +266,8 @@ type RelayClientOptions = {
|
|
|
232
266
|
*/
|
|
233
267
|
timeout?: number;
|
|
234
268
|
};
|
|
235
|
-
declare function createRelayClient(options: RelayClientOptions):
|
|
269
|
+
declare function createRelayClient(options: RelayClientOptions): RelayClient;
|
|
270
|
+
declare function relayClient(options: RelayClientOptions): {
|
|
236
271
|
offers: {
|
|
237
272
|
/** Offers available to this participant, including stock and per-member availability. */
|
|
238
273
|
list: (requestOptions?: RelayRequestOptions) => Promise<{
|
|
@@ -1442,6 +1477,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
1442
1477
|
} | {
|
|
1443
1478
|
kind: "blocked";
|
|
1444
1479
|
reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
|
|
1480
|
+
window?: "quest" | "tracker" | undefined;
|
|
1445
1481
|
resetsAt?: number | undefined;
|
|
1446
1482
|
} | {
|
|
1447
1483
|
kind: "staff-required";
|
|
@@ -1722,6 +1758,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
1722
1758
|
createdAt: number;
|
|
1723
1759
|
updatedAt: number;
|
|
1724
1760
|
automatic?: string | undefined;
|
|
1761
|
+
window?: "quest" | "tracker" | undefined;
|
|
1725
1762
|
}>;
|
|
1726
1763
|
/**
|
|
1727
1764
|
* Why automatic quests did or did not run for the signed-in member's activity, newest first:
|
|
@@ -1741,6 +1778,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
1741
1778
|
createdAt: number;
|
|
1742
1779
|
updatedAt: number;
|
|
1743
1780
|
automatic?: string | undefined;
|
|
1781
|
+
window?: "quest" | "tracker" | undefined;
|
|
1744
1782
|
}[];
|
|
1745
1783
|
nextCursor: string | null;
|
|
1746
1784
|
}>;
|
|
@@ -2092,6 +2130,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
2092
2130
|
} | {
|
|
2093
2131
|
kind: "blocked";
|
|
2094
2132
|
reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
|
|
2133
|
+
window?: "quest" | "tracker" | undefined;
|
|
2095
2134
|
resetsAt?: number | undefined;
|
|
2096
2135
|
} | {
|
|
2097
2136
|
kind: "staff-required";
|
|
@@ -2472,6 +2511,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
2472
2511
|
} | {
|
|
2473
2512
|
kind: "blocked";
|
|
2474
2513
|
reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
|
|
2514
|
+
window?: "quest" | "tracker" | undefined;
|
|
2475
2515
|
resetsAt?: number | undefined;
|
|
2476
2516
|
} | {
|
|
2477
2517
|
kind: "staff-required";
|
|
@@ -2855,6 +2895,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
2855
2895
|
} | {
|
|
2856
2896
|
kind: "blocked";
|
|
2857
2897
|
reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
|
|
2898
|
+
window?: "quest" | "tracker" | undefined;
|
|
2858
2899
|
resetsAt?: number | undefined;
|
|
2859
2900
|
} | {
|
|
2860
2901
|
kind: "staff-required";
|
|
@@ -3416,17 +3457,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
3416
3457
|
(quest: string, options?: {
|
|
3417
3458
|
input: "photo";
|
|
3418
3459
|
release?: string;
|
|
3419
|
-
recoverPrevious
|
|
3420
|
-
/**
|
|
3421
|
-
* The session ID the app read (`auth.session()`). Relay refuses the call with a `RelayError`
|
|
3422
|
-
* whose code is `stale-session` if the member's session changed since. Calls Relay binds to a
|
|
3423
|
-
* session (wallet linking, collection passes, retries) read the current session when omitted.
|
|
3424
|
-
*/
|
|
3425
|
-
? /**
|
|
3426
|
-
* The session ID the app read (`auth.session()`). Relay refuses the call with a `RelayError`
|
|
3427
|
-
* whose code is `stale-session` if the member's session changed since. Calls Relay binds to a
|
|
3428
|
-
* session (wallet linking, collection passes, retries) read the current session when omitted.
|
|
3429
|
-
*/: boolean;
|
|
3460
|
+
recoverPrevious?: boolean;
|
|
3430
3461
|
repeatable?: boolean;
|
|
3431
3462
|
}): Promise<PhotoSubmission>;
|
|
3432
3463
|
(quest: string, options: {
|
|
@@ -3437,7 +3468,10 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
3437
3468
|
}): Promise<QuizSubmission>;
|
|
3438
3469
|
(quest: string, options: {
|
|
3439
3470
|
input: "none";
|
|
3440
|
-
release
|
|
3471
|
+
release? /**
|
|
3472
|
+
* Cancels the call, which rejects with a `RelayError` of kind `aborted`. Cancelling stops any
|
|
3473
|
+
* retry; a write already sent stays `uncertain`, since Relay may have applied it.
|
|
3474
|
+
*/: string;
|
|
3441
3475
|
recoverPrevious?: boolean;
|
|
3442
3476
|
repeatable?: boolean;
|
|
3443
3477
|
}): Promise<ClaimSubmission>;
|
|
@@ -3581,6 +3615,7 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
3581
3615
|
} | {
|
|
3582
3616
|
kind: "blocked";
|
|
3583
3617
|
reason: "paused" | "outside-window" | "budget-exhausted" | "connection-required" | "wallet-required" | "enrollment-required";
|
|
3618
|
+
window?: "quest" | "tracker" | undefined;
|
|
3584
3619
|
resetsAt?: number | undefined;
|
|
3585
3620
|
} | {
|
|
3586
3621
|
kind: "staff-required";
|
|
@@ -4115,6 +4150,11 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
4115
4150
|
}>;
|
|
4116
4151
|
};
|
|
4117
4152
|
evidence: {
|
|
4153
|
+
/**
|
|
4154
|
+
* @deprecated Never reachable through participant gates: Relay does not serve evidence back
|
|
4155
|
+
* to members, so this always fails with 404. Reviewers download evidence through the
|
|
4156
|
+
* management API. Removed in 2.0.0.
|
|
4157
|
+
*/
|
|
4118
4158
|
download(id: string, requestOptions?: RelayRequestOptions): Promise<Blob>;
|
|
4119
4159
|
};
|
|
4120
4160
|
engagement: {
|
|
@@ -4267,7 +4307,14 @@ declare function createRelayClient(options: RelayClientOptions): {
|
|
|
4267
4307
|
}>;
|
|
4268
4308
|
};
|
|
4269
4309
|
};
|
|
4270
|
-
/**
|
|
4271
|
-
|
|
4310
|
+
/**
|
|
4311
|
+
* The participant client `createRelayClient` and `createBrowserRelayClient` return. Not for
|
|
4312
|
+
* implementation: only these factories create it, and a 1.x minor release can add methods, so an
|
|
4313
|
+
* object written by hand as a `RelayClient` may stop compiling.
|
|
4314
|
+
*
|
|
4315
|
+
* @compat sealed
|
|
4316
|
+
*/
|
|
4317
|
+
interface RelayClient extends ReturnType<typeof relayClient> {
|
|
4318
|
+
}
|
|
4272
4319
|
|
|
4273
4320
|
export { type ClaimSubmission as C, type KnownRelayErrorCode as K, type PhotoSubmission as P, type QuestActionResult as Q, type RelayClient as R, type SubmissionDraft as S, type ValueSubmission as V, type ProgressObservation as a, type ProgressObserver as b, type QuestController as c, QuestUpdatedError as d, type QuizSubmission as e, type RelayClientOptions as f, RelayError as g, RelayErrorCode as h, type RelayErrorDetails as i, type RelayErrorKind as j, type RelayRequestOptions as k, type SubmissionStatus as l, type SubmissionStore as m, createRelayClient as n, isRelayError as o };
|