@series-inc/venus-sdk 2.6.2 → 3.0.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/README.md +131 -95
- package/dist/{AdsApi-C_GcWmfO.d.mts → AdsApi-CNGRf6j0.d.mts} +524 -60
- package/dist/{AdsApi-C_GcWmfO.d.ts → AdsApi-CNGRf6j0.d.ts} +524 -60
- package/dist/{chunk-YDXFZ2A2.mjs → chunk-354W7EXH.mjs} +1725 -106
- package/dist/chunk-354W7EXH.mjs.map +1 -0
- package/dist/index.cjs +1987 -330
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +208 -359
- package/dist/index.d.ts +208 -359
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +512 -307
- package/dist/venus-api/index.cjs.map +1 -1
- package/dist/venus-api/index.d.mts +2 -2
- package/dist/venus-api/index.d.ts +2 -2
- package/dist/venus-api/index.mjs +13 -1423
- package/dist/venus-api/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-YDXFZ2A2.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ await VenusAPI.initializeAsync()
|
|
|
31
31
|
### Profile API
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
// Get current user profile
|
|
35
|
-
const profile =
|
|
34
|
+
// Get current user profile (synchronous)
|
|
35
|
+
const profile = VenusAPI.profile.getCurrentProfile()
|
|
36
36
|
console.log(profile.name, profile.username)
|
|
37
37
|
```
|
|
38
38
|
---
|
|
@@ -90,27 +90,45 @@ if (rewardEarned) {
|
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
// Trigger haptic feedback
|
|
93
|
-
await VenusAPI.haptics.
|
|
94
|
-
await VenusAPI.haptics.
|
|
95
|
-
await
|
|
96
|
-
await
|
|
97
|
-
await VenusAPI.haptics.
|
|
98
|
-
|
|
93
|
+
await VenusAPI.haptics.triggerHapticAsync('success')
|
|
94
|
+
await VenusAPI.haptics.triggerHapticAsync('warning')
|
|
95
|
+
await VenusAPI.haptics.triggerHapticAsync('error')
|
|
96
|
+
await VenusAPI.haptics.triggerHapticAsync('light')
|
|
97
|
+
await VenusAPI.haptics.triggerHapticAsync('medium')
|
|
98
|
+
await VenusAPI.haptics.triggerHapticAsync('heavy')
|
|
99
99
|
```
|
|
100
100
|
---
|
|
101
101
|
|
|
102
102
|
### Local Notifications API
|
|
103
103
|
|
|
104
104
|
```typescript
|
|
105
|
-
// Schedule a delayed notification
|
|
106
|
-
const id = await VenusApi.notifications.scheduleAsync(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
// Schedule a delayed notification (minimal - required params only)
|
|
106
|
+
const id = await VenusApi.notifications.scheduleAsync(
|
|
107
|
+
'Notification Title',
|
|
108
|
+
'Notification Body',
|
|
109
|
+
60 // Delay in seconds
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
// Schedule with optional notification ID
|
|
113
|
+
const id = await VenusApi.notifications.scheduleAsync(
|
|
114
|
+
'Notification Title',
|
|
115
|
+
'Notification Body',
|
|
116
|
+
60,
|
|
117
|
+
'custom-notification-id'
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
// Schedule with all optional settings
|
|
121
|
+
const id = await VenusApi.notifications.scheduleAsync(
|
|
122
|
+
'Notification Title',
|
|
123
|
+
'Notification Body',
|
|
124
|
+
60,
|
|
125
|
+
'custom-notification-id',
|
|
126
|
+
{
|
|
127
|
+
priority: 100, // 0-100, default 50
|
|
128
|
+
groupId: 'reminders', // Group related notifications
|
|
129
|
+
payload: { key: 'value' } // Custom data
|
|
130
|
+
}
|
|
131
|
+
)
|
|
114
132
|
|
|
115
133
|
// Cancel a notification
|
|
116
134
|
await VenusApi.notifications.cancelNotification(notificationId)
|
|
@@ -156,13 +174,7 @@ The preloader is opt-in by default. In order to opt in, you must add
|
|
|
156
174
|
// get VBucks/Hard Currency balance
|
|
157
175
|
await VenusApi.iap.getHardCurrencyBalance()
|
|
158
176
|
// Spend VBucks/Hard Currency
|
|
159
|
-
await VenusApi.iap.spendCurrency(
|
|
160
|
-
productId: 'yourProductID',
|
|
161
|
-
amount: '3',
|
|
162
|
-
options?: {
|
|
163
|
-
screenname: 'yourScreenName'
|
|
164
|
-
},
|
|
165
|
-
})
|
|
177
|
+
await VenusApi.iap.spendCurrency('yourProductID', 3)
|
|
166
178
|
// Open Venus Store
|
|
167
179
|
await VenusApi.iap.openStore()
|
|
168
180
|
// Get Currency Icon
|
|
@@ -263,24 +275,26 @@ await VenusAPI.simulation.triggerRecipeChainAsync('battle_complete')
|
|
|
263
275
|
|
|
264
276
|
```typescript
|
|
265
277
|
// Check requirements for a single recipe
|
|
266
|
-
const requirements = await VenusAPI.simulation.getRecipeRequirementsAsync(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
// Returns: {
|
|
278
|
+
const requirements = await VenusAPI.simulation.getRecipeRequirementsAsync(
|
|
279
|
+
'craft_sword',
|
|
280
|
+
'player',
|
|
281
|
+
1
|
|
282
|
+
)
|
|
283
|
+
// Returns: { recipeId, entity, amount?, inputs, canAfford, disabled }
|
|
272
284
|
|
|
273
285
|
// Batch check multiple recipes
|
|
274
286
|
const results = await VenusAPI.simulation.getBatchRecipeRequirementsAsync([
|
|
275
|
-
{ recipeId: 'craft_sword',
|
|
276
|
-
{ recipeId: 'craft_shield',
|
|
287
|
+
{ recipeId: 'craft_sword', batchAmount: 1 },
|
|
288
|
+
{ recipeId: 'craft_shield', batchAmount: 2 }
|
|
277
289
|
])
|
|
290
|
+
// Returns: { success, results, errors? }
|
|
278
291
|
|
|
279
292
|
// Get available recipes
|
|
280
293
|
const recipes = await VenusAPI.simulation.getAvailableRecipesAsync({
|
|
281
294
|
roomId: 'room_123',
|
|
282
295
|
includeActorRecipes: true
|
|
283
296
|
})
|
|
297
|
+
// Returns: { success, recipes }
|
|
284
298
|
```
|
|
285
299
|
|
|
286
300
|
#### Slot Management
|
|
@@ -363,20 +377,20 @@ Three-tier storage system with different data scopes:
|
|
|
363
377
|
|
|
364
378
|
```typescript
|
|
365
379
|
// Device Cache - persists across all apps for the device
|
|
366
|
-
await VenusAPI.deviceCache.
|
|
367
|
-
const userId = await VenusAPI.deviceCache.
|
|
380
|
+
await VenusAPI.deviceCache.setItem('lastUserId', '12345')
|
|
381
|
+
const userId = await VenusAPI.deviceCache.getItem('lastUserId')
|
|
368
382
|
|
|
369
383
|
// App Storage - app-specific persistent storage
|
|
370
|
-
await VenusAPI.appStorage.
|
|
371
|
-
await VenusAPI.appStorage.
|
|
384
|
+
await VenusAPI.appStorage.setItem('highScore', JSON.stringify(1000))
|
|
385
|
+
await VenusAPI.appStorage.setItem('playerData', JSON.stringify({ level: 5, gold: 1000 }))
|
|
372
386
|
|
|
373
387
|
// Global Storage - shared across all apps for the user
|
|
374
|
-
await VenusAPI.globalStorage.
|
|
388
|
+
await VenusAPI.globalStorage.setItem('preferences', JSON.stringify({ theme: 'dark' }))
|
|
375
389
|
|
|
376
390
|
// All storage APIs support:
|
|
377
|
-
const value = await storage.
|
|
378
|
-
await storage.
|
|
379
|
-
await storage.
|
|
391
|
+
const value = await storage.getItem(key)
|
|
392
|
+
await storage.setItem(key, value)
|
|
393
|
+
await storage.removeItem(key)
|
|
380
394
|
await storage.clear()
|
|
381
395
|
const count = await storage.length()
|
|
382
396
|
const keyName = await storage.key(index)
|
|
@@ -398,34 +412,35 @@ await VenusAPI.popups.showToast('Game saved!', {
|
|
|
398
412
|
})
|
|
399
413
|
|
|
400
414
|
// Alert dialog
|
|
401
|
-
await VenusAPI.popups.showAlert(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
buttonText: 'OK'
|
|
405
|
-
|
|
415
|
+
await VenusAPI.popups.showAlert(
|
|
416
|
+
'Warning',
|
|
417
|
+
'This action cannot be undone',
|
|
418
|
+
{ buttonText: 'OK' }
|
|
419
|
+
)
|
|
406
420
|
|
|
407
421
|
// Confirm dialog
|
|
408
|
-
const confirmed = await VenusAPI.popups.showConfirm(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
confirmText: 'Delete',
|
|
412
|
-
|
|
413
|
-
})
|
|
422
|
+
const confirmed = await VenusAPI.popups.showConfirm(
|
|
423
|
+
'Delete Item',
|
|
424
|
+
'Are you sure you want to delete this item?',
|
|
425
|
+
{ confirmText: 'Delete', cancelText: 'Cancel' }
|
|
426
|
+
)
|
|
414
427
|
|
|
415
428
|
if (confirmed) {
|
|
416
429
|
// User confirmed
|
|
417
430
|
}
|
|
418
431
|
|
|
419
432
|
// Action sheet
|
|
420
|
-
const selected = await VenusAPI.popups.showActionSheet(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
{ id: '
|
|
424
|
-
{ id: '
|
|
425
|
-
{ id: 'delete', label: 'Delete', variant: 'destructive' }
|
|
433
|
+
const selected = await VenusAPI.popups.showActionSheet(
|
|
434
|
+
[
|
|
435
|
+
{ id: 'edit', label: 'Edit' },
|
|
436
|
+
{ id: 'share', label: 'Share' },
|
|
437
|
+
{ id: 'delete', label: 'Delete' }
|
|
426
438
|
],
|
|
427
|
-
|
|
428
|
-
|
|
439
|
+
{
|
|
440
|
+
title: 'Choose Action',
|
|
441
|
+
cancelButtonText: 'Cancel'
|
|
442
|
+
}
|
|
443
|
+
)
|
|
429
444
|
|
|
430
445
|
if (selected === 'delete') {
|
|
431
446
|
// User selected delete
|
|
@@ -439,18 +454,17 @@ if (selected === 'delete') {
|
|
|
439
454
|
Stack-based navigation system:
|
|
440
455
|
|
|
441
456
|
```typescript
|
|
442
|
-
// Get current stack information
|
|
443
|
-
const stack =
|
|
444
|
-
// Returns: {
|
|
457
|
+
// Get current stack information (synchronous)
|
|
458
|
+
const stack = VenusAPI.navigation.getStackInfo()
|
|
459
|
+
// Returns: { isInStack, stackPosition, isTopOfStack, stackDepth, parentInstanceId }
|
|
445
460
|
|
|
446
461
|
// Push new app to stack
|
|
447
|
-
await VenusAPI.navigation.
|
|
448
|
-
|
|
449
|
-
context: { level: 5, difficulty: 'hard' }
|
|
462
|
+
await VenusAPI.navigation.pushApp('bird-flap', {
|
|
463
|
+
contextData: { level: 5, difficulty: 'hard' }
|
|
450
464
|
})
|
|
451
465
|
|
|
452
466
|
// Pop from stack (returns to previous app)
|
|
453
|
-
await VenusAPI.navigation.
|
|
467
|
+
await VenusAPI.navigation.popApp()
|
|
454
468
|
```
|
|
455
469
|
|
|
456
470
|
---
|
|
@@ -461,23 +475,27 @@ Social interaction APIs for posts:
|
|
|
461
475
|
|
|
462
476
|
```typescript
|
|
463
477
|
// Get post interaction data
|
|
464
|
-
const
|
|
465
|
-
// Returns: {
|
|
478
|
+
const postInfo = await VenusAPI.post.getPostInfo()
|
|
479
|
+
// Returns: { isLiked, isFollowing, likesCount, commentsCount }
|
|
466
480
|
|
|
467
481
|
// Toggle like
|
|
468
|
-
await VenusAPI.post.
|
|
482
|
+
const likeResult = await VenusAPI.post.toggleLikeAsync()
|
|
483
|
+
// Returns: { isLiked, likesCount, action: 'liked' | 'unliked' }
|
|
469
484
|
|
|
470
485
|
// Toggle follow
|
|
471
|
-
await VenusAPI.post.
|
|
486
|
+
const followResult = await VenusAPI.post.toggleFollowAsync()
|
|
487
|
+
// Returns: { isFollowing, action: 'followed' | 'unfollowed' }
|
|
472
488
|
|
|
473
489
|
// Open comments UI
|
|
474
|
-
await VenusAPI.post.
|
|
490
|
+
const commentsResult = await VenusAPI.post.openCommentsAsync()
|
|
491
|
+
// Returns: { opened, commentsCount }
|
|
475
492
|
|
|
476
493
|
// Share post
|
|
477
|
-
await VenusAPI.post.
|
|
494
|
+
const shareResult = await VenusAPI.post.sharePostAsync({
|
|
478
495
|
message: 'Check this out!',
|
|
479
|
-
|
|
496
|
+
title: 'My Post'
|
|
480
497
|
})
|
|
498
|
+
// Returns: { shared, platform, customMessage? }
|
|
481
499
|
```
|
|
482
500
|
|
|
483
501
|
---
|
|
@@ -501,27 +519,32 @@ await VenusAPI.analytics.setUserProperty('vip_status', 'gold')
|
|
|
501
519
|
### Avatar 3D API
|
|
502
520
|
|
|
503
521
|
```typescript
|
|
504
|
-
//
|
|
505
|
-
const avatar = await VenusAPI.avatar3d.
|
|
522
|
+
// Load current avatar configuration
|
|
523
|
+
const avatar = await VenusAPI.avatar3d.loadAvatar()
|
|
524
|
+
// Or load a specific avatar
|
|
525
|
+
const avatarConfig = await VenusAPI.avatar3d.loadAvatar('avatar_123')
|
|
506
526
|
|
|
507
527
|
// Show avatar editor
|
|
508
528
|
const result = await VenusAPI.avatar3d.showEditor({
|
|
509
|
-
|
|
510
|
-
|
|
529
|
+
currentAvatar: avatarConfig,
|
|
530
|
+
contextData: { source: 'settings' }
|
|
511
531
|
})
|
|
512
532
|
|
|
513
|
-
if (result.
|
|
514
|
-
console.log('Avatar updated:', result.
|
|
533
|
+
if (result.wasChanged && result.savedAvatarId) {
|
|
534
|
+
console.log('Avatar updated:', result.savedAvatarId)
|
|
515
535
|
}
|
|
516
536
|
|
|
517
|
-
//
|
|
518
|
-
await VenusAPI.avatar3d.
|
|
537
|
+
// Save avatar
|
|
538
|
+
const avatarId = await VenusAPI.avatar3d.saveAvatar(avatarConfig)
|
|
519
539
|
|
|
520
|
-
//
|
|
521
|
-
|
|
540
|
+
// Delete avatar
|
|
541
|
+
await VenusAPI.avatar3d.deleteAvatar()
|
|
522
542
|
|
|
523
543
|
// Download avatar manifest
|
|
524
|
-
const manifest = await VenusAPI.avatar3d.downloadManifest(
|
|
544
|
+
const manifest = await VenusAPI.avatar3d.downloadManifest()
|
|
545
|
+
|
|
546
|
+
// Download asset paths
|
|
547
|
+
const assetPaths = await VenusAPI.avatar3d.downloadAssetPaths()
|
|
525
548
|
```
|
|
526
549
|
|
|
527
550
|
---
|
|
@@ -556,21 +579,28 @@ Server time synchronization and formatting:
|
|
|
556
579
|
|
|
557
580
|
```typescript
|
|
558
581
|
// Get server time
|
|
559
|
-
const
|
|
560
|
-
// Returns: {
|
|
582
|
+
const serverTimeData = await VenusAPI.time.requestTimeAsync()
|
|
583
|
+
// Returns: { serverTime, localTime, timezoneOffset, formattedTime, locale }
|
|
561
584
|
|
|
562
585
|
// Format time with locale
|
|
563
|
-
const formatted = VenusAPI.time.
|
|
586
|
+
const formatted = VenusAPI.time.formatTime(Date.now(), {
|
|
564
587
|
locale: 'en-US',
|
|
565
588
|
format: 'full' // 'full', 'long', 'medium', 'short'
|
|
566
589
|
})
|
|
567
590
|
|
|
568
591
|
// Format number with locale
|
|
569
|
-
const
|
|
592
|
+
const formattedNumber = VenusAPI.time.formatNumber(1234567.89, {
|
|
570
593
|
locale: 'en-US',
|
|
571
594
|
style: 'currency',
|
|
572
595
|
currency: 'USD'
|
|
573
596
|
})
|
|
597
|
+
|
|
598
|
+
// Get future time
|
|
599
|
+
const futureTime = await VenusAPI.time.getFutureTimeAsync({
|
|
600
|
+
days: 1,
|
|
601
|
+
hours: 2,
|
|
602
|
+
minutes: 30
|
|
603
|
+
})
|
|
574
604
|
```
|
|
575
605
|
|
|
576
606
|
---
|
|
@@ -578,11 +608,17 @@ const formatted = VenusAPI.time.formatNumber(1234567.89, {
|
|
|
578
608
|
### CDN API
|
|
579
609
|
|
|
580
610
|
```typescript
|
|
581
|
-
//
|
|
582
|
-
const
|
|
611
|
+
// Resolve asset URLs (synchronous)
|
|
612
|
+
const assetUrl = VenusAPI.cdn.resolveAssetUrl('images/logo.png')
|
|
613
|
+
const avatarUrl = VenusAPI.cdn.resolveAvatarAssetUrl('avatars/model.glb')
|
|
614
|
+
const libUrl = VenusAPI.cdn.resolveSharedLibUrl('libs/helper.js')
|
|
615
|
+
|
|
616
|
+
// Get CDN base URL
|
|
617
|
+
const baseUrl = VenusAPI.cdn.getAssetCdnBaseUrl()
|
|
583
618
|
|
|
584
|
-
//
|
|
585
|
-
const
|
|
619
|
+
// Fetch from CDN
|
|
620
|
+
const response = await VenusAPI.cdn.fetchFromCdn('https://cdn.example.com/file.json')
|
|
621
|
+
const blob = await VenusAPI.cdn.fetchBlob('path/to/asset.png')
|
|
586
622
|
```
|
|
587
623
|
|
|
588
624
|
---
|
|
@@ -592,15 +628,15 @@ const uploadUrl = await VenusAPI.cdn.upload(file)
|
|
|
592
628
|
Feature flags, experiments, and A/B testing:
|
|
593
629
|
|
|
594
630
|
```typescript
|
|
595
|
-
// Get feature flag value
|
|
631
|
+
// Get feature flag value (returns boolean)
|
|
596
632
|
const enabled = await VenusAPI.features.getFeatureFlag('new_ui_enabled')
|
|
597
633
|
|
|
598
|
-
// Get feature gate (boolean
|
|
634
|
+
// Get feature gate (returns boolean)
|
|
599
635
|
const canAccess = await VenusAPI.features.getFeatureGate('beta_features')
|
|
600
636
|
|
|
601
637
|
// Get experiment variant
|
|
602
638
|
const experiment = await VenusAPI.features.getExperiment('checkout_flow')
|
|
603
|
-
// Returns: {
|
|
639
|
+
// Returns: { name, ruleID, value, groupName } | null
|
|
604
640
|
```
|
|
605
641
|
|
|
606
642
|
### Lifecycle API
|