@series-inc/venus-sdk 2.6.2 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -565,11 +565,11 @@ var RpcAdsApi = class {
565
565
  __publicField(this, "rpcClient");
566
566
  this.rpcClient = rpcClient;
567
567
  }
568
- async showInterstitialAd() {
568
+ async showInterstitialAd(options) {
569
569
  console.log(`[Venus SDK] [RpcAdsApi] showInterstitialAd`);
570
570
  const response = await this.rpcClient.call(
571
571
  "H5_SHOW_INTERSTITIAL_AD" /* SHOW_INTERSTITIAL_AD */,
572
- {},
572
+ options || {},
573
573
  -1
574
574
  );
575
575
  return response.shown;
@@ -581,11 +581,11 @@ var RpcAdsApi = class {
581
581
  );
582
582
  return response.ready;
583
583
  }
584
- async showRewardedAdAsync() {
584
+ async showRewardedAdAsync(options) {
585
585
  console.log("[Venus SDK] [RpcAdsApi] showRewardedAdAsync");
586
586
  const result = await this.rpcClient.call(
587
587
  "H5_SHOW_REWARDED_AD" /* SHOW_REWARDED_AD */,
588
- {},
588
+ options || {},
589
589
  -1
590
590
  );
591
591
  const resultAsString = JSON.stringify(result, null, 2);
@@ -609,15 +609,15 @@ var MockAdsApi = class {
609
609
  await createMockDelay(MOCK_DELAYS.short);
610
610
  return true;
611
611
  }
612
- async showRewardedAdAsync() {
612
+ async showRewardedAdAsync(options) {
613
613
  this.log("[MockAdsApi] showRewardedAdAsync called");
614
- await this.mockOverlay.showAdOverlay();
614
+ await this.mockOverlay.showAdOverlay(options);
615
615
  this.log("[MockAdsApi] Rewarded ad completed");
616
616
  return true;
617
617
  }
618
- async showInterstitialAd() {
618
+ async showInterstitialAd(options) {
619
619
  this.log(`[MockAdsApi] showInterstitialAd`);
620
- await this.mockOverlay.showAdOverlay();
620
+ await this.mockOverlay.showAdOverlay(options);
621
621
  this.log("[MockAdsApi] interstitial ad shown");
622
622
  return true;
623
623
  }
@@ -1009,22 +1009,23 @@ var MockNotificationsApi = class {
1009
1009
  const isEnabled = venusApi._mock.notificationsEnabled !== false;
1010
1010
  return isEnabled;
1011
1011
  }
1012
- async scheduleAsync(options) {
1012
+ async scheduleAsync(title, body, seconds, notificationId, options) {
1013
+ const { priority = 50, groupId, payload } = options || {};
1013
1014
  if (isWebPlatform()) {
1014
1015
  console.log(
1015
1016
  "[Venus Mock] Notifications not supported on web platform, simulating success"
1016
1017
  );
1017
1018
  console.info(
1018
1019
  "\u{1F514} [Venus Mock] Notification would be scheduled:",
1019
- options.title || "Untitled",
1020
+ title || "Untitled",
1020
1021
  "\n Body:",
1021
- options.body || "No body",
1022
+ body || "No body",
1022
1023
  "\n This is a simulation - real notifications require a native platform."
1023
1024
  );
1024
1025
  const mockId = `mock-web-notification-${Date.now()}`;
1025
1026
  return mockId;
1026
1027
  }
1027
- console.log("[Venus Mock] Schedule local notification:", options);
1028
+ console.log("[Venus Mock] Schedule local notification:", { title, body, seconds, options });
1028
1029
  const venusApi = this.venusApi;
1029
1030
  if (!venusApi._mock.pendingRequests) {
1030
1031
  console.log("[Venus Mock] Initializing pendingRequests");
@@ -1034,19 +1035,19 @@ var MockNotificationsApi = class {
1034
1035
  console.log("[Venus Mock] Creating request with ID:", requestId);
1035
1036
  return new Promise((resolve) => {
1036
1037
  venusApi._mock.pendingRequests[requestId] = { resolve };
1037
- const notificationId = `mock-notification-${Date.now()}`;
1038
+ const id = notificationId || `mock-notification-${Date.now()}`;
1038
1039
  if (!venusApi._mock.scheduledNotifications) {
1039
1040
  venusApi._mock.scheduledNotifications = {};
1040
1041
  }
1041
- venusApi._mock.scheduledNotifications[notificationId] = {
1042
- id: notificationId,
1043
- title: options.title,
1044
- body: options.body,
1045
- payload: options.payload,
1046
- trigger: options.trigger
1042
+ venusApi._mock.scheduledNotifications[id] = {
1043
+ id,
1044
+ title,
1045
+ body,
1046
+ payload,
1047
+ seconds
1047
1048
  };
1048
1049
  setTimeout(() => {
1049
- resolve(notificationId);
1050
+ resolve(id);
1050
1051
  }, MOCK_DELAYS.short);
1051
1052
  });
1052
1053
  }
@@ -1072,14 +1073,16 @@ var RpcNotificationsApi = class {
1072
1073
  __publicField(this, "rpcClient");
1073
1074
  this.rpcClient = rpcClient;
1074
1075
  }
1075
- async scheduleAsync(options) {
1076
+ async scheduleAsync(title, body, seconds, notificationId, options) {
1077
+ const { priority = 50, groupId, payload } = options || {};
1076
1078
  const request = {
1077
- title: options.title,
1078
- body: options.body,
1079
- data: options.payload,
1080
- key: options.groupId,
1081
- priority: options.priority || 1,
1082
- trigger: options.trigger
1079
+ title,
1080
+ body,
1081
+ priority,
1082
+ key: groupId,
1083
+ data: payload,
1084
+ seconds,
1085
+ notificationId
1083
1086
  };
1084
1087
  const response = await this.rpcClient.call(
1085
1088
  "H5_SCHEDULE_LOCAL_NOTIFICATION" /* SCHEDULE_LOCAL_NOTIFICATION */,
@@ -3973,6 +3976,238 @@ function initializeIap(venusApiInstance, host) {
3973
3976
  venusApiInstance.iap = host.iap;
3974
3977
  }
3975
3978
 
3979
+ // src/leaderboard/RpcLeaderboardApi.ts
3980
+ var RpcLeaderboardApi = class {
3981
+ constructor(rpcClient) {
3982
+ __publicField(this, "rpcClient");
3983
+ this.rpcClient = rpcClient;
3984
+ }
3985
+ startRun(mode) {
3986
+ return this.rpcClient.call(
3987
+ "H5_LEADERBOARD_START_RUN" /* H5_LEADERBOARD_START_RUN */,
3988
+ mode ? { mode } : {}
3989
+ );
3990
+ }
3991
+ submitScore(sessionId, score, durationSec, options) {
3992
+ return this.rpcClient.call(
3993
+ "H5_LEADERBOARD_SUBMIT_SCORE" /* H5_LEADERBOARD_SUBMIT_SCORE */,
3994
+ {
3995
+ sessionId,
3996
+ score,
3997
+ durationSec,
3998
+ mode: options?.mode,
3999
+ telemetry: options?.telemetry,
4000
+ metadata: options?.metadata,
4001
+ hash: options?.hash
4002
+ }
4003
+ );
4004
+ }
4005
+ getLeaderboard(options) {
4006
+ return this.rpcClient.call(
4007
+ "H5_LEADERBOARD_GET" /* H5_LEADERBOARD_GET */,
4008
+ options ?? {}
4009
+ );
4010
+ }
4011
+ getPlayerStats(options) {
4012
+ return this.rpcClient.call(
4013
+ "H5_LEADERBOARD_GET_PLAYER_STATS" /* H5_LEADERBOARD_GET_PLAYER_STATS */,
4014
+ options ?? {}
4015
+ );
4016
+ }
4017
+ getLeaderboardHighlight(options) {
4018
+ return this.rpcClient.call(
4019
+ "H5_LEADERBOARD_GET_HIGHLIGHT" /* H5_LEADERBOARD_GET_HIGHLIGHT */,
4020
+ options ?? {}
4021
+ );
4022
+ }
4023
+ };
4024
+
4025
+ // src/leaderboard/MockLeaderboardApi.ts
4026
+ var MockLeaderboardApi = class {
4027
+ constructor(options) {
4028
+ __publicField(this, "sessions", /* @__PURE__ */ new Map());
4029
+ __publicField(this, "entriesByMode", /* @__PURE__ */ new Map());
4030
+ __publicField(this, "sessionCounter", 0);
4031
+ __publicField(this, "requiresHash", false);
4032
+ if (options?.requiresHash) {
4033
+ this.requiresHash = true;
4034
+ }
4035
+ }
4036
+ configure(options) {
4037
+ if (typeof options.requiresHash === "boolean") {
4038
+ this.requiresHash = options.requiresHash;
4039
+ }
4040
+ }
4041
+ generateNonce() {
4042
+ return (Math.random().toString(36).slice(2) + Math.random().toString(36).slice(2)).slice(0, 64);
4043
+ }
4044
+ getModeKey(mode) {
4045
+ const normalizedMode = mode || "default";
4046
+ return `${normalizedMode}`;
4047
+ }
4048
+ getEntriesForMode(mode) {
4049
+ const key = this.getModeKey(mode);
4050
+ if (!this.entriesByMode.has(key)) {
4051
+ this.entriesByMode.set(key, []);
4052
+ }
4053
+ return this.entriesByMode.get(key);
4054
+ }
4055
+ async startRun(mode) {
4056
+ const sessionId = `mock_session_${++this.sessionCounter}`;
4057
+ const startTime = Date.now();
4058
+ const expiresAt = startTime + 36e5;
4059
+ const resolvedMode = mode || "default";
4060
+ const hashNonce = this.requiresHash ? this.generateNonce() : null;
4061
+ this.sessions.set(sessionId, {
4062
+ id: sessionId,
4063
+ expiresAt,
4064
+ mode: resolvedMode,
4065
+ hashNonce,
4066
+ used: false
4067
+ });
4068
+ return {
4069
+ sessionId,
4070
+ startTime,
4071
+ expiresAt,
4072
+ hashNonce,
4073
+ mode: resolvedMode
4074
+ };
4075
+ }
4076
+ async submitScore(sessionId, score, durationSec, options) {
4077
+ const session = this.sessions.get(sessionId);
4078
+ if (!session) {
4079
+ throw new Error("Invalid leaderboard session");
4080
+ }
4081
+ if (session.expiresAt < Date.now()) {
4082
+ throw new Error("Invalid or expired leaderboard session");
4083
+ }
4084
+ if (session.used) {
4085
+ throw new Error("Leaderboard session already used");
4086
+ }
4087
+ if (options?.mode && options.mode !== session.mode) {
4088
+ throw new Error("Submission mode does not match session mode");
4089
+ }
4090
+ if (session.hashNonce && !options?.hash) {
4091
+ throw new Error("Score hash is required for sealed leaderboard submissions");
4092
+ }
4093
+ const submittedAt = Date.now();
4094
+ const entry = {
4095
+ profileId: `mock_profile`,
4096
+ username: "Mock Player",
4097
+ avatarUrl: null,
4098
+ score,
4099
+ durationSec,
4100
+ submittedAt,
4101
+ sessionId,
4102
+ rank: null,
4103
+ zScore: null,
4104
+ isAnomaly: false,
4105
+ trustScore: 50,
4106
+ metadata: options?.metadata ?? null,
4107
+ isSeed: false
4108
+ };
4109
+ const modeEntries = this.getEntriesForMode(session.mode);
4110
+ modeEntries.push(entry);
4111
+ modeEntries.sort((a, b) => {
4112
+ if (b.score !== a.score) {
4113
+ return b.score - a.score;
4114
+ }
4115
+ return a.submittedAt - b.submittedAt;
4116
+ });
4117
+ modeEntries.forEach((e, index) => {
4118
+ modeEntries[index] = {
4119
+ ...e,
4120
+ rank: index + 1
4121
+ };
4122
+ });
4123
+ session.used = true;
4124
+ session.hashNonce = null;
4125
+ const inserted = modeEntries.find((e) => e.sessionId === sessionId && e.submittedAt === submittedAt);
4126
+ return {
4127
+ accepted: true,
4128
+ rank: inserted?.rank ?? null
4129
+ };
4130
+ }
4131
+ async getLeaderboard(options) {
4132
+ const limit = options?.limit ?? 10;
4133
+ const mode = options?.mode ?? "default";
4134
+ const modeEntries = [...this.getEntriesForMode(mode)];
4135
+ const entries = modeEntries.slice(0, limit).map((entry) => ({
4136
+ ...entry
4137
+ }));
4138
+ return {
4139
+ variant: "standard",
4140
+ entries,
4141
+ totalEntries: modeEntries.length,
4142
+ nextCursor: null,
4143
+ playerRank: null,
4144
+ periodInstance: options?.period ?? "alltime"
4145
+ };
4146
+ }
4147
+ async getPlayerStats(_options) {
4148
+ const mode = _options?.mode ?? "default";
4149
+ const modeEntries = this.getEntriesForMode(mode);
4150
+ const playerEntry = modeEntries[0] ?? null;
4151
+ return {
4152
+ rank: playerEntry?.rank ?? null,
4153
+ score: playerEntry?.score,
4154
+ totalPlayers: modeEntries.length,
4155
+ percentile: playerEntry ? Math.max(0, 1 - ((playerEntry.rank ?? 1) - 1) / Math.max(modeEntries.length, 1)) : void 0,
4156
+ trustScore: 50,
4157
+ periodInstance: _options?.period ?? "alltime"
4158
+ };
4159
+ }
4160
+ async getLeaderboardHighlight(options) {
4161
+ const mode = options?.mode ?? "default";
4162
+ const modeEntries = [...this.getEntriesForMode(mode)];
4163
+ const topCount = Math.max(1, Math.min(options?.topCount ?? 3, 10));
4164
+ const aheadCount = Math.max(0, Math.min(options?.contextAhead ?? 4, 10));
4165
+ const behindCount = Math.max(0, Math.min(options?.contextBehind ?? 2, 10));
4166
+ const topEntries = modeEntries.slice(0, topCount);
4167
+ const playerEntry = modeEntries[0] ?? null;
4168
+ const totalEntries = modeEntries.length;
4169
+ let playerRank = playerEntry?.rank ?? null;
4170
+ let beforePlayer = [];
4171
+ let afterPlayer = [];
4172
+ let totalBefore = playerRank ? playerRank - 1 : 0;
4173
+ let totalAfter = playerRank ? Math.max(totalEntries - playerRank, 0) : 0;
4174
+ let omittedBefore = totalBefore;
4175
+ let omittedAfter = totalAfter;
4176
+ if (playerRank && playerRank > 0) {
4177
+ const beforeStart = Math.max(playerRank - aheadCount - 1, 0);
4178
+ beforePlayer = modeEntries.slice(beforeStart, playerRank - 1);
4179
+ const afterEnd = Math.min(playerRank + behindCount, totalEntries);
4180
+ afterPlayer = modeEntries.slice(playerRank, afterEnd);
4181
+ const shownTopAhead = topEntries.filter((entry) => (entry.rank ?? 0) > 0 && (entry.rank ?? 0) < playerRank).length;
4182
+ omittedBefore = Math.max(totalBefore - (beforePlayer.length + shownTopAhead), 0);
4183
+ omittedAfter = Math.max(totalAfter - afterPlayer.length, 0);
4184
+ }
4185
+ return {
4186
+ variant: "highlight",
4187
+ entries: topEntries,
4188
+ totalEntries,
4189
+ nextCursor: null,
4190
+ playerRank: playerRank ?? null,
4191
+ periodInstance: options?.period ?? "alltime",
4192
+ context: {
4193
+ topEntries,
4194
+ beforePlayer,
4195
+ playerEntry: playerEntry ?? null,
4196
+ afterPlayer,
4197
+ totalBefore,
4198
+ totalAfter,
4199
+ omittedBefore,
4200
+ omittedAfter
4201
+ }
4202
+ };
4203
+ }
4204
+ };
4205
+
4206
+ // src/leaderboard/index.ts
4207
+ function initializeLeaderboard(venusApiInstance, host) {
4208
+ venusApiInstance.leaderboard = host.leaderboard;
4209
+ }
4210
+
3976
4211
  // src/profile/HostProfileApi.ts
3977
4212
  var HostProfileApi = class {
3978
4213
  getCurrentProfile() {
@@ -4265,14 +4500,6 @@ var MockPostApi = class {
4265
4500
  commentsCount: 0
4266
4501
  };
4267
4502
  }
4268
- async sharePostAsync(context) {
4269
- console.log("[Venus Mock] Sharing post with additionalInfo:", context);
4270
- await createMockDelay(MOCK_DELAYS.short);
4271
- return {
4272
- shared: true,
4273
- platform: "mock"
4274
- };
4275
- }
4276
4503
  async toggleFollowAsync() {
4277
4504
  const venusApi = this.venusApi;
4278
4505
  console.log("[Venus Mock] *Toggling follow status");
@@ -4317,11 +4544,6 @@ var RpcPostApi = class {
4317
4544
  openCommentsAsync() {
4318
4545
  return this.rpcClient.call("H5_OPEN_COMMENTS" /* OPEN_COMMENTS */, {});
4319
4546
  }
4320
- sharePostAsync(context) {
4321
- return this.rpcClient.call("H5_SHARE_POST" /* SHARE_POST */, {
4322
- shareContext: context
4323
- });
4324
- }
4325
4547
  toggleFollowAsync() {
4326
4548
  return this.rpcClient.call(
4327
4549
  "H5_TOGGLE_FOLLOW" /* TOGGLE_FOLLOW */,
@@ -4344,9 +4566,6 @@ function initializePost(venusApi, host) {
4344
4566
  venusApi.toggleLikeAsync = () => {
4345
4567
  return host.post.toggleLikeAsync();
4346
4568
  };
4347
- venusApi.sharePostAsync = async (options) => {
4348
- await host.post.sharePostAsync(options);
4349
- };
4350
4569
  venusApi.openCommentsAsync = async () => {
4351
4570
  await host.post.openCommentsAsync();
4352
4571
  };
@@ -4441,59 +4660,73 @@ function initializeFeaturesApi(venusApi, host) {
4441
4660
  // src/lifecycles/MockLifecycleApi.ts
4442
4661
  var MockLifecycleApi = class {
4443
4662
  constructor() {
4444
- __publicField(this, "playCallbacks", []);
4445
- __publicField(this, "pauseCallbacks", []);
4446
- __publicField(this, "resumeCallbacks", []);
4447
- __publicField(this, "quitCallbacks", []);
4448
- __publicField(this, "showCallbacks", []);
4449
- __publicField(this, "hideCallbacks", []);
4450
- }
4451
- onCleanup(callback) {
4452
- }
4453
- onShow(callback) {
4454
- this.showCallbacks.push(callback);
4663
+ __publicField(this, "pauseCallbacks", /* @__PURE__ */ new Set());
4664
+ __publicField(this, "resumeCallbacks", /* @__PURE__ */ new Set());
4665
+ __publicField(this, "awakeCallbacks", /* @__PURE__ */ new Set());
4666
+ __publicField(this, "sleepCallbacks", /* @__PURE__ */ new Set());
4667
+ __publicField(this, "quitCallbacks", /* @__PURE__ */ new Set());
4668
+ }
4669
+ onSleep(callback) {
4670
+ this.sleepCallbacks.add(callback);
4671
+ return {
4672
+ unsubscribe: () => {
4673
+ this.sleepCallbacks.delete(callback);
4674
+ }
4675
+ };
4455
4676
  }
4456
- onHide(callback) {
4457
- this.hideCallbacks.push(callback);
4677
+ onAwake(callback) {
4678
+ this.awakeCallbacks.add(callback);
4679
+ return {
4680
+ unsubscribe: () => {
4681
+ this.awakeCallbacks.delete(callback);
4682
+ }
4683
+ };
4458
4684
  }
4459
4685
  onPause(callback) {
4460
- this.pauseCallbacks.push(callback);
4461
- }
4462
- onPlay(callback) {
4463
- this.playCallbacks.push(callback);
4464
- }
4465
- onQuit(callback) {
4466
- this.quitCallbacks.push(callback);
4686
+ this.pauseCallbacks.add(callback);
4687
+ return {
4688
+ unsubscribe: () => {
4689
+ this.pauseCallbacks.delete(callback);
4690
+ }
4691
+ };
4467
4692
  }
4468
4693
  onResume(callback) {
4469
- this.resumeCallbacks.push(callback);
4694
+ this.resumeCallbacks.add(callback);
4695
+ return {
4696
+ unsubscribe: () => {
4697
+ this.resumeCallbacks.delete(callback);
4698
+ }
4699
+ };
4470
4700
  }
4471
- triggerOnPlayCallbacks(context) {
4472
- for (const callback of this.playCallbacks) {
4473
- callback(context);
4474
- }
4701
+ onQuit(callback) {
4702
+ this.quitCallbacks.add(callback);
4703
+ return {
4704
+ unsubscribe: () => {
4705
+ this.quitCallbacks.delete(callback);
4706
+ }
4707
+ };
4475
4708
  }
4476
- triggerOnPauseCallbacks() {
4709
+ triggerPauseCallbacks() {
4477
4710
  for (const callback of this.pauseCallbacks) {
4478
4711
  callback();
4479
4712
  }
4480
4713
  }
4481
- triggerOnResumeCallbacks() {
4714
+ triggerResumeCallbacks() {
4482
4715
  for (const callback of this.resumeCallbacks) {
4483
4716
  callback();
4484
4717
  }
4485
4718
  }
4486
- triggerOnShowCallbacks(context) {
4487
- for (const callback of this.showCallbacks) {
4488
- callback(context);
4719
+ triggerAwakeCallbacks() {
4720
+ for (const callback of this.awakeCallbacks) {
4721
+ callback();
4489
4722
  }
4490
4723
  }
4491
- triggerOnHideCallbacks() {
4492
- for (const callback of this.hideCallbacks) {
4724
+ triggerSleepCallbacks() {
4725
+ for (const callback of this.sleepCallbacks) {
4493
4726
  callback();
4494
4727
  }
4495
4728
  }
4496
- triggerOnQuitCallbacks() {
4729
+ triggerQuitCallbacks() {
4497
4730
  for (const callback of this.quitCallbacks) {
4498
4731
  callback();
4499
4732
  }
@@ -4506,52 +4739,26 @@ var RpcLifecycleApi = class {
4506
4739
  __publicField(this, "rpcClient");
4507
4740
  this.rpcClient = rpcClient;
4508
4741
  }
4509
- onCleanup(callback) {
4510
- this.rpcClient.onNotification("CLEANUP" /* CLEANUP */, callback);
4511
- }
4512
- onHide(callback) {
4513
- this.rpcClient.onNotification("HIDDEN" /* HIDDEN */, callback);
4514
- }
4515
- onPause(callback) {
4516
- this.rpcClient.onNotification("PAUSE" /* PAUSE */, callback);
4742
+ onQuit(callback) {
4743
+ return this.rpcClient.onNotification("QUIT" /* QUIT */, callback);
4517
4744
  }
4518
- onPlay(callback) {
4519
- this.rpcClient.onNotification("PLAY" /* PLAY */, callback);
4745
+ onSleep(callback) {
4746
+ return this.rpcClient.onNotification("SLEEP" /* SLEEP */, callback);
4520
4747
  }
4521
- onQuit(callback) {
4522
- this.rpcClient.onNotification("QUIT" /* QUIT */, callback);
4748
+ onAwake(callback) {
4749
+ return this.rpcClient.onNotification("AWAKE" /* AWAKE */, callback);
4523
4750
  }
4524
4751
  onResume(callback) {
4525
- this.rpcClient.onNotification("RESUME" /* RESUME */, callback);
4752
+ return this.rpcClient.onNotification("RESUME" /* RESUME */, callback);
4526
4753
  }
4527
- onShow(callback) {
4528
- this.rpcClient.onNotification("SHOWN" /* SHOWN */, callback);
4754
+ onPause(callback) {
4755
+ return this.rpcClient.onNotification("PAUSE" /* PAUSE */, callback);
4529
4756
  }
4530
4757
  };
4531
4758
 
4532
4759
  // src/lifecycles/index.ts
4533
4760
  function initializeLifecycleApi(venusApi, host) {
4534
- venusApi.onPlay = (callback) => {
4535
- host.lifecycle.onPlay(callback);
4536
- };
4537
- venusApi.onPause = (callback) => {
4538
- host.lifecycle.onPause(callback);
4539
- };
4540
- venusApi.onResume = (callback) => {
4541
- host.lifecycle.onResume(callback);
4542
- };
4543
- venusApi.onShow = (callback) => {
4544
- host.lifecycle.onShow(callback);
4545
- };
4546
- venusApi.onHide = (callback) => {
4547
- host.lifecycle.onHide(callback);
4548
- };
4549
- venusApi.onQuit = (callback) => {
4550
- host.lifecycle.onQuit(callback);
4551
- };
4552
- venusApi.onCleanup = (callback) => {
4553
- host.lifecycle.onCleanup(callback);
4554
- };
4761
+ venusApi.lifecycles = host.lifecycle;
4555
4762
  }
4556
4763
 
4557
4764
  // src/simulation/utils.ts
@@ -5604,6 +5811,37 @@ function initializePreloader(venusApi, host) {
5604
5811
  venusApi.preloader = host.preloader;
5605
5812
  }
5606
5813
 
5814
+ // src/social/MockSocialApi.ts
5815
+ var MOCK_QR_CODE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";
5816
+ var MockSocialApi = class {
5817
+ async shareLinkAsync(options) {
5818
+ const shareUrl = this.createMockUrl(options.launchParams);
5819
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
5820
+ try {
5821
+ await navigator.clipboard.writeText(shareUrl);
5822
+ console.log("[Venus SDK] (mock) Copied share URL to clipboard");
5823
+ } catch (error) {
5824
+ console.warn(
5825
+ "[Venus SDK] (mock) Failed to copy share URL to clipboard",
5826
+ error
5827
+ );
5828
+ }
5829
+ }
5830
+ return { shareUrl };
5831
+ }
5832
+ async createQRCodeAsync(options) {
5833
+ const shareUrl = this.createMockUrl(options.launchParams);
5834
+ return {
5835
+ shareUrl,
5836
+ qrCode: MOCK_QR_CODE
5837
+ };
5838
+ }
5839
+ createMockUrl(launchParams) {
5840
+ const params = new URLSearchParams(launchParams);
5841
+ return `https://mock-share.venus.test/share?${params.toString()}`;
5842
+ }
5843
+ };
5844
+
5607
5845
  // src/MockHost.ts
5608
5846
  var ROOMS_UNAVAILABLE_MESSAGE = "[Venus SDK] Rooms API is only available when running inside the Venus host environment.";
5609
5847
  function createUnavailableRoomsApi() {
@@ -5670,7 +5908,9 @@ var MockHost = class {
5670
5908
  __publicField(this, "rooms");
5671
5909
  __publicField(this, "logging");
5672
5910
  __publicField(this, "iap");
5911
+ __publicField(this, "leaderboard");
5673
5912
  __publicField(this, "preloader");
5913
+ __publicField(this, "social");
5674
5914
  __publicField(this, "state", 0 /* PLAYING */);
5675
5915
  __publicField(this, "venusApi");
5676
5916
  __publicField(this, "_isInitialized", false);
@@ -5703,6 +5943,8 @@ var MockHost = class {
5703
5943
  this.rooms = createUnavailableRoomsApi();
5704
5944
  this.logging = new MockLoggingApi();
5705
5945
  this.iap = new MockIapApi();
5946
+ this.social = new MockSocialApi();
5947
+ this.leaderboard = new MockLeaderboardApi();
5706
5948
  initializeRoomsApi(this.venusApi, this);
5707
5949
  this.preloader = new MockPreloaderApi();
5708
5950
  venusApi.isMock = () => true;
@@ -5711,8 +5953,11 @@ var MockHost = class {
5711
5953
  get isInitialized() {
5712
5954
  return this._isInitialized;
5713
5955
  }
5714
- async initialize(options = {}) {
5956
+ initialize(options) {
5715
5957
  this._isInitialized = true;
5958
+ return Promise.resolve({
5959
+ initializeAsleep: false
5960
+ });
5716
5961
  }
5717
5962
  updateUiControls() {
5718
5963
  const controls = {
@@ -5783,27 +6028,87 @@ var MockHost = class {
5783
6028
  };
5784
6029
  }
5785
6030
  async handleMenuButtonClicked() {
5786
- this.triggerLifecycleEvent("PAUSE" /* PAUSE */);
5787
- const sleepAwakeToggleAction = {
6031
+ if (this.state === 0 /* PLAYING */) {
6032
+ this.triggerLifecycleEvent("PAUSE" /* PAUSE */);
6033
+ this.state = 1 /* PAUSED */;
6034
+ }
6035
+ const actionSheetItems = [];
6036
+ const awakeAction = {
5788
6037
  label: "\u23F0 Awake",
5789
- id: "sleepAwakeToggle"
6038
+ id: "awakeAction"
6039
+ };
6040
+ const sleepAction = {
6041
+ label: "\u{1F4A4} Sleep",
6042
+ id: "sleepAction"
6043
+ };
6044
+ const quitAction = {
6045
+ label: "\u{1F6D1} Quit",
6046
+ id: "quitAction"
6047
+ };
6048
+ const playAction = {
6049
+ label: "\u25B6\uFE0F Play",
6050
+ id: "playAction"
5790
6051
  };
5791
6052
  if (this.state === 1 /* PAUSED */) {
5792
- sleepAwakeToggleAction.label = "\u{1F4A4} Sleep";
5793
- }
5794
- const action = await this.showActionSheetOverlay([sleepAwakeToggleAction]);
5795
- if (action === sleepAwakeToggleAction.id) {
5796
- if (this.state === 1 /* PAUSED */) {
5797
- this.state = 2 /* SLEEPING */;
5798
- this.triggerLifecycleEvent("HIDDEN" /* HIDDEN */);
5799
- } else {
5800
- this.state = 1 /* PAUSED */;
5801
- this.triggerLifecycleEvent("SHOWN" /* SHOWN */);
5802
- }
6053
+ actionSheetItems.push(sleepAction);
6054
+ } else if (this.state === 2 /* SLEEPING */) {
6055
+ actionSheetItems.push(awakeAction);
6056
+ }
6057
+ if (this.state !== 3 /* TERMINATED */) {
6058
+ actionSheetItems.push(quitAction);
6059
+ } else if (this.state === 3 /* TERMINATED */) {
6060
+ actionSheetItems.push(playAction);
6061
+ }
6062
+ const action = await this.showActionSheetOverlay(actionSheetItems);
6063
+ if (action === awakeAction.id) {
6064
+ this.tryAwake();
6065
+ } else if (action === sleepAction.id) {
6066
+ this.trySleep();
6067
+ } else if (action === playAction.id) {
6068
+ this.tryPlay();
6069
+ } else if (action === quitAction.id) {
6070
+ this.tryQuit();
5803
6071
  } else {
5804
- if (this.state === 1 /* PAUSED */) {
5805
- this.triggerLifecycleEvent("RESUME" /* RESUME */);
5806
- }
6072
+ this.tryResume();
6073
+ }
6074
+ }
6075
+ tryAwake() {
6076
+ if (this.state === 2 /* SLEEPING */) {
6077
+ this.triggerLifecycleEvent("AWAKE" /* AWAKE */);
6078
+ this.state = 1 /* PAUSED */;
6079
+ }
6080
+ }
6081
+ trySleep() {
6082
+ if (this.state === 1 /* PAUSED */) {
6083
+ this.triggerLifecycleEvent("SLEEP" /* SLEEP */);
6084
+ this.state = 2 /* SLEEPING */;
6085
+ }
6086
+ }
6087
+ tryPlay() {
6088
+ if (this.state === 3 /* TERMINATED */) {
6089
+ this.triggerLifecycleEvent("AWAKE" /* AWAKE */);
6090
+ this.state = 1 /* PAUSED */;
6091
+ this.triggerLifecycleEvent("RESUME" /* RESUME */);
6092
+ this.state = 0 /* PLAYING */;
6093
+ }
6094
+ }
6095
+ tryQuit() {
6096
+ if (this.state === 0 /* PLAYING */) {
6097
+ this.triggerLifecycleEvent("PAUSE" /* PAUSE */);
6098
+ this.state = 1 /* PAUSED */;
6099
+ }
6100
+ if (this.state === 1 /* PAUSED */) {
6101
+ this.triggerLifecycleEvent("SLEEP" /* SLEEP */);
6102
+ this.state = 2 /* SLEEPING */;
6103
+ }
6104
+ if (this.state === 2 /* SLEEPING */) {
6105
+ this.triggerLifecycleEvent("QUIT" /* QUIT */);
6106
+ this.state = 3 /* TERMINATED */;
6107
+ }
6108
+ }
6109
+ tryResume() {
6110
+ if (this.state === 1 /* PAUSED */) {
6111
+ this.triggerLifecycleEvent("RESUME" /* RESUME */);
5807
6112
  }
5808
6113
  }
5809
6114
  async showAdOverlay(type) {
@@ -5934,28 +6239,16 @@ var MockHost = class {
5934
6239
  }
5935
6240
  triggerLifecycleEvent(name) {
5936
6241
  console.log("Trigger Lifecycle Event: ", name);
5937
- if (name == "PLAY" /* PLAY */) {
5938
- this._mockLifecyclesApi.triggerOnPlayCallbacks({
5939
- hudInsets: { top: 60, right: 0, bottom: 0, left: 0 },
5940
- // shareData: {
5941
- // title: 'Mock Share Title',
5942
- // description: 'Mock share description for testing',
5943
- // },
5944
- format: "post"
5945
- // stackData: null,
5946
- });
5947
- } else if (name == "PAUSE" /* PAUSE */) {
5948
- this._mockLifecyclesApi.triggerOnPauseCallbacks();
6242
+ if (name == "PAUSE" /* PAUSE */) {
6243
+ this._mockLifecyclesApi.triggerPauseCallbacks();
5949
6244
  } else if (name == "RESUME" /* RESUME */) {
5950
- this._mockLifecyclesApi.triggerOnResumeCallbacks();
6245
+ this._mockLifecyclesApi.triggerResumeCallbacks();
5951
6246
  } else if (name == "QUIT" /* QUIT */) {
5952
- this._mockLifecyclesApi.triggerOnQuitCallbacks();
5953
- } else if (name == "SHOWN" /* SHOWN */) {
5954
- this._mockLifecyclesApi.triggerOnShowCallbacks({
5955
- hudInsets: { top: 60, bottom: 120, left: 0, right: 0 }
5956
- });
5957
- } else if (name == "HIDDEN" /* HIDDEN */) {
5958
- this._mockLifecyclesApi.triggerOnHideCallbacks();
6247
+ this._mockLifecyclesApi.triggerQuitCallbacks();
6248
+ } else if (name == "AWAKE" /* AWAKE */) {
6249
+ this._mockLifecyclesApi.triggerAwakeCallbacks();
6250
+ } else if (name == "SLEEP" /* SLEEP */) {
6251
+ this._mockLifecyclesApi.triggerSleepCallbacks();
5959
6252
  }
5960
6253
  }
5961
6254
  setOverlayElementVisibility(element, visible) {
@@ -6258,7 +6551,7 @@ var VenusTransport = class {
6258
6551
  return;
6259
6552
  }
6260
6553
  this.notifyVenusMessageReceived(message);
6261
- if (message.type === "PLAY" /* PLAY */ || message.type === "PAUSE" /* PAUSE */ || message.type === "RESUME" /* RESUME */ || message.type === "SHOWN" /* SHOWN */ || message.type === "HIDDEN" /* HIDDEN */ || message.type === "CLEANUP" /* CLEANUP */ || message.type === "QUIT" /* QUIT */) {
6554
+ if (message.type === "PAUSE" /* PAUSE */ || message.type === "RESUME" /* RESUME */ || message.type === "AWAKE" /* AWAKE */ || message.type === "SLEEP" /* SLEEP */ || message.type === "QUIT" /* QUIT */) {
6262
6555
  const notification = {
6263
6556
  type: "rpc-notification",
6264
6557
  id: message.type,
@@ -6728,6 +7021,36 @@ var RpcRoomsApi = class {
6728
7021
  }
6729
7022
  };
6730
7023
 
7024
+ // src/social/RpcSocialApi.ts
7025
+ var RpcSocialApi = class {
7026
+ constructor(rpcClient) {
7027
+ this.rpcClient = rpcClient;
7028
+ }
7029
+ async shareLinkAsync(options) {
7030
+ const result = await this.rpcClient.call("H5_SHARE_LINK" /* SHARE_LINK */, {
7031
+ launchParams: options.launchParams,
7032
+ metadata: options.metadata ?? {}
7033
+ });
7034
+ return {
7035
+ shareUrl: result.shareUrl
7036
+ };
7037
+ }
7038
+ async createQRCodeAsync(options) {
7039
+ const result = await this.rpcClient.call(
7040
+ "H5_CREATE_SHARE_QRCODE" /* CREATE_SHARE_QRCODE */,
7041
+ {
7042
+ launchParams: options.launchParams,
7043
+ metadata: options.metadata ?? {},
7044
+ qrOptions: options.qrOptions ?? {}
7045
+ }
7046
+ );
7047
+ return {
7048
+ shareUrl: result.shareUrl,
7049
+ qrCode: result.qrCode
7050
+ };
7051
+ }
7052
+ };
7053
+
6731
7054
  // src/RemoteHost.ts
6732
7055
  var getCdnBaseUrl = () => {
6733
7056
  return "https://venus-static-01293ak.web.app/";
@@ -6755,7 +7078,9 @@ var RemoteHost = class {
6755
7078
  __publicField(this, "rooms");
6756
7079
  __publicField(this, "logging");
6757
7080
  __publicField(this, "iap");
7081
+ __publicField(this, "leaderboard");
6758
7082
  __publicField(this, "preloader");
7083
+ __publicField(this, "social");
6759
7084
  __publicField(this, "venusApi");
6760
7085
  __publicField(this, "rpcClient");
6761
7086
  __publicField(this, "_isInitialized", false);
@@ -6810,7 +7135,9 @@ var RemoteHost = class {
6810
7135
  this.rooms = new RpcRoomsApi(rpcClient);
6811
7136
  this.logging = new RpcLoggingApi(this, rpcClient);
6812
7137
  this.iap = new RpcIapApi(rpcClient);
7138
+ this.leaderboard = new RpcLeaderboardApi(rpcClient);
6813
7139
  this.preloader = new RpcPreloaderApi(rpcClient);
7140
+ this.social = new RpcSocialApi(rpcClient);
6814
7141
  venusApi.isMock = () => false;
6815
7142
  this.venusApi.sharedAssets = new RpcSharedAssetsApi(rpcClient, venusApi);
6816
7143
  initializeRoomsApi(this.venusApi, this);
@@ -6819,72 +7146,20 @@ var RemoteHost = class {
6819
7146
  get isInitialized() {
6820
7147
  return this._isInitialized;
6821
7148
  }
6822
- async initialize(options = {}) {
7149
+ async initialize(options) {
6823
7150
  this.log("Initializing Remote Host...");
6824
7151
  const transport = new VenusTransport();
6825
7152
  transport.start();
6826
7153
  this.rpcClient.start(transport);
6827
7154
  const roomsApi = this.rooms;
6828
7155
  roomsApi.setupNotifications(transport);
6829
- try {
6830
- this.log("Trying to initialize using NEW method...");
6831
- transport.instanceId = await this.initNew();
6832
- } catch (error) {
6833
- this.log(`Failed to initialize using NEW method: ${error}`);
6834
- this.log(`Trying to initialize using OLD method...`);
6835
- transport.instanceId = await this.initOld(transport);
6836
- }
6837
- this.log(`Remote Host Initialized with id: ${transport.instanceId}`);
6838
- this._isInitialized = true;
6839
- this.venusApi._bootstrap.apiInjected = true;
6840
- this.venusApi._bootstrap.venus = window.venus;
6841
- await this.rpcClient.call("READY" /* READY */, {});
6842
- }
6843
- registerIFrame(transport) {
6844
- return new Promise((resolve, reject) => {
6845
- this.log("Registering IFrame...");
6846
- const location = window.location;
6847
- const pathName = location.pathname;
6848
- const tokens = pathName.split("/");
6849
- const appId = tokens[2];
6850
- console.log("[Venus SDK] App ID ", appId);
6851
- const registrationMessage = {
6852
- type: "H5_IFRAME_REGISTER",
6853
- instanceId: appId,
6854
- direction: "H5_TO_APP",
6855
- timestamp: Date.now()
6856
- };
6857
- const subscription = transport.onVenusMessage((message) => {
6858
- if (message.type == "INJECT_VENUS_API_SCRIPT") {
6859
- const scriptContent = message.data?.script;
6860
- if (!scriptContent) {
6861
- throw new Error("Failed to inject venus api, no script found.");
6862
- }
6863
- const script = document.createElement("script");
6864
- script.type = "text/javascript";
6865
- script.textContent = scriptContent;
6866
- document.head.appendChild(script);
6867
- setTimeout(() => {
6868
- if (window.venus) {
6869
- subscription.unsubscribe();
6870
- resolve(window.venus?._config?.instanceId);
6871
- }
6872
- }, 100);
6873
- }
6874
- });
6875
- transport.sendVenusMessage(registrationMessage);
6876
- setTimeout(() => {
6877
- subscription.unsubscribe();
6878
- reject();
6879
- }, 1e3);
6880
- });
6881
- }
6882
- async initNew() {
6883
7156
  const response = await this.rpcClient.call(
6884
7157
  "INITIALIZE_SDK" /* INIT_SDK */,
6885
7158
  {},
6886
- 1e3
7159
+ 5e3
6887
7160
  );
7161
+ transport.instanceId = response.instanceId;
7162
+ this.log(`Remote Host Initialized with id: ${transport.instanceId}`);
6888
7163
  if (response.profile) {
6889
7164
  const profile = response.profile;
6890
7165
  const sanitizedProfile = {
@@ -6905,26 +7180,17 @@ var RemoteHost = class {
6905
7180
  }
6906
7181
  }
6907
7182
  }
6908
- return response.instanceId;
6909
- }
6910
- async initOld(transport) {
6911
- const isInIframe = window.self !== window.top;
6912
- const hasReactNativeWebView = typeof window.ReactNativeWebView !== "undefined";
6913
- if (hasReactNativeWebView) {
6914
- return this.useInjectedId();
6915
- } else if (isInIframe) {
6916
- return await this.registerIFrame(transport);
6917
- } else {
6918
- throw new Error("Failed to initialize. Unknown Error");
6919
- }
6920
- }
6921
- useInjectedId() {
6922
- const instanceId = window.venus?._config?.instanceId || window._venusInitState?.poolId;
6923
- this.log(`On mobile, using injected instanceId: ${instanceId}`);
6924
- if (!instanceId) {
6925
- throw new Error("Expected injected instanceId on mobile");
7183
+ this._isInitialized = true;
7184
+ this.venusApi.launchParams = response.launchParams || {};
7185
+ await this.rpcClient.call("READY" /* READY */, {});
7186
+ const hudInsets = response.hudInsets;
7187
+ if (hudInsets) {
7188
+ this.venusApi.config.ui.safeArea = hudInsets;
6926
7189
  }
6927
- return instanceId;
7190
+ return {
7191
+ hudInsets,
7192
+ initializeAsleep: response.initializeAsleep
7193
+ };
6928
7194
  }
6929
7195
  log(message) {
6930
7196
  console.log(`[Venus SDK] [Remote Host] ${message}`);
@@ -6946,7 +7212,15 @@ function createHost(venusApi, isMock) {
6946
7212
  init_rooms();
6947
7213
 
6948
7214
  // src/version.ts
6949
- var SDK_VERSION = "2.6.2";
7215
+ var SDK_VERSION = "3.0.1";
7216
+
7217
+ // src/social/index.ts
7218
+ function initializeSocial(venusApi, host) {
7219
+ venusApi.social = host.social;
7220
+ venusApi.getLaunchParams = () => {
7221
+ return venusApi.launchParams || {};
7222
+ };
7223
+ }
6950
7224
 
6951
7225
  // src/venus-api/index.js
6952
7226
  var HapticStyle = {
@@ -7130,6 +7404,7 @@ var VenusAPI2 = class {
7130
7404
  }
7131
7405
  };
7132
7406
  this._detectHostedEnvironment();
7407
+ this.launchParams = {};
7133
7408
  this.config = createProxiedObject.call(this, "config", {
7134
7409
  locale: "en-US",
7135
7410
  languageCode: "en",
@@ -7253,6 +7528,7 @@ var VenusAPI2 = class {
7253
7528
  initializePopups(this, host);
7254
7529
  initializeAnalytics(this, host);
7255
7530
  initializeIap(this, host);
7531
+ initializeLeaderboard(this, host);
7256
7532
  initializeLocalNotifications(this, host);
7257
7533
  initializePreloader(this, host);
7258
7534
  initializeTime(this, host);
@@ -7270,6 +7546,7 @@ var VenusAPI2 = class {
7270
7546
  initializePost(this, host);
7271
7547
  initializeAi(this, host);
7272
7548
  initializeSimulation(this, host);
7549
+ initializeSocial(this, host);
7273
7550
  initializeAssetLoader(this, createProxiedMethod);
7274
7551
  }
7275
7552
  // Generate deterministic instance ID based on current page URL
@@ -7332,95 +7609,23 @@ var VenusAPI2 = class {
7332
7609
  //---------------------------------------
7333
7610
  // PUBLIC API METHODS
7334
7611
  //---------------------------------------
7335
- async initializeAsync(options = {}) {
7612
+ async initializeAsync(options) {
7336
7613
  if (this._shared.initialized) {
7337
7614
  return Promise.resolve(true);
7338
7615
  }
7339
7616
  if (this._shared.initPromise) {
7340
7617
  return this._shared.initPromise;
7341
7618
  }
7342
- this._shared.initPromise = new Promise(async (resolve) => {
7619
+ this._shared.initPromise = new Promise(async (resolve, reject) => {
7343
7620
  try {
7344
- if (options) {
7345
- const supportedRootParams = [
7346
- "hardDisableMock",
7347
- "mock",
7348
- "helpText",
7349
- "forceRemoteCdn",
7350
- "usePreloader"
7351
- ];
7352
- const supportedMockParams = [
7353
- "initDelay",
7354
- "isMobile",
7355
- "isWeb",
7356
- "locale",
7357
- "rooms",
7358
- "craftingConfig",
7359
- "onShowContext",
7360
- "onHideContext"
7361
- ];
7362
- Object.keys(options).forEach((param) => {
7363
- if (!supportedRootParams.includes(param)) {
7364
- this.log(`Unsupported parameter: ${param}`);
7365
- }
7366
- });
7367
- if (options.mockData && typeof options.mockData === "object") {
7368
- console.warn(
7369
- "[Venus Mock] mockData is deprecated, use options.mock instead"
7370
- );
7371
- options.mock = { ...options.mock, ...options.mockData };
7372
- }
7373
- if (options.mock && typeof options.mock === "object") {
7374
- Object.keys(options.mock).forEach((param) => {
7375
- if (!supportedMockParams.includes(param)) {
7376
- this.log(`Unsupported mock parameter: ${param}`);
7377
- }
7378
- });
7379
- }
7380
- if (options.helpText && typeof options.helpText === "string") {
7381
- this._mock.helpText = options.helpText;
7382
- }
7383
- if (typeof options.forceRemoteCdn === "boolean") {
7384
- this._mock.forceRemoteCdn = options.forceRemoteCdn;
7385
- console.log(
7386
- "[Venus Mock] Force remote CDN mode:",
7387
- options.forceRemoteCdn
7388
- );
7389
- }
7390
- }
7391
- await this.host.initialize(options);
7392
- if (!options.usePreloader) {
7393
- await this.host.preloader.hideLoadScreen();
7621
+ const result = await this.host.initialize(options);
7622
+ this._shared.initialized = true;
7623
+ if (!options || !options.usePreloader) {
7624
+ this.host.preloader.hideLoadScreen();
7394
7625
  }
7395
- if (this._bootstrap.isInsideHostedEnvironment) {
7396
- this._shared.initialized = true;
7397
- resolve(true);
7398
- return;
7399
- }
7400
- const mockDelay = options.mock?.initDelay ?? 100;
7401
- this.log(`Using mock initialization delay: ${mockDelay}ms`);
7402
- setTimeout(async () => {
7403
- this._shared.initialized = true;
7404
- this._initializeMockMode();
7405
- resolve(true);
7406
- }, mockDelay);
7626
+ resolve(result);
7407
7627
  } catch (err) {
7408
- console.warn(
7409
- "[Venus Bootstrap] Initialization error, falling back to mock mode",
7410
- err
7411
- );
7412
- if (options.hardDisableMock) {
7413
- console.warn(
7414
- "[Venus Bootstrap] hardDisableMock is true, not using mock."
7415
- );
7416
- resolve(false);
7417
- return;
7418
- }
7419
- this._initializeMockMode();
7420
- setTimeout(async () => {
7421
- this._shared.initialized = true;
7422
- resolve(true);
7423
- }, 100);
7628
+ reject(err);
7424
7629
  }
7425
7630
  });
7426
7631
  return this._shared.initPromise;