@wix/editor 1.685.0 → 1.687.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
@@ -168,14 +168,14 @@ class ApplicationSDKShape extends BaseSDKShape {
168
168
  return privateAPI.info.getAppInstance(await this.getAppDefinitionId());
169
169
  }
170
170
  }
171
- var index$g = new PlatformSDKShape(ApplicationSDKShape).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build();
171
+ var index$h = new PlatformSDKShape(ApplicationSDKShape).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build();
172
172
 
173
173
  class EventsSDKShape extends BaseSDKShape {
174
174
  async addEventListener(name, cb) {
175
175
  return (await this.getApplicationContext()).getEvents().addEventListener(name, cb);
176
176
  }
177
177
  }
178
- var index$f = new PlatformSDKShape(EventsSDKShape).withPublicMethod("addEventListener").build();
178
+ var index$g = new PlatformSDKShape(EventsSDKShape).withPublicMethod("addEventListener").build();
179
179
 
180
180
  class ElementsSDKShape extends BaseSDKShape {
181
181
  async getSelection() {
@@ -194,7 +194,7 @@ class ElementsSDKShape extends BaseSDKShape {
194
194
  });
195
195
  }
196
196
  }
197
- var index$e = new PlatformSDKShape(ElementsSDKShape).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build();
197
+ var index$f = new PlatformSDKShape(ElementsSDKShape).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build();
198
198
 
199
199
  class InfoSDKShape extends BaseSDKShape {
200
200
  async getViewMode() {
@@ -234,7 +234,7 @@ class InfoSDKShape extends BaseSDKShape {
234
234
  return privateAPI.info.getMetaSiteId();
235
235
  }
236
236
  }
237
- var index$d = new PlatformSDKShape(InfoSDKShape).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getLocales").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").withPublicMethod("getSiteFonts").withPublicMethod("getFontFamilyDisplayName").withPublicMethod("getMetaSiteId").build();
237
+ var index$e = new PlatformSDKShape(InfoSDKShape).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getLocales").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").withPublicMethod("getSiteFonts").withPublicMethod("getFontFamilyDisplayName").withPublicMethod("getMetaSiteId").build();
238
238
 
239
239
  var WidgetShapeErrorCode = /* @__PURE__ */ ((WidgetShapeErrorCode2) => {
240
240
  WidgetShapeErrorCode2["UndefinedCompRef"] = "UndefinedCompRef";
@@ -410,7 +410,7 @@ class WidgetSDKShape extends BaseSDKShape {
410
410
  }
411
411
  }
412
412
  const widgetShape = new PlatformSDKShape(WidgetSDKShape).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts");
413
- var index$c = widgetShape.build();
413
+ var index$d = widgetShape.build();
414
414
 
415
415
  function fontValueToCSS(fontValue) {
416
416
  return `${fontValue.cssVariableName ? `var(${fontValue.cssVariableName}, ` : ""}${fontValue.italic ? "italic " : ""}${fontValue.bold ? "bold " : ""}${fontValue.size || 16}px ${// wrap each font family with quotes
@@ -510,7 +510,7 @@ class InputsSDKShape extends BaseSDKShape {
510
510
  return _value;
511
511
  }
512
512
  }
513
- var index$b = new PlatformSDKShape(InputsSDKShape).withPublicMethod("selectColor").withPublicMethod("selectFont").build();
513
+ var index$c = new PlatformSDKShape(InputsSDKShape).withPublicMethod("selectColor").withPublicMethod("selectFont").build();
514
514
 
515
515
  class PanelsSDKShape extends BaseSDKShape {
516
516
  async openLanguageSupportPanel() {
@@ -522,7 +522,7 @@ class PanelsSDKShape extends BaseSDKShape {
522
522
  return privateAPI.panels.openFontsUploadPanel();
523
523
  }
524
524
  }
525
- var index$a = new PlatformSDKShape(PanelsSDKShape).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build();
525
+ var index$b = new PlatformSDKShape(PanelsSDKShape).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build();
526
526
 
527
527
  class ModalsSDKShape extends BaseSDKShape {
528
528
  async openDashboardModal(options) {
@@ -533,7 +533,7 @@ class ModalsSDKShape extends BaseSDKShape {
533
533
  );
534
534
  }
535
535
  }
536
- var index$9 = new PlatformSDKShape(ModalsSDKShape).withPublicMethod("openDashboardModal").build();
536
+ var index$a = new PlatformSDKShape(ModalsSDKShape).withPublicMethod("openDashboardModal").build();
537
537
 
538
538
  class ElementSDKShape extends BaseSDKShape {
539
539
  constructor(overriddenApplicationContext = null, childPath = []) {
@@ -1306,7 +1306,7 @@ class ElementSDKShape extends BaseSDKShape {
1306
1306
  );
1307
1307
  }
1308
1308
  }
1309
- var index$8 = new PlatformSDKShape(ElementSDKShape).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getDisplayName").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectSort").withPublicMethod("selectFilter").withPublicMethod("selectColor").withPublicMethod("selectBackground").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").withPublicMethod("getArrayItemsSelectedIndex").withPublicMethod("setArrayItemsSelectedIndex").withPublicMethod("resetArrayItemsSelectedIndex").withPublicMethod("getBiToken").build();
1309
+ var index$9 = new PlatformSDKShape(ElementSDKShape).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getDisplayName").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectSort").withPublicMethod("selectFilter").withPublicMethod("selectColor").withPublicMethod("selectBackground").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").withPublicMethod("getArrayItemsSelectedIndex").withPublicMethod("setArrayItemsSelectedIndex").withPublicMethod("resetArrayItemsSelectedIndex").withPublicMethod("getBiToken").build();
1310
1310
 
1311
1311
  class PreferencesSDKShape extends BaseSDKShape {
1312
1312
  async get(keys) {
@@ -1324,7 +1324,7 @@ class PreferencesSDKShape extends BaseSDKShape {
1324
1324
  );
1325
1325
  }
1326
1326
  }
1327
- var index$7 = new PlatformSDKShape(PreferencesSDKShape).withPublicMethod("set").withPublicMethod("get").build();
1327
+ var index$8 = new PlatformSDKShape(PreferencesSDKShape).withPublicMethod("set").withPublicMethod("get").build();
1328
1328
 
1329
1329
  class ExternalPanelsSDKShape extends BaseSDKShape {
1330
1330
  async getData() {
@@ -1366,7 +1366,7 @@ class ExternalPanelsSDKShape extends BaseSDKShape {
1366
1366
  return privateAPI.externalPanels.translate(key, values);
1367
1367
  }
1368
1368
  }
1369
- var index$6 = new PlatformSDKShape(ExternalPanelsSDKShape).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build();
1369
+ var index$7 = new PlatformSDKShape(ExternalPanelsSDKShape).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build();
1370
1370
 
1371
1371
  var ControllersErrorCode = /* @__PURE__ */ ((ControllersErrorCode2) => {
1372
1372
  ControllersErrorCode2["UndefinedCompRef"] = "UndefinedCompRef";
@@ -1397,7 +1397,7 @@ class ControllersSDKShape extends BaseSDKShape {
1397
1397
  );
1398
1398
  }
1399
1399
  }
1400
- var index$5 = new PlatformSDKShape(ControllersSDKShape).withPublicMethod("get").build();
1400
+ var index$6 = new PlatformSDKShape(ControllersSDKShape).withPublicMethod("get").build();
1401
1401
 
1402
1402
  class CmsBindingConnectionItem {
1403
1403
  constructor(privateAPI, pointer, bindingTarget, config) {
@@ -1442,7 +1442,7 @@ class CmsBindingsSDKShape extends BaseSDKShape {
1442
1442
  );
1443
1443
  }
1444
1444
  }
1445
- var index$4 = new PlatformSDKShape(CmsBindingsSDKShape).withPublicMethod("get").build();
1445
+ var index$5 = new PlatformSDKShape(CmsBindingsSDKShape).withPublicMethod("get").build();
1446
1446
 
1447
1447
  class BindingsProvider {
1448
1448
  constructor(privateAPI, editorPointer, controllerRef, dataItemTarget, name) {
@@ -1499,7 +1499,7 @@ class BindingsProvidersSDKShape extends BaseSDKShape {
1499
1499
  );
1500
1500
  }
1501
1501
  }
1502
- var index$3 = new PlatformSDKShape(BindingsProvidersSDKShape).withPublicMethod("list").build();
1502
+ var index$4 = new PlatformSDKShape(BindingsProvidersSDKShape).withPublicMethod("list").build();
1503
1503
 
1504
1504
  class ProvidersPublicSDKShape extends BaseSDKShape {
1505
1505
  constructor(overriddenApplicationContext = null, childPath = []) {
@@ -1657,7 +1657,7 @@ class ContextActionsSDKShape extends BaseSDKShape {
1657
1657
  );
1658
1658
  }
1659
1659
  }
1660
- var index$2 = new PlatformSDKShape(ContextActionsSDKShape).withPublicMethod("getContextActions").build();
1660
+ var index$3 = new PlatformSDKShape(ContextActionsSDKShape).withPublicMethod("getContextActions").build();
1661
1661
 
1662
1662
  class Workspace {
1663
1663
  constructor(applicationContext) {
@@ -1745,7 +1745,7 @@ class RoutersSDKShape extends BaseSDKShape {
1745
1745
  return privateAPI.routers.add(extensionId);
1746
1746
  }
1747
1747
  }
1748
- var index$1 = new PlatformSDKShape(RoutersSDKShape).withPublicMethod("isValidPrefix").withPublicMethod("list").withPublicMethod("add").build();
1748
+ var index$2 = new PlatformSDKShape(RoutersSDKShape).withPublicMethod("isValidPrefix").withPublicMethod("list").withPublicMethod("add").build();
1749
1749
 
1750
1750
  class PagesSDKShape extends BaseSDKShape {
1751
1751
  constructor(overriddenApplicationContext = null) {
@@ -1765,7 +1765,44 @@ class PagesSDKShape extends BaseSDKShape {
1765
1765
  return privateAPI.pages.addExtension(extensionId, options);
1766
1766
  }
1767
1767
  }
1768
- var index = new PlatformSDKShape(PagesSDKShape).withPublicMethod("list").withPublicMethod("addTemplate").withPublicMethod("addExtension").build();
1768
+ var index$1 = new PlatformSDKShape(PagesSDKShape).withPublicMethod("list").withPublicMethod("addTemplate").withPublicMethod("addExtension").build();
1769
+
1770
+ function isReadOnlyRouterPage(page) {
1771
+ return "getRouter" in page;
1772
+ }
1773
+ class PageSDKShape extends BaseSDKShape {
1774
+ constructor(overriddenApplicationContext = null) {
1775
+ super(overriddenApplicationContext);
1776
+ this.overriddenApplicationContext = overriddenApplicationContext;
1777
+ }
1778
+ async #getCurrentPage() {
1779
+ const privateAPI = await this.getPlatformPrivateAPI();
1780
+ return privateAPI.pages.getCurrent();
1781
+ }
1782
+ async getTitle() {
1783
+ return (await this.#getCurrentPage()).getTitle();
1784
+ }
1785
+ async getExtensionId() {
1786
+ return (await this.#getCurrentPage()).getExtensionId();
1787
+ }
1788
+ /**
1789
+ * The page's role within its router, or `undefined` when the page is not
1790
+ * connected to a router owned by the calling app.
1791
+ */
1792
+ async getPageRole() {
1793
+ const current = await this.#getCurrentPage();
1794
+ return isReadOnlyRouterPage(current) ? current.getPageRole() : void 0;
1795
+ }
1796
+ /**
1797
+ * Read-only access to the page's router, or `undefined` when the page is not
1798
+ * connected to a router owned by the calling app.
1799
+ */
1800
+ async getRouter() {
1801
+ const current = await this.#getCurrentPage();
1802
+ return isReadOnlyRouterPage(current) ? current.getRouter() : void 0;
1803
+ }
1804
+ }
1805
+ var index = new PlatformSDKShape(PageSDKShape).withPublicMethod("getTitle").withPublicMethod("getExtensionId").withPublicMethod("getPageRole").withPublicMethod("getRouter").build();
1769
1806
 
1770
1807
  const frame = () => {
1771
1808
  const queryParams = new URLSearchParams(window.location.search);
@@ -1824,31 +1861,33 @@ const editor = {
1824
1861
  exports.BaseSDKShape = BaseSDKShape;
1825
1862
  exports.ContextActionsSDKShape = ContextActionsSDKShape;
1826
1863
  exports.ElementSDKShape = ElementSDKShape;
1864
+ exports.PageSDKShape = PageSDKShape;
1827
1865
  exports.PagesSDKShape = PagesSDKShape;
1828
1866
  exports.PlatformSDKShape = PlatformSDKShape;
1829
1867
  exports.ReactElementsSDKShape = ElementSDKShape;
1830
1868
  exports.RoutersSDKShape = RoutersSDKShape;
1831
1869
  exports.Workspace = Workspace;
1832
1870
  exports.WorkspaceHost = WorkspaceHost;
1833
- exports.application = index$g;
1871
+ exports.application = index$h;
1834
1872
  exports.bindings = bindingsPublicSDKShape;
1835
- exports.bindingsProviders = index$3;
1836
- exports.cmsBindings = index$4;
1837
- exports.contextActions = index$2;
1838
- exports.controllers = index$5;
1873
+ exports.bindingsProviders = index$4;
1874
+ exports.cmsBindings = index$5;
1875
+ exports.contextActions = index$3;
1876
+ exports.controllers = index$6;
1839
1877
  exports.editor = editor;
1840
- exports.element = index$8;
1841
- exports.elements = index$e;
1842
- exports.events = index$f;
1843
- exports.externalPanels = index$6;
1844
- exports.info = index$d;
1845
- exports.inputs = index$b;
1846
- exports.modals = index$9;
1847
- exports.pages = index;
1848
- exports.panels = index$a;
1849
- exports.preferences = index$7;
1878
+ exports.element = index$9;
1879
+ exports.elements = index$f;
1880
+ exports.events = index$g;
1881
+ exports.externalPanels = index$7;
1882
+ exports.info = index$e;
1883
+ exports.inputs = index$c;
1884
+ exports.modals = index$a;
1885
+ exports.page = index;
1886
+ exports.pages = index$1;
1887
+ exports.panels = index$b;
1888
+ exports.preferences = index$8;
1850
1889
  exports.providers = providersPublicSDKShape;
1851
- exports.reactElements = index$8;
1852
- exports.routers = index$1;
1853
- exports.widget = index$c;
1890
+ exports.reactElements = index$9;
1891
+ exports.routers = index$2;
1892
+ exports.widget = index$d;
1854
1893
  //# sourceMappingURL=index.js.map