@trops/dash-core 0.1.327 → 0.1.330

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/index.esm.js CHANGED
@@ -588,6 +588,41 @@ var DashboardApi = {
588
588
  }
589
589
  };
590
590
 
591
+ /**
592
+ * DashboardActionsApi
593
+ *
594
+ * Provides programmatic control over dashboard-level actions.
595
+ * Widgets can call these methods directly (not via events) to
596
+ * control the dashboard they are rendered in.
597
+ *
598
+ * Internally dispatches CustomEvents on `window` so the API
599
+ * stays decoupled from the React component tree.
600
+ */
601
+ var DashboardActionsApi = {
602
+ /**
603
+ * Switch the active page by its internal ID.
604
+ * @param {string} pageId - The ID of the page to switch to
605
+ */
606
+ switchPage: function switchPage(pageId) {
607
+ window.dispatchEvent(new CustomEvent("dash:switch-page", {
608
+ detail: {
609
+ pageId: pageId
610
+ }
611
+ }));
612
+ },
613
+ /**
614
+ * Switch the active page by its display name.
615
+ * @param {string} pageName - The display name of the page (e.g. "Opp Detail")
616
+ */
617
+ switchPageByName: function switchPageByName(pageName) {
618
+ window.dispatchEvent(new CustomEvent("dash:switch-page", {
619
+ detail: {
620
+ pageName: pageName
621
+ }
622
+ }));
623
+ }
624
+ };
625
+
591
626
  var SECURE_STORE_ENCRYPTION_CHECK = "secure-storage-encryption-check";
592
627
  var SECURE_STORE_ENCRYPTION_CHECK_COMPLETE = "secure-storage-encryption-check-complete";
593
628
  var SECURE_STORE_ENCRYPTION_CHECK_ERROR = "secure-storage-encryption-check-error";
@@ -1877,6 +1912,7 @@ var DashboardContext = /*#__PURE__*/createContext({
1877
1912
  pub: DashboardPublisher,
1878
1913
  widgetApi: buildWidgetApi(),
1879
1914
  dashApi: null,
1915
+ dashboardApi: DashboardActionsApi,
1880
1916
  providers: {}
1881
1917
  });
1882
1918
 
@@ -2605,6 +2641,7 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2605
2641
  widgetApi: widgetApi,
2606
2642
  pub: DashboardPublisher,
2607
2643
  dashApi: dashApi,
2644
+ dashboardApi: DashboardActionsApi,
2608
2645
  credentials: credentials,
2609
2646
  providers: providers
2610
2647
  };
@@ -23907,7 +23944,8 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
23907
23944
  publishEvent: function publishEvent(eventName, payload) {
23908
23945
  return helpers.publishEvent(eventName, payload);
23909
23946
  },
23910
- api: w
23947
+ api: w,
23948
+ dashboardApi: DashboardActionsApi
23911
23949
  }, params), userPrefs), {}, {
23912
23950
  backgroundColor: bgColor,
23913
23951
  widgetConfig: helpers.config(),
@@ -23920,6 +23958,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
23920
23958
  return helpers.publishEvent(eventName, payload);
23921
23959
  },
23922
23960
  api: w,
23961
+ dashboardApi: DashboardActionsApi,
23923
23962
  id: "widget-kids-".concat(widgetKey)
23924
23963
  }, params), userPrefs), {}, {
23925
23964
  backgroundColor: bgColor,
@@ -51468,6 +51507,28 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
51468
51507
  _useState48 = _slicedToArray(_useState47, 2),
51469
51508
  activePageId = _useState48[0],
51470
51509
  setActivePageId = _useState48[1];
51510
+
51511
+ // Listen for programmatic page switches via DashboardActionsApi
51512
+ useEffect(function () {
51513
+ function onSwitchPage(e) {
51514
+ var _ref4 = e.detail || {},
51515
+ pageId = _ref4.pageId,
51516
+ pageName = _ref4.pageName;
51517
+ if (pageId) {
51518
+ setActivePageId(pageId);
51519
+ } else if (pageName) {
51520
+ var pages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
51521
+ var match = pages.find(function (p) {
51522
+ return p.name.toLowerCase() === pageName.toLowerCase();
51523
+ });
51524
+ if (match) setActivePageId(match.id);
51525
+ }
51526
+ }
51527
+ window.addEventListener("dash:switch-page", onSwitchPage);
51528
+ return function () {
51529
+ return window.removeEventListener("dash:switch-page", onSwitchPage);
51530
+ };
51531
+ }, [workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages]);
51471
51532
  var workspacePages = (workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.pages) || [];
51472
51533
 
51473
51534
  // Memoize sorted pages so page object references stay stable across re-renders
@@ -54820,5 +54881,5 @@ function ChatCore(_ref) {
54820
54881
 
54821
54882
  ComponentManager.registerContainerTypes(LayoutContainer, LayoutGridContainer);
54822
54883
 
54823
- export { ALGOLIA_ANALYTICS_FOR_QUERY, ALGOLIA_ANALYTICS_FOR_QUERY_COMPLETE, ALGOLIA_ANALYTICS_FOR_QUERY_ERROR, ALGOLIA_LIST_INDICES, ALGOLIA_LIST_INDICES_COMPLETE, ALGOLIA_LIST_INDICES_ERROR, AVAILABLE_COLORS, AddMenuItemModal, AdvancedMcpConfig, AppContext, AppSettingsModal, AppThemeScope, AppWrapper, CHOOSE_FILE, CHOOSE_FILE_COMPLETE, CHOOSE_FILE_ERROR, ChatCore, ChatInput, ChatMessages, ColorModel, ComponentConfigModel, ComponentManager, ContextModel, DATA_JSON_TO_CSV_FILE, DATA_JSON_TO_CSV_FILE_COMPLETE, DATA_JSON_TO_CSV_FILE_ERROR, DATA_JSON_TO_CSV_STRING, DATA_JSON_TO_CSV_STRING_COMPLETE, DATA_JSON_TO_CSV_STRING_ERROR, DATA_READ_FROM_FILE, DATA_READ_FROM_FILE_COMPLETE, DATA_READ_FROM_FILE_ERROR, DATA_SAVE_TO_FILE, DATA_SAVE_TO_FILE_COMPLETE, DATA_SAVE_TO_FILE_ERROR, DashCommandPalette, DashNavbar, DashSidebar, DashTabBar, DashboardStage as Dashboard, DashboardApi, DashboardContext, DashboardFooter, DashboardHeader, DashboardMenuItem, DashboardModel, DashboardMonitor, DashboardPublisher, DashboardStage, DashboardThemeProvider, DashboardWizardModal, DashboardWrapper, ElectronDashboardApi, ErrorBoundary, ExternalWidget, GRID_CELL_WIDGET_TYPE, HARMONY_STRATEGIES, LAYOUT_LIST, LAYOUT_LIST_COMPLETE, LAYOUT_LIST_ERROR, LAYOUT_SAVE, LAYOUT_SAVE_COMPLETE, LAYOUT_SAVE_ERROR, Layout, LayoutBuilder, LayoutBuilderAddItemModal, LayoutBuilderConfigContainerMenuItem, LayoutBuilderConfigMenuItem, LayoutBuilderConfigModal, LayoutBuilderEditItemModal, LayoutBuilderEventModal, LayoutBuilderGridItem, LayoutContainer, LayoutDragBuilder, LayoutDragBuilderEdit, LayoutGridContainer, LayoutManagerModal, LayoutModel, LayoutQuickAddMenu, MCP_CALL_TOOL_COMPLETE, MCP_CALL_TOOL_ERROR, MCP_GET_CATALOG_COMPLETE, MCP_GET_CATALOG_ERROR, MCP_LIST_RESOURCES_COMPLETE, MCP_LIST_RESOURCES_ERROR, MCP_LIST_TOOLS_COMPLETE, MCP_LIST_TOOLS_ERROR, MCP_READ_RESOURCE_COMPLETE, MCP_READ_RESOURCE_ERROR, MCP_RUN_AUTH_COMPLETE, MCP_RUN_AUTH_ERROR, MCP_SERVER_STATUS_COMPLETE, MCP_SERVER_STATUS_ERROR, MCP_START_SERVER_COMPLETE, MCP_START_SERVER_ERROR, MCP_STOP_SERVER_COMPLETE, MCP_STOP_SERVER_ERROR, MENU_ITEMS_DELETE, MENU_ITEMS_DELETE_COMPLETE, MENU_ITEMS_DELETE_ERROR, MENU_ITEMS_LIST, MENU_ITEMS_LIST_COMPLETE, MENU_ITEMS_LIST_ERROR, MENU_ITEMS_SAVE, MENU_ITEMS_SAVE_COMPLETE, MENU_ITEMS_SAVE_ERROR, MainMenu, MainMenuItem, MainMenuSection, McpServerPicker, MenuItemModel, MenuSlideOverlay, MergeCellsModal, MessageBubble, MissingProviderPrompt, MockDashboardApi, PROVIDER_DELETE_COMPLETE, PROVIDER_DELETE_ERROR, PROVIDER_GET_COMPLETE, PROVIDER_GET_ERROR, PROVIDER_LIST_COMPLETE, PROVIDER_LIST_ERROR, PROVIDER_SAVE_COMPLETE, PROVIDER_SAVE_ERROR, PageTabBar, PanelCode, PanelEditItem, PanelEditItemHandlers, PanelEditItemNotifications, PinnedSidebar, ProviderContext, ProviderErrorBoundary, ProviderForm, ProviderSelector, SECURE_STORAGE_ENCRYPT_STRING, SECURE_STORAGE_ENCRYPT_STRING_COMPLETE, SECURE_STORAGE_ENCRYPT_STRING_ERROR, SECURE_STORE_ENCRYPTION_CHECK, SECURE_STORE_ENCRYPTION_CHECK_COMPLETE, SECURE_STORE_ENCRYPTION_CHECK_ERROR, SECURE_STORE_GET_DATA, SECURE_STORE_GET_DATA_COMPLETE, SECURE_STORE_GET_DATA_ERROR, SECURE_STORE_SET_DATA, SECURE_STORE_SET_DATA_COMPLETE, SECURE_STORE_SET_DATA_ERROR, SETTINGS_GET, SETTINGS_GET_COMPLETE, SETTINGS_GET_ERROR, SETTINGS_SAVE, SETTINGS_SAVE_COMPLETE, SETTINGS_SAVE_ERROR, SIDEBAR_WIDGET_TYPE, SettingsModel, SideMenu, SplitCellModal, StreamingText, THEME_DELETE, THEME_DELETE_COMPLETE, THEME_DELETE_ERROR, THEME_EXTRACT_FROM_URL, THEME_EXTRACT_FROM_URL_COMPLETE, THEME_EXTRACT_FROM_URL_ERROR, THEME_LIST, THEME_LIST_COMPLETE, THEME_LIST_ERROR, THEME_MAP_PALETTE, THEME_MAP_PALETTE_COMPLETE, THEME_MAP_PALETTE_ERROR, THEME_SAVE, THEME_SAVE_COMPLETE, THEME_SAVE_ERROR, ThemeApi, ThemeColorDots, ThemeManagerModal, ThemeModel, ThemeWrapper, ToolCallBlock, ToolSelector, WELCOME_STORAGE_KEY, WORKSPACE_DELETE, WORKSPACE_DELETE_COMPLETE, WORKSPACE_DELETE_ERROR, WORKSPACE_LIST, WORKSPACE_LIST_COMPLETE, WORKSPACE_LIST_ERROR, WORKSPACE_SAVE, WORKSPACE_SAVE_COMPLETE, WORKSPACE_SAVE_ERROR, WebDashboardApi, WelcomePrompt, Widget, WidgetApi, WidgetConfigPanel, WidgetContext, WidgetFactory, WidgetNotFound, WidgetPopoutStage, WidgetProviderWrapper, WidgetSidebar, WizardCustomizeStep, WizardDiscoverStep, Workspace, WorkspaceContext, WorkspaceFooter, WorkspaceMenu, WorkspaceModel, addChildToLayoutItem, addItemToItemLayout, buildMcpConfigFromOverrides, canHaveChildren, changeDirectionForLayoutItem, createProviderRegistry, deriveFormFields, envMappingToRows, evaluateBundle, extractWidgetConfigs, formStateToMcpJson, formatFieldName, generateCustomTheme, generateHarmonyTheme, generateRandomTheme, generateThemeName, getBorderStyle, getChildrenForLayoutItem, getComponentInLayout, getContainerBorderColor, getContainerColor, getIndexOfLayoutChildrenForItem, getIndexOfLayoutItem, getLayoutItemById, getLayoutItemForWorkspace, getNearestParentWorkspace, getNextHighestId, getNextHighestItemInLayout, getNextHighestOrder, getNextHighestParentId, getNextLowestItemInLayout, getParentForLayoutItem, getParentWorkspaceForItem, getThemePresets, getUserConfigurableProviders, getWidgetsForWorkspace, getWorkspacesForWorkspace, headerTemplateToRows, isContainer, isLikelySecret, isMaxOrderForItem, isMinOrderForItem, isWidget, isWidgetResolvable, isWorkspace, layoutItemHasWorkspaceAsChild, loadWidgetBundle, mcpJsonToFormState, numChildrenForLayout, removeItemFromLayout, renderComponent, renderGridLayout, renderGridLayoutFlow, _renderLayout as renderLayout, renderLayoutMenu, replaceItemInLayout, resolveIcon, setHostModules, traverseParentTree, updateLayoutItem, updateParentForItem, useDashboard, useMcpDashServer, useMcpProvider, useNotifications, useProvider, useProviderClient, useScheduler, useWebSocketProvider, useWidgetEvents, useWidgetProviders, useWidgetSchedulerStatus, useWizardState, validateCellMerge, validateGridCell, validateGridPlacement, validateWidgetPlacement, widgetCountToTemplate, withProviderDetection };
54884
+ export { ALGOLIA_ANALYTICS_FOR_QUERY, ALGOLIA_ANALYTICS_FOR_QUERY_COMPLETE, ALGOLIA_ANALYTICS_FOR_QUERY_ERROR, ALGOLIA_LIST_INDICES, ALGOLIA_LIST_INDICES_COMPLETE, ALGOLIA_LIST_INDICES_ERROR, AVAILABLE_COLORS, AddMenuItemModal, AdvancedMcpConfig, AppContext, AppSettingsModal, AppThemeScope, AppWrapper, CHOOSE_FILE, CHOOSE_FILE_COMPLETE, CHOOSE_FILE_ERROR, ChatCore, ChatInput, ChatMessages, ColorModel, ComponentConfigModel, ComponentManager, ContextModel, DATA_JSON_TO_CSV_FILE, DATA_JSON_TO_CSV_FILE_COMPLETE, DATA_JSON_TO_CSV_FILE_ERROR, DATA_JSON_TO_CSV_STRING, DATA_JSON_TO_CSV_STRING_COMPLETE, DATA_JSON_TO_CSV_STRING_ERROR, DATA_READ_FROM_FILE, DATA_READ_FROM_FILE_COMPLETE, DATA_READ_FROM_FILE_ERROR, DATA_SAVE_TO_FILE, DATA_SAVE_TO_FILE_COMPLETE, DATA_SAVE_TO_FILE_ERROR, DashCommandPalette, DashNavbar, DashSidebar, DashTabBar, DashboardStage as Dashboard, DashboardActionsApi, DashboardApi, DashboardContext, DashboardFooter, DashboardHeader, DashboardMenuItem, DashboardModel, DashboardMonitor, DashboardPublisher, DashboardStage, DashboardThemeProvider, DashboardWizardModal, DashboardWrapper, ElectronDashboardApi, ErrorBoundary, ExternalWidget, GRID_CELL_WIDGET_TYPE, HARMONY_STRATEGIES, LAYOUT_LIST, LAYOUT_LIST_COMPLETE, LAYOUT_LIST_ERROR, LAYOUT_SAVE, LAYOUT_SAVE_COMPLETE, LAYOUT_SAVE_ERROR, Layout, LayoutBuilder, LayoutBuilderAddItemModal, LayoutBuilderConfigContainerMenuItem, LayoutBuilderConfigMenuItem, LayoutBuilderConfigModal, LayoutBuilderEditItemModal, LayoutBuilderEventModal, LayoutBuilderGridItem, LayoutContainer, LayoutDragBuilder, LayoutDragBuilderEdit, LayoutGridContainer, LayoutManagerModal, LayoutModel, LayoutQuickAddMenu, MCP_CALL_TOOL_COMPLETE, MCP_CALL_TOOL_ERROR, MCP_GET_CATALOG_COMPLETE, MCP_GET_CATALOG_ERROR, MCP_LIST_RESOURCES_COMPLETE, MCP_LIST_RESOURCES_ERROR, MCP_LIST_TOOLS_COMPLETE, MCP_LIST_TOOLS_ERROR, MCP_READ_RESOURCE_COMPLETE, MCP_READ_RESOURCE_ERROR, MCP_RUN_AUTH_COMPLETE, MCP_RUN_AUTH_ERROR, MCP_SERVER_STATUS_COMPLETE, MCP_SERVER_STATUS_ERROR, MCP_START_SERVER_COMPLETE, MCP_START_SERVER_ERROR, MCP_STOP_SERVER_COMPLETE, MCP_STOP_SERVER_ERROR, MENU_ITEMS_DELETE, MENU_ITEMS_DELETE_COMPLETE, MENU_ITEMS_DELETE_ERROR, MENU_ITEMS_LIST, MENU_ITEMS_LIST_COMPLETE, MENU_ITEMS_LIST_ERROR, MENU_ITEMS_SAVE, MENU_ITEMS_SAVE_COMPLETE, MENU_ITEMS_SAVE_ERROR, MainMenu, MainMenuItem, MainMenuSection, McpServerPicker, MenuItemModel, MenuSlideOverlay, MergeCellsModal, MessageBubble, MissingProviderPrompt, MockDashboardApi, PROVIDER_DELETE_COMPLETE, PROVIDER_DELETE_ERROR, PROVIDER_GET_COMPLETE, PROVIDER_GET_ERROR, PROVIDER_LIST_COMPLETE, PROVIDER_LIST_ERROR, PROVIDER_SAVE_COMPLETE, PROVIDER_SAVE_ERROR, PageTabBar, PanelCode, PanelEditItem, PanelEditItemHandlers, PanelEditItemNotifications, PinnedSidebar, ProviderContext, ProviderErrorBoundary, ProviderForm, ProviderSelector, SECURE_STORAGE_ENCRYPT_STRING, SECURE_STORAGE_ENCRYPT_STRING_COMPLETE, SECURE_STORAGE_ENCRYPT_STRING_ERROR, SECURE_STORE_ENCRYPTION_CHECK, SECURE_STORE_ENCRYPTION_CHECK_COMPLETE, SECURE_STORE_ENCRYPTION_CHECK_ERROR, SECURE_STORE_GET_DATA, SECURE_STORE_GET_DATA_COMPLETE, SECURE_STORE_GET_DATA_ERROR, SECURE_STORE_SET_DATA, SECURE_STORE_SET_DATA_COMPLETE, SECURE_STORE_SET_DATA_ERROR, SETTINGS_GET, SETTINGS_GET_COMPLETE, SETTINGS_GET_ERROR, SETTINGS_SAVE, SETTINGS_SAVE_COMPLETE, SETTINGS_SAVE_ERROR, SIDEBAR_WIDGET_TYPE, SettingsModel, SideMenu, SplitCellModal, StreamingText, THEME_DELETE, THEME_DELETE_COMPLETE, THEME_DELETE_ERROR, THEME_EXTRACT_FROM_URL, THEME_EXTRACT_FROM_URL_COMPLETE, THEME_EXTRACT_FROM_URL_ERROR, THEME_LIST, THEME_LIST_COMPLETE, THEME_LIST_ERROR, THEME_MAP_PALETTE, THEME_MAP_PALETTE_COMPLETE, THEME_MAP_PALETTE_ERROR, THEME_SAVE, THEME_SAVE_COMPLETE, THEME_SAVE_ERROR, ThemeApi, ThemeColorDots, ThemeManagerModal, ThemeModel, ThemeWrapper, ToolCallBlock, ToolSelector, WELCOME_STORAGE_KEY, WORKSPACE_DELETE, WORKSPACE_DELETE_COMPLETE, WORKSPACE_DELETE_ERROR, WORKSPACE_LIST, WORKSPACE_LIST_COMPLETE, WORKSPACE_LIST_ERROR, WORKSPACE_SAVE, WORKSPACE_SAVE_COMPLETE, WORKSPACE_SAVE_ERROR, WebDashboardApi, WelcomePrompt, Widget, WidgetApi, WidgetConfigPanel, WidgetContext, WidgetFactory, WidgetNotFound, WidgetPopoutStage, WidgetProviderWrapper, WidgetSidebar, WizardCustomizeStep, WizardDiscoverStep, Workspace, WorkspaceContext, WorkspaceFooter, WorkspaceMenu, WorkspaceModel, addChildToLayoutItem, addItemToItemLayout, buildMcpConfigFromOverrides, canHaveChildren, changeDirectionForLayoutItem, createProviderRegistry, deriveFormFields, envMappingToRows, evaluateBundle, extractWidgetConfigs, formStateToMcpJson, formatFieldName, generateCustomTheme, generateHarmonyTheme, generateRandomTheme, generateThemeName, getBorderStyle, getChildrenForLayoutItem, getComponentInLayout, getContainerBorderColor, getContainerColor, getIndexOfLayoutChildrenForItem, getIndexOfLayoutItem, getLayoutItemById, getLayoutItemForWorkspace, getNearestParentWorkspace, getNextHighestId, getNextHighestItemInLayout, getNextHighestOrder, getNextHighestParentId, getNextLowestItemInLayout, getParentForLayoutItem, getParentWorkspaceForItem, getThemePresets, getUserConfigurableProviders, getWidgetsForWorkspace, getWorkspacesForWorkspace, headerTemplateToRows, isContainer, isLikelySecret, isMaxOrderForItem, isMinOrderForItem, isWidget, isWidgetResolvable, isWorkspace, layoutItemHasWorkspaceAsChild, loadWidgetBundle, mcpJsonToFormState, numChildrenForLayout, removeItemFromLayout, renderComponent, renderGridLayout, renderGridLayoutFlow, _renderLayout as renderLayout, renderLayoutMenu, replaceItemInLayout, resolveIcon, setHostModules, traverseParentTree, updateLayoutItem, updateParentForItem, useDashboard, useMcpDashServer, useMcpProvider, useNotifications, useProvider, useProviderClient, useScheduler, useWebSocketProvider, useWidgetEvents, useWidgetProviders, useWidgetSchedulerStatus, useWizardState, validateCellMerge, validateGridCell, validateGridPlacement, validateWidgetPlacement, widgetCountToTemplate, withProviderDetection };
54824
54885
  //# sourceMappingURL=index.esm.js.map