@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.
@@ -5674,6 +5674,8 @@ class API {
5674
5674
  });
5675
5675
  const body = await response.json();
5676
5676
  this.#updateUrls(body);
5677
+ // Do not use the socket link from the config endpoint, as this is incomplete and will always fail if used
5678
+ delete this.URLS.socket;
5677
5679
  this.configReady = true;
5678
5680
  return body.config;
5679
5681
  } catch (error) {
@@ -5742,14 +5744,16 @@ class API {
5742
5744
  async connect() {
5743
5745
  this.connected = false;
5744
5746
  const conversationInitialState = await this.#createConversation();
5745
- this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket}`, this.#config.context.channelName, this.#getChannelTopic(), this.#getAccessToken());
5746
- this.conversation.onConnection(({
5747
- connected,
5748
- ready
5749
- }) => {
5750
- this.connected = connected;
5751
- this.#ready = ready;
5752
- });
5747
+ if (this.URLS.socket) {
5748
+ this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket}`, this.#config.context.channelName, this.#getChannelTopic(), this.#getAccessToken());
5749
+ this.conversation.onConnection(({
5750
+ connected,
5751
+ ready
5752
+ }) => {
5753
+ this.connected = connected;
5754
+ this.#ready = ready;
5755
+ });
5756
+ }
5753
5757
  return conversationInitialState;
5754
5758
  }
5755
5759
  uploadFile(file, progressCallback, successCallback, errorCallback) {
@@ -5910,7 +5914,7 @@ class API {
5910
5914
  return {
5911
5915
  clientName: "@seamly/web-ui",
5912
5916
  clientVariant: this.#layoutMode,
5913
- clientVersion: "23.0.6-alpha.1",
5917
+ clientVersion: "23.0.6",
5914
5918
  currentUrl: window.location.toString(),
5915
5919
  screenResolution: `${window.screen.width}x${window.screen.height}`,
5916
5920
  timezone: getTimeZone(),
@@ -23239,7 +23243,7 @@ class ExternalApi {
23239
23243
  constructor(appConfig) {
23240
23244
  this._waitingActions = [];
23241
23245
  this._instances = {};
23242
- this._timeoutId = undefined;
23246
+ this.timeouts = {};
23243
23247
  this.appConfig = appConfig;
23244
23248
  this.context = {};
23245
23249
  }
@@ -23349,10 +23353,7 @@ class ExternalApi {
23349
23353
  this._instances[config.namespace] = instance;
23350
23354
  // Clear the context after creating the instance, so we do not reuse it for the next
23351
23355
  this.context = {};
23352
- window.clearTimeout(this._timeoutId);
23353
- this._timeoutId = window.setTimeout(() => {
23354
- instance.render();
23355
- }, 60);
23356
+ this.debouncedRender(instance, config.namespace);
23356
23357
  }
23357
23358
  }
23358
23359
  handleDestroy(actionObj) {
@@ -23379,6 +23380,17 @@ class ExternalApi {
23379
23380
  createInstance(config) {
23380
23381
  return new Engine(config, this);
23381
23382
  }
23383
+
23384
+ /**
23385
+ * @param {Engine} instance
23386
+ * @param {string} namespace
23387
+ */
23388
+ debouncedRender(instance, namespace) {
23389
+ window.clearTimeout(this.timeouts[namespace]);
23390
+ this.timeouts[namespace] = window.setTimeout(() => {
23391
+ instance.render();
23392
+ }, 100);
23393
+ }
23382
23394
  destroy(instance) {
23383
23395
  if (!instance) {
23384
23396
  Object.entries(this._instances).forEach(([namespace, _instance]) => {