@magiclabs.ai/magicbook-client 0.6.11 → 0.6.12

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.
package/index.js CHANGED
@@ -4130,8 +4130,8 @@ var designOptionsServerSchema = z.object({
4130
4130
  });
4131
4131
 
4132
4132
  // ../../core/config.ts
4133
- var defaultApiHost = "https://api.sfly-sls.magicbook.io";
4134
- var defaultWebSocketHost = "wss://socket.sfly-sls.magicbook.io";
4133
+ var defaultApiHost = "https://api.dev-sls.magicbook.io";
4134
+ var defaultWebSocketHost = "wss://socket.dev-sls.magicbook.io";
4135
4135
  var designRequestTimeout = parseInt("30000"?.toString() || "3000");
4136
4136
 
4137
4137
  // ../../core/models/design-request/index.ts
@@ -4243,7 +4243,6 @@ var DesignRequest = class {
4243
4243
  }
4244
4244
  async eventHandler(detail, type = "MagicBook.designRequestUpdated") {
4245
4245
  const customEvent = new CustomEvent(type, { detail });
4246
- window.dispatchEvent(customEvent);
4247
4246
  if (statesToCloseWS.includes(detail.slug)) {
4248
4247
  this.webSocket.close();
4249
4248
  if (statesToReport.includes(detail.slug)) {
@@ -4254,6 +4253,7 @@ var DesignRequest = class {
4254
4253
  }
4255
4254
  }
4256
4255
  this.state = detail.slug;
4256
+ window.dispatchEvent(customEvent);
4257
4257
  }
4258
4258
  timeoutHandler() {
4259
4259
  return setTimeout(async () => {
@@ -4262,12 +4262,12 @@ var DesignRequest = class {
4262
4262
  }
4263
4263
  async getProgress() {
4264
4264
  let timeout;
4265
- this.webSocket.onmessage = (event) => {
4265
+ this.webSocket.onmessage = async (event) => {
4266
4266
  const detail = JSON.parse(event.data);
4267
4267
  if (this.state !== detail.slug) {
4268
4268
  timeout && clearTimeout(timeout);
4269
4269
  timeout = this.timeoutHandler();
4270
- this.eventHandler(detail);
4270
+ await this.eventHandler(detail);
4271
4271
  }
4272
4272
  };
4273
4273
  this.webSocket.onclose = () => clearTimeout(timeout);