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