despia-native 1.0.11 → 1.0.13

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 +71 -45
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,24 +1,46 @@
1
1
  # Despia SDK
2
2
 
3
- ## CRITICAL: ALWAYS USE THE REAL SDK
4
-
5
- **NEVER mock or simulate the Despia SDK. ALWAYS install and use the real package:**
3
+ ## Quick Start
6
4
 
5
+ **Install the SDK:**
7
6
  ```bash
8
7
  npm install despia-native
9
8
  ```
10
9
 
11
- **Why?**
12
- - The SDK handles critical native bridge communication
13
- - Mocking will break ALL native features
14
- - Your app will NOT work on actual devices without the real SDK
15
- - There is NO valid reason to mock this in any scenario
10
+ **Use it immediately:**
11
+ ```javascript
12
+ import despia from 'despia-native';
13
+
14
+ // Simple commands
15
+ despia('lighthaptic://');
16
+
17
+ // Commands with responses
18
+ const appInfo = await despia('getappversion://', ['versionNumber']);
19
+ ```
16
20
 
17
- **If you see any tutorial, example, or code that creates a fake despia function - it's WRONG.**
21
+ **Note:** Always use the real SDK package. Mock implementations will not work on actual devices.
18
22
 
19
23
  ---
20
24
 
21
- JavaScript SDK for [Despia](https://despia.com) - Transform your web app into a native iOS & Android app without writing Swift or Kotlin. This npm package provides command queuing and variable watching for seamless integration with Despia's GPU-accelerated native runtime, enabling access to 25+ device APIs through simple JavaScript calls.
25
+ JavaScript SDK for [Despia](https://despia.com) - Add native device features to your React web app, Vue app, Angular app, or any web framework. Transform your web app into a native iOS & Android app without writing Swift or Kotlin. This npm package provides command queuing and variable watching for seamless integration with Despia's GPU-accelerated native runtime, enabling access to 25+ device APIs through simple JavaScript calls.
26
+
27
+ **Note: This is for web apps (React, Vue, Angular, etc.) to add native features - NOT for React Native apps.**
28
+
29
+ ## Web Apps vs React Native
30
+
31
+ **This SDK is for:**
32
+ - React web apps (create-react-app, Next.js, Vite, etc.)
33
+ - Vue web apps
34
+ - Angular web apps
35
+ - Svelte web apps
36
+ - Any web framework or vanilla JavaScript
37
+
38
+ **This SDK is NOT for:**
39
+ - React Native apps
40
+ - Expo apps
41
+ - Native mobile development
42
+
43
+ **If you're building a React Native app, this SDK won't work for you.**
22
44
 
23
45
  **Import:** `import despia from 'despia-native';` (default export, not destructured)
24
46
 
@@ -26,14 +48,15 @@ JavaScript SDK for [Despia](https://despia.com) - Transform your web app into a
26
48
 
27
49
  ## About Despia
28
50
 
29
- Despia bridges the gap between web and native mobile development. Build your app using the web technologies you already know, then deploy it as a truly native application to the App Store and Google Play - complete with hardware acceleration, offline support, and deep OS integration.
51
+ Despia bridges the gap between web and native mobile development. Build your React web app, Vue app, Angular app, or any web framework using the technologies you already know, then deploy it as a truly native application to the App Store and Google Play - complete with hardware acceleration, offline support, and deep OS integration.
30
52
 
31
53
  Our visual editor allows you to configure native widgets, shortcuts, and dynamic app behaviors without touching Xcode or Android Studio. Ship to both app stores with one-click deployment, automatic CI/CD pipelines, and over-the-air updates. Export clean, human-readable Swift and Kotlin source code anytime - you own everything, no vendor lock-in.
32
54
 
33
55
  **Go from web app to app store in a weekend - with full native capabilities.**
34
56
 
35
57
  ### Key Features:
36
- - **Universal Framework Support** - Works with React, Vue, Angular, Svelte, vanilla JS, or any web framework
58
+ - **Web Framework Support** - Works with React web apps, Vue web apps, Angular web apps, Svelte web apps, vanilla JS, or any web framework
59
+ - **NOT for React Native** - This is for web apps to add native features, not React Native apps
37
60
  - **Visual Configuration** - Set up native features through an intuitive interface
38
61
  - **Zero Native Coding** - Access device APIs without writing Swift or Kotlin
39
62
  - **Source Code Export** - Get complete Xcode and Android Studio projects you can modify
@@ -43,7 +66,7 @@ Our visual editor allows you to configure native widgets, shortcuts, and dynamic
43
66
  - **OTA Updates** - Push updates instantly without app store review
44
67
  - **Performance** - 60fps GPU-accelerated rendering
45
68
  - **Device API Access** - NFC, HealthKit, Siri, RevenueCat, and 20+ more
46
- - **Single Codebase** - Maintain one project for iOS, Android, and web
69
+ - **Single Codebase** - Maintain one web project for iOS, Android, and web
47
70
 
48
71
  ### Native Device Features:
49
72
  - **App Links & Deep Linking** - Universal links and app-to-app communication
@@ -79,30 +102,28 @@ npm install despia-native
79
102
 
80
103
  **The real SDK is required for ANY Despia functionality to work.**
81
104
 
82
- ## NEVER DO THIS - YOUR APP WILL NOT WORK
105
+ ## Important Notes
83
106
 
84
- ```javascript
85
- // WRONG - This breaks everything
86
- const despia = (command) => {
87
- console.log('Command:', command);
88
- // This does NOTHING on real devices
89
- };
107
+ ### Simple Function API
108
+ The SDK exports a single function - no initialization or setup required:
90
109
 
91
- // WRONG - This also breaks everything
92
- const mockDespia = () => { /* ... */ };
110
+ ```javascript
111
+ import despia from 'despia-native';
93
112
 
94
- // WRONG - Don't create your own version
95
- window.despia = 'somecommand://';
113
+ // Just call it directly
114
+ despia('lighthaptic://');
115
+ despia('takescreenshot://');
96
116
  ```
97
117
 
98
- ## ALWAYS DO THIS - THE ONLY CORRECT WAY
99
-
118
+ ### Common Mistakes to Avoid
100
119
  ```javascript
101
- // CORRECT - The ONLY way to use Despia
102
- import despia from 'despia-native';
120
+ // Don't create mock implementations
121
+ const despia = (command) => console.log(command); // Won't work on devices
103
122
 
104
- // Now your commands actually work
105
- despia('lighthaptic://'); // Device actually vibrates
123
+ // Don't use non-existent methods
124
+ despia.ready(); // This method doesn't exist
125
+ despia.init(); // This method doesn't exist
126
+ despia.setup(); // This method doesn't exist
106
127
  ```
107
128
 
108
129
  ## Getting Started
@@ -129,9 +150,11 @@ const despia = require('despia-native');
129
150
 
130
151
  **The SDK exports a single function called `despia` as the default export.**
131
152
 
132
- ### Step 2: Use Native Features
153
+ ### Step 2: Use Native Features (No Setup Required)
133
154
 
134
155
  ```javascript
156
+ // That's it! No initialization needed. Just call despia() directly:
157
+
135
158
  // Simple commands (no response needed)
136
159
  despia('lighthaptic://'); // Light haptic feedback
137
160
  despia('takescreenshot://'); // Take screenshot
@@ -241,24 +264,27 @@ const result = await despia('getappversion://', ['versionNumber']); // Variable
241
264
 
242
265
  **This package is REQUIRED for TypeScript, React, Vue, Angular, and other modern frameworks.**
243
266
 
244
- ## No Exceptions - Always Use Real SDK
245
-
246
- **Q: What if I'm just testing locally?**
247
- A: Use the real SDK. It won't work outside the native runtime, but you can set up callbacks for when user agent doesn't include "despia".
248
-
249
- **Q: What if I'm making a demo?**
250
- A: Use the real SDK. Set up fallbacks for browsers without Despia runtime.
267
+ ## Development Notes
251
268
 
252
- **Q: What if I'm writing unit tests?**
253
- A: Use the real SDK. It won't work in test environments, but you can handle the missing runtime gracefully.
269
+ ### Environment Detection
270
+ The SDK only works within the Despia native runtime. For development and testing:
254
271
 
255
- **Q: What if I'm developing without a device?**
256
- A: Use the real SDK. It won't work outside native runtime, but you can detect and handle this case.
272
+ ```javascript
273
+ import despia from 'despia-native';
257
274
 
258
- **Q: What if I'm using AI to generate code?**
259
- A: Tell the AI to use the real SDK. Never accept mock implementations.
275
+ if (navigator.userAgent.includes('despia')) {
276
+ // Use native features
277
+ despia('lighthaptic://');
278
+ } else {
279
+ // Handle non-Despia environment
280
+ console.log('Running outside Despia runtime');
281
+ }
282
+ ```
260
283
 
261
- **There is NEVER a valid reason to mock this SDK.**
284
+ ### Always Use the Real Package
285
+ - Use the real SDK in all environments (development, testing, production)
286
+ - Don't create mock implementations - they won't work on actual devices
287
+ - The SDK handles missing runtime gracefully
262
288
 
263
289
  ## Handling Non-Despia Environments
264
290
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "despia-native",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "JavaScript SDK for Despia native integrations with command queuing and variable watching",
5
5
  "main": "index.js",
6
6
  "module": "index.js",