@seamly/web-ui 24.0.0-beta.1 → 24.0.0-beta.2
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 +41 -20
- 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 +41 -20
- 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 +41 -20
- 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 +41 -20
- 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 +41 -20
- 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 +3 -3
|
@@ -3219,7 +3219,14 @@ class ConversationConnector {
|
|
|
3219
3219
|
try {
|
|
3220
3220
|
switch (json.type) {
|
|
3221
3221
|
case 'attach_channel_response':
|
|
3222
|
-
if (!json.payload.success)
|
|
3222
|
+
if (!json.payload.success) {
|
|
3223
|
+
this.#emitConnectionState({
|
|
3224
|
+
connected: true,
|
|
3225
|
+
ready: false,
|
|
3226
|
+
currentState: 'attach_channel_erred'
|
|
3227
|
+
});
|
|
3228
|
+
return;
|
|
3229
|
+
}
|
|
3223
3230
|
this.#emitConnectionState({
|
|
3224
3231
|
connected: true,
|
|
3225
3232
|
ready: true,
|
|
@@ -3941,21 +3948,23 @@ class API {
|
|
|
3941
3948
|
async connect() {
|
|
3942
3949
|
this.connected = false;
|
|
3943
3950
|
const conversationInitialState = !this.hasConversation() ? await this.createConversation() : undefined;
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
// Send environment
|
|
3954
|
-
const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
|
|
3955
|
-
if (this.#config.sendEnvironment) {
|
|
3956
|
-
this.send('context', {
|
|
3957
|
-
environment
|
|
3951
|
+
if (this.URLS.socket) {
|
|
3952
|
+
this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
|
|
3953
|
+
this.conversation.onConnection(({
|
|
3954
|
+
connected,
|
|
3955
|
+
ready
|
|
3956
|
+
}) => {
|
|
3957
|
+
this.connected = connected;
|
|
3958
|
+
this.#ready = ready;
|
|
3958
3959
|
});
|
|
3960
|
+
|
|
3961
|
+
// Send environment
|
|
3962
|
+
const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
|
|
3963
|
+
if (this.#config.sendEnvironment) {
|
|
3964
|
+
this.send('context', {
|
|
3965
|
+
environment
|
|
3966
|
+
});
|
|
3967
|
+
}
|
|
3959
3968
|
}
|
|
3960
3969
|
return conversationInitialState;
|
|
3961
3970
|
}
|
|
@@ -3994,7 +4003,7 @@ class API {
|
|
|
3994
4003
|
return {
|
|
3995
4004
|
clientName: "@seamly/web-ui",
|
|
3996
4005
|
clientVariant: this.#layoutMode,
|
|
3997
|
-
clientVersion: "24.0.0-beta.
|
|
4006
|
+
clientVersion: "24.0.0-beta.2",
|
|
3998
4007
|
currentUrl: window.location.toString(),
|
|
3999
4008
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
4000
4009
|
timezone: getTimeZone(),
|
|
@@ -16821,13 +16830,13 @@ const SeamlyEventSubscriber = () => {
|
|
|
16821
16830
|
dispatch(clearInterrupt());
|
|
16822
16831
|
});
|
|
16823
16832
|
}
|
|
16824
|
-
}, [conversation, dispatch]);
|
|
16833
|
+
}, [conversation, conversation.socket, dispatch]);
|
|
16825
16834
|
(0,hooks_.useEffect)(() => {
|
|
16826
16835
|
if (conversation.socket) {
|
|
16827
16836
|
conversation.onConnection(({
|
|
16828
16837
|
currentState
|
|
16829
16838
|
}) => {
|
|
16830
|
-
if (currentState === '
|
|
16839
|
+
if (currentState === 'attach_channel_erred') {
|
|
16831
16840
|
const seamlyGeneralError = new SeamlyGeneralError();
|
|
16832
16841
|
dispatch(setInterrupt({
|
|
16833
16842
|
name: seamlyGeneralError.name,
|
|
@@ -16842,7 +16851,7 @@ const SeamlyEventSubscriber = () => {
|
|
|
16842
16851
|
return false;
|
|
16843
16852
|
});
|
|
16844
16853
|
}
|
|
16845
|
-
}, [conversation, dispatch]);
|
|
16854
|
+
}, [conversation, conversation.socket, dispatch]);
|
|
16846
16855
|
(0,hooks_.useEffect)(() => {
|
|
16847
16856
|
conversation.onConnection(({
|
|
16848
16857
|
connected
|
|
@@ -21496,6 +21505,7 @@ class ExternalApi {
|
|
|
21496
21505
|
constructor(appConfig) {
|
|
21497
21506
|
this._waitingActions = [];
|
|
21498
21507
|
this._instances = {};
|
|
21508
|
+
this.timeouts = {};
|
|
21499
21509
|
this.appConfig = appConfig;
|
|
21500
21510
|
this.context = {};
|
|
21501
21511
|
}
|
|
@@ -21605,7 +21615,7 @@ class ExternalApi {
|
|
|
21605
21615
|
this._instances[config.namespace] = instance;
|
|
21606
21616
|
// Clear the context after creating the instance, so we do not reuse it for the next
|
|
21607
21617
|
this.context = {};
|
|
21608
|
-
instance.
|
|
21618
|
+
this.debouncedRender(instance, config.namespace);
|
|
21609
21619
|
}
|
|
21610
21620
|
}
|
|
21611
21621
|
handleDestroy(actionObj) {
|
|
@@ -21632,6 +21642,17 @@ class ExternalApi {
|
|
|
21632
21642
|
createInstance(config) {
|
|
21633
21643
|
return new Engine(config, this);
|
|
21634
21644
|
}
|
|
21645
|
+
|
|
21646
|
+
/**
|
|
21647
|
+
* @param {Engine} instance
|
|
21648
|
+
* @param {string} namespace
|
|
21649
|
+
*/
|
|
21650
|
+
debouncedRender(instance, namespace) {
|
|
21651
|
+
window.clearTimeout(this.timeouts[namespace]);
|
|
21652
|
+
this.timeouts[namespace] = window.setTimeout(() => {
|
|
21653
|
+
instance.render();
|
|
21654
|
+
}, 100);
|
|
21655
|
+
}
|
|
21635
21656
|
destroy(instance) {
|
|
21636
21657
|
if (!instance) {
|
|
21637
21658
|
Object.entries(this._instances).forEach(([namespace, _instance]) => {
|