@playbasis-ai/qwikcard-sdk 2.3.6 → 2.3.7
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/SDK_HANDOVER_GUIDE.md +3 -3
- package/dist/QwikCardApp.js +2 -2
- package/package.json +1 -1
- package/src/QwikCardApp.tsx +15 -15
package/SDK_HANDOVER_GUIDE.md
CHANGED
|
@@ -51,7 +51,7 @@ For the most professional "NPM experience" without public exposure, use **GitHub
|
|
|
51
51
|
1. **Publish to GitHub**: Configure your `package.json` to point to the `@rzforemost` scope on GitHub.
|
|
52
52
|
2. **Install via NPM**:
|
|
53
53
|
```bash
|
|
54
|
-
npm install @
|
|
54
|
+
npm install @playbasis-ai/qwikcard-sdk
|
|
55
55
|
```
|
|
56
56
|
_(Note: Requires a `.npmrc` file with a GitHub Personal Access Token)._
|
|
57
57
|
|
|
@@ -60,14 +60,14 @@ For the most professional "NPM experience" without public exposure, use **GitHub
|
|
|
60
60
|
If your team prefers an "invocation" style, simply wrap the `QwikCardApp` in a single screen or a conditional overlay. This effectively "invokes" the entire template library in one line:
|
|
61
61
|
|
|
62
62
|
```tsx
|
|
63
|
-
import { QwikCardApp } from '@
|
|
63
|
+
import { QwikCardApp } from '@playbasis-ai/qwikcard-sdk';
|
|
64
64
|
|
|
65
65
|
const MyScreen = () => (
|
|
66
66
|
<QwikCardApp
|
|
67
67
|
apiKey="YOUR_API_KEY"
|
|
68
68
|
tenantId="YOUR_TENANT_ID"
|
|
69
69
|
playerId="USER_123"
|
|
70
|
-
baseUrl="https://api.playbasis
|
|
70
|
+
baseUrl="https://apim-pb-staging.azure-api.net/playbasis/v1" // optional
|
|
71
71
|
leaderboardId="YOUR_LEADERBOARD_ID" // optional
|
|
72
72
|
/>
|
|
73
73
|
);
|
package/dist/QwikCardApp.js
CHANGED
|
@@ -33,8 +33,8 @@ function AppContent({ leaderboardId }) {
|
|
|
33
33
|
const [player, balances, quests, allBadges, playerBadges, rewards] = await Promise.all([
|
|
34
34
|
client.getPlayer(playerId),
|
|
35
35
|
client.getBalances(playerId),
|
|
36
|
-
client.getPlayerQuests(playerId),
|
|
37
|
-
client.getBadges(),
|
|
36
|
+
client.getPlayerQuests(playerId).catch(() => []), // Gracefully handle if endpoint missing
|
|
37
|
+
client.getBadges().catch(() => []), // Gracefully handle if endpoint missing
|
|
38
38
|
client.getPlayerBadges(playerId),
|
|
39
39
|
client.getRewards().catch(() => []), // Gracefully handle if rewards endpoint doesn't exist
|
|
40
40
|
]);
|
package/package.json
CHANGED
package/src/QwikCardApp.tsx
CHANGED
|
@@ -49,8 +49,8 @@ function AppContent({ leaderboardId }: { leaderboardId?: string }) {
|
|
|
49
49
|
const [player, balances, quests, allBadges, playerBadges, rewards] = await Promise.all([
|
|
50
50
|
client.getPlayer(playerId),
|
|
51
51
|
client.getBalances(playerId),
|
|
52
|
-
client.getPlayerQuests(playerId),
|
|
53
|
-
client.getBadges(),
|
|
52
|
+
client.getPlayerQuests(playerId).catch(() => []), // Gracefully handle if endpoint missing
|
|
53
|
+
client.getBadges().catch(() => []), // Gracefully handle if endpoint missing
|
|
54
54
|
client.getPlayerBadges(playerId),
|
|
55
55
|
client.getRewards().catch(() => []), // Gracefully handle if rewards endpoint doesn't exist
|
|
56
56
|
]);
|
|
@@ -60,19 +60,19 @@ function AppContent({ leaderboardId }: { leaderboardId?: string }) {
|
|
|
60
60
|
|
|
61
61
|
const leaderboardEntries = leaderboardId
|
|
62
62
|
? await (async () => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
try {
|
|
64
|
+
const res = await client.getLeaderboard(leaderboardId, { limit: 50 });
|
|
65
|
+
return res.entries.map((e) => ({
|
|
66
|
+
userId: e.playerId,
|
|
67
|
+
rank: e.rank,
|
|
68
|
+
displayName: e.displayName,
|
|
69
|
+
score: e.score,
|
|
70
|
+
isCurrentUser: e.playerId === player.id,
|
|
71
|
+
}));
|
|
72
|
+
} catch {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
})()
|
|
76
76
|
: [];
|
|
77
77
|
|
|
78
78
|
return {
|