@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
|
@@ -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.3",
|
|
3998
4007
|
currentUrl: window.location.toString(),
|
|
3999
4008
|
screenResolution: `${window.screen.width}x${window.screen.height}`,
|
|
4000
4009
|
timezone: getTimeZone(),
|
|
@@ -16800,34 +16809,12 @@ const SeamlyEventSubscriber = () => {
|
|
|
16800
16809
|
const {
|
|
16801
16810
|
emitEvent
|
|
16802
16811
|
} = use_seamly_commands();
|
|
16803
|
-
(0,hooks_.useEffect)(() => {
|
|
16804
|
-
if (conversation.socket) {
|
|
16805
|
-
const {
|
|
16806
|
-
onError,
|
|
16807
|
-
onOpen
|
|
16808
|
-
} = conversation;
|
|
16809
|
-
onError(err => {
|
|
16810
|
-
const seamlyOfflineError = new SeamlyOfflineError(err);
|
|
16811
|
-
dispatch(setInterrupt({
|
|
16812
|
-
name: seamlyOfflineError.name,
|
|
16813
|
-
message: seamlyOfflineError.message,
|
|
16814
|
-
langKey: seamlyOfflineError.langKey,
|
|
16815
|
-
originalEvent: seamlyOfflineError.originalEvent,
|
|
16816
|
-
originalError: seamlyOfflineError.originalError
|
|
16817
|
-
}));
|
|
16818
|
-
dispatch(clearEvents());
|
|
16819
|
-
});
|
|
16820
|
-
onOpen(() => {
|
|
16821
|
-
dispatch(clearInterrupt());
|
|
16822
|
-
});
|
|
16823
|
-
}
|
|
16824
|
-
}, [conversation, dispatch]);
|
|
16825
16812
|
(0,hooks_.useEffect)(() => {
|
|
16826
16813
|
if (conversation.socket) {
|
|
16827
16814
|
conversation.onConnection(({
|
|
16828
16815
|
currentState
|
|
16829
16816
|
}) => {
|
|
16830
|
-
if (currentState === '
|
|
16817
|
+
if (currentState === 'attach_channel_erred') {
|
|
16831
16818
|
const seamlyGeneralError = new SeamlyGeneralError();
|
|
16832
16819
|
dispatch(setInterrupt({
|
|
16833
16820
|
name: seamlyGeneralError.name,
|
|
@@ -16841,8 +16828,22 @@ const SeamlyEventSubscriber = () => {
|
|
|
16841
16828
|
}
|
|
16842
16829
|
return false;
|
|
16843
16830
|
});
|
|
16831
|
+
conversation.onError(err => {
|
|
16832
|
+
const seamlyOfflineError = new SeamlyOfflineError(err);
|
|
16833
|
+
dispatch(setInterrupt({
|
|
16834
|
+
name: seamlyOfflineError.name,
|
|
16835
|
+
message: seamlyOfflineError.message,
|
|
16836
|
+
langKey: seamlyOfflineError.langKey,
|
|
16837
|
+
originalEvent: seamlyOfflineError.originalEvent,
|
|
16838
|
+
originalError: seamlyOfflineError.originalError
|
|
16839
|
+
}));
|
|
16840
|
+
dispatch(clearEvents());
|
|
16841
|
+
});
|
|
16842
|
+
conversation.onOpen(() => {
|
|
16843
|
+
dispatch(clearInterrupt());
|
|
16844
|
+
});
|
|
16844
16845
|
}
|
|
16845
|
-
}, [conversation, dispatch]);
|
|
16846
|
+
}, [conversation, conversation.socket, dispatch]);
|
|
16846
16847
|
(0,hooks_.useEffect)(() => {
|
|
16847
16848
|
conversation.onConnection(({
|
|
16848
16849
|
connected
|
|
@@ -21496,6 +21497,7 @@ class ExternalApi {
|
|
|
21496
21497
|
constructor(appConfig) {
|
|
21497
21498
|
this._waitingActions = [];
|
|
21498
21499
|
this._instances = {};
|
|
21500
|
+
this.timeouts = {};
|
|
21499
21501
|
this.appConfig = appConfig;
|
|
21500
21502
|
this.context = {};
|
|
21501
21503
|
}
|
|
@@ -21605,7 +21607,7 @@ class ExternalApi {
|
|
|
21605
21607
|
this._instances[config.namespace] = instance;
|
|
21606
21608
|
// Clear the context after creating the instance, so we do not reuse it for the next
|
|
21607
21609
|
this.context = {};
|
|
21608
|
-
instance.
|
|
21610
|
+
this.debouncedRender(instance, config.namespace);
|
|
21609
21611
|
}
|
|
21610
21612
|
}
|
|
21611
21613
|
handleDestroy(actionObj) {
|
|
@@ -21632,6 +21634,17 @@ class ExternalApi {
|
|
|
21632
21634
|
createInstance(config) {
|
|
21633
21635
|
return new Engine(config, this);
|
|
21634
21636
|
}
|
|
21637
|
+
|
|
21638
|
+
/**
|
|
21639
|
+
* @param {Engine} instance
|
|
21640
|
+
* @param {string} namespace
|
|
21641
|
+
*/
|
|
21642
|
+
debouncedRender(instance, namespace) {
|
|
21643
|
+
window.clearTimeout(this.timeouts[namespace]);
|
|
21644
|
+
this.timeouts[namespace] = window.setTimeout(() => {
|
|
21645
|
+
instance.render();
|
|
21646
|
+
}, 100);
|
|
21647
|
+
}
|
|
21635
21648
|
destroy(instance) {
|
|
21636
21649
|
if (!instance) {
|
|
21637
21650
|
Object.entries(this._instances).forEach(([namespace, _instance]) => {
|