@seamly/web-ui 21.0.2 → 21.0.3-beta.1
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/index.debug.js +3 -3
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.js +58 -17
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/standalone.js +75 -32
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/style-guide.js +58 -17
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/utils.js +58 -17
- package/build/dist/lib/utils.min.js +1 -1
- package/package.json +1 -1
- package/src/javascripts/api/conversation-connector.ts +49 -12
- package/src/javascripts/api/index.ts +12 -10
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +2 -2
package/build/dist/lib/utils.js
CHANGED
|
@@ -6861,21 +6861,37 @@ class ConversationConnector {
|
|
|
6861
6861
|
this.channel.on('system', msg => {
|
|
6862
6862
|
switch (msg.type) {
|
|
6863
6863
|
case 'attach_channel_succeeded':
|
|
6864
|
-
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this,
|
|
6864
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
6865
|
+
connected: true,
|
|
6866
|
+
ready: true,
|
|
6867
|
+
currentState: 'attach_channel_succeeded'
|
|
6868
|
+
});
|
|
6865
6869
|
break;
|
|
6866
6870
|
}
|
|
6867
6871
|
});
|
|
6868
6872
|
this.socket.onClose(() => {
|
|
6869
6873
|
log('[SOCKET]CLOSE');
|
|
6870
|
-
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this,
|
|
6874
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
6875
|
+
connected: false,
|
|
6876
|
+
ready: false,
|
|
6877
|
+
currentState: 'socket_closed'
|
|
6878
|
+
});
|
|
6871
6879
|
});
|
|
6872
6880
|
this.channel.onClose(() => {
|
|
6873
6881
|
log('[CHANNEL]CLOSE');
|
|
6874
|
-
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this,
|
|
6882
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
6883
|
+
connected: false,
|
|
6884
|
+
ready: false,
|
|
6885
|
+
currentState: 'channel_closed'
|
|
6886
|
+
});
|
|
6875
6887
|
});
|
|
6876
6888
|
this.channel.onError(msg => {
|
|
6877
6889
|
log('[CHANNEL][ERROR]', msg);
|
|
6878
|
-
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this,
|
|
6890
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
6891
|
+
connected: false,
|
|
6892
|
+
ready: false,
|
|
6893
|
+
currentState: 'channel_erred'
|
|
6894
|
+
});
|
|
6879
6895
|
});
|
|
6880
6896
|
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_listenTo).call(this, 'ack', 'ui', 'error', 'participant', 'message', 'service_data', 'system', 'info', 'sync');
|
|
6881
6897
|
});
|
|
@@ -6883,10 +6899,18 @@ class ConversationConnector {
|
|
|
6883
6899
|
start() {
|
|
6884
6900
|
this.channel.join().receive('ok', () => {
|
|
6885
6901
|
log('[CHANNEL][JOIN] OK');
|
|
6886
|
-
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this,
|
|
6902
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
6903
|
+
connected: true,
|
|
6904
|
+
ready: false,
|
|
6905
|
+
currentState: 'join_channel_succeeded'
|
|
6906
|
+
});
|
|
6887
6907
|
}).receive('error', err => {
|
|
6888
6908
|
log('[CHANNEL][JOIN] ERROR', err);
|
|
6889
|
-
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this,
|
|
6909
|
+
__classPrivateFieldGet(this, _ConversationConnector_instances, "m", _ConversationConnector_emitConnectionState).call(this, {
|
|
6910
|
+
connected: false,
|
|
6911
|
+
ready: false,
|
|
6912
|
+
currentState: 'join_channel_erred'
|
|
6913
|
+
});
|
|
6890
6914
|
// @ts-ignore
|
|
6891
6915
|
this.channel.socket.disconnect();
|
|
6892
6916
|
}).receive('timeout', () => {
|
|
@@ -6900,7 +6924,6 @@ class ConversationConnector {
|
|
|
6900
6924
|
(_b = this.socket) === null || _b === void 0 ? void 0 : _b.remove(this.channel);
|
|
6901
6925
|
(_c = this.socket) === null || _c === void 0 ? void 0 : _c.disconnect();
|
|
6902
6926
|
}
|
|
6903
|
-
// eslint-disable-next-line no-unused-vars
|
|
6904
6927
|
onConnection(cb) {
|
|
6905
6928
|
__classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").push(cb);
|
|
6906
6929
|
}
|
|
@@ -6915,7 +6938,15 @@ _ConversationConnector_connectionListeners = new WeakMap(), _ConversationConnect
|
|
|
6915
6938
|
});
|
|
6916
6939
|
});
|
|
6917
6940
|
}, _ConversationConnector_emitConnectionState = function _ConversationConnector_emitConnectionState(payload) {
|
|
6918
|
-
|
|
6941
|
+
// Loop in reverse order to enable splicing the array while iterating
|
|
6942
|
+
for (let i = __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").length - 1; i >= 0; i--) {
|
|
6943
|
+
const cb = __classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f")[i];
|
|
6944
|
+
const complete = cb(payload);
|
|
6945
|
+
// If we only want to execute the callback once, remove it from the listener
|
|
6946
|
+
if (complete) {
|
|
6947
|
+
__classPrivateFieldGet(this, _ConversationConnector_connectionListeners, "f").splice(i, 1);
|
|
6948
|
+
}
|
|
6949
|
+
}
|
|
6919
6950
|
};
|
|
6920
6951
|
;// CONCATENATED MODULE: ./src/javascripts/api/index.ts
|
|
6921
6952
|
var api_awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
@@ -7169,9 +7200,12 @@ class API {
|
|
|
7169
7200
|
conversationInitialState = yield api_classPrivateFieldGet(this, _API_instances, "m", _API_createConversation).call(this);
|
|
7170
7201
|
}
|
|
7171
7202
|
this.conversation.connect(`${api_classPrivateFieldGet(this, _API_instances, "m", _API_getUrlPrefix).call(this, 'ws')}${this.URLS.socket}`, api_classPrivateFieldGet(this, _API_config, "f").context.channelName, api_classPrivateFieldGet(this, _API_instances, "m", _API_getChannelTopic).call(this), api_classPrivateFieldGet(this, _API_instances, "m", _API_getAccessToken).call(this));
|
|
7172
|
-
this.conversation.onConnection(
|
|
7173
|
-
|
|
7174
|
-
|
|
7203
|
+
this.conversation.onConnection(({
|
|
7204
|
+
connected,
|
|
7205
|
+
ready
|
|
7206
|
+
}) => {
|
|
7207
|
+
this.connected = connected;
|
|
7208
|
+
api_classPrivateFieldSet(this, _API_ready, ready, "f");
|
|
7175
7209
|
});
|
|
7176
7210
|
// Send environment
|
|
7177
7211
|
if (api_classPrivateFieldGet(this, _API_config, "f").sendEnvironment) {
|
|
@@ -7254,12 +7288,17 @@ class API {
|
|
|
7254
7288
|
var _a;
|
|
7255
7289
|
if (!this.connected || waitForReady && !api_classPrivateFieldGet(this, _API_ready, "f")) {
|
|
7256
7290
|
// Wait for connection to be made
|
|
7257
|
-
(_a = this.conversation) === null || _a === void 0 ? void 0 : _a.onConnection(
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7291
|
+
(_a = this.conversation) === null || _a === void 0 ? void 0 : _a.onConnection(({
|
|
7292
|
+
connected,
|
|
7293
|
+
ready
|
|
7294
|
+
}) => {
|
|
7295
|
+
this.connected = connected;
|
|
7296
|
+
api_classPrivateFieldSet(this, _API_ready, ready, "f");
|
|
7297
|
+
if (waitForReady ? ready : connected) {
|
|
7261
7298
|
this.send(command, payload, waitForReady);
|
|
7299
|
+
return true;
|
|
7262
7300
|
}
|
|
7301
|
+
return false;
|
|
7263
7302
|
});
|
|
7264
7303
|
return;
|
|
7265
7304
|
}
|
|
@@ -17842,8 +17881,10 @@ const SeamlyEventSubscriber = () => {
|
|
|
17842
17881
|
return () => {};
|
|
17843
17882
|
}, [api, api.connectionInfo, api.conversation]);
|
|
17844
17883
|
(0,hooks_.useEffect)(() => {
|
|
17845
|
-
api.conversation.onConnection(
|
|
17846
|
-
|
|
17884
|
+
api.conversation.onConnection(({
|
|
17885
|
+
currentState
|
|
17886
|
+
}) => {
|
|
17887
|
+
if (currentState === 'join_channel_erred') {
|
|
17847
17888
|
const seamlyGeneralError = new SeamlyGeneralError();
|
|
17848
17889
|
dispatch(setInterrupt({
|
|
17849
17890
|
name: seamlyGeneralError.name,
|