@seamly/web-ui 24.0.0-beta.2 → 24.0.0-beta.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.
@@ -826,7 +826,7 @@ class API {
826
826
  return {
827
827
  clientName: "@seamly/web-ui",
828
828
  clientVariant: this.#layoutMode,
829
- clientVersion: "24.0.0-beta.2",
829
+ clientVersion: "24.0.0-beta.4",
830
830
  currentUrl: window.location.toString(),
831
831
  screenResolution: `${window.screen.width}x${window.screen.height}`,
832
832
  timezone: (0,_utils__WEBPACK_IMPORTED_MODULE_10__.getTimeZone)(),
@@ -8284,28 +8284,6 @@ const SeamlyEventSubscriber = () => {
8284
8284
  const {
8285
8285
  emitEvent
8286
8286
  } = (0,ui_hooks_seamly_hooks__WEBPACK_IMPORTED_MODULE_12__.useSeamlyCommands)();
8287
- (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
8288
- if (conversation.socket) {
8289
- const {
8290
- onError,
8291
- onOpen
8292
- } = conversation;
8293
- onError(err => {
8294
- const seamlyOfflineError = new api_errors_seamly_offline_error__WEBPACK_IMPORTED_MODULE_2__["default"](err);
8295
- dispatch((0,domains_interrupt_slice__WEBPACK_IMPORTED_MODULE_6__.setInterrupt)({
8296
- name: seamlyOfflineError.name,
8297
- message: seamlyOfflineError.message,
8298
- langKey: seamlyOfflineError.langKey,
8299
- originalEvent: seamlyOfflineError.originalEvent,
8300
- originalError: seamlyOfflineError.originalError
8301
- }));
8302
- dispatch((0,domains_store_slice__WEBPACK_IMPORTED_MODULE_9__.clearEvents)());
8303
- });
8304
- onOpen(() => {
8305
- dispatch((0,domains_interrupt_slice__WEBPACK_IMPORTED_MODULE_6__.clearInterrupt)());
8306
- });
8307
- }
8308
- }, [conversation, conversation.socket, dispatch]);
8309
8287
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
8310
8288
  if (conversation.socket) {
8311
8289
  conversation.onConnection(({
@@ -8325,6 +8303,20 @@ const SeamlyEventSubscriber = () => {
8325
8303
  }
8326
8304
  return false;
8327
8305
  });
8306
+ conversation.onError(err => {
8307
+ const seamlyOfflineError = new api_errors_seamly_offline_error__WEBPACK_IMPORTED_MODULE_2__["default"](err);
8308
+ dispatch((0,domains_interrupt_slice__WEBPACK_IMPORTED_MODULE_6__.setInterrupt)({
8309
+ name: seamlyOfflineError.name,
8310
+ message: seamlyOfflineError.message,
8311
+ langKey: seamlyOfflineError.langKey,
8312
+ originalEvent: seamlyOfflineError.originalEvent,
8313
+ originalError: seamlyOfflineError.originalError
8314
+ }));
8315
+ dispatch((0,domains_store_slice__WEBPACK_IMPORTED_MODULE_9__.clearEvents)());
8316
+ });
8317
+ conversation.onOpen(() => {
8318
+ dispatch((0,domains_interrupt_slice__WEBPACK_IMPORTED_MODULE_6__.clearInterrupt)());
8319
+ });
8328
8320
  }
8329
8321
  }, [conversation, conversation.socket, dispatch]);
8330
8322
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
@@ -14265,7 +14257,8 @@ const useSeamlyChat = () => {
14265
14257
  (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
14266
14258
  // This is needed to reset the ref to allow connect and start to happen again.
14267
14259
  // Mostly due to Interrupt situations and a reset being called.
14268
- if (!apiConfigReady || !apiConnected) {
14260
+ // Only do this in case both are `false` (reset does this), because the websocket itself will automatically try to reconnect.
14261
+ if (!apiConfigReady && !apiConnected) {
14269
14262
  connectCalled.current = false;
14270
14263
  }
14271
14264
  }, [apiConfigReady, apiConnected]);