@series-inc/venus-sdk 3.4.1 → 3.4.2-beta.0

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.
@@ -2248,17 +2248,13 @@ var RpcRoomsApi = class {
2248
2248
  setupRoomNotifications(transport, () => this.getSubscriptions());
2249
2249
  }
2250
2250
  async createRoomAsync(options) {
2251
- const response = await this.rpcClient.call(
2251
+ const roomData = await this.rpcClient.call(
2252
2252
  "H5_ROOM_CREATE" /* H5_ROOM_CREATE */,
2253
2253
  {
2254
2254
  options
2255
2255
  }
2256
2256
  );
2257
- if (response.success === false) {
2258
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to create room";
2259
- throw new Error(errorMessage);
2260
- }
2261
- const room = new VenusRoom(response.roomData);
2257
+ const room = new VenusRoom(roomData);
2262
2258
  return room;
2263
2259
  }
2264
2260
  async joinOrCreateRoomAsync(options) {
@@ -2268,29 +2264,21 @@ var RpcRoomsApi = class {
2268
2264
  options
2269
2265
  }
2270
2266
  );
2271
- if (response.success === false) {
2272
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to join or create room";
2273
- throw new Error(errorMessage);
2274
- }
2275
- const room = new VenusRoom(response.value.roomData);
2267
+ const room = new VenusRoom(response.roomData);
2276
2268
  return {
2277
- action: response.value.action,
2269
+ action: response.action,
2278
2270
  room,
2279
- playersJoined: response.value.playersJoined
2271
+ playersJoined: response.playersJoined
2280
2272
  };
2281
2273
  }
2282
2274
  async joinRoomByCodeAsync(roomCode) {
2283
- const response = await this.rpcClient.call(
2275
+ const roomData = await this.rpcClient.call(
2284
2276
  "H5_ROOM_JOIN_BY_CODE" /* H5_ROOM_JOIN_BY_CODE */,
2285
2277
  {
2286
2278
  roomCode
2287
2279
  }
2288
2280
  );
2289
- if (response?.success === false) {
2290
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to join room by code";
2291
- throw new Error(errorMessage);
2292
- }
2293
- const room = new VenusRoom(response.roomData);
2281
+ const room = new VenusRoom(roomData);
2294
2282
  return room;
2295
2283
  }
2296
2284
  // Get user's rooms with optional filtering
@@ -2301,10 +2289,6 @@ var RpcRoomsApi = class {
2301
2289
  includeArchived: options.includeArchived ?? false
2302
2290
  }
2303
2291
  );
2304
- if (response?.success === false) {
2305
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to get user rooms";
2306
- throw new Error(errorMessage);
2307
- }
2308
2292
  const venusRooms = [];
2309
2293
  for (const roomData of response.rooms) {
2310
2294
  if (!roomData.id) {
@@ -2325,7 +2309,7 @@ var RpcRoomsApi = class {
2325
2309
  return venusRooms;
2326
2310
  }
2327
2311
  async updateRoomDataAsync(room, updates, options = {}) {
2328
- const response = await this.rpcClient.call(
2312
+ await this.rpcClient.call(
2329
2313
  "H5_ROOM_UPDATE_DATA" /* H5_ROOM_UPDATE_DATA */,
2330
2314
  {
2331
2315
  roomId: room.id,
@@ -2333,26 +2317,18 @@ var RpcRoomsApi = class {
2333
2317
  merge: options.merge ?? true
2334
2318
  }
2335
2319
  );
2336
- if (response?.success === false) {
2337
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to update room data";
2338
- throw new Error(errorMessage);
2339
- }
2340
2320
  }
2341
2321
  async getRoomDataAsync(room) {
2342
- const response = await this.rpcClient.call(
2322
+ const data = await this.rpcClient.call(
2343
2323
  "H5_ROOM_GET_DATA" /* H5_ROOM_GET_DATA */,
2344
2324
  {
2345
2325
  roomId: room.id
2346
2326
  }
2347
2327
  );
2348
- if (response?.success === false) {
2349
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to get room data";
2350
- throw new Error(errorMessage);
2351
- }
2352
- return response.data;
2328
+ return data;
2353
2329
  }
2354
2330
  async sendRoomMessageAsync(venusRoom, request) {
2355
- const response = await this.rpcClient.call(
2331
+ const messageId = await this.rpcClient.call(
2356
2332
  "H5_ROOM_SEND_MESSAGE" /* H5_ROOM_SEND_MESSAGE */,
2357
2333
  {
2358
2334
  roomId: venusRoom.id,
@@ -2360,26 +2336,18 @@ var RpcRoomsApi = class {
2360
2336
  metadata: request.metadata
2361
2337
  }
2362
2338
  );
2363
- if (response?.success === false) {
2364
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to send message";
2365
- throw new Error(errorMessage);
2366
- }
2367
- return response.messageId;
2339
+ return messageId;
2368
2340
  }
2369
2341
  async leaveRoomAsync(room) {
2370
- const response = await this.rpcClient.call(
2342
+ await this.rpcClient.call(
2371
2343
  "H5_ROOM_LEAVE" /* H5_ROOM_LEAVE */,
2372
2344
  {
2373
2345
  roomId: room.id
2374
2346
  }
2375
2347
  );
2376
- if (response?.success === false) {
2377
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to leave room";
2378
- throw new Error(errorMessage);
2379
- }
2380
2348
  }
2381
2349
  async startRoomGameAsync(room, options = {}) {
2382
- const response = await this.rpcClient.call(
2350
+ await this.rpcClient.call(
2383
2351
  "H5_ROOM_START_GAME" /* H5_ROOM_START_GAME */,
2384
2352
  {
2385
2353
  roomId: room.id,
@@ -2387,13 +2355,9 @@ var RpcRoomsApi = class {
2387
2355
  turnOrder: options.turnOrder ?? null
2388
2356
  }
2389
2357
  );
2390
- if (response?.success === false) {
2391
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to start game";
2392
- throw new Error(errorMessage);
2393
- }
2394
2358
  }
2395
2359
  async proposeMoveAsync(room, proposalPayload) {
2396
- const response = await this.rpcClient.call(
2360
+ const data = await this.rpcClient.call(
2397
2361
  "h5:room:proposeMove" /* H5_ROOM_PROPOSE_MOVE */,
2398
2362
  {
2399
2363
  roomId: room.id,
@@ -2403,11 +2367,7 @@ var RpcRoomsApi = class {
2403
2367
  clientProposalId: proposalPayload.clientProposalId
2404
2368
  }
2405
2369
  );
2406
- if (response?.success === false) {
2407
- const errorMessage = typeof response.error === "string" ? response.error : "Failed to propose move";
2408
- throw new Error(errorMessage);
2409
- }
2410
- return response.data;
2370
+ return data;
2411
2371
  }
2412
2372
  async validateMoveAsync(_room, moveId, verdict) {
2413
2373
  return {
@@ -3459,7 +3419,7 @@ function initializeTime(venusApi, host) {
3459
3419
  }
3460
3420
 
3461
3421
  // src/version.ts
3462
- var SDK_VERSION = "3.4.1";
3422
+ var SDK_VERSION = "3.4.2-beta.0";
3463
3423
 
3464
3424
  // src/shared-assets/base64Utils.ts
3465
3425
  function base64ToArrayBuffer(base64) {
@@ -5154,5 +5114,5 @@ function initializeSocial(venusApi, host) {
5154
5114
  }
5155
5115
 
5156
5116
  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 };
5157
- //# sourceMappingURL=chunk-CEBNBYQX.js.map
5158
- //# sourceMappingURL=chunk-CEBNBYQX.js.map
5117
+ //# sourceMappingURL=chunk-34XHWHTI.js.map
5118
+ //# sourceMappingURL=chunk-34XHWHTI.js.map