@domino-sdk/relay 1.61.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 (88) hide show
  1. package/CHANGELOG.md +276 -8
  2. package/README.md +3 -2
  3. package/dist/{schema-CZ6Rj0ZF.d.ts → accounts-nz3mzfRQ.d.ts} +3146 -1765
  4. package/dist/action-9Xl0StBg.d.ts +33 -0
  5. package/dist/{attempt-captures-DYnJVkfg.d.ts → attempt-captures-DMi8oR9T.d.ts} +1 -1
  6. package/dist/authoring.d.ts +171 -49
  7. package/dist/authoring.js +158 -49
  8. package/dist/{automatic-outcomes-If88LR9f.d.ts → automatic-outcomes-C_LLQU1p.d.ts} +15 -1
  9. package/dist/avatar.d.ts +1 -1
  10. package/dist/browser.d.ts +15 -11
  11. package/dist/browser.js +18 -12
  12. package/dist/capability-error-CuI_F7yM.d.ts +296 -0
  13. package/dist/{pages-K7-KjSXw.d.ts → catalog-BaTOKpNw.d.ts} +56 -567
  14. package/dist/{chunk-XBV2CK2H.js → chunk-3RFP6GT5.js} +15 -3
  15. package/dist/{chunk-VURRFVNP.js → chunk-4GQW43UU.js} +239 -361
  16. package/dist/chunk-4NOFSGAL.js +320 -0
  17. package/dist/{chunk-24I4R732.js → chunk-5XLZ34PV.js} +34 -19
  18. package/dist/{chunk-L77O64I4.js → chunk-7X67QLPB.js} +43 -43
  19. package/dist/{chunk-RHBS5FJL.js → chunk-7Z4SZ6YM.js} +3 -3
  20. package/dist/{chunk-QEAS4ZGS.js → chunk-AQOL3SK5.js} +1 -1
  21. package/dist/chunk-EHUSD3O2.js +377 -0
  22. package/dist/chunk-FO2LCZTL.js +19 -0
  23. package/dist/{chunk-DYXDZFKA.js → chunk-FU5CGNTR.js} +166 -178
  24. package/dist/chunk-FWLQ5XCS.js +21 -0
  25. package/dist/chunk-GLH6MEI2.js +193 -0
  26. package/dist/chunk-ICXZZNPS.js +199 -0
  27. package/dist/{chunk-ZDJLPN4L.js → chunk-ID3BZXFZ.js} +2696 -2693
  28. package/dist/chunk-KP2MCX3R.js +587 -0
  29. package/dist/{chunk-SKGTNTLF.js → chunk-LZWXCBUB.js} +213 -297
  30. package/dist/chunk-MTKRIQEU.js +31 -0
  31. package/dist/{chunk-4OC7REYX.js → chunk-MWMCQLCG.js} +3 -3
  32. package/dist/{chunk-PPB7HALD.js → chunk-N4BDKS6Y.js} +27 -26
  33. package/dist/{chunk-5I54XBK2.js → chunk-N4LNEGQX.js} +2 -2
  34. package/dist/chunk-NQDEWJWE.js +554 -0
  35. package/dist/chunk-QR6HH4DI.js +508 -0
  36. package/dist/chunk-TLSQETTY.js +41 -0
  37. package/dist/{chunk-MHPKEVEW.js → chunk-U66GUVSG.js} +7 -2
  38. package/dist/{chunk-KDR2VAJP.js → chunk-UYVJZR33.js} +2 -2
  39. package/dist/chunk-UZ765UGH.js +18 -0
  40. package/dist/{chunk-7A4J67ZL.js → chunk-VWQGWGCH.js} +7 -7
  41. package/dist/chunk-W7YSMSGC.js +725 -0
  42. package/dist/{client-C51w7fMb.d.ts → client-DHmG7rn6.d.ts} +126 -93
  43. package/dist/{announcements-CHx3-HBw.d.ts → dashboards-CLemT6kj.d.ts} +14 -137
  44. package/dist/{deployments-kWoHFaqj.d.ts → deployments-DTULi7dF.d.ts} +450 -18
  45. package/dist/identity-integration-DOeNZaxF.d.ts +1271 -0
  46. package/dist/index.d.ts +13 -11
  47. package/dist/index.js +16 -11
  48. package/dist/internal.d.ts +29 -13
  49. package/dist/internal.js +57 -17
  50. package/dist/{integrations-B3y36OaB.d.ts → limits-kNzYdZ00.d.ts} +464 -53
  51. package/dist/{offers-BoV4ryUc.d.ts → offers-CYeN_I0Y.d.ts} +22 -4
  52. package/dist/{participant-activity-DHL8QYks.d.ts → participant-activity-D-Drp24G.d.ts} +16 -3
  53. package/dist/portal-proxy.d.ts +75 -2
  54. package/dist/portal-proxy.js +153 -25
  55. package/dist/react/index.d.ts +214 -27
  56. package/dist/react/index.js +196 -42
  57. package/dist/{action-DBzILFx9.d.ts → request-error-D_dUPLwo.d.ts} +1 -31
  58. package/dist/reward-deliveries-drp-x1G-.d.ts +782 -0
  59. package/dist/runtime/authoring.js +1 -1
  60. package/dist/runtime/chunks/UGDV5W4N.js +1 -0
  61. package/dist/runtime/manifest.json +3 -3
  62. package/dist/runtime/schema.js +1 -1
  63. package/dist/schema.d.ts +330 -31
  64. package/dist/schema.js +147 -91
  65. package/dist/server/index.d.ts +14 -12
  66. package/dist/server/index.js +6425 -6260
  67. package/dist/sign-in-providers-B1Q9eDRm.d.ts +44 -0
  68. package/dist/submission-input-DZCbjQUH.d.ts +343 -0
  69. package/dist/{telegram-browser-BUceZIGZ.d.ts → telegram-browser-NL0Asmsi.d.ts} +46 -6
  70. package/dist/telegram.d.ts +64 -0
  71. package/dist/telegram.js +23 -0
  72. package/dist/testing.d.ts +326 -27
  73. package/dist/testing.js +440 -90
  74. package/dist/tracker-data-esm3WG8R.d.ts +1881 -0
  75. package/dist/{transport-BrX9pIGN.d.ts → transport-Czht_irp.d.ts} +43483 -38512
  76. package/dist/{wallet-CIqFoxdm.d.ts → wallet-B7e06v4m.d.ts} +32 -9
  77. package/package.json +5 -1
  78. package/dist/accounts-DoabriBX.d.ts +0 -306
  79. package/dist/capability-error-DufwG3G0.d.ts +0 -159
  80. package/dist/chunk-3Y3L2F54.js +0 -982
  81. package/dist/chunk-DHXDBAJF.js +0 -544
  82. package/dist/chunk-EN3M5Z4J.js +0 -13
  83. package/dist/chunk-QNUHWK7R.js +0 -602
  84. package/dist/chunk-SE4PFJPT.js +0 -247
  85. package/dist/groups-CqcA2Ycs.d.ts +0 -2827
  86. package/dist/runtime/chunks/5QVFB4TU.js +0 -1
  87. package/dist/submission-input-C54Q8yAD.d.ts +0 -146
  88. package/dist/x-D1PGi8Sq.d.ts +0 -331
@@ -1,49 +1,15 @@
1
1
  import {
2
2
  parseDefinition
3
- } from "./chunk-3Y3L2F54.js";
3
+ } from "./chunk-FO2LCZTL.js";
4
4
  import {
5
5
  identifier,
6
+ limits,
6
7
  resourceHandle,
7
8
  responseShape
8
- } from "./chunk-ZDJLPN4L.js";
9
-
10
- // src/youtube.ts
11
- import * as z from "zod";
12
- var youtubeShortBodySchema = z.object({
13
- title: z.string(),
14
- description: z.string(),
15
- tags: z.array(z.string()),
16
- durationSeconds: z.number().int().nonnegative(),
17
- /** When the video was published, epoch milliseconds. */
18
- publishedAt: z.number().int().nonnegative()
19
- });
20
- var youtubeShortMetrics = ["views", "likes", "comments"];
21
-
22
- // src/tiktok.ts
23
- import * as z2 from "zod";
24
- var tiktokVideoBodySchema = z2.object({
25
- title: z2.string(),
26
- /** The creator's caption, `video_description` in TikTok's API. */
27
- description: z2.string(),
28
- durationSeconds: z2.number().int().nonnegative(),
29
- width: z2.number().int().nonnegative(),
30
- height: z2.number().int().nonnegative(),
31
- /** When the video was posted, epoch milliseconds. */
32
- createdAt: z2.number().int().nonnegative(),
33
- /** TikTok's shareable link to the video. */
34
- shareUrl: z2.string(),
35
- /** Whether the creator labelled the video as AI-generated content. */
36
- isAigc: z2.boolean()
37
- });
38
- var tiktokVideoMetrics = [
39
- "views",
40
- "likes",
41
- "comments",
42
- "shares"
43
- ];
9
+ } from "./chunk-ID3BZXFZ.js";
44
10
 
45
11
  // src/server/analytics.ts
46
- import * as z3 from "zod";
12
+ import * as z from "zod";
47
13
  function once(build) {
48
14
  let built;
49
15
  return () => built ??= build();
@@ -60,51 +26,61 @@ function lazyShape(builders) {
60
26
  return shape;
61
27
  }
62
28
  var analyticsRanges = ["7d", "30d", "90d", "all"];
63
- var amount = once(() => z3.number().int().safe());
64
- var amounts = once(() => z3.array(amount()));
65
- var instant = once(() => z3.iso.datetime({ offset: true }));
66
- var bucket = once(
67
- () => z3.object({
29
+ var amount = /* @__PURE__ */ (() => once(() => z.number().int().safe()))();
30
+ var amounts = /* @__PURE__ */ (() => once(() => z.array(amount())))();
31
+ var instant = /* @__PURE__ */ (() => once(() => z.iso.datetime({ offset: true })))();
32
+ var instantMs = /* @__PURE__ */ (() => once(() => amount().optional()))();
33
+ var bucket = /* @__PURE__ */ (() => once(
34
+ () => z.object({
68
35
  /** The period's label in its time zone, such as `2026-10-08@Europe/Budapest` or `2026-W41@UTC`. */
69
- key: z3.string(),
36
+ key: z.string(),
70
37
  start: instant(),
71
- end: instant()
38
+ startMs: instantMs(),
39
+ end: instant(),
40
+ endMs: instantMs()
72
41
  })
73
- );
74
- var range = once(
75
- () => z3.object({
76
- key: z3.enum(analyticsRanges),
42
+ ))();
43
+ var range = /* @__PURE__ */ (() => once(
44
+ () => z.object({
45
+ key: z.enum(analyticsRanges),
77
46
  from: instant(),
47
+ fromMs: instantMs(),
78
48
  /** Now, by the database's clock, when the read ran. */
79
49
  to: instant(),
80
- bucket: z3.enum(["day", "week"]),
50
+ toMs: instantMs(),
51
+ bucket: z.enum(["day", "week"]),
81
52
  /** The project calendar's time zone now. Buckets before a time zone change follow the old one. */
82
- timeZone: z3.string(),
83
- buckets: z3.array(bucket())
53
+ timeZone: z.string(),
54
+ buckets: z.array(bucket())
84
55
  })
85
- );
86
- var previousRange = once(
87
- () => z3.object({ from: instant(), to: instant() }).optional()
88
- );
89
- var analyticsQuerySchema = z3.strictObject(
56
+ ))();
57
+ var previousRange = /* @__PURE__ */ (() => once(
58
+ () => z.object({
59
+ from: instant(),
60
+ fromMs: instantMs(),
61
+ to: instant(),
62
+ toMs: instantMs()
63
+ }).optional()
64
+ ))();
65
+ var analyticsQuerySchema = /* @__PURE__ */ (() => z.strictObject(
90
66
  lazyShape({
91
- range: () => z3.enum(analyticsRanges),
67
+ range: () => z.enum(analyticsRanges),
92
68
  /** A point ledger's key or ID. Defaults to the first ledger that is not archived. */
93
69
  ledger: () => identifier.optional()
94
70
  })
95
- );
96
- var metric = once(
97
- () => z3.object({
71
+ ))();
72
+ var metric = /* @__PURE__ */ (() => once(
73
+ () => z.object({
98
74
  total: amount(),
99
75
  previousTotal: amount().optional(),
100
76
  series: amounts()
101
77
  })
102
- );
103
- var optionalMetric = once(() => metric().optional());
104
- var quest = once(
105
- () => z3.object({
78
+ ))();
79
+ var optionalMetric = /* @__PURE__ */ (() => once(() => metric().optional()))();
80
+ var quest = /* @__PURE__ */ (() => once(
81
+ () => z.object({
106
82
  quest: identifier,
107
- title: z3.string(),
83
+ title: z.string(),
108
84
  /** Attempts created in the range. */
109
85
  attempts: amount(),
110
86
  /** Completions in the range that were never revoked. */
@@ -116,57 +92,68 @@ var quest = once(
116
92
  /** Attempts created in the range that went to staff review. */
117
93
  needsReview: amount(),
118
94
  /** `rejected ÷ decided`, or null below 10 decided attempts. */
119
- rejectionRate: z3.number().min(0).max(1).nullable(),
95
+ rejectionRate: z.number().min(0).max(1).nullable(),
120
96
  /**
121
97
  * The 5 most common rejections, most frequent first. Rejections with a code (an evaluator's
122
- * reject code or one Relay writes, such as `budget-exhausted`) group by it, and `reason` is the
123
- * latest rejection's reason; rejections without one group by their exact reason.
98
+ * reject code or one Relay writes, such as `budget-exhausted`) group by it and by who wrote it,
99
+ * so Relay's `key-used` and an evaluator's own `key-used` are separate rows; `reason` is the
100
+ * latest rejection's reason. Rejections without one group by their exact reason.
124
101
  */
125
- topReasons: z3.array(
126
- z3.object({
127
- reason: z3.string(),
128
- code: z3.string().nullable(),
102
+ topReasons: z.array(
103
+ z.object({
104
+ reason: z.string(),
105
+ code: z.string().nullable(),
106
+ /**
107
+ * Who wrote `code`: `relay` or `evaluator`, null for a rejection without one. Relay always
108
+ * sends it; servers before it was added did not.
109
+ */
110
+ codeSource: z.string().nullish(),
129
111
  count: amount()
130
112
  })
131
113
  ),
132
- /** Rejections by who made them: the evaluator, staff, an exhausted budget, an expired deferral. */
133
- rejectionsBySource: z3.object({
114
+ /**
115
+ * Rejections by who made them: the evaluator, staff, an exhausted budget, an expired deferral,
116
+ * or Relay because another member's completion holds the attempt's shared key (`keyUsed`, which
117
+ * Relay always sends; servers before it was added counted those as `evaluator`).
118
+ */
119
+ rejectionsBySource: z.object({
134
120
  evaluator: amount(),
135
121
  staff: amount(),
136
122
  budget: amount(),
137
- expired: amount()
123
+ expired: amount(),
124
+ keyUsed: amount().optional()
138
125
  }),
139
126
  /** Attempts and completions per bucket. */
140
- series: z3.object({ attempts: amounts(), completions: amounts() })
127
+ series: z.object({ attempts: amounts(), completions: amounts() })
141
128
  })
142
- );
143
- var analyticsReadSchema = z3.object(
144
- lazyShape({
129
+ ))();
130
+ var analyticsReadSchema = /* @__PURE__ */ (() => z.object(
131
+ /* @__PURE__ */ lazyShape({
145
132
  range,
146
133
  previous: previousRange,
147
- members: () => z3.object({
134
+ members: () => z.object({
148
135
  /** Members who joined the project. */
149
136
  signUps: metric(),
150
137
  /** Distinct members with an attempt; the total counts each member once over the range. */
151
138
  active: metric()
152
139
  }),
153
- quests: () => z3.object({
140
+ quests: () => z.object({
154
141
  attempts: metric(),
155
142
  completions: metric(),
156
143
  rejections: metric(),
157
144
  needsReview: metric(),
158
145
  /** Quests with activity in the range, most attempted first. */
159
- byQuest: z3.array(quest())
146
+ byQuest: z.array(quest())
160
147
  }),
161
- points: () => z3.object({
148
+ points: () => z.object({
162
149
  /** The project's point ledgers, oldest first. */
163
- ledgers: z3.array(
164
- z3.object({ key: identifier, name: z3.string(), archived: z3.boolean() })
150
+ ledgers: z.array(
151
+ z.object({ key: identifier, name: z.string(), archived: z.boolean() })
165
152
  ),
166
153
  /** The ledger this section reads, or null when the project has none to read. */
167
154
  ledger: identifier.nullable(),
168
155
  /** Whether the ledger has a spend entry. `spent` and `net` are present only when it does. */
169
- hasSpending: z3.boolean(),
156
+ hasSpending: z.boolean(),
170
157
  /** Points in award entries. */
171
158
  awarded: metric(),
172
159
  /** Points in spend entries, as a positive number. */
@@ -177,20 +164,20 @@ var analyticsReadSchema = z3.object(
177
164
  membersEarning: metric()
178
165
  }),
179
166
  /** Fulfilled offer redemptions. Present only when the project has an offer. */
180
- offers: () => z3.object({
167
+ offers: () => z.object({
181
168
  redemptions: metric(),
182
169
  /** Every offer, most redeemed first. */
183
- byOffer: z3.array(
184
- z3.object({
170
+ byOffer: z.array(
171
+ z.object({
185
172
  offer: identifier,
186
- title: z3.string(),
173
+ title: z.string(),
187
174
  redemptions: amount(),
188
175
  series: amounts()
189
176
  })
190
177
  )
191
178
  }).optional(),
192
179
  /** Present only when the project has a referral program. */
193
- referrals: () => z3.object({
180
+ referrals: () => z.object({
194
181
  /** Referrals accepted. */
195
182
  accepted: metric(),
196
183
  /** Active qualifications, by when they first qualified; suspended referrals still count. */
@@ -201,20 +188,22 @@ var analyticsReadSchema = z3.object(
201
188
  * `acceptedQualified.total ÷ accepted.total` is the share of the range's friends who have
202
189
  * qualified since, never above 1.
203
190
  */
204
- acceptedQualified: z3.object({
191
+ acceptedQualified: z.object({
205
192
  total: amount(),
206
193
  previousTotal: amount().optional()
207
194
  })
208
195
  }).optional(),
209
196
  /** Present only in the test environment. */
210
- testEnvironment: () => z3.object({
197
+ testEnvironment: () => z.object({
211
198
  /** When a test member was last reset, deleting their history, or null. */
212
199
  lastResetAt: instant().nullable(),
200
+ /** `lastResetAt` in epoch milliseconds. Servers before it was added did not send it. */
201
+ lastResetAtMs: amount().nullish(),
213
202
  /** Test members whose clock is advanced, so their activity can be dated in the future. */
214
203
  shiftedClockMembers: amount()
215
204
  }).optional()
216
205
  })
217
- );
206
+ ))();
218
207
  var analyticsBreakdowns = [
219
208
  "quest",
220
209
  "source",
@@ -395,84 +384,87 @@ var analyticsCatalog = {
395
384
  ledger: false
396
385
  }
397
386
  };
398
- var analyticsMetricIds = Object.keys(
387
+ var analyticsMetricIds = /* @__PURE__ */ (() => Object.keys(
399
388
  analyticsCatalog
400
- );
401
- var analyticsCatalogSchema = z3.object(
389
+ ))();
390
+ var analyticsCatalogSchema = /* @__PURE__ */ (() => z.object(
402
391
  lazyShape({
403
- metrics: () => z3.array(
404
- z3.object({
405
- id: z3.string(),
406
- definition: z3.string(),
407
- kind: z3.enum(["count", "distinct", "rate"]),
408
- breakdowns: z3.array(z3.string()),
409
- filters: z3.array(z3.string()),
410
- charts: z3.array(z3.string()),
411
- ledger: z3.boolean(),
392
+ metrics: () => z.array(
393
+ z.object({
394
+ id: z.string(),
395
+ definition: z.string(),
396
+ kind: z.enum(["count", "distinct", "rate"]),
397
+ breakdowns: z.array(z.string()),
398
+ filters: z.array(z.string()),
399
+ charts: z.array(z.string()),
400
+ ledger: z.boolean(),
412
401
  /** For a rate, the denominator below which a value is empty. */
413
402
  minimumDenominator: amount().optional()
414
403
  })
415
404
  )
416
405
  })
417
- );
406
+ ))();
418
407
  var analyticsQueryLimit = 100;
419
- var analyticsMetricQuerySchema = z3.strictObject(
408
+ var analyticsMetricQuerySchema = /* @__PURE__ */ (() => z.strictObject(
420
409
  lazyShape({
421
- metric: () => z3.string().min(1).max(100),
422
- range: () => z3.enum(analyticsRanges),
423
- breakdown: () => z3.string().min(1).max(100).optional(),
410
+ metric: () => z.string().min(1).max(100),
411
+ range: () => z.enum(analyticsRanges),
412
+ breakdown: () => z.string().min(1).max(100).optional(),
424
413
  /** Each filter names one key or a list of keys; a list matches any of them. */
425
- filter: () => z3.record(
426
- z3.string().min(1).max(100),
427
- z3.union([identifier, z3.array(identifier).min(1).max(100)])
414
+ filter: () => z.record(
415
+ z.string().min(1).max(100),
416
+ z.union([identifier, z.array(identifier).min(1).max(100)])
428
417
  ).optional(),
429
418
  /** A point ledger's key or ID, archived ledgers included. Points metrics need one. */
430
419
  ledger: () => identifier.optional(),
431
420
  /** Breakdown rows to return, 1 to 100 (default 100); the rest are summed into `other`. */
432
- limit: () => z3.number().int().optional()
421
+ limit: () => z.number().int().optional()
433
422
  })
434
- );
435
- var measureNumber = once(() => z3.number().nullable());
436
- var measure = once(() => ({
423
+ ))();
424
+ var measureNumber = /* @__PURE__ */ (() => once(() => z.number().nullable()))();
425
+ var measure = /* @__PURE__ */ (() => once(() => ({
437
426
  total: measureNumber(),
438
427
  previousTotal: measureNumber().optional(),
439
- series: z3.array(measureNumber())
440
- }));
441
- var analyticsMetricResultSchema = z3.object(
428
+ series: z.array(measureNumber())
429
+ })))();
430
+ var analyticsMetricResultSchema = /* @__PURE__ */ (() => z.object(
442
431
  lazyShape({
443
- metric: () => z3.string(),
432
+ metric: () => z.string(),
444
433
  /** How the value reads: a `count`, a `distinct` count of members, or a `rate` from 0 to 1. */
445
- kind: () => z3.enum(["count", "distinct", "rate"]),
434
+ kind: () => z.enum(["count", "distinct", "rate"]),
446
435
  range,
447
436
  previous: previousRange,
448
437
  /** The point ledger a points metric read, by key. */
449
438
  ledger: () => identifier.optional(),
450
439
  /** The metric over everything the filters match, every breakdown row included. */
451
- value: () => z3.object(measure()),
452
- breakdown: () => z3.object({
453
- dimension: z3.string(),
440
+ value: () => z.object(measure()),
441
+ breakdown: () => z.object({
442
+ dimension: z.string(),
454
443
  /**
455
444
  * Sorted by total, largest first (an empty rate last), at most `limit`. Every matching
456
445
  * quest, offer, program, group, tracker or leaderboard that is not archived has a row, and an archived one has a row
457
446
  * when it has activity in the range or the range before.
458
447
  */
459
- rows: z3.array(
460
- z3.object({
461
- /** The resource's key (its ID when it has none), the source, the outcome, or the reason's code or text. */
462
- key: z3.string(),
463
- title: z3.string(),
464
- archived: z3.boolean(),
448
+ rows: z.array(
449
+ z.object({
450
+ /**
451
+ * The resource's key (its ID when it has none), the source, the outcome, or the reason's
452
+ * code or text; Relay's `key-used` is `relay:key-used`, apart from an evaluator's `key-used`.
453
+ */
454
+ key: z.string(),
455
+ title: z.string(),
456
+ archived: z.boolean(),
465
457
  ...measure()
466
458
  })
467
459
  ),
468
460
  /** The rows past `limit`, summed; for a rate, their summed numerators over denominators. */
469
- other: z3.object({ rows: amount(), ...measure() }).optional()
461
+ other: z.object({ rows: amount(), ...measure() }).optional()
470
462
  }).optional()
471
463
  })
472
- );
464
+ ))();
473
465
 
474
466
  // src/dashboards.ts
475
- import * as z4 from "zod";
467
+ import * as z2 from "zod";
476
468
  var dashboardLimits = { panels: 24, dashboards: 20 };
477
469
  var defaultPanelWidths = {
478
470
  number: 1,
@@ -480,64 +472,64 @@ var defaultPanelWidths = {
480
472
  bar: 2,
481
473
  table: 4
482
474
  };
483
- var title = z4.string().trim().min(1).max(120);
484
- var description = z4.string().trim().min(1).max(500);
485
- var filterValue = z4.union([identifier, z4.array(identifier).min(1).max(100)]);
486
- var filter = z4.record(z4.string().min(1).max(100), filterValue);
487
- var panelFields = {
475
+ var title = /* @__PURE__ */ (() => z2.string().trim().min(1).max(120))();
476
+ var description = /* @__PURE__ */ (() => z2.string().trim().min(1).max(500))();
477
+ var filterValue = /* @__PURE__ */ (() => z2.union([identifier, z2.array(identifier).min(1).max(100)]))();
478
+ var filter = /* @__PURE__ */ (() => z2.record(z2.string().min(1).max(100), filterValue))();
479
+ var panelFields = /* @__PURE__ */ (() => ({
488
480
  key: identifier,
489
481
  title,
490
482
  description: description.optional(),
491
483
  /** A metric ID from the catalog (`analytics.catalog`). */
492
- metric: z4.string().min(1).max(100),
493
- breakdown: z4.string().min(1).max(100).optional(),
484
+ metric: z2.string().min(1).max(100),
485
+ breakdown: z2.string().min(1).max(100).optional(),
494
486
  /** Each filter names one key or a list of keys; a list matches any of them. */
495
487
  filter: filter.optional(),
496
488
  /** The point ledger a points metric reads, by key. */
497
489
  ledger: identifier.optional(),
498
- chart: z4.enum(analyticsCharts)
499
- };
500
- var dashboardPanelAuthoringSchema = z4.strictObject({
490
+ chart: z2.enum(analyticsCharts)
491
+ }))();
492
+ var dashboardPanelAuthoringSchema = /* @__PURE__ */ (() => z2.strictObject({
501
493
  ...panelFields,
502
- width: z4.number().int().min(1).max(4).optional()
503
- });
504
- var dashboardAuthoringSchema = z4.strictObject({
494
+ width: z2.number().int().min(1).max(4).optional()
495
+ }))();
496
+ var dashboardAuthoringSchema = /* @__PURE__ */ (() => z2.strictObject({
505
497
  key: identifier,
506
498
  title,
507
499
  description: description.optional(),
508
500
  /** The range the dashboard opens with. Defaults to `30d`. */
509
- defaultRange: z4.enum(analyticsRanges).optional(),
501
+ defaultRange: z2.enum(analyticsRanges).optional(),
510
502
  /** Orders dashboards in lists: by position, those without one last, then by title. */
511
- position: z4.number().int().min(0).max(1e3).optional(),
512
- sections: z4.array(
513
- z4.strictObject({
503
+ position: z2.number().int().min(0).max(1e3).optional(),
504
+ sections: z2.array(
505
+ z2.strictObject({
514
506
  title: title.optional(),
515
- panels: z4.array(dashboardPanelAuthoringSchema).min(1).max(100)
507
+ panels: z2.array(dashboardPanelAuthoringSchema).min(1).max(100)
516
508
  })
517
509
  ).min(1).max(100)
518
- });
519
- var dashboardDefinitionSchema = z4.strictObject({
510
+ }))();
511
+ var dashboardDefinitionSchema = /* @__PURE__ */ (() => z2.strictObject({
520
512
  key: identifier,
521
513
  title,
522
514
  description: description.optional(),
523
- defaultRange: z4.enum(analyticsRanges),
524
- position: z4.number().int().min(0).max(1e3).optional(),
525
- sections: z4.array(
526
- z4.strictObject({
515
+ defaultRange: z2.enum(analyticsRanges),
516
+ position: z2.number().int().min(0).max(1e3).optional(),
517
+ sections: z2.array(
518
+ z2.strictObject({
527
519
  title: title.optional(),
528
- panels: z4.array(
529
- z4.strictObject({
520
+ panels: z2.array(
521
+ z2.strictObject({
530
522
  ...panelFields,
531
- width: z4.number().int().min(1).max(4)
523
+ width: z2.number().int().min(1).max(4)
532
524
  })
533
525
  )
534
526
  })
535
527
  )
536
- });
537
- var dashboardArtifactSchema = z4.union([
528
+ }))();
529
+ var dashboardArtifactSchema = /* @__PURE__ */ (() => z2.union([
538
530
  dashboardAuthoringSchema,
539
- z4.object({ code: z4.string().min(1).max(2e6) }).strict()
540
- ]);
531
+ z2.object({ code: z2.string().min(1).max(2e6) }).strict()
532
+ ]))();
541
533
  function normalizeDashboard(input) {
542
534
  const dashboard = dashboardAuthoringSchema.parse(input);
543
535
  return dashboardDefinitionSchema.parse({
@@ -561,10 +553,10 @@ function dashboardPanels(dashboard) {
561
553
  function dashboardIssue(dashboard) {
562
554
  const panels = dashboard.sections.flatMap((section) => [...section.panels]);
563
555
  const where = `dashboard "${dashboard.key}"`;
564
- if (panels.length > dashboardLimits.panels) {
556
+ if (panels.length > limits.dashboardPanels) {
565
557
  return {
566
558
  code: "too-many-panels",
567
- message: `The ${where} has ${panels.length} panels; a dashboard holds at most ${dashboardLimits.panels}.`
559
+ message: `The ${where} has ${panels.length} panels; a dashboard holds at most ${limits.dashboardPanels}.`
568
560
  };
569
561
  }
570
562
  const keys = /* @__PURE__ */ new Set();
@@ -640,15 +632,15 @@ function dashboardIssue(dashboard) {
640
632
  }
641
633
  return null;
642
634
  }
643
- var dashboardPreviewSchema = responseShape(
644
- z4.object({
635
+ var dashboardPreviewSchema = /* @__PURE__ */ (() => responseShape(
636
+ z2.object({
645
637
  key: identifier,
646
- title: z4.string(),
638
+ title: z2.string(),
647
639
  /** `unchanged`: the definition equals the published one, and publishing writes no version. */
648
- change: z4.enum(["created", "updated", "unchanged"]),
640
+ change: z2.enum(["created", "updated", "unchanged"]),
649
641
  definition: dashboardDefinitionSchema
650
642
  })
651
- );
643
+ ))();
652
644
  var keyOf = (reference) => typeof reference === "string" ? reference : reference.key;
653
645
  function defineDashboard(input) {
654
646
  const authored = parseDefinition("Dashboard", dashboardAuthoringSchema, {
@@ -673,10 +665,6 @@ function defineDashboard(input) {
673
665
  }
674
666
 
675
667
  export {
676
- youtubeShortBodySchema,
677
- youtubeShortMetrics,
678
- tiktokVideoBodySchema,
679
- tiktokVideoMetrics,
680
668
  analyticsRanges,
681
669
  analyticsQuerySchema,
682
670
  analyticsReadSchema,
@@ -0,0 +1,21 @@
1
+ // src/telegram-browser.ts
2
+ function miniAppInitData() {
3
+ const scope = globalThis;
4
+ const fromScript = scope.Telegram?.WebApp?.initData;
5
+ if (typeof fromScript === "string" && fromScript.length > 0) {
6
+ return fromScript;
7
+ }
8
+ const hash = scope.location?.hash;
9
+ if (!hash) {
10
+ return null;
11
+ }
12
+ return new URLSearchParams(hash.replace(/^#/, "")).get("tgWebAppData") || null;
13
+ }
14
+ function telegramMiniAppInitData() {
15
+ return miniAppInitData();
16
+ }
17
+
18
+ export {
19
+ miniAppInitData,
20
+ telegramMiniAppInitData
21
+ };