@seamly/web-ui 23.0.6-alpha.1 → 23.0.6

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.
@@ -5341,6 +5341,8 @@ class API {
5341
5341
  });
5342
5342
  const body = await response.json();
5343
5343
  this.#updateUrls(body);
5344
+ // Do not use the socket link from the config endpoint, as this is incomplete and will always fail if used
5345
+ delete this.URLS.socket;
5344
5346
  this.configReady = true;
5345
5347
  return body.config;
5346
5348
  } catch (error) {
@@ -5409,14 +5411,16 @@ class API {
5409
5411
  async connect() {
5410
5412
  this.connected = false;
5411
5413
  const conversationInitialState = await this.#createConversation();
5412
- this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket}`, this.#config.context.channelName, this.#getChannelTopic(), this.#getAccessToken());
5413
- this.conversation.onConnection(({
5414
- connected,
5415
- ready
5416
- }) => {
5417
- this.connected = connected;
5418
- this.#ready = ready;
5419
- });
5414
+ if (this.URLS.socket) {
5415
+ this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket}`, this.#config.context.channelName, this.#getChannelTopic(), this.#getAccessToken());
5416
+ this.conversation.onConnection(({
5417
+ connected,
5418
+ ready
5419
+ }) => {
5420
+ this.connected = connected;
5421
+ this.#ready = ready;
5422
+ });
5423
+ }
5420
5424
  return conversationInitialState;
5421
5425
  }
5422
5426
  uploadFile(file, progressCallback, successCallback, errorCallback) {
@@ -5577,7 +5581,7 @@ class API {
5577
5581
  return {
5578
5582
  clientName: "@seamly/web-ui",
5579
5583
  clientVariant: this.#layoutMode,
5580
- clientVersion: "23.0.6-alpha.1",
5584
+ clientVersion: "23.0.6",
5581
5585
  currentUrl: window.location.toString(),
5582
5586
  screenResolution: `${window.screen.width}x${window.screen.height}`,
5583
5587
  timezone: getTimeZone(),
@@ -22906,7 +22910,7 @@ class ExternalApi {
22906
22910
  constructor(appConfig) {
22907
22911
  this._waitingActions = [];
22908
22912
  this._instances = {};
22909
- this._timeoutId = undefined;
22913
+ this.timeouts = {};
22910
22914
  this.appConfig = appConfig;
22911
22915
  this.context = {};
22912
22916
  }
@@ -23016,10 +23020,7 @@ class ExternalApi {
23016
23020
  this._instances[config.namespace] = instance;
23017
23021
  // Clear the context after creating the instance, so we do not reuse it for the next
23018
23022
  this.context = {};
23019
- window.clearTimeout(this._timeoutId);
23020
- this._timeoutId = window.setTimeout(() => {
23021
- instance.render();
23022
- }, 60);
23023
+ this.debouncedRender(instance, config.namespace);
23023
23024
  }
23024
23025
  }
23025
23026
  handleDestroy(actionObj) {
@@ -23046,6 +23047,17 @@ class ExternalApi {
23046
23047
  createInstance(config) {
23047
23048
  return new Engine(config, this);
23048
23049
  }
23050
+
23051
+ /**
23052
+ * @param {Engine} instance
23053
+ * @param {string} namespace
23054
+ */
23055
+ debouncedRender(instance, namespace) {
23056
+ window.clearTimeout(this.timeouts[namespace]);
23057
+ this.timeouts[namespace] = window.setTimeout(() => {
23058
+ instance.render();
23059
+ }, 100);
23060
+ }
23049
23061
  destroy(instance) {
23050
23062
  if (!instance) {
23051
23063
  Object.entries(this._instances).forEach(([namespace, _instance]) => {