@wix/editor 1.539.0 → 1.540.0

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/dist/cjs/index.js CHANGED
@@ -1589,8 +1589,25 @@ class Workspace {
1589
1589
  async workspaceAPI() {
1590
1590
  const context = await this.applicationContext;
1591
1591
  const privateAPI = context.getPrivateAPI();
1592
- const workspaceAPI = await privateAPI.workspace;
1593
- return workspaceAPI;
1592
+ return await privateAPI.workspace;
1593
+ }
1594
+ async appsAPI() {
1595
+ const workspace = await this.workspaceAPI();
1596
+ if (!workspace.apps) {
1597
+ throw new Error(
1598
+ "apps namespace is not available \u2014 host has not implemented it"
1599
+ );
1600
+ }
1601
+ return workspace.apps;
1602
+ }
1603
+ async toolsAPI() {
1604
+ const workspace = await this.workspaceAPI();
1605
+ if (!workspace.tools) {
1606
+ throw new Error(
1607
+ "tools namespace is not available \u2014 host has not implemented it"
1608
+ );
1609
+ }
1610
+ return workspace.tools;
1594
1611
  }
1595
1612
  getContextIds = () => {
1596
1613
  throw new Error("Not implemented yet");
@@ -1600,20 +1617,26 @@ class Workspace {
1600
1617
  };
1601
1618
  apps = {
1602
1619
  startInstallFlow: async (args) => {
1603
- const workspaceAPI = await this.workspaceAPI();
1604
- return workspaceAPI.apps.startInstallFlow(args);
1620
+ const apps = await this.appsAPI();
1621
+ return apps.startInstallFlow(args);
1605
1622
  },
1606
1623
  startPurchasePlanFlow: async (args) => {
1607
- const workspaceAPI = await this.workspaceAPI();
1608
- return workspaceAPI.apps.startPurchasePlanFlow(args);
1624
+ const apps = await this.appsAPI();
1625
+ return apps.startPurchasePlanFlow(args);
1609
1626
  },
1610
1627
  startUpdateFlow: async (args) => {
1611
- const workspaceAPI = await this.workspaceAPI();
1612
- return workspaceAPI.apps.startUpdateFlow(args);
1628
+ const apps = await this.appsAPI();
1629
+ return apps.startUpdateFlow(args);
1613
1630
  },
1614
1631
  openContactSupport: async (args) => {
1615
- const workspaceAPI = await this.workspaceAPI();
1616
- return workspaceAPI.apps.openContactSupport(args);
1632
+ const apps = await this.appsAPI();
1633
+ return apps.openContactSupport(args);
1634
+ }
1635
+ };
1636
+ tools = {
1637
+ editWithWixel: async (args) => {
1638
+ const tools = await this.toolsAPI();
1639
+ return tools.editWithWixel(args);
1617
1640
  }
1618
1641
  };
1619
1642
  }