@fundedfast/sdk 1.3.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 (52) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +352 -0
  3. package/dist/cjs/client.d.ts +130 -0
  4. package/dist/cjs/client.d.ts.map +1 -0
  5. package/dist/cjs/client.js +362 -0
  6. package/dist/cjs/client.js.map +1 -0
  7. package/dist/cjs/index.d.ts +27 -0
  8. package/dist/cjs/index.d.ts.map +1 -0
  9. package/dist/cjs/index.js +33 -0
  10. package/dist/cjs/index.js.map +1 -0
  11. package/dist/cjs/package.json +1 -0
  12. package/dist/cjs/resources/admin.d.ts +597 -0
  13. package/dist/cjs/resources/admin.d.ts.map +1 -0
  14. package/dist/cjs/resources/admin.js +842 -0
  15. package/dist/cjs/resources/admin.js.map +1 -0
  16. package/dist/cjs/resources/public.d.ts +519 -0
  17. package/dist/cjs/resources/public.d.ts.map +1 -0
  18. package/dist/cjs/resources/public.js +588 -0
  19. package/dist/cjs/resources/public.js.map +1 -0
  20. package/dist/cjs/types.d.ts +651 -0
  21. package/dist/cjs/types.d.ts.map +1 -0
  22. package/dist/cjs/types.js +11 -0
  23. package/dist/cjs/types.js.map +1 -0
  24. package/dist/cjs/webhooks.d.ts +104 -0
  25. package/dist/cjs/webhooks.d.ts.map +1 -0
  26. package/dist/cjs/webhooks.js +199 -0
  27. package/dist/cjs/webhooks.js.map +1 -0
  28. package/dist/esm/client.d.ts +130 -0
  29. package/dist/esm/client.d.ts.map +1 -0
  30. package/dist/esm/client.js +355 -0
  31. package/dist/esm/client.js.map +1 -0
  32. package/dist/esm/index.d.ts +27 -0
  33. package/dist/esm/index.d.ts.map +1 -0
  34. package/dist/esm/index.js +26 -0
  35. package/dist/esm/index.js.map +1 -0
  36. package/dist/esm/resources/admin.d.ts +597 -0
  37. package/dist/esm/resources/admin.d.ts.map +1 -0
  38. package/dist/esm/resources/admin.js +816 -0
  39. package/dist/esm/resources/admin.js.map +1 -0
  40. package/dist/esm/resources/public.d.ts +519 -0
  41. package/dist/esm/resources/public.d.ts.map +1 -0
  42. package/dist/esm/resources/public.js +578 -0
  43. package/dist/esm/resources/public.js.map +1 -0
  44. package/dist/esm/types.d.ts +651 -0
  45. package/dist/esm/types.d.ts.map +1 -0
  46. package/dist/esm/types.js +10 -0
  47. package/dist/esm/types.js.map +1 -0
  48. package/dist/esm/webhooks.d.ts +104 -0
  49. package/dist/esm/webhooks.d.ts.map +1 -0
  50. package/dist/esm/webhooks.js +159 -0
  51. package/dist/esm/webhooks.js.map +1 -0
  52. package/package.json +72 -0
@@ -0,0 +1,842 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminSupportApi = exports.AdminTemplatesApi = exports.AdminNotificationChannelsApi = exports.AdminUsersApi = exports.AdminReconciliationApi = exports.AdminAdaptersApi = exports.AdminSelfExclusionApi = exports.AdminRewardRulesApi = exports.AdminRewardsApi = exports.AdminNotificationsApi = exports.AdminAchievementsApi = exports.AdminAnalyticsApi = exports.AdminLoyaltyApi = exports.AdminTournamentsApi = exports.AdminMissionsApi = exports.AdminBonusesApi = exports.AdminSettingsApi = exports.AdminAuditApi = exports.AdminWebhooksApi = exports.AdminBetsApi = exports.AdminRulesetsApi = exports.AdminChallengeTiersApi = exports.AdminApi = void 0;
4
+ class AdminApi {
5
+ challengeTiers;
6
+ rulesets;
7
+ bets;
8
+ webhooks;
9
+ audit;
10
+ settings;
11
+ bonuses;
12
+ missions;
13
+ tournaments;
14
+ loyalty;
15
+ analytics;
16
+ achievements;
17
+ notifications;
18
+ rewards;
19
+ rewardRules;
20
+ selfExclusion;
21
+ adapters;
22
+ reconciliation;
23
+ users;
24
+ notificationChannels;
25
+ templates;
26
+ support;
27
+ constructor(client) {
28
+ this.challengeTiers = new AdminChallengeTiersApi(client);
29
+ this.rulesets = new AdminRulesetsApi(client);
30
+ this.bets = new AdminBetsApi(client);
31
+ this.webhooks = new AdminWebhooksApi(client);
32
+ this.audit = new AdminAuditApi(client);
33
+ this.settings = new AdminSettingsApi(client);
34
+ this.bonuses = new AdminBonusesApi(client);
35
+ this.missions = new AdminMissionsApi(client);
36
+ this.tournaments = new AdminTournamentsApi(client);
37
+ this.loyalty = new AdminLoyaltyApi(client);
38
+ this.analytics = new AdminAnalyticsApi(client);
39
+ this.achievements = new AdminAchievementsApi(client);
40
+ this.notifications = new AdminNotificationsApi(client);
41
+ this.rewards = new AdminRewardsApi(client);
42
+ this.rewardRules = new AdminRewardRulesApi(client);
43
+ this.selfExclusion = new AdminSelfExclusionApi(client);
44
+ this.adapters = new AdminAdaptersApi(client);
45
+ this.reconciliation = new AdminReconciliationApi(client);
46
+ this.users = new AdminUsersApi(client);
47
+ this.notificationChannels = new AdminNotificationChannelsApi(client);
48
+ this.templates = new AdminTemplatesApi(client);
49
+ this.support = new AdminSupportApi(client);
50
+ }
51
+ }
52
+ exports.AdminApi = AdminApi;
53
+ class AdminChallengeTiersApi {
54
+ client;
55
+ constructor(client) {
56
+ this.client = client;
57
+ }
58
+ async list() {
59
+ const res = await this.client.request('GET', '/admin/challenge-tiers');
60
+ return res.challengeTiers;
61
+ }
62
+ async create(data) {
63
+ const res = await this.client.request('POST', '/admin/challenge-tiers', { body: data });
64
+ return res.challengeTier;
65
+ }
66
+ async update(id, data) {
67
+ const res = await this.client.request('PUT', `/admin/challenge-tiers/${id}`, { body: data });
68
+ return res.challengeTier;
69
+ }
70
+ async delete(id) {
71
+ return this.client.request('DELETE', `/admin/challenge-tiers/${id}`);
72
+ }
73
+ }
74
+ exports.AdminChallengeTiersApi = AdminChallengeTiersApi;
75
+ class AdminRulesetsApi {
76
+ client;
77
+ constructor(client) {
78
+ this.client = client;
79
+ }
80
+ async list() {
81
+ const res = await this.client.request('GET', '/admin/rulesets');
82
+ return res.rulesets;
83
+ }
84
+ async create(data) {
85
+ const res = await this.client.request('POST', '/admin/rulesets', { body: data });
86
+ return res.ruleset;
87
+ }
88
+ async update(id, data) {
89
+ const res = await this.client.request('PUT', `/admin/rulesets/${id}`, { body: data });
90
+ return res.ruleset;
91
+ }
92
+ async delete(id) {
93
+ return this.client.request('DELETE', `/admin/rulesets/${id}`);
94
+ }
95
+ }
96
+ exports.AdminRulesetsApi = AdminRulesetsApi;
97
+ class AdminBetsApi {
98
+ client;
99
+ constructor(client) {
100
+ this.client = client;
101
+ }
102
+ async list(options) {
103
+ const query = {};
104
+ if (options?.status)
105
+ query.status = options.status;
106
+ if (options?.userId)
107
+ query.userId = options.userId;
108
+ const res = await this.client.request('GET', '/admin/bet-events', { query });
109
+ return res.betEvents;
110
+ }
111
+ async settle(id, outcome) {
112
+ const res = await this.client.request('POST', `/admin/bet-events/${id}/settle`, { body: { outcome } });
113
+ return res.betEvent;
114
+ }
115
+ async bulkSettle(settlements) {
116
+ return this.client.request('POST', '/admin/bet-events/bulk-settle', { body: { settlements } });
117
+ }
118
+ async bulkExpire() {
119
+ return this.client.request('POST', '/admin/challenges/bulk-expire');
120
+ }
121
+ async export(options) {
122
+ const query = {};
123
+ if (options?.from)
124
+ query.from = options.from;
125
+ if (options?.to)
126
+ query.to = options.to;
127
+ if (options?.userId)
128
+ query.userId = options.userId;
129
+ return this.client.request('GET', '/admin/bet-events/export', { query });
130
+ }
131
+ }
132
+ exports.AdminBetsApi = AdminBetsApi;
133
+ class AdminWebhooksApi {
134
+ client;
135
+ constructor(client) {
136
+ this.client = client;
137
+ }
138
+ async list() {
139
+ const res = await this.client.request('GET', '/admin/webhooks');
140
+ return res.deliveries;
141
+ }
142
+ async deadLetters() {
143
+ const res = await this.client.request('GET', '/admin/webhooks/dead-letters');
144
+ return res.deadLetters;
145
+ }
146
+ async replay(id) {
147
+ return this.client.request('POST', `/admin/webhooks/dead-letters/${id}/replay`);
148
+ }
149
+ /** Retry a failed webhook delivery (resets it to pending and re-dispatches). */
150
+ async retry(id) {
151
+ return this.client.request('POST', `/admin/webhooks/${id}/retry`);
152
+ }
153
+ /**
154
+ * List dead-letter post-bet hook runs (gamification, bonuses, missions,
155
+ * tournaments, loyalty accruals that exhausted all queue retries).
156
+ * Distinct from webhook delivery dead letters.
157
+ */
158
+ async hookDeadLetters() {
159
+ return this.client.request('GET', '/admin/hooks/dead-letters');
160
+ }
161
+ /** Replay a dead-letter post-bet hook run. Double-counting is prevented server-side. */
162
+ async replayHook(id) {
163
+ return this.client.request('POST', `/admin/hooks/dead-letters/${id}/replay`);
164
+ }
165
+ async rotateSecret() {
166
+ return this.client.request('POST', '/admin/webhooks/rotate-secret');
167
+ }
168
+ async health() {
169
+ return this.client.request('GET', '/admin/webhooks/health');
170
+ }
171
+ async echo(limit = 50, eventType) {
172
+ const query = { limit: String(limit) };
173
+ if (eventType)
174
+ query.eventType = eventType;
175
+ return this.client.request('GET', '/webhook-echo', { query });
176
+ }
177
+ async clearEcho() {
178
+ return this.client.request('DELETE', '/webhook-echo');
179
+ }
180
+ }
181
+ exports.AdminWebhooksApi = AdminWebhooksApi;
182
+ class AdminAuditApi {
183
+ client;
184
+ constructor(client) {
185
+ this.client = client;
186
+ }
187
+ async list(options) {
188
+ const query = {};
189
+ if (options?.type)
190
+ query.type = options.type;
191
+ if (options?.limit)
192
+ query.limit = String(options.limit);
193
+ if (options?.offset)
194
+ query.offset = String(options.offset);
195
+ return this.client.request('GET', '/audit/log', { query });
196
+ }
197
+ /** Admin audit log (different view from /audit/log) */
198
+ async adminLog(options) {
199
+ const query = {};
200
+ if (options?.action)
201
+ query.action = options.action;
202
+ if (options?.userId)
203
+ query.userId = options.userId;
204
+ if (options?.limit)
205
+ query.limit = String(options.limit);
206
+ if (options?.offset)
207
+ query.offset = String(options.offset);
208
+ return this.client.request('GET', '/admin/audit-log', { query });
209
+ }
210
+ /**
211
+ * Bulk data export (GDPR Art. 20).
212
+ *
213
+ * Exports tenant data as JSON: rulesets, challenge tiers, challenges,
214
+ * funded accounts, bet events, and webhook deliveries. One call covers at
215
+ * most 90 days (the last 90 when no bounds are given); a wider from/to range
216
+ * is rejected, so export longer histories as consecutive windows.
217
+ */
218
+ async export(options) {
219
+ const query = {};
220
+ if (options?.from)
221
+ query.from = options.from;
222
+ if (options?.to)
223
+ query.to = options.to;
224
+ return this.client.request('GET', '/audit/export', { query });
225
+ }
226
+ /** Data retention policy for all data categories, with GDPR rights information. */
227
+ async retention() {
228
+ return this.client.request('GET', '/audit/retention');
229
+ }
230
+ }
231
+ exports.AdminAuditApi = AdminAuditApi;
232
+ class AdminSettingsApi {
233
+ client;
234
+ constructor(client) {
235
+ this.client = client;
236
+ }
237
+ async get() {
238
+ return this.client.request('GET', '/admin/settings');
239
+ }
240
+ async setIntegrationMode(mode) {
241
+ return this.client.request('PUT', '/admin/integration-mode', { body: { integrationMode: mode } });
242
+ }
243
+ async getIntegrationMode() {
244
+ return this.client.request('GET', '/admin/integration-mode');
245
+ }
246
+ async setWebhookUrl(url) {
247
+ return this.client.request('PUT', '/admin/settings/webhook', { body: { webhookUrl: url } });
248
+ }
249
+ /**
250
+ * Set the single operator approval URL. FAST calls this one endpoint before any
251
+ * money/irreversible action (purchase, withdrawal, cancel); the action `type` is
252
+ * in the request payload and the `X-Fast-Event` header. Pass null to disable.
253
+ */
254
+ async setApprovalUrl(approvalUrl) {
255
+ return this.client.request('PUT', '/admin/settings/approval-urls', { body: { approvalUrl } });
256
+ }
257
+ async setChallengeLimit(limit) {
258
+ return this.client.request('PUT', '/admin/settings/challenge-limit', { body: { operatorChallengeLimit: limit } });
259
+ }
260
+ async setCurrency(currency, symbol) {
261
+ return this.client.request('PUT', '/admin/settings/currency', { body: { currency, currencySymbol: symbol } });
262
+ }
263
+ async setExposureAlert(threshold) {
264
+ return this.client.request('PUT', '/admin/exposure-alert', { body: { threshold } });
265
+ }
266
+ async configExport(data) {
267
+ return this.client.request('PUT', '/admin/settings/export', { body: data });
268
+ }
269
+ /**
270
+ * Presigned download URL for one day's export CSV.
271
+ * @param date Export date as YYYY-MM-DD. Required by the endpoint.
272
+ */
273
+ async downloadExport(date) {
274
+ return this.client.request('GET', '/admin/settings/export/download', { query: { date } });
275
+ }
276
+ async testExport() {
277
+ return this.client.request('POST', '/admin/settings/export/test');
278
+ }
279
+ async getTheme() {
280
+ const res = await this.client.request('GET', '/admin/theme');
281
+ return res.theme;
282
+ }
283
+ async setTheme(theme) {
284
+ const res = await this.client.request('PUT', '/admin/theme', { body: theme });
285
+ return res.theme;
286
+ }
287
+ async clearSnapshots() {
288
+ return this.client.request('POST', '/admin/clear-snapshots');
289
+ }
290
+ /**
291
+ * Configure widget layout preferences.
292
+ *
293
+ * Toggles the funded-only layout and whether History shows as a bottom-nav
294
+ * item. Layout preferences only - does not change which engagement modules
295
+ * the plan includes. Only the provided fields are changed.
296
+ */
297
+ async setWidgetLayout(layout) {
298
+ return this.client.request('PUT', '/admin/settings/widget-layout', { body: layout });
299
+ }
300
+ }
301
+ exports.AdminSettingsApi = AdminSettingsApi;
302
+ class AdminBonusesApi {
303
+ client;
304
+ constructor(client) {
305
+ this.client = client;
306
+ }
307
+ async listOffers() {
308
+ const res = await this.client.request('GET', '/admin/bonus-offers');
309
+ return res.offers;
310
+ }
311
+ async createOffer(data) {
312
+ const res = await this.client.request('POST', '/admin/bonus-offers', { body: data });
313
+ return res.offer;
314
+ }
315
+ async updateOffer(id, data) {
316
+ const res = await this.client.request('PUT', `/admin/bonus-offers/${id}`, { body: data });
317
+ return res.offer;
318
+ }
319
+ async deleteOffer(id) {
320
+ return this.client.request('DELETE', `/admin/bonus-offers/${id}`);
321
+ }
322
+ async listActive() {
323
+ const res = await this.client.request('GET', '/admin/bonuses');
324
+ return res.bonuses;
325
+ }
326
+ async cancel(id) {
327
+ return this.client.request('POST', `/admin/bonuses/${id}/cancel`);
328
+ }
329
+ async grantToUser(data) {
330
+ return this.client.request('POST', '/admin/bonuses/grant', { body: data });
331
+ }
332
+ async stats() {
333
+ return this.client.request('GET', '/admin/bonuses/stats');
334
+ }
335
+ async getUserBonuses(userId) {
336
+ return this.client.request('GET', `/users/${userId}/bonuses`);
337
+ }
338
+ async activate(userId, bonusOfferId, depositAmount) {
339
+ return this.client.request('POST', `/users/${userId}/bonuses/activate`, { body: { bonusOfferId, depositAmount } });
340
+ }
341
+ }
342
+ exports.AdminBonusesApi = AdminBonusesApi;
343
+ class AdminMissionsApi {
344
+ client;
345
+ constructor(client) {
346
+ this.client = client;
347
+ }
348
+ async list() {
349
+ const res = await this.client.request('GET', '/admin/missions');
350
+ return res.missions;
351
+ }
352
+ async create(data) {
353
+ const res = await this.client.request('POST', '/admin/missions', { body: data });
354
+ return res.mission;
355
+ }
356
+ async update(id, data) {
357
+ const res = await this.client.request('PUT', `/admin/missions/${id}`, { body: data });
358
+ return res.mission;
359
+ }
360
+ async delete(id) {
361
+ return this.client.request('DELETE', `/admin/missions/${id}`);
362
+ }
363
+ async stats() {
364
+ return this.client.request('GET', '/admin/missions/stats');
365
+ }
366
+ async statsForMission(id) {
367
+ return this.client.request('GET', `/admin/missions/${id}/stats`);
368
+ }
369
+ async getUserMissions(userId) {
370
+ return this.client.request('GET', `/users/${userId}/missions`);
371
+ }
372
+ async join(userId, missionId) {
373
+ return this.client.request('POST', `/users/${userId}/missions/${missionId}/join`);
374
+ }
375
+ }
376
+ exports.AdminMissionsApi = AdminMissionsApi;
377
+ class AdminTournamentsApi {
378
+ client;
379
+ constructor(client) {
380
+ this.client = client;
381
+ }
382
+ async list() {
383
+ const res = await this.client.request('GET', '/admin/tournaments');
384
+ return res.tournaments;
385
+ }
386
+ async create(data) {
387
+ const res = await this.client.request('POST', '/admin/tournaments', { body: data });
388
+ return res.tournament;
389
+ }
390
+ async update(id, data) {
391
+ const res = await this.client.request('PUT', `/admin/tournaments/${id}`, { body: data });
392
+ return res.tournament;
393
+ }
394
+ /** Cancel an upcoming or active tournament. */
395
+ async cancel(id) {
396
+ return this.client.request('POST', `/admin/tournaments/${id}/cancel`);
397
+ }
398
+ async settle(id) {
399
+ return this.client.request('POST', `/admin/tournaments/${id}/settle`);
400
+ }
401
+ async entries(id) {
402
+ return this.client.request('GET', `/admin/tournaments/${id}/entries`);
403
+ }
404
+ async invite(id, userIds) {
405
+ return this.client.request('POST', `/admin/tournaments/${id}/invite`, { body: { userIds } });
406
+ }
407
+ async invites(id) {
408
+ return this.client.request('GET', `/admin/tournaments/${id}/invites`);
409
+ }
410
+ async stats() {
411
+ return this.client.request('GET', '/admin/tournaments/stats');
412
+ }
413
+ async listPublic() {
414
+ const res = await this.client.request('GET', '/tournaments');
415
+ return res.tournaments;
416
+ }
417
+ async leaderboard(tournamentId, limit = 10) {
418
+ return this.client.request('GET', `/tournaments/${tournamentId}/leaderboard`, { query: { limit: String(limit) } });
419
+ }
420
+ async join(userId, tournamentId) {
421
+ return this.client.request('POST', `/users/${userId}/tournaments/${tournamentId}/join`);
422
+ }
423
+ }
424
+ exports.AdminTournamentsApi = AdminTournamentsApi;
425
+ class AdminLoyaltyApi {
426
+ client;
427
+ constructor(client) {
428
+ this.client = client;
429
+ }
430
+ async getConfig() {
431
+ const res = await this.client.request('GET', '/admin/loyalty/config');
432
+ return res.config;
433
+ }
434
+ async setConfig(config) {
435
+ const res = await this.client.request('PUT', '/admin/loyalty/config', { body: config });
436
+ return res.config;
437
+ }
438
+ async getTiers() {
439
+ const res = await this.client.request('GET', '/admin/loyalty/tiers');
440
+ return res.tiers;
441
+ }
442
+ async createTier(data) {
443
+ const res = await this.client.request('POST', '/admin/loyalty/tiers', { body: data });
444
+ return res.tier;
445
+ }
446
+ async updateTier(id, data) {
447
+ const res = await this.client.request('PUT', `/admin/loyalty/tiers/${id}`, { body: data });
448
+ return res.tier;
449
+ }
450
+ async deleteTier(id) {
451
+ return this.client.request('DELETE', `/admin/loyalty/tiers/${id}`);
452
+ }
453
+ async listUsers(options) {
454
+ const query = {};
455
+ if (options?.tierId)
456
+ query.tierId = options.tierId;
457
+ if (options?.limit)
458
+ query.limit = String(options.limit);
459
+ return this.client.request('GET', '/admin/loyalty/users', { query });
460
+ }
461
+ async getUser(userId) {
462
+ const res = await this.client.request('GET', `/admin/loyalty/users/${userId}`);
463
+ return res.user;
464
+ }
465
+ async adjustPoints(userId, points, reason) {
466
+ return this.client.request('POST', `/admin/loyalty/users/${userId}/adjust`, { body: { points, reason } });
467
+ }
468
+ async getPublicTiers() {
469
+ const res = await this.client.request('GET', '/loyalty/tiers');
470
+ return res.tiers;
471
+ }
472
+ async stats() {
473
+ const res = await this.client.request('GET', '/admin/loyalty/stats');
474
+ return res.stats;
475
+ }
476
+ async getUserLoyalty(userId) {
477
+ const res = await this.client.request('GET', `/users/${userId}/loyalty`);
478
+ return res.loyalty;
479
+ }
480
+ }
481
+ exports.AdminLoyaltyApi = AdminLoyaltyApi;
482
+ class AdminAnalyticsApi {
483
+ client;
484
+ constructor(client) {
485
+ this.client = client;
486
+ }
487
+ async overview() {
488
+ return this.client.request('GET', '/admin/overview');
489
+ }
490
+ async requestLog(options) {
491
+ const query = {};
492
+ if (options?.limit)
493
+ query.limit = String(options.limit);
494
+ if (options?.offset)
495
+ query.offset = String(options.offset);
496
+ return this.client.request('GET', '/admin/request-log', { query });
497
+ }
498
+ /** Challenge analytics (pass/fail rates, volumes) with optional ISO 8601 date range. */
499
+ async challenges(options) {
500
+ return this.client.request('GET', '/analytics/challenges', { query: { from: options?.from, to: options?.to } });
501
+ }
502
+ /** Revenue analytics with optional ISO 8601 date range. */
503
+ async revenue(options) {
504
+ return this.client.request('GET', '/analytics/revenue', { query: { from: options?.from, to: options?.to } });
505
+ }
506
+ /** User cohort analytics with optional ISO 8601 date range. */
507
+ async users(options) {
508
+ return this.client.request('GET', '/analytics/users', { query: { from: options?.from, to: options?.to } });
509
+ }
510
+ /** Anonymized cross-tenant benchmarks for comparison. */
511
+ async benchmarks() {
512
+ return this.client.request('GET', '/analytics/benchmarks');
513
+ }
514
+ /** Daily engagement metrics with optional YYYY-MM-DD date range. */
515
+ async engagement(options) {
516
+ return this.client.request('GET', '/admin/analytics/engagement', { query: { from: options?.from, to: options?.to } });
517
+ }
518
+ /** Purchase-to-funded funnel metrics with optional YYYY-MM-DD date range. */
519
+ async funnel(options) {
520
+ return this.client.request('GET', '/admin/analytics/funnel', { query: { from: options?.from, to: options?.to } });
521
+ }
522
+ /** Reward grant/consumption analytics. */
523
+ async rewards() {
524
+ return this.client.request('GET', '/admin/analytics/rewards');
525
+ }
526
+ /** Admin leaderboard view (anonymized user IDs; requires Growth+ tier). */
527
+ async leaderboard(period, limit) {
528
+ const query = {};
529
+ if (period)
530
+ query.period = period;
531
+ if (limit)
532
+ query.limit = String(limit);
533
+ return this.client.request('GET', '/admin/leaderboard', { query });
534
+ }
535
+ }
536
+ exports.AdminAnalyticsApi = AdminAnalyticsApi;
537
+ /**
538
+ * Achievement management (admin).
539
+ */
540
+ class AdminAchievementsApi {
541
+ client;
542
+ constructor(client) {
543
+ this.client = client;
544
+ }
545
+ async list() {
546
+ const res = await this.client.request('GET', '/admin/achievements');
547
+ return res.achievements;
548
+ }
549
+ async create(data) {
550
+ const res = await this.client.request('POST', '/admin/achievements', { body: data });
551
+ return res.achievement;
552
+ }
553
+ async update(id, data) {
554
+ const res = await this.client.request('PUT', `/admin/achievements/${id}`, { body: data });
555
+ return res.achievement;
556
+ }
557
+ async delete(id) {
558
+ return this.client.request('DELETE', `/admin/achievements/${id}`);
559
+ }
560
+ async forUser(userId) {
561
+ return this.client.request('GET', `/admin/users/${userId}/achievements`);
562
+ }
563
+ async grant(userId, achievementId) {
564
+ const res = await this.client.request('POST', `/admin/users/${userId}/achievements`, { body: { achievementId } });
565
+ return res.userAchievement;
566
+ }
567
+ async bulkGrant(data) {
568
+ return this.client.request('POST', '/admin/achievements/bulk-grant', { body: data });
569
+ }
570
+ async gdprExport(userId) {
571
+ return this.client.request('GET', `/admin/users/${userId}/gdpr-export`);
572
+ }
573
+ async gdprErase(userId, confirmUserId) {
574
+ return this.client.request('POST', `/admin/users/${userId}/gdpr-erase`, { body: { confirmUserId } });
575
+ }
576
+ }
577
+ exports.AdminAchievementsApi = AdminAchievementsApi;
578
+ /**
579
+ * Notification channel/preferences management (admin).
580
+ */
581
+ class AdminNotificationsApi {
582
+ client;
583
+ constructor(client) {
584
+ this.client = client;
585
+ }
586
+ async getPreferences() {
587
+ const res = await this.client.request('GET', '/admin/notification-preferences');
588
+ return res.preferences;
589
+ }
590
+ async setPreferences(prefs) {
591
+ const res = await this.client.request('PUT', '/admin/notification-preferences', { body: prefs });
592
+ return res.preferences;
593
+ }
594
+ }
595
+ exports.AdminNotificationsApi = AdminNotificationsApi;
596
+ class AdminRewardsApi {
597
+ client;
598
+ constructor(client) {
599
+ this.client = client;
600
+ }
601
+ /**
602
+ * List a user's pending (unconsumed, unexpired) rewards.
603
+ * The endpoint is scoped to one user; there is no across-users variant.
604
+ */
605
+ async list(userId) {
606
+ return this.client.request('GET', '/admin/rewards', { query: { userId } });
607
+ }
608
+ /**
609
+ * Get a user's reward grant history. userId is required by the endpoint;
610
+ * limit is optional.
611
+ */
612
+ async history(userId, options) {
613
+ const query = { userId };
614
+ if (options?.limit)
615
+ query.limit = String(options.limit);
616
+ return this.client.request('GET', '/admin/rewards/history', { query });
617
+ }
618
+ /** Manually grant a reward to a user. */
619
+ async grant(data) {
620
+ return this.client.request('POST', '/admin/rewards/grant', { body: data });
621
+ }
622
+ /** Bulk grant a reward to multiple users. */
623
+ async bulkGrant(data) {
624
+ return this.client.request('POST', '/admin/rewards/bulk-grant', { body: data });
625
+ }
626
+ /** Delete (revoke) a pending reward. */
627
+ async delete(id) {
628
+ return this.client.request('DELETE', `/admin/rewards/${id}`);
629
+ }
630
+ }
631
+ exports.AdminRewardsApi = AdminRewardsApi;
632
+ class AdminRewardRulesApi {
633
+ client;
634
+ constructor(client) {
635
+ this.client = client;
636
+ }
637
+ /** List all reward rule definitions. */
638
+ async list() {
639
+ const res = await this.client.request('GET', '/admin/reward-rules');
640
+ return res.rules;
641
+ }
642
+ /** Create a new reward rule. */
643
+ async create(data) {
644
+ const res = await this.client.request('POST', '/admin/reward-rules', { body: data });
645
+ return res.rule;
646
+ }
647
+ /** Update an existing reward rule. */
648
+ async update(id, data) {
649
+ const res = await this.client.request('PUT', `/admin/reward-rules/${id}`, { body: data });
650
+ return res.rule;
651
+ }
652
+ /** Delete a reward rule. */
653
+ async delete(id) {
654
+ return this.client.request('DELETE', `/admin/reward-rules/${id}`);
655
+ }
656
+ }
657
+ exports.AdminRewardRulesApi = AdminRewardRulesApi;
658
+ class AdminSelfExclusionApi {
659
+ client;
660
+ constructor(client) {
661
+ this.client = client;
662
+ }
663
+ /** List all currently excluded users. */
664
+ async list() {
665
+ return this.client.request('GET', '/admin/self-exclusion');
666
+ }
667
+ /** Get exclusion status for a specific user. Returns 404 if not excluded. */
668
+ async get(userId) {
669
+ return this.client.request('GET', `/admin/self-exclusion/${userId}`);
670
+ }
671
+ /** Exclude a user from purchasing challenges. Upsert: re-excluding updates the record. */
672
+ async exclude(data) {
673
+ return this.client.request('POST', '/admin/self-exclusion', { body: data });
674
+ }
675
+ /** Lift (remove) self-exclusion for a user. */
676
+ async lift(userId) {
677
+ return this.client.request('DELETE', `/admin/self-exclusion/${userId}`);
678
+ }
679
+ }
680
+ exports.AdminSelfExclusionApi = AdminSelfExclusionApi;
681
+ class AdminAdaptersApi {
682
+ client;
683
+ constructor(client) {
684
+ this.client = client;
685
+ }
686
+ /** List all adapter field mappings. */
687
+ async list() {
688
+ const res = await this.client.request('GET', '/admin/adapters');
689
+ return res.adapters;
690
+ }
691
+ /** Create a new adapter mapping. */
692
+ async create(data) {
693
+ const res = await this.client.request('POST', '/admin/adapters', { body: data });
694
+ return res.adapter;
695
+ }
696
+ /** Update an adapter mapping. */
697
+ async update(id, data) {
698
+ const res = await this.client.request('PUT', `/admin/adapters/${id}`, { body: data });
699
+ return res.adapter;
700
+ }
701
+ /** Delete an adapter mapping. */
702
+ async delete(id) {
703
+ return this.client.request('DELETE', `/admin/adapters/${id}`);
704
+ }
705
+ }
706
+ exports.AdminAdaptersApi = AdminAdaptersApi;
707
+ class AdminReconciliationApi {
708
+ client;
709
+ constructor(client) {
710
+ this.client = client;
711
+ }
712
+ /**
713
+ * List reconciliation flags requiring manual review.
714
+ *
715
+ * @param status - Optional filter: 'open' or 'resolved'
716
+ */
717
+ async flags(status) {
718
+ const query = {};
719
+ if (status)
720
+ query.status = status;
721
+ return this.client.request('GET', '/admin/reconciliation/flags', { query });
722
+ }
723
+ }
724
+ exports.AdminReconciliationApi = AdminReconciliationApi;
725
+ /**
726
+ * Per-user admin operations: lookup, funded account revocation.
727
+ */
728
+ class AdminUsersApi {
729
+ client;
730
+ constructor(client) {
731
+ this.client = client;
732
+ }
733
+ /**
734
+ * Full user lookup: all challenges, funded accounts, the 100 most recent
735
+ * bet events, achievements, and pending/applied rewards.
736
+ */
737
+ async get(userId) {
738
+ return this.client.request('GET', `/admin/users/${userId}`);
739
+ }
740
+ /**
741
+ * Manually revoke the active funded account for a user.
742
+ *
743
+ * Use before GDPR erasure or when a funded account must be closed for any
744
+ * reason. Emits `funded_account.revoked`.
745
+ *
746
+ * @param userId - Sportsbook user identifier
747
+ * @param reason - Revocation reason (default: 'manual_admin_revoke')
748
+ * @throws {FastApiError} 404 if the user has no active funded account
749
+ */
750
+ async revokeFunded(userId, reason) {
751
+ return this.client.request('POST', `/admin/users/${userId}/revoke-funded`, { body: reason ? { reason } : {} });
752
+ }
753
+ }
754
+ exports.AdminUsersApi = AdminUsersApi;
755
+ /**
756
+ * Operator notification channels (Slack / Teams / Discord / custom webhooks).
757
+ */
758
+ class AdminNotificationChannelsApi {
759
+ client;
760
+ constructor(client) {
761
+ this.client = client;
762
+ }
763
+ async list() {
764
+ return this.client.request('GET', '/admin/notification-channels');
765
+ }
766
+ /**
767
+ * Create a channel. `eventTypes` empty/omitted means all events;
768
+ * `minPriority` is one of low, normal, high, critical.
769
+ */
770
+ async create(data) {
771
+ return this.client.request('POST', '/admin/notification-channels', { body: data });
772
+ }
773
+ async update(id, data) {
774
+ return this.client.request('PUT', `/admin/notification-channels/${id}`, { body: data });
775
+ }
776
+ async delete(id) {
777
+ return this.client.request('DELETE', `/admin/notification-channels/${id}`);
778
+ }
779
+ /** Send a test notification to the channel. */
780
+ async test(id) {
781
+ return this.client.request('POST', `/admin/notification-channels/${id}/test`);
782
+ }
783
+ }
784
+ exports.AdminNotificationChannelsApi = AdminNotificationChannelsApi;
785
+ /**
786
+ * Challenge templates: curated ruleset + tier bundles you can clone into
787
+ * your tenant.
788
+ */
789
+ class AdminTemplatesApi {
790
+ client;
791
+ constructor(client) {
792
+ this.client = client;
793
+ }
794
+ async list() {
795
+ return this.client.request('GET', '/admin/templates');
796
+ }
797
+ async get(id) {
798
+ return this.client.request('GET', `/admin/templates/${id}`);
799
+ }
800
+ /**
801
+ * Clone a template into your tenant. Creates a new ruleset and challenge
802
+ * tier; you can override the tier name, own stake, and duration.
803
+ */
804
+ async clone(id, overrides) {
805
+ return this.client.request('POST', `/admin/templates/${id}/clone`, { body: overrides ?? {} });
806
+ }
807
+ }
808
+ exports.AdminTemplatesApi = AdminTemplatesApi;
809
+ /**
810
+ * Support requests to the FAST team.
811
+ */
812
+ class AdminSupportApi {
813
+ client;
814
+ constructor(client) {
815
+ this.client = client;
816
+ }
817
+ async list(options) {
818
+ const query = {};
819
+ if (options?.status)
820
+ query.status = options.status;
821
+ if (options?.limit)
822
+ query.limit = String(options.limit);
823
+ return this.client.request('GET', '/admin/support/requests', { query });
824
+ }
825
+ async get(id) {
826
+ return this.client.request('GET', `/admin/support/requests/${id}`);
827
+ }
828
+ /** Open a new support request. Category defaults to 'other'. */
829
+ async create(data) {
830
+ return this.client.request('POST', '/admin/support/requests', { body: data });
831
+ }
832
+ /** Add a message to an existing support request. */
833
+ async addMessage(id, body) {
834
+ return this.client.request('POST', `/admin/support/requests/${id}/messages`, { body: { body } });
835
+ }
836
+ /** Close a support request. */
837
+ async close(id) {
838
+ return this.client.request('POST', `/admin/support/requests/${id}/close`);
839
+ }
840
+ }
841
+ exports.AdminSupportApi = AdminSupportApi;
842
+ //# sourceMappingURL=admin.js.map