@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.
@@ -4287,7 +4287,7 @@ class API {
4287
4287
  return {
4288
4288
  clientName: "@seamly/web-ui",
4289
4289
  clientVariant: this.#layoutMode,
4290
- clientVersion: "24.0.0-beta.2",
4290
+ clientVersion: "24.0.0-beta.4",
4291
4291
  currentUrl: window.location.toString(),
4292
4292
  screenResolution: `${window.screen.width}x${window.screen.height}`,
4293
4293
  timezone: getTimeZone(),
@@ -12932,7 +12932,8 @@ const useSeamlyChat = () => {
12932
12932
  (0,hooks_.useEffect)(() => {
12933
12933
  // This is needed to reset the ref to allow connect and start to happen again.
12934
12934
  // Mostly due to Interrupt situations and a reset being called.
12935
- if (!apiConfigReady || !apiConnected) {
12935
+ // Only do this in case both are `false` (reset does this), because the websocket itself will automatically try to reconnect.
12936
+ if (!apiConfigReady && !apiConnected) {
12936
12937
  connectCalled.current = false;
12937
12938
  }
12938
12939
  }, [apiConfigReady, apiConnected]);
@@ -17093,28 +17094,6 @@ const SeamlyEventSubscriber = () => {
17093
17094
  const {
17094
17095
  emitEvent
17095
17096
  } = use_seamly_commands();
17096
- (0,hooks_.useEffect)(() => {
17097
- if (conversation.socket) {
17098
- const {
17099
- onError,
17100
- onOpen
17101
- } = conversation;
17102
- onError(err => {
17103
- const seamlyOfflineError = new SeamlyOfflineError(err);
17104
- dispatch(setInterrupt({
17105
- name: seamlyOfflineError.name,
17106
- message: seamlyOfflineError.message,
17107
- langKey: seamlyOfflineError.langKey,
17108
- originalEvent: seamlyOfflineError.originalEvent,
17109
- originalError: seamlyOfflineError.originalError
17110
- }));
17111
- dispatch(clearEvents());
17112
- });
17113
- onOpen(() => {
17114
- dispatch(clearInterrupt());
17115
- });
17116
- }
17117
- }, [conversation, conversation.socket, dispatch]);
17118
17097
  (0,hooks_.useEffect)(() => {
17119
17098
  if (conversation.socket) {
17120
17099
  conversation.onConnection(({
@@ -17134,6 +17113,20 @@ const SeamlyEventSubscriber = () => {
17134
17113
  }
17135
17114
  return false;
17136
17115
  });
17116
+ conversation.onError(err => {
17117
+ const seamlyOfflineError = new SeamlyOfflineError(err);
17118
+ dispatch(setInterrupt({
17119
+ name: seamlyOfflineError.name,
17120
+ message: seamlyOfflineError.message,
17121
+ langKey: seamlyOfflineError.langKey,
17122
+ originalEvent: seamlyOfflineError.originalEvent,
17123
+ originalError: seamlyOfflineError.originalError
17124
+ }));
17125
+ dispatch(clearEvents());
17126
+ });
17127
+ conversation.onOpen(() => {
17128
+ dispatch(clearInterrupt());
17129
+ });
17137
17130
  }
17138
17131
  }, [conversation, conversation.socket, dispatch]);
17139
17132
  (0,hooks_.useEffect)(() => {