@proappstore/sdk 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/README.md +66 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @proappstore/sdk
2
+
3
+ Unified SDK for paid apps on **proappstore.online**. Includes everything from `@freeappstore/sdk` (auth, kv, counters, rooms, proxy) plus subscription management and license keys.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @proappstore/sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { initPro } from '@proappstore/sdk'
15
+
16
+ const app = initPro({ appId: 'my-app' })
17
+
18
+ // Auth (GitHub OAuth — same identity as FreeAppStore)
19
+ await app.auth.init()
20
+ app.auth.onChange((user) => console.log(user))
21
+ app.auth.signIn()
22
+
23
+ // Per-user KV storage
24
+ await app.kv.set('profile', { name: 'Alice' })
25
+ const keys = await app.kv.list({ prefix: 'note:' })
26
+
27
+ // Shared counters (cross-user)
28
+ await app.counters.increment('views')
29
+ const all = await app.counters.list()
30
+
31
+ // Real-time rooms
32
+ const room = app.rooms.join('lobby')
33
+ room.send({ text: 'hello' })
34
+ room.onMessage((msg) => console.log(msg))
35
+
36
+ // Subscriptions (Stripe-powered)
37
+ const sub = await app.subscription.status()
38
+ if (!sub || sub.status !== 'active') {
39
+ await app.subscription.openCheckout({
40
+ priceId: 'price_xxx',
41
+ successUrl: 'https://my-app.proappstore.online/success',
42
+ cancelUrl: 'https://my-app.proappstore.online/',
43
+ })
44
+ }
45
+ await app.subscription.openPortal('https://my-app.proappstore.online/')
46
+
47
+ // License keys
48
+ const license = await app.license.current()
49
+ const valid = await app.license.validate('KEY-123')
50
+ ```
51
+
52
+ ## Modules
53
+
54
+ | Module | Source | Description |
55
+ |--------|--------|-------------|
56
+ | `auth` | FAS | GitHub OAuth, SSO across all apps |
57
+ | `kv` | FAS | Per-user key-value store (list, get, set, delete, getMany) |
58
+ | `counters` | FAS | Shared atomic counters (votes, views, leaderboards) |
59
+ | `rooms` | FAS | Real-time WebSocket rooms (presence, chat, collab) |
60
+ | `proxy` | FAS | Secret-injecting API proxy for third-party services |
61
+ | `subscription` | Pro | Stripe checkout, portal, status |
62
+ | `license` | Pro | Per-app license key validation |
63
+
64
+ ## License
65
+
66
+ MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proappstore/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Browser SDK for paid apps on proappstore.online — subscriptions, license keys, premium modules.",
5
5
  "license": "MIT",
6
6
  "type": "module",