@playbasis-ai/qwikcard-sdk 2.3.23 → 2.3.24

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.
package/CHANGELOG.md CHANGED
@@ -119,6 +119,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
119
119
 
120
120
  - Always render leaderboard entries with a fallback “not ranked yet” banner for zero‑XP players.
121
121
 
122
+ ## [2.3.24] - 2026-01-31
123
+
124
+ ### Fixed
125
+
126
+ - Always include a current-user placeholder in leaderboard bootstrap data so the UI never renders empty.
127
+
122
128
  ## [2.3.11] - 2026-01-29
123
129
 
124
130
  ### Changed
@@ -1 +1 @@
1
- {"version":3,"file":"QwikCardApp.d.ts","sourceRoot":"","sources":["../src/QwikCardApp.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAmSD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAMlD"}
1
+ {"version":3,"file":"QwikCardApp.d.ts","sourceRoot":"","sources":["../src/QwikCardApp.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAmUD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAMlD"}
@@ -46,19 +46,49 @@ function AppContent({ leaderboardId }) {
46
46
  ? await (async () => {
47
47
  try {
48
48
  const res = await client.getLeaderboard(leaderboardId, { limit: 50 });
49
- return res.entries.map((e) => ({
50
- userId: e.playerId,
51
- rank: e.rank,
52
- displayName: e.displayName,
53
- score: e.score,
54
- isCurrentUser: e.playerId === player.id,
49
+ const normalized = res.entries.map((entry) => ({
50
+ userId: entry.playerId,
51
+ rank: entry.rank,
52
+ displayName: entry.displayName || 'Player',
53
+ score: entry.score,
54
+ isCurrentUser: entry.playerId === player.id,
55
55
  }));
56
+ const hasCurrentUser = normalized.some((entry) => entry.isCurrentUser);
57
+ if (!hasCurrentUser) {
58
+ return [
59
+ {
60
+ userId: player.id,
61
+ rank: 0,
62
+ displayName: player.displayName || 'You',
63
+ score: xp,
64
+ isCurrentUser: true,
65
+ },
66
+ ...normalized,
67
+ ];
68
+ }
69
+ return normalized;
56
70
  }
57
71
  catch {
58
- return [];
72
+ return [
73
+ {
74
+ userId: player.id,
75
+ rank: 0,
76
+ displayName: player.displayName || 'You',
77
+ score: xp,
78
+ isCurrentUser: true,
79
+ },
80
+ ];
59
81
  }
60
82
  })()
61
- : [];
83
+ : [
84
+ {
85
+ userId: player.id,
86
+ rank: 0,
87
+ displayName: player.displayName || 'You',
88
+ score: xp,
89
+ isCurrentUser: true,
90
+ },
91
+ ];
62
92
  return {
63
93
  user: {
64
94
  userId: player.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playbasis-ai/qwikcard-sdk",
3
- "version": "2.3.23",
3
+ "version": "2.3.24",
4
4
  "description": "Playbasis SDK for QwikCard College Rewards - React Native gamification integration",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -67,18 +67,50 @@ function AppContent({ leaderboardId }: { leaderboardId?: string }) {
67
67
  ? await (async () => {
68
68
  try {
69
69
  const res = await client.getLeaderboard(leaderboardId, { limit: 50 });
70
- return res.entries.map((e) => ({
71
- userId: e.playerId,
72
- rank: e.rank,
73
- displayName: e.displayName,
74
- score: e.score,
75
- isCurrentUser: e.playerId === player.id,
70
+ const normalized = res.entries.map((entry) => ({
71
+ userId: entry.playerId,
72
+ rank: entry.rank,
73
+ displayName: entry.displayName || 'Player',
74
+ score: entry.score,
75
+ isCurrentUser: entry.playerId === player.id,
76
76
  }));
77
+ const hasCurrentUser = normalized.some((entry) => entry.isCurrentUser);
78
+
79
+ if (!hasCurrentUser) {
80
+ return [
81
+ {
82
+ userId: player.id,
83
+ rank: 0,
84
+ displayName: player.displayName || 'You',
85
+ score: xp,
86
+ isCurrentUser: true,
87
+ },
88
+ ...normalized,
89
+ ];
90
+ }
91
+
92
+ return normalized;
77
93
  } catch {
78
- return [];
94
+ return [
95
+ {
96
+ userId: player.id,
97
+ rank: 0,
98
+ displayName: player.displayName || 'You',
99
+ score: xp,
100
+ isCurrentUser: true,
101
+ },
102
+ ];
79
103
  }
80
104
  })()
81
- : [];
105
+ : [
106
+ {
107
+ userId: player.id,
108
+ rank: 0,
109
+ displayName: player.displayName || 'You',
110
+ score: xp,
111
+ isCurrentUser: true,
112
+ },
113
+ ];
82
114
 
83
115
  return {
84
116
  user: {