@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
@@ -3503,7 +3503,14 @@ class ConversationConnector {
3503
3503
  try {
3504
3504
  switch (json.type) {
3505
3505
  case 'attach_channel_response':
3506
- if (!json.payload.success) return;
3506
+ if (!json.payload.success) {
3507
+ this.#emitConnectionState({
3508
+ connected: true,
3509
+ ready: false,
3510
+ currentState: 'attach_channel_erred'
3511
+ });
3512
+ return;
3513
+ }
3507
3514
  this.#emitConnectionState({
3508
3515
  connected: true,
3509
3516
  ready: true,
@@ -4225,21 +4232,23 @@ class API {
4225
4232
  async connect() {
4226
4233
  this.connected = false;
4227
4234
  const conversationInitialState = !this.hasConversation() ? await this.createConversation() : undefined;
4228
- this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket?.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
4229
- this.conversation.onConnection(({
4230
- connected,
4231
- ready
4232
- }) => {
4233
- this.connected = connected;
4234
- this.#ready = ready;
4235
- });
4236
-
4237
- // Send environment
4238
- const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
4239
- if (this.#config.sendEnvironment) {
4240
- this.send('context', {
4241
- environment
4235
+ if (this.URLS.socket) {
4236
+ this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
4237
+ this.conversation.onConnection(({
4238
+ connected,
4239
+ ready
4240
+ }) => {
4241
+ this.connected = connected;
4242
+ this.#ready = ready;
4242
4243
  });
4244
+
4245
+ // Send environment
4246
+ const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
4247
+ if (this.#config.sendEnvironment) {
4248
+ this.send('context', {
4249
+ environment
4250
+ });
4251
+ }
4243
4252
  }
4244
4253
  return conversationInitialState;
4245
4254
  }
@@ -4278,7 +4287,7 @@ class API {
4278
4287
  return {
4279
4288
  clientName: "@seamly/web-ui",
4280
4289
  clientVariant: this.#layoutMode,
4281
- clientVersion: "24.0.0-beta.1",
4290
+ clientVersion: "24.0.0-beta.2",
4282
4291
  currentUrl: window.location.toString(),
4283
4292
  screenResolution: `${window.screen.width}x${window.screen.height}`,
4284
4293
  timezone: getTimeZone(),
@@ -17105,13 +17114,13 @@ const SeamlyEventSubscriber = () => {
17105
17114
  dispatch(clearInterrupt());
17106
17115
  });
17107
17116
  }
17108
- }, [conversation, dispatch]);
17117
+ }, [conversation, conversation.socket, dispatch]);
17109
17118
  (0,hooks_.useEffect)(() => {
17110
17119
  if (conversation.socket) {
17111
17120
  conversation.onConnection(({
17112
17121
  currentState
17113
17122
  }) => {
17114
- if (currentState === 'socket_join_error') {
17123
+ if (currentState === 'attach_channel_erred') {
17115
17124
  const seamlyGeneralError = new SeamlyGeneralError();
17116
17125
  dispatch(setInterrupt({
17117
17126
  name: seamlyGeneralError.name,
@@ -17126,7 +17135,7 @@ const SeamlyEventSubscriber = () => {
17126
17135
  return false;
17127
17136
  });
17128
17137
  }
17129
- }, [conversation, dispatch]);
17138
+ }, [conversation, conversation.socket, dispatch]);
17130
17139
  (0,hooks_.useEffect)(() => {
17131
17140
  conversation.onConnection(({
17132
17141
  connected
@@ -21780,6 +21789,7 @@ class ExternalApi {
21780
21789
  constructor(appConfig) {
21781
21790
  this._waitingActions = [];
21782
21791
  this._instances = {};
21792
+ this.timeouts = {};
21783
21793
  this.appConfig = appConfig;
21784
21794
  this.context = {};
21785
21795
  }
@@ -21889,7 +21899,7 @@ class ExternalApi {
21889
21899
  this._instances[config.namespace] = instance;
21890
21900
  // Clear the context after creating the instance, so we do not reuse it for the next
21891
21901
  this.context = {};
21892
- instance.render();
21902
+ this.debouncedRender(instance, config.namespace);
21893
21903
  }
21894
21904
  }
21895
21905
  handleDestroy(actionObj) {
@@ -21916,6 +21926,17 @@ class ExternalApi {
21916
21926
  createInstance(config) {
21917
21927
  return new Engine(config, this);
21918
21928
  }
21929
+
21930
+ /**
21931
+ * @param {Engine} instance
21932
+ * @param {string} namespace
21933
+ */
21934
+ debouncedRender(instance, namespace) {
21935
+ window.clearTimeout(this.timeouts[namespace]);
21936
+ this.timeouts[namespace] = window.setTimeout(() => {
21937
+ instance.render();
21938
+ }, 100);
21939
+ }
21919
21940
  destroy(instance) {
21920
21941
  if (!instance) {
21921
21942
  Object.entries(this._instances).forEach(([namespace, _instance]) => {