@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
|
@@ -73,7 +73,14 @@ class ConversationConnector {
|
|
|
73
73
|
try {
|
|
74
74
|
switch (json.type) {
|
|
75
75
|
case 'attach_channel_response':
|
|
76
|
-
if (!json.payload.success)
|
|
76
|
+
if (!json.payload.success) {
|
|
77
|
+
this.#emitConnectionState({
|
|
78
|
+
connected: true,
|
|
79
|
+
ready: false,
|
|
80
|
+
currentState: 'attach_channel_erred'
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
77
84
|
this.#emitConnectionState({
|
|
78
85
|
connected: true,
|
|
79
86
|
ready: true,
|
|
@@ -764,21 +771,23 @@ class API {
|
|
|
764
771
|
async connect() {
|
|
765
772
|
this.connected = false;
|
|
766
773
|
const conversationInitialState = !this.hasConversation() ? await this.createConversation() : undefined;
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
// Send environment
|
|
777
|
-
const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
|
|
778
|
-
if (this.#config.sendEnvironment) {
|
|
779
|
-
this.send('context', {
|
|
780
|
-
environment
|
|
774
|
+
if (this.URLS.socket) {
|
|
775
|
+
this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
|
|
776
|
+
this.conversation.onConnection(({
|
|
777
|
+
connected,
|
|
778
|
+
ready
|
|
779
|
+
}) => {
|
|
780
|
+
this.connected = connected;
|
|
781
|
+
this.#ready = ready;
|
|
781
782
|
});
|
|
783
|
+
|
|
784
|
+
// Send environment
|
|
785
|
+
const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
|
|
786
|
+
if (this.#config.sendEnvironment) {
|
|
787
|
+
this.send('context', {
|
|
788
|
+
environment
|
|
789
|
+
});
|
|
790
|
+
}
|
|
782
791
|
}
|
|
783
792
|
return conversationInitialState;
|
|
784
793
|
}
|
|
@@ -817,7 +826,7 @@ class API {
|
|
|
817
826
|
return {
|
|
818
827
|
clientName: "@seamly/web-ui",
|
|
819
828
|
clientVariant: this.#layoutMode,
|
|
820
|
-
clientVersion: "24.0.0-beta.
|
|
829
|
+
clientVersion: "24.0.0-beta.2",
|
|
821
830
|
currentUrl: window.location.toString(),
|
|
822
831
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
823
832
|
timezone: (0,_utils__WEBPACK_IMPORTED_MODULE_10__.getTimeZone)(),
|
|
@@ -4809,6 +4818,7 @@ class ExternalApi {
|
|
|
4809
4818
|
constructor(appConfig) {
|
|
4810
4819
|
this._waitingActions = [];
|
|
4811
4820
|
this._instances = {};
|
|
4821
|
+
this.timeouts = {};
|
|
4812
4822
|
this.appConfig = appConfig;
|
|
4813
4823
|
this.context = {};
|
|
4814
4824
|
}
|
|
@@ -4918,7 +4928,7 @@ class ExternalApi {
|
|
|
4918
4928
|
this._instances[config.namespace] = instance;
|
|
4919
4929
|
// Clear the context after creating the instance, so we do not reuse it for the next
|
|
4920
4930
|
this.context = {};
|
|
4921
|
-
instance.
|
|
4931
|
+
this.debouncedRender(instance, config.namespace);
|
|
4922
4932
|
}
|
|
4923
4933
|
}
|
|
4924
4934
|
handleDestroy(actionObj) {
|
|
@@ -4945,6 +4955,17 @@ class ExternalApi {
|
|
|
4945
4955
|
createInstance(config) {
|
|
4946
4956
|
return new lib_engine__WEBPACK_IMPORTED_MODULE_1__["default"](config, this);
|
|
4947
4957
|
}
|
|
4958
|
+
|
|
4959
|
+
/**
|
|
4960
|
+
* @param {Engine} instance
|
|
4961
|
+
* @param {string} namespace
|
|
4962
|
+
*/
|
|
4963
|
+
debouncedRender(instance, namespace) {
|
|
4964
|
+
window.clearTimeout(this.timeouts[namespace]);
|
|
4965
|
+
this.timeouts[namespace] = window.setTimeout(() => {
|
|
4966
|
+
instance.render();
|
|
4967
|
+
}, 100);
|
|
4968
|
+
}
|
|
4948
4969
|
destroy(instance) {
|
|
4949
4970
|
if (!instance) {
|
|
4950
4971
|
Object.entries(this._instances).forEach(([namespace, _instance]) => {
|
|
@@ -8284,13 +8305,13 @@ const SeamlyEventSubscriber = () => {
|
|
|
8284
8305
|
dispatch((0,domains_interrupt_slice__WEBPACK_IMPORTED_MODULE_6__.clearInterrupt)());
|
|
8285
8306
|
});
|
|
8286
8307
|
}
|
|
8287
|
-
}, [conversation, dispatch]);
|
|
8308
|
+
}, [conversation, conversation.socket, dispatch]);
|
|
8288
8309
|
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
8289
8310
|
if (conversation.socket) {
|
|
8290
8311
|
conversation.onConnection(({
|
|
8291
8312
|
currentState
|
|
8292
8313
|
}) => {
|
|
8293
|
-
if (currentState === '
|
|
8314
|
+
if (currentState === 'attach_channel_erred') {
|
|
8294
8315
|
const seamlyGeneralError = new api_errors_seamly_general_error__WEBPACK_IMPORTED_MODULE_1__["default"]();
|
|
8295
8316
|
dispatch((0,domains_interrupt_slice__WEBPACK_IMPORTED_MODULE_6__.setInterrupt)({
|
|
8296
8317
|
name: seamlyGeneralError.name,
|
|
@@ -8305,7 +8326,7 @@ const SeamlyEventSubscriber = () => {
|
|
|
8305
8326
|
return false;
|
|
8306
8327
|
});
|
|
8307
8328
|
}
|
|
8308
|
-
}, [conversation, dispatch]);
|
|
8329
|
+
}, [conversation, conversation.socket, dispatch]);
|
|
8309
8330
|
(0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
8310
8331
|
conversation.onConnection(({
|
|
8311
8332
|
connected
|