@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.cjs CHANGED
@@ -4193,8 +4193,8 @@ var designOptionsServerSchema = z.object({
4193
4193
  });
4194
4194
 
4195
4195
  // ../../core/config.ts
4196
- var defaultApiHost = "https://api.sfly-sls.magicbook.io";
4197
- var defaultWebSocketHost = "wss://socket.sfly-sls.magicbook.io";
4196
+ var defaultApiHost = "https://api.dev-sls.magicbook.io";
4197
+ var defaultWebSocketHost = "wss://socket.dev-sls.magicbook.io";
4198
4198
  var designRequestTimeout = parseInt("30000"?.toString() || "3000");
4199
4199
 
4200
4200
  // ../../core/models/design-request/index.ts
@@ -4306,7 +4306,6 @@ var DesignRequest = class {
4306
4306
  }
4307
4307
  async eventHandler(detail, type = "MagicBook.designRequestUpdated") {
4308
4308
  const customEvent = new CustomEvent(type, { detail });
4309
- window.dispatchEvent(customEvent);
4310
4309
  if (statesToCloseWS.includes(detail.slug)) {
4311
4310
  this.webSocket.close();
4312
4311
  if (statesToReport.includes(detail.slug)) {
@@ -4317,6 +4316,7 @@ var DesignRequest = class {
4317
4316
  }
4318
4317
  }
4319
4318
  this.state = detail.slug;
4319
+ window.dispatchEvent(customEvent);
4320
4320
  }
4321
4321
  timeoutHandler() {
4322
4322
  return setTimeout(async () => {
@@ -4325,12 +4325,12 @@ var DesignRequest = class {
4325
4325
  }
4326
4326
  async getProgress() {
4327
4327
  let timeout;
4328
- this.webSocket.onmessage = (event) => {
4328
+ this.webSocket.onmessage = async (event) => {
4329
4329
  const detail = JSON.parse(event.data);
4330
4330
  if (this.state !== detail.slug) {
4331
4331
  timeout && clearTimeout(timeout);
4332
4332
  timeout = this.timeoutHandler();
4333
- this.eventHandler(detail);
4333
+ await this.eventHandler(detail);
4334
4334
  }
4335
4335
  };
4336
4336
  this.webSocket.onclose = () => clearTimeout(timeout);