@livx.cc/native-kit 0.16.0 → 0.16.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.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/package.json +23 -2
- package/src/modules/billing/types.ts +2 -2
- package/src/modules/billing/validators.ts +1 -1
- package/src/modules/push.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Elya Livshitz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @livx.cc/native-kit
|
|
2
|
+
|
|
3
|
+
Isomorphic native-capabilities kit for PWAs — the **same API in the browser and inside an [appwrap](https://github.com/Livshitz/appwrap) native shell**. Zero dependencies.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun add @livx.cc/native-kit # or: npm i @livx.cc/native-kit
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { kit } from '@livx.cc/native-kit';
|
|
11
|
+
|
|
12
|
+
await kit.haptics.impact('medium'); // native vibration in the shell, no-op/web-fallback in a browser
|
|
13
|
+
const photo = await kit.photos.pick(); // native picker on device, <input type=file> on web
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The kit detects whether it's running inside the appwrap shell and routes each call to the native bridge or a web fallback, so a single web build works everywhere. Capabilities advertise their real backing (`native` / `web` / `none`) so your UI can be honest about what's available.
|
|
17
|
+
|
|
18
|
+
Covers haptics, share, storage, notifications, OAuth, billing (IAP), health, geo, camera, photos, contacts, calendar, motion, reviews, and more.
|
|
19
|
+
|
|
20
|
+
**Full documentation, capability model, and the bridge protocol:** see the [appwrap README](https://github.com/Livshitz/appwrap#readme).
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
MIT © Elya Livshitz
|
package/package.json
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livx.cc/native-kit",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Isomorphic native-capabilities kit for PWAs — same API in browser and in an appwrap native shell. Zero dependencies.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Elya Livshitz",
|
|
7
|
+
"homepage": "https://github.com/Livshitz/appwrap#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Livshitz/appwrap.git",
|
|
11
|
+
"directory": "packages/native-kit"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Livshitz/appwrap/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"pwa",
|
|
18
|
+
"native",
|
|
19
|
+
"webview",
|
|
20
|
+
"nativescript",
|
|
21
|
+
"appwrap",
|
|
22
|
+
"isomorphic",
|
|
23
|
+
"ios",
|
|
24
|
+
"android"
|
|
25
|
+
],
|
|
5
26
|
"type": "module",
|
|
6
27
|
"main": "./src/index.ts",
|
|
7
28
|
"module": "./src/index.ts",
|
|
@@ -16,7 +37,7 @@
|
|
|
16
37
|
"src"
|
|
17
38
|
],
|
|
18
39
|
"scripts": {
|
|
19
|
-
"build": "bun build src/index.ts --outdir
|
|
40
|
+
"build": "bun build src/index.ts --outdir=dist --format=esm && bun build src/index.ts --outfile=dist/native-kit.iife.js --format=iife --global-name=NativeKitLib"
|
|
20
41
|
},
|
|
21
42
|
"devDependencies": {
|
|
22
43
|
"typescript": "^5.4.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Billing / IAP contract — platform-neutral shapes shared by the module,
|
|
2
|
-
* the native handlers, and any pluggable validator (
|
|
2
|
+
* the native handlers, and any pluggable validator (RevenueCat / IAPHUB / custom). */
|
|
3
3
|
|
|
4
4
|
export type ProductType =
|
|
5
5
|
| 'consumable'
|
|
@@ -61,7 +61,7 @@ export interface PurchaseResult {
|
|
|
61
61
|
/**
|
|
62
62
|
* The swappable seam. The kit owns the on-device purchase flow; *who decides the
|
|
63
63
|
* user is actually entitled* is up to the app. Implement this (or configure the
|
|
64
|
-
* bundled `HttpValidator`) to point at
|
|
64
|
+
* bundled `HttpValidator`) to point at RevenueCat, IAPHUB, or your own backend.
|
|
65
65
|
*/
|
|
66
66
|
export interface BillingValidator {
|
|
67
67
|
/** Validate a fresh purchase/restore receipt → the entitlements it grants. */
|
|
@@ -38,7 +38,7 @@ export class HttpValidatorOptions {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Generic server-validated strategy. One implementation covers
|
|
41
|
+
* Generic server-validated strategy. One implementation covers RevenueCat,
|
|
42
42
|
* IAPHUB, or any custom backend — they differ only by URL, auth header, and a small
|
|
43
43
|
* response mapper. HTTP over SDK by design (no vendor packages).
|
|
44
44
|
*/
|
package/src/modules/push.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { KitError, type Capability, type Unsubscribe } from '../core/types';
|
|
|
5
5
|
export type PushPlatform = 'apns' | 'fcm';
|
|
6
6
|
|
|
7
7
|
/** A device push token + its transport. The kit's job ENDS here: ship this to YOUR backend
|
|
8
|
-
* (
|
|
8
|
+
* (FCM-direct / OneSignal / custom) — the framework never sends, so it's push-platform-agnostic. */
|
|
9
9
|
export interface PushToken {
|
|
10
10
|
platform: PushPlatform;
|
|
11
11
|
token: string;
|