@series-inc/venus-sdk 3.2.1-beta.0 → 3.2.1-beta.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/dist/{AdsApi-or6zfdzM.d.mts → AdsApi-OXtzPhiB.d.mts} +1 -65
- package/dist/{AdsApi-or6zfdzM.d.ts → AdsApi-OXtzPhiB.d.ts} +1 -65
- package/dist/{chunk-UXY5CKKG.mjs → chunk-3ZNKYBXC.mjs} +3 -3
- package/dist/chunk-3ZNKYBXC.mjs.map +1 -0
- package/dist/{chunk-YOBDYPKZ.mjs → chunk-46LCYRXS.mjs} +5 -92
- package/dist/chunk-46LCYRXS.mjs.map +1 -0
- package/dist/index.cjs +4 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +15 -13
- package/dist/index.d.ts +15 -13
- package/dist/index.mjs +2 -2
- package/dist/venus-api/index.cjs +3 -87
- 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 +1 -1
- package/dist/vite/index.cjs +20 -0
- package/dist/vite/index.cjs.map +1 -1
- package/dist/vite/index.mjs +20 -1
- package/dist/vite/index.mjs.map +1 -1
- package/dist/webview/index.cjs +1 -1
- package/dist/webview/index.cjs.map +1 -1
- package/dist/webview/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-UXY5CKKG.mjs.map +0 -1
- package/dist/chunk-YOBDYPKZ.mjs.map +0 -1
|
@@ -125,13 +125,6 @@ interface NotificationsApi {
|
|
|
125
125
|
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
interface ShowConfirmOptions {
|
|
129
|
-
confirmText?: string;
|
|
130
|
-
cancelText?: string;
|
|
131
|
-
}
|
|
132
|
-
interface ShowAlertOptions {
|
|
133
|
-
buttonText?: string;
|
|
134
|
-
}
|
|
135
128
|
interface ShowToastOptions {
|
|
136
129
|
duration?: number;
|
|
137
130
|
variant?: 'success' | 'error' | 'warning' | 'info';
|
|
@@ -140,21 +133,7 @@ interface ShowToastOptions {
|
|
|
140
133
|
};
|
|
141
134
|
}
|
|
142
135
|
interface PopupsApi {
|
|
143
|
-
showAlert(title: string, message: string, options?: ShowAlertOptions): Promise<void>;
|
|
144
|
-
showConfirm(title: string, message: string, options?: ShowConfirmOptions): Promise<boolean>;
|
|
145
136
|
showToast(message: string, options?: ShowToastOptions): Promise<boolean>;
|
|
146
|
-
showActionSheet(items: ActionSheetItem[], options?: ShowActionSheetOptions): Promise<string | number | null>;
|
|
147
|
-
}
|
|
148
|
-
interface ActionSheetItem {
|
|
149
|
-
id?: string;
|
|
150
|
-
label: string;
|
|
151
|
-
icon?: string;
|
|
152
|
-
}
|
|
153
|
-
interface ShowActionSheetOptions {
|
|
154
|
-
title?: string;
|
|
155
|
-
message?: string;
|
|
156
|
-
cancelButtonText?: string;
|
|
157
|
-
disableCancel?: boolean;
|
|
158
137
|
}
|
|
159
138
|
|
|
160
139
|
interface ProfileApi {
|
|
@@ -1357,11 +1336,6 @@ interface VenusExecuteRecipeResult {
|
|
|
1357
1336
|
amountFulfilled?: number;
|
|
1358
1337
|
partialSuccess?: boolean;
|
|
1359
1338
|
}
|
|
1360
|
-
interface ActionSheetOption {
|
|
1361
|
-
label: string;
|
|
1362
|
-
icon?: string;
|
|
1363
|
-
id?: string;
|
|
1364
|
-
}
|
|
1365
1339
|
interface Profile {
|
|
1366
1340
|
id: string;
|
|
1367
1341
|
username: string;
|
|
@@ -1428,44 +1402,6 @@ interface VenusAPI {
|
|
|
1428
1402
|
getLaunchParams(): Record<string, string>;
|
|
1429
1403
|
getLocale(): string;
|
|
1430
1404
|
getLanguageCode(): string;
|
|
1431
|
-
/**
|
|
1432
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1433
|
-
*/
|
|
1434
|
-
showToast(message: string | {
|
|
1435
|
-
message: string;
|
|
1436
|
-
duration?: number;
|
|
1437
|
-
variant?: string;
|
|
1438
|
-
action?: {
|
|
1439
|
-
label: string;
|
|
1440
|
-
};
|
|
1441
|
-
}): Promise<boolean>;
|
|
1442
|
-
/**
|
|
1443
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1444
|
-
*/
|
|
1445
|
-
showAlert(options: {
|
|
1446
|
-
title: string;
|
|
1447
|
-
message: string;
|
|
1448
|
-
buttonText?: string;
|
|
1449
|
-
}): Promise<void>;
|
|
1450
|
-
/**
|
|
1451
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1452
|
-
*/
|
|
1453
|
-
showConfirm(options: {
|
|
1454
|
-
title: string;
|
|
1455
|
-
message: string;
|
|
1456
|
-
confirmText?: string;
|
|
1457
|
-
cancelText?: string;
|
|
1458
|
-
}): Promise<boolean>;
|
|
1459
|
-
/**
|
|
1460
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1461
|
-
*/
|
|
1462
|
-
showActionSheet(options: {
|
|
1463
|
-
title: string;
|
|
1464
|
-
message?: string;
|
|
1465
|
-
options: ActionSheetOption[];
|
|
1466
|
-
cancelButtonText?: string;
|
|
1467
|
-
disableCancel?: boolean;
|
|
1468
|
-
}): Promise<string | number | null>;
|
|
1469
1405
|
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
1470
1406
|
deviceCache: {
|
|
1471
1407
|
setItem(key: string, value: string): Promise<void>;
|
|
@@ -1612,4 +1548,4 @@ interface AdsApi {
|
|
|
1612
1548
|
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
1613
1549
|
}
|
|
1614
1550
|
|
|
1615
|
-
export { type
|
|
1551
|
+
export { type AiApi as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type ScheduleNotificationOptions as C, type PopupsApi as D, type ShowToastOptions as E, type ShowInterstitialAdOptions as F, type ShowRewardedAdOptions as G, type Host as H, type ProfileApi as I, type DeviceApi as J, type DeviceInfo as K, type EnvironmentApi as L, type EnvironmentInfo as M, type NavigationApi as N, type SystemApi as O, type Profile as P, type QuitOptions as Q, type RecipeRequirementResult as R, type SimulationRunSummary as S, type SafeArea as T, type CdnApi as U, type VenusAPI as V, type SubPath as W, type FetchBlobOptions as X, type TimeApi as Y, type ServerTimeData as Z, type GetFutureTimeOptions as _, type VenusSimulationStateResponse as a, type PlayerRankResult as a$, type AiChatCompletionRequest as a0, type AiChatCompletionData as a1, type HapticsApi as a2, HapticFeedbackStyle as a3, type FeaturesApi as a4, type Experiment as a5, type LifecycleApi as a6, type SleepCallback as a7, type Subscription as a8, type AwakeCallback as a9, type ProposedMoveEvent as aA, VenusTransport as aB, type RoomsApi as aC, type CreateRoomOptions as aD, type JoinOrCreateRoomOptions as aE, type JoinOrCreateResult as aF, type ListRoomsOptions as aG, type UpdateRoomDataOptions as aH, type RoomMessageRequest as aI, type StartRoomGameOptions as aJ, type ProposeMoveRequest as aK, type ProposeMoveResult as aL, type ValidateMoveVerdict as aM, type ValidateMoveResult as aN, type RoomSubscriptionOptions as aO, type LoggingApi as aP, type IapApi as aQ, type SpendCurrencyOptions as aR, type LoadEmbeddedAssetsResponse as aS, type SharedAssetsApi as aT, type LeaderboardApi as aU, type ScoreToken as aV, type SubmitScoreParams as aW, type SubmitScoreResult as aX, type GetPagedScoresOptions as aY, type PagedScoresResponse as aZ, type PlayerRankOptions as a_, type PauseCallback as aa, type ResumeCallback as ab, type QuitCallback as ac, type SimulationApi as ad, type SimulationSlotValidationResult as ae, type SimulationBatchOperation as af, type SimulationBatchOperationsResult as ag, type SimulationAvailableItem as ah, type SimulationPowerPreview as ai, type SimulationSlotMutationResult as aj, type SimulationSlotContainer as ak, type SimulationAssignment as al, type SimulationState as am, type ExecuteRecipeOptions as an, type ExecuteRecipeResponse as ao, type CollectRecipeResult as ap, type GetActiveRunsOptions as aq, type ExecuteScopedRecipeOptions as ar, type ExecuteScopedRecipeResult as as, type GetAvailableRecipesOptions as at, type GetAvailableRecipesResult as au, type Recipe as av, type GetBatchRecipeRequirements as aw, type TriggerRecipeChainOptions as ax, type RoomDataUpdate as ay, type RoomMessageEvent as az, type SimulationUpdateType as b, type GetPodiumScoresOptions as b0, type PodiumScoresResponse as b1, type PreloaderApi as b2, type SocialApi as b3, type ShareMetadata as b4, type ShareLinkResult as b5, type SocialQRCodeOptions as b6, type QRCodeResult as b7, type Avatar3dApi as b8, type AssetManifest as b9, RpcSharedAssetsApi as bA, type LoadEmbeddedAssetsRequest as bB, type LeaderboardModeConfig as bC, type LeaderboardPeriodType as bD, type LeaderboardPeriodConfig as bE, type LeaderboardAntiCheatConfig as bF, type LeaderboardDisplaySettings as bG, type LeaderboardConfig as bH, type LeaderboardEntry as bI, type PodiumScoresContext as bJ, type HudInsets as bK, createHost as bL, type Avatar3dConfig as ba, type ShowEditorOptions as bb, type Avatar3dEdits as bc, type AdsApi as bd, type InitializationOptions as be, type InitializationContext as bf, type AiMessage as bg, type Asset as bh, type Category as bi, MockAvatarApi as bj, type TimeIntervalTriggerInput as bk, type NotificationTriggerInput as bl, type OnRequestCallback as bm, type OnResponseCallback as bn, type OnNotificationCallback as bo, type RpcTransport as bp, type JoinRoomMatchCriteria as bq, type RoomMessageEventType as br, type VenusRoomPayload as bs, type RecipeInfo as bt, type SimulationPersonalState as bu, type SimulationRoomActiveRecipe as bv, type SimulationRoomState as bw, type SimulationBatchOperationAssign as bx, type SimulationBatchOperationRemove as by, type SimulationBatchOperationResult as bz, type SimulationEntityUpdate as c, type SimulationActiveRunsUpdate as d, type SimulationSnapshotUpdate as e, type SimulationUpdateData as f, type SimulationSubscribeOptions as g, type VenusSimulationEffect as h, type VenusSimulationRecipe as i, type VenusSimulationConfig as j, type RecipeRequirementQuery as k, type VenusExecuteRecipeOptions as l, type VenusExecuteScopedRecipeOptions as m, type VenusAvailableRecipe as n, type VenusCollectRecipeResult as o, type VenusExecuteRecipeResult as p, VenusRoom as q, type RpcRequest as r, type RpcResponse as s, type RpcNotification as t, RpcClient as u, type StorageApi as v, type NavigationStackInfo as w, type PushAppOptions as x, type NotificationsApi as y, type ScheduleLocalNotification as z };
|
|
@@ -125,13 +125,6 @@ interface NotificationsApi {
|
|
|
125
125
|
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
interface ShowConfirmOptions {
|
|
129
|
-
confirmText?: string;
|
|
130
|
-
cancelText?: string;
|
|
131
|
-
}
|
|
132
|
-
interface ShowAlertOptions {
|
|
133
|
-
buttonText?: string;
|
|
134
|
-
}
|
|
135
128
|
interface ShowToastOptions {
|
|
136
129
|
duration?: number;
|
|
137
130
|
variant?: 'success' | 'error' | 'warning' | 'info';
|
|
@@ -140,21 +133,7 @@ interface ShowToastOptions {
|
|
|
140
133
|
};
|
|
141
134
|
}
|
|
142
135
|
interface PopupsApi {
|
|
143
|
-
showAlert(title: string, message: string, options?: ShowAlertOptions): Promise<void>;
|
|
144
|
-
showConfirm(title: string, message: string, options?: ShowConfirmOptions): Promise<boolean>;
|
|
145
136
|
showToast(message: string, options?: ShowToastOptions): Promise<boolean>;
|
|
146
|
-
showActionSheet(items: ActionSheetItem[], options?: ShowActionSheetOptions): Promise<string | number | null>;
|
|
147
|
-
}
|
|
148
|
-
interface ActionSheetItem {
|
|
149
|
-
id?: string;
|
|
150
|
-
label: string;
|
|
151
|
-
icon?: string;
|
|
152
|
-
}
|
|
153
|
-
interface ShowActionSheetOptions {
|
|
154
|
-
title?: string;
|
|
155
|
-
message?: string;
|
|
156
|
-
cancelButtonText?: string;
|
|
157
|
-
disableCancel?: boolean;
|
|
158
137
|
}
|
|
159
138
|
|
|
160
139
|
interface ProfileApi {
|
|
@@ -1357,11 +1336,6 @@ interface VenusExecuteRecipeResult {
|
|
|
1357
1336
|
amountFulfilled?: number;
|
|
1358
1337
|
partialSuccess?: boolean;
|
|
1359
1338
|
}
|
|
1360
|
-
interface ActionSheetOption {
|
|
1361
|
-
label: string;
|
|
1362
|
-
icon?: string;
|
|
1363
|
-
id?: string;
|
|
1364
|
-
}
|
|
1365
1339
|
interface Profile {
|
|
1366
1340
|
id: string;
|
|
1367
1341
|
username: string;
|
|
@@ -1428,44 +1402,6 @@ interface VenusAPI {
|
|
|
1428
1402
|
getLaunchParams(): Record<string, string>;
|
|
1429
1403
|
getLocale(): string;
|
|
1430
1404
|
getLanguageCode(): string;
|
|
1431
|
-
/**
|
|
1432
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1433
|
-
*/
|
|
1434
|
-
showToast(message: string | {
|
|
1435
|
-
message: string;
|
|
1436
|
-
duration?: number;
|
|
1437
|
-
variant?: string;
|
|
1438
|
-
action?: {
|
|
1439
|
-
label: string;
|
|
1440
|
-
};
|
|
1441
|
-
}): Promise<boolean>;
|
|
1442
|
-
/**
|
|
1443
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1444
|
-
*/
|
|
1445
|
-
showAlert(options: {
|
|
1446
|
-
title: string;
|
|
1447
|
-
message: string;
|
|
1448
|
-
buttonText?: string;
|
|
1449
|
-
}): Promise<void>;
|
|
1450
|
-
/**
|
|
1451
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1452
|
-
*/
|
|
1453
|
-
showConfirm(options: {
|
|
1454
|
-
title: string;
|
|
1455
|
-
message: string;
|
|
1456
|
-
confirmText?: string;
|
|
1457
|
-
cancelText?: string;
|
|
1458
|
-
}): Promise<boolean>;
|
|
1459
|
-
/**
|
|
1460
|
-
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1461
|
-
*/
|
|
1462
|
-
showActionSheet(options: {
|
|
1463
|
-
title: string;
|
|
1464
|
-
message?: string;
|
|
1465
|
-
options: ActionSheetOption[];
|
|
1466
|
-
cancelButtonText?: string;
|
|
1467
|
-
disableCancel?: boolean;
|
|
1468
|
-
}): Promise<string | number | null>;
|
|
1469
1405
|
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
1470
1406
|
deviceCache: {
|
|
1471
1407
|
setItem(key: string, value: string): Promise<void>;
|
|
@@ -1612,4 +1548,4 @@ interface AdsApi {
|
|
|
1612
1548
|
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
1613
1549
|
}
|
|
1614
1550
|
|
|
1615
|
-
export { type
|
|
1551
|
+
export { type AiApi as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type ScheduleNotificationOptions as C, type PopupsApi as D, type ShowToastOptions as E, type ShowInterstitialAdOptions as F, type ShowRewardedAdOptions as G, type Host as H, type ProfileApi as I, type DeviceApi as J, type DeviceInfo as K, type EnvironmentApi as L, type EnvironmentInfo as M, type NavigationApi as N, type SystemApi as O, type Profile as P, type QuitOptions as Q, type RecipeRequirementResult as R, type SimulationRunSummary as S, type SafeArea as T, type CdnApi as U, type VenusAPI as V, type SubPath as W, type FetchBlobOptions as X, type TimeApi as Y, type ServerTimeData as Z, type GetFutureTimeOptions as _, type VenusSimulationStateResponse as a, type PlayerRankResult as a$, type AiChatCompletionRequest as a0, type AiChatCompletionData as a1, type HapticsApi as a2, HapticFeedbackStyle as a3, type FeaturesApi as a4, type Experiment as a5, type LifecycleApi as a6, type SleepCallback as a7, type Subscription as a8, type AwakeCallback as a9, type ProposedMoveEvent as aA, VenusTransport as aB, type RoomsApi as aC, type CreateRoomOptions as aD, type JoinOrCreateRoomOptions as aE, type JoinOrCreateResult as aF, type ListRoomsOptions as aG, type UpdateRoomDataOptions as aH, type RoomMessageRequest as aI, type StartRoomGameOptions as aJ, type ProposeMoveRequest as aK, type ProposeMoveResult as aL, type ValidateMoveVerdict as aM, type ValidateMoveResult as aN, type RoomSubscriptionOptions as aO, type LoggingApi as aP, type IapApi as aQ, type SpendCurrencyOptions as aR, type LoadEmbeddedAssetsResponse as aS, type SharedAssetsApi as aT, type LeaderboardApi as aU, type ScoreToken as aV, type SubmitScoreParams as aW, type SubmitScoreResult as aX, type GetPagedScoresOptions as aY, type PagedScoresResponse as aZ, type PlayerRankOptions as a_, type PauseCallback as aa, type ResumeCallback as ab, type QuitCallback as ac, type SimulationApi as ad, type SimulationSlotValidationResult as ae, type SimulationBatchOperation as af, type SimulationBatchOperationsResult as ag, type SimulationAvailableItem as ah, type SimulationPowerPreview as ai, type SimulationSlotMutationResult as aj, type SimulationSlotContainer as ak, type SimulationAssignment as al, type SimulationState as am, type ExecuteRecipeOptions as an, type ExecuteRecipeResponse as ao, type CollectRecipeResult as ap, type GetActiveRunsOptions as aq, type ExecuteScopedRecipeOptions as ar, type ExecuteScopedRecipeResult as as, type GetAvailableRecipesOptions as at, type GetAvailableRecipesResult as au, type Recipe as av, type GetBatchRecipeRequirements as aw, type TriggerRecipeChainOptions as ax, type RoomDataUpdate as ay, type RoomMessageEvent as az, type SimulationUpdateType as b, type GetPodiumScoresOptions as b0, type PodiumScoresResponse as b1, type PreloaderApi as b2, type SocialApi as b3, type ShareMetadata as b4, type ShareLinkResult as b5, type SocialQRCodeOptions as b6, type QRCodeResult as b7, type Avatar3dApi as b8, type AssetManifest as b9, RpcSharedAssetsApi as bA, type LoadEmbeddedAssetsRequest as bB, type LeaderboardModeConfig as bC, type LeaderboardPeriodType as bD, type LeaderboardPeriodConfig as bE, type LeaderboardAntiCheatConfig as bF, type LeaderboardDisplaySettings as bG, type LeaderboardConfig as bH, type LeaderboardEntry as bI, type PodiumScoresContext as bJ, type HudInsets as bK, createHost as bL, type Avatar3dConfig as ba, type ShowEditorOptions as bb, type Avatar3dEdits as bc, type AdsApi as bd, type InitializationOptions as be, type InitializationContext as bf, type AiMessage as bg, type Asset as bh, type Category as bi, MockAvatarApi as bj, type TimeIntervalTriggerInput as bk, type NotificationTriggerInput as bl, type OnRequestCallback as bm, type OnResponseCallback as bn, type OnNotificationCallback as bo, type RpcTransport as bp, type JoinRoomMatchCriteria as bq, type RoomMessageEventType as br, type VenusRoomPayload as bs, type RecipeInfo as bt, type SimulationPersonalState as bu, type SimulationRoomActiveRecipe as bv, type SimulationRoomState as bw, type SimulationBatchOperationAssign as bx, type SimulationBatchOperationRemove as by, type SimulationBatchOperationResult as bz, type SimulationEntityUpdate as c, type SimulationActiveRunsUpdate as d, type SimulationSnapshotUpdate as e, type SimulationUpdateData as f, type SimulationSubscribeOptions as g, type VenusSimulationEffect as h, type VenusSimulationRecipe as i, type VenusSimulationConfig as j, type RecipeRequirementQuery as k, type VenusExecuteRecipeOptions as l, type VenusExecuteScopedRecipeOptions as m, type VenusAvailableRecipe as n, type VenusCollectRecipeResult as o, type VenusExecuteRecipeResult as p, VenusRoom as q, type RpcRequest as r, type RpcResponse as s, type RpcNotification as t, RpcClient as u, type StorageApi as v, type NavigationStackInfo as w, type PushAppOptions as x, type NotificationsApi as y, type ScheduleLocalNotification as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// raw-loader
|
|
1
|
+
// raw-loader:E:\SeriesAI\venus\venus-sdk\packages\api\src\webview\webviewLibraryShim.js
|
|
2
2
|
var webviewLibraryShim_default = "/**\r\n * Venus Embedded Libraries WebView Shim\r\n *\r\n * This code is injected into H5 game WebViews BEFORE the game's main script runs.\r\n * It bootstraps the embedded libraries system by:\r\n * 1. Reading window.__venusLibrariesConfig (set by the Vite plugin)\r\n * 2. Loading libraries via RPC (mobile) or CDN (web)\r\n * 3. Registering libraries in window.__venusLibraryExports\r\n * 4. Allowing the game's virtual modules to access them\r\n *\r\n * This shim is NOT imported by H5 games - it's injected by the Venus host via\r\n * injectedJavaScriptBeforeContentLoaded in H5AppPoolRenderer.\r\n */\r\n\r\n;(function () {\r\n if (typeof window === 'undefined') {\r\n return\r\n }\r\n\r\n if (window.__venusLibraryShim && window.__venusLibraryShim.__initialized) {\r\n return\r\n }\r\n\r\n var RESPONSE_TYPE = 'H5_RESPONSE'\r\n var REQUEST_TYPE = 'H5_LOAD_EMBEDDED_ASSET'\r\n var REQUEST_TIMEOUT_MS = 12000\r\n var pendingRequests = new Map()\r\n\r\n function ensureConfig() {\r\n if (!window.__venusLibrariesConfig) {\r\n window.__venusLibrariesConfig = {\r\n enabled: false,\r\n required: [],\r\n manifest: {},\r\n cdnBase: '',\r\n }\r\n }\r\n if (!window.__venusLibrariesConfig.manifest) {\r\n window.__venusLibrariesConfig.manifest = {}\r\n }\r\n if (!Array.isArray(window.__venusLibrariesConfig.required)) {\r\n window.__venusLibrariesConfig.required = []\r\n }\r\n return window.__venusLibrariesConfig\r\n }\r\n\r\n function ensureExportsRegistry() {\r\n if (!window.__venusLibraryExports) {\r\n window.__venusLibraryExports = {}\r\n }\r\n return window.__venusLibraryExports\r\n }\r\n\r\n function hasHostBridge() {\r\n return !!(\r\n window.ReactNativeWebView &&\r\n typeof window.ReactNativeWebView.postMessage === 'function'\r\n )\r\n }\r\n\r\n function registerResponseListeners() {\r\n if (\r\n window.__venusLibraryShim &&\r\n window.__venusLibraryShim.__listenerRegistered\r\n ) {\r\n return\r\n }\r\n\r\n function handleMessage(event) {\r\n var payload = parsePayload(event && event.data)\r\n if (!payload || payload.type !== RESPONSE_TYPE || !payload.data) {\r\n return\r\n }\r\n var requestId = payload.data.requestId\r\n if (!requestId || !pendingRequests.has(requestId)) {\r\n return\r\n }\r\n var pending = pendingRequests.get(requestId)\r\n pendingRequests.delete(requestId)\r\n clearTimeout(pending.timeout)\r\n\r\n if (payload.data.success === false) {\r\n pending.reject(\r\n new Error(payload.data.error || 'Embedded library load failed'),\r\n )\r\n return\r\n }\r\n\r\n var value = payload.data.value || payload.data\r\n if (!value || !value.base64Data) {\r\n pending.reject(\r\n new Error('Embedded library response was missing base64Data'),\r\n )\r\n return\r\n }\r\n\r\n pending.resolve(value.base64Data)\r\n }\r\n\r\n if (\r\n typeof document !== 'undefined' &&\r\n typeof document.addEventListener === 'function'\r\n ) {\r\n document.addEventListener('message', handleMessage, false)\r\n }\r\n if (\r\n typeof window !== 'undefined' &&\r\n typeof window.addEventListener === 'function'\r\n ) {\r\n window.addEventListener('message', handleMessage, false)\r\n }\r\n\r\n if (!window.__venusLibraryShim) {\r\n window.__venusLibraryShim = {}\r\n }\r\n window.__venusLibraryShim.__listenerRegistered = true\r\n }\r\n\r\n function parsePayload(raw) {\r\n if (!raw || typeof raw !== 'string') {\r\n return null\r\n }\r\n try {\r\n return JSON.parse(raw)\r\n } catch (error) {\r\n return null\r\n }\r\n }\r\n\r\n function createRequestId(libraryKey) {\r\n var sanitized = ''\r\n for (var i = 0; i < libraryKey.length; i++) {\r\n var c = libraryKey.charAt(i)\r\n if (\r\n (c >= 'a' && c <= 'z') ||\r\n (c >= 'A' && c <= 'Z') ||\r\n (c >= '0' && c <= '9') ||\r\n c === '-' ||\r\n c === '_'\r\n ) {\r\n sanitized += c\r\n } else {\r\n sanitized += '_'\r\n }\r\n }\r\n return (\r\n 'embedded-lib-' +\r\n sanitized +\r\n '-' +\r\n Date.now() +\r\n '-' +\r\n Math.random().toString(36).slice(2)\r\n )\r\n }\r\n\r\n function postHostRequest(assetKey, requestId) {\r\n if (!hasHostBridge()) {\r\n throw new Error('Host bridge is unavailable')\r\n }\r\n var bridge = window.ReactNativeWebView\r\n var message = {\r\n type: REQUEST_TYPE,\r\n direction: 'H5_TO_APP',\r\n data: {\r\n requestId: requestId,\r\n assetKey: assetKey,\r\n },\r\n instanceId:\r\n (window._venusInitState && window._venusInitState.poolId) || 'unknown',\r\n timestamp: Date.now(),\r\n }\r\n bridge.postMessage(JSON.stringify(message))\r\n }\r\n\r\n function loadLibraryViaHost(assetKey, libraryKey) {\r\n return new Promise(function (resolve, reject) {\r\n var requestId = createRequestId(libraryKey)\r\n var timeout = setTimeout(function () {\r\n pendingRequests.delete(requestId)\r\n reject(new Error('Timed out loading embedded library: ' + libraryKey))\r\n }, REQUEST_TIMEOUT_MS)\r\n\r\n pendingRequests.set(requestId, {\r\n resolve: resolve,\r\n reject: reject,\r\n timeout: timeout,\r\n })\r\n\r\n try {\r\n postHostRequest(assetKey, requestId)\r\n } catch (error) {\r\n pendingRequests.delete(requestId)\r\n clearTimeout(timeout)\r\n reject(error)\r\n }\r\n })\r\n }\r\n\r\n function buildCdnUrl(config, entry) {\r\n var base = config.cdnBase || ''\r\n if (!base.endsWith('/')) {\r\n base += '/'\r\n }\r\n var path = entry.cdnPath\r\n if (path.charAt(0) === '/') {\r\n path = path.substring(1)\r\n }\r\n return base + path\r\n }\r\n\r\n async function loadLibraryViaCdn(config, entry, libraryKey) {\r\n if (!config.cdnBase) {\r\n throw new Error('CDN base URL is not configured')\r\n }\r\n var url = buildCdnUrl(config, entry)\r\n var response = await fetch(url, { credentials: 'omit' })\r\n if (!response.ok) {\r\n throw new Error(\r\n 'Failed to fetch embedded library from CDN: ' + libraryKey,\r\n )\r\n }\r\n return await response.text()\r\n }\r\n\r\n function decodeBase64ToUtf8(base64) {\r\n if (typeof base64 !== 'string') {\r\n throw new Error('Invalid base64 payload')\r\n }\r\n\r\n if (typeof atob === 'function') {\r\n var binary = atob(base64)\r\n if (typeof TextDecoder !== 'undefined') {\r\n var len = binary.length\r\n var bytes = new Uint8Array(len)\r\n for (var i = 0; i < len; i++) {\r\n bytes[i] = binary.charCodeAt(i)\r\n }\r\n return new TextDecoder('utf-8').decode(bytes)\r\n }\r\n return decodeURIComponent(escape(binary))\r\n }\r\n\r\n var bufferCtor =\r\n (typeof globalThis !== 'undefined' && globalThis.Buffer) ||\r\n (typeof window !== 'undefined' && window.Buffer)\r\n if (bufferCtor) {\r\n return bufferCtor.from(base64, 'base64').toString('utf-8')\r\n }\r\n\r\n throw new Error('No base64 decoder available')\r\n }\r\n\r\n function evaluateLibrarySource(libraryKey, globalVar, source) {\r\n var registry = ensureExportsRegistry()\r\n if (!source) {\r\n throw new Error('Embedded library source was empty for ' + libraryKey)\r\n }\r\n\r\n var previousValue = window[globalVar]\r\n try {\r\n var executor = new Function(\r\n source + '\\n//# sourceURL=venus-library-' + libraryKey + '.js',\r\n )\r\n executor.call(window)\r\n } catch (error) {\r\n throw new Error(\r\n 'Failed to evaluate embedded library ' +\r\n libraryKey +\r\n ': ' +\r\n (error && error.message ? error.message : error),\r\n )\r\n }\r\n\r\n var exported = window[globalVar] || previousValue\r\n if (!exported) {\r\n throw new Error(\r\n 'Embedded library ' + libraryKey + ' did not register ' + globalVar,\r\n )\r\n }\r\n\r\n registry[libraryKey] = exported\r\n return exported\r\n }\r\n\r\n async function ensureLibraryLoaded(config, libraryKey) {\r\n var registry = ensureExportsRegistry()\r\n if (registry[libraryKey]) {\r\n return registry[libraryKey]\r\n }\r\n\r\n var entry = config.manifest && config.manifest[libraryKey]\r\n if (!entry) {\r\n throw new Error('No manifest entry for embedded library ' + libraryKey)\r\n }\r\n\r\n var source = null\r\n if (config.useHost !== false && hasHostBridge()) {\r\n try {\r\n var base64 = await loadLibraryViaHost(entry.assetKey, libraryKey)\r\n source = decodeBase64ToUtf8(base64)\r\n } catch (error) {\r\n // Log the RPC error loudly before fallback\r\n console.error(\r\n '[Venus Libraries] Failed to load ' +\r\n libraryKey +\r\n ' from host via RPC:',\r\n error,\r\n )\r\n console.warn(\r\n '[Venus Libraries] Falling back to CDN for ' +\r\n libraryKey +\r\n '. This may indicate an asset packaging issue.',\r\n )\r\n }\r\n }\r\n\r\n if (!source) {\r\n source = await loadLibraryViaCdn(config, entry, libraryKey)\r\n }\r\n\r\n return evaluateLibrarySource(libraryKey, entry.globalVar, source)\r\n }\r\n\r\n async function bootstrap() {\r\n try {\r\n registerResponseListeners()\r\n getBootstrapPromise()\r\n\r\n var config = ensureConfig()\r\n\r\n if (!config.enabled) {\r\n if (bootstrapResolve) bootstrapResolve()\r\n return\r\n }\r\n\r\n if (!Array.isArray(config.required) || config.required.length === 0) {\r\n if (bootstrapResolve) bootstrapResolve()\r\n return\r\n }\r\n\r\n // Group libraries by load stage for parallel loading within stages\r\n var librariesByStage = {}\r\n for (var i = 0; i < config.required.length; i++) {\r\n var libraryKey = config.required[i]\r\n var entry = config.manifest[libraryKey]\r\n var stage = entry.loadStage || 0\r\n if (!librariesByStage[stage]) librariesByStage[stage] = []\r\n librariesByStage[stage].push(libraryKey)\r\n }\r\n\r\n // Load stages sequentially, libraries within each stage in parallel\r\n var stages = Object.keys(librariesByStage).sort(function (a, b) {\r\n return parseInt(a, 10) - parseInt(b, 10)\r\n })\r\n\r\n for (var s = 0; s < stages.length; s++) {\r\n var stage = stages[s]\r\n var libs = librariesByStage[stage]\r\n\r\n // Load all libraries in this stage in parallel\r\n var stagePromises = libs.map(function (libraryKey) {\r\n return ensureLibraryLoaded(config, libraryKey).catch(\r\n function (error) {\r\n console.error(\r\n '[Venus Libraries] Failed to load library ' + libraryKey,\r\n error,\r\n )\r\n throw error\r\n },\r\n )\r\n })\r\n\r\n await Promise.all(stagePromises)\r\n }\r\n\r\n if (bootstrapResolve) bootstrapResolve()\r\n } catch (error) {\r\n console.error('[Venus Libraries] Bootstrap error', error)\r\n if (bootstrapReject) bootstrapReject(error)\r\n throw error\r\n }\r\n }\r\n\r\n // Create a promise that resolves when bootstrap completes\r\n var bootstrapPromise = null\r\n var bootstrapResolve = null\r\n var bootstrapReject = null\r\n\r\n function getBootstrapPromise() {\r\n if (!bootstrapPromise) {\r\n bootstrapPromise = new Promise(function (resolve, reject) {\r\n bootstrapResolve = resolve\r\n bootstrapReject = reject\r\n })\r\n }\r\n return bootstrapPromise\r\n }\r\n\r\n window.__venusLibraryShim = {\r\n bootstrap: bootstrap,\r\n ready: getBootstrapPromise,\r\n getExports: function (libraryKey) {\r\n var registry = ensureExportsRegistry()\r\n return registry[libraryKey]\r\n },\r\n __initialized: true,\r\n }\r\n})()\r\n";
|
|
3
3
|
|
|
4
4
|
// src/webview/webviewLibraryShimSource.ts
|
|
@@ -8,5 +8,5 @@ function getWebviewLibraryShimSource() {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export { WEBVIEW_LIBRARY_SHIM_SOURCE, getWebviewLibraryShimSource };
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-3ZNKYBXC.mjs.map
|
|
12
|
+
//# sourceMappingURL=chunk-3ZNKYBXC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["raw-loader:E:/SeriesAI/venus/venus-sdk/packages/api/src/webview/webviewLibraryShim.js","../src/webview/webviewLibraryShimSource.ts"],"names":[],"mappings":";AAAA,IAAO,0BAAA,GAAQ,omYAAA;;;ACcR,IAAM,2BAAA,GAA8B;AAEpC,SAAS,2BAAA,GAAsC;AACpD,EAAA,OAAO,2BAAA;AACT","file":"chunk-3ZNKYBXC.mjs","sourcesContent":["export default \"/**\\r\\n * Venus Embedded Libraries WebView Shim\\r\\n *\\r\\n * This code is injected into H5 game WebViews BEFORE the game's main script runs.\\r\\n * It bootstraps the embedded libraries system by:\\r\\n * 1. Reading window.__venusLibrariesConfig (set by the Vite plugin)\\r\\n * 2. Loading libraries via RPC (mobile) or CDN (web)\\r\\n * 3. Registering libraries in window.__venusLibraryExports\\r\\n * 4. Allowing the game's virtual modules to access them\\r\\n *\\r\\n * This shim is NOT imported by H5 games - it's injected by the Venus host via\\r\\n * injectedJavaScriptBeforeContentLoaded in H5AppPoolRenderer.\\r\\n */\\r\\n\\r\\n;(function () {\\r\\n if (typeof window === 'undefined') {\\r\\n return\\r\\n }\\r\\n\\r\\n if (window.__venusLibraryShim && window.__venusLibraryShim.__initialized) {\\r\\n return\\r\\n }\\r\\n\\r\\n var RESPONSE_TYPE = 'H5_RESPONSE'\\r\\n var REQUEST_TYPE = 'H5_LOAD_EMBEDDED_ASSET'\\r\\n var REQUEST_TIMEOUT_MS = 12000\\r\\n var pendingRequests = new Map()\\r\\n\\r\\n function ensureConfig() {\\r\\n if (!window.__venusLibrariesConfig) {\\r\\n window.__venusLibrariesConfig = {\\r\\n enabled: false,\\r\\n required: [],\\r\\n manifest: {},\\r\\n cdnBase: '',\\r\\n }\\r\\n }\\r\\n if (!window.__venusLibrariesConfig.manifest) {\\r\\n window.__venusLibrariesConfig.manifest = {}\\r\\n }\\r\\n if (!Array.isArray(window.__venusLibrariesConfig.required)) {\\r\\n window.__venusLibrariesConfig.required = []\\r\\n }\\r\\n return window.__venusLibrariesConfig\\r\\n }\\r\\n\\r\\n function ensureExportsRegistry() {\\r\\n if (!window.__venusLibraryExports) {\\r\\n window.__venusLibraryExports = {}\\r\\n }\\r\\n return window.__venusLibraryExports\\r\\n }\\r\\n\\r\\n function hasHostBridge() {\\r\\n return !!(\\r\\n window.ReactNativeWebView &&\\r\\n typeof window.ReactNativeWebView.postMessage === 'function'\\r\\n )\\r\\n }\\r\\n\\r\\n function registerResponseListeners() {\\r\\n if (\\r\\n window.__venusLibraryShim &&\\r\\n window.__venusLibraryShim.__listenerRegistered\\r\\n ) {\\r\\n return\\r\\n }\\r\\n\\r\\n function handleMessage(event) {\\r\\n var payload = parsePayload(event && event.data)\\r\\n if (!payload || payload.type !== RESPONSE_TYPE || !payload.data) {\\r\\n return\\r\\n }\\r\\n var requestId = payload.data.requestId\\r\\n if (!requestId || !pendingRequests.has(requestId)) {\\r\\n return\\r\\n }\\r\\n var pending = pendingRequests.get(requestId)\\r\\n pendingRequests.delete(requestId)\\r\\n clearTimeout(pending.timeout)\\r\\n\\r\\n if (payload.data.success === false) {\\r\\n pending.reject(\\r\\n new Error(payload.data.error || 'Embedded library load failed'),\\r\\n )\\r\\n return\\r\\n }\\r\\n\\r\\n var value = payload.data.value || payload.data\\r\\n if (!value || !value.base64Data) {\\r\\n pending.reject(\\r\\n new Error('Embedded library response was missing base64Data'),\\r\\n )\\r\\n return\\r\\n }\\r\\n\\r\\n pending.resolve(value.base64Data)\\r\\n }\\r\\n\\r\\n if (\\r\\n typeof document !== 'undefined' &&\\r\\n typeof document.addEventListener === 'function'\\r\\n ) {\\r\\n document.addEventListener('message', handleMessage, false)\\r\\n }\\r\\n if (\\r\\n typeof window !== 'undefined' &&\\r\\n typeof window.addEventListener === 'function'\\r\\n ) {\\r\\n window.addEventListener('message', handleMessage, false)\\r\\n }\\r\\n\\r\\n if (!window.__venusLibraryShim) {\\r\\n window.__venusLibraryShim = {}\\r\\n }\\r\\n window.__venusLibraryShim.__listenerRegistered = true\\r\\n }\\r\\n\\r\\n function parsePayload(raw) {\\r\\n if (!raw || typeof raw !== 'string') {\\r\\n return null\\r\\n }\\r\\n try {\\r\\n return JSON.parse(raw)\\r\\n } catch (error) {\\r\\n return null\\r\\n }\\r\\n }\\r\\n\\r\\n function createRequestId(libraryKey) {\\r\\n var sanitized = ''\\r\\n for (var i = 0; i < libraryKey.length; i++) {\\r\\n var c = libraryKey.charAt(i)\\r\\n if (\\r\\n (c >= 'a' && c <= 'z') ||\\r\\n (c >= 'A' && c <= 'Z') ||\\r\\n (c >= '0' && c <= '9') ||\\r\\n c === '-' ||\\r\\n c === '_'\\r\\n ) {\\r\\n sanitized += c\\r\\n } else {\\r\\n sanitized += '_'\\r\\n }\\r\\n }\\r\\n return (\\r\\n 'embedded-lib-' +\\r\\n sanitized +\\r\\n '-' +\\r\\n Date.now() +\\r\\n '-' +\\r\\n Math.random().toString(36).slice(2)\\r\\n )\\r\\n }\\r\\n\\r\\n function postHostRequest(assetKey, requestId) {\\r\\n if (!hasHostBridge()) {\\r\\n throw new Error('Host bridge is unavailable')\\r\\n }\\r\\n var bridge = window.ReactNativeWebView\\r\\n var message = {\\r\\n type: REQUEST_TYPE,\\r\\n direction: 'H5_TO_APP',\\r\\n data: {\\r\\n requestId: requestId,\\r\\n assetKey: assetKey,\\r\\n },\\r\\n instanceId:\\r\\n (window._venusInitState && window._venusInitState.poolId) || 'unknown',\\r\\n timestamp: Date.now(),\\r\\n }\\r\\n bridge.postMessage(JSON.stringify(message))\\r\\n }\\r\\n\\r\\n function loadLibraryViaHost(assetKey, libraryKey) {\\r\\n return new Promise(function (resolve, reject) {\\r\\n var requestId = createRequestId(libraryKey)\\r\\n var timeout = setTimeout(function () {\\r\\n pendingRequests.delete(requestId)\\r\\n reject(new Error('Timed out loading embedded library: ' + libraryKey))\\r\\n }, REQUEST_TIMEOUT_MS)\\r\\n\\r\\n pendingRequests.set(requestId, {\\r\\n resolve: resolve,\\r\\n reject: reject,\\r\\n timeout: timeout,\\r\\n })\\r\\n\\r\\n try {\\r\\n postHostRequest(assetKey, requestId)\\r\\n } catch (error) {\\r\\n pendingRequests.delete(requestId)\\r\\n clearTimeout(timeout)\\r\\n reject(error)\\r\\n }\\r\\n })\\r\\n }\\r\\n\\r\\n function buildCdnUrl(config, entry) {\\r\\n var base = config.cdnBase || ''\\r\\n if (!base.endsWith('/')) {\\r\\n base += '/'\\r\\n }\\r\\n var path = entry.cdnPath\\r\\n if (path.charAt(0) === '/') {\\r\\n path = path.substring(1)\\r\\n }\\r\\n return base + path\\r\\n }\\r\\n\\r\\n async function loadLibraryViaCdn(config, entry, libraryKey) {\\r\\n if (!config.cdnBase) {\\r\\n throw new Error('CDN base URL is not configured')\\r\\n }\\r\\n var url = buildCdnUrl(config, entry)\\r\\n var response = await fetch(url, { credentials: 'omit' })\\r\\n if (!response.ok) {\\r\\n throw new Error(\\r\\n 'Failed to fetch embedded library from CDN: ' + libraryKey,\\r\\n )\\r\\n }\\r\\n return await response.text()\\r\\n }\\r\\n\\r\\n function decodeBase64ToUtf8(base64) {\\r\\n if (typeof base64 !== 'string') {\\r\\n throw new Error('Invalid base64 payload')\\r\\n }\\r\\n\\r\\n if (typeof atob === 'function') {\\r\\n var binary = atob(base64)\\r\\n if (typeof TextDecoder !== 'undefined') {\\r\\n var len = binary.length\\r\\n var bytes = new Uint8Array(len)\\r\\n for (var i = 0; i < len; i++) {\\r\\n bytes[i] = binary.charCodeAt(i)\\r\\n }\\r\\n return new TextDecoder('utf-8').decode(bytes)\\r\\n }\\r\\n return decodeURIComponent(escape(binary))\\r\\n }\\r\\n\\r\\n var bufferCtor =\\r\\n (typeof globalThis !== 'undefined' && globalThis.Buffer) ||\\r\\n (typeof window !== 'undefined' && window.Buffer)\\r\\n if (bufferCtor) {\\r\\n return bufferCtor.from(base64, 'base64').toString('utf-8')\\r\\n }\\r\\n\\r\\n throw new Error('No base64 decoder available')\\r\\n }\\r\\n\\r\\n function evaluateLibrarySource(libraryKey, globalVar, source) {\\r\\n var registry = ensureExportsRegistry()\\r\\n if (!source) {\\r\\n throw new Error('Embedded library source was empty for ' + libraryKey)\\r\\n }\\r\\n\\r\\n var previousValue = window[globalVar]\\r\\n try {\\r\\n var executor = new Function(\\r\\n source + '\\\\n//# sourceURL=venus-library-' + libraryKey + '.js',\\r\\n )\\r\\n executor.call(window)\\r\\n } catch (error) {\\r\\n throw new Error(\\r\\n 'Failed to evaluate embedded library ' +\\r\\n libraryKey +\\r\\n ': ' +\\r\\n (error && error.message ? error.message : error),\\r\\n )\\r\\n }\\r\\n\\r\\n var exported = window[globalVar] || previousValue\\r\\n if (!exported) {\\r\\n throw new Error(\\r\\n 'Embedded library ' + libraryKey + ' did not register ' + globalVar,\\r\\n )\\r\\n }\\r\\n\\r\\n registry[libraryKey] = exported\\r\\n return exported\\r\\n }\\r\\n\\r\\n async function ensureLibraryLoaded(config, libraryKey) {\\r\\n var registry = ensureExportsRegistry()\\r\\n if (registry[libraryKey]) {\\r\\n return registry[libraryKey]\\r\\n }\\r\\n\\r\\n var entry = config.manifest && config.manifest[libraryKey]\\r\\n if (!entry) {\\r\\n throw new Error('No manifest entry for embedded library ' + libraryKey)\\r\\n }\\r\\n\\r\\n var source = null\\r\\n if (config.useHost !== false && hasHostBridge()) {\\r\\n try {\\r\\n var base64 = await loadLibraryViaHost(entry.assetKey, libraryKey)\\r\\n source = decodeBase64ToUtf8(base64)\\r\\n } catch (error) {\\r\\n // Log the RPC error loudly before fallback\\r\\n console.error(\\r\\n '[Venus Libraries] Failed to load ' +\\r\\n libraryKey +\\r\\n ' from host via RPC:',\\r\\n error,\\r\\n )\\r\\n console.warn(\\r\\n '[Venus Libraries] Falling back to CDN for ' +\\r\\n libraryKey +\\r\\n '. This may indicate an asset packaging issue.',\\r\\n )\\r\\n }\\r\\n }\\r\\n\\r\\n if (!source) {\\r\\n source = await loadLibraryViaCdn(config, entry, libraryKey)\\r\\n }\\r\\n\\r\\n return evaluateLibrarySource(libraryKey, entry.globalVar, source)\\r\\n }\\r\\n\\r\\n async function bootstrap() {\\r\\n try {\\r\\n registerResponseListeners()\\r\\n getBootstrapPromise()\\r\\n\\r\\n var config = ensureConfig()\\r\\n\\r\\n if (!config.enabled) {\\r\\n if (bootstrapResolve) bootstrapResolve()\\r\\n return\\r\\n }\\r\\n\\r\\n if (!Array.isArray(config.required) || config.required.length === 0) {\\r\\n if (bootstrapResolve) bootstrapResolve()\\r\\n return\\r\\n }\\r\\n\\r\\n // Group libraries by load stage for parallel loading within stages\\r\\n var librariesByStage = {}\\r\\n for (var i = 0; i < config.required.length; i++) {\\r\\n var libraryKey = config.required[i]\\r\\n var entry = config.manifest[libraryKey]\\r\\n var stage = entry.loadStage || 0\\r\\n if (!librariesByStage[stage]) librariesByStage[stage] = []\\r\\n librariesByStage[stage].push(libraryKey)\\r\\n }\\r\\n\\r\\n // Load stages sequentially, libraries within each stage in parallel\\r\\n var stages = Object.keys(librariesByStage).sort(function (a, b) {\\r\\n return parseInt(a, 10) - parseInt(b, 10)\\r\\n })\\r\\n\\r\\n for (var s = 0; s < stages.length; s++) {\\r\\n var stage = stages[s]\\r\\n var libs = librariesByStage[stage]\\r\\n\\r\\n // Load all libraries in this stage in parallel\\r\\n var stagePromises = libs.map(function (libraryKey) {\\r\\n return ensureLibraryLoaded(config, libraryKey).catch(\\r\\n function (error) {\\r\\n console.error(\\r\\n '[Venus Libraries] Failed to load library ' + libraryKey,\\r\\n error,\\r\\n )\\r\\n throw error\\r\\n },\\r\\n )\\r\\n })\\r\\n\\r\\n await Promise.all(stagePromises)\\r\\n }\\r\\n\\r\\n if (bootstrapResolve) bootstrapResolve()\\r\\n } catch (error) {\\r\\n console.error('[Venus Libraries] Bootstrap error', error)\\r\\n if (bootstrapReject) bootstrapReject(error)\\r\\n throw error\\r\\n }\\r\\n }\\r\\n\\r\\n // Create a promise that resolves when bootstrap completes\\r\\n var bootstrapPromise = null\\r\\n var bootstrapResolve = null\\r\\n var bootstrapReject = null\\r\\n\\r\\n function getBootstrapPromise() {\\r\\n if (!bootstrapPromise) {\\r\\n bootstrapPromise = new Promise(function (resolve, reject) {\\r\\n bootstrapResolve = resolve\\r\\n bootstrapReject = reject\\r\\n })\\r\\n }\\r\\n return bootstrapPromise\\r\\n }\\r\\n\\r\\n window.__venusLibraryShim = {\\r\\n bootstrap: bootstrap,\\r\\n ready: getBootstrapPromise,\\r\\n getExports: function (libraryKey) {\\r\\n var registry = ensureExportsRegistry()\\r\\n return registry[libraryKey]\\r\\n },\\r\\n __initialized: true,\\r\\n }\\r\\n})()\\r\\n\"","/**\r\n * Webview Library Shim Source\r\n *\r\n * This module exports the shim code that is injected into H5 game WebViews.\r\n * The actual shim code is in webviewLibraryShim.js and imported as a raw string.\r\n *\r\n * Using Vite's ?raw import allows us to:\r\n * - Keep the shim as actual JavaScript (not a string literal)\r\n * - Get proper IDE support (syntax highlighting, linting)\r\n * - Avoid escaping issues\r\n */\r\n\r\nimport shimSource from './webviewLibraryShim.js?raw'\r\n\r\nexport const WEBVIEW_LIBRARY_SHIM_SOURCE = shimSource\r\n\r\nexport function getWebviewLibraryShimSource(): string {\r\n return WEBVIEW_LIBRARY_SHIM_SOURCE\r\n}\r\n"]}
|
|
@@ -43,9 +43,6 @@ var VenusMessageId = /* @__PURE__ */ ((VenusMessageId2) => {
|
|
|
43
43
|
VenusMessageId2["IS_LOCAL_NOTIFICATIONS_ENABLED"] = "H5_IS_LOCAL_NOTIFICATIONS_ENABLED";
|
|
44
44
|
VenusMessageId2["SET_LOCAL_NOTIFICATIONS_ENABLED"] = "H5_SET_LOCAL_NOTIFICATIONS_ENABLED";
|
|
45
45
|
VenusMessageId2["TOAST"] = "H5_TOAST";
|
|
46
|
-
VenusMessageId2["ALERT_DIALOG"] = "H5_ALERT_DIALOG";
|
|
47
|
-
VenusMessageId2["CONFIRM_DIALOG"] = "H5_CONFIRM_DIALOG";
|
|
48
|
-
VenusMessageId2["ACTION_SHEET_SHOW"] = "H5_ACTION_SHEET_SHOW";
|
|
49
46
|
VenusMessageId2["REQUEST_SERVER_TIME"] = "H5_REQUEST_SERVER_TIME";
|
|
50
47
|
VenusMessageId2["SHARE_LINK"] = "H5_SHARE_LINK";
|
|
51
48
|
VenusMessageId2["CREATE_SHARE_QRCODE"] = "H5_CREATE_SHARE_QRCODE";
|
|
@@ -949,7 +946,7 @@ var MockCdnApi = class {
|
|
|
949
946
|
const cleanSubPath = subPath.startsWith("/") ? subPath.slice(1) : subPath;
|
|
950
947
|
const isLocalhost = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
|
951
948
|
if (isLocalhost && !this.forceRemoteCdn) {
|
|
952
|
-
return
|
|
949
|
+
return `cdn/${cleanSubPath}`;
|
|
953
950
|
}
|
|
954
951
|
const pathParts = cleanSubPath.split("/");
|
|
955
952
|
const encodedParts = pathParts.map((part, index) => {
|
|
@@ -1914,40 +1911,6 @@ var RpcPopupsApi = class {
|
|
|
1914
1911
|
__publicField(this, "rpcClient");
|
|
1915
1912
|
this.rpcClient = rpcClient;
|
|
1916
1913
|
}
|
|
1917
|
-
async showActionSheet(items, options) {
|
|
1918
|
-
const result = await this.rpcClient.call(
|
|
1919
|
-
"H5_ACTION_SHEET_SHOW" /* ACTION_SHEET_SHOW */,
|
|
1920
|
-
{
|
|
1921
|
-
title: options?.title || "",
|
|
1922
|
-
message: options?.message || "",
|
|
1923
|
-
options: items,
|
|
1924
|
-
cancelButtonText: options?.cancelButtonText || "Cancel"
|
|
1925
|
-
}
|
|
1926
|
-
);
|
|
1927
|
-
return result;
|
|
1928
|
-
}
|
|
1929
|
-
async showAlert(title, message, options) {
|
|
1930
|
-
const buttonText = options?.buttonText || "OK";
|
|
1931
|
-
await this.rpcClient.call("H5_ALERT_DIALOG" /* ALERT_DIALOG */, {
|
|
1932
|
-
title,
|
|
1933
|
-
message,
|
|
1934
|
-
buttonText
|
|
1935
|
-
});
|
|
1936
|
-
}
|
|
1937
|
-
async showConfirm(title, message, options) {
|
|
1938
|
-
const confirmText = options?.confirmText || "OK";
|
|
1939
|
-
const cancelText = options?.cancelText || "Cancel";
|
|
1940
|
-
const result = await this.rpcClient.call(
|
|
1941
|
-
"H5_CONFIRM_DIALOG" /* CONFIRM_DIALOG */,
|
|
1942
|
-
{
|
|
1943
|
-
title,
|
|
1944
|
-
message,
|
|
1945
|
-
confirmText,
|
|
1946
|
-
cancelText
|
|
1947
|
-
}
|
|
1948
|
-
);
|
|
1949
|
-
return result;
|
|
1950
|
-
}
|
|
1951
1914
|
async showToast(message, options) {
|
|
1952
1915
|
const duration = options?.duration ?? 3e3;
|
|
1953
1916
|
const variant = options?.variant ?? "info";
|
|
@@ -1971,21 +1934,6 @@ var MockPopupsApi = class {
|
|
|
1971
1934
|
__publicField(this, "overlay");
|
|
1972
1935
|
this.overlay = override;
|
|
1973
1936
|
}
|
|
1974
|
-
showActionSheet(items, options) {
|
|
1975
|
-
console.log(
|
|
1976
|
-
`[Venus Mock] Show Action sheet, items: ${JSON.stringify(items, null, 2)}, options: ${JSON.stringify(options, null, 2)}`
|
|
1977
|
-
);
|
|
1978
|
-
return this.overlay.showActionSheet(items, options);
|
|
1979
|
-
}
|
|
1980
|
-
async showAlert(title, message, options) {
|
|
1981
|
-
window.alert(`${title}
|
|
1982
|
-
${message}`);
|
|
1983
|
-
}
|
|
1984
|
-
async showConfirm(title, message, options) {
|
|
1985
|
-
const result = window.confirm(`${title || "Confirm"}
|
|
1986
|
-
${message}`);
|
|
1987
|
-
return result;
|
|
1988
|
-
}
|
|
1989
1937
|
async showToast(message, options) {
|
|
1990
1938
|
const variant = options?.variant ?? "info";
|
|
1991
1939
|
const duration = options?.duration ?? 3e3;
|
|
@@ -2012,41 +1960,6 @@ ${message}`);
|
|
|
2012
1960
|
|
|
2013
1961
|
// src/popups/index.ts
|
|
2014
1962
|
function initializePopups(venusApi, host) {
|
|
2015
|
-
venusApi.showToast = async (input) => {
|
|
2016
|
-
if (typeof input === "string") {
|
|
2017
|
-
return await host.popups.showToast(input);
|
|
2018
|
-
} else {
|
|
2019
|
-
return await host.popups.showToast(input.message, {
|
|
2020
|
-
duration: input.duration,
|
|
2021
|
-
action: input.action,
|
|
2022
|
-
variant: "success"
|
|
2023
|
-
});
|
|
2024
|
-
}
|
|
2025
|
-
};
|
|
2026
|
-
venusApi.showAlert = async (input) => {
|
|
2027
|
-
await host.popups.showAlert(input.title, input.message, {
|
|
2028
|
-
buttonText: input.buttonText
|
|
2029
|
-
});
|
|
2030
|
-
};
|
|
2031
|
-
venusApi.showConfirm = async (input) => {
|
|
2032
|
-
const confirmed = await host.popups.showConfirm(
|
|
2033
|
-
input.title,
|
|
2034
|
-
input.message,
|
|
2035
|
-
{
|
|
2036
|
-
confirmText: input.confirmText,
|
|
2037
|
-
cancelText: input.cancelText
|
|
2038
|
-
}
|
|
2039
|
-
);
|
|
2040
|
-
return confirmed;
|
|
2041
|
-
};
|
|
2042
|
-
venusApi.showActionSheet = async (input) => {
|
|
2043
|
-
return await host.popups.showActionSheet(input.options, {
|
|
2044
|
-
title: input.title,
|
|
2045
|
-
message: input.message,
|
|
2046
|
-
cancelButtonText: input.cancelButtonText,
|
|
2047
|
-
disableCancel: input.disableCancel
|
|
2048
|
-
});
|
|
2049
|
-
};
|
|
2050
1963
|
venusApi.popups = host.popups;
|
|
2051
1964
|
}
|
|
2052
1965
|
|
|
@@ -3550,7 +3463,7 @@ function initializeTime(venusApi, host) {
|
|
|
3550
3463
|
}
|
|
3551
3464
|
|
|
3552
3465
|
// src/version.ts
|
|
3553
|
-
var SDK_VERSION = "3.2.1-beta.
|
|
3466
|
+
var SDK_VERSION = "3.2.1-beta.1";
|
|
3554
3467
|
|
|
3555
3468
|
// src/shared-assets/base64Utils.ts
|
|
3556
3469
|
function base64ToArrayBuffer(base64) {
|
|
@@ -4557,7 +4470,7 @@ var RemoteHost = class {
|
|
|
4557
4470
|
5e3
|
|
4558
4471
|
);
|
|
4559
4472
|
transport.instanceId = response.instanceId;
|
|
4560
|
-
this.log(`Remote Host Initialized with id: ${transport.instanceId}
|
|
4473
|
+
this.log(`Remote Host Initialized with id: ${transport.instanceId}`);
|
|
4561
4474
|
const profile = response.profile;
|
|
4562
4475
|
const sanitizedProfile = {
|
|
4563
4476
|
id: profile.id,
|
|
@@ -5241,5 +5154,5 @@ function initializeSocial(venusApi, host) {
|
|
|
5241
5154
|
}
|
|
5242
5155
|
|
|
5243
5156
|
export { DEFAULT_SHARED_LIB_CDN_BASE, EMBEDDED_LIBRARIES, EMBEDDED_LIBRARY_BY_KEY, HASH_ALGORITHM_NODE, HASH_ALGORITHM_WEB_CRYPTO, HapticFeedbackStyle, HostCdnApi, HostDeviceApi, HostEnvironmentApi, HostProfileApi, HostSystemApi, HostTimeApi, MODULE_TO_LIBRARY_SPECIFIERS, MockAdsApi, MockAiApi, MockAnalyticsApi, MockAvatarApi, MockCdnApi, MockDeviceApi, MockEnvironmentApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLeaderboardApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSocialApi, MockStorageApi, MockSystemApi, MockTimeApi, RemoteHost, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLeaderboardApi, RpcLifecycleApi, RpcLoggingApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRoomsApi, RpcSharedAssetsApi, RpcSimulationApi, RpcSocialApi, RpcStorageApi, SDK_VERSION, VenusMessageId, VenusRoom, base64ToArrayBuffer, base64ToUtf8, computeScoreHash, createHost, createMockStorageApi, getLibraryDefinition, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLeaderboard, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeSocial, initializeStackNavigation, initializeStorage, initializeSystem, initializeTime, isPacificDaylightTime, setupRoomNotifications };
|
|
5244
|
-
//# sourceMappingURL=chunk-
|
|
5245
|
-
//# sourceMappingURL=chunk-
|
|
5157
|
+
//# sourceMappingURL=chunk-46LCYRXS.mjs.map
|
|
5158
|
+
//# sourceMappingURL=chunk-46LCYRXS.mjs.map
|