@fluid-app/portal-sdk 0.1.415 → 0.1.416

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.
@@ -53,7 +53,7 @@ require("./ShopWidget-syBHBQ-q.cjs");
53
53
  require("./translation-adapter-CcmlvMde.cjs");
54
54
  require("./translation-adapter-Cxne_Utb.cjs");
55
55
  require("./ScreenHeaderContext-NGY43GoF.cjs");
56
- const require_MessagingScreen = require("./MessagingScreen-DVz7cYnY.cjs");
56
+ const require_MessagingScreen = require("./MessagingScreen-JZNWyshx.cjs");
57
57
  require("./prop-types-XaMasfW8.cjs");
58
58
  require("./dist-CqlQDYSy.cjs");
59
59
  require("./es-Br4TMHJ0.cjs");
@@ -3729,17 +3729,7 @@ function useMessagingCable(options) {
3729
3729
  let messageSub = null;
3730
3730
  let appearanceSub = null;
3731
3731
  let notificationsSub = null;
3732
- let tornDown = false;
3733
- let retryCount = 0;
3734
- let retryTimeout = null;
3735
- const MAX_RETRIES = 5;
3736
- const BASE_RETRY_DELAY = 2e3;
3737
3732
  const teardown = () => {
3738
- tornDown = true;
3739
- if (retryTimeout) {
3740
- clearTimeout(retryTimeout);
3741
- retryTimeout = null;
3742
- }
3743
3733
  try {
3744
3734
  messageSub?.unsubscribe();
3745
3735
  } catch (err) {
@@ -3926,42 +3916,23 @@ function useMessagingCable(options) {
3926
3916
  }
3927
3917
  console.debug("[ws] notification", parsed.data);
3928
3918
  };
3929
- const attemptReconnect = (url) => {
3930
- if (tornDown) return;
3931
- if (retryTimeout !== null) return;
3932
- retryCount++;
3933
- if (retryCount > MAX_RETRIES) {
3934
- console.error(`[ws] max retries (${MAX_RETRIES}) exceeded, giving up reconnection`);
3935
- return;
3936
- }
3937
- const delay = Math.min(BASE_RETRY_DELAY * Math.pow(2, retryCount - 1), 3e4);
3938
- console.debug(`[ws] reconnecting in ${delay}ms (attempt ${retryCount}/${MAX_RETRIES})`);
3939
- retryTimeout = setTimeout(() => {
3940
- retryTimeout = null;
3941
- if (!tornDown) connectAt(url, () => {
3942
- retryCount = 0;
3943
- });
3944
- }, delay);
3945
- };
3946
- const connectAt = (url, onFirstConnected) => {
3919
+ const connectAt = (url) => {
3947
3920
  try {
3948
3921
  consumer = createConsumer(`${url}?token=${token}`);
3949
3922
  } catch (err) {
3950
3923
  console.error("[ws] failed to create consumer", err);
3951
- attemptReconnect(url);
3952
3924
  return;
3953
3925
  }
3954
3926
  let reported = false;
3955
3927
  const report = () => {
3956
3928
  if (!reported) {
3957
3929
  reported = true;
3958
- onFirstConnected();
3959
3930
  console.debug("[ws] open", url);
3960
3931
  }
3961
3932
  };
3962
3933
  const handleDisconnect = (channelName) => {
3934
+ reported = false;
3963
3935
  console.debug(`[ws] close: ${channelName}`);
3964
- if (!tornDown) attemptReconnect(url);
3965
3936
  };
3966
3937
  try {
3967
3938
  if (recipientId) messageSub = consumer.subscriptions.create({
@@ -3979,7 +3950,6 @@ function useMessagingCable(options) {
3979
3950
  },
3980
3951
  rejected: () => {
3981
3952
  console.error("[ws] message subscription rejected");
3982
- attemptReconnect(url);
3983
3953
  }
3984
3954
  });
3985
3955
  if (companyId) appearanceSub = consumer.subscriptions.create({
@@ -3997,7 +3967,6 @@ function useMessagingCable(options) {
3997
3967
  },
3998
3968
  rejected: () => {
3999
3969
  console.error("[ws] appearance subscription rejected");
4000
- attemptReconnect(url);
4001
3970
  }
4002
3971
  });
4003
3972
  notificationsSub = consumer.subscriptions.create({ channel: "NotificationsChannel" }, {
@@ -4012,20 +3981,17 @@ function useMessagingCable(options) {
4012
3981
  },
4013
3982
  rejected: () => {
4014
3983
  console.error("[ws] notifications subscription rejected");
4015
- attemptReconnect(url);
4016
3984
  }
4017
3985
  });
4018
3986
  } catch (err) {
4019
3987
  console.error("[ws] failed to create subscriptions", err);
4020
3988
  teardown();
4021
- attemptReconnect(url);
4022
3989
  }
4023
3990
  };
4024
3991
  try {
4025
- connectAt(websocketUrl, () => {});
3992
+ connectAt(websocketUrl);
4026
3993
  } catch (err) {
4027
3994
  console.error("[ws] failed to connect", err);
4028
- attemptReconnect(websocketUrl);
4029
3995
  }
4030
3996
  return () => {
4031
3997
  teardown();
@@ -53813,4 +53779,4 @@ const messagingScreenPropertySchema = {
53813
53779
  //#endregion
53814
53780
  export { useMessagingAuth as i, messagingScreenPropertySchema as n, useMessagingConfig as r, MessagingScreen as t };
53815
53781
 
53816
- //# sourceMappingURL=MessagingScreen-BqA9nLK3.mjs.map
53782
+ //# sourceMappingURL=MessagingScreen-DEGSn8mb.mjs.map