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

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.
Files changed (34) hide show
  1. package/build/dist/lib/components.js +162 -161
  2. package/build/dist/lib/components.js.map +1 -1
  3. package/build/dist/lib/components.min.js +1 -1
  4. package/build/dist/lib/components.min.js.map +1 -1
  5. package/build/dist/lib/hooks.js +162 -161
  6. package/build/dist/lib/hooks.js.map +1 -1
  7. package/build/dist/lib/hooks.min.js +1 -1
  8. package/build/dist/lib/hooks.min.js.map +1 -1
  9. package/build/dist/lib/index.debug.js +158 -86
  10. package/build/dist/lib/index.debug.js.map +1 -1
  11. package/build/dist/lib/index.debug.min.js +1 -1
  12. package/build/dist/lib/index.debug.min.js.map +1 -1
  13. package/build/dist/lib/index.js +348 -190
  14. package/build/dist/lib/index.js.map +1 -1
  15. package/build/dist/lib/index.min.js +1 -1
  16. package/build/dist/lib/index.min.js.map +1 -1
  17. package/build/dist/lib/standalone.js +764 -201
  18. package/build/dist/lib/standalone.js.map +1 -1
  19. package/build/dist/lib/standalone.min.js +1 -1
  20. package/build/dist/lib/standalone.min.js.map +1 -1
  21. package/build/dist/lib/storage.min.js.map +1 -1
  22. package/build/dist/lib/style-guide.js +202 -188
  23. package/build/dist/lib/style-guide.js.map +1 -1
  24. package/build/dist/lib/style-guide.min.js +1 -1
  25. package/build/dist/lib/style-guide.min.js.map +1 -1
  26. package/build/dist/lib/styles-default-implementation.css +1 -1
  27. package/build/dist/lib/styles.css +1 -1
  28. package/build/dist/lib/utils.js +202 -188
  29. package/build/dist/lib/utils.js.map +1 -1
  30. package/build/dist/lib/utils.min.js +1 -1
  31. package/build/dist/lib/utils.min.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/javascripts/api/conversation-connector.ts +6 -9
  34. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +20 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamly/web-ui",
3
- "version": "22.3.0-beta.2",
3
+ "version": "22.3.0-beta.3",
4
4
  "main": "build/dist/lib/index.js",
5
5
  "types": "build/src/javascripts/index.d.ts",
6
6
  "module": "",
@@ -46,11 +46,12 @@ export default class ConversationConnector {
46
46
  this.channelTopic = channelTopic
47
47
  const { url: splittedUrl, params } = splitUrlParams(this.url)
48
48
 
49
- this.socket = new Socket(splittedUrl, {
50
- params: { ...params, v: apiVersion },
51
- })
52
-
53
- this.socket.connect()
49
+ if (!this.socket) {
50
+ this.socket = new Socket(splittedUrl, {
51
+ params: { ...params, v: apiVersion },
52
+ })
53
+ this.socket.connect()
54
+ }
54
55
 
55
56
  this.channel = this.socket.channel(this.channelTopic, {
56
57
  authorization: `Bearer ${this.accessToken}`,
@@ -138,8 +139,6 @@ export default class ConversationConnector {
138
139
  ready: false,
139
140
  currentState: 'join_channel_erred',
140
141
  })
141
- // @ts-ignore
142
- this.channel.socket.disconnect()
143
142
  })
144
143
  .receive('timeout', () => {
145
144
  log('[CHANEL][JOIN] Networking issue. Still waiting...')
@@ -149,8 +148,6 @@ export default class ConversationConnector {
149
148
  disconnect() {
150
149
  this.channel?.leave().receive('ok', () => {
151
150
  log('[CHANNEL][LEAVE] OK')
152
- this.socket?.remove(this.channel)
153
- this.socket?.disconnect()
154
151
  this.#connectionListeners = []
155
152
  })
156
153
  }
@@ -71,21 +71,26 @@ const SeamlyEventSubscriber = () => {
71
71
  }, [api, api.connectionInfo, api.conversation.socket, dispatch])
72
72
 
73
73
  useEffect(() => {
74
- api.conversation.onConnection(({ currentState }) => {
75
- if (currentState === 'join_channel_erred') {
76
- const seamlyGeneralError = new SeamlyGeneralError()
77
- dispatch(
78
- setInterrupt({
79
- name: seamlyGeneralError.name,
80
- message: seamlyGeneralError.message,
81
- langKey: seamlyGeneralError.langKey,
82
- originalEvent: seamlyGeneralError.originalEvent,
83
- originalError: seamlyGeneralError.originalError,
84
- action: seamlyGeneralError.action,
85
- }),
86
- )
87
- }
88
- })
74
+ if (api.connectionInfo && api.conversation.socket) {
75
+ api.conversation.onConnection(({ currentState }) => {
76
+ if (currentState === 'join_channel_erred') {
77
+ const seamlyGeneralError = new SeamlyGeneralError()
78
+ dispatch(
79
+ setInterrupt({
80
+ name: seamlyGeneralError.name,
81
+ message: seamlyGeneralError.message,
82
+ langKey: seamlyGeneralError.langKey,
83
+ originalEvent: seamlyGeneralError.originalEvent,
84
+ originalError: seamlyGeneralError.originalError,
85
+ action: seamlyGeneralError.action,
86
+ }),
87
+ )
88
+
89
+ return true
90
+ }
91
+ return false
92
+ })
93
+ }
89
94
  }, [api, api.connectionInfo, api.conversation.channel, dispatch])
90
95
 
91
96
  useEffect(() => {