@series-inc/venus-sdk 2.4.1 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +264 -204
- package/dist/{AdsApi-Cz0XgLM8.d.mts → AdsApi-C_GcWmfO.d.mts} +178 -84
- package/dist/{AdsApi-Cz0XgLM8.d.ts → AdsApi-C_GcWmfO.d.ts} +178 -84
- package/dist/{chunk-MWUS3A7C.mjs → chunk-W7IPHM67.mjs} +22 -3
- package/dist/chunk-W7IPHM67.mjs.map +1 -0
- package/dist/{chunk-KQZIPQLJ.mjs → chunk-YDXFZ2A2.mjs} +363 -49
- package/dist/chunk-YDXFZ2A2.mjs.map +1 -0
- package/dist/core-R3FHW62G.mjs +3 -0
- package/dist/{core-RDMPQV6U.mjs.map → core-R3FHW62G.mjs.map} +1 -1
- package/dist/index.cjs +343 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +110 -9
- package/dist/index.d.ts +110 -9
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +579 -1366
- 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 +159 -1270
- package/dist/venus-api/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-KQZIPQLJ.mjs.map +0 -1
- package/dist/chunk-MWUS3A7C.mjs.map +0 -1
- package/dist/core-RDMPQV6U.mjs +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"core-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"core-R3FHW62G.mjs"}
|
package/dist/index.cjs
CHANGED
|
@@ -119,6 +119,10 @@ var VenusMessageId = /* @__PURE__ */ ((VenusMessageId2) => {
|
|
|
119
119
|
VenusMessageId2["H5_ROOM_ELIMINATE_PLAYER"] = "H5_ROOM_ELIMINATE_PLAYER";
|
|
120
120
|
VenusMessageId2["H5_ROOM_PROMOTE_TO_SPECTATOR"] = "H5_ROOM_PROMOTE_TO_SPECTATOR";
|
|
121
121
|
VenusMessageId2["H5_LOAD_EMBEDDED_ASSET"] = "H5_LOAD_EMBEDDED_ASSET";
|
|
122
|
+
VenusMessageId2["H5_SHOW_LOAD_SCREEN"] = "H5_SHOW_LOAD_SCREEN";
|
|
123
|
+
VenusMessageId2["H5_HIDE_LOAD_SCREEN"] = "H5_HIDE_LOAD_SCREEN";
|
|
124
|
+
VenusMessageId2["H5_SET_LOADER_TEXT"] = "H5_SET_LOADER_TEXT";
|
|
125
|
+
VenusMessageId2["H5_SET_LOADER_PROGRESS"] = "H5_SET_LOADER_PROGRESS";
|
|
122
126
|
VenusMessageId2["H5_IAP_OPEN_STORE"] = "H5_IAP_OPEN_STORE";
|
|
123
127
|
VenusMessageId2["H5_IAP_GET_CURRENCY_ICON"] = "H5_IAP_GET_CURRENCY_ICON";
|
|
124
128
|
return VenusMessageId2;
|
|
@@ -140,7 +144,11 @@ var RpcAdsApi = class {
|
|
|
140
144
|
return response.shown;
|
|
141
145
|
}
|
|
142
146
|
async isRewardedAdReadyAsync() {
|
|
143
|
-
|
|
147
|
+
console.log(`[Venus SDK] [RpcAdsApi] isRewardedAdReadyAsync`);
|
|
148
|
+
const response = await this.rpcClient.call(
|
|
149
|
+
"H5_IS_REWARDED_AD_READY" /* IS_REWARDED_AD_READY */
|
|
150
|
+
);
|
|
151
|
+
return response.ready;
|
|
144
152
|
}
|
|
145
153
|
async showRewardedAdAsync() {
|
|
146
154
|
console.log("[Venus SDK] [RpcAdsApi] showRewardedAdAsync");
|
|
@@ -189,6 +197,8 @@ var MockAdsApi = class {
|
|
|
189
197
|
}
|
|
190
198
|
async showInterstitialAd() {
|
|
191
199
|
this.log(`[MockAdsApi] showInterstitialAd`);
|
|
200
|
+
await this.mockOverlay.showAdOverlay();
|
|
201
|
+
this.log("[MockAdsApi] interstitial ad shown");
|
|
192
202
|
return true;
|
|
193
203
|
}
|
|
194
204
|
log(message, ...args) {
|
|
@@ -1553,7 +1563,7 @@ var MockNotificationsApi = class {
|
|
|
1553
1563
|
__publicField(this, "venusApi");
|
|
1554
1564
|
this.venusApi = venusApi;
|
|
1555
1565
|
}
|
|
1556
|
-
async
|
|
1566
|
+
async cancelNotification(notificationId) {
|
|
1557
1567
|
const venusApi = this.venusApi;
|
|
1558
1568
|
if (isWebPlatform()) {
|
|
1559
1569
|
console.log(
|
|
@@ -1594,16 +1604,16 @@ var MockNotificationsApi = class {
|
|
|
1594
1604
|
const isEnabled = venusApi._mock.notificationsEnabled !== false;
|
|
1595
1605
|
return isEnabled;
|
|
1596
1606
|
}
|
|
1597
|
-
async
|
|
1607
|
+
async scheduleAsync(options) {
|
|
1598
1608
|
if (isWebPlatform()) {
|
|
1599
1609
|
console.log(
|
|
1600
1610
|
"[Venus Mock] Notifications not supported on web platform, simulating success"
|
|
1601
1611
|
);
|
|
1602
1612
|
console.info(
|
|
1603
1613
|
"\u{1F514} [Venus Mock] Notification would be scheduled:",
|
|
1604
|
-
title || "Untitled",
|
|
1614
|
+
options.title || "Untitled",
|
|
1605
1615
|
"\n Body:",
|
|
1606
|
-
body || "No body",
|
|
1616
|
+
options.body || "No body",
|
|
1607
1617
|
"\n This is a simulation - real notifications require a native platform."
|
|
1608
1618
|
);
|
|
1609
1619
|
const mockId = `mock-web-notification-${Date.now()}`;
|
|
@@ -1624,9 +1634,11 @@ var MockNotificationsApi = class {
|
|
|
1624
1634
|
venusApi._mock.scheduledNotifications = {};
|
|
1625
1635
|
}
|
|
1626
1636
|
venusApi._mock.scheduledNotifications[notificationId] = {
|
|
1627
|
-
...options,
|
|
1628
1637
|
id: notificationId,
|
|
1629
|
-
|
|
1638
|
+
title: options.title,
|
|
1639
|
+
body: options.body,
|
|
1640
|
+
payload: options.payload,
|
|
1641
|
+
trigger: options.trigger
|
|
1630
1642
|
};
|
|
1631
1643
|
setTimeout(() => {
|
|
1632
1644
|
resolve(notificationId);
|
|
@@ -1649,36 +1661,76 @@ var MockNotificationsApi = class {
|
|
|
1649
1661
|
}
|
|
1650
1662
|
};
|
|
1651
1663
|
|
|
1652
|
-
// src/notifications/
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1669
|
-
|
|
1664
|
+
// src/notifications/RpcNotificationsApi.ts
|
|
1665
|
+
var RpcNotificationsApi = class {
|
|
1666
|
+
constructor(rpcClient) {
|
|
1667
|
+
__publicField(this, "rpcClient");
|
|
1668
|
+
this.rpcClient = rpcClient;
|
|
1669
|
+
}
|
|
1670
|
+
async scheduleAsync(options) {
|
|
1671
|
+
const request = {
|
|
1672
|
+
title: options.title,
|
|
1673
|
+
body: options.body,
|
|
1674
|
+
data: options.payload,
|
|
1675
|
+
key: options.groupId,
|
|
1676
|
+
priority: options.priority || 1,
|
|
1677
|
+
trigger: options.trigger
|
|
1678
|
+
};
|
|
1679
|
+
const response = await this.rpcClient.call(
|
|
1680
|
+
"H5_SCHEDULE_LOCAL_NOTIFICATION" /* SCHEDULE_LOCAL_NOTIFICATION */,
|
|
1681
|
+
request
|
|
1682
|
+
);
|
|
1683
|
+
if (response.scheduled) {
|
|
1684
|
+
return response.id;
|
|
1685
|
+
}
|
|
1686
|
+
return null;
|
|
1687
|
+
}
|
|
1688
|
+
async cancelNotification(id) {
|
|
1689
|
+
const result = await this.rpcClient.call(
|
|
1690
|
+
"H5_CANCEL_LOCAL_NOTIFICATION" /* CANCEL_LOCAL_NOTIFICATION */,
|
|
1670
1691
|
{
|
|
1671
|
-
|
|
1672
|
-
priority: options.priority,
|
|
1673
|
-
groupId: options.groupId,
|
|
1674
|
-
payload: options.payload
|
|
1692
|
+
id
|
|
1675
1693
|
}
|
|
1676
1694
|
);
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1695
|
+
return result.canceled;
|
|
1696
|
+
}
|
|
1697
|
+
async getAllScheduledLocalNotifications() {
|
|
1698
|
+
const response = await this.rpcClient.call(
|
|
1699
|
+
"H5_GET_ALL_SCHEDULED_LOCAL_NOTIFICATIONS" /* GET_ALL_SCHEDULED_LOCAL_NOTIFICATIONS */,
|
|
1700
|
+
{}
|
|
1701
|
+
);
|
|
1702
|
+
const notifications = response.notifications.map((notif) => {
|
|
1703
|
+
return {
|
|
1704
|
+
id: notif.identifier,
|
|
1705
|
+
title: notif.content.title,
|
|
1706
|
+
body: notif.content.body,
|
|
1707
|
+
payload: notif.content.data,
|
|
1708
|
+
trigger: notif.trigger
|
|
1709
|
+
};
|
|
1710
|
+
});
|
|
1711
|
+
return notifications;
|
|
1712
|
+
}
|
|
1713
|
+
async isLocalNotificationsEnabled() {
|
|
1714
|
+
const response = await this.rpcClient.call(
|
|
1715
|
+
"H5_IS_LOCAL_NOTIFICATIONS_ENABLED" /* IS_LOCAL_NOTIFICATIONS_ENABLED */,
|
|
1716
|
+
{}
|
|
1717
|
+
);
|
|
1718
|
+
return response.enabled;
|
|
1719
|
+
}
|
|
1720
|
+
async setLocalNotificationsEnabled(enabled) {
|
|
1721
|
+
const response = await this.rpcClient.call(
|
|
1722
|
+
"H5_SET_LOCAL_NOTIFICATIONS_ENABLED" /* SET_LOCAL_NOTIFICATIONS_ENABLED */,
|
|
1723
|
+
{
|
|
1724
|
+
enabled
|
|
1725
|
+
}
|
|
1726
|
+
);
|
|
1727
|
+
return response.enabled;
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
// src/notifications/index.ts
|
|
1732
|
+
function initializeLocalNotifications(venusApi, host) {
|
|
1733
|
+
venusApi.notifications = host.notifications;
|
|
1682
1734
|
}
|
|
1683
1735
|
|
|
1684
1736
|
// src/popups/RpcPopupsApi.ts
|
|
@@ -1826,17 +1878,22 @@ function initializePopups(venusApi, host) {
|
|
|
1826
1878
|
// src/profile/HostProfileApi.ts
|
|
1827
1879
|
var HostProfileApi = class {
|
|
1828
1880
|
getCurrentProfile() {
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1881
|
+
const profile = window.venus?.profile;
|
|
1882
|
+
if (!profile) {
|
|
1883
|
+
throw new Error(
|
|
1884
|
+
"[Venus SDK] Host profile handshake did not complete. Await VenusAPI.initializeAsync() so INIT_SDK can deliver the profile before calling profile APIs."
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
if (!profile.id || !profile.username) {
|
|
1888
|
+
throw new Error(
|
|
1889
|
+
"[Venus SDK] INIT_SDK returned an incomplete profile (missing id/username). The host must supply real credentials before rooms APIs are used."
|
|
1890
|
+
);
|
|
1835
1891
|
}
|
|
1836
1892
|
return {
|
|
1837
|
-
id:
|
|
1838
|
-
|
|
1839
|
-
|
|
1893
|
+
id: profile.id,
|
|
1894
|
+
username: profile.username,
|
|
1895
|
+
avatarUrl: profile.avatarUrl,
|
|
1896
|
+
isAnonymous: profile.isAnonymous
|
|
1840
1897
|
};
|
|
1841
1898
|
}
|
|
1842
1899
|
};
|
|
@@ -1847,7 +1904,8 @@ var MockProfileApi = class {
|
|
|
1847
1904
|
return {
|
|
1848
1905
|
id: "mock_profile_123",
|
|
1849
1906
|
name: "Mock User",
|
|
1850
|
-
username: "mockuser"
|
|
1907
|
+
username: "mockuser",
|
|
1908
|
+
isAnonymous: false
|
|
1851
1909
|
};
|
|
1852
1910
|
}
|
|
1853
1911
|
};
|
|
@@ -1962,6 +2020,198 @@ var RpcClient = class {
|
|
|
1962
2020
|
}
|
|
1963
2021
|
};
|
|
1964
2022
|
|
|
2023
|
+
// src/rooms/VenusRoom.ts
|
|
2024
|
+
var VenusRoom = class {
|
|
2025
|
+
constructor(roomData) {
|
|
2026
|
+
__publicField(this, "id");
|
|
2027
|
+
__publicField(this, "name");
|
|
2028
|
+
__publicField(this, "players");
|
|
2029
|
+
__publicField(this, "maxPlayers");
|
|
2030
|
+
__publicField(this, "gameType");
|
|
2031
|
+
__publicField(this, "appId");
|
|
2032
|
+
__publicField(this, "type");
|
|
2033
|
+
__publicField(this, "createdBy");
|
|
2034
|
+
__publicField(this, "createdAt");
|
|
2035
|
+
__publicField(this, "updatedAt");
|
|
2036
|
+
__publicField(this, "isPrivate");
|
|
2037
|
+
__publicField(this, "currentPlayers");
|
|
2038
|
+
__publicField(this, "status");
|
|
2039
|
+
__publicField(this, "customMetadata");
|
|
2040
|
+
__publicField(this, "admins");
|
|
2041
|
+
__publicField(this, "roomCode");
|
|
2042
|
+
__publicField(this, "description");
|
|
2043
|
+
__publicField(this, "data");
|
|
2044
|
+
__publicField(this, "version");
|
|
2045
|
+
__publicField(this, "_subscriptions", /* @__PURE__ */ new Map());
|
|
2046
|
+
this.id = roomData.id;
|
|
2047
|
+
this.name = roomData.name;
|
|
2048
|
+
this.players = roomData.currentPlayers || [];
|
|
2049
|
+
this.maxPlayers = roomData.maxPlayers;
|
|
2050
|
+
this.gameType = roomData.gameType;
|
|
2051
|
+
this.appId = roomData.appId;
|
|
2052
|
+
this.type = roomData.type;
|
|
2053
|
+
this.createdBy = roomData.createdBy;
|
|
2054
|
+
this.createdAt = roomData.createdAt;
|
|
2055
|
+
this.updatedAt = roomData.updatedAt;
|
|
2056
|
+
this.isPrivate = roomData.isPrivate;
|
|
2057
|
+
this.currentPlayers = roomData.currentPlayers || [];
|
|
2058
|
+
this.status = roomData.status;
|
|
2059
|
+
this.customMetadata = roomData.customMetadata || {};
|
|
2060
|
+
this.admins = roomData.admins || [];
|
|
2061
|
+
this.roomCode = roomData.roomCode;
|
|
2062
|
+
this.description = roomData.description;
|
|
2063
|
+
this.data = roomData.data || {};
|
|
2064
|
+
this.version = roomData.version;
|
|
2065
|
+
console.log(`VenusRoom: Created room object for ${this.id}`, {
|
|
2066
|
+
hasCustomMetadata: !!this.customMetadata,
|
|
2067
|
+
hasGameState: !!this.customMetadata?.rules?.gameState,
|
|
2068
|
+
gamePhase: this.customMetadata?.rules?.gameState?.phase,
|
|
2069
|
+
currentPlayer: this.customMetadata?.rules?.gameState?.currentPlayer
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
updateFromRoomData(newRoomData) {
|
|
2073
|
+
if (newRoomData.id === this.id) {
|
|
2074
|
+
this.name = newRoomData.name || this.name;
|
|
2075
|
+
this.players = newRoomData.currentPlayers || this.players;
|
|
2076
|
+
this.maxPlayers = newRoomData.maxPlayers || this.maxPlayers;
|
|
2077
|
+
this.gameType = newRoomData.gameType || this.gameType;
|
|
2078
|
+
this.currentPlayers = newRoomData.currentPlayers || this.currentPlayers;
|
|
2079
|
+
this.customMetadata = newRoomData.customMetadata || this.customMetadata;
|
|
2080
|
+
this.data = newRoomData.data || this.data;
|
|
2081
|
+
this.status = newRoomData.status || this.status;
|
|
2082
|
+
this.updatedAt = newRoomData.updatedAt || this.updatedAt;
|
|
2083
|
+
console.log(`VenusRoom: Updated room object ${this.id} with fresh data`, {
|
|
2084
|
+
hasCustomMetadata: !!this.customMetadata,
|
|
2085
|
+
hasGameState: !!this.customMetadata?.rules?.gameState,
|
|
2086
|
+
gamePhase: this.customMetadata?.rules?.gameState?.phase,
|
|
2087
|
+
currentPlayer: this.customMetadata?.rules?.gameState?.currentPlayer
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
|
|
2093
|
+
// src/rooms/index.ts
|
|
2094
|
+
function bindMethod(target, targetKey, source, sourceKey) {
|
|
2095
|
+
const key = sourceKey ?? targetKey;
|
|
2096
|
+
const fn = source?.[key];
|
|
2097
|
+
if (typeof fn === "function") {
|
|
2098
|
+
target[targetKey] = fn.bind(source);
|
|
2099
|
+
return true;
|
|
2100
|
+
}
|
|
2101
|
+
return false;
|
|
2102
|
+
}
|
|
2103
|
+
function setupRoomNotifications(transport, getSubscriptions) {
|
|
2104
|
+
console.log("[Venus Rooms] Setting up room notification listeners");
|
|
2105
|
+
return transport.onVenusMessage((message) => {
|
|
2106
|
+
const subscriptions = getSubscriptions();
|
|
2107
|
+
if (!subscriptions) {
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
if (message.type === "H5_ROOM_DATA_UPDATED") {
|
|
2111
|
+
const messageData = message.data;
|
|
2112
|
+
const { roomId, roomData } = messageData;
|
|
2113
|
+
if (!roomId) return;
|
|
2114
|
+
const callbacks = subscriptions.data?.[roomId] || [];
|
|
2115
|
+
const allEventsCallbacks = subscriptions.allEvents?.[roomId] || [];
|
|
2116
|
+
console.log(`[Venus Rooms] \u{1F514} Room data updated for ${roomId}, notifying ${callbacks.length} callbacks`, roomData);
|
|
2117
|
+
callbacks.forEach((callback) => {
|
|
2118
|
+
try {
|
|
2119
|
+
callback(roomData);
|
|
2120
|
+
} catch (error) {
|
|
2121
|
+
console.error("[Venus Rooms] Error in room data callback:", error);
|
|
2122
|
+
throw error;
|
|
2123
|
+
}
|
|
2124
|
+
});
|
|
2125
|
+
allEventsCallbacks.forEach((callback) => {
|
|
2126
|
+
try {
|
|
2127
|
+
callback({ type: message.type, ...messageData });
|
|
2128
|
+
} catch (error) {
|
|
2129
|
+
console.error("[Venus Rooms] Error in allEvents callback:", error);
|
|
2130
|
+
throw error;
|
|
2131
|
+
}
|
|
2132
|
+
});
|
|
2133
|
+
}
|
|
2134
|
+
if (message.type === "H5_ROOM_MESSAGE_RECEIVED" || message.type === "H5_ROOM_MESSAGE_UPDATED" || message.type === "H5_ROOM_MESSAGE_DELETED") {
|
|
2135
|
+
const messageData = message.data;
|
|
2136
|
+
const { roomId } = messageData;
|
|
2137
|
+
if (!roomId) return;
|
|
2138
|
+
const callbacks = subscriptions.messages?.[roomId] || [];
|
|
2139
|
+
const allEventsCallbacks = subscriptions.allEvents?.[roomId] || [];
|
|
2140
|
+
console.log(`[Venus Rooms] \u{1F514} Room message event for ${roomId}, notifying ${callbacks.length} callbacks`);
|
|
2141
|
+
callbacks.forEach((callback) => {
|
|
2142
|
+
try {
|
|
2143
|
+
callback(messageData);
|
|
2144
|
+
} catch (error) {
|
|
2145
|
+
console.error("[Venus Rooms] Error in room message callback:", error);
|
|
2146
|
+
throw error;
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2149
|
+
allEventsCallbacks.forEach((callback) => {
|
|
2150
|
+
try {
|
|
2151
|
+
callback({ type: message.type, ...messageData });
|
|
2152
|
+
} catch (error) {
|
|
2153
|
+
console.error("[Venus Rooms] Error in allEvents callback:", error);
|
|
2154
|
+
throw error;
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
if (message.type === "app:h5:proposedMoveValidationUpdated") {
|
|
2159
|
+
const messageData = message.data;
|
|
2160
|
+
const { roomId } = messageData;
|
|
2161
|
+
if (!roomId) return;
|
|
2162
|
+
const callbacks = subscriptions.gameEvents?.[roomId] || [];
|
|
2163
|
+
const allEventsCallbacks = subscriptions.allEvents?.[roomId] || [];
|
|
2164
|
+
console.log(`[Venus Rooms] \u{1F514} Proposed move validation updated for ${roomId}, notifying ${callbacks.length} callbacks`);
|
|
2165
|
+
callbacks.forEach((callback) => {
|
|
2166
|
+
try {
|
|
2167
|
+
callback(messageData);
|
|
2168
|
+
} catch (error) {
|
|
2169
|
+
console.error("[Venus Rooms] Error in game event callback:", error);
|
|
2170
|
+
throw error;
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
allEventsCallbacks.forEach((callback) => {
|
|
2174
|
+
try {
|
|
2175
|
+
callback({ type: message.type, ...messageData });
|
|
2176
|
+
} catch (error) {
|
|
2177
|
+
console.error("[Venus Rooms] Error in allEvents callback:", error);
|
|
2178
|
+
throw error;
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
function initializeRoomsApi(venusApi, host) {
|
|
2185
|
+
const roomsApi = host?.rooms;
|
|
2186
|
+
if (!roomsApi) {
|
|
2187
|
+
console.warn(
|
|
2188
|
+
"[Venus SDK] Host did not provide a rooms implementation. Rooms API will be unavailable."
|
|
2189
|
+
);
|
|
2190
|
+
return;
|
|
2191
|
+
}
|
|
2192
|
+
const venus = venusApi;
|
|
2193
|
+
const existingNamespace = venus.rooms || {};
|
|
2194
|
+
const roomsNamespace = Object.assign({}, existingNamespace);
|
|
2195
|
+
const namespaceBindings = [
|
|
2196
|
+
["create", "createRoom"],
|
|
2197
|
+
["joinOrCreate", "joinOrCreateRoom"],
|
|
2198
|
+
["joinByCode", "joinRoomByCode"],
|
|
2199
|
+
["list", "getUserRooms"],
|
|
2200
|
+
["subscribeToRoom", "subscribe"],
|
|
2201
|
+
["updateRoomData", "updateData"],
|
|
2202
|
+
["getRoomData", "getData"],
|
|
2203
|
+
["sendRoomMessage", "sendMessage"],
|
|
2204
|
+
["leaveRoom", "leave"],
|
|
2205
|
+
["startRoomGame", "startGame"],
|
|
2206
|
+
["proposeMove"],
|
|
2207
|
+
["validateMove"]
|
|
2208
|
+
];
|
|
2209
|
+
namespaceBindings.forEach(([targetKey, sourceKey]) => {
|
|
2210
|
+
bindMethod(roomsNamespace, targetKey, roomsApi, sourceKey);
|
|
2211
|
+
});
|
|
2212
|
+
venus.rooms = roomsNamespace;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
1965
2215
|
// src/storage/MockStorageApi.ts
|
|
1966
2216
|
function createMockStorageApi(storageType, appUrl) {
|
|
1967
2217
|
const appIdentifier = appUrl ? generateAppIdentifier(appUrl) : null;
|
|
@@ -3292,7 +3542,7 @@ function initializeTime(venusApi, host) {
|
|
|
3292
3542
|
}
|
|
3293
3543
|
|
|
3294
3544
|
// src/version.ts
|
|
3295
|
-
var SDK_VERSION = "2.
|
|
3545
|
+
var SDK_VERSION = "2.6.2";
|
|
3296
3546
|
|
|
3297
3547
|
// src/shared-assets/consts.ts
|
|
3298
3548
|
var BurgerTimeAssetsCdnPath = "burger-time/Core.stow";
|
|
@@ -3363,6 +3613,47 @@ var MockSharedAssetsApi = class {
|
|
|
3363
3613
|
}
|
|
3364
3614
|
};
|
|
3365
3615
|
|
|
3616
|
+
// src/game-preloader/MockPreloaderApi.ts
|
|
3617
|
+
var MockPreloaderApi = class {
|
|
3618
|
+
async showLoadScreen() {
|
|
3619
|
+
console.log("showLoadScreen");
|
|
3620
|
+
}
|
|
3621
|
+
async hideLoadScreen() {
|
|
3622
|
+
console.log("hideLoadScreen");
|
|
3623
|
+
}
|
|
3624
|
+
async setLoaderText(text) {
|
|
3625
|
+
console.log("setLoaderText", text);
|
|
3626
|
+
}
|
|
3627
|
+
async setLoaderProgress(progress) {
|
|
3628
|
+
console.log("setLoaderProgress", progress);
|
|
3629
|
+
}
|
|
3630
|
+
};
|
|
3631
|
+
|
|
3632
|
+
// src/game-preloader/RpcPreloaderApi.ts
|
|
3633
|
+
var RpcPreloaderApi = class {
|
|
3634
|
+
constructor(rpcClient) {
|
|
3635
|
+
__publicField(this, "rpcClient");
|
|
3636
|
+
this.rpcClient = rpcClient;
|
|
3637
|
+
}
|
|
3638
|
+
async showLoadScreen() {
|
|
3639
|
+
await this.rpcClient.call("H5_SHOW_LOAD_SCREEN" /* H5_SHOW_LOAD_SCREEN */);
|
|
3640
|
+
}
|
|
3641
|
+
async hideLoadScreen() {
|
|
3642
|
+
await this.rpcClient.call("H5_HIDE_LOAD_SCREEN" /* H5_HIDE_LOAD_SCREEN */);
|
|
3643
|
+
}
|
|
3644
|
+
async setLoaderText(text) {
|
|
3645
|
+
await this.rpcClient.call("H5_SET_LOADER_TEXT" /* H5_SET_LOADER_TEXT */, { text });
|
|
3646
|
+
}
|
|
3647
|
+
async setLoaderProgress(progress) {
|
|
3648
|
+
await this.rpcClient.call("H5_SET_LOADER_PROGRESS" /* H5_SET_LOADER_PROGRESS */, { progress });
|
|
3649
|
+
}
|
|
3650
|
+
};
|
|
3651
|
+
|
|
3652
|
+
// src/game-preloader/index.ts
|
|
3653
|
+
function initializePreloader(venusApi, host) {
|
|
3654
|
+
venusApi.preloader = host.preloader;
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3366
3657
|
exports.HapticFeedbackStyle = HapticFeedbackStyle;
|
|
3367
3658
|
exports.HostCdnApi = HostCdnApi;
|
|
3368
3659
|
exports.HostProfileApi = HostProfileApi;
|
|
@@ -3380,6 +3671,7 @@ exports.MockLoggingApi = MockLoggingApi;
|
|
|
3380
3671
|
exports.MockNavigationApi = MockNavigationApi;
|
|
3381
3672
|
exports.MockNotificationsApi = MockNotificationsApi;
|
|
3382
3673
|
exports.MockPopupsApi = MockPopupsApi;
|
|
3674
|
+
exports.MockPreloaderApi = MockPreloaderApi;
|
|
3383
3675
|
exports.MockProfileApi = MockProfileApi;
|
|
3384
3676
|
exports.MockSharedAssetsApi = MockSharedAssetsApi;
|
|
3385
3677
|
exports.MockSimulationApi = MockSimulationApi;
|
|
@@ -3396,12 +3688,15 @@ exports.RpcIapApi = RpcIapApi;
|
|
|
3396
3688
|
exports.RpcLifecycleApi = RpcLifecycleApi;
|
|
3397
3689
|
exports.RpcLoggingApi = RpcLoggingApi;
|
|
3398
3690
|
exports.RpcNavigationApi = RpcNavigationApi;
|
|
3691
|
+
exports.RpcNotificationsApi = RpcNotificationsApi;
|
|
3399
3692
|
exports.RpcPopupsApi = RpcPopupsApi;
|
|
3693
|
+
exports.RpcPreloaderApi = RpcPreloaderApi;
|
|
3400
3694
|
exports.RpcSharedAssetsApi = RpcSharedAssetsApi;
|
|
3401
3695
|
exports.RpcSimulationApi = RpcSimulationApi;
|
|
3402
3696
|
exports.RpcStorageApi = RpcStorageApi;
|
|
3403
3697
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3404
3698
|
exports.VenusMessageId = VenusMessageId;
|
|
3699
|
+
exports.VenusRoom = VenusRoom;
|
|
3405
3700
|
exports.createMockStorageApi = createMockStorageApi;
|
|
3406
3701
|
exports.initializeAds = initializeAds;
|
|
3407
3702
|
exports.initializeAi = initializeAi;
|
|
@@ -3415,11 +3710,14 @@ exports.initializeLifecycleApi = initializeLifecycleApi;
|
|
|
3415
3710
|
exports.initializeLocalNotifications = initializeLocalNotifications;
|
|
3416
3711
|
exports.initializeLoggingApi = initializeLoggingApi;
|
|
3417
3712
|
exports.initializePopups = initializePopups;
|
|
3713
|
+
exports.initializePreloader = initializePreloader;
|
|
3418
3714
|
exports.initializeProfile = initializeProfile;
|
|
3715
|
+
exports.initializeRoomsApi = initializeRoomsApi;
|
|
3419
3716
|
exports.initializeSimulation = initializeSimulation;
|
|
3420
3717
|
exports.initializeStackNavigation = initializeStackNavigation;
|
|
3421
3718
|
exports.initializeStorage = initializeStorage;
|
|
3422
3719
|
exports.initializeTime = initializeTime;
|
|
3423
3720
|
exports.isPacificDaylightTime = isPacificDaylightTime;
|
|
3721
|
+
exports.setupRoomNotifications = setupRoomNotifications;
|
|
3424
3722
|
//# sourceMappingURL=index.cjs.map
|
|
3425
3723
|
//# sourceMappingURL=index.cjs.map
|