@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.
Files changed (32) hide show
  1. package/build/dist/lib/components.js +8 -1
  2. package/build/dist/lib/components.js.map +1 -1
  3. package/build/dist/lib/components.min.js.map +1 -1
  4. package/build/dist/lib/hooks.js +8 -1
  5. package/build/dist/lib/hooks.js.map +1 -1
  6. package/build/dist/lib/hooks.min.js +1 -1
  7. package/build/dist/lib/hooks.min.js.map +1 -1
  8. package/build/dist/lib/index.debug.js +41 -20
  9. package/build/dist/lib/index.debug.js.map +1 -1
  10. package/build/dist/lib/index.debug.min.js +1 -1
  11. package/build/dist/lib/index.debug.min.js.map +1 -1
  12. package/build/dist/lib/index.js +41 -20
  13. package/build/dist/lib/index.js.map +1 -1
  14. package/build/dist/lib/index.min.js +1 -1
  15. package/build/dist/lib/index.min.js.map +1 -1
  16. package/build/dist/lib/standalone.js +41 -20
  17. package/build/dist/lib/standalone.js.map +1 -1
  18. package/build/dist/lib/standalone.min.js +1 -1
  19. package/build/dist/lib/standalone.min.js.map +1 -1
  20. package/build/dist/lib/style-guide.js +41 -20
  21. package/build/dist/lib/style-guide.js.map +1 -1
  22. package/build/dist/lib/style-guide.min.js +1 -1
  23. package/build/dist/lib/style-guide.min.js.map +1 -1
  24. package/build/dist/lib/utils.js +41 -20
  25. package/build/dist/lib/utils.js.map +1 -1
  26. package/build/dist/lib/utils.min.js +1 -1
  27. package/build/dist/lib/utils.min.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/javascripts/api/conversation-connector.ts +8 -1
  30. package/src/javascripts/api/index.ts +21 -19
  31. package/src/javascripts/lib/external-api/index.ts +13 -1
  32. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +3 -3
@@ -662,7 +662,14 @@ class ConversationConnector {
662
662
  try {
663
663
  switch (json.type) {
664
664
  case 'attach_channel_response':
665
- if (!json.payload.success) return;
665
+ if (!json.payload.success) {
666
+ this.#emitConnectionState({
667
+ connected: true,
668
+ ready: false,
669
+ currentState: 'attach_channel_erred'
670
+ });
671
+ return;
672
+ }
666
673
  this.#emitConnectionState({
667
674
  connected: true,
668
675
  ready: true,
@@ -14913,21 +14920,23 @@ class API {
14913
14920
  async connect() {
14914
14921
  this.connected = false;
14915
14922
  const conversationInitialState = !this.hasConversation() ? await this.createConversation() : undefined;
14916
- this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket?.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
14917
- this.conversation.onConnection(({
14918
- connected,
14919
- ready
14920
- }) => {
14921
- this.connected = connected;
14922
- this.#ready = ready;
14923
- });
14924
-
14925
- // Send environment
14926
- const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
14927
- if (this.#config.sendEnvironment) {
14928
- this.send('context', {
14929
- environment
14923
+ if (this.URLS.socket) {
14924
+ this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
14925
+ this.conversation.onConnection(({
14926
+ connected,
14927
+ ready
14928
+ }) => {
14929
+ this.connected = connected;
14930
+ this.#ready = ready;
14930
14931
  });
14932
+
14933
+ // Send environment
14934
+ const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
14935
+ if (this.#config.sendEnvironment) {
14936
+ this.send('context', {
14937
+ environment
14938
+ });
14939
+ }
14931
14940
  }
14932
14941
  return conversationInitialState;
14933
14942
  }
@@ -14966,7 +14975,7 @@ class API {
14966
14975
  return {
14967
14976
  clientName: "@seamly/web-ui",
14968
14977
  clientVariant: this.#layoutMode,
14969
- clientVersion: "24.0.0-beta.1",
14978
+ clientVersion: "24.0.0-beta.2",
14970
14979
  currentUrl: window.location.toString(),
14971
14980
  screenResolution: `${window.screen.width}x${window.screen.height}`,
14972
14981
  timezone: getTimeZone(),
@@ -18131,13 +18140,13 @@ const SeamlyEventSubscriber = () => {
18131
18140
  dispatch((0,interrupt_slice/* clearInterrupt */.DB)());
18132
18141
  });
18133
18142
  }
18134
- }, [conversation, dispatch]);
18143
+ }, [conversation, conversation.socket, dispatch]);
18135
18144
  (0,hooks_.useEffect)(() => {
18136
18145
  if (conversation.socket) {
18137
18146
  conversation.onConnection(({
18138
18147
  currentState
18139
18148
  }) => {
18140
- if (currentState === 'socket_join_error') {
18149
+ if (currentState === 'attach_channel_erred') {
18141
18150
  const seamlyGeneralError = new seamly_general_error/* default */.A();
18142
18151
  dispatch((0,interrupt_slice/* setInterrupt */.y7)({
18143
18152
  name: seamlyGeneralError.name,
@@ -18152,7 +18161,7 @@ const SeamlyEventSubscriber = () => {
18152
18161
  return false;
18153
18162
  });
18154
18163
  }
18155
- }, [conversation, dispatch]);
18164
+ }, [conversation, conversation.socket, dispatch]);
18156
18165
  (0,hooks_.useEffect)(() => {
18157
18166
  conversation.onConnection(({
18158
18167
  connected
@@ -22833,6 +22842,7 @@ class ExternalApi {
22833
22842
  constructor(appConfig) {
22834
22843
  this._waitingActions = [];
22835
22844
  this._instances = {};
22845
+ this.timeouts = {};
22836
22846
  this.appConfig = appConfig;
22837
22847
  this.context = {};
22838
22848
  }
@@ -22942,7 +22952,7 @@ class ExternalApi {
22942
22952
  this._instances[config.namespace] = instance;
22943
22953
  // Clear the context after creating the instance, so we do not reuse it for the next
22944
22954
  this.context = {};
22945
- instance.render();
22955
+ this.debouncedRender(instance, config.namespace);
22946
22956
  }
22947
22957
  }
22948
22958
  handleDestroy(actionObj) {
@@ -22969,6 +22979,17 @@ class ExternalApi {
22969
22979
  createInstance(config) {
22970
22980
  return new Engine(config, this);
22971
22981
  }
22982
+
22983
+ /**
22984
+ * @param {Engine} instance
22985
+ * @param {string} namespace
22986
+ */
22987
+ debouncedRender(instance, namespace) {
22988
+ window.clearTimeout(this.timeouts[namespace]);
22989
+ this.timeouts[namespace] = window.setTimeout(() => {
22990
+ instance.render();
22991
+ }, 100);
22992
+ }
22972
22993
  destroy(instance) {
22973
22994
  if (!instance) {
22974
22995
  Object.entries(this._instances).forEach(([namespace, _instance]) => {