@livx.cc/native-kit 0.25.0 → 0.27.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livx.cc/native-kit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Isomorphic native-capabilities kit for PWAs
|
|
3
|
+
"version": "0.27.0",
|
|
4
|
+
"description": "Isomorphic native-capabilities kit for PWAs \u2014 same API in browser and in an appwrap native shell. Zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Elya Livshitz",
|
|
7
7
|
"homepage": "https://github.com/Livshitz/appwrap#readme",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"build": "tsc --noEmit && 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"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"typescript": "^5.4.0"
|
package/src/modules/oauth.ts
CHANGED
|
@@ -17,7 +17,10 @@ export interface OAuthResult {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* System-browser OAuth
|
|
20
|
+
* System-browser OAuth — iOS ASWebAuthenticationSession / Android Chrome Custom Tabs. The Android
|
|
21
|
+
* tab returns the provider redirect via the app's urlScheme deep-link path (it doesn't auto-close
|
|
22
|
+
* like iOS); the shell matches the callbackScheme and resolves with the same { url } shape. A
|
|
23
|
+
* user-dismissed tab/sheet rejects with code 'CANCELLED'. Provider-agnostic by design — the same
|
|
21
24
|
* philosophy as `kit.push`: the shell owns only the device-side primitive (run the auth handshake in
|
|
22
25
|
* the OS-shared, policy-compliant browser), while the PWA builds the auth URL and does token exchange.
|
|
23
26
|
*
|
|
@@ -36,6 +39,9 @@ export class OAuthModule {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
authorize(params: OAuthAuthorizeParams): Promise<OAuthResult> {
|
|
39
|
-
|
|
42
|
+
// Long timeout: a real sign-in (password + 2FA + consent in the system browser) easily exceeds
|
|
43
|
+
// the 10s invoke default — without this the kit abandons the request id before the redirect
|
|
44
|
+
// returns and the login is silently dropped. Matches the other interactive flows (pickers 120s).
|
|
45
|
+
return this.kit.invoke('oauth.authorize', params as unknown as Record<string, unknown>, { timeoutMs: 300_000 });
|
|
40
46
|
}
|
|
41
47
|
}
|
package/src/modules/reviews.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { NativeKit } from '../core/NativeKit';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/** In-app store review prompt — iOS SKStoreReviewController / Android Play In-App Review (opt-in
|
|
4
|
+
* `reviews` module). The OS rate-limits display; on Android it only surfaces for a Play-Store-track
|
|
5
|
+
* install (a sideload/emulator no-ops without showing UI). Fire-and-forget either way. */
|
|
4
6
|
export class ReviewsModule {
|
|
5
7
|
constructor(private kit: NativeKit) {}
|
|
6
8
|
|
package/src/modules/scanner.ts
CHANGED
|
@@ -53,7 +53,9 @@ export class ScannerModule {
|
|
|
53
53
|
|
|
54
54
|
/** Open the scanner; resolve the first code, or `{ cancelled: true }` if dismissed. */
|
|
55
55
|
scan(opts: ScanOptions = {}): Promise<ScanResult | ScanCancelled> {
|
|
56
|
-
|
|
56
|
+
// Open-ended: the camera stays up until a code is found or the user cancels — lining up a QR
|
|
57
|
+
// routinely takes longer than the 10s invoke default, which would abandon the scan mid-aim.
|
|
58
|
+
return this.kit.invoke('scanner.scan', opts, { timeoutMs: 300_000 });
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
/** Dismiss an in-progress {@link scan} (its promise then resolves `{ cancelled: true }`). */
|
package/src/modules/speech.ts
CHANGED
|
@@ -68,7 +68,9 @@ export class SpeechModule {
|
|
|
68
68
|
|
|
69
69
|
/** Speak `text` aloud; resolves when the utterance finishes (or is stopped). */
|
|
70
70
|
speak(text: string, opts: SpeakOptions = {}): Promise<void> {
|
|
71
|
-
|
|
71
|
+
// Resolves only when the utterance (or its queue) finishes — easily exceeds the 10s invoke
|
|
72
|
+
// default for longer text or back-to-back speak() calls, dropping the result. Give it room.
|
|
73
|
+
return this.kit.invoke('speech.speak', { text, ...opts }, { timeoutMs: 120_000 });
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/** Cancel the current/queued utterance immediately. */
|
|
@@ -84,7 +86,9 @@ export class SpeechModule {
|
|
|
84
86
|
/** Start capturing the mic; resolves the FINAL transcript. With `{ partial:true }`, interim
|
|
85
87
|
* results stream via {@link onPartial}. Throws `KitError('UNSUPPORTED')` where STT is absent. */
|
|
86
88
|
listen(opts: ListenOptions = {}): Promise<string> {
|
|
87
|
-
|
|
89
|
+
// Open-ended: resolves on the final result or when stopListening() is called — a person may take
|
|
90
|
+
// a while to speak, so it must not be cut off by the 10s invoke default.
|
|
91
|
+
return this.kit.invoke('speech.listen', opts, { timeoutMs: 600_000 });
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
/** Stop capture early; the pending {@link listen} resolves with the best transcript so far. */
|