@seamly/web-ui 22.3.0-beta.2 → 22.3.0

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.
@@ -1998,12 +1998,14 @@ class ConversationConnector {
1998
1998
  url: splittedUrl,
1999
1999
  params
2000
2000
  } = split_url_params(this.url);
2001
- this.socket = new Socket(splittedUrl, {
2002
- params: Object.assign(Object.assign({}, params), {
2003
- v: apiVersion
2004
- })
2005
- });
2006
- this.socket.connect();
2001
+ if (!this.socket) {
2002
+ this.socket = new Socket(splittedUrl, {
2003
+ params: Object.assign(Object.assign({}, params), {
2004
+ v: apiVersion
2005
+ })
2006
+ });
2007
+ this.socket.connect();
2008
+ }
2007
2009
  this.channel = this.socket.channel(this.channelTopic, {
2008
2010
  authorization: `Bearer ${this.accessToken}`,
2009
2011
  channelName: this.channelName
@@ -2068,8 +2070,6 @@ class ConversationConnector {
2068
2070
  ready: false,
2069
2071
  currentState: 'join_channel_erred'
2070
2072
  });
2071
- // @ts-ignore
2072
- this.channel.socket.disconnect();
2073
2073
  }).receive('timeout', () => {
2074
2074
  log('[CHANEL][JOIN] Networking issue. Still waiting...');
2075
2075
  });
@@ -2077,10 +2077,7 @@ class ConversationConnector {
2077
2077
  disconnect() {
2078
2078
  var _a;
2079
2079
  (_a = this.channel) === null || _a === void 0 ? void 0 : _a.leave().receive('ok', () => {
2080
- var _a, _b;
2081
2080
  log('[CHANNEL][LEAVE] OK');
2082
- (_a = this.socket) === null || _a === void 0 ? void 0 : _a.remove(this.channel);
2083
- (_b = this.socket) === null || _b === void 0 ? void 0 : _b.disconnect();
2084
2081
  __classPrivateFieldSet(this, _ConversationConnector_connectionListeners, [], "f");
2085
2082
  });
2086
2083
  }
@@ -2622,7 +2619,7 @@ _API_ready = new WeakMap(), _API_externalId = new WeakMap(), _API_conversationAu
2622
2619
  return {
2623
2620
  clientName: "@seamly/web-ui",
2624
2621
  clientVariant: api_classPrivateFieldGet(this, _API_layoutMode, "f"),
2625
- clientVersion: "22.3.0-beta.2",
2622
+ clientVersion: "22.3.0",
2626
2623
  currentUrl: window.location.toString(),
2627
2624
  screenResolution: `${window.screen.width}x${window.screen.height}`,
2628
2625
  timezone: getTimeZone(),
@@ -14007,21 +14004,25 @@ const SeamlyEventSubscriber = () => {
14007
14004
  }
14008
14005
  }, [api, api.connectionInfo, api.conversation.socket, dispatch]);
14009
14006
  (0,hooks_.useEffect)(() => {
14010
- api.conversation.onConnection(({
14011
- currentState
14012
- }) => {
14013
- if (currentState === 'join_channel_erred') {
14014
- const seamlyGeneralError = new SeamlyGeneralError();
14015
- dispatch(setInterrupt({
14016
- name: seamlyGeneralError.name,
14017
- message: seamlyGeneralError.message,
14018
- langKey: seamlyGeneralError.langKey,
14019
- originalEvent: seamlyGeneralError.originalEvent,
14020
- originalError: seamlyGeneralError.originalError,
14021
- action: seamlyGeneralError.action
14022
- }));
14023
- }
14024
- });
14007
+ if (api.connectionInfo && api.conversation.socket) {
14008
+ api.conversation.onConnection(({
14009
+ currentState
14010
+ }) => {
14011
+ if (currentState === 'join_channel_erred') {
14012
+ const seamlyGeneralError = new SeamlyGeneralError();
14013
+ dispatch(setInterrupt({
14014
+ name: seamlyGeneralError.name,
14015
+ message: seamlyGeneralError.message,
14016
+ langKey: seamlyGeneralError.langKey,
14017
+ originalEvent: seamlyGeneralError.originalEvent,
14018
+ originalError: seamlyGeneralError.originalError,
14019
+ action: seamlyGeneralError.action
14020
+ }));
14021
+ return true;
14022
+ }
14023
+ return false;
14024
+ });
14025
+ }
14025
14026
  }, [api, api.connectionInfo, api.conversation.channel, dispatch]);
14026
14027
  (0,hooks_.useEffect)(() => {
14027
14028
  if (api.connectionInfo) {