quests: QuestMetrics helpers (purchaseOffer/purchaseItem), README quests section
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user