@series-inc/rundot-game-sdk 5.3.0 → 5.3.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 +32 -32
- package/dist/{AdsApi-Btyr54oN.d.ts → AdsApi-D24CnsBw.d.ts} +100 -2
- package/dist/{chunk-CJU2J3S6.js → chunk-3GKY3LY5.js} +2 -2
- package/dist/chunk-3GKY3LY5.js.map +1 -0
- package/dist/{chunk-FIVOMIFY.js → chunk-GE4GZ6CH.js} +12 -11
- package/dist/chunk-GE4GZ6CH.js.map +1 -0
- package/dist/{chunk-SRXN4OKZ.js → chunk-HU7Z7SGX.js} +294 -10
- package/dist/chunk-HU7Z7SGX.js.map +1 -0
- package/dist/chunk-KJQHROY6.js +12 -0
- package/dist/chunk-KJQHROY6.js.map +1 -0
- package/dist/core-6DQFSOBL.js +3 -0
- package/dist/{core-Z4AOFL5J.js.map → core-6DQFSOBL.js.map} +1 -1
- package/dist/index.d.ts +41 -6
- package/dist/index.js +4 -4
- package/dist/rundot-game-api/index.d.ts +12 -12
- package/dist/rundot-game-api/index.js +7 -5
- package/dist/rundot-game-api/index.js.map +1 -1
- package/dist/sandbox/index.js +4 -2
- package/dist/sandbox/index.js.map +1 -1
- package/dist/vite/index.css +1 -1
- package/dist/vite/index.css.map +1 -1
- package/dist/vite/index.js +2 -2
- package/dist/vite/index.js.map +1 -1
- package/dist/webview/index.js +1 -1
- package/package.json +84 -84
- package/scripts/postinstall.mjs +377 -377
- package/dist/chunk-7J5IQAUF.js +0 -12
- package/dist/chunk-7J5IQAUF.js.map +0 -1
- package/dist/chunk-CJU2J3S6.js.map +0 -1
- package/dist/chunk-FIVOMIFY.js.map +0 -1
- package/dist/chunk-SRXN4OKZ.js.map +0 -1
- package/dist/core-Z4AOFL5J.js +0 -3
package/README.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
# RUN.game SDK API
|
|
2
|
-
|
|
3
|
-
Build connected HTML5 games that integrate deeply with the RUN.game platform. This package provides the client SDK used by hosted games as well as the local mock environment for development.
|
|
4
|
-
|
|
5
|
-
## Highlights
|
|
6
|
-
|
|
7
|
-
- Typed APIs for RUN.game platform services (simulation, rooms, analytics, ads, and more)
|
|
8
|
-
- Host-aware tooling including lifecycle hooks, safe-area utilities, and asset loading helpers
|
|
9
|
-
|
|
10
|
-
## Quick Start
|
|
11
|
-
|
|
12
|
-
### Installation
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install @series-inc/rundot-game-sdk@latest
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Initialize
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
import { default as RundotGameAPI } from '@series-inc/rundot-game-sdk/api'
|
|
22
|
-
|
|
23
|
-
// Initialize the API
|
|
24
|
-
await RundotGameAPI.initializeAsync()
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Documentation
|
|
28
|
-
|
|
29
|
-
The complete RUN.game SDK manuals live on [Run.game Docs](https://series-1.gitbook.io/getreel-docs). Start there for setup guides, API references, tutorials, and best practices.
|
|
30
|
-
|
|
31
|
-
## Support & Links
|
|
32
|
-
|
|
1
|
+
# RUN.game SDK API
|
|
2
|
+
|
|
3
|
+
Build connected HTML5 games that integrate deeply with the RUN.game platform. This package provides the client SDK used by hosted games as well as the local mock environment for development.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Typed APIs for RUN.game platform services (simulation, rooms, analytics, ads, and more)
|
|
8
|
+
- Host-aware tooling including lifecycle hooks, safe-area utilities, and asset loading helpers
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
### Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @series-inc/rundot-game-sdk@latest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Initialize
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { default as RundotGameAPI } from '@series-inc/rundot-game-sdk/api'
|
|
22
|
+
|
|
23
|
+
// Initialize the API
|
|
24
|
+
await RundotGameAPI.initializeAsync()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
The complete RUN.game SDK manuals live on [Run.game Docs](https://series-1.gitbook.io/getreel-docs). Start there for setup guides, API references, tutorials, and best practices.
|
|
30
|
+
|
|
31
|
+
## Support & Links
|
|
32
|
+
|
|
33
33
|
- [Join our Discord!](https://discord.gg/NcjhKQHx)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface AnalyticsApi {
|
|
2
2
|
recordCustomEvent(eventName: string, payload?: Record<string, any>): Promise<void>;
|
|
3
|
-
trackFunnelStep(stepNumber: number, stepName: string, funnelName?: string): Promise<void>;
|
|
3
|
+
trackFunnelStep(stepNumber: number, stepName: string, funnelName?: string, funnelOrder?: number): Promise<void>;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
interface RpcRequest {
|
|
@@ -967,6 +967,35 @@ interface LoadEmbeddedAssetsResponse {
|
|
|
967
967
|
base64Data: string;
|
|
968
968
|
}
|
|
969
969
|
|
|
970
|
+
interface SubscriptionStatusResponse {
|
|
971
|
+
subscriptionName: string;
|
|
972
|
+
store: string;
|
|
973
|
+
}
|
|
974
|
+
declare enum PackageType {
|
|
975
|
+
ANNUAL = "annual",
|
|
976
|
+
CUSTOM = "custom",
|
|
977
|
+
LIFETIME = "lifetime",
|
|
978
|
+
MONTHLY = "monthly",
|
|
979
|
+
SIX_MONTH = "six_month",
|
|
980
|
+
THREE_MONTH = "three_month",
|
|
981
|
+
TWO_MONTH = "two_month",
|
|
982
|
+
UNKNOWN = "unknown",
|
|
983
|
+
WEEKLY = "weekly"
|
|
984
|
+
}
|
|
985
|
+
interface IapSubscription {
|
|
986
|
+
offeringId: string;
|
|
987
|
+
productId: string;
|
|
988
|
+
packageType: PackageType;
|
|
989
|
+
currencyCode: string;
|
|
990
|
+
description: string;
|
|
991
|
+
price: number;
|
|
992
|
+
pricePerMonth: number | null;
|
|
993
|
+
pricePerWeek: number | null;
|
|
994
|
+
pricePerYear: number | null;
|
|
995
|
+
}
|
|
996
|
+
interface PurchaseResponse {
|
|
997
|
+
success: boolean;
|
|
998
|
+
}
|
|
970
999
|
interface SpendCurrencyOptions {
|
|
971
1000
|
screenName?: string;
|
|
972
1001
|
}
|
|
@@ -981,6 +1010,9 @@ interface IapApi {
|
|
|
981
1010
|
spendCurrency(productId: string, amount: number, options?: SpendCurrencyOptions): Promise<void>;
|
|
982
1011
|
openStore(): Promise<OpenStoreResult>;
|
|
983
1012
|
getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
|
|
1013
|
+
getUserSubscriptionStatus(subscriptionName: string): Promise<SubscriptionStatusResponse | null>;
|
|
1014
|
+
getSubscriptionsForOffering(offeringName: string): Promise<IapSubscription[]>;
|
|
1015
|
+
purchaseSubscriptionFromOffering(offeringName: string, productId: string): Promise<PurchaseResponse>;
|
|
984
1016
|
}
|
|
985
1017
|
|
|
986
1018
|
interface LeaderboardModeConfig {
|
|
@@ -1335,6 +1367,68 @@ interface ImageGenApi {
|
|
|
1335
1367
|
generate(params: ImageGenParams): Promise<ImageGenResult>;
|
|
1336
1368
|
}
|
|
1337
1369
|
|
|
1370
|
+
interface Entitlement {
|
|
1371
|
+
entitlementId: string;
|
|
1372
|
+
userId: string;
|
|
1373
|
+
gameId: string;
|
|
1374
|
+
itemId: string;
|
|
1375
|
+
quantity: number;
|
|
1376
|
+
consumable: boolean;
|
|
1377
|
+
status: 'active' | 'revoked' | 'expired';
|
|
1378
|
+
expiresAt: number | null;
|
|
1379
|
+
createdAt: number;
|
|
1380
|
+
updatedAt: number;
|
|
1381
|
+
revokedAt: number | null;
|
|
1382
|
+
}
|
|
1383
|
+
interface LedgerEntry {
|
|
1384
|
+
ledgerId: string;
|
|
1385
|
+
userId: string;
|
|
1386
|
+
gameId: string;
|
|
1387
|
+
itemId: string;
|
|
1388
|
+
change: number;
|
|
1389
|
+
action: 'grant' | 'consume' | 'revoke' | 'expire';
|
|
1390
|
+
source: string;
|
|
1391
|
+
referenceId: string;
|
|
1392
|
+
reason: string | null;
|
|
1393
|
+
createdAt: number;
|
|
1394
|
+
balanceAfter: number;
|
|
1395
|
+
}
|
|
1396
|
+
interface EntitlementApi {
|
|
1397
|
+
/** Get all active entitlements for the current game */
|
|
1398
|
+
listEntitlements(): Promise<Entitlement[]>;
|
|
1399
|
+
/** Get current quantity for a specific item */
|
|
1400
|
+
getQuantity(itemId: string): Promise<number>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Consume quantity from a consumable entitlement.
|
|
1403
|
+
*
|
|
1404
|
+
* A unique referenceId is generated internally for idempotency unless one is
|
|
1405
|
+
* provided. If a callback is supplied it is invoked exactly once on success
|
|
1406
|
+
* with the resulting entitlement and the referenceId that was used. If the
|
|
1407
|
+
* callback throws, the error is logged as a warning and the entitlement is
|
|
1408
|
+
* still returned.
|
|
1409
|
+
*
|
|
1410
|
+
* **Retry pattern** – make the first call without a referenceId and capture
|
|
1411
|
+
* it in the callback. If the callback or any post-consume work fails, retry
|
|
1412
|
+
* with the same referenceId so the server treats the request as idempotent:
|
|
1413
|
+
*
|
|
1414
|
+
* ```ts
|
|
1415
|
+
* let savedRefId: string | undefined
|
|
1416
|
+
* try {
|
|
1417
|
+
* await api.consumeEntitlement('coins', 10, (_ent, refId) => {
|
|
1418
|
+
* savedRefId = refId
|
|
1419
|
+
* riskyOperation() // may throw
|
|
1420
|
+
* })
|
|
1421
|
+
* } catch {
|
|
1422
|
+
* // retry with the same referenceId – the server won't double-consume
|
|
1423
|
+
* await api.consumeEntitlement('coins', 10, undefined, undefined, savedRefId)
|
|
1424
|
+
* }
|
|
1425
|
+
* ```
|
|
1426
|
+
*/
|
|
1427
|
+
consumeEntitlement(itemId: string, quantity: number, callback?: (entitlement: Entitlement, referenceId: string) => void | Promise<void>, reason?: string, referenceId?: string): Promise<Entitlement>;
|
|
1428
|
+
/** Get ledger entries (audit trail) */
|
|
1429
|
+
getLedger(itemId?: string, limit?: number, startAfter?: number): Promise<LedgerEntry[]>;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1338
1432
|
/**
|
|
1339
1433
|
* Safe area insets representing padding needed to avoid device notches and host UI.
|
|
1340
1434
|
* Includes toolbar/feedHeader height + device safe areas.
|
|
@@ -1356,6 +1450,7 @@ interface InitializationOptions {
|
|
|
1356
1450
|
usePreloader?: boolean;
|
|
1357
1451
|
launchParams?: Record<string, string>;
|
|
1358
1452
|
shareParams?: Record<string, string>;
|
|
1453
|
+
notificationParams?: Record<string, string>;
|
|
1359
1454
|
}
|
|
1360
1455
|
interface InitializationContext {
|
|
1361
1456
|
/**
|
|
@@ -1366,6 +1461,7 @@ interface InitializationContext {
|
|
|
1366
1461
|
initializeAsleep: boolean;
|
|
1367
1462
|
launchParams?: Record<string, string>;
|
|
1368
1463
|
shareParams?: Record<string, string>;
|
|
1464
|
+
notificationParams?: Record<string, string>;
|
|
1369
1465
|
}
|
|
1370
1466
|
interface Host {
|
|
1371
1467
|
readonly ads: AdsApi;
|
|
@@ -1393,6 +1489,7 @@ interface Host {
|
|
|
1393
1489
|
readonly preloader: PreloaderApi;
|
|
1394
1490
|
readonly social: SocialApi;
|
|
1395
1491
|
readonly imageGen: ImageGenApi;
|
|
1492
|
+
readonly entitlements: EntitlementApi;
|
|
1396
1493
|
readonly isInitialized: boolean;
|
|
1397
1494
|
readonly iap: IapApi;
|
|
1398
1495
|
readonly context?: InitializationContext;
|
|
@@ -1834,6 +1931,7 @@ interface RundotGameAPI {
|
|
|
1834
1931
|
lifecycles: LifecycleApi;
|
|
1835
1932
|
social: SocialApi;
|
|
1836
1933
|
imageGen: ImageGenApi;
|
|
1934
|
+
entitlements: EntitlementApi;
|
|
1837
1935
|
context: InitializationContext;
|
|
1838
1936
|
}
|
|
1839
1937
|
|
|
@@ -1851,4 +1949,4 @@ interface AdsApi {
|
|
|
1851
1949
|
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
1852
1950
|
}
|
|
1853
1951
|
|
|
1854
|
-
export { type AiChatCompletionRequest as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type ScheduleLocalNotification as C, type ScheduleNotificationOptions as D, type PopupsApi as E, type ShowToastOptions as F, type ShowInterstitialAdOptions as G, type Host as H, type ShowRewardedAdOptions as I, type ProfileApi as J, type DeviceApi as K, type DeviceInfo as L, type EnvironmentApi as M, type NavigationApi as N, type EnvironmentInfo as O, type Profile as P, type QuitOptions as Q, type RundotGameAPI as R, type SimulationRunSummary as S, type SystemApi as T, type SafeArea as U, type CdnApi as V, type FetchFromCdnOptions as W, type TimeApi as X, type ServerTimeData as Y, type GetFutureTimeOptions as Z, type AiApi as _, type RecipeRequirementResult as a, type
|
|
1952
|
+
export { type AiChatCompletionRequest as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type ScheduleLocalNotification as C, type ScheduleNotificationOptions as D, type PopupsApi as E, type ShowToastOptions as F, type ShowInterstitialAdOptions as G, type Host as H, type ShowRewardedAdOptions as I, type ProfileApi as J, type DeviceApi as K, type DeviceInfo as L, type EnvironmentApi as M, type NavigationApi as N, type EnvironmentInfo as O, type Profile as P, type QuitOptions as Q, type RundotGameAPI as R, type SimulationRunSummary as S, type SystemApi as T, type SafeArea as U, type CdnApi as V, type FetchFromCdnOptions as W, type TimeApi as X, type ServerTimeData as Y, type GetFutureTimeOptions as Z, type AiApi as _, type RecipeRequirementResult as a, type SubmitScoreParams as a$, type AiChatCompletionData as a0, type HapticsApi as a1, HapticFeedbackStyle as a2, type FeaturesApi as a3, type Experiment as a4, type LifecycleApi as a5, type SleepCallback as a6, type Subscription as a7, type AwakeCallback as a8, type PauseCallback as a9, type RoomMessageEvent as aA, type ProposedMoveEvent as aB, RundotGameTransport as aC, type RoomsApi as aD, type CreateRoomOptions as aE, type JoinOrCreateRoomOptions as aF, type JoinOrCreateResult as aG, type ListRoomsOptions as aH, type UpdateRoomDataOptions as aI, type RoomMessageRequest as aJ, type StartRoomGameOptions as aK, type ProposeMoveRequest as aL, type ProposeMoveResult as aM, type ValidateMoveVerdict as aN, type ValidateMoveResult as aO, type RoomSubscriptionOptions as aP, type LoggingApi as aQ, type IapApi as aR, type SpendCurrencyOptions as aS, type OpenStoreResult as aT, type LoadEmbeddedAssetsResponse as aU, type SubscriptionStatusResponse as aV, type IapSubscription as aW, type PurchaseResponse as aX, type SharedAssetsApi as aY, type LeaderboardApi as aZ, type ScoreToken as a_, type ResumeCallback as aa, type QuitCallback as ab, type SimulationApi as ac, type SimulationSlotValidationResult as ad, type SimulationBatchOperation as ae, type SimulationBatchOperationsResult as af, type SimulationAvailableItem as ag, type SimulationPowerPreview as ah, type SimulationSlotMutationResult as ai, type SimulationSlotContainer as aj, type SimulationAssignment as ak, type SimulationState as al, type ExecuteRecipeOptions as am, type ExecuteRecipeResponse as an, type CollectRecipeResult as ao, type ResetStateOptions as ap, type ResetStateResult as aq, type GetActiveRunsOptions as ar, type ExecuteScopedRecipeOptions as as, type ExecuteScopedRecipeResult as at, type GetAvailableRecipesOptions as au, type GetAvailableRecipesResult as av, type Recipe as aw, type GetBatchRecipeRequirements as ax, type TriggerRecipeChainOptions as ay, type RoomDataUpdate as az, type RundotGameSimulationStateResponse as b, type LeaderboardPeriodType as b$, type SubmitScoreResult as b0, type GetPagedScoresOptions as b1, type PagedScoresResponse as b2, type PlayerRankOptions as b3, type PlayerRankResult as b4, type GetPodiumScoresOptions as b5, type PodiumScoresResponse as b6, type PreloaderApi as b7, type SocialApi as b8, type ShareMetadata as b9, type OnRequestCallback as bA, type OnResponseCallback as bB, type OnNotificationCallback as bC, type RpcTransport as bD, type JoinRoomMatchCriteria as bE, type RoomMessageEventType as bF, type RoomMessagePayload as bG, type ProposedMovePayload as bH, ROOM_GAME_PHASES as bI, type RoomGamePhase as bJ, type RundotGameRoomRulesGameState as bK, type RundotGameRoomRules as bL, type RundotGameRoomCustomMetadata as bM, type RundotGameRoomPayload as bN, type RoomEnvelopeResponse as bO, type RoomsEnvelopeResponse as bP, type JoinOrCreateRoomEnvelopeResponse as bQ, type RecipeInfo as bR, type SimulationPersonalState as bS, type SimulationRoomActiveRecipe as bT, type SimulationRoomState as bU, type SimulationBatchOperationAssign as bV, type SimulationBatchOperationRemove as bW, type SimulationBatchOperationResult as bX, RpcSharedAssetsApi as bY, type LoadEmbeddedAssetsRequest as bZ, type LeaderboardModeConfig as b_, type ShareLinkResult as ba, type SocialQRCodeOptions as bb, type QRCodeResult as bc, type EntitlementApi as bd, type Entitlement as be, type LedgerEntry as bf, type Avatar3dApi as bg, type AssetManifest as bh, type Avatar3dConfig as bi, type ShowEditorOptions as bj, type Avatar3dEdits as bk, type AdsApi as bl, type ImageGenApi as bm, type ImageGenParams as bn, type ImageGenResult as bo, type UgcApi as bp, type InitializationContext as bq, type InitializationOptions as br, type AiMessage as bs, type Asset as bt, type Category as bu, MockAvatarApi as bv, type SubPath as bw, PackageType as bx, type TimeIntervalTriggerInput as by, type NotificationTriggerInput as bz, type SimulationUpdateType as c, type LeaderboardPeriodConfig as c0, type LeaderboardAntiCheatConfig as c1, type LeaderboardDisplaySettings as c2, type LeaderboardConfig as c3, type LeaderboardEntry as c4, type PodiumScoresContext as c5, type HudInsets as c6, createHost as c7, type SimulationEntityUpdate as d, type SimulationActiveRunsUpdate as e, type SimulationSnapshotUpdate as f, type SimulationUpdateData as g, type SimulationSubscribeOptions as h, type RundotGameSimulationEffect as i, type RundotGameSimulationRecipe as j, type RundotGameSimulationConfig as k, type RecipeRequirementQuery as l, type RundotGameExecuteRecipeOptions as m, type RundotGameExecuteScopedRecipeOptions as n, type RundotGameAvailableRecipe as o, type RundotGameCollectRecipeResult as p, type RundotGameExecuteRecipeResult as q, RundotGameRoom as r, type RpcRequest as s, type RpcResponse as t, type RpcNotification as u, RpcClient as v, type StorageApi as w, type NavigationStackInfo as x, type PushAppOptions as y, type NotificationsApi as z };
|
|
@@ -74,5 +74,5 @@ function createMockDelay(ms = MOCK_DELAYS.short) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export { MOCK_DELAYS, createMockDelay, createProxiedMethod, createProxiedObject, isWebPlatform };
|
|
77
|
-
//# sourceMappingURL=chunk-
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
77
|
+
//# sourceMappingURL=chunk-3GKY3LY5.js.map
|
|
78
|
+
//# sourceMappingURL=chunk-3GKY3LY5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rundot-game-api/systems/core.js"],"names":[],"mappings":"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","file":"chunk-3GKY3LY5.js","sourcesContent":["// Core utility functions for the RUN.game API system\n// These functions are used across multiple modules to handle real vs mock API delegation\n\n// Helper function to create proxied methods that delegate to real API when available\nexport function createProxiedMethod(methodName, mockImpl) {\n return function (...args) {\n // For lifecycle handlers (methods that start with 'on'), store them locally\n if (methodName.startsWith('on') && typeof args[0] === 'function') {\n if (!this._bootstrap._localHandlers) {\n this._bootstrap._localHandlers = {}\n }\n\n // Store the handler locally\n this._bootstrap._localHandlers[methodName] = args[0]\n\n // If the real API is available, also register with it\n if (\n this._bootstrap.rundotGame &&\n typeof this._bootstrap.rundotGame[methodName] === 'function'\n ) {\n return this._bootstrap.rundotGame[methodName](...args)\n }\n\n return true\n }\n\n // For all other methods, if the real API is available and has the method, use it\n if (\n this._bootstrap.rundotGame &&\n typeof this._bootstrap.rundotGame[methodName] === 'function'\n ) {\n return this._bootstrap.rundotGame[methodName](...args)\n }\n\n // Otherwise, fall back to the mock implementation\n return mockImpl.apply(this, args)\n }\n}\n\n// Helper function to create proxied objects with methods and getters that delegate to real API\nexport function createProxiedObject(objectName, mockImpl) {\n const self = this // Store reference to 'this' for use in handlers\n\n // Helper to create recursive proxies\n function createNestedProxy(target, realApiPath) {\n const handler = {\n get: function (targetObj, prop, receiver) {\n // If the real API is available, use it\n if (self._bootstrap.rundotGame && realApiPath) {\n // Navigate to the correct path in the real API\n let realApiValue = self._bootstrap.rundotGame\n const pathParts = realApiPath.split('.')\n\n for (const part of pathParts) {\n if (realApiValue && realApiValue[part]) {\n realApiValue = realApiValue[part]\n } else {\n realApiValue = null\n break\n }\n }\n\n if (realApiValue && prop in realApiValue) {\n const realValue = Reflect.get(realApiValue, prop, receiver)\n\n // If the real value is an object (but not a function), create a nested proxy\n if (\n realValue &&\n typeof realValue === 'object' &&\n typeof realValue !== 'function'\n ) {\n return createNestedProxy(realValue, `${realApiPath}.${prop}`)\n }\n\n return realValue\n }\n }\n\n // Otherwise, get from the mock implementation\n const value = Reflect.get(targetObj, prop)\n\n // If it's a method, bind it to the RundotGameAPI instance\n if (typeof value === 'function') {\n return function (...args) {\n return value.apply(self, args)\n }\n }\n\n // If it's an object (but not null or array), create a nested proxy\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n const nestedPath = realApiPath ? `${realApiPath}.${prop}` : prop\n return createNestedProxy(value, nestedPath)\n }\n\n return value\n },\n }\n\n return new Proxy(target, handler)\n }\n\n return createNestedProxy(mockImpl, objectName)\n}\n\n// Helper function to check if we're on web platform (for feature detection)\nexport function isWebPlatform() {\n return typeof window !== 'undefined' && !window.ReactNativeWebView\n}\n\n// Standard mock delay (100ms for most operations, 1000ms for longer ones like ads/AI)\nexport const MOCK_DELAYS = {\n short: 100, // Quick operations (get/set preferences, etc.)\n medium: 500, // Medium operations (network-like calls)\n long: 1000, // Long operations (ads, AI, etc.)\n}\n\n// Centralized mock delay function\nexport function createMockDelay(ms = MOCK_DELAYS.short) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"]}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { RpcAdsApi, RpcAnalyticsApi, RpcStorageApi, RpcAvatarApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, HostProfileApi, HostDeviceApi, HostEnvironmentApi, HostSystemApi, HostCdnApi, HostTimeApi, RpcAiApi, RpcHapticsApi, RpcFeaturesApi, RpcLifecycleApi, RpcRoomsApi, RpcLoggingApi, RpcIapApi, RpcPreloaderApi, RpcSharedAssetsApi, initializeRoomsApi, MockAdsApi, MockLifecycleApi, MockAnalyticsApi, createMockStorageApi, MockAvatarApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockProfileApi, MockDeviceApi, MockEnvironmentApi, MockSystemApi, MockCdnApi, MockTimeApi, MockAiApi, MockHapticsApi, MockFeaturesApi, MockLoggingApi, MockIapApi, MockSocialApi, MockPreloaderApi, MockSharedAssetsApi } from './chunk-
|
|
2
|
-
|
|
3
|
-
// src/utils/idGenerator.ts
|
|
4
|
-
function generateId() {
|
|
5
|
-
return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
6
|
-
}
|
|
1
|
+
import { generateId, RpcAdsApi, RpcAnalyticsApi, RpcStorageApi, RpcAvatarApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, HostProfileApi, HostDeviceApi, HostEnvironmentApi, HostSystemApi, HostCdnApi, HostTimeApi, RpcAiApi, RpcHapticsApi, RpcFeaturesApi, RpcLifecycleApi, RpcRoomsApi, RpcLoggingApi, RpcIapApi, RpcPreloaderApi, RpcEntitlementApi, RpcSharedAssetsApi, initializeRoomsApi, MockAdsApi, MockLifecycleApi, MockAnalyticsApi, createMockStorageApi, MockAvatarApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockProfileApi, MockDeviceApi, MockEnvironmentApi, MockSystemApi, MockCdnApi, MockTimeApi, MockAiApi, MockHapticsApi, MockFeaturesApi, MockLoggingApi, MockIapApi, MockSocialApi, MockEntitlementApi, MockPreloaderApi, MockSharedAssetsApi } from './chunk-HU7Z7SGX.js';
|
|
7
2
|
|
|
8
3
|
// src/rpc/RpcClient.ts
|
|
9
4
|
var RpcClient = class {
|
|
@@ -537,7 +532,7 @@ function initializeSimulation(rundotGameApi, host) {
|
|
|
537
532
|
}
|
|
538
533
|
|
|
539
534
|
// src/version.ts
|
|
540
|
-
var SDK_VERSION = "5.3.
|
|
535
|
+
var SDK_VERSION = "5.3.2";
|
|
541
536
|
|
|
542
537
|
// src/leaderboard/utils.ts
|
|
543
538
|
var HASH_ALGORITHM_WEB_CRYPTO = "SHA-256";
|
|
@@ -1287,6 +1282,7 @@ var RemoteHost = class {
|
|
|
1287
1282
|
preloader;
|
|
1288
1283
|
social;
|
|
1289
1284
|
imageGen;
|
|
1285
|
+
entitlements;
|
|
1290
1286
|
context;
|
|
1291
1287
|
get isInitialized() {
|
|
1292
1288
|
return this._isInitialized;
|
|
@@ -1353,6 +1349,7 @@ var RemoteHost = class {
|
|
|
1353
1349
|
this.preloader = new RpcPreloaderApi(rpcClient);
|
|
1354
1350
|
this.social = new RpcSocialApi(rpcClient);
|
|
1355
1351
|
this.imageGen = new RpcImageGenApi(rpcClient);
|
|
1352
|
+
this.entitlements = new RpcEntitlementApi(rpcClient);
|
|
1356
1353
|
rundotGameApi.isMock = () => false;
|
|
1357
1354
|
this.rundotGameApi.sharedAssets = new RpcSharedAssetsApi(rpcClient, rundotGameApi);
|
|
1358
1355
|
initializeRoomsApi(this.rundotGameApi, this);
|
|
@@ -1393,7 +1390,8 @@ var RemoteHost = class {
|
|
|
1393
1390
|
safeArea,
|
|
1394
1391
|
initializeAsleep: response.initializeAsleep,
|
|
1395
1392
|
launchParams: response.launchParams,
|
|
1396
|
-
shareParams: response.shareParams
|
|
1393
|
+
shareParams: response.shareParams,
|
|
1394
|
+
notificationParams: response.notificationParams
|
|
1397
1395
|
};
|
|
1398
1396
|
return this.context;
|
|
1399
1397
|
}
|
|
@@ -1550,6 +1548,7 @@ var MockHost = class {
|
|
|
1550
1548
|
preloader;
|
|
1551
1549
|
social;
|
|
1552
1550
|
imageGen;
|
|
1551
|
+
entitlements;
|
|
1553
1552
|
context;
|
|
1554
1553
|
state = 0 /* PLAYING */;
|
|
1555
1554
|
get isInitialized() {
|
|
@@ -1593,6 +1592,7 @@ var MockHost = class {
|
|
|
1593
1592
|
this.iap = new MockIapApi();
|
|
1594
1593
|
this.social = new MockSocialApi();
|
|
1595
1594
|
this.imageGen = new MockImageGenApi();
|
|
1595
|
+
this.entitlements = new MockEntitlementApi();
|
|
1596
1596
|
initializeRoomsApi(this.rundotGameApi, this);
|
|
1597
1597
|
this.preloader = new MockPreloaderApi();
|
|
1598
1598
|
rundotGameApi.isMock = () => true;
|
|
@@ -1609,7 +1609,8 @@ var MockHost = class {
|
|
|
1609
1609
|
initializeAsleep: false,
|
|
1610
1610
|
safeArea: this.rundotGameApi._safeAreaData,
|
|
1611
1611
|
launchParams: options?.launchParams || { "MOCK_LAUNCH_PARAMS_KEY": "MOCK_LAUNCH_PARAMS_VALUE" },
|
|
1612
|
-
shareParams: options?.shareParams || { "MOCK_SHARE_PARAMS_KEY": "MOCK_SHARE_PARAMS_VALUE" }
|
|
1612
|
+
shareParams: options?.shareParams || { "MOCK_SHARE_PARAMS_KEY": "MOCK_SHARE_PARAMS_VALUE" },
|
|
1613
|
+
notificationParams: {}
|
|
1613
1614
|
};
|
|
1614
1615
|
return Promise.resolve(this.context);
|
|
1615
1616
|
}
|
|
@@ -1995,5 +1996,5 @@ function initializeSocial(rundotGameApi, host) {
|
|
|
1995
1996
|
}
|
|
1996
1997
|
|
|
1997
1998
|
export { HASH_ALGORITHM_NODE, HASH_ALGORITHM_WEB_CRYPTO, MockImageGenApi, MockLeaderboardApi, RemoteHost, RpcClient, RpcImageGenApi, RpcLeaderboardApi, RpcSimulationApi, RpcSocialApi, SDK_VERSION, computeScoreHash, createHost, initializeImageGen, initializeLeaderboard, initializeSimulation, initializeSocial, initializeUgc };
|
|
1998
|
-
//# sourceMappingURL=chunk-
|
|
1999
|
-
//# sourceMappingURL=chunk-
|
|
1999
|
+
//# sourceMappingURL=chunk-GE4GZ6CH.js.map
|
|
2000
|
+
//# sourceMappingURL=chunk-GE4GZ6CH.js.map
|