Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04e3565412 | |||
| 19a296ab9a | |||
| a72989402e | |||
| 3556c0b035 |
@@ -35,6 +35,9 @@ jobs:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: check
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -55,4 +58,4 @@ jobs:
|
||||
- name: Publish
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## 0.6.0
|
||||
|
||||
- `LeaderboardSession.claim()` / effect `claim()` completes the leaderboard
|
||||
node with handle `onClaim`. The server matches live rank to an authored
|
||||
place and continues from that place (Grant Reward and/or In-App Message).
|
||||
- `rewardClaimed()` is a deprecated alias for `claim()` and will be removed
|
||||
in the next SDK version.
|
||||
- `rank_not_eligible` on Claim leaves the session open (retry Claim or End);
|
||||
it no longer fails the run.
|
||||
|
||||
## 0.5.1
|
||||
|
||||
- `QuestMetrics` / `reportProgress`: custom free-text metrics no longer
|
||||
progress quests. Report a released catalog counter slug instead.
|
||||
`purchaseOffer` / `purchaseItem` helpers are unchanged (server-side shop
|
||||
fan-out).
|
||||
|
||||
## 0.5.0
|
||||
|
||||
- `client.auth.loginWithCustom({ customData, region?, language?, nickname? })`
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rudder/js-sdk",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"publishConfig": {
|
||||
"registry": "https://hub.rudder.build/api/packages/rudder/npm/"
|
||||
},
|
||||
|
||||
@@ -35,6 +35,8 @@ export interface StoreOfferEffect {
|
||||
|
||||
export interface LeaderboardEffect {
|
||||
end(): Promise<void>;
|
||||
claim(): Promise<void>;
|
||||
/** @deprecated Use {@link LeaderboardEffect.claim}. Removed in the next SDK version. */
|
||||
rewardClaimed(): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -191,7 +193,8 @@ export class EffectsCenter implements Effects {
|
||||
emitLeaderboard(session: LeaderboardSession): void {
|
||||
this.emit(this.leaderboardHandlers, {
|
||||
end: () => session.end(),
|
||||
rewardClaimed: () => session.rewardClaimed(),
|
||||
claim: () => session.claim(),
|
||||
rewardClaimed: () => session.claim(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
*
|
||||
* 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}.
|
||||
* instead of hardcoding it. Catalog counter slugs are reported via
|
||||
* {@link QuestsService.reportProgress}. Custom free-text metrics no longer
|
||||
* progress quests — they no-op at runtime.
|
||||
*/
|
||||
|
||||
/** Metric for purchasing a store offer; auto-reported on purchase. */
|
||||
|
||||
@@ -61,6 +61,10 @@ function isTransientHttpError(err: unknown): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isRankNotEligible(err: unknown): boolean {
|
||||
return err instanceof RudderHttpError && err.code === 'rank_not_eligible';
|
||||
}
|
||||
|
||||
|
||||
export class ScenarioService<TConfig extends RemoteConfigShape = RemoteConfigShape> {
|
||||
private readonly runs = new Map<string, RuntimeRun>();
|
||||
@@ -434,6 +438,10 @@ export class ScenarioService<TConfig extends RemoteConfigShape = RemoteConfigSha
|
||||
await this.persist();
|
||||
} catch (err) {
|
||||
run.pendingTransitions--;
|
||||
if (isRankNotEligible(err)) {
|
||||
await this.persist();
|
||||
throw err;
|
||||
}
|
||||
this.failRun(
|
||||
run,
|
||||
nodeId,
|
||||
|
||||
@@ -180,14 +180,19 @@ export class LeaderboardSession {
|
||||
|
||||
async end(): Promise<void> {
|
||||
if (this.resolved) return;
|
||||
this.resolved = true;
|
||||
await this.context.complete('onEnd');
|
||||
this.resolved = true;
|
||||
}
|
||||
|
||||
async rewardClaimed(): Promise<void> {
|
||||
async claim(): Promise<void> {
|
||||
if (this.resolved) return;
|
||||
await this.context.complete('onClaim');
|
||||
this.resolved = true;
|
||||
await this.context.complete('onRewardClaimed');
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link LeaderboardSession.claim}. Removed in the next SDK version. */
|
||||
async rewardClaimed(): Promise<void> {
|
||||
return this.claim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user