quests: QuestMetrics helpers (purchaseOffer/purchaseItem), README quests section
CI / check (push) Successful in 59s
CI / publish (push) Has been skipped

This commit is contained in:
edmand46
2026-08-25 16:25:32 +03:00
parent 1013f2395f
commit 68287d212e
3 changed files with 51 additions and 1 deletions
+1
View File
@@ -27,6 +27,7 @@ export type {
export type { LeaderboardsService, LeaderboardHandle } from './leaderboards/LeaderboardsService.js';
export type { BattlePassService } from './battlepass/BattlePassService.js';
export type { QuestsService } from './quests/QuestsService.js';
export * as QuestMetrics from './quests/QuestMetrics.js';
// Observable state primitives
export { SyncedState } from './state/SyncedState.js';
+18
View File
@@ -0,0 +1,18 @@
/**
* QuestMetrics — builders for the quest metric strings known to the platform.
*
* Purchase metrics are reported automatically by the shop purchase fan-out,
* so these helpers exist mainly to name the format instead of hardcoding it.
* Any other metric is a custom string reported via
* {@link QuestsService.reportProgress}.
*/
/** Metric for purchasing a store offer; auto-reported on purchase. */
export function purchaseOffer(offerId: string): string {
return `purchase.offer:${offerId}`;
}
/** Metric for purchasing a catalog item; auto-reported on purchase. */
export function purchaseItem(itemId: string): string {
return `purchase.item:${itemId}`;
}