@seamly/web-ui 22.3.2 → 22.3.4

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.
@@ -12200,7 +12200,6 @@ class ConversationConnector {
12200
12200
  _ConversationConnector_connectionListeners.set(this, []);
12201
12201
  }
12202
12202
  connect(url, channelName, channelTopic, accessToken) {
12203
- var _a;
12204
12203
  return __awaiter(this, void 0, void 0, function* () {
12205
12204
  this.url = url;
12206
12205
  this.accessToken = accessToken;
@@ -12210,12 +12209,22 @@ class ConversationConnector {
12210
12209
  url: splittedUrl,
12211
12210
  params
12212
12211
  } = split_url_params(this.url);
12213
- if (!((_a = this.socket) === null || _a === void 0 ? void 0 : _a.isConnected())) {
12212
+ if (!this.socket) {
12214
12213
  this.socket = new Socket(splittedUrl, {
12215
12214
  params: assign_default()(assign_default()({}, params), {
12216
12215
  v: apiVersion
12217
- })
12216
+ }),
12217
+ reconnectAfterMs: tries => {
12218
+ // Calculate the backoff time based on the number of tries.
12219
+ const backoff = Math.pow(2, tries) * 250;
12220
+ // Limit the backoff time to 10 seconds.
12221
+ return Math.min(backoff, 10000);
12222
+ }
12218
12223
  });
12224
+ }
12225
+ // Checks if the socket is not already connected before attempting a connection.
12226
+ // This prevents multiple connection attempts during server reconnects, network switches or SPA route changes.
12227
+ if (!this.socket.isConnected()) {
12219
12228
  this.socket.connect();
12220
12229
  }
12221
12230
  this.channel = this.socket.channel(this.channelTopic, {
@@ -12862,7 +12871,7 @@ _API_ready = new (weak_map_default())(), _API_externalId = new (weak_map_default
12862
12871
  return {
12863
12872
  clientName: "@seamly/web-ui",
12864
12873
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
12865
- clientVersion: "22.3.2",
12874
+ clientVersion: "22.3.4",
12866
12875
  currentUrl: window.location.toString(),
12867
12876
  screenResolution: `${window.screen.width}x${window.screen.height}`,
12868
12877
  timezone: getTimeZone(),
@@ -28631,7 +28640,7 @@ const useNotification = () => {
28631
28640
  const [visibilityState, setVisibilityState] = (0,hooks_module/* useState */.eJ)(document.visibilityState);
28632
28641
  const showNotifications = useSelector_useSelector(selectShowNotifications);
28633
28642
  const requestPermission = (0,hooks_module/* useCallback */.I4)(() => use_notifications_awaiter(void 0, void 0, void 0, function* () {
28634
- if (Notification && permission !== 'granted') {
28643
+ if (hasNotificationSupport && permission !== 'granted') {
28635
28644
  const notificationPermission = yield Notification.requestPermission();
28636
28645
  setPermission(notificationPermission);
28637
28646
  }