@proappstore/sdk 0.2.0 → 0.3.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 +66 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -4
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/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FreeAppStore } from '@freeappstore/sdk';
|
|
|
2
2
|
import { SubscriptionApi } from './subscription.js';
|
|
3
3
|
import { LicenseApi } from './license.js';
|
|
4
4
|
import type { ProInitOptions } from './types.js';
|
|
5
|
-
export type { User, Unsubscribe, FasInitOptions, ConnectionState, Room, RoomMessage, RoomPeer, } from '@freeappstore/sdk';
|
|
5
|
+
export type { AuthProvider, User, Unsubscribe, FasInitOptions, ConnectionState, Room, RoomMessage, RoomPeer, } from '@freeappstore/sdk';
|
|
6
6
|
export type { ProInitOptions, Subscription, SubscriptionStatus, CheckoutRequest, LicenseInfo, } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Pro SDK instance — includes everything from @freeappstore/sdk (auth, kv,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,YAAY,EACV,IAAI,EACJ,WAAW,EACX,cAAc,EACd,eAAe,EACf,IAAI,EACJ,WAAW,EACX,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;gBAEjB,IAAI,EAAE,cAAc;CAMjC;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,CAEzD"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,cAAc,EACd,eAAe,EACf,IAAI,EACJ,WAAW,EACX,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;gBAEjB,IAAI,EAAE,cAAc;CAMjC;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,WAAW,CAEzD"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAuB1C;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAClC,YAAY,CAAkB;IAC9B,OAAO,CAAa;IAE7B,YAAY,IAAoB;QAC9B,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,gCAAgC,CAAC;QACvE,IAAI,CAAC,YAAY,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3E,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAC,IAAoB;IAC1C,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proappstore/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Browser SDK for paid apps on proappstore.online — subscriptions, license keys, premium modules.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -12,14 +12,21 @@
|
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"repository": {
|
|
16
|
-
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/proappstore-online/platform.git",
|
|
18
|
+
"directory": "packages/sdk"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
17
24
|
"scripts": {
|
|
18
25
|
"build": "tsc",
|
|
19
26
|
"typecheck": "tsc --noEmit"
|
|
20
27
|
},
|
|
21
28
|
"dependencies": {
|
|
22
|
-
"@freeappstore/sdk": "^0.
|
|
29
|
+
"@freeappstore/sdk": "^0.6.0"
|
|
23
30
|
},
|
|
24
31
|
"devDependencies": {
|
|
25
32
|
"typescript": "^5.7.0"
|