@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
@@ -3552,7 +3552,14 @@ class ConversationConnector {
3552
3552
  try {
3553
3553
  switch (json.type) {
3554
3554
  case 'attach_channel_response':
3555
- if (!json.payload.success) return;
3555
+ if (!json.payload.success) {
3556
+ this.#emitConnectionState({
3557
+ connected: true,
3558
+ ready: false,
3559
+ currentState: 'attach_channel_erred'
3560
+ });
3561
+ return;
3562
+ }
3556
3563
  this.#emitConnectionState({
3557
3564
  connected: true,
3558
3565
  ready: true,
@@ -4274,21 +4281,23 @@ class API {
4274
4281
  async connect() {
4275
4282
  this.connected = false;
4276
4283
  const conversationInitialState = !this.hasConversation() ? await this.createConversation() : undefined;
4277
- this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket?.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
4278
- this.conversation.onConnection(({
4279
- connected,
4280
- ready
4281
- }) => {
4282
- this.connected = connected;
4283
- this.#ready = ready;
4284
- });
4285
-
4286
- // Send environment
4287
- const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
4288
- if (this.#config.sendEnvironment) {
4289
- this.send('context', {
4290
- environment
4284
+ if (this.URLS.socket) {
4285
+ this.conversation.connect(`${this.#getUrlPrefix('ws')}${this.URLS.socket.href}`, this.#config.context.channelName || '', this.getChannelTopic(), this.getAccessToken());
4286
+ this.conversation.onConnection(({
4287
+ connected,
4288
+ ready
4289
+ }) => {
4290
+ this.connected = connected;
4291
+ this.#ready = ready;
4291
4292
  });
4293
+
4294
+ // Send environment
4295
+ const environment = this.#config.sendEnvironment === true ? this.getEnvironment() : this.#config.sendEnvironment;
4296
+ if (this.#config.sendEnvironment) {
4297
+ this.send('context', {
4298
+ environment
4299
+ });
4300
+ }
4292
4301
  }
4293
4302
  return conversationInitialState;
4294
4303
  }
@@ -4327,7 +4336,7 @@ class API {
4327
4336
  return {
4328
4337
  clientName: "@seamly/web-ui",
4329
4338
  clientVariant: this.#layoutMode,
4330
- clientVersion: "24.0.0-beta.1",
4339
+ clientVersion: "24.0.0-beta.2",
4331
4340
  currentUrl: window.location.toString(),
4332
4341
  screenResolution: `${window.screen.width}x${window.screen.height}`,
4333
4342
  timezone: getTimeZone(),
@@ -17154,13 +17163,13 @@ const SeamlyEventSubscriber = () => {
17154
17163
  dispatch(clearInterrupt());
17155
17164
  });
17156
17165
  }
17157
- }, [conversation, dispatch]);
17166
+ }, [conversation, conversation.socket, dispatch]);
17158
17167
  (0,hooks_module/* useEffect */.vJ)(() => {
17159
17168
  if (conversation.socket) {
17160
17169
  conversation.onConnection(({
17161
17170
  currentState
17162
17171
  }) => {
17163
- if (currentState === 'socket_join_error') {
17172
+ if (currentState === 'attach_channel_erred') {
17164
17173
  const seamlyGeneralError = new SeamlyGeneralError();
17165
17174
  dispatch(setInterrupt({
17166
17175
  name: seamlyGeneralError.name,
@@ -17175,7 +17184,7 @@ const SeamlyEventSubscriber = () => {
17175
17184
  return false;
17176
17185
  });
17177
17186
  }
17178
- }, [conversation, dispatch]);
17187
+ }, [conversation, conversation.socket, dispatch]);
17179
17188
  (0,hooks_module/* useEffect */.vJ)(() => {
17180
17189
  conversation.onConnection(({
17181
17190
  connected
@@ -21829,6 +21838,7 @@ class ExternalApi {
21829
21838
  constructor(appConfig) {
21830
21839
  this._waitingActions = [];
21831
21840
  this._instances = {};
21841
+ this.timeouts = {};
21832
21842
  this.appConfig = appConfig;
21833
21843
  this.context = {};
21834
21844
  }
@@ -21938,7 +21948,7 @@ class ExternalApi {
21938
21948
  this._instances[config.namespace] = instance;
21939
21949
  // Clear the context after creating the instance, so we do not reuse it for the next
21940
21950
  this.context = {};
21941
- instance.render();
21951
+ this.debouncedRender(instance, config.namespace);
21942
21952
  }
21943
21953
  }
21944
21954
  handleDestroy(actionObj) {
@@ -21965,6 +21975,17 @@ class ExternalApi {
21965
21975
  createInstance(config) {
21966
21976
  return new Engine(config, this);
21967
21977
  }
21978
+
21979
+ /**
21980
+ * @param {Engine} instance
21981
+ * @param {string} namespace
21982
+ */
21983
+ debouncedRender(instance, namespace) {
21984
+ window.clearTimeout(this.timeouts[namespace]);
21985
+ this.timeouts[namespace] = window.setTimeout(() => {
21986
+ instance.render();
21987
+ }, 100);
21988
+ }
21968
21989
  destroy(instance) {
21969
21990
  if (!instance) {
21970
21991
  Object.entries(this._instances).forEach(([namespace, _instance]) => {