@usions/sdk 2.32.0 → 2.34.0

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/README.md CHANGED
@@ -6,6 +6,7 @@ Provides access to user info, storage, wallet, chat, sessions, and real-time mul
6
6
 
7
7
  ## Documentation
8
8
 
9
+ - [Shared player connections](../../docs/sdk-connect-players.md) — development API for P2P with relay fallback; [minimal game example](examples/players.html)
9
10
  - [Guides](../../docs/sdk-guides/README.md) — first game in 30 min, the reliability contract, netcode, money, cloud saves
10
11
  - [API reference](../../docs/sdk-api/README.md) (generated from the type declarations)
11
12
  - [Platform behavior spec](../../docs/sdk-guides/06-platform-spec.md) — delivery guarantees, quotas, security model
@@ -317,3 +318,54 @@ import type { UsionConfig, GameModule, PlayerJoinedData } from '@usions/sdk';
317
318
  ## License
318
319
 
319
320
  MIT
321
+
322
+ ## Profile content (SDK 2.30+)
323
+
324
+ Profile starts with **Record** (selected by default), then **Right now**, then
325
+ one category per app with content and an explicit `profile_content` grant.
326
+ The app category uses its registered name. Signed-in profile visitors can see
327
+ its cards, subject to blocking; Right now retains its existing audience rules.
328
+
329
+ Ask after a user taps a clearly labeled action such as “Show on my profile”:
330
+
331
+ ```js
332
+ const consent = await Usion.permissions.request(['profile_content'], {
333
+ reason: 'Show your artwork in this app’s category on your profile.',
334
+ });
335
+ if (consent.permissions.profile_content) {
336
+ await Usion.profile.setContent({
337
+ items: [{
338
+ id: 'artwork-1',
339
+ title: 'My latest artwork',
340
+ description: 'Made with Drawing Studio',
341
+ imageUrl: 'https://your-cdn.example/artwork-1.png',
342
+ }],
343
+ });
344
+ }
345
+ ```
346
+
347
+ - `Usion.profile.getContent()` returns `{ items }` for this app and the current
348
+ user only. Requires the grant.
349
+ - `Usion.profile.setContent({ items })` replaces this app’s complete list and
350
+ returns the saved `{ items }`. It never requests permission automatically.
351
+ - `Usion.profile.clearContent()` removes the app’s content and resolves void.
352
+ Cleanup is allowed after revocation too. Publishing `items: []` also hides
353
+ the category but retains permission.
354
+ - Up to 50 cards: unique `id` (1–80 letters/digits/underscores/hyphens), `title`
355
+ (1–120 characters), optional plain-text `description` (≤2,000), optional
356
+ HTTPS `imageUrl` (≤2,048, no credentials). Upload images first. HTML,
357
+ scripts, embedded frames, custom links and arbitrary extra fields are rejected.
358
+ Card taps open the originating app in Usion.
359
+ - `PERMISSION_DENIED` means consent is missing or revoked. Check
360
+ `Usion.permissions.has('profile_content')` without prompting, and handle
361
+ denial gracefully. Cancellation never publishes content.
362
+ - Only a published app with a live grant and nonempty content appears on the
363
+ profile. Revocation in Settings or “Remove from profile” hides it and prevents
364
+ further publishing. Existing stored content can reappear if access is granted
365
+ again; use `clearContent()` to delete it.
366
+ - This is the stable **v2** SDK API. It requires updated web/mobile hosts and
367
+ backend. Older hosts reject after the 30-second request timeout; standalone
368
+ pages reject with `UNSUPPORTED`. Never fall back to silently publishing.
369
+ - The host binds the signed-in user and current service. Mini-apps cannot select
370
+ another owner or service, grant themselves access, or read Record/Right now
371
+ data through this API. Existing leaderboard APIs continue to supply Record.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usions/sdk",
3
- "version": "2.32.0",
3
+ "version": "2.34.0",
4
4
  "description": "Usion Mini App SDK for iframe games and services",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -36,15 +36,18 @@
36
36
  "check:size": "node scripts/check-size.mjs",
37
37
  "check:version": "node scripts/sync-version.mjs --check",
38
38
  "docs:api": "typedoc --plugin typedoc-plugin-markdown --entryPoints types/index.d.ts --out ../../docs/sdk-api --readme none --tsconfig test/tsconfig.json",
39
- "check:src": "tsc -p tsconfig.src.json"
39
+ "check:src": "tsc -p tsconfig.src.json",
40
+ "test:players:browser": "npm run build && node test/players-browser.mjs"
40
41
  },
41
42
  "devDependencies": {
42
43
  "@rollup/plugin-terser": "^1.0.0",
44
+ "playwright": "^1.63.0",
43
45
  "rollup": "^4.0.0",
44
46
  "typedoc": "^0.28.19",
45
47
  "typedoc-plugin-markdown": "^4.12.0",
46
48
  "typescript": "^5.9.3",
47
- "vitest": "^2.1.9"
49
+ "vitest": "^2.1.9",
50
+ "ws": "^8.21.3"
48
51
  },
49
52
  "keywords": [
50
53
  "usion",