@domino-sdk/relay 1.19.0 → 1.20.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/browser.d.ts +3 -3
- package/dist/browser.js +6 -4
- package/dist/{chunk-ANE7DHSG.js → chunk-5TQ6452M.js} +1 -1
- package/dist/{chunk-IE4QOQUI.js → chunk-5ZRDK4KQ.js} +116 -94
- package/dist/{chunk-K2Q5JHME.js → chunk-7YRXDG7R.js} +9 -2
- package/dist/{chunk-QEWAM3OB.js → chunk-COT7AUM7.js} +35 -3
- package/dist/{chunk-RKARJARI.js → chunk-FEUMOQIM.js} +1 -1
- package/dist/{chunk-SG5IUOMX.js → chunk-OJOR6VEB.js} +66 -4
- package/dist/{chunk-UIHPWC4C.js → chunk-USVER53M.js} +2 -0
- package/dist/{client-93pUw04R.d.ts → client-DSlycgar.d.ts} +62 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +3 -3
- package/dist/portal-proxy.js +2 -2
- package/dist/react/index.d.ts +88 -5
- package/dist/react/index.js +109 -11
- package/dist/schema.d.ts +21 -1
- package/dist/schema.js +11 -3
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +59 -7
- package/dist/{participant-activity-DYdUUhw2.d.ts → telegram-DALZ7GdF.d.ts} +40 -1
- package/dist/{sign-in-options--25uHySG.d.ts → telegram-browser-CGB01TaB.d.ts} +39 -2
- package/dist/{transport-bLac-fNk.d.ts → transport-DE2MMVjr.d.ts} +116 -3
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as SubmissionStore, f as RelayClientOptions, R as RelayClient } from './client-
|
|
2
|
-
export { C as CosmosChains, D as DiscoveredWallet, E as Eip1193Provider, a as EmailSignInOption, K as KeplrLike, O as OAuthSignInOption, S as SignInClient, b as SignInIcon, c as SignInMethods, d as SignInOption, e as SignInOptions, f as SignInUnavailable, g as SignInWallet, h as SolanaInjectedProvider, i as StandardWallet, j as StandardWalletAccount, W as WalletSignInOption, k as cosmosChainList, l as cosmosSigner, m as discoverCosmosWallets, n as discoverEvmWallets, o as discoverSignInWallets, p as discoverSolanaWallets, q as evmSigner, s as signInOptions, r as solanaSigner, w as walletStandardSolanaSigner } from './
|
|
1
|
+
import { n as SubmissionStore, f as RelayClientOptions, R as RelayClient } from './client-DSlycgar.js';
|
|
2
|
+
export { C as CosmosChains, D as DiscoveredWallet, E as Eip1193Provider, a as EmailSignInOption, K as KeplrLike, O as OAuthSignInOption, S as SignInClient, b as SignInIcon, c as SignInMethods, d as SignInOption, e as SignInOptions, f as SignInUnavailable, g as SignInWallet, h as SolanaInjectedProvider, i as StandardWallet, j as StandardWalletAccount, T as TelegramSignInOption, W as WalletSignInOption, k as cosmosChainList, l as cosmosSigner, m as discoverCosmosWallets, n as discoverEvmWallets, o as discoverSignInWallets, p as discoverSolanaWallets, q as evmSigner, s as signInOptions, r as solanaSigner, t as telegramMiniAppInitData, w as walletStandardSolanaSigner } from './telegram-browser-CGB01TaB.js';
|
|
3
3
|
import './groups-jLLG7MML.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './schema-Br3c1GOu.js';
|
|
6
6
|
import './pages-1h1387a3.js';
|
|
7
7
|
import './submission-input-BEJ9qENg.js';
|
|
8
8
|
import './action-DBzILFx9.js';
|
|
9
|
-
import './
|
|
9
|
+
import './telegram-DALZ7GdF.js';
|
|
10
10
|
import './accounts-5ciAkCMP.js';
|
|
11
11
|
import './profiles-D29SS12z.js';
|
|
12
12
|
import './wallet-CDyo-U4n.js';
|
package/dist/browser.js
CHANGED
|
@@ -10,14 +10,15 @@ import {
|
|
|
10
10
|
evmSigner,
|
|
11
11
|
signInOptions,
|
|
12
12
|
solanaSigner,
|
|
13
|
+
telegramMiniAppInitData,
|
|
13
14
|
walletStandardSolanaSigner
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-COT7AUM7.js";
|
|
16
|
+
import "./chunk-OJOR6VEB.js";
|
|
16
17
|
import "./chunk-T47OFHHX.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-5ZRDK4KQ.js";
|
|
18
19
|
import "./chunk-XSLRNFIY.js";
|
|
19
20
|
import "./chunk-5P5PTZ3T.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-FEUMOQIM.js";
|
|
21
22
|
import "./chunk-YXAK2637.js";
|
|
22
23
|
import "./chunk-EMLDFUTV.js";
|
|
23
24
|
export {
|
|
@@ -32,5 +33,6 @@ export {
|
|
|
32
33
|
evmSigner,
|
|
33
34
|
signInOptions,
|
|
34
35
|
solanaSigner,
|
|
36
|
+
telegramMiniAppInitData,
|
|
35
37
|
walletStandardSolanaSigner
|
|
36
38
|
};
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
pointLedgerReferenceSchema
|
|
4
4
|
} from "./chunk-XSLRNFIY.js";
|
|
5
5
|
import {
|
|
6
|
+
accountConnectionSchema,
|
|
6
7
|
authoringIdentityShape,
|
|
7
8
|
entitlementSchema,
|
|
8
9
|
identifier,
|
|
@@ -270,30 +271,47 @@ var questPublicationPreviewSchema = responseShape(
|
|
|
270
271
|
var allocateQuestSchema = z2.object({ actionId: identifier }).strict();
|
|
271
272
|
var allocatedQuestSchema = z2.object({ id: identifier });
|
|
272
273
|
|
|
273
|
-
// src/
|
|
274
|
+
// src/telegram.ts
|
|
274
275
|
import { z as z3 } from "zod";
|
|
275
|
-
var
|
|
276
|
-
|
|
276
|
+
var telegramSignInMethodsSchema = z3.object({
|
|
277
|
+
/** Telegram Login, the OpenID Connect sign-in Domino configures for the platform. */
|
|
278
|
+
login: z3.boolean(),
|
|
279
|
+
/** Mini App sign-in, which the project enables in Console with its bot's ID. */
|
|
280
|
+
miniApp: z3.boolean()
|
|
281
|
+
});
|
|
282
|
+
var telegramAccountConnectionSchema = accountConnectionSchema.extend({
|
|
283
|
+
provider: z3.literal("telegram")
|
|
284
|
+
});
|
|
285
|
+
var telegramInitDataSchema = z3.string().min(1, "Pass the Mini App's Telegram.WebApp.initData").max(8192);
|
|
286
|
+
var telegramMiniAppSignInSchema = z3.object({
|
|
287
|
+
initData: telegramInitDataSchema,
|
|
288
|
+
mode: z3.enum(["sign-in", "connect"])
|
|
289
|
+
}).strict();
|
|
290
|
+
|
|
291
|
+
// src/collection.ts
|
|
292
|
+
import { z as z4 } from "zod";
|
|
293
|
+
var collectionCodeSchema = z4.string().regex(/^relay:collect:[a-f0-9]{64}$/);
|
|
294
|
+
var collectionPassSchema = z4.object({
|
|
277
295
|
code: collectionCodeSchema,
|
|
278
|
-
expiresAt:
|
|
296
|
+
expiresAt: z4.number(),
|
|
279
297
|
entitlement: identifier
|
|
280
298
|
});
|
|
281
|
-
var collectionResolveSchema =
|
|
299
|
+
var collectionResolveSchema = z4.object({ code: collectionCodeSchema }).strict();
|
|
282
300
|
var collectionBeginSchema = collectionResolveSchema.extend({
|
|
283
301
|
actionId: identifier,
|
|
284
|
-
revision:
|
|
302
|
+
revision: z4.number().int().positive(),
|
|
285
303
|
selection: pickupSelectionSchema.optional()
|
|
286
304
|
});
|
|
287
|
-
var collectionPreviewSchema =
|
|
305
|
+
var collectionPreviewSchema = z4.object({
|
|
288
306
|
entitlement: entitlementSchema,
|
|
289
307
|
inventory: pickupAvailabilitySchema,
|
|
290
|
-
expiresAt:
|
|
308
|
+
expiresAt: z4.number()
|
|
291
309
|
});
|
|
292
310
|
|
|
293
311
|
// src/outcomes.ts
|
|
294
|
-
import { z as
|
|
295
|
-
var timestamp =
|
|
296
|
-
var questEnrollmentInputSchema =
|
|
312
|
+
import { z as z5 } from "zod";
|
|
313
|
+
var timestamp = z5.number().int().safe().nonnegative();
|
|
314
|
+
var questEnrollmentInputSchema = z5.strictObject({
|
|
297
315
|
actionId: identifier,
|
|
298
316
|
/** Quest key or ID. */
|
|
299
317
|
quest: identifier
|
|
@@ -301,26 +319,26 @@ var questEnrollmentInputSchema = z4.strictObject({
|
|
|
301
319
|
var memberEnrollmentInputSchema = questEnrollmentInputSchema.extend({
|
|
302
320
|
member: identifier
|
|
303
321
|
});
|
|
304
|
-
var questEnrollmentSchema =
|
|
322
|
+
var questEnrollmentSchema = z5.object({
|
|
305
323
|
/** Stable quest ID. */
|
|
306
324
|
quest: identifier,
|
|
307
325
|
member: identifier,
|
|
308
326
|
enrolledAt: timestamp
|
|
309
327
|
});
|
|
310
|
-
var questClaimInputSchema =
|
|
328
|
+
var questClaimInputSchema = z5.strictObject({
|
|
311
329
|
actionId: identifier,
|
|
312
330
|
/** Quest key or ID. */
|
|
313
331
|
quest: identifier,
|
|
314
332
|
/** The outcome's tracker, as `QuestOutcome.tracker` names it. */
|
|
315
333
|
tracker: identifier,
|
|
316
|
-
record:
|
|
334
|
+
record: z5.string().min(1).max(256),
|
|
317
335
|
observedAt: timestamp
|
|
318
336
|
});
|
|
319
337
|
var QuestOutcomeState = {
|
|
320
338
|
Admitted: "admitted",
|
|
321
339
|
Skipped: "skipped"
|
|
322
340
|
};
|
|
323
|
-
var questOutcomeSchema =
|
|
341
|
+
var questOutcomeSchema = z5.object({
|
|
324
342
|
/** Prerequisite transition identity; absent on older tracker responses. */
|
|
325
343
|
automatic: identifier.optional(),
|
|
326
344
|
/** Stable quest ID. */
|
|
@@ -328,156 +346,156 @@ var questOutcomeSchema = z4.object({
|
|
|
328
346
|
/** Stable tracker ID of the record decided. */
|
|
329
347
|
tracker: identifier.nullable(),
|
|
330
348
|
/** The record's ID in its tracker. */
|
|
331
|
-
record:
|
|
349
|
+
record: z5.string().nullable(),
|
|
332
350
|
/** Which observation of the record was decided. */
|
|
333
351
|
observedAt: timestamp.nullable(),
|
|
334
|
-
state:
|
|
352
|
+
state: z5.enum(["admitted", "skipped"]),
|
|
335
353
|
/**
|
|
336
354
|
* Why it was skipped, one of `trackerSkipCodes` or a code a newer Relay sends; null when
|
|
337
355
|
* admitted. Show an unknown code by its `reason`.
|
|
338
356
|
*/
|
|
339
|
-
code:
|
|
357
|
+
code: z5.string().nullable(),
|
|
340
358
|
/** Why it was skipped, for people; null when admitted. */
|
|
341
|
-
reason:
|
|
359
|
+
reason: z5.string().nullable(),
|
|
342
360
|
/** Which window refused admission when `code` is `outside-window`. */
|
|
343
|
-
window:
|
|
361
|
+
window: z5.enum(["tracker", "quest"]).optional(),
|
|
344
362
|
/** The admitted attempt. */
|
|
345
363
|
attempt: identifier.nullable(),
|
|
346
364
|
/** The member can claim it with `relay.quests.claim()`. */
|
|
347
|
-
claimable:
|
|
365
|
+
claimable: z5.boolean(),
|
|
348
366
|
createdAt: timestamp,
|
|
349
367
|
updatedAt: timestamp
|
|
350
368
|
});
|
|
351
|
-
var questOutcomeQuerySchema =
|
|
369
|
+
var questOutcomeQuerySchema = z5.strictObject({
|
|
352
370
|
/** Quest key or ID. */
|
|
353
371
|
quest: identifier.optional(),
|
|
354
|
-
state:
|
|
372
|
+
state: z5.enum(["admitted", "skipped"]).optional(),
|
|
355
373
|
/** Only skips with this code, such as `historical`. */
|
|
356
|
-
code:
|
|
374
|
+
code: z5.string().min(1).max(100).optional(),
|
|
357
375
|
cursor: pageCursorSchema.optional()
|
|
358
376
|
});
|
|
359
|
-
var questOutcomePageSchema =
|
|
360
|
-
items:
|
|
377
|
+
var questOutcomePageSchema = z5.object({
|
|
378
|
+
items: z5.array(questOutcomeSchema),
|
|
361
379
|
nextCursor: pageCursorSchema.nullable()
|
|
362
380
|
});
|
|
363
381
|
|
|
364
382
|
// src/participant-rewards.ts
|
|
365
|
-
import { z as
|
|
366
|
-
var participantEntitlementsSchema =
|
|
367
|
-
items:
|
|
383
|
+
import { z as z6 } from "zod";
|
|
384
|
+
var participantEntitlementsSchema = z6.object({
|
|
385
|
+
items: z6.array(entitlementSchema)
|
|
368
386
|
});
|
|
369
387
|
var base2 = {
|
|
370
|
-
id:
|
|
371
|
-
status:
|
|
372
|
-
at:
|
|
373
|
-
quest:
|
|
374
|
-
completion:
|
|
388
|
+
id: z6.string(),
|
|
389
|
+
status: z6.string(),
|
|
390
|
+
at: z6.number().nullable(),
|
|
391
|
+
quest: z6.string().nullable(),
|
|
392
|
+
completion: z6.string().nullable()
|
|
375
393
|
};
|
|
376
|
-
var known =
|
|
377
|
-
|
|
394
|
+
var known = z6.discriminatedUnion("kind", [
|
|
395
|
+
z6.object({
|
|
378
396
|
...base2,
|
|
379
|
-
kind:
|
|
397
|
+
kind: z6.literal("points"),
|
|
380
398
|
ledger: pointLedgerReferenceSchema,
|
|
381
|
-
amount:
|
|
382
|
-
reversed:
|
|
383
|
-
}).catchall(
|
|
384
|
-
|
|
399
|
+
amount: z6.number(),
|
|
400
|
+
reversed: z6.number()
|
|
401
|
+
}).catchall(z6.json()),
|
|
402
|
+
z6.object({
|
|
385
403
|
...base2,
|
|
386
|
-
kind:
|
|
404
|
+
kind: z6.literal("tier"),
|
|
387
405
|
entitlement: entitlementSchema
|
|
388
|
-
}).catchall(
|
|
389
|
-
|
|
406
|
+
}).catchall(z6.json().transform((value) => value)),
|
|
407
|
+
z6.object({
|
|
390
408
|
...base2,
|
|
391
|
-
kind:
|
|
392
|
-
provider:
|
|
393
|
-
action:
|
|
394
|
-
roleId:
|
|
395
|
-
deliveredAt:
|
|
396
|
-
revokedAt:
|
|
397
|
-
reconciliation:
|
|
398
|
-
}).catchall(
|
|
409
|
+
kind: z6.literal("integration"),
|
|
410
|
+
provider: z6.string(),
|
|
411
|
+
action: z6.string(),
|
|
412
|
+
roleId: z6.string().optional(),
|
|
413
|
+
deliveredAt: z6.number().nullable(),
|
|
414
|
+
revokedAt: z6.number().nullable(),
|
|
415
|
+
reconciliation: z6.object({ status: z6.string(), ownership: z6.string(), at: z6.number() }).catchall(z6.json()).nullable()
|
|
416
|
+
}).catchall(z6.json().optional())
|
|
399
417
|
]);
|
|
400
|
-
var participantDeliverySchema =
|
|
418
|
+
var participantDeliverySchema = z6.union([
|
|
401
419
|
known,
|
|
402
|
-
|
|
420
|
+
z6.object({
|
|
403
421
|
...base2,
|
|
404
|
-
kind:
|
|
405
|
-
}).catchall(
|
|
422
|
+
kind: z6.string().refine((kind) => !["points", "tier", "integration"].includes(kind))
|
|
423
|
+
}).catchall(z6.json()).transform(({ kind, ...item }) => ({
|
|
406
424
|
...item,
|
|
407
425
|
kind: "unknown",
|
|
408
426
|
reportedKind: kind
|
|
409
427
|
}))
|
|
410
428
|
]);
|
|
411
|
-
var participantDeliveriesSchema =
|
|
412
|
-
items:
|
|
429
|
+
var participantDeliveriesSchema = z6.object({
|
|
430
|
+
items: z6.array(participantDeliverySchema)
|
|
413
431
|
});
|
|
414
432
|
|
|
415
433
|
// src/reward-deliveries.ts
|
|
416
|
-
import { z as
|
|
434
|
+
import { z as z7 } from "zod";
|
|
417
435
|
var RewardDeliveryAction = {
|
|
418
436
|
/** Delivers a quest's Discord role reward. */
|
|
419
437
|
GrantRole: "grant-role"
|
|
420
438
|
};
|
|
421
|
-
var rewardDeliveryActionSchema =
|
|
422
|
-
var roleReconciliationSchema =
|
|
423
|
-
status:
|
|
424
|
-
ownership:
|
|
425
|
-
at:
|
|
426
|
-
reason:
|
|
439
|
+
var rewardDeliveryActionSchema = z7.string().min(1).max(64);
|
|
440
|
+
var roleReconciliationSchema = z7.object({
|
|
441
|
+
status: z7.enum(["pending", "granted", "removed", "preserved", "failed"]),
|
|
442
|
+
ownership: z7.enum(["unclaimed", "relay", "external"]),
|
|
443
|
+
at: z7.number(),
|
|
444
|
+
reason: z7.string().nullable()
|
|
427
445
|
});
|
|
428
|
-
var knownRewardDeliverySchema =
|
|
429
|
-
id:
|
|
430
|
-
quest:
|
|
431
|
-
completion:
|
|
432
|
-
member:
|
|
433
|
-
provider:
|
|
446
|
+
var knownRewardDeliverySchema = z7.object({
|
|
447
|
+
id: z7.string(),
|
|
448
|
+
quest: z7.string(),
|
|
449
|
+
completion: z7.string(),
|
|
450
|
+
member: z7.string(),
|
|
451
|
+
provider: z7.literal("discord"),
|
|
434
452
|
/** `RewardDeliveryAction`, such as `grant-role`. */
|
|
435
453
|
action: rewardDeliveryActionSchema,
|
|
436
|
-
roleId:
|
|
454
|
+
roleId: z7.string(),
|
|
437
455
|
/**
|
|
438
456
|
* `failed` is terminal: Discord rejected the grant permanently (unknown role,
|
|
439
457
|
* member left the server, missing permissions) or retries ran out after about
|
|
440
458
|
* a day. An operator can retry it once the cause is fixed, unless revokedAt is set.
|
|
441
459
|
* Revoke stops pending grants; a late success records deliveredAt but leaves status failed.
|
|
442
460
|
*/
|
|
443
|
-
status:
|
|
461
|
+
status: z7.enum(["pending", "delivered", "failed"]),
|
|
444
462
|
/** Provider attempts in the current round; an operator retry starts a new round at zero. */
|
|
445
|
-
attempts:
|
|
463
|
+
attempts: z7.number().int(),
|
|
446
464
|
/** While pending with a `lastError`, when the next attempt is scheduled. */
|
|
447
|
-
nextAt:
|
|
448
|
-
lastError:
|
|
449
|
-
createdAt:
|
|
450
|
-
deliveredAt:
|
|
465
|
+
nextAt: z7.number(),
|
|
466
|
+
lastError: z7.string().nullable(),
|
|
467
|
+
createdAt: z7.number(),
|
|
468
|
+
deliveredAt: z7.number().nullable(),
|
|
451
469
|
/** First dispatch attempt, retained across retries. Legacy rows use creation time when dispatch timing is unknown. */
|
|
452
|
-
dispatchedAt:
|
|
470
|
+
dispatchedAt: z7.number().nullable().optional(),
|
|
453
471
|
/** Completion revocation stops retries, including deliveries that had already failed. */
|
|
454
|
-
revokedAt:
|
|
472
|
+
revokedAt: z7.number().nullable().optional(),
|
|
455
473
|
/** Current reconciliation of the pinned Discord membership; original delivery and revoke history stay intact. */
|
|
456
474
|
reconciliation: roleReconciliationSchema.nullable().optional()
|
|
457
475
|
});
|
|
458
476
|
var futureRewardDeliverySchema = knownRewardDeliverySchema.extend({
|
|
459
|
-
provider:
|
|
460
|
-
status:
|
|
461
|
-
roleId:
|
|
462
|
-
reconciliation:
|
|
463
|
-
status:
|
|
464
|
-
ownership:
|
|
465
|
-
at:
|
|
466
|
-
reason:
|
|
467
|
-
}).catchall(
|
|
468
|
-
}).catchall(
|
|
477
|
+
provider: z7.string(),
|
|
478
|
+
status: z7.string(),
|
|
479
|
+
roleId: z7.string().optional(),
|
|
480
|
+
reconciliation: z7.object({
|
|
481
|
+
status: z7.string(),
|
|
482
|
+
ownership: z7.string(),
|
|
483
|
+
at: z7.number(),
|
|
484
|
+
reason: z7.string().nullable()
|
|
485
|
+
}).catchall(z7.json()).nullable().optional()
|
|
486
|
+
}).catchall(z7.json().optional()).refine(
|
|
469
487
|
(delivery) => delivery.provider !== "discord" || !["pending", "delivered", "failed"].includes(delivery.status) || delivery.reconciliation && (!["pending", "granted", "removed", "preserved", "failed"].includes(
|
|
470
488
|
delivery.reconciliation.status
|
|
471
489
|
) || !["unclaimed", "relay", "external"].includes(
|
|
472
490
|
delivery.reconciliation.ownership
|
|
473
491
|
))
|
|
474
492
|
);
|
|
475
|
-
var rewardDeliverySchema =
|
|
476
|
-
knownRewardDeliverySchema.catchall(
|
|
493
|
+
var rewardDeliverySchema = z7.union([
|
|
494
|
+
knownRewardDeliverySchema.catchall(z7.json().optional()),
|
|
477
495
|
futureRewardDeliverySchema
|
|
478
496
|
]);
|
|
479
|
-
var rewardDeliveriesSchema =
|
|
480
|
-
deliveries:
|
|
497
|
+
var rewardDeliveriesSchema = z7.object({
|
|
498
|
+
deliveries: z7.array(rewardDeliverySchema)
|
|
481
499
|
});
|
|
482
500
|
|
|
483
501
|
export {
|
|
@@ -506,6 +524,10 @@ export {
|
|
|
506
524
|
questPublicationPreviewSchema,
|
|
507
525
|
allocateQuestSchema,
|
|
508
526
|
allocatedQuestSchema,
|
|
527
|
+
telegramSignInMethodsSchema,
|
|
528
|
+
telegramAccountConnectionSchema,
|
|
529
|
+
telegramInitDataSchema,
|
|
530
|
+
telegramMiniAppSignInSchema,
|
|
509
531
|
collectionCodeSchema,
|
|
510
532
|
collectionPassSchema,
|
|
511
533
|
collectionResolveSchema,
|
|
@@ -23,8 +23,9 @@ import {
|
|
|
23
23
|
questOutcomeSchema,
|
|
24
24
|
questTypeVersionSchema,
|
|
25
25
|
questViewSchema,
|
|
26
|
-
rewardDeliveriesSchema
|
|
27
|
-
|
|
26
|
+
rewardDeliveriesSchema,
|
|
27
|
+
telegramAccountConnectionSchema
|
|
28
|
+
} from "./chunk-5ZRDK4KQ.js";
|
|
28
29
|
import {
|
|
29
30
|
badgeArtifactSchema,
|
|
30
31
|
badgeSchema,
|
|
@@ -411,6 +412,9 @@ var participantResponseSchemas = lazyResponseReaders({
|
|
|
411
412
|
get memberBadgesSchema() {
|
|
412
413
|
return knownResponse(memberBadgesSchema);
|
|
413
414
|
},
|
|
415
|
+
get telegramAccountConnectionSchema() {
|
|
416
|
+
return knownResponse(telegramAccountConnectionSchema);
|
|
417
|
+
},
|
|
414
418
|
get accountConnectionSchema() {
|
|
415
419
|
return knownResponse(accountConnectionSchema);
|
|
416
420
|
},
|
|
@@ -538,6 +542,9 @@ var participantResponseSchemas = lazyResponseReaders({
|
|
|
538
542
|
var participantResponses = {
|
|
539
543
|
badgeSchema: responseSchema(badgeSchema),
|
|
540
544
|
memberBadgesSchema: responseSchema(memberBadgesSchema),
|
|
545
|
+
telegramAccountConnectionSchema: responseSchema(
|
|
546
|
+
telegramAccountConnectionSchema
|
|
547
|
+
),
|
|
541
548
|
accountConnectionSchema: responseSchema(accountConnectionSchema),
|
|
542
549
|
attemptSchema: responseSchema(attemptSchema),
|
|
543
550
|
authProviderSchema: responseSchema(authProviderSchema),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRelayClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OJOR6VEB.js";
|
|
4
4
|
import {
|
|
5
5
|
RelayErrorCode,
|
|
6
6
|
asRelayError,
|
|
@@ -430,9 +430,19 @@ function signInOptionsFrom(methods, wallets, input) {
|
|
|
430
430
|
message: `Wallet sign-in accepts ${names} wallets. Install one in this browser, then reload this page.`
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
+
const telegram = actions.telegram;
|
|
433
434
|
return {
|
|
434
435
|
options,
|
|
435
436
|
unavailable,
|
|
437
|
+
...methods.telegram?.login && telegram ? {
|
|
438
|
+
telegram: {
|
|
439
|
+
kind: "telegram",
|
|
440
|
+
id: "telegram",
|
|
441
|
+
label: "Telegram",
|
|
442
|
+
icon: "telegram",
|
|
443
|
+
start: () => telegram()
|
|
444
|
+
}
|
|
445
|
+
} : {},
|
|
436
446
|
...methods.error ? { methodsError: methods.error } : {}
|
|
437
447
|
};
|
|
438
448
|
}
|
|
@@ -442,7 +452,8 @@ async function readSignInMethods(relay) {
|
|
|
442
452
|
return {
|
|
443
453
|
providers: result.providers.filter((entry) => entry.configured).map((entry) => entry.provider),
|
|
444
454
|
email: result.email,
|
|
445
|
-
wallets: result.wallets
|
|
455
|
+
wallets: result.wallets,
|
|
456
|
+
...result.telegram ? { telegram: result.telegram } : {}
|
|
446
457
|
};
|
|
447
458
|
} catch (cause) {
|
|
448
459
|
return {
|
|
@@ -484,11 +495,31 @@ async function signInOptions(relay, input = {}) {
|
|
|
484
495
|
async wallet(signer) {
|
|
485
496
|
await relay.auth.wallet.signIn(signer);
|
|
486
497
|
challenge = null;
|
|
487
|
-
}
|
|
498
|
+
},
|
|
499
|
+
...relay.auth.telegram ? {
|
|
500
|
+
async telegram() {
|
|
501
|
+
const { url } = await relay.auth.telegram.start("sign-in");
|
|
502
|
+
window.location.assign(url);
|
|
503
|
+
}
|
|
504
|
+
} : {}
|
|
488
505
|
}
|
|
489
506
|
});
|
|
490
507
|
}
|
|
491
508
|
|
|
509
|
+
// src/telegram-browser.ts
|
|
510
|
+
function telegramMiniAppInitData() {
|
|
511
|
+
const scope = globalThis;
|
|
512
|
+
const fromScript = scope.Telegram?.WebApp?.initData;
|
|
513
|
+
if (typeof fromScript === "string" && fromScript.length > 0) {
|
|
514
|
+
return fromScript;
|
|
515
|
+
}
|
|
516
|
+
const hash = scope.location?.hash;
|
|
517
|
+
if (!hash) {
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
return new URLSearchParams(hash.replace(/^#/, "")).get("tgWebAppData") || null;
|
|
521
|
+
}
|
|
522
|
+
|
|
492
523
|
// src/browser.ts
|
|
493
524
|
function createBrowserRelayClient(options) {
|
|
494
525
|
return createRelayClient({
|
|
@@ -667,6 +698,7 @@ export {
|
|
|
667
698
|
signInOptionsFrom,
|
|
668
699
|
readSignInMethods,
|
|
669
700
|
signInOptions,
|
|
701
|
+
telegramMiniAppInitData,
|
|
670
702
|
createBrowserRelayClient,
|
|
671
703
|
browserSubmissionStore
|
|
672
704
|
};
|
|
@@ -15,8 +15,11 @@ import {
|
|
|
15
15
|
questOutcomePageSchema,
|
|
16
16
|
questOutcomeQuerySchema,
|
|
17
17
|
questOutcomeSchema,
|
|
18
|
-
rewardDeliveriesSchema
|
|
19
|
-
|
|
18
|
+
rewardDeliveriesSchema,
|
|
19
|
+
telegramAccountConnectionSchema,
|
|
20
|
+
telegramMiniAppSignInSchema,
|
|
21
|
+
telegramSignInMethodsSchema
|
|
22
|
+
} from "./chunk-5ZRDK4KQ.js";
|
|
20
23
|
import {
|
|
21
24
|
AVATAR_UPLOAD_LIMIT,
|
|
22
25
|
avatarUploadTypes,
|
|
@@ -55,7 +58,7 @@ import {
|
|
|
55
58
|
} from "./chunk-5P5PTZ3T.js";
|
|
56
59
|
import {
|
|
57
60
|
clientIdentity
|
|
58
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-FEUMOQIM.js";
|
|
59
62
|
import {
|
|
60
63
|
exchangeResultSchema,
|
|
61
64
|
exchangeSchema,
|
|
@@ -1516,7 +1519,12 @@ function relayClient(options) {
|
|
|
1516
1519
|
email: z2.boolean(),
|
|
1517
1520
|
/** The wallet sign-in this project enabled. */
|
|
1518
1521
|
wallets: walletSignInNetworksSchema,
|
|
1519
|
-
demo: z2.boolean()
|
|
1522
|
+
demo: z2.boolean(),
|
|
1523
|
+
/**
|
|
1524
|
+
* Telegram's sign-in, which is not one of `providers` in SDK 1.x. Absent from Relay
|
|
1525
|
+
* versions without Telegram.
|
|
1526
|
+
*/
|
|
1527
|
+
telegram: telegramSignInMethodsSchema.optional()
|
|
1520
1528
|
}),
|
|
1521
1529
|
{ options: requestOptions }
|
|
1522
1530
|
),
|
|
@@ -1597,6 +1605,60 @@ function relayClient(options) {
|
|
|
1597
1605
|
);
|
|
1598
1606
|
}
|
|
1599
1607
|
},
|
|
1608
|
+
/**
|
|
1609
|
+
* Telegram sign-in and the member's Telegram account. Telegram is not an `AuthProvider` in
|
|
1610
|
+
* SDK 1.x, so `accounts()`, `start()` and `disconnect()` leave it out and these take its place.
|
|
1611
|
+
*/
|
|
1612
|
+
telegram: {
|
|
1613
|
+
/**
|
|
1614
|
+
* Leaves for Telegram Login when the platform configured it (`providers().telegram.login`):
|
|
1615
|
+
* `"sign-in"` signs in, or signs up; `"connect"` links Telegram to the signed-in member.
|
|
1616
|
+
*/
|
|
1617
|
+
start: async (mode, requestOptions) => request("/v1/auth/start", z2.object({ url: z2.string() }), {
|
|
1618
|
+
json: {
|
|
1619
|
+
provider: "telegram",
|
|
1620
|
+
mode: parseInput(z2.enum(["sign-in", "connect"]), mode)
|
|
1621
|
+
},
|
|
1622
|
+
options: requestOptions
|
|
1623
|
+
}),
|
|
1624
|
+
/** The member's Telegram account. */
|
|
1625
|
+
account: (requestOptions) => request(
|
|
1626
|
+
"/v1/auth/accounts/telegram",
|
|
1627
|
+
telegramAccountConnectionSchema,
|
|
1628
|
+
{ options: requestOptions }
|
|
1629
|
+
),
|
|
1630
|
+
/** Unlinks the member's Telegram account, as `disconnect()` does for the other providers. */
|
|
1631
|
+
disconnect: async (requestOptions) => request("/v1/auth/accounts/disconnect", acknowledged, {
|
|
1632
|
+
json: { provider: "telegram" },
|
|
1633
|
+
options: requestOptions
|
|
1634
|
+
}),
|
|
1635
|
+
/**
|
|
1636
|
+
* Sign-in inside a Telegram Mini App, where the project enabled it in Console
|
|
1637
|
+
* (`providers().telegram.miniApp`). Pass the Mini App's signed launch data,
|
|
1638
|
+
* `telegramMiniAppInitData()`. Relay checks Telegram's signature for the project's bot and
|
|
1639
|
+
* accepts launch data at most five minutes old, once.
|
|
1640
|
+
*/
|
|
1641
|
+
miniApp: {
|
|
1642
|
+
/** Signs in, or signs up, as the Telegram user who opened the Mini App. */
|
|
1643
|
+
signIn: (initData, requestOptions) => changeSession(
|
|
1644
|
+
() => request("/v1/auth/telegram/mini-app", participantSessionSchema, {
|
|
1645
|
+
json: parseInput(telegramMiniAppSignInSchema, {
|
|
1646
|
+
initData,
|
|
1647
|
+
mode: "sign-in"
|
|
1648
|
+
}),
|
|
1649
|
+
options: requestOptions
|
|
1650
|
+
})
|
|
1651
|
+
),
|
|
1652
|
+
/** Links the Telegram user who opened the Mini App to the signed-in member. */
|
|
1653
|
+
connect: (initData, requestOptions) => request("/v1/auth/telegram/mini-app", acknowledged, {
|
|
1654
|
+
json: parseInput(telegramMiniAppSignInSchema, {
|
|
1655
|
+
initData,
|
|
1656
|
+
mode: "connect"
|
|
1657
|
+
}),
|
|
1658
|
+
options: requestOptions
|
|
1659
|
+
})
|
|
1660
|
+
}
|
|
1661
|
+
},
|
|
1600
1662
|
/** The member's connected sign-in accounts, one per provider. */
|
|
1601
1663
|
accounts: (requestOptions) => request("/v1/auth/accounts", z2.array(accountConnectionSchema), {
|
|
1602
1664
|
options: requestOptions
|
|
@@ -19,7 +19,9 @@ var participantRoutes = [
|
|
|
19
19
|
{ method: "GET", path: "/v1/auth/session" },
|
|
20
20
|
{ method: "POST", path: "/v1/auth/logout" },
|
|
21
21
|
{ method: "GET", path: "/v1/auth/accounts" },
|
|
22
|
+
{ method: "GET", path: "/v1/auth/accounts/telegram" },
|
|
22
23
|
{ method: "POST", path: "/v1/auth/accounts/disconnect" },
|
|
24
|
+
{ method: "POST", path: "/v1/auth/telegram/mini-app" },
|
|
23
25
|
// The signed-in member: progress, submissions, rewards, points, activity and linked wallets.
|
|
24
26
|
{ method: "GET", path: "/v1/me" },
|
|
25
27
|
{ method: "GET", path: "/v1/me/progress" },
|