diff --git a/CHANGELOG.md b/CHANGELOG.md index 867c160..e906c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.5.0 + +- `client.auth.loginWithCustom({ customData, region?, language?, nickname? })` + — custom webhook auth, same token + runtime start as `loginWithDevice`. +- `QuestMetrics.purchaseOffer` / `purchaseItem` helpers for the shop purchase + metric format. +- Typecheck against regenerated models: `listQuests` no longer takes a body, + battle-pass `track` is `'free' | 'premium'`, scenario run status has no + `unknown_run`. + ## 0.4.0 - Fixed `BattlePassLevelSession.level` reading node data key `level` — the diff --git a/README.md b/README.md index e379aaf..4c52a03 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ client.dispose(); | Area | Access | |---|---| -| Auth | `client.auth.loginWithDevice()`, `client.auth.logout()`, `client.auth.isAuthenticated`, `client.auth.onAuthStateChange(cb)` | +| Auth | `client.auth.loginWithDevice()`, `client.auth.loginWithCustom({ customData })`, `client.auth.logout()`, `client.auth.isAuthenticated`, `client.auth.onAuthStateChange(cb)` | | Player / wallets | `client.player` (observable) | | Inventory | `client.inventory` (observable, catalog-merged) | | Catalog | `client.catalog` (observable) | diff --git a/package-lock.json b/package-lock.json index ee48b4f..be2ea7c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rudder/js-sdk", - "version": "0.1.0", + "version": "0.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rudder/js-sdk", - "version": "0.1.0", + "version": "0.5.0", "devDependencies": { "@types/node": "^26.1.1", "jsdom": "^29.1.1", diff --git a/package.json b/package.json index 7a39b03..2160274 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rudder/js-sdk", - "version": "0.4.0", + "version": "0.5.0", "publishConfig": { "registry": "https://hub.rudder.build/api/packages/rudder/npm/" }, diff --git a/src/effects/EffectsCenter.ts b/src/effects/EffectsCenter.ts index 4c7b466..1e45eba 100644 --- a/src/effects/EffectsCenter.ts +++ b/src/effects/EffectsCenter.ts @@ -79,7 +79,7 @@ export interface QuestEffect { export interface BattlePassEffect { getProgress(): Promise; addXp(source: string, amount: number): Promise; - claimReward(level: number, track?: string): Promise; + claimReward(level: number, track?: 'free' | 'premium'): Promise; purchasePremium(): Promise; levelUp(): Promise; end(): Promise; diff --git a/src/quests/QuestMetrics.ts b/src/quests/QuestMetrics.ts index 7c1d5db..2828568 100644 --- a/src/quests/QuestMetrics.ts +++ b/src/quests/QuestMetrics.ts @@ -1,9 +1,9 @@ /** * 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 + * Purchase metrics are reported automatically server-side 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}. */ diff --git a/src/quests/QuestsService.ts b/src/quests/QuestsService.ts index 159fd84..73a7ce7 100644 --- a/src/quests/QuestsService.ts +++ b/src/quests/QuestsService.ts @@ -15,7 +15,7 @@ export class QuestsService { /** Lists the player's quests with per-objective progress and rewards. */ async list(): Promise { - const response = await api.listQuests(this.ctx, {}); + const response = await api.listQuests(this.ctx); return response.quests ?? []; } diff --git a/src/scenario/ScenarioService.ts b/src/scenario/ScenarioService.ts index 06d79ad..855e615 100644 --- a/src/scenario/ScenarioService.ts +++ b/src/scenario/ScenarioService.ts @@ -136,8 +136,9 @@ export class ScenarioService { + claimReward(level: number, track?: 'free' | 'premium'): Promise { const { scenarioId, nodeId, runId } = this.ids(); return this.battlePass.claimReward({ scenarioId, nodeId, level, track, runId }); } diff --git a/test/e2e/remoteConfig.e2e.test.ts b/test/e2e/remoteConfig.e2e.test.ts index e616f58..f664845 100644 --- a/test/e2e/remoteConfig.e2e.test.ts +++ b/test/e2e/remoteConfig.e2e.test.ts @@ -16,7 +16,7 @@ interface GameRemoteConfig extends Record { missing_declared: string; } -function cfg(key: string, value: string, valueType: string, active = true): RemoteConfig { +function cfg(key: string, value: string, valueType: NonNullable, active = true): RemoteConfig { return { key, value, valueType, active }; }