@seamly/web-ui 24.0.0-beta.1 → 24.0.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.
- package/build/dist/lib/components.js +8 -1
- package/build/dist/lib/components.js.map +1 -1
- package/build/dist/lib/components.min.js.map +1 -1
- package/build/dist/lib/hooks.js +8 -1
- package/build/dist/lib/hooks.js.map +1 -1
- package/build/dist/lib/hooks.min.js +1 -1
- package/build/dist/lib/hooks.min.js.map +1 -1
- package/build/dist/lib/index.debug.js +54 -41
- package/build/dist/lib/index.debug.js.map +1 -1
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.map +1 -1
- package/build/dist/lib/index.js +54 -41
- package/build/dist/lib/index.js.map +1 -1
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.map +1 -1
- package/build/dist/lib/standalone.js +54 -41
- package/build/dist/lib/standalone.js.map +1 -1
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.map +1 -1
- package/build/dist/lib/style-guide.js +54 -41
- package/build/dist/lib/style-guide.js.map +1 -1
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.map +1 -1
- package/build/dist/lib/utils.js +54 -41
- package/build/dist/lib/utils.js.map +1 -1
- package/build/dist/lib/utils.min.js +1 -1
- package/build/dist/lib/utils.min.js.map +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/conversation-connector.ts +8 -1
- package/src/javascripts/api/index.ts +21 -19
- package/src/javascripts/lib/external-api/index.ts +13 -1
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +22 -26
package/package.json
CHANGED
|
@@ -47,7 +47,14 @@ export default class ConversationConnector {
|
|
|
47
47
|
try {
|
|
48
48
|
switch (json.type) {
|
|
49
49
|
case 'attach_channel_response':
|
|
50
|
-
if (!json.payload.success)
|
|
50
|
+
if (!json.payload.success) {
|
|
51
|
+
this.#emitConnectionState({
|
|
52
|
+
connected: true,
|
|
53
|
+
ready: false,
|
|
54
|
+
currentState: 'attach_channel_erred',
|
|
55
|
+
})
|
|
56
|
+
return
|
|
57
|
+
}
|
|
51
58
|
this.#emitConnectionState({
|
|
52
59
|
connected: true,
|
|
53
60
|
ready: true,
|
|
@@ -455,28 +455,30 @@ export default class API {
|
|
|
455
455
|
? await this.createConversation()
|
|
456
456
|
: undefined
|
|
457
457
|
|
|
458
|
-
this.
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
458
|
+
if (this.URLS.socket) {
|
|
459
|
+
this.conversation.connect(
|
|
460
|
+
`${this.#getUrlPrefix('ws')}${this.URLS.socket.href}`,
|
|
461
|
+
this.#config.context.channelName || '',
|
|
462
|
+
this.getChannelTopic(),
|
|
463
|
+
this.getAccessToken(),
|
|
464
|
+
)
|
|
464
465
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
this.conversation.onConnection(({ connected, ready }) => {
|
|
467
|
+
this.connected = connected
|
|
468
|
+
this.#ready = ready
|
|
469
|
+
})
|
|
469
470
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
471
|
+
// Send environment
|
|
472
|
+
const environment =
|
|
473
|
+
this.#config.sendEnvironment === true
|
|
474
|
+
? this.getEnvironment()
|
|
475
|
+
: this.#config.sendEnvironment
|
|
475
476
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
477
|
+
if (this.#config.sendEnvironment) {
|
|
478
|
+
this.send('context', {
|
|
479
|
+
environment,
|
|
480
|
+
})
|
|
481
|
+
}
|
|
480
482
|
}
|
|
481
483
|
|
|
482
484
|
return conversationInitialState
|
|
@@ -13,6 +13,7 @@ class ExternalApi {
|
|
|
13
13
|
constructor(appConfig) {
|
|
14
14
|
this._waitingActions = []
|
|
15
15
|
this._instances = {}
|
|
16
|
+
this.timeouts = {}
|
|
16
17
|
this.appConfig = appConfig
|
|
17
18
|
this.context = {}
|
|
18
19
|
}
|
|
@@ -124,7 +125,7 @@ class ExternalApi {
|
|
|
124
125
|
this._instances[config.namespace] = instance
|
|
125
126
|
// Clear the context after creating the instance, so we do not reuse it for the next
|
|
126
127
|
this.context = {}
|
|
127
|
-
instance.
|
|
128
|
+
this.debouncedRender(instance, config.namespace)
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
131
|
|
|
@@ -158,6 +159,17 @@ class ExternalApi {
|
|
|
158
159
|
return new Engine(config, this)
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
/**
|
|
163
|
+
* @param {Engine} instance
|
|
164
|
+
* @param {string} namespace
|
|
165
|
+
*/
|
|
166
|
+
debouncedRender(instance, namespace) {
|
|
167
|
+
window.clearTimeout(this.timeouts[namespace])
|
|
168
|
+
this.timeouts[namespace] = window.setTimeout(() => {
|
|
169
|
+
instance.render()
|
|
170
|
+
}, 100)
|
|
171
|
+
}
|
|
172
|
+
|
|
161
173
|
destroy(instance) {
|
|
162
174
|
if (!instance) {
|
|
163
175
|
Object.entries(this._instances).forEach(([namespace, _instance]) => {
|
|
@@ -45,34 +45,10 @@ const SeamlyEventSubscriber = () => {
|
|
|
45
45
|
const { initCountdown, endCountdown } = useSeamlyIdleDetachCountdown()
|
|
46
46
|
const { emitEvent } = useSeamlyCommands()
|
|
47
47
|
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
if (conversation.socket) {
|
|
50
|
-
const { onError, onOpen } = conversation
|
|
51
|
-
onError((err) => {
|
|
52
|
-
const seamlyOfflineError = new SeamlyOfflineError(err)
|
|
53
|
-
dispatch(
|
|
54
|
-
setInterrupt({
|
|
55
|
-
name: seamlyOfflineError.name,
|
|
56
|
-
message: seamlyOfflineError.message,
|
|
57
|
-
langKey: seamlyOfflineError.langKey,
|
|
58
|
-
originalEvent: seamlyOfflineError.originalEvent,
|
|
59
|
-
originalError: seamlyOfflineError.originalError,
|
|
60
|
-
}),
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
dispatch(clearEvents())
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
onOpen(() => {
|
|
67
|
-
dispatch(clearInterrupt())
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
}, [conversation, dispatch])
|
|
71
|
-
|
|
72
48
|
useEffect(() => {
|
|
73
49
|
if (conversation.socket) {
|
|
74
50
|
conversation.onConnection(({ currentState }) => {
|
|
75
|
-
if (currentState === '
|
|
51
|
+
if (currentState === 'attach_channel_erred') {
|
|
76
52
|
const seamlyGeneralError = new SeamlyGeneralError()
|
|
77
53
|
dispatch(
|
|
78
54
|
setInterrupt({
|
|
@@ -87,10 +63,30 @@ const SeamlyEventSubscriber = () => {
|
|
|
87
63
|
|
|
88
64
|
return true
|
|
89
65
|
}
|
|
66
|
+
|
|
90
67
|
return false
|
|
91
68
|
})
|
|
69
|
+
|
|
70
|
+
conversation.onError((err) => {
|
|
71
|
+
const seamlyOfflineError = new SeamlyOfflineError(err)
|
|
72
|
+
dispatch(
|
|
73
|
+
setInterrupt({
|
|
74
|
+
name: seamlyOfflineError.name,
|
|
75
|
+
message: seamlyOfflineError.message,
|
|
76
|
+
langKey: seamlyOfflineError.langKey,
|
|
77
|
+
originalEvent: seamlyOfflineError.originalEvent,
|
|
78
|
+
originalError: seamlyOfflineError.originalError,
|
|
79
|
+
}),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
dispatch(clearEvents())
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
conversation.onOpen(() => {
|
|
86
|
+
dispatch(clearInterrupt())
|
|
87
|
+
})
|
|
92
88
|
}
|
|
93
|
-
}, [conversation, dispatch])
|
|
89
|
+
}, [conversation, conversation.socket, dispatch])
|
|
94
90
|
|
|
95
91
|
useEffect(() => {
|
|
96
92
|
conversation.onConnection(({ connected }) => {
|