@series-inc/venus-sdk 2.4.1 → 2.6.2

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 CHANGED
@@ -17,21 +17,203 @@ The Venus SDK is built on a client-server RPC architecture:
17
17
  - **Mock Implementations** - Complete mock APIs for local development
18
18
  - **Venus API** - Low-level platform interface
19
19
 
20
- ### Core Components
20
+ ### Usage
21
21
 
22
22
  ```typescript
23
- import { createHost, VenusAPI } from 'venus-sdk'
23
+ import { default as VenusAPI } from '@series-inc/venus-sdk/api'
24
24
 
25
- // Create Venus API instance
26
- const venusApi = new VenusAPI()
27
- await venusApi.initializeAsync()
25
+ // Initialize the API
26
+ await VenusAPI.initializeAsync()
27
+ ```
28
+
29
+ ## API Overview
30
+
31
+ ### Profile API
32
+
33
+ ```typescript
34
+ // Get current user profile
35
+ const profile = await VenusAPI.profile.getCurrentProfile()
36
+ console.log(profile.name, profile.username)
37
+ ```
38
+ ---
28
39
 
29
- // Create Host (false = remote, true = mock)
30
- const host = createHost(venusApi, false)
31
- await host.initialize()
40
+ ### Safe Area & HUD Insets
41
+
42
+ ```typescript
43
+ // Static safe area from initialization (baseline padding)
44
+ const safeArea = VenusAPI.config.ui.safeArea
45
+ layout.style.paddingTop = `${safeArea.top}px`
46
+ layout.style.paddingBottom = `${safeArea.bottom}px`
47
+
48
+ // Dynamic HUD insets arrive with lifecycle events
49
+ VenusAPI.lifecycle.onShow(({ hudInsets }) => {
50
+ applyInsets(hudInsets, 'preview')
51
+ })
52
+
53
+ VenusAPI.lifecycle.onPlay(({ hudInsets }) => {
54
+ applyInsets(hudInsets, 'fullscreen')
55
+ })
56
+
57
+ function applyInsets(insets, mode) {
58
+ // Use whichever inset is larger to avoid overlap with host UI
59
+ const top = Math.max(VenusAPI.config.ui.safeArea.top, insets.top)
60
+ canvas.style.paddingTop = `${top}px`
61
+ canvas.dataset.mode = mode
62
+ }
32
63
  ```
33
64
 
34
- ## API Reference
65
+ `safeArea` provides a static baseline defined at initialization. `hudInsets` reflect the live host UI chrome and differ between preview (`onShow`) and fullscreen (`onPlay`) contexts.
66
+
67
+ ---
68
+
69
+ ### Ads API
70
+
71
+ ```typescript
72
+ // Check if rewarded ad is ready
73
+ const rewardedReady = await VenusAPI.ads.isRewardedAdReadyAsync()
74
+
75
+ // Show interstitial ad
76
+ const interstitialShown = await VenusAPI.ads.showInterstitialAd()
77
+ if (interstitialShown) {
78
+ // Interstitial ad was displayed
79
+ }
80
+
81
+ // Show rewarded video ad
82
+ const rewardEarned = await VenusAPI.ads.showRewardedAdAsync()
83
+ if (rewardEarned) {
84
+ // User watched the full video and earned reward
85
+ }
86
+ ```
87
+ ---
88
+
89
+ ### Haptics API
90
+
91
+ ```typescript
92
+ // Trigger haptic feedback
93
+ await VenusAPI.haptics.trigger('success')
94
+ await VenusAPI.haptics.trigger('warning')
95
+ await VenusApi.haptics.trigger('light')
96
+ await VenusApi.haptics.trigger('medium')
97
+ await VenusAPI.haptics.trigger('heavy')
98
+
99
+ ```
100
+ ---
101
+
102
+ ### Local Notifications API
103
+
104
+ ```typescript
105
+ // Schedule a delayed notification
106
+ const id = await VenusApi.notifications.scheduleAsync({
107
+ title: 'Notification Title',
108
+ body: 'Notification Body',
109
+ trigger: {
110
+ type: 'timeInterval',
111
+ seconds: 60 // Delay in seconds (required)
112
+ },
113
+ })
114
+
115
+ // Cancel a notification
116
+ await VenusApi.notifications.cancelNotification(notificationId)
117
+
118
+ // Get all scheduled notifications
119
+ await VenusApi.notifications.getAllScheduledLocalNotifications()
120
+ ```
121
+ ---
122
+
123
+ ### Loader API
124
+
125
+ The preloader is opt-in by default. In order to opt in, you must add
126
+ ```typescript
127
+ await VenusAPI.initializeAsync({ usePreloader: true })
128
+ ```
129
+
130
+ ```typescript
131
+ // Activating and dismissing the preloader
132
+ await VenusApi.preloader.showLoadScreen()
133
+ await VenusApi.preloader.hideLoadScreen()
134
+ ```
135
+ ---
136
+
137
+ ### Custom Funnel Events API
138
+
139
+ ```typescript
140
+ // Record a custom analytics event
141
+ await VenusApi.analytics.recordCustomEvent('level_completed', {
142
+ level: 5,
143
+ score: 1250,
144
+ time: 45.2
145
+ })
146
+
147
+ // Track funnel step with optional funnel name
148
+ await VenusApi.analytics.trackFunnelStep(1, 'tutorial_started', 'onboarding')
149
+ await VenusApi.analytics.trackFunnelStep(2, 'tutorial_completed', 'onboarding')
150
+ ```
151
+ ---
152
+
153
+ ### IAP API
154
+
155
+ ```typescript
156
+ // get VBucks/Hard Currency balance
157
+ await VenusApi.iap.getHardCurrencyBalance()
158
+ // Spend VBucks/Hard Currency
159
+ await VenusApi.iap.spendCurrency({
160
+ productId: 'yourProductID',
161
+ amount: '3',
162
+ options?: {
163
+ screenname: 'yourScreenName'
164
+ },
165
+ })
166
+ // Open Venus Store
167
+ await VenusApi.iap.openStore()
168
+ // Get Currency Icon
169
+ await VenusApi.iap.getCurrencyIcon()
170
+ ```
171
+ ---
172
+
173
+ ### Saves API
174
+
175
+ ```typescript
176
+ // Get an item from storage
177
+ await VenusApi.storage.getItem('playerData')
178
+ // Set an item in storage
179
+ await VenusApi.storage.setItem('playerData', JSON.stringify({ level: 10 }))
180
+ // Remove an item from storage
181
+ await VenusApi.storage.removeItem('playerData')
182
+ // Get storage length
183
+ await VenusApi.storage.length()
184
+ // Get key at specific index
185
+ await VenusApi.storage.key(0)
186
+ // Clear all items from storage
187
+ await VenusApi.storage.clear()
188
+ // Set multiple items at once
189
+ await VenusApi.storage.setMultipleItems([
190
+ { key: 'playerData', value: JSON.stringify({ level: 10 }) },
191
+ { key: 'settings', value: JSON.stringify({ sound: true }) }
192
+ ])
193
+ // Remove multiple items at once
194
+ await VenusApi.storage.removeMultipleItems(['playerData', 'settings'])
195
+ // Get all items from storage
196
+ await VenusApi.storage.getAllItems()
197
+ ```
198
+ ---
199
+
200
+ ### LLM API
201
+
202
+ ```typescript
203
+ // Request chat completion from AI model
204
+ const response = await VenusApi.ai.requestChatCompletionAsync({
205
+ model: 'chatGPT',
206
+ messages: [
207
+ {
208
+ role: 'user',
209
+ content: 'What is the best strategy for this level?'
210
+ }
211
+ ]
212
+ })
213
+
214
+ // Get available completion models
215
+ const models = await VenusApi.ai.getAvailableCompletionModels()
216
+ ```
35
217
 
36
218
  ### Simulation API
37
219
 
@@ -41,11 +223,11 @@ The Simulation API manages game state, recipe execution, and slot systems.
41
223
 
42
224
  ```typescript
43
225
  // Get current simulation state
44
- const state = await host.simulation.getStateAsync(roomId?)
226
+ const state = await VenusAPI.simulation.getStateAsync(roomId?)
45
227
  // Returns: { entities, inventory, currencies, timers, etc. }
46
228
 
47
229
  // Get simulation configuration
48
- const config = await host.simulation.getConfigAsync(roomId?)
230
+ const config = await VenusAPI.simulation.getConfigAsync(roomId?)
49
231
  ```
50
232
 
51
233
  #### Recipe Execution
@@ -54,34 +236,34 @@ Recipes are server-authoritative game actions (crafting, battles, upgrades, etc.
54
236
 
55
237
  ```typescript
56
238
  // Execute a recipe
57
- const result = await host.simulation.executeRecipeAsync(
239
+ const result = await VenusAPI.simulation.executeRecipeAsync(
58
240
  'craft_sword',
59
241
  { materials: ['iron', 'wood'] },
60
242
  { skipNotification: false }
61
243
  )
62
244
 
63
245
  // Execute a scoped recipe (entity-specific)
64
- const result = await host.simulation.executeScopedRecipeAsync(
246
+ const result = await VenusAPI.simulation.executeScopedRecipeAsync(
65
247
  'upgrade_weapon',
66
248
  'sword_123',
67
249
  { level: 5 }
68
250
  )
69
251
 
70
252
  // Get active recipe runs (for time-based recipes)
71
- const runs = await host.simulation.getActiveRunsAsync()
253
+ const runs = await VenusAPI.simulation.getActiveRunsAsync()
72
254
 
73
255
  // Collect completed recipe
74
- const result = await host.simulation.collectRecipeAsync(runId)
256
+ const result = await VenusAPI.simulation.collectRecipeAsync(runId)
75
257
 
76
258
  // Trigger recipe chain
77
- await host.simulation.triggerRecipeChainAsync('battle_complete')
259
+ await VenusAPI.simulation.triggerRecipeChainAsync('battle_complete')
78
260
  ```
79
261
 
80
262
  #### Recipe Requirements
81
263
 
82
264
  ```typescript
83
265
  // Check requirements for a single recipe
84
- const requirements = await host.simulation.getRecipeRequirementsAsync({
266
+ const requirements = await VenusAPI.simulation.getRecipeRequirementsAsync({
85
267
  recipeId: 'craft_sword',
86
268
  entity: 'player',
87
269
  amount: 1
@@ -89,13 +271,13 @@ const requirements = await host.simulation.getRecipeRequirementsAsync({
89
271
  // Returns: { canAfford, costs, rewards }
90
272
 
91
273
  // Batch check multiple recipes
92
- const results = await host.simulation.getBatchRecipeRequirementsAsync([
274
+ const results = await VenusAPI.simulation.getBatchRecipeRequirementsAsync([
93
275
  { recipeId: 'craft_sword', amount: 1 },
94
276
  { recipeId: 'craft_shield', amount: 2 }
95
277
  ])
96
278
 
97
279
  // Get available recipes
98
- const recipes = await host.simulation.getAvailableRecipesAsync({
280
+ const recipes = await VenusAPI.simulation.getAvailableRecipesAsync({
99
281
  roomId: 'room_123',
100
282
  includeActorRecipes: true
101
283
  })
@@ -107,24 +289,24 @@ Slots represent equipment, loadouts, teams, or any item container system:
107
289
 
108
290
  ```typescript
109
291
  // Get all slot containers
110
- const containers = await host.simulation.getSlotContainersAsync()
292
+ const containers = await VenusAPI.simulation.getSlotContainersAsync()
111
293
  // Returns: [{ id: 'equipment', slots: [...] }, { id: 'team', slots: [...] }]
112
294
 
113
295
  // Get slot assignments for a container
114
- const assignments = await host.simulation.getSlotAssignmentsAsync('equipment')
296
+ const assignments = await VenusAPI.simulation.getSlotAssignmentsAsync('equipment')
115
297
  // Returns: [{ slotId: 'weapon', itemId: 'sword_123' }, ...]
116
298
 
117
299
  // Assign item to slot
118
- await host.simulation.assignItemToSlotAsync('equipment', 'weapon', 'sword_123')
300
+ await VenusAPI.simulation.assignItemToSlotAsync('equipment', 'weapon', 'sword_123')
119
301
 
120
302
  // Remove item from slot
121
- await host.simulation.removeItemFromSlotAsync('equipment', 'weapon')
303
+ await VenusAPI.simulation.removeItemFromSlotAsync('equipment', 'weapon')
122
304
 
123
305
  // Get available items for a slot
124
- const items = await host.simulation.getAvailableItemsAsync('equipment', 'weapon')
306
+ const items = await VenusAPI.simulation.getAvailableItemsAsync('equipment', 'weapon')
125
307
 
126
308
  // Preview power calculation before assignment
127
- const preview = await host.simulation.calculatePowerPreviewAsync(
309
+ const preview = await VenusAPI.simulation.calculatePowerPreviewAsync(
128
310
  'equipment',
129
311
  'weapon',
130
312
  'sword_456'
@@ -132,7 +314,7 @@ const preview = await host.simulation.calculatePowerPreviewAsync(
132
314
  // Returns: { currentPower: 100, newPower: 150, delta: +50 }
133
315
 
134
316
  // Validate slot assignment
135
- const valid = await host.simulation.validateSlotAssignmentAsync(
317
+ const valid = await VenusAPI.simulation.validateSlotAssignmentAsync(
136
318
  'equipment',
137
319
  'weapon',
138
320
  'shield_123' // Wrong type
@@ -140,7 +322,7 @@ const valid = await host.simulation.validateSlotAssignmentAsync(
140
322
  // Returns: { valid: false, reason: 'Type mismatch' }
141
323
 
142
324
  // Batch operations (atomic)
143
- await host.simulation.executeBatchOperationsAsync([
325
+ await VenusAPI.simulation.executeBatchOperationsAsync([
144
326
  { type: 'assign', containerId: 'equipment', slotId: 'weapon', itemId: 'sword' },
145
327
  { type: 'assign', containerId: 'equipment', slotId: 'armor', itemId: 'plate' },
146
328
  { type: 'remove', containerId: 'equipment', slotId: 'boots' }
@@ -151,21 +333,22 @@ await host.simulation.executeBatchOperationsAsync([
151
333
 
152
334
  ```typescript
153
335
  // Resolve dynamic field values
154
- const value = await host.simulation.resolveFieldValueAsync(
336
+ const value = await VenusAPI.simulation.resolveFieldValueAsync(
155
337
  'player_123',
156
338
  'stats.power',
157
339
  'player'
158
340
  )
159
341
 
160
342
  // Get entity metadata
161
- const metadata = await host.simulation.getEntityMetadataAsync('sword_123')
343
+ const metadata = await VenusAPI.simulation.getEntityMetadataAsync('sword_123')
162
344
  ```
345
+ ---
163
346
 
164
347
  #### Utility Methods
165
348
 
166
349
  ```typescript
167
350
  // Sum stat contributions
168
- const totalPower = host.simulation.sumContributions(
351
+ const totalPower = VenusAPI.simulation.sumContributions(
169
352
  [{ power: 10 }, { power: 20 }, { power: 15 }],
170
353
  'power'
171
354
  )
@@ -180,15 +363,15 @@ Three-tier storage system with different data scopes:
180
363
 
181
364
  ```typescript
182
365
  // Device Cache - persists across all apps for the device
183
- await host.deviceCache.set('lastUserId', '12345')
184
- const userId = await host.deviceCache.get('lastUserId')
366
+ await VenusAPI.deviceCache.set('lastUserId', '12345')
367
+ const userId = await VenusAPI.deviceCache.get('lastUserId')
185
368
 
186
369
  // App Storage - app-specific persistent storage
187
- await host.appStorage.set('highScore', 1000)
188
- await host.appStorage.set('playerData', { level: 5, gold: 1000 })
370
+ await VenusAPI.appStorage.set('highScore', 1000)
371
+ await VenusAPI.appStorage.set('playerData', { level: 5, gold: 1000 })
189
372
 
190
373
  // Global Storage - shared across all apps for the user
191
- await host.globalStorage.set('preferences', { theme: 'dark' })
374
+ await VenusAPI.globalStorage.set('preferences', { theme: 'dark' })
192
375
 
193
376
  // All storage APIs support:
194
377
  const value = await storage.get(key, defaultValue?)
@@ -201,47 +384,6 @@ const keyName = await storage.key(index)
201
384
 
202
385
  ---
203
386
 
204
- ### Profile API
205
-
206
- ```typescript
207
- // Get current user profile
208
- const profile = await host.profile.getCurrentProfile()
209
- // Returns: { id, name, username }
210
- ```
211
-
212
- ---
213
-
214
- ### Ads API
215
-
216
- ```typescript
217
- // Check ad readiness
218
- const interstitialReady = await host.ads.isInterstitialReady()
219
- const rewardedReady = await host.ads.isRewardedReady()
220
-
221
- // Show interstitial ad
222
- await host.ads.showInterstitial()
223
-
224
- // Show rewarded video ad
225
- const watched = await host.ads.showRewarded()
226
- if (watched) {
227
- // User watched the full video, grant reward
228
- }
229
- ```
230
-
231
- ---
232
-
233
- ### Haptics API
234
-
235
- Trigger haptic feedback on supported devices:
236
-
237
- ```typescript
238
- // Available haptic types: 'light', 'medium', 'heavy', 'success', 'warning', 'error'
239
- await host.haptics.trigger('success')
240
- await host.haptics.trigger('warning')
241
- await host.haptics.trigger('heavy')
242
- ```
243
-
244
- ---
245
387
 
246
388
  ### Popups API
247
389
 
@@ -249,21 +391,21 @@ Display native-style UI popups:
249
391
 
250
392
  ```typescript
251
393
  // Toast messages
252
- await host.popups.showToast('Game saved!', {
394
+ await VenusAPI.popups.showToast('Game saved!', {
253
395
  duration: 3000,
254
396
  variant: 'success',
255
397
  action: { label: 'Undo' }
256
398
  })
257
399
 
258
400
  // Alert dialog
259
- await host.popups.showAlert({
401
+ await VenusAPI.popups.showAlert({
260
402
  title: 'Warning',
261
403
  message: 'This action cannot be undone',
262
404
  buttonText: 'OK'
263
405
  })
264
406
 
265
407
  // Confirm dialog
266
- const confirmed = await host.popups.showConfirm({
408
+ const confirmed = await VenusAPI.popups.showConfirm({
267
409
  title: 'Delete Item',
268
410
  message: 'Are you sure you want to delete this item?',
269
411
  confirmText: 'Delete',
@@ -275,7 +417,7 @@ if (confirmed) {
275
417
  }
276
418
 
277
419
  // Action sheet
278
- const selected = await host.popups.showActionSheet({
420
+ const selected = await VenusAPI.popups.showActionSheet({
279
421
  title: 'Choose Action',
280
422
  options: [
281
423
  { id: 'edit', label: 'Edit', variant: 'default' },
@@ -298,17 +440,17 @@ Stack-based navigation system:
298
440
 
299
441
  ```typescript
300
442
  // Get current stack information
301
- const stack = await host.navigation.getStackInfo()
443
+ const stack = await VenusAPI.navigation.getStackInfo()
302
444
  // Returns: { depth, currentApp, history }
303
445
 
304
446
  // Push new app to stack
305
- await host.navigation.push({
447
+ await VenusAPI.navigation.push({
306
448
  appId: 'bird-flap',
307
449
  context: { level: 5, difficulty: 'hard' }
308
450
  })
309
451
 
310
452
  // Pop from stack (returns to previous app)
311
- await host.navigation.pop()
453
+ await VenusAPI.navigation.pop()
312
454
  ```
313
455
 
314
456
  ---
@@ -319,20 +461,20 @@ Social interaction APIs for posts:
319
461
 
320
462
  ```typescript
321
463
  // Get post interaction data
322
- const interactions = await host.post.getInteractions()
464
+ const interactions = await VenusAPI.post.getInteractions()
323
465
  // Returns: { postId, isLiked, isFollowing, likeCount, commentCount }
324
466
 
325
467
  // Toggle like
326
- await host.post.toggleLike()
468
+ await VenusAPI.post.toggleLike()
327
469
 
328
470
  // Toggle follow
329
- await host.post.toggleFollow()
471
+ await VenusAPI.post.toggleFollow()
330
472
 
331
473
  // Open comments UI
332
- await host.post.openComments()
474
+ await VenusAPI.post.openComments()
333
475
 
334
476
  // Share post
335
- await host.post.share({
477
+ await VenusAPI.post.share({
336
478
  message: 'Check this out!',
337
479
  recipientIds: ['user1', 'user2']
338
480
  })
@@ -340,43 +482,18 @@ await host.post.share({
340
482
 
341
483
  ---
342
484
 
343
- ### AI API
344
-
345
- LLM integration for chat completions:
346
-
347
- ```typescript
348
- // Get available models
349
- const models = await host.ai.getAvailableModels()
350
- // Returns: ['gpt-4', 'gpt-3.5-turbo', 'claude-3-opus', ...]
351
-
352
- // Chat completion
353
- const response = await host.ai.chatCompletion({
354
- messages: [
355
- { role: 'system', content: 'You are a helpful game assistant' },
356
- { role: 'user', content: 'What is the best strategy for this level?' }
357
- ],
358
- model: 'gpt-4',
359
- temperature: 0.7,
360
- max_tokens: 500
361
- })
362
-
363
- console.log(response.choices[0].message.content)
364
- ```
365
-
366
- ---
367
-
368
485
  ### Analytics API
369
486
 
370
487
  ```typescript
371
488
  // Log custom event
372
- await host.analytics.logEvent('level_complete', {
489
+ await VenusAPI.analytics.logEvent('level_complete', {
373
490
  level: 5,
374
491
  score: 1000,
375
492
  timeElapsed: 120
376
493
  })
377
494
 
378
495
  // Set user properties
379
- await host.analytics.setUserProperty('vip_status', 'gold')
496
+ await VenusAPI.analytics.setUserProperty('vip_status', 'gold')
380
497
  ```
381
498
 
382
499
  ---
@@ -385,10 +502,10 @@ await host.analytics.setUserProperty('vip_status', 'gold')
385
502
 
386
503
  ```typescript
387
504
  // Get current avatar configuration
388
- const avatar = await host.avatar3d.get()
505
+ const avatar = await VenusAPI.avatar3d.get()
389
506
 
390
507
  // Show avatar editor
391
- const result = await host.avatar3d.showEditor({
508
+ const result = await VenusAPI.avatar3d.showEditor({
392
509
  allowSave: true,
393
510
  enableSharing: true
394
511
  })
@@ -398,13 +515,13 @@ if (result.saved) {
398
515
  }
399
516
 
400
517
  // Delete avatar
401
- await host.avatar3d.delete()
518
+ await VenusAPI.avatar3d.delete()
402
519
 
403
520
  // Get shared avatar
404
- const sharedAvatar = await host.avatar3d.getSharedAvatar('avatar_123')
521
+ const sharedAvatar = await VenusAPI.avatar3d.getSharedAvatar('avatar_123')
405
522
 
406
523
  // Download avatar manifest
407
- const manifest = await host.avatar3d.downloadManifest('avatar_123')
524
+ const manifest = await VenusAPI.avatar3d.downloadManifest('avatar_123')
408
525
  ```
409
526
 
410
527
  ---
@@ -415,17 +532,17 @@ Multi-user room management:
415
532
 
416
533
  ```typescript
417
534
  // Get current room
418
- const room = await host.rooms.getCurrentRoom()
535
+ const room = await VenusAPI.rooms.getCurrentRoom()
419
536
  // Returns: { id, name, participants, metadata }
420
537
 
421
538
  // Join room
422
- await host.rooms.join('room_123')
539
+ await VenusAPI.rooms.join('room_123')
423
540
 
424
541
  // Leave room
425
- await host.rooms.leave()
542
+ await VenusAPI.rooms.leave()
426
543
 
427
544
  // Send room message
428
- await host.rooms.sendMessage({
545
+ await VenusAPI.rooms.sendMessage({
429
546
  type: 'game_action',
430
547
  data: { action: 'move', x: 10, y: 20 }
431
548
  })
@@ -433,51 +550,23 @@ await host.rooms.sendMessage({
433
550
 
434
551
  ---
435
552
 
436
- ### Notifications API
437
-
438
- Local push notifications:
439
-
440
- ```typescript
441
- // Schedule notification
442
- await host.notifications.schedule({
443
- id: 'energy_full',
444
- title: 'Energy Restored!',
445
- body: 'Your energy is now full. Come back to play!',
446
- trigger: { type: 'time', seconds: 3600 } // 1 hour
447
- })
448
-
449
- // Cancel notification
450
- await host.notifications.cancel('energy_full')
451
-
452
- // Get all scheduled notifications
453
- const scheduled = await host.notifications.getAllScheduled()
454
-
455
- // Check if notifications are enabled
456
- const enabled = await host.notifications.isEnabled()
457
-
458
- // Enable/disable notifications
459
- await host.notifications.setEnabled(true)
460
- ```
461
-
462
- ---
463
-
464
553
  ### Time API
465
554
 
466
555
  Server time synchronization and formatting:
467
556
 
468
557
  ```typescript
469
558
  // Get server time
470
- const serverTime = await host.time.getServerTime()
559
+ const serverTime = await VenusAPI.time.getServerTime()
471
560
  // Returns: { timestamp, timezone, formatted }
472
561
 
473
562
  // Format time with locale
474
- const formatted = host.time.format(Date.now(), {
563
+ const formatted = VenusAPI.time.format(Date.now(), {
475
564
  locale: 'en-US',
476
565
  format: 'full' // 'full', 'long', 'medium', 'short'
477
566
  })
478
567
 
479
568
  // Format number with locale
480
- const formatted = host.time.formatNumber(1234567.89, {
569
+ const formatted = VenusAPI.time.formatNumber(1234567.89, {
481
570
  locale: 'en-US',
482
571
  style: 'currency',
483
572
  currency: 'USD'
@@ -490,10 +579,10 @@ const formatted = host.time.formatNumber(1234567.89, {
490
579
 
491
580
  ```typescript
492
581
  // Get CDN URL for an asset
493
- const url = await host.cdn.getAssetUrl('images/logo.png')
582
+ const url = await VenusAPI.cdn.getAssetUrl('images/logo.png')
494
583
 
495
584
  // Upload to CDN
496
- const uploadUrl = await host.cdn.upload(file)
585
+ const uploadUrl = await VenusAPI.cdn.upload(file)
497
586
  ```
498
587
 
499
588
  ---
@@ -504,77 +593,52 @@ Feature flags, experiments, and A/B testing:
504
593
 
505
594
  ```typescript
506
595
  // Get feature flag value
507
- const enabled = await host.features.getFeatureFlag('new_ui_enabled')
596
+ const enabled = await VenusAPI.features.getFeatureFlag('new_ui_enabled')
508
597
 
509
598
  // Get feature gate (boolean flag)
510
- const canAccess = await host.features.getFeatureGate('beta_features')
599
+ const canAccess = await VenusAPI.features.getFeatureGate('beta_features')
511
600
 
512
601
  // Get experiment variant
513
- const experiment = await host.features.getExperiment('checkout_flow')
602
+ const experiment = await VenusAPI.features.getExperiment('checkout_flow')
514
603
  // Returns: { variant: 'control' | 'variant_a' | 'variant_b', ... }
515
604
  ```
516
605
 
517
- ---
518
-
519
- ### IAP API
520
-
521
- In-app purchases and virtual currency:
522
-
523
- ```typescript
524
- // Get wallet balance
525
- const wallet = await host.iap.getWallet()
526
- // Returns: { coins: 1000, gems: 50 }
527
-
528
- // Spend currency
529
- const result = await host.iap.spendCurrency('coins', 100)
530
- if (result.success) {
531
- console.log('Purchase successful')
532
- }
533
-
534
- // Listen for wallet updates
535
- host.iap.onWalletUpdate((wallet) => {
536
- console.log('Wallet updated:', wallet)
537
- })
538
- ```
539
-
540
- ---
541
-
542
606
  ### Lifecycle API
543
607
 
544
608
  App lifecycle event handlers:
545
609
 
546
610
  ```typescript
547
611
  // Register lifecycle callbacks
548
- host.lifecycle.onReady(() => {
612
+ VenusAPI.lifecycle.onReady(() => {
549
613
  console.log('App ready')
550
614
  })
551
615
 
552
- host.lifecycle.onShow((context) => {
616
+ VenusAPI.lifecycle.onShow((context) => {
553
617
  console.log('App shown', context.hudInsets)
554
618
  })
555
619
 
556
- host.lifecycle.onPlay((context) => {
620
+ VenusAPI.lifecycle.onPlay((context) => {
557
621
  console.log('App playing', context.hudInsets)
558
622
  })
559
623
 
560
- host.lifecycle.onPause(() => {
624
+ VenusAPI.lifecycle.onPause(() => {
561
625
  console.log('App paused')
562
626
  })
563
627
 
564
- host.lifecycle.onResume(() => {
628
+ VenusAPI.lifecycle.onResume(() => {
565
629
  console.log('App resumed')
566
630
  })
567
631
 
568
- host.lifecycle.onHidden(() => {
632
+ VenusAPI.lifecycle.onHidden(() => {
569
633
  console.log('App hidden')
570
634
  })
571
635
 
572
- host.lifecycle.onQuit(() => {
636
+ VenusAPI.lifecycle.onQuit(() => {
573
637
  console.log('App quitting')
574
638
  })
575
639
 
576
640
  // Quit the app
577
- await host.lifecycle.quit()
641
+ await VenusAPI.lifecycle.quit()
578
642
  ```
579
643
 
580
644
  ---
@@ -583,9 +647,9 @@ await host.lifecycle.quit()
583
647
 
584
648
  ```typescript
585
649
  // Log messages
586
- host.logging.log('Info message', { data: 'value' })
587
- host.logging.error('Error message', error)
588
- host.logging.debug('Debug info')
650
+ VenusAPI.logging.log('Info message', { data: 'value' })
651
+ VenusAPI.logging.error('Error message', error)
652
+ VenusAPI.logging.debug('Debug info')
589
653
  ```
590
654
 
591
655
  ---
@@ -595,22 +659,18 @@ host.logging.debug('Debug info')
595
659
  All APIs have complete mock implementations for local development:
596
660
 
597
661
  ```typescript
598
- import { createHost, VenusAPI } from 'venus-sdk'
599
-
600
- const venusApi = new VenusAPI()
601
- await venusApi.initializeAsync({ mock: true })
662
+ import { default as VenusAPI } from '@series-inc/venus-sdk/api'
602
663
 
603
- const host = createHost(venusApi, true) // true = mock mode
604
- await host.initialize()
664
+ await VenusAPI.initializeAsync({ mock: true })
605
665
 
606
666
  // All APIs work the same, but with simulated responses
607
- const state = await host.simulation.getStateAsync()
667
+ const state = await VenusAPI.simulation.getStateAsync()
608
668
  ```
609
669
 
610
670
  ### Custom Mock Data
611
671
 
612
672
  ```typescript
613
- await venusApi.initializeAsync({
673
+ await VenusAPI.initializeAsync({
614
674
  mock: {
615
675
  simulation: {
616
676
  state: { customData: 'value' }