@burdenoff/microfe-subscriberbot 2026.1107.8 → 2026.1110.2
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/generated/global-operations.d.ts +4 -2
- package/dist/generated/global-types.d.ts +2 -22
- package/dist/generated/wspace-operations.d.ts +4 -2
- package/dist/generated/wspace-types.d.ts +4 -24
- package/dist/index.d.ts +0 -1
- package/dist/node_modules/clsx/dist/clsx.js +8 -7
- package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +134 -151
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/stories/Accessibility.stories.d.ts +2 -4
- package/dist/stories/EmptyState.stories.d.ts +0 -2
- package/dist/stories/MetricsCard.stories.d.ts +0 -2
- package/dist/stories/StatusBadge.stories.d.ts +0 -2
- package/dist/stories/pages/AgentDetailPage.stories.d.ts +0 -2
- package/dist/stories/pages/AgentNewPage.stories.d.ts +0 -2
- package/dist/stories/pages/AgentsListPage.stories.d.ts +0 -2
- package/dist/stories/pages/AssetVaultPage.stories.d.ts +0 -2
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts +0 -2
- package/dist/stories/pages/DashboardPage.stories.d.ts +0 -2
- package/dist/stories/pages/DecisionDetailPage.stories.d.ts +0 -2
- package/dist/stories/pages/DecisionsPage.stories.d.ts +0 -2
- package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts +0 -2
- package/dist/stories/pages/InboxPage.stories.d.ts +0 -2
- package/dist/stories/pages/InboxReadState.stories.d.ts +1 -3
- package/dist/stories/pages/InsightsPage.stories.d.ts +0 -2
- package/dist/stories/pages/InvoicesPage.stories.d.ts +0 -2
- package/dist/stories/pages/NegotiationDetailPage.stories.d.ts +0 -2
- package/dist/stories/pages/NegotiationNewPage.stories.d.ts +0 -2
- package/dist/stories/pages/NegotiationsPage.stories.d.ts +0 -2
- package/dist/stories/pages/ProcurementDetailPage.stories.d.ts +0 -2
- package/dist/stories/pages/ProcurementNewPage.stories.d.ts +0 -2
- package/dist/stories/pages/ProcurementPage.stories.d.ts +0 -2
- package/dist/stories/pages/ProviderDetailPage.stories.d.ts +0 -2
- package/dist/stories/pages/ProviderNewPage.stories.d.ts +0 -2
- package/dist/stories/pages/ProvidersListPage.stories.d.ts +0 -2
- package/dist/stories/pages/RelationshipDetailPage.stories.d.ts +0 -2
- package/dist/stories/pages/RelationshipNewPage.stories.d.ts +0 -2
- package/dist/stories/pages/RelationshipsListPage.stories.d.ts +0 -2
- package/dist/stories/pages/RenewalsPage.stories.d.ts +0 -2
- package/dist/stories/pages/SavingsPage.stories.d.ts +0 -2
- package/dist/stories/pages/WorkflowBuilderPage.stories.d.ts +0 -2
- package/dist/stories/pages/WorkflowsPage.stories.d.ts +0 -2
- package/dist/stories/support/PageHarness.d.ts +0 -2
- package/dist/stories/support/bankingFixtures.d.ts +0 -2
- package/dist/stories/support/fixtures.d.ts +0 -2
- package/dist/stories/support/graphqlMock.d.ts +0 -2
- package/dist/stories/support/handlers.d.ts +0 -2
- package/dist/stories/support/negotiationFixtures.d.ts +0 -2
- package/dist/stories/support/phoneViewport.d.ts +0 -2
- package/dist/stories/support/play.d.ts +0 -2
- package/dist/stories/support/procurementFixtures.d.ts +0 -2
- package/dist/subscriberbot/SubscriberBotRoot.d.ts +0 -2
- package/dist/subscriberbot/SubscriberBotRoot.js +10 -7
- package/dist/subscriberbot/SubscriberBotRoot.js.map +1 -1
- package/dist/subscriberbot/SubscriberBotRoutes.d.ts +0 -2
- package/dist/subscriberbot/SubscriberBotRoutes.js +1 -2
- package/dist/subscriberbot/SubscriberBotRoutes.js.map +1 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.d.ts +0 -2
- package/dist/subscriberbot/admin/AdminDashboardPage.js +9 -10
- package/dist/subscriberbot/admin/AdminDashboardPage.js.map +1 -1
- package/dist/subscriberbot/admin/AdminRoot.d.ts +0 -2
- package/dist/subscriberbot/admin/AdminRoot.js +2 -3
- package/dist/subscriberbot/admin/AdminRoot.js.map +1 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts +0 -2
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js +56 -57
- package/dist/subscriberbot/admin/NegotiationDeskPanel.js.map +1 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts +0 -2
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js +107 -108
- package/dist/subscriberbot/admin/ProcurementDeskPanel.js.map +1 -1
- package/dist/subscriberbot/admin/index.d.ts +0 -1
- package/dist/subscriberbot/admin/index.js +1 -1
- package/dist/subscriberbot/components/EmptyState.d.ts +0 -2
- package/dist/subscriberbot/components/EmptyState.js +1 -2
- package/dist/subscriberbot/components/EmptyState.js.map +1 -1
- package/dist/subscriberbot/components/MetricsCard.d.ts +0 -2
- package/dist/subscriberbot/components/MetricsCard.js +1 -2
- package/dist/subscriberbot/components/MetricsCard.js.map +1 -1
- package/dist/subscriberbot/components/Modal.d.ts +0 -2
- package/dist/subscriberbot/components/Modal.js +2 -3
- package/dist/subscriberbot/components/Modal.js.map +1 -1
- package/dist/subscriberbot/components/PageLayout.d.ts +0 -2
- package/dist/subscriberbot/components/PageLayout.js +1 -2
- package/dist/subscriberbot/components/PageLayout.js.map +1 -1
- package/dist/subscriberbot/components/PostureOptions.d.ts +1 -3
- package/dist/subscriberbot/components/PostureOptions.js +7 -8
- package/dist/subscriberbot/components/PostureOptions.js.map +1 -1
- package/dist/subscriberbot/components/StateViews.d.ts +0 -2
- package/dist/subscriberbot/components/StateViews.js +1 -2
- package/dist/subscriberbot/components/StateViews.js.map +1 -1
- package/dist/subscriberbot/components/StatusBadge.d.ts +0 -2
- package/dist/subscriberbot/components/StatusBadge.js +2 -3
- package/dist/subscriberbot/components/StatusBadge.js.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionBanners.d.ts +0 -2
- package/dist/subscriberbot/components/decisions/DecisionBanners.js +7 -8
- package/dist/subscriberbot/components/decisions/DecisionBanners.js.map +1 -1
- package/dist/subscriberbot/components/decisions/DecisionCard.d.ts +0 -2
- package/dist/subscriberbot/components/decisions/DecisionCard.js +65 -66
- package/dist/subscriberbot/components/decisions/DecisionCard.js.map +1 -1
- package/dist/subscriberbot/components/decisions/decisionModel.d.ts +0 -2
- package/dist/subscriberbot/components/decisions/decisionModel.js +2 -3
- package/dist/subscriberbot/components/decisions/decisionModel.js.map +1 -1
- package/dist/subscriberbot/components/decisions/index.d.ts +0 -1
- package/dist/subscriberbot/components/decisions/index.js +4 -3
- package/dist/subscriberbot/components/index.d.ts +0 -1
- package/dist/subscriberbot/components/index.js +8 -7
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts +0 -2
- package/dist/subscriberbot/components/mobile/MobileDashboard.js +23 -24
- package/dist/subscriberbot/components/mobile/MobileDashboard.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts +0 -2
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js +40 -49
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.js.map +1 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts +0 -2
- package/dist/subscriberbot/components/mobile/MobileScreen.js +1 -2
- package/dist/subscriberbot/components/mobile/MobileScreen.js.map +1 -1
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.d.ts +0 -2
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.js +1 -2
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.js.map +1 -1
- package/dist/subscriberbot/components/mobile/index.d.ts +0 -1
- package/dist/subscriberbot/components/mobile/index.js +4 -3
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.d.ts +0 -2
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js +1 -2
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts +0 -2
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js +4 -5
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts +0 -2
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js +4 -5
- package/dist/subscriberbot/components/negotiations/OutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/negotiations/index.d.ts +0 -1
- package/dist/subscriberbot/components/negotiations/index.js +5 -4
- package/dist/subscriberbot/components/negotiations/labels.d.ts +0 -2
- package/dist/subscriberbot/components/negotiations/labels.js +1 -2
- package/dist/subscriberbot/components/negotiations/labels.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts +0 -2
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js +4 -5
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.d.ts +0 -2
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js +1 -2
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.js.map +1 -1
- package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts +0 -2
- package/dist/subscriberbot/components/procurement/ProcurementThread.js +4 -5
- package/dist/subscriberbot/components/procurement/ProcurementThread.js.map +1 -1
- package/dist/subscriberbot/components/procurement/index.d.ts +0 -1
- package/dist/subscriberbot/components/procurement/index.js +5 -4
- package/dist/subscriberbot/components/procurement/labels.d.ts +0 -2
- package/dist/subscriberbot/components/procurement/labels.js +1 -2
- package/dist/subscriberbot/components/procurement/labels.js.map +1 -1
- package/dist/subscriberbot/components/savings/SavingsCards.d.ts +0 -2
- package/dist/subscriberbot/components/savings/SavingsCards.js +90 -91
- package/dist/subscriberbot/components/savings/SavingsCards.js.map +1 -1
- package/dist/subscriberbot/components/savings/index.d.ts +0 -1
- package/dist/subscriberbot/components/savings/index.js +3 -2
- package/dist/subscriberbot/components/savings/savingsModel.d.ts +0 -2
- package/dist/subscriberbot/components/savings/savingsModel.js +2 -3
- package/dist/subscriberbot/components/savings/savingsModel.js.map +1 -1
- package/dist/subscriberbot/components/viz.d.ts +0 -2
- package/dist/subscriberbot/components/viz.js +2 -3
- package/dist/subscriberbot/components/viz.js.map +1 -1
- package/dist/subscriberbot/config/assistantUsecases.d.ts +0 -1
- package/dist/subscriberbot/context/SubscriberBotContext.d.ts +0 -2
- package/dist/subscriberbot/context/SubscriberBotContext.js +3 -3
- package/dist/subscriberbot/context/SubscriberBotContext.js.map +1 -1
- package/dist/subscriberbot/context/index.d.ts +0 -1
- package/dist/subscriberbot/context/index.js +1 -1
- package/dist/subscriberbot/hooks/index.d.ts +0 -1
- package/dist/subscriberbot/hooks/index.js +2 -2
- package/dist/subscriberbot/hooks/useAutonomousAgentMode.d.ts +0 -2
- package/dist/subscriberbot/hooks/useAutonomousAgentMode.js +2 -3
- package/dist/subscriberbot/hooks/useAutonomousAgentMode.js.map +1 -1
- package/dist/subscriberbot/hooks/useBankingApi.d.ts +0 -2
- package/dist/subscriberbot/hooks/useBankingApi.js +2 -3
- package/dist/subscriberbot/hooks/useBankingApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useCompactViewport.d.ts +0 -1
- package/dist/subscriberbot/hooks/useCompactViewport.js +1 -2
- package/dist/subscriberbot/hooks/useCompactViewport.js.map +1 -1
- package/dist/subscriberbot/hooks/useFormError.d.ts +0 -1
- package/dist/subscriberbot/hooks/useFormError.js +1 -2
- package/dist/subscriberbot/hooks/useFormError.js.map +1 -1
- package/dist/subscriberbot/hooks/useFormatters.d.ts +0 -1
- package/dist/subscriberbot/hooks/useFormatters.js +1 -2
- package/dist/subscriberbot/hooks/useFormatters.js.map +1 -1
- package/dist/subscriberbot/hooks/useNegotiationApi.d.ts +0 -2
- package/dist/subscriberbot/hooks/useNegotiationApi.js +2 -3
- package/dist/subscriberbot/hooks/useNegotiationApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useProcurementApi.d.ts +0 -2
- package/dist/subscriberbot/hooks/useProcurementApi.js +2 -3
- package/dist/subscriberbot/hooks/useProcurementApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useRouteSelection.d.ts +0 -1
- package/dist/subscriberbot/hooks/useRouteSelection.js +3 -3
- package/dist/subscriberbot/hooks/useRouteSelection.js.map +1 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts +0 -2
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js +1 -2
- package/dist/subscriberbot/hooks/useSubscriberBotApi.js.map +1 -1
- package/dist/subscriberbot/hooks/useTr.d.ts +0 -1
- package/dist/subscriberbot/hooks/useTr.js +1 -2
- package/dist/subscriberbot/hooks/useTr.js.map +1 -1
- package/dist/subscriberbot/index.d.ts +0 -1
- package/dist/subscriberbot/index.js +9 -8
- package/dist/subscriberbot/pages/AssetVaultPage.d.ts +0 -2
- package/dist/subscriberbot/pages/AssetVaultPage.js +34 -35
- package/dist/subscriberbot/pages/AssetVaultPage.js.map +1 -1
- package/dist/subscriberbot/pages/DashboardPage.d.ts +1 -2
- package/dist/subscriberbot/pages/DashboardPage.js +86 -87
- package/dist/subscriberbot/pages/DashboardPage.js.map +1 -1
- package/dist/subscriberbot/pages/InboxPage.d.ts +1 -2
- package/dist/subscriberbot/pages/InboxPage.js +194 -199
- package/dist/subscriberbot/pages/InboxPage.js.map +1 -1
- package/dist/subscriberbot/pages/InsightsPage.d.ts +0 -2
- package/dist/subscriberbot/pages/InsightsPage.js +28 -29
- package/dist/subscriberbot/pages/InsightsPage.js.map +1 -1
- package/dist/subscriberbot/pages/InvoicesPage.d.ts +1 -2
- package/dist/subscriberbot/pages/InvoicesPage.js +179 -188
- package/dist/subscriberbot/pages/InvoicesPage.js.map +1 -1
- package/dist/subscriberbot/pages/RenewalsPage.d.ts +0 -2
- package/dist/subscriberbot/pages/RenewalsPage.js +293 -298
- package/dist/subscriberbot/pages/RenewalsPage.js.map +1 -1
- package/dist/subscriberbot/pages/SavingsPage.d.ts +0 -2
- package/dist/subscriberbot/pages/SavingsPage.js +25 -26
- package/dist/subscriberbot/pages/SavingsPage.js.map +1 -1
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts +1 -2
- package/dist/subscriberbot/pages/WorkflowsPage.js +67 -68
- package/dist/subscriberbot/pages/WorkflowsPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts +1 -2
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js +126 -127
- package/dist/subscriberbot/pages/agents/AgentDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts +1 -2
- package/dist/subscriberbot/pages/agents/AgentNewPage.js +10 -11
- package/dist/subscriberbot/pages/agents/AgentNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts +1 -2
- package/dist/subscriberbot/pages/agents/AgentsListPage.js +23 -24
- package/dist/subscriberbot/pages/agents/AgentsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts +1 -2
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js +337 -359
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/banking/ConnectBankModal.d.ts +1 -3
- package/dist/subscriberbot/pages/banking/ConnectBankModal.js +22 -27
- package/dist/subscriberbot/pages/banking/ConnectBankModal.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts +1 -2
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js +25 -26
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts +1 -2
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js +34 -35
- package/dist/subscriberbot/pages/decisions/DecisionsPage.js.map +1 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts +1 -2
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js +125 -130
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts +1 -2
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js +94 -95
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts +1 -2
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js +15 -16
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts +1 -2
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js +20 -21
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts +1 -2
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js +86 -87
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts +1 -2
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js +164 -165
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts +1 -2
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js +20 -21
- package/dist/subscriberbot/pages/procurement/ProcurementPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts +1 -2
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js +350 -351
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderInsights.d.ts +2 -3
- package/dist/subscriberbot/pages/providers/ProviderInsights.js +95 -96
- package/dist/subscriberbot/pages/providers/ProviderInsights.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts +1 -2
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js +11 -12
- package/dist/subscriberbot/pages/providers/ProviderNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts +1 -2
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js +62 -63
- package/dist/subscriberbot/pages/providers/ProvidersListPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts +1 -2
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js +166 -172
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts +1 -2
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js +12 -13
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.js.map +1 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts +1 -2
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js +21 -22
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts +1 -3
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js +242 -255
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.js.map +1 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts +0 -2
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js +2 -3
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.js.map +1 -1
- package/dist/subscriberbot/services/createSandboxAssistantTransport.d.ts +0 -1
- package/dist/subscriberbot/services/createSandboxAssistantTransport.js +1 -2
- package/dist/subscriberbot/services/createSandboxAssistantTransport.js.map +1 -1
- package/dist/subscriberbot/store/index.d.ts +0 -1
- package/dist/subscriberbot/store/index.js +1 -1
- package/dist/subscriberbot/store/subscriberbotStore.d.ts +1 -3
- package/dist/subscriberbot/store/subscriberbotStore.js +1 -2
- package/dist/subscriberbot/store/subscriberbotStore.js.map +1 -1
- package/dist/subscriberbot/types/assistant.d.ts +0 -2
- package/dist/subscriberbot/types/banking.d.ts +0 -2
- package/dist/subscriberbot/types/index.d.ts +0 -2
- package/dist/subscriberbot/types/negotiation.d.ts +0 -2
- package/dist/subscriberbot/types/procurement.d.ts +0 -1
- package/dist/subscriberbot/utils/bankRedirectLink.d.ts +0 -2
- package/dist/subscriberbot/utils/bankRedirectLink.js +18 -19
- package/dist/subscriberbot/utils/bankRedirectLink.js.map +1 -1
- package/dist/subscriberbot/utils/chartScale.d.ts +0 -1
- package/dist/subscriberbot/utils/chartScale.js +1 -2
- package/dist/subscriberbot/utils/chartScale.js.map +1 -1
- package/dist/subscriberbot/utils/cn.d.ts +0 -2
- package/dist/subscriberbot/utils/cn.js +2 -3
- package/dist/subscriberbot/utils/cn.js.map +1 -1
- package/dist/subscriberbot/utils/formatters.d.ts +0 -1
- package/dist/subscriberbot/utils/formatters.js +4 -5
- package/dist/subscriberbot/utils/formatters.js.map +1 -1
- package/dist/subscriberbot/utils/index.d.ts +0 -1
- package/dist/subscriberbot/utils/navigation.d.ts +0 -1
- package/dist/subscriberbot/utils/navigation.js +1 -2
- package/dist/subscriberbot/utils/navigation.js.map +1 -1
- package/dist/subscriberbot/utils/pageContext.d.ts +0 -1
- package/dist/subscriberbot/utils/pageContext.js +3 -4
- package/dist/subscriberbot/utils/pageContext.js.map +1 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts +0 -1
- package/dist/subscriberbot/utils/plaidLink.js +21 -22
- package/dist/subscriberbot/utils/plaidLink.js.map +1 -1
- package/dist/subscriberbot/utils/portfolio.d.ts +0 -2
- package/dist/subscriberbot/utils/portfolio.js +5 -6
- package/dist/subscriberbot/utils/portfolio.js.map +1 -1
- package/dist/subscriberbot/utils/renewals.d.ts +0 -2
- package/dist/subscriberbot/utils/renewals.js +1 -2
- package/dist/subscriberbot/utils/renewals.js.map +1 -1
- package/package.json +73 -56
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/stories/Accessibility.stories.d.ts.map +0 -1
- package/dist/stories/EmptyState.stories.d.ts.map +0 -1
- package/dist/stories/MetricsCard.stories.d.ts.map +0 -1
- package/dist/stories/StatusBadge.stories.d.ts.map +0 -1
- package/dist/stories/pages/AgentDetailPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/AgentNewPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/AgentsListPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/AssetVaultPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/BankConnectionsPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/DashboardPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/DecisionDetailPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/DecisionsPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/EnterpriseSpendPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/InboxPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/InboxReadState.stories.d.ts.map +0 -1
- package/dist/stories/pages/InsightsPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/InvoicesPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/NegotiationDetailPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/NegotiationNewPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/NegotiationsPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/ProcurementDetailPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/ProcurementNewPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/ProcurementPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/ProviderDetailPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/ProviderNewPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/ProvidersListPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/RelationshipDetailPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/RelationshipNewPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/RelationshipsListPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/RenewalsPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/SavingsPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/WorkflowBuilderPage.stories.d.ts.map +0 -1
- package/dist/stories/pages/WorkflowsPage.stories.d.ts.map +0 -1
- package/dist/stories/support/PageHarness.d.ts.map +0 -1
- package/dist/stories/support/bankingFixtures.d.ts.map +0 -1
- package/dist/stories/support/fixtures.d.ts.map +0 -1
- package/dist/stories/support/graphqlMock.d.ts.map +0 -1
- package/dist/stories/support/handlers.d.ts.map +0 -1
- package/dist/stories/support/negotiationFixtures.d.ts.map +0 -1
- package/dist/stories/support/phoneViewport.d.ts.map +0 -1
- package/dist/stories/support/play.d.ts.map +0 -1
- package/dist/stories/support/procurementFixtures.d.ts.map +0 -1
- package/dist/subscriberbot/SubscriberBotRoot.d.ts.map +0 -1
- package/dist/subscriberbot/SubscriberBotRoutes.d.ts.map +0 -1
- package/dist/subscriberbot/admin/AdminDashboardPage.d.ts.map +0 -1
- package/dist/subscriberbot/admin/AdminRoot.d.ts.map +0 -1
- package/dist/subscriberbot/admin/NegotiationDeskPanel.d.ts.map +0 -1
- package/dist/subscriberbot/admin/ProcurementDeskPanel.d.ts.map +0 -1
- package/dist/subscriberbot/admin/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/EmptyState.d.ts.map +0 -1
- package/dist/subscriberbot/components/MetricsCard.d.ts.map +0 -1
- package/dist/subscriberbot/components/Modal.d.ts.map +0 -1
- package/dist/subscriberbot/components/PageLayout.d.ts.map +0 -1
- package/dist/subscriberbot/components/PostureOptions.d.ts.map +0 -1
- package/dist/subscriberbot/components/StateViews.d.ts.map +0 -1
- package/dist/subscriberbot/components/StatusBadge.d.ts.map +0 -1
- package/dist/subscriberbot/components/decisions/DecisionBanners.d.ts.map +0 -1
- package/dist/subscriberbot/components/decisions/DecisionCard.d.ts.map +0 -1
- package/dist/subscriberbot/components/decisions/decisionModel.d.ts.map +0 -1
- package/dist/subscriberbot/components/decisions/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/mobile/MobileDashboard.d.ts.map +0 -1
- package/dist/subscriberbot/components/mobile/MobileRelationshipList.d.ts.map +0 -1
- package/dist/subscriberbot/components/mobile/MobileScreen.d.ts.map +0 -1
- package/dist/subscriberbot/components/mobile/RelationshipGlyph.d.ts.map +0 -1
- package/dist/subscriberbot/components/mobile/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/negotiations/NegotiationStatusPill.d.ts.map +0 -1
- package/dist/subscriberbot/components/negotiations/NegotiationTimeline.d.ts.map +0 -1
- package/dist/subscriberbot/components/negotiations/OutcomeForm.d.ts.map +0 -1
- package/dist/subscriberbot/components/negotiations/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/negotiations/labels.d.ts.map +0 -1
- package/dist/subscriberbot/components/procurement/ProcurementOutcomeForm.d.ts.map +0 -1
- package/dist/subscriberbot/components/procurement/ProcurementStatusPill.d.ts.map +0 -1
- package/dist/subscriberbot/components/procurement/ProcurementThread.d.ts.map +0 -1
- package/dist/subscriberbot/components/procurement/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/procurement/labels.d.ts.map +0 -1
- package/dist/subscriberbot/components/savings/SavingsCards.d.ts.map +0 -1
- package/dist/subscriberbot/components/savings/index.d.ts.map +0 -1
- package/dist/subscriberbot/components/savings/savingsModel.d.ts.map +0 -1
- package/dist/subscriberbot/components/viz.d.ts.map +0 -1
- package/dist/subscriberbot/config/assistantUsecases.d.ts.map +0 -1
- package/dist/subscriberbot/context/SubscriberBotContext.d.ts.map +0 -1
- package/dist/subscriberbot/context/index.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/index.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useAutonomousAgentMode.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useBankingApi.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useCompactViewport.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useFormError.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useFormatters.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useNegotiationApi.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useProcurementApi.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useRouteSelection.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useSubscriberBotApi.d.ts.map +0 -1
- package/dist/subscriberbot/hooks/useTr.d.ts.map +0 -1
- package/dist/subscriberbot/index.d.ts.map +0 -1
- package/dist/subscriberbot/pages/AssetVaultPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/DashboardPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/InboxPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/InsightsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/InvoicesPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/RenewalsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/SavingsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/WorkflowsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/agents/AgentDetailPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/agents/AgentNewPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/agents/AgentsListPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/banking/BankConnectionsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/banking/ConnectBankModal.d.ts.map +0 -1
- package/dist/subscriberbot/pages/decisions/DecisionDetailPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/decisions/DecisionsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/enterprise/EnterpriseSpendPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationDetailPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationNewPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/negotiations/NegotiationsPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/procurement/ProcurementDetailPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/procurement/ProcurementNewPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/procurement/ProcurementPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/providers/ProviderDetailPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/providers/ProviderInsights.d.ts.map +0 -1
- package/dist/subscriberbot/pages/providers/ProviderNewPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/providers/ProvidersListPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/relationships/RelationshipDetailPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/relationships/RelationshipNewPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/relationships/RelationshipsListPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/workflows/WorkflowBuilderPage.d.ts.map +0 -1
- package/dist/subscriberbot/pages/workflows/workflowBuilderGraph.d.ts.map +0 -1
- package/dist/subscriberbot/services/createSandboxAssistantTransport.d.ts.map +0 -1
- package/dist/subscriberbot/store/index.d.ts.map +0 -1
- package/dist/subscriberbot/store/subscriberbotStore.d.ts.map +0 -1
- package/dist/subscriberbot/types/assistant.d.ts.map +0 -1
- package/dist/subscriberbot/types/banking.d.ts.map +0 -1
- package/dist/subscriberbot/types/index.d.ts.map +0 -1
- package/dist/subscriberbot/types/negotiation.d.ts.map +0 -1
- package/dist/subscriberbot/types/procurement.d.ts.map +0 -1
- package/dist/subscriberbot/utils/bankRedirectLink.d.ts.map +0 -1
- package/dist/subscriberbot/utils/chartScale.d.ts.map +0 -1
- package/dist/subscriberbot/utils/cn.d.ts.map +0 -1
- package/dist/subscriberbot/utils/formatters.d.ts.map +0 -1
- package/dist/subscriberbot/utils/index.d.ts.map +0 -1
- package/dist/subscriberbot/utils/navigation.d.ts.map +0 -1
- package/dist/subscriberbot/utils/pageContext.d.ts.map +0 -1
- package/dist/subscriberbot/utils/plaidLink.d.ts.map +0 -1
- package/dist/subscriberbot/utils/portfolio.d.ts.map +0 -1
- package/dist/subscriberbot/utils/renewals.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkflowBuilderPage.js","names":[],"sources":["../../../../src/subscriberbot/pages/workflows/WorkflowBuilderPage.tsx"],"sourcesContent":["/**\n * Workflow builder (BOFF-4006)\n * @module subscriberbot/pages/workflows\n *\n * `/workflows/:id/builder` — the visual, node-based editor for one workflow.\n * A palette adds trigger / action / condition / delay / branch nodes, the\n * canvas connects and arranges them, and the inspector edits the selected\n * node's configuration. Edits stay local until Save, which replaces the\n * graph in one `subSaveWorkflowGraph` call; the svc re-validates it and\n * returns the issues that would stop the workflow from running. Activation\n * is refused while any issue remains.\n *\n * An ACTIVE workflow is shown read-only: the svc keeps active workflows valid\n * at all times, so the user pauses it to restructure it.\n */\n\nimport { type FC, useCallback, useMemo, useState } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ReactFlow,\n Background,\n Controls,\n Handle,\n MarkerType,\n Position,\n applyNodeChanges,\n type Connection,\n type Edge,\n type EdgeChange,\n type Node,\n type NodeChange,\n type NodeProps,\n} from '@xyflow/react';\nimport '@xyflow/react/dist/style.css';\nimport {\n AlertTriangle,\n ArrowLeft,\n CheckCircle2,\n Clock,\n GitBranch,\n GitFork,\n Pause,\n Play,\n Save,\n Trash2,\n Zap,\n Sparkles,\n} from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout, StatusBadge, LoadingView, ErrorView, EmptyState } from '../../components';\nimport {\n useWorkflow,\n useSaveWorkflowGraph,\n useActivateWorkflow,\n usePauseWorkflow,\n} from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport type {\n SubWorkflowActionKind,\n SubWorkflowGraphIssue,\n SubWorkflowNodeConfig,\n SubWorkflowNodeKind,\n SubWorkflowWithGraph,\n} from '../../types';\nimport {\n ACTION_KINDS,\n NODE_KINDS,\n type BuilderGraph,\n type BuilderNode,\n canAddKind,\n configSummary,\n connectionError,\n defaultLabel,\n fromServerGraph,\n initialConfig,\n nextNodePosition,\n removeNode,\n toSaveInput,\n} from './workflowBuilderGraph';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:opacity-60';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\nconst secondaryBtn =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\nconst primaryBtn =\n 'inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\n\nconst KIND_META: Record<\n SubWorkflowNodeKind,\n {\n icon: FC<{ className?: string }>;\n bar: string;\n labelKey: string;\n fallback: string;\n hint: string;\n }\n> = {\n TRIGGER: {\n icon: Zap,\n bar: 'bg-[var(--color-accent-indigo)]',\n labelKey: 'workflows.builder.kind.trigger',\n fallback: 'Trigger',\n hint: 'The event that starts the workflow',\n },\n ACTION: {\n icon: Sparkles,\n bar: 'bg-status-success-text',\n labelKey: 'workflows.builder.kind.action',\n fallback: 'Action',\n hint: 'Notify, alert, create a task, update, classify or call an adapter',\n },\n CONDITION: {\n icon: GitFork,\n bar: 'bg-status-warning-text',\n labelKey: 'workflows.builder.kind.condition',\n fallback: 'Condition',\n hint: 'Route through a true or false outlet',\n },\n DELAY: {\n icon: Clock,\n bar: 'bg-text-secondary',\n labelKey: 'workflows.builder.kind.delay',\n fallback: 'Delay',\n hint: 'Wait before the next step',\n },\n BRANCH: {\n icon: GitBranch,\n bar: 'bg-[var(--color-accent-indigo)]',\n labelKey: 'workflows.builder.kind.branch',\n fallback: 'Branch',\n hint: 'Run two or more paths in parallel',\n },\n};\n\nconst ACTION_LABELS: Record<SubWorkflowActionKind, string> = {\n NOTIFY: 'Notify',\n ALERT: 'Raise an alert',\n CREATE_TASK: 'Create a task',\n UPDATE_RELATIONSHIP: 'Update the relationship',\n CLASSIFY: 'Classify with AI',\n EVALUATE_POLICIES: 'Evaluate agent policies',\n CALL_ADAPTER: 'Call the provider adapter',\n};\n\n// React Flow ships light-only control colours (near-white buttons), which\n// render as blank white squares in dark mode. Point its documented\n// --xy-controls-* variables at the shell's semantic tokens so the zoom\n// controls follow the active theme.\nconst controlsCls = [\n 'overflow-hidden rounded-lg border border-border-subtle',\n '[--xy-controls-box-shadow:none]',\n '[--xy-controls-button-background-color:var(--color-bg-elevated)]',\n '[--xy-controls-button-background-color-hover:var(--color-bg-surface)]',\n '[--xy-controls-button-border-color:var(--color-border-subtle)]',\n '[--xy-controls-button-color:var(--color-text-secondary)]',\n '[--xy-controls-button-color-hover:var(--color-text-primary)]',\n].join(' ');\nconst handleStyle = { background: 'var(--color-text-secondary)', width: 10, height: 10 };\n\ntype CanvasNodeData = {\n kind: SubWorkflowNodeKind;\n label: string;\n summary: string;\n hasIssue: boolean;\n};\ntype CanvasNode = Node<CanvasNodeData, 'workflow'>;\n\n/** A node card on the canvas: accent bar by kind, icon, label and config summary. */\nfunction WorkflowNodeCard({ data, selected }: NodeProps<CanvasNode>) {\n const tr = useTr();\n const meta = KIND_META[data.kind];\n const Icon = meta.icon;\n return (\n <div\n data-testid={`workflow-node-${data.kind.toLowerCase()}`}\n className={`w-52 overflow-hidden rounded-xl border bg-bg-surface shadow-sm ${\n selected\n ? 'border-[var(--color-focus-ring)] ring-2 ring-[var(--color-focus-ring)]'\n : data.hasIssue\n ? 'border-status-warning-text'\n : 'border-border-subtle'\n }`}\n >\n {data.kind !== 'TRIGGER' && (\n <Handle type=\"target\" position={Position.Left} style={handleStyle} />\n )}\n <div className={`h-1 w-full ${meta.bar}`} aria-hidden />\n <div className=\"p-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n <Icon className=\"h-4 w-4\" />\n </span>\n <p className=\"text-[10px] font-medium uppercase tracking-wide text-text-secondary\">\n {tr(meta.labelKey, meta.fallback)}\n </p>\n {data.hasIssue && (\n <AlertTriangle\n className=\"ms-auto h-3.5 w-3.5 text-status-warning-text\"\n aria-label={tr('workflows.builder.nodeHasIssue', 'Needs attention')}\n />\n )}\n </div>\n <p className=\"mt-2 truncate text-sm font-semibold text-text-primary\" title={data.label}>\n {data.label}\n </p>\n <p className=\"mt-0.5 truncate text-xs text-text-secondary\" title={data.summary}>\n {data.summary}\n </p>\n </div>\n {data.kind === 'CONDITION' ? (\n <>\n <Handle\n id=\"true\"\n type=\"source\"\n position={Position.Right}\n style={{ ...handleStyle, top: '35%', background: 'var(--color-status-success-text)' }}\n />\n <Handle\n id=\"false\"\n type=\"source\"\n position={Position.Right}\n style={{ ...handleStyle, top: '70%', background: 'var(--color-status-error-text)' }}\n />\n </>\n ) : (\n <Handle type=\"source\" position={Position.Right} style={handleStyle} />\n )}\n </div>\n );\n}\n\nconst nodeTypes = { workflow: WorkflowNodeCard };\n\n/** Inspector form for the selected node. */\nfunction NodeInspector({\n node,\n readOnly,\n onChange,\n onDelete,\n}: {\n node: BuilderNode;\n readOnly: boolean;\n onChange: (patch: { label?: string; config?: SubWorkflowNodeConfig }) => void;\n onDelete: () => void;\n}) {\n const tr = useTr();\n const meta = KIND_META[node.kind];\n const setConfig = (patch: SubWorkflowNodeConfig) =>\n onChange({ config: { ...node.config, ...patch } });\n\n return (\n <div className=\"space-y-4\" data-testid=\"workflow-node-inspector\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr(meta.labelKey, meta.fallback)}\n </p>\n <div>\n <label htmlFor=\"wfb-label\" className={labelCls}>\n {tr('workflows.builder.inspector.label', 'Label')}\n </label>\n <input\n id=\"wfb-label\"\n className={inputCls}\n value={node.label}\n maxLength={120}\n disabled={readOnly}\n onChange={(e) => onChange({ label: e.target.value })}\n />\n </div>\n\n {node.kind === 'TRIGGER' && (\n <div>\n <label htmlFor=\"wfb-event\" className={labelCls}>\n {tr('workflows.builder.inspector.event', 'Trigger event')}\n </label>\n <input\n id=\"wfb-event\"\n className={inputCls}\n value={typeof node.config.event === 'string' ? node.config.event : ''}\n maxLength={120}\n placeholder={tr(\n 'workflows.form.triggerPlaceholder',\n 'e.g. InvoiceReceived, RenewalDetected'\n )}\n disabled={readOnly}\n onChange={(e) => setConfig({ event: e.target.value })}\n />\n </div>\n )}\n\n {node.kind === 'ACTION' && (\n <>\n <div>\n <label htmlFor=\"wfb-action\" className={labelCls}>\n {tr('workflows.builder.inspector.action', 'Action')}\n </label>\n <select\n id=\"wfb-action\"\n className={inputCls}\n value={typeof node.config.action === 'string' ? node.config.action : ''}\n disabled={readOnly}\n onChange={(e) =>\n setConfig({\n action: (e.target.value || undefined) as SubWorkflowActionKind | undefined,\n })\n }\n >\n <option value=\"\">\n {tr('workflows.builder.inspector.chooseAction', 'Choose an action…')}\n </option>\n {ACTION_KINDS.map((a) => (\n <option key={a} value={a}>\n {tr(`workflows.builder.action.${a.toLowerCase()}`, ACTION_LABELS[a])}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"wfb-message\" className={labelCls}>\n {tr('workflows.builder.inspector.message', 'Message (optional)')}\n </label>\n <textarea\n id=\"wfb-message\"\n rows={3}\n className={inputCls}\n maxLength={1000}\n value={typeof node.config.message === 'string' ? node.config.message : ''}\n disabled={readOnly}\n onChange={(e) => setConfig({ message: e.target.value })}\n />\n </div>\n </>\n )}\n\n {node.kind === 'CONDITION' && (\n <div>\n <label htmlFor=\"wfb-expression\" className={labelCls}>\n {tr('workflows.builder.inspector.expression', 'Condition')}\n </label>\n <input\n id=\"wfb-expression\"\n className={inputCls}\n maxLength={500}\n placeholder={tr(\n 'workflows.builder.inspector.expressionPlaceholder',\n 'e.g. monthlySpend > 100'\n )}\n value={typeof node.config.expression === 'string' ? node.config.expression : ''}\n disabled={readOnly}\n onChange={(e) => setConfig({ expression: e.target.value })}\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tr(\n 'workflows.builder.inspector.expressionHint',\n 'Connect the green outlet for when it holds and the red outlet for when it does not.'\n )}\n </p>\n </div>\n )}\n\n {node.kind === 'DELAY' && (\n <div>\n <label htmlFor=\"wfb-delay\" className={labelCls}>\n {tr('workflows.builder.inspector.delay', 'Wait (minutes)')}\n </label>\n <input\n id=\"wfb-delay\"\n type=\"number\"\n min={1}\n max={525600}\n step={1}\n className={inputCls}\n value={\n typeof node.config.durationMinutes === 'number' ? node.config.durationMinutes : ''\n }\n disabled={readOnly}\n onChange={(e) => {\n const n = Number.parseInt(e.target.value, 10);\n setConfig({ durationMinutes: Number.isFinite(n) ? n : undefined });\n }}\n />\n </div>\n )}\n\n {node.kind === 'BRANCH' && (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'workflows.builder.inspector.branchHint',\n 'Connect two or more steps; they run in parallel.'\n )}\n </p>\n )}\n\n {!readOnly && (\n <button\n type=\"button\"\n onClick={onDelete}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-status-error-text/40 px-3 py-1.5 text-xs font-medium text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" />{' '}\n {tr('workflows.builder.inspector.deleteNode', 'Delete node')}\n </button>\n )}\n </div>\n );\n}\n\n/** The editor itself, mounted once the workflow has loaded. */\nfunction WorkflowBuilder({ workflow }: { workflow: SubWorkflowWithGraph }) {\n const tr = useTr();\n const save = useSaveWorkflowGraph();\n const activate = useActivateWorkflow();\n const pause = usePauseWorkflow();\n\n const [graph, setGraph] = useState<BuilderGraph>(() => fromServerGraph(workflow.graph));\n const [issues, setIssues] = useState<SubWorkflowGraphIssue[]>(workflow.graph.issues);\n const [dirty, setDirty] = useState(false);\n const [selectedNodeId, setSelectedNodeId] = useState<string | null>(null);\n const [selectedEdgeId, setSelectedEdgeId] = useState<string | null>(null);\n const [notice, setNotice] = useState<{ tone: 'error' | 'success'; text: string } | null>(null);\n const [placeholderSeq, setPlaceholderSeq] = useState(1);\n\n const readOnly = workflow.status === 'ACTIVE';\n // Editing pauses while a save is in flight: the response replaces the local\n // graph (placeholder ids become server ids), so an edit made in the meantime\n // would otherwise be overwritten and reported as saved.\n const editLocked = readOnly || save.isPending;\n\n // A refetch after save/activate/pause brings a fresh server graph; adopt it\n // unless the user has local edits in flight. Compared during render (the\n // \"store the previous prop\" pattern) so no effect has to mirror props into state.\n const [seenGraph, setSeenGraph] = useState(workflow.graph);\n if (seenGraph !== workflow.graph) {\n setSeenGraph(workflow.graph);\n if (!dirty) {\n setGraph(fromServerGraph(workflow.graph));\n setIssues(workflow.graph.issues);\n }\n }\n\n const issueNodeIds = useMemo(\n () => new Set(issues.map((i) => i.nodeId).filter((id): id is string => Boolean(id))),\n [issues]\n );\n\n const rfNodes: CanvasNode[] = useMemo(\n () =>\n graph.nodes.map((n) => ({\n id: n.id,\n type: 'workflow',\n position: { x: n.x, y: n.y },\n selected: n.id === selectedNodeId,\n data: {\n kind: n.kind,\n label:\n n.label ||\n tr(`workflowBuilder.nodeLabel.${n.kind.toLowerCase()}`, defaultLabel(n.kind)),\n summary: configSummary(n, tr),\n hasIssue: !dirty && issueNodeIds.has(n.id),\n },\n })),\n [graph.nodes, selectedNodeId, dirty, issueNodeIds, tr]\n );\n\n const rfEdges: Edge[] = useMemo(\n () =>\n graph.edges.map((e) => ({\n id: e.id,\n source: e.source,\n target: e.target,\n sourceHandle: e.handle,\n selected: e.id === selectedEdgeId,\n label:\n e.handle === 'true'\n ? tr('workflows.builder.yes', 'Yes')\n : e.handle === 'false'\n ? tr('workflows.builder.no', 'No')\n : undefined,\n markerEnd: { type: MarkerType.ArrowClosed, color: 'var(--color-text-secondary)' },\n style: {\n stroke:\n e.id === selectedEdgeId ? 'var(--color-focus-ring)' : 'var(--color-text-secondary)',\n strokeWidth: 2,\n },\n })),\n [graph.edges, selectedEdgeId, tr]\n );\n\n const edit = useCallback((next: (g: BuilderGraph) => BuilderGraph) => {\n setGraph((g) => next(g));\n setDirty(true);\n setNotice(null);\n }, []);\n\n const onNodesChange = useCallback(\n (changes: NodeChange<CanvasNode>[]) => {\n const moves = changes.filter((c) => c.type === 'position' && c.position);\n const removals = changes.filter((c) => c.type === 'remove');\n if (editLocked || (moves.length === 0 && removals.length === 0)) return;\n edit((g) => {\n const moved = applyNodeChanges(\n moves,\n g.nodes.map((n) => ({ id: n.id, position: { x: n.x, y: n.y }, data: {} }))\n );\n let next: BuilderGraph = {\n nodes: g.nodes.map((n) => {\n const m = moved.find((x) => x.id === n.id);\n return m ? { ...n, x: m.position.x, y: m.position.y } : n;\n }),\n edges: g.edges,\n };\n for (const r of removals) if (r.type === 'remove') next = removeNode(next, r.id);\n return next;\n });\n },\n [edit, editLocked]\n );\n\n const onEdgesChange = useCallback(\n (changes: EdgeChange[]) => {\n const removed = new Set(changes.filter((c) => c.type === 'remove').map((c) => c.id));\n if (editLocked || removed.size === 0) return;\n edit((g) => ({ nodes: g.nodes, edges: g.edges.filter((e) => !removed.has(e.id)) }));\n },\n [edit, editLocked]\n );\n\n const onConnect = useCallback(\n (c: Connection) => {\n if (editLocked) return;\n const handle = c.sourceHandle ?? null;\n const reason = connectionError(graph, c.source, c.target, handle, tr);\n if (reason) {\n setNotice({ tone: 'error', text: reason });\n return;\n }\n edit((g) => ({\n nodes: g.nodes,\n edges: [\n ...g.edges,\n {\n id: `edge-${c.source}-${handle ?? 'out'}-${c.target}`,\n source: c.source,\n target: c.target,\n handle,\n label: null,\n },\n ],\n }));\n },\n [edit, graph, editLocked, tr]\n );\n\n const addNode = (kind: SubWorkflowNodeKind) => {\n const id = `new-${placeholderSeq}`;\n setPlaceholderSeq((s) => s + 1);\n const pos = nextNodePosition(graph.nodes);\n edit((g) => ({\n nodes: [\n ...g.nodes,\n {\n id,\n kind,\n label: tr(`workflowBuilder.nodeLabel.${kind.toLowerCase()}`, defaultLabel(kind)),\n config: initialConfig(kind),\n x: pos.x,\n y: pos.y,\n },\n ],\n edges: g.edges,\n }));\n setSelectedNodeId(id);\n setSelectedEdgeId(null);\n };\n\n const selectedNode = graph.nodes.find((n) => n.id === selectedNodeId) ?? null;\n\n const handleSave = () => {\n save.mutate(\n { workflowId: workflow.id, input: toSaveInput(graph) },\n {\n onSuccess: (saved) => {\n setGraph(fromServerGraph(saved));\n setIssues(saved.issues);\n setDirty(false);\n setSelectedNodeId(null);\n setSelectedEdgeId(null);\n setNotice({\n tone: 'success',\n text: saved.valid\n ? tr('workflows.builder.savedValid', 'Saved. This workflow is ready to activate.')\n : tr(\n 'workflows.builder.savedWithIssues',\n 'Saved as a draft. Fix the issues below before activating.'\n ),\n });\n },\n onError: (err) =>\n setNotice({\n tone: 'error',\n text: err instanceof Error ? err.message : tr('common.error', 'An error occurred'),\n }),\n }\n );\n };\n\n const handleActivate = () =>\n activate.mutate(workflow.id, {\n onSuccess: () =>\n setNotice({\n tone: 'success',\n text: tr('workflows.builder.activated', 'Workflow activated.'),\n }),\n onError: (err) =>\n setNotice({\n tone: 'error',\n text: err instanceof Error ? err.message : tr('common.error', 'An error occurred'),\n }),\n });\n\n const handlePause = () =>\n pause.mutate(workflow.id, {\n onSuccess: () =>\n setNotice({\n tone: 'success',\n text: tr('workflows.builder.paused', 'Workflow paused. You can edit it now.'),\n }),\n onError: (err) =>\n setNotice({\n tone: 'error',\n text: err instanceof Error ? err.message : tr('common.error', 'An error occurred'),\n }),\n });\n\n const canActivate = !readOnly && !dirty && issues.length === 0 && graph.nodes.length > 0;\n\n return (\n <>\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={workflow.status} />\n {dirty && (\n <span className=\"rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n {tr('workflows.builder.unsaved', 'Unsaved changes')}\n </span>\n )}\n {!dirty && issues.length === 0 && graph.nodes.length > 0 && (\n <span className=\"inline-flex items-center gap-1 text-xs text-status-success-text\">\n <CheckCircle2 className=\"h-3.5 w-3.5\" />{' '}\n {tr('workflows.builder.valid', 'Ready to run')}\n </span>\n )}\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {readOnly ? (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={handlePause}\n disabled={pause.isPending}\n >\n <Pause className=\"h-4 w-4\" /> {tr('workflows.builder.pauseToEdit', 'Pause to edit')}\n </button>\n ) : (\n <>\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={handleSave}\n disabled={!dirty || save.isPending}\n >\n <Save className=\"h-4 w-4\" />{' '}\n {save.isPending\n ? tr('workflows.builder.saving', 'Saving…')\n : tr('workflows.builder.save', 'Save')}\n </button>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={handleActivate}\n disabled={!canActivate || activate.isPending}\n title={\n dirty\n ? tr('workflows.builder.saveFirst', 'Save your changes first')\n : issues.length > 0\n ? tr('workflows.builder.fixIssuesFirst', 'Fix the issues first')\n : undefined\n }\n >\n <Play className=\"h-4 w-4\" />{' '}\n {activate.isPending\n ? tr('common.activating', 'Activating…')\n : tr('workflows.flow.activate', 'Activate workflow')}\n </button>\n </>\n )}\n </div>\n </div>\n\n {notice && (\n <div\n role={notice.tone === 'error' ? 'alert' : 'status'}\n className={`mt-3 rounded-lg border px-4 py-2 text-sm ${\n notice.tone === 'error'\n ? 'border-status-error-text/30 bg-status-error-bg-subtle text-status-error-text'\n : 'border-status-success-text/30 bg-status-success-bg-subtle text-status-success-text'\n }`}\n >\n {notice.text}\n </div>\n )}\n {readOnly && (\n <p className=\"mt-3 text-sm text-text-secondary\">\n {tr(\n 'workflows.builder.readOnlyActive',\n 'This workflow is active, so it is shown read-only. Pause it to change its steps.'\n )}\n </p>\n )}\n\n <div className=\"mt-4 grid grid-cols-1 gap-4 lg:grid-cols-[13rem_minmax(0,1fr)_18rem]\">\n {/* Palette */}\n <GlassCard treatment=\"metric\" className=\"p-3\">\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr('workflows.builder.palette', 'Add a step')}\n </p>\n <div\n className=\"grid grid-cols-2 gap-2 lg:grid-cols-1\"\n role=\"group\"\n aria-label={tr('workflows.builder.palette', 'Add a step')}\n >\n {NODE_KINDS.map((kind) => {\n const meta = KIND_META[kind];\n const Icon = meta.icon;\n const disabled = editLocked || !canAddKind(kind, graph.nodes);\n return (\n <button\n key={kind}\n type=\"button\"\n disabled={disabled}\n onClick={() => addNode(kind)}\n title={tr(`${meta.labelKey}Hint`, meta.hint)}\n className=\"flex items-center gap-2 rounded-lg border border-border-subtle bg-bg-surface px-2.5 py-2 text-start text-sm text-text-primary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <Icon className=\"h-4 w-4 shrink-0 text-text-secondary\" />\n <span className=\"truncate\">{tr(meta.labelKey, meta.fallback)}</span>\n </button>\n );\n })}\n </div>\n </GlassCard>\n\n {/* Canvas */}\n <div\n className=\"h-[60vh] min-h-[420px] overflow-hidden rounded-xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"workflow-canvas\"\n >\n {graph.nodes.length === 0 ? (\n <div className=\"flex h-full items-center justify-center p-6\">\n <EmptyState\n icon={<Zap className=\"h-10 w-10\" />}\n title={tr('workflows.builder.emptyTitle', 'Start with a trigger')}\n description={tr(\n 'workflows.builder.emptyDescription',\n 'Add a trigger from the palette, then connect the steps that should follow it.'\n )}\n />\n </div>\n ) : (\n <ReactFlow\n nodes={rfNodes}\n edges={rfEdges}\n nodeTypes={nodeTypes}\n onNodesChange={onNodesChange}\n onEdgesChange={onEdgesChange}\n onConnect={onConnect}\n onNodeClick={(_e, n) => {\n setSelectedNodeId(n.id);\n setSelectedEdgeId(null);\n }}\n onEdgeClick={(_e, e) => {\n setSelectedEdgeId(e.id);\n setSelectedNodeId(null);\n }}\n onPaneClick={() => {\n setSelectedNodeId(null);\n setSelectedEdgeId(null);\n }}\n nodesDraggable={!editLocked}\n nodesConnectable={!editLocked}\n deleteKeyCode={editLocked ? null : ['Backspace', 'Delete']}\n fitView\n fitViewOptions={{ padding: 0.2, maxZoom: 1.1 }}\n proOptions={{ hideAttribution: true }}\n >\n <Background color=\"var(--color-border-subtle)\" gap={20} />\n <Controls showInteractive={false} className={controlsCls} />\n </ReactFlow>\n )}\n </div>\n\n {/* Inspector + issues */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"metric\" className=\"p-4\">\n {selectedNode ? (\n <NodeInspector\n node={selectedNode}\n readOnly={editLocked}\n onChange={(patch) =>\n edit((g) => ({\n nodes: g.nodes.map((n) => (n.id === selectedNode.id ? { ...n, ...patch } : n)),\n edges: g.edges,\n }))\n }\n onDelete={() => {\n edit((g) => removeNode(g, selectedNode.id));\n setSelectedNodeId(null);\n }}\n />\n ) : selectedEdgeId && !editLocked ? (\n <div className=\"space-y-3\">\n <p className=\"text-sm text-text-primary\">\n {tr('workflows.builder.edgeSelected', 'Connection selected')}\n </p>\n <button\n type=\"button\"\n onClick={() => {\n edit((g) => ({\n nodes: g.nodes,\n edges: g.edges.filter((e) => e.id !== selectedEdgeId),\n }));\n setSelectedEdgeId(null);\n }}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-status-error-text/40 px-3 py-1.5 text-xs font-medium text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" />{' '}\n {tr('workflows.builder.deleteEdge', 'Delete connection')}\n </button>\n </div>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'workflows.builder.inspectorEmpty',\n 'Select a node to edit it. Drag from a node’s right edge to another node to connect them.'\n )}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"metric\" className=\"p-4\" data-testid=\"workflow-issues\">\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr('workflows.builder.issues', 'Validation')}\n </p>\n {dirty ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('workflows.builder.issuesAfterSave', 'Save to check the workflow.')}\n </p>\n ) : issues.length === 0 ? (\n <p className=\"inline-flex items-center gap-1.5 text-sm text-status-success-text\">\n <CheckCircle2 className=\"h-4 w-4\" />{' '}\n {tr('workflows.builder.noIssues', 'No issues found')}\n </p>\n ) : (\n <ul className=\"space-y-2\">\n {issues.map((issue, i) => (\n <li key={`${issue.code}-${issue.nodeId ?? issue.edgeId ?? i}`}>\n <button\n type=\"button\"\n className=\"flex w-full items-start gap-2 text-start text-sm text-text-primary hover:underline disabled:no-underline\"\n disabled={!issue.nodeId}\n onClick={() => issue.nodeId && setSelectedNodeId(issue.nodeId)}\n >\n <AlertTriangle className=\"mt-0.5 h-4 w-4 shrink-0 text-status-warning-text\" />\n <span>{issue.message}</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n </GlassCard>\n </div>\n </div>\n </>\n );\n}\n\nexport function WorkflowBuilderPage() {\n const { id } = useParams<{ id: string }>();\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const { data, isLoading, isError, refetch } = useWorkflow(id);\n\n return (\n <PageLayout\n title={data?.name ?? tr('workflows.builder.title', 'Workflow builder')}\n description={\n data\n ? tr('workflows.builder.subtitle', 'Visual builder · starts on {{trigger}}', {\n trigger: data.triggerEvent || '—',\n })\n : undefined\n }\n actions={\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => navigateTo(id ? `/workflows/${id}` : '/workflows')}\n >\n <ArrowLeft className=\"rtl:rotate-180 h-4 w-4\" />{' '}\n {tr('workflows.builder.back', 'Workflows')}\n </button>\n }\n >\n {isLoading ? (\n <LoadingView label={tr('workflows.builder.loading', 'Loading workflow…')} />\n ) : isError ? (\n <ErrorView\n message={tr('workflows.builder.error', 'Could not load this workflow.')}\n onRetry={() => void refetch()}\n />\n ) : !data ? (\n <EmptyState\n title={tr('workflows.builder.notFound', 'Workflow not found')}\n description={tr(\n 'workflows.builder.notFoundDescription',\n 'It may have been deleted, or it belongs to another workspace.'\n )}\n />\n ) : (\n // Keyed by workflow id so moving to another workflow starts a fresh\n // editor instead of carrying the previous workflow's unsaved graph.\n <WorkflowBuilder key={data.id} workflow={data} />\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiFA,IAAM,IACJ,4NACI,IAAW,sDACX,IACJ,kKACI,IACJ,gKAEI,IASF;CACF,SAAS;EACP,MAAM;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,QAAQ;EACN,MAAM;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,WAAW;EACT,MAAM;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,QAAQ;EACN,MAAM;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;AACF,GAEM,IAAuD;CAC3D,QAAQ;CACR,OAAO;CACP,aAAa;CACb,qBAAqB;CACrB,UAAU;CACV,mBAAmB;CACnB,cAAc;AAChB,GAMM,KAAc;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EAAE,KAAK,GAAG,GACJ,IAAc;CAAE,YAAY;CAA+B,OAAO;CAAI,QAAQ;AAAG;AAWvF,SAAS,EAAiB,EAAE,SAAM,eAAmC;CACnE,IAAM,IAAK,EAAM,GACX,IAAO,EAAU,EAAK,OACtB,IAAO,EAAK;CAClB,OACE,kBAAC,OAAD;EACE,eAAa,iBAAiB,EAAK,KAAK,YAAY;EACpD,WAAW,kEACT,IACI,2EACA,EAAK,WACH,+BACA;YAPV;GAUG,EAAK,SAAS,aACb,kBAAC,GAAD;IAAQ,MAAK;IAAS,UAAU,EAAS;IAAM,OAAO;GAAc,CAAA;GAEtE,kBAAC,OAAD;IAAK,WAAW,cAAc,EAAK;IAAO,eAAA;GAAa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O,YAAY;aAHlE;IAKE,kBAAC,GAAD,EAAW,WAAU,yBAA0B,CAAA;IAAE;IAChD,EAAG,0BAA0B,WAAW;GACnC;;YAGT,IACC,kBAAC,GAAD,EAAa,OAAO,EAAG,6BAA6B,mBAAmB,EAAI,CAAA,IACzE,IACF,kBAAC,GAAD;GACE,SAAS,EAAG,2BAA2B,+BAA+B;GACtE,eAAe,KAAK,EAAQ;EAC7B,CAAA,IACE,IAWH,kBAAC,GAAD,EAA+B,UAAU,EAAO,GAA1B,EAAK,EAAqB,IAVhD,kBAAC,GAAD;GACE,OAAO,EAAG,8BAA8B,oBAAoB;GAC5D,aAAa,EACX,yCACA,+DACF;EACD,CAAA;CAMO,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"WorkflowBuilderPage.js","names":["_Fragment","EmptyState","EmptyState$1","Fragment$1","inputCls","labelCls","secondaryBtn","primaryBtn","KIND_META","Zap","Sparkles","GitFork","Clock","GitBranch","ACTION_LABELS","controlsCls","handleStyle","WorkflowNodeCard","tr","useTr","meta","data","Icon","selected","Handle","Position","AlertTriangle","nodeTypes","NodeInspector","node","setConfig","onChange","patch","readOnly","ACTION_KINDS","a","n","onDelete","Trash2","WorkflowBuilder","save","useSaveWorkflowGraph","activate","useActivateWorkflow","pause","usePauseWorkflow","graph","setGraph","useState","fromServerGraph","workflow","issues","setIssues","dirty","setDirty","selectedNodeId","setSelectedNodeId","selectedEdgeId","setSelectedEdgeId","notice","setNotice","placeholderSeq","setPlaceholderSeq","editLocked","seenGraph","setSeenGraph","issueNodeIds","useMemo","i","id","rfNodes","defaultLabel","configSummary","rfEdges","MarkerType","edit","useCallback","next","g","onNodesChange","moves","changes","c","removals","moved","applyNodeChanges","m","x","r","removeNode","onEdgesChange","removed","onConnect","handle","reason","connectionError","addNode","s","pos","nextNodePosition","kind","initialConfig","selectedNode","handleSave","toSaveInput","saved","err","handleActivate","handlePause","canActivate","StatusBadge","CheckCircle2","Pause","Save","Play","GlassCard","NODE_KINDS","disabled","canAddKind","ReactFlow","e","Background","Controls","issue","WorkflowBuilderPage","useParams","useSubscriberBot","useWorkflow","PageLayout","navigateTo","ArrowLeft","isLoading","LoadingView","isError","ErrorView","refetch"],"sources":["../../../../src/subscriberbot/pages/workflows/WorkflowBuilderPage.tsx"],"sourcesContent":["/**\n * Workflow builder (BOFF-4006)\n * @module subscriberbot/pages/workflows\n *\n * `/workflows/:id/builder` — the visual, node-based editor for one workflow.\n * A palette adds trigger / action / condition / delay / branch nodes, the\n * canvas connects and arranges them, and the inspector edits the selected\n * node's configuration. Edits stay local until Save, which replaces the\n * graph in one `subSaveWorkflowGraph` call; the svc re-validates it and\n * returns the issues that would stop the workflow from running. Activation\n * is refused while any issue remains.\n *\n * An ACTIVE workflow is shown read-only: the svc keeps active workflows valid\n * at all times, so the user pauses it to restructure it.\n */\n\nimport { type FC, useCallback, useMemo, useState } from 'react';\nimport { useParams } from 'react-router';\nimport {\n ReactFlow,\n Background,\n Controls,\n Handle,\n MarkerType,\n Position,\n applyNodeChanges,\n type Connection,\n type Edge,\n type EdgeChange,\n type Node,\n type NodeChange,\n type NodeProps,\n} from '@xyflow/react';\nimport '@xyflow/react/dist/style.css';\nimport {\n AlertTriangle,\n ArrowLeft,\n CheckCircle2,\n Clock,\n GitBranch,\n GitFork,\n Pause,\n Play,\n Save,\n Trash2,\n Zap,\n Sparkles,\n} from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout, StatusBadge, LoadingView, ErrorView, EmptyState } from '../../components';\nimport {\n useWorkflow,\n useSaveWorkflowGraph,\n useActivateWorkflow,\n usePauseWorkflow,\n} from '../../hooks/useSubscriberBotApi';\nimport { useTr } from '../../hooks/useTr';\nimport { useSubscriberBot } from '../../context/SubscriberBotContext';\nimport type {\n SubWorkflowActionKind,\n SubWorkflowGraphIssue,\n SubWorkflowNodeConfig,\n SubWorkflowNodeKind,\n SubWorkflowWithGraph,\n} from '../../types';\nimport {\n ACTION_KINDS,\n NODE_KINDS,\n type BuilderGraph,\n type BuilderNode,\n canAddKind,\n configSummary,\n connectionError,\n defaultLabel,\n fromServerGraph,\n initialConfig,\n nextNodePosition,\n removeNode,\n toSaveInput,\n} from './workflowBuilderGraph';\n\nconst inputCls =\n 'w-full rounded-lg border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:opacity-60';\nconst labelCls = 'mb-1 block text-xs font-medium text-text-secondary';\nconst secondaryBtn =\n 'inline-flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\nconst primaryBtn =\n 'inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:opacity-50';\n\nconst KIND_META: Record<\n SubWorkflowNodeKind,\n {\n icon: FC<{ className?: string }>;\n bar: string;\n labelKey: string;\n fallback: string;\n hint: string;\n }\n> = {\n TRIGGER: {\n icon: Zap,\n bar: 'bg-[var(--color-accent-indigo)]',\n labelKey: 'workflows.builder.kind.trigger',\n fallback: 'Trigger',\n hint: 'The event that starts the workflow',\n },\n ACTION: {\n icon: Sparkles,\n bar: 'bg-status-success-text',\n labelKey: 'workflows.builder.kind.action',\n fallback: 'Action',\n hint: 'Notify, alert, create a task, update, classify or call an adapter',\n },\n CONDITION: {\n icon: GitFork,\n bar: 'bg-status-warning-text',\n labelKey: 'workflows.builder.kind.condition',\n fallback: 'Condition',\n hint: 'Route through a true or false outlet',\n },\n DELAY: {\n icon: Clock,\n bar: 'bg-text-secondary',\n labelKey: 'workflows.builder.kind.delay',\n fallback: 'Delay',\n hint: 'Wait before the next step',\n },\n BRANCH: {\n icon: GitBranch,\n bar: 'bg-[var(--color-accent-indigo)]',\n labelKey: 'workflows.builder.kind.branch',\n fallback: 'Branch',\n hint: 'Run two or more paths in parallel',\n },\n};\n\nconst ACTION_LABELS: Record<SubWorkflowActionKind, string> = {\n NOTIFY: 'Notify',\n ALERT: 'Raise an alert',\n CREATE_TASK: 'Create a task',\n UPDATE_RELATIONSHIP: 'Update the relationship',\n CLASSIFY: 'Classify with AI',\n EVALUATE_POLICIES: 'Evaluate agent policies',\n CALL_ADAPTER: 'Call the provider adapter',\n};\n\n// React Flow ships light-only control colours (near-white buttons), which\n// render as blank white squares in dark mode. Point its documented\n// --xy-controls-* variables at the shell's semantic tokens so the zoom\n// controls follow the active theme.\nconst controlsCls = [\n 'overflow-hidden rounded-lg border border-border-subtle',\n '[--xy-controls-box-shadow:none]',\n '[--xy-controls-button-background-color:var(--color-bg-elevated)]',\n '[--xy-controls-button-background-color-hover:var(--color-bg-surface)]',\n '[--xy-controls-button-border-color:var(--color-border-subtle)]',\n '[--xy-controls-button-color:var(--color-text-secondary)]',\n '[--xy-controls-button-color-hover:var(--color-text-primary)]',\n].join(' ');\nconst handleStyle = { background: 'var(--color-text-secondary)', width: 10, height: 10 };\n\ntype CanvasNodeData = {\n kind: SubWorkflowNodeKind;\n label: string;\n summary: string;\n hasIssue: boolean;\n};\ntype CanvasNode = Node<CanvasNodeData, 'workflow'>;\n\n/** A node card on the canvas: accent bar by kind, icon, label and config summary. */\nfunction WorkflowNodeCard({ data, selected }: NodeProps<CanvasNode>) {\n const tr = useTr();\n const meta = KIND_META[data.kind];\n const Icon = meta.icon;\n return (\n <div\n data-testid={`workflow-node-${data.kind.toLowerCase()}`}\n className={`w-52 overflow-hidden rounded-xl border bg-bg-surface shadow-sm ${\n selected\n ? 'border-[var(--color-focus-ring)] ring-2 ring-[var(--color-focus-ring)]'\n : data.hasIssue\n ? 'border-status-warning-text'\n : 'border-border-subtle'\n }`}\n >\n {data.kind !== 'TRIGGER' && (\n <Handle type=\"target\" position={Position.Left} style={handleStyle} />\n )}\n <div className={`h-1 w-full ${meta.bar}`} aria-hidden />\n <div className=\"p-3\">\n <div className=\"flex items-center gap-2\">\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-text-primary\">\n <Icon className=\"h-4 w-4\" />\n </span>\n <p className=\"text-[10px] font-medium uppercase tracking-wide text-text-secondary\">\n {tr(meta.labelKey, meta.fallback)}\n </p>\n {data.hasIssue && (\n <AlertTriangle\n className=\"ms-auto h-3.5 w-3.5 text-status-warning-text\"\n aria-label={tr('workflows.builder.nodeHasIssue', 'Needs attention')}\n />\n )}\n </div>\n <p className=\"mt-2 truncate text-sm font-semibold text-text-primary\" title={data.label}>\n {data.label}\n </p>\n <p className=\"mt-0.5 truncate text-xs text-text-secondary\" title={data.summary}>\n {data.summary}\n </p>\n </div>\n {data.kind === 'CONDITION' ? (\n <>\n <Handle\n id=\"true\"\n type=\"source\"\n position={Position.Right}\n style={{ ...handleStyle, top: '35%', background: 'var(--color-status-success-text)' }}\n />\n <Handle\n id=\"false\"\n type=\"source\"\n position={Position.Right}\n style={{ ...handleStyle, top: '70%', background: 'var(--color-status-error-text)' }}\n />\n </>\n ) : (\n <Handle type=\"source\" position={Position.Right} style={handleStyle} />\n )}\n </div>\n );\n}\n\nconst nodeTypes = { workflow: WorkflowNodeCard };\n\n/** Inspector form for the selected node. */\nfunction NodeInspector({\n node,\n readOnly,\n onChange,\n onDelete,\n}: {\n node: BuilderNode;\n readOnly: boolean;\n onChange: (patch: { label?: string; config?: SubWorkflowNodeConfig }) => void;\n onDelete: () => void;\n}) {\n const tr = useTr();\n const meta = KIND_META[node.kind];\n const setConfig = (patch: SubWorkflowNodeConfig) =>\n onChange({ config: { ...node.config, ...patch } });\n\n return (\n <div className=\"space-y-4\" data-testid=\"workflow-node-inspector\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr(meta.labelKey, meta.fallback)}\n </p>\n <div>\n <label htmlFor=\"wfb-label\" className={labelCls}>\n {tr('workflows.builder.inspector.label', 'Label')}\n </label>\n <input\n id=\"wfb-label\"\n className={inputCls}\n value={node.label}\n maxLength={120}\n disabled={readOnly}\n onChange={(e) => onChange({ label: e.target.value })}\n />\n </div>\n\n {node.kind === 'TRIGGER' && (\n <div>\n <label htmlFor=\"wfb-event\" className={labelCls}>\n {tr('workflows.builder.inspector.event', 'Trigger event')}\n </label>\n <input\n id=\"wfb-event\"\n className={inputCls}\n value={typeof node.config.event === 'string' ? node.config.event : ''}\n maxLength={120}\n placeholder={tr(\n 'workflows.form.triggerPlaceholder',\n 'e.g. InvoiceReceived, RenewalDetected'\n )}\n disabled={readOnly}\n onChange={(e) => setConfig({ event: e.target.value })}\n />\n </div>\n )}\n\n {node.kind === 'ACTION' && (\n <>\n <div>\n <label htmlFor=\"wfb-action\" className={labelCls}>\n {tr('workflows.builder.inspector.action', 'Action')}\n </label>\n <select\n id=\"wfb-action\"\n className={inputCls}\n value={typeof node.config.action === 'string' ? node.config.action : ''}\n disabled={readOnly}\n onChange={(e) =>\n setConfig({\n action: (e.target.value || undefined) as SubWorkflowActionKind | undefined,\n })\n }\n >\n <option value=\"\">\n {tr('workflows.builder.inspector.chooseAction', 'Choose an action…')}\n </option>\n {ACTION_KINDS.map((a) => (\n <option key={a} value={a}>\n {tr(`workflows.builder.action.${a.toLowerCase()}`, ACTION_LABELS[a])}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label htmlFor=\"wfb-message\" className={labelCls}>\n {tr('workflows.builder.inspector.message', 'Message (optional)')}\n </label>\n <textarea\n id=\"wfb-message\"\n rows={3}\n className={inputCls}\n maxLength={1000}\n value={typeof node.config.message === 'string' ? node.config.message : ''}\n disabled={readOnly}\n onChange={(e) => setConfig({ message: e.target.value })}\n />\n </div>\n </>\n )}\n\n {node.kind === 'CONDITION' && (\n <div>\n <label htmlFor=\"wfb-expression\" className={labelCls}>\n {tr('workflows.builder.inspector.expression', 'Condition')}\n </label>\n <input\n id=\"wfb-expression\"\n className={inputCls}\n maxLength={500}\n placeholder={tr(\n 'workflows.builder.inspector.expressionPlaceholder',\n 'e.g. monthlySpend > 100'\n )}\n value={typeof node.config.expression === 'string' ? node.config.expression : ''}\n disabled={readOnly}\n onChange={(e) => setConfig({ expression: e.target.value })}\n />\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tr(\n 'workflows.builder.inspector.expressionHint',\n 'Connect the green outlet for when it holds and the red outlet for when it does not.'\n )}\n </p>\n </div>\n )}\n\n {node.kind === 'DELAY' && (\n <div>\n <label htmlFor=\"wfb-delay\" className={labelCls}>\n {tr('workflows.builder.inspector.delay', 'Wait (minutes)')}\n </label>\n <input\n id=\"wfb-delay\"\n type=\"number\"\n min={1}\n max={525600}\n step={1}\n className={inputCls}\n value={\n typeof node.config.durationMinutes === 'number' ? node.config.durationMinutes : ''\n }\n disabled={readOnly}\n onChange={(e) => {\n const n = Number.parseInt(e.target.value, 10);\n setConfig({ durationMinutes: Number.isFinite(n) ? n : undefined });\n }}\n />\n </div>\n )}\n\n {node.kind === 'BRANCH' && (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'workflows.builder.inspector.branchHint',\n 'Connect two or more steps; they run in parallel.'\n )}\n </p>\n )}\n\n {!readOnly && (\n <button\n type=\"button\"\n onClick={onDelete}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-status-error-text/40 px-3 py-1.5 text-xs font-medium text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" />{' '}\n {tr('workflows.builder.inspector.deleteNode', 'Delete node')}\n </button>\n )}\n </div>\n );\n}\n\n/** The editor itself, mounted once the workflow has loaded. */\nfunction WorkflowBuilder({ workflow }: { workflow: SubWorkflowWithGraph }) {\n const tr = useTr();\n const save = useSaveWorkflowGraph();\n const activate = useActivateWorkflow();\n const pause = usePauseWorkflow();\n\n const [graph, setGraph] = useState<BuilderGraph>(() => fromServerGraph(workflow.graph));\n const [issues, setIssues] = useState<SubWorkflowGraphIssue[]>(workflow.graph.issues);\n const [dirty, setDirty] = useState(false);\n const [selectedNodeId, setSelectedNodeId] = useState<string | null>(null);\n const [selectedEdgeId, setSelectedEdgeId] = useState<string | null>(null);\n const [notice, setNotice] = useState<{ tone: 'error' | 'success'; text: string } | null>(null);\n const [placeholderSeq, setPlaceholderSeq] = useState(1);\n\n const readOnly = workflow.status === 'ACTIVE';\n // Editing pauses while a save is in flight: the response replaces the local\n // graph (placeholder ids become server ids), so an edit made in the meantime\n // would otherwise be overwritten and reported as saved.\n const editLocked = readOnly || save.isPending;\n\n // A refetch after save/activate/pause brings a fresh server graph; adopt it\n // unless the user has local edits in flight. Compared during render (the\n // \"store the previous prop\" pattern) so no effect has to mirror props into state.\n const [seenGraph, setSeenGraph] = useState(workflow.graph);\n if (seenGraph !== workflow.graph) {\n setSeenGraph(workflow.graph);\n if (!dirty) {\n setGraph(fromServerGraph(workflow.graph));\n setIssues(workflow.graph.issues);\n }\n }\n\n const issueNodeIds = useMemo(\n () => new Set(issues.map((i) => i.nodeId).filter((id): id is string => Boolean(id))),\n [issues]\n );\n\n const rfNodes: CanvasNode[] = useMemo(\n () =>\n graph.nodes.map((n) => ({\n id: n.id,\n type: 'workflow',\n position: { x: n.x, y: n.y },\n selected: n.id === selectedNodeId,\n data: {\n kind: n.kind,\n label:\n n.label ||\n tr(`workflowBuilder.nodeLabel.${n.kind.toLowerCase()}`, defaultLabel(n.kind)),\n summary: configSummary(n, tr),\n hasIssue: !dirty && issueNodeIds.has(n.id),\n },\n })),\n [graph.nodes, selectedNodeId, dirty, issueNodeIds, tr]\n );\n\n const rfEdges: Edge[] = useMemo(\n () =>\n graph.edges.map((e) => ({\n id: e.id,\n source: e.source,\n target: e.target,\n sourceHandle: e.handle,\n selected: e.id === selectedEdgeId,\n label:\n e.handle === 'true'\n ? tr('workflows.builder.yes', 'Yes')\n : e.handle === 'false'\n ? tr('workflows.builder.no', 'No')\n : undefined,\n markerEnd: { type: MarkerType.ArrowClosed, color: 'var(--color-text-secondary)' },\n style: {\n stroke:\n e.id === selectedEdgeId ? 'var(--color-focus-ring)' : 'var(--color-text-secondary)',\n strokeWidth: 2,\n },\n })),\n [graph.edges, selectedEdgeId, tr]\n );\n\n const edit = useCallback((next: (g: BuilderGraph) => BuilderGraph) => {\n setGraph((g) => next(g));\n setDirty(true);\n setNotice(null);\n }, []);\n\n const onNodesChange = useCallback(\n (changes: NodeChange<CanvasNode>[]) => {\n const moves = changes.filter((c) => c.type === 'position' && c.position);\n const removals = changes.filter((c) => c.type === 'remove');\n if (editLocked || (moves.length === 0 && removals.length === 0)) return;\n edit((g) => {\n const moved = applyNodeChanges(\n moves,\n g.nodes.map((n) => ({ id: n.id, position: { x: n.x, y: n.y }, data: {} }))\n );\n let next: BuilderGraph = {\n nodes: g.nodes.map((n) => {\n const m = moved.find((x) => x.id === n.id);\n return m ? { ...n, x: m.position.x, y: m.position.y } : n;\n }),\n edges: g.edges,\n };\n for (const r of removals) if (r.type === 'remove') next = removeNode(next, r.id);\n return next;\n });\n },\n [edit, editLocked]\n );\n\n const onEdgesChange = useCallback(\n (changes: EdgeChange[]) => {\n const removed = new Set(changes.filter((c) => c.type === 'remove').map((c) => c.id));\n if (editLocked || removed.size === 0) return;\n edit((g) => ({ nodes: g.nodes, edges: g.edges.filter((e) => !removed.has(e.id)) }));\n },\n [edit, editLocked]\n );\n\n const onConnect = useCallback(\n (c: Connection) => {\n if (editLocked) return;\n const handle = c.sourceHandle ?? null;\n const reason = connectionError(graph, c.source, c.target, handle, tr);\n if (reason) {\n setNotice({ tone: 'error', text: reason });\n return;\n }\n edit((g) => ({\n nodes: g.nodes,\n edges: [\n ...g.edges,\n {\n id: `edge-${c.source}-${handle ?? 'out'}-${c.target}`,\n source: c.source,\n target: c.target,\n handle,\n label: null,\n },\n ],\n }));\n },\n [edit, graph, editLocked, tr]\n );\n\n const addNode = (kind: SubWorkflowNodeKind) => {\n const id = `new-${placeholderSeq}`;\n setPlaceholderSeq((s) => s + 1);\n const pos = nextNodePosition(graph.nodes);\n edit((g) => ({\n nodes: [\n ...g.nodes,\n {\n id,\n kind,\n label: tr(`workflowBuilder.nodeLabel.${kind.toLowerCase()}`, defaultLabel(kind)),\n config: initialConfig(kind),\n x: pos.x,\n y: pos.y,\n },\n ],\n edges: g.edges,\n }));\n setSelectedNodeId(id);\n setSelectedEdgeId(null);\n };\n\n const selectedNode = graph.nodes.find((n) => n.id === selectedNodeId) ?? null;\n\n const handleSave = () => {\n save.mutate(\n { workflowId: workflow.id, input: toSaveInput(graph) },\n {\n onSuccess: (saved) => {\n setGraph(fromServerGraph(saved));\n setIssues(saved.issues);\n setDirty(false);\n setSelectedNodeId(null);\n setSelectedEdgeId(null);\n setNotice({\n tone: 'success',\n text: saved.valid\n ? tr('workflows.builder.savedValid', 'Saved. This workflow is ready to activate.')\n : tr(\n 'workflows.builder.savedWithIssues',\n 'Saved as a draft. Fix the issues below before activating.'\n ),\n });\n },\n onError: (err) =>\n setNotice({\n tone: 'error',\n text: err instanceof Error ? err.message : tr('common.error', 'An error occurred'),\n }),\n }\n );\n };\n\n const handleActivate = () =>\n activate.mutate(workflow.id, {\n onSuccess: () =>\n setNotice({\n tone: 'success',\n text: tr('workflows.builder.activated', 'Workflow activated.'),\n }),\n onError: (err) =>\n setNotice({\n tone: 'error',\n text: err instanceof Error ? err.message : tr('common.error', 'An error occurred'),\n }),\n });\n\n const handlePause = () =>\n pause.mutate(workflow.id, {\n onSuccess: () =>\n setNotice({\n tone: 'success',\n text: tr('workflows.builder.paused', 'Workflow paused. You can edit it now.'),\n }),\n onError: (err) =>\n setNotice({\n tone: 'error',\n text: err instanceof Error ? err.message : tr('common.error', 'An error occurred'),\n }),\n });\n\n const canActivate = !readOnly && !dirty && issues.length === 0 && graph.nodes.length > 0;\n\n return (\n <>\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={workflow.status} />\n {dirty && (\n <span className=\"rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\">\n {tr('workflows.builder.unsaved', 'Unsaved changes')}\n </span>\n )}\n {!dirty && issues.length === 0 && graph.nodes.length > 0 && (\n <span className=\"inline-flex items-center gap-1 text-xs text-status-success-text\">\n <CheckCircle2 className=\"h-3.5 w-3.5\" />{' '}\n {tr('workflows.builder.valid', 'Ready to run')}\n </span>\n )}\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n {readOnly ? (\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={handlePause}\n disabled={pause.isPending}\n >\n <Pause className=\"h-4 w-4\" /> {tr('workflows.builder.pauseToEdit', 'Pause to edit')}\n </button>\n ) : (\n <>\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={handleSave}\n disabled={!dirty || save.isPending}\n >\n <Save className=\"h-4 w-4\" />{' '}\n {save.isPending\n ? tr('workflows.builder.saving', 'Saving…')\n : tr('workflows.builder.save', 'Save')}\n </button>\n <button\n type=\"button\"\n className={primaryBtn}\n onClick={handleActivate}\n disabled={!canActivate || activate.isPending}\n title={\n dirty\n ? tr('workflows.builder.saveFirst', 'Save your changes first')\n : issues.length > 0\n ? tr('workflows.builder.fixIssuesFirst', 'Fix the issues first')\n : undefined\n }\n >\n <Play className=\"h-4 w-4\" />{' '}\n {activate.isPending\n ? tr('common.activating', 'Activating…')\n : tr('workflows.flow.activate', 'Activate workflow')}\n </button>\n </>\n )}\n </div>\n </div>\n\n {notice && (\n <div\n role={notice.tone === 'error' ? 'alert' : 'status'}\n className={`mt-3 rounded-lg border px-4 py-2 text-sm ${\n notice.tone === 'error'\n ? 'border-status-error-text/30 bg-status-error-bg-subtle text-status-error-text'\n : 'border-status-success-text/30 bg-status-success-bg-subtle text-status-success-text'\n }`}\n >\n {notice.text}\n </div>\n )}\n {readOnly && (\n <p className=\"mt-3 text-sm text-text-secondary\">\n {tr(\n 'workflows.builder.readOnlyActive',\n 'This workflow is active, so it is shown read-only. Pause it to change its steps.'\n )}\n </p>\n )}\n\n <div className=\"mt-4 grid grid-cols-1 gap-4 lg:grid-cols-[13rem_minmax(0,1fr)_18rem]\">\n {/* Palette */}\n <GlassCard treatment=\"metric\" className=\"p-3\">\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr('workflows.builder.palette', 'Add a step')}\n </p>\n <div\n className=\"grid grid-cols-2 gap-2 lg:grid-cols-1\"\n role=\"group\"\n aria-label={tr('workflows.builder.palette', 'Add a step')}\n >\n {NODE_KINDS.map((kind) => {\n const meta = KIND_META[kind];\n const Icon = meta.icon;\n const disabled = editLocked || !canAddKind(kind, graph.nodes);\n return (\n <button\n key={kind}\n type=\"button\"\n disabled={disabled}\n onClick={() => addNode(kind)}\n title={tr(`${meta.labelKey}Hint`, meta.hint)}\n className=\"flex items-center gap-2 rounded-lg border border-border-subtle bg-bg-surface px-2.5 py-2 text-start text-sm text-text-primary hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-50\"\n >\n <Icon className=\"h-4 w-4 shrink-0 text-text-secondary\" />\n <span className=\"truncate\">{tr(meta.labelKey, meta.fallback)}</span>\n </button>\n );\n })}\n </div>\n </GlassCard>\n\n {/* Canvas */}\n <div\n className=\"h-[60vh] min-h-[420px] overflow-hidden rounded-xl border border-border-subtle bg-bg-sunken\"\n data-testid=\"workflow-canvas\"\n >\n {graph.nodes.length === 0 ? (\n <div className=\"flex h-full items-center justify-center p-6\">\n <EmptyState\n icon={<Zap className=\"h-10 w-10\" />}\n title={tr('workflows.builder.emptyTitle', 'Start with a trigger')}\n description={tr(\n 'workflows.builder.emptyDescription',\n 'Add a trigger from the palette, then connect the steps that should follow it.'\n )}\n />\n </div>\n ) : (\n <ReactFlow\n nodes={rfNodes}\n edges={rfEdges}\n nodeTypes={nodeTypes}\n onNodesChange={onNodesChange}\n onEdgesChange={onEdgesChange}\n onConnect={onConnect}\n onNodeClick={(_e, n) => {\n setSelectedNodeId(n.id);\n setSelectedEdgeId(null);\n }}\n onEdgeClick={(_e, e) => {\n setSelectedEdgeId(e.id);\n setSelectedNodeId(null);\n }}\n onPaneClick={() => {\n setSelectedNodeId(null);\n setSelectedEdgeId(null);\n }}\n nodesDraggable={!editLocked}\n nodesConnectable={!editLocked}\n deleteKeyCode={editLocked ? null : ['Backspace', 'Delete']}\n fitView\n fitViewOptions={{ padding: 0.2, maxZoom: 1.1 }}\n proOptions={{ hideAttribution: true }}\n >\n <Background color=\"var(--color-border-subtle)\" gap={20} />\n <Controls showInteractive={false} className={controlsCls} />\n </ReactFlow>\n )}\n </div>\n\n {/* Inspector + issues */}\n <div className=\"space-y-4\">\n <GlassCard treatment=\"metric\" className=\"p-4\">\n {selectedNode ? (\n <NodeInspector\n node={selectedNode}\n readOnly={editLocked}\n onChange={(patch) =>\n edit((g) => ({\n nodes: g.nodes.map((n) => (n.id === selectedNode.id ? { ...n, ...patch } : n)),\n edges: g.edges,\n }))\n }\n onDelete={() => {\n edit((g) => removeNode(g, selectedNode.id));\n setSelectedNodeId(null);\n }}\n />\n ) : selectedEdgeId && !editLocked ? (\n <div className=\"space-y-3\">\n <p className=\"text-sm text-text-primary\">\n {tr('workflows.builder.edgeSelected', 'Connection selected')}\n </p>\n <button\n type=\"button\"\n onClick={() => {\n edit((g) => ({\n nodes: g.nodes,\n edges: g.edges.filter((e) => e.id !== selectedEdgeId),\n }));\n setSelectedEdgeId(null);\n }}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-status-error-text/40 px-3 py-1.5 text-xs font-medium text-status-error-text hover:bg-status-error-bg-subtle\"\n >\n <Trash2 className=\"h-3.5 w-3.5\" />{' '}\n {tr('workflows.builder.deleteEdge', 'Delete connection')}\n </button>\n </div>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'workflows.builder.inspectorEmpty',\n 'Select a node to edit it. Drag from a node’s right edge to another node to connect them.'\n )}\n </p>\n )}\n </GlassCard>\n\n <GlassCard treatment=\"metric\" className=\"p-4\" data-testid=\"workflow-issues\">\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr('workflows.builder.issues', 'Validation')}\n </p>\n {dirty ? (\n <p className=\"text-sm text-text-secondary\">\n {tr('workflows.builder.issuesAfterSave', 'Save to check the workflow.')}\n </p>\n ) : issues.length === 0 ? (\n <p className=\"inline-flex items-center gap-1.5 text-sm text-status-success-text\">\n <CheckCircle2 className=\"h-4 w-4\" />{' '}\n {tr('workflows.builder.noIssues', 'No issues found')}\n </p>\n ) : (\n <ul className=\"space-y-2\">\n {issues.map((issue, i) => (\n <li key={`${issue.code}-${issue.nodeId ?? issue.edgeId ?? i}`}>\n <button\n type=\"button\"\n className=\"flex w-full items-start gap-2 text-start text-sm text-text-primary hover:underline disabled:no-underline\"\n disabled={!issue.nodeId}\n onClick={() => issue.nodeId && setSelectedNodeId(issue.nodeId)}\n >\n <AlertTriangle className=\"mt-0.5 h-4 w-4 shrink-0 text-status-warning-text\" />\n <span>{issue.message}</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n </GlassCard>\n </div>\n </div>\n </>\n );\n}\n\nexport function WorkflowBuilderPage() {\n const { id } = useParams<{ id: string }>();\n const tr = useTr();\n const { navigateTo } = useSubscriberBot();\n const { data, isLoading, isError, refetch } = useWorkflow(id);\n\n return (\n <PageLayout\n title={data?.name ?? tr('workflows.builder.title', 'Workflow builder')}\n description={\n data\n ? tr('workflows.builder.subtitle', 'Visual builder · starts on {{trigger}}', {\n trigger: data.triggerEvent || '—',\n })\n : undefined\n }\n actions={\n <button\n type=\"button\"\n className={secondaryBtn}\n onClick={() => navigateTo(id ? `/workflows/${id}` : '/workflows')}\n >\n <ArrowLeft className=\"rtl:rotate-180 h-4 w-4\" />{' '}\n {tr('workflows.builder.back', 'Workflows')}\n </button>\n }\n >\n {isLoading ? (\n <LoadingView label={tr('workflows.builder.loading', 'Loading workflow…')} />\n ) : isError ? (\n <ErrorView\n message={tr('workflows.builder.error', 'Could not load this workflow.')}\n onRetry={() => void refetch()}\n />\n ) : !data ? (\n <EmptyState\n title={tr('workflows.builder.notFound', 'Workflow not found')}\n description={tr(\n 'workflows.builder.notFoundDescription',\n 'It may have been deleted, or it belongs to another workspace.'\n )}\n />\n ) : (\n // Keyed by workflow id so moving to another workflow starts a fresh\n // editor instead of carrying the previous workflow's unsaved graph.\n <WorkflowBuilder key={data.id} workflow={data} />\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiFA,IAAMI,IACJ,4NACIC,IAAW,sDACXC,IACJ,kKACIC,IACJ,gKAEIC,IASF;CACF,SAAS;EACP,MAAMC;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,QAAQ;EACN,MAAMC;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,WAAW;EACT,MAAMC;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,OAAO;EACL,MAAMC;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;CACA,QAAQ;EACN,MAAMC;EACN,KAAK;EACL,UAAU;EACV,UAAU;EACV,MAAM;CACR;AACF,GAEMC,IAAuD;CAC3D,QAAQ;CACR,OAAO;CACP,aAAa;CACb,qBAAqB;CACrB,UAAU;CACV,mBAAmB;CACnB,cAAc;AAChB,GAMMC,IAAc,sZASdC,IAAc;CAAE,YAAY;CAA+B,OAAO;CAAI,QAAQ;AAAG;AAWvF,SAASC,EAAiB,EAAE,SAAM,eAAmC;CACnE,IAAMC,IAAKC,EAAM,GACXC,IAAOZ,EAAUa,EAAK,OACtBC,IAAOF,EAAK;CAClB,OACE,kBAAC,OAAD;EACE,eAAa,iBAAiBC,EAAK,KAAK,YAAY;EACpD,WAAW,kEACTE,IACI,2EACAF,EAAK,WACH,+BACA;EAPV,UAAA;GAUGA,EAAK,SAAS,aACb,kBAACG,GAAD;IAAQ,MAAK;IAAS,UAAUC,EAAS;IAAM,OAAOT;GAAc,CAAA;GAEtE,kBAAC,OAAD;IAAK,WAAW,cAAcI,EAAK;IAAO,eAAA;GAAa,CAAA;GACvD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,kBAAC,O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;;EAGT,UAAAiH,IACC,kBAACC,GAAD,EAAa,OAAOlH,EAAG,6BAA6B,mBAAmB,EAAI,CAAA,IACzEmH,IACF,kBAACC,GAAD;GACE,SAASpH,EAAG,2BAA2B,+BAA+B;GACtE,eAAe,KAAKqH,EAAQ;EAC7B,CAAA,IACElH,IAWH,kBAACkB,GAAD,EAA+B,UAAUlB,EAAO,GAA1BA,EAAK,EAAqB,IAVhD,kBAACpB,GAAD;GACE,OAAOiB,EAAG,8BAA8B,oBAAoB;GAC5D,aAAaA,EACX,yCACA,+DACF;EACD,CAAA;CAMO,CAAA;AAEhB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SubSaveWorkflowGraphInput, SubWorkflowGraph, SubWorkflowNodeConfig, SubWorkflowNodeKind } from '../../types';
|
|
2
|
-
|
|
3
2
|
/** One node in the builder's local (unsaved) state. */
|
|
4
3
|
export interface BuilderNode {
|
|
5
4
|
/** The server id, or a `new-N` placeholder until the first save. */
|
|
@@ -59,4 +58,3 @@ export declare function configSummary(node: Pick<BuilderNode, 'kind' | 'config'>
|
|
|
59
58
|
/** 90 → "1 h 30 min", 2880 → "2 d". */
|
|
60
59
|
export declare function formatDuration(minutes: number, tr?: Translate): string;
|
|
61
60
|
export {};
|
|
62
|
-
//# sourceMappingURL=workflowBuilderGraph.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/subscriberbot/pages/workflows/workflowBuilderGraph.ts
|
|
2
2
|
var e = [
|
|
3
3
|
"TRIGGER",
|
|
4
4
|
"ACTION",
|
|
@@ -117,7 +117,6 @@ function m(e, t = u) {
|
|
|
117
117
|
i ? t("workflowBuilder.duration.minutes", "{{count}} min", { count: i }) : ""
|
|
118
118
|
].filter(Boolean).join(" ") || t("workflowBuilder.duration.minutes", "{{count}} min", { count: 0 });
|
|
119
119
|
}
|
|
120
|
-
|
|
121
|
-
export { t as ACTION_KINDS, e as NODE_KINDS, c as canAddKind, p as configSummary, d as connectionError, i as defaultLabel, a as fromServerGraph, l as initialConfig, s as nextNodePosition, f as removeNode, o as toSaveInput };
|
|
120
|
+
export { t as ACTION_KINDS, n as CONDITION_HANDLES, e as NODE_KINDS, c as canAddKind, p as configSummary, d as connectionError, i as defaultLabel, m as formatDuration, a as fromServerGraph, l as initialConfig, s as nextNodePosition, f as removeNode, o as toSaveInput };
|
|
122
121
|
|
|
123
122
|
//# sourceMappingURL=workflowBuilderGraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflowBuilderGraph.js","names":[],"sources":["../../../../src/subscriberbot/pages/workflows/workflowBuilderGraph.ts"],"sourcesContent":["/**\n * Workflow builder graph helpers (BOFF-4006).\n * @module subscriberbot/pages/workflows\n *\n * Pure conversions between the svc's workflow graph (`SubWorkflowGraph`) and\n * the canvas model, plus the connection rules the canvas enforces while the\n * user draws. The rules mirror `workflow-graph.validation.ts` in\n * wspace-subscriberbot-svc, which stays the authority: anything the canvas\n * lets through is checked again on save.\n */\n\nimport type {\n SubSaveWorkflowGraphInput,\n SubWorkflowGraph,\n SubWorkflowNodeConfig,\n SubWorkflowNodeKind,\n} from '../../types';\n\n/** One node in the builder's local (unsaved) state. */\nexport interface BuilderNode {\n /** The server id, or a `new-N` placeholder until the first save. */\n id: string;\n kind: SubWorkflowNodeKind;\n label: string;\n config: SubWorkflowNodeConfig;\n x: number;\n y: number;\n}\n\n/** One edge in the builder's local state. */\nexport interface BuilderEdge {\n id: string;\n source: string;\n target: string;\n /** \"true\" / \"false\" for a condition outlet, null otherwise. */\n handle: string | null;\n /**\n * The edge's label as stored on the server. The builder does not edit it,\n * but carries it through so a whole-graph save never clears it.\n */\n label: string | null;\n}\n\nexport interface BuilderGraph {\n nodes: BuilderNode[];\n edges: BuilderEdge[];\n}\n\nexport const NODE_KINDS: readonly SubWorkflowNodeKind[] = [\n 'TRIGGER',\n 'ACTION',\n 'CONDITION',\n 'DELAY',\n 'BRANCH',\n];\n\nexport const ACTION_KINDS = [\n 'NOTIFY',\n 'ALERT',\n 'CREATE_TASK',\n 'UPDATE_RELATIONSHIP',\n 'CLASSIFY',\n 'EVALUATE_POLICIES',\n 'CALL_ADAPTER',\n] as const;\n\nexport const CONDITION_HANDLES = ['true', 'false'] as const;\n\n/** Horizontal spacing between columns of nodes on the canvas. */\nexport const COLUMN_WIDTH = 280;\n\nconst DEFAULT_LABELS: Record<SubWorkflowNodeKind, string> = {\n TRIGGER: 'When',\n ACTION: 'Action',\n CONDITION: 'If',\n DELAY: 'Wait',\n BRANCH: 'Branch',\n};\n\nexport function defaultLabel(kind: SubWorkflowNodeKind): string {\n return DEFAULT_LABELS[kind];\n}\n\n/** Server graph → local builder state. */\nexport function fromServerGraph(graph: SubWorkflowGraph): BuilderGraph {\n return {\n nodes: graph.nodes.map((n) => ({\n id: n.id,\n kind: n.kind,\n label: n.label,\n config: n.config ?? {},\n x: n.positionX,\n y: n.positionY,\n })),\n edges: graph.edges.map((e) => ({\n id: e.id,\n source: e.sourceNodeId,\n target: e.targetNodeId,\n handle: e.sourceHandle,\n label: e.label ?? null,\n })),\n };\n}\n\n/** Local builder state → the `subSaveWorkflowGraph` input. */\nexport function toSaveInput(graph: BuilderGraph): SubSaveWorkflowGraphInput {\n return {\n nodes: graph.nodes.map((n) => ({\n id: n.id,\n kind: n.kind,\n label: n.label.trim() || defaultLabel(n.kind),\n config: n.config,\n positionX: Math.round(n.x),\n positionY: Math.round(n.y),\n })),\n edges: graph.edges.map((e) => ({\n sourceNodeId: e.source,\n targetNodeId: e.target,\n sourceHandle: e.handle,\n label: e.label,\n })),\n };\n}\n\n/** Where a node added from the palette lands: one column right of the rightmost node. */\nexport function nextNodePosition(nodes: readonly BuilderNode[]): { x: number; y: number } {\n if (nodes.length === 0) return { x: 0, y: 0 };\n const maxX = Math.max(...nodes.map((n) => n.x));\n const inLastColumn = nodes.filter((n) => n.x === maxX).length;\n return { x: maxX + COLUMN_WIDTH, y: inLastColumn > 1 ? inLastColumn * 60 : 0 };\n}\n\n/** The palette only offers a trigger when the workflow has none. */\nexport function canAddKind(kind: SubWorkflowNodeKind, nodes: readonly BuilderNode[]): boolean {\n return kind !== 'TRIGGER' || !nodes.some((n) => n.kind === 'TRIGGER');\n}\n\n/** Initial configuration for a node added from the palette. */\nexport function initialConfig(kind: SubWorkflowNodeKind): SubWorkflowNodeConfig {\n switch (kind) {\n case 'ACTION':\n return { action: 'NOTIFY' };\n case 'DELAY':\n return { durationMinutes: 1440 };\n default:\n return {};\n }\n}\n\n/**\n * Why a new connection would be refused, or null when it is allowed. Mirrors\n * `assertEdgeAllowed` in the svc.\n */\ntype Translate = (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string;\nconst fallbackText: Translate = (_key, fallback, params) =>\n fallback.replace(/\\{\\{([^{}]+)\\}\\}/g, (match, key: string) =>\n params && Object.hasOwn(params, key) ? String(params[key]) : match\n );\n\nexport function connectionError(\n graph: BuilderGraph,\n source: string,\n target: string,\n handle: string | null,\n tr: Translate = fallbackText\n): string | null {\n const from = graph.nodes.find((n) => n.id === source);\n const to = graph.nodes.find((n) => n.id === target);\n if (!from || !to)\n return tr(\n 'workflowBuilder.connection.bothEnds',\n 'Both ends of a connection must be nodes of this workflow'\n );\n if (from.id === to.id)\n return tr('workflowBuilder.connection.selfConnection', 'A node cannot connect to itself');\n if (to.kind === 'TRIGGER')\n return tr(\n 'workflowBuilder.connection.triggerTarget',\n 'Nothing can connect into the trigger; it always starts the workflow'\n );\n if (from.kind === 'CONDITION') {\n if (!handle || !(CONDITION_HANDLES as readonly string[]).includes(handle)) {\n return tr(\n 'workflowBuilder.connection.conditionOutlet',\n 'A condition connects through its \"true\" or \"false\" outlet'\n );\n }\n if (graph.edges.some((e) => e.source === from.id && e.handle === handle)) {\n return tr(\n 'workflowBuilder.connection.occupiedOutlet',\n 'This condition\\'s \"{{handle}}\" outlet is already connected',\n { handle }\n );\n }\n } else if (handle) {\n return tr('workflowBuilder.connection.namedOutlet', 'Only a condition has named outlets');\n }\n if (graph.edges.some((e) => e.source === source && e.target === target)) {\n return tr('workflowBuilder.connection.duplicate', 'These nodes are already connected');\n }\n return null;\n}\n\n/** Remove a node and every edge touching it. */\nexport function removeNode(graph: BuilderGraph, nodeId: string): BuilderGraph {\n return {\n nodes: graph.nodes.filter((n) => n.id !== nodeId),\n edges: graph.edges.filter((e) => e.source !== nodeId && e.target !== nodeId),\n };\n}\n\n/** A short human summary of a node's configuration for the canvas card. */\nexport function configSummary(\n node: Pick<BuilderNode, 'kind' | 'config'>,\n tr: Translate = fallbackText\n): string {\n const c = node.config;\n switch (node.kind) {\n case 'TRIGGER':\n return typeof c.event === 'string' && c.event\n ? c.event\n : tr('workflowBuilder.summary.noEvent', 'No event chosen');\n case 'ACTION':\n return typeof c.action === 'string' && c.action\n ? c.action.replace(/_/g, ' ').toLowerCase()\n : tr('workflowBuilder.summary.noAction', 'No action chosen');\n case 'CONDITION':\n return typeof c.expression === 'string' && c.expression\n ? c.expression\n : tr('workflowBuilder.summary.noCondition', 'No condition');\n case 'DELAY':\n return typeof c.durationMinutes === 'number'\n ? formatDuration(c.durationMinutes, tr)\n : tr('workflowBuilder.summary.noDuration', 'No duration');\n case 'BRANCH':\n return tr('workflowBuilder.summary.parallel', 'Runs paths in parallel');\n }\n}\n\n/** 90 → \"1 h 30 min\", 2880 → \"2 d\". */\nexport function formatDuration(minutes: number, tr: Translate = fallbackText): string {\n const days = Math.floor(minutes / 1440);\n const hours = Math.floor((minutes % 1440) / 60);\n const mins = minutes % 60;\n const parts = [\n days ? tr('workflowBuilder.duration.days', '{{count}} d', { count: days }) : '',\n hours ? tr('workflowBuilder.duration.hours', '{{count}} h', { count: hours }) : '',\n mins ? tr('workflowBuilder.duration.minutes', '{{count}} min', { count: mins }) : '',\n ];\n return (\n parts.filter(Boolean).join(' ') ||\n tr('workflowBuilder.duration.minutes', '{{count}} min', { count: 0 })\n );\n}\n"],"mappings":";AAgDA,IAAa,IAA6C;CACxD;CACA;CACA;CACA;CACA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_KINDS","CONDITION_HANDLES","DEFAULT_LABELS","defaultLabel","kind","fromServerGraph","graph","n","toSaveInput","nextNodePosition","nodes","maxX","inLastColumn","canAddKind","initialConfig","fallbackText","fallback","params","key","match","connectionError","from","source","to","target","tr","handle","removeNode","nodeId","configSummary","c","node","formatDuration","days","minutes","hours","mins"],"sources":["../../../../src/subscriberbot/pages/workflows/workflowBuilderGraph.ts"],"sourcesContent":["/**\n * Workflow builder graph helpers (BOFF-4006).\n * @module subscriberbot/pages/workflows\n *\n * Pure conversions between the svc's workflow graph (`SubWorkflowGraph`) and\n * the canvas model, plus the connection rules the canvas enforces while the\n * user draws. The rules mirror `workflow-graph.validation.ts` in\n * wspace-subscriberbot-svc, which stays the authority: anything the canvas\n * lets through is checked again on save.\n */\n\nimport type {\n SubSaveWorkflowGraphInput,\n SubWorkflowGraph,\n SubWorkflowNodeConfig,\n SubWorkflowNodeKind,\n} from '../../types';\n\n/** One node in the builder's local (unsaved) state. */\nexport interface BuilderNode {\n /** The server id, or a `new-N` placeholder until the first save. */\n id: string;\n kind: SubWorkflowNodeKind;\n label: string;\n config: SubWorkflowNodeConfig;\n x: number;\n y: number;\n}\n\n/** One edge in the builder's local state. */\nexport interface BuilderEdge {\n id: string;\n source: string;\n target: string;\n /** \"true\" / \"false\" for a condition outlet, null otherwise. */\n handle: string | null;\n /**\n * The edge's label as stored on the server. The builder does not edit it,\n * but carries it through so a whole-graph save never clears it.\n */\n label: string | null;\n}\n\nexport interface BuilderGraph {\n nodes: BuilderNode[];\n edges: BuilderEdge[];\n}\n\nexport const NODE_KINDS: readonly SubWorkflowNodeKind[] = [\n 'TRIGGER',\n 'ACTION',\n 'CONDITION',\n 'DELAY',\n 'BRANCH',\n];\n\nexport const ACTION_KINDS = [\n 'NOTIFY',\n 'ALERT',\n 'CREATE_TASK',\n 'UPDATE_RELATIONSHIP',\n 'CLASSIFY',\n 'EVALUATE_POLICIES',\n 'CALL_ADAPTER',\n] as const;\n\nexport const CONDITION_HANDLES = ['true', 'false'] as const;\n\n/** Horizontal spacing between columns of nodes on the canvas. */\nexport const COLUMN_WIDTH = 280;\n\nconst DEFAULT_LABELS: Record<SubWorkflowNodeKind, string> = {\n TRIGGER: 'When',\n ACTION: 'Action',\n CONDITION: 'If',\n DELAY: 'Wait',\n BRANCH: 'Branch',\n};\n\nexport function defaultLabel(kind: SubWorkflowNodeKind): string {\n return DEFAULT_LABELS[kind];\n}\n\n/** Server graph → local builder state. */\nexport function fromServerGraph(graph: SubWorkflowGraph): BuilderGraph {\n return {\n nodes: graph.nodes.map((n) => ({\n id: n.id,\n kind: n.kind,\n label: n.label,\n config: n.config ?? {},\n x: n.positionX,\n y: n.positionY,\n })),\n edges: graph.edges.map((e) => ({\n id: e.id,\n source: e.sourceNodeId,\n target: e.targetNodeId,\n handle: e.sourceHandle,\n label: e.label ?? null,\n })),\n };\n}\n\n/** Local builder state → the `subSaveWorkflowGraph` input. */\nexport function toSaveInput(graph: BuilderGraph): SubSaveWorkflowGraphInput {\n return {\n nodes: graph.nodes.map((n) => ({\n id: n.id,\n kind: n.kind,\n label: n.label.trim() || defaultLabel(n.kind),\n config: n.config,\n positionX: Math.round(n.x),\n positionY: Math.round(n.y),\n })),\n edges: graph.edges.map((e) => ({\n sourceNodeId: e.source,\n targetNodeId: e.target,\n sourceHandle: e.handle,\n label: e.label,\n })),\n };\n}\n\n/** Where a node added from the palette lands: one column right of the rightmost node. */\nexport function nextNodePosition(nodes: readonly BuilderNode[]): { x: number; y: number } {\n if (nodes.length === 0) return { x: 0, y: 0 };\n const maxX = Math.max(...nodes.map((n) => n.x));\n const inLastColumn = nodes.filter((n) => n.x === maxX).length;\n return { x: maxX + COLUMN_WIDTH, y: inLastColumn > 1 ? inLastColumn * 60 : 0 };\n}\n\n/** The palette only offers a trigger when the workflow has none. */\nexport function canAddKind(kind: SubWorkflowNodeKind, nodes: readonly BuilderNode[]): boolean {\n return kind !== 'TRIGGER' || !nodes.some((n) => n.kind === 'TRIGGER');\n}\n\n/** Initial configuration for a node added from the palette. */\nexport function initialConfig(kind: SubWorkflowNodeKind): SubWorkflowNodeConfig {\n switch (kind) {\n case 'ACTION':\n return { action: 'NOTIFY' };\n case 'DELAY':\n return { durationMinutes: 1440 };\n default:\n return {};\n }\n}\n\n/**\n * Why a new connection would be refused, or null when it is allowed. Mirrors\n * `assertEdgeAllowed` in the svc.\n */\ntype Translate = (\n key: string,\n fallback: string,\n params?: Record<string, string | number>\n) => string;\nconst fallbackText: Translate = (_key, fallback, params) =>\n fallback.replace(/\\{\\{([^{}]+)\\}\\}/g, (match, key: string) =>\n params && Object.hasOwn(params, key) ? String(params[key]) : match\n );\n\nexport function connectionError(\n graph: BuilderGraph,\n source: string,\n target: string,\n handle: string | null,\n tr: Translate = fallbackText\n): string | null {\n const from = graph.nodes.find((n) => n.id === source);\n const to = graph.nodes.find((n) => n.id === target);\n if (!from || !to)\n return tr(\n 'workflowBuilder.connection.bothEnds',\n 'Both ends of a connection must be nodes of this workflow'\n );\n if (from.id === to.id)\n return tr('workflowBuilder.connection.selfConnection', 'A node cannot connect to itself');\n if (to.kind === 'TRIGGER')\n return tr(\n 'workflowBuilder.connection.triggerTarget',\n 'Nothing can connect into the trigger; it always starts the workflow'\n );\n if (from.kind === 'CONDITION') {\n if (!handle || !(CONDITION_HANDLES as readonly string[]).includes(handle)) {\n return tr(\n 'workflowBuilder.connection.conditionOutlet',\n 'A condition connects through its \"true\" or \"false\" outlet'\n );\n }\n if (graph.edges.some((e) => e.source === from.id && e.handle === handle)) {\n return tr(\n 'workflowBuilder.connection.occupiedOutlet',\n 'This condition\\'s \"{{handle}}\" outlet is already connected',\n { handle }\n );\n }\n } else if (handle) {\n return tr('workflowBuilder.connection.namedOutlet', 'Only a condition has named outlets');\n }\n if (graph.edges.some((e) => e.source === source && e.target === target)) {\n return tr('workflowBuilder.connection.duplicate', 'These nodes are already connected');\n }\n return null;\n}\n\n/** Remove a node and every edge touching it. */\nexport function removeNode(graph: BuilderGraph, nodeId: string): BuilderGraph {\n return {\n nodes: graph.nodes.filter((n) => n.id !== nodeId),\n edges: graph.edges.filter((e) => e.source !== nodeId && e.target !== nodeId),\n };\n}\n\n/** A short human summary of a node's configuration for the canvas card. */\nexport function configSummary(\n node: Pick<BuilderNode, 'kind' | 'config'>,\n tr: Translate = fallbackText\n): string {\n const c = node.config;\n switch (node.kind) {\n case 'TRIGGER':\n return typeof c.event === 'string' && c.event\n ? c.event\n : tr('workflowBuilder.summary.noEvent', 'No event chosen');\n case 'ACTION':\n return typeof c.action === 'string' && c.action\n ? c.action.replace(/_/g, ' ').toLowerCase()\n : tr('workflowBuilder.summary.noAction', 'No action chosen');\n case 'CONDITION':\n return typeof c.expression === 'string' && c.expression\n ? c.expression\n : tr('workflowBuilder.summary.noCondition', 'No condition');\n case 'DELAY':\n return typeof c.durationMinutes === 'number'\n ? formatDuration(c.durationMinutes, tr)\n : tr('workflowBuilder.summary.noDuration', 'No duration');\n case 'BRANCH':\n return tr('workflowBuilder.summary.parallel', 'Runs paths in parallel');\n }\n}\n\n/** 90 → \"1 h 30 min\", 2880 → \"2 d\". */\nexport function formatDuration(minutes: number, tr: Translate = fallbackText): string {\n const days = Math.floor(minutes / 1440);\n const hours = Math.floor((minutes % 1440) / 60);\n const mins = minutes % 60;\n const parts = [\n days ? tr('workflowBuilder.duration.days', '{{count}} d', { count: days }) : '',\n hours ? tr('workflowBuilder.duration.hours', '{{count}} h', { count: hours }) : '',\n mins ? tr('workflowBuilder.duration.minutes', '{{count}} min', { count: mins }) : '',\n ];\n return (\n parts.filter(Boolean).join(' ') ||\n tr('workflowBuilder.duration.minutes', '{{count}} min', { count: 0 })\n );\n}\n"],"mappings":";AAgDA,IAAaA,IAA6C;CACxD;CACA;CACA;CACA;CACA;AACF,GAEaC,IAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEaC,IAAoB,CAAC,QAAQ,OAAO,GAK3CC,IAAsD;CAC1D,SAAS;CACT,QAAQ;CACR,WAAW;CACX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 @@
|
|
|
1
1
|
import { gatherPageContext as e } from "../utils/pageContext.js";
|
|
2
2
|
import { useSandboxAssistantTransport as t } from "@burdenoff/fe-libs/shared/assistant";
|
|
3
|
-
|
|
3
|
+
// src/subscriberbot/services/createSandboxAssistantTransport.ts
|
|
4
4
|
function n() {
|
|
5
5
|
return t({
|
|
6
6
|
product: "subscriberbot",
|
|
@@ -8,7 +8,6 @@ function n() {
|
|
|
8
8
|
enableCredits: !0
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { n as useSandboxAssistantTransport };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=createSandboxAssistantTransport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../../src/subscriberbot/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * subscriberbot adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\nimport { gatherPageContext } from '#subscriberbot/utils/pageContext';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'subscriberbot',\n gatherPageContext: gatherPageContext,\n enableCredits: true,\n });\n}\n"],"mappings":";;;AAyBA,
|
|
1
|
+
{"version":3,"file":"createSandboxAssistantTransport.js","names":["useSandboxAssistantTransport","useSharedTransport","useSandboxAssistantTransport$1","useSandboxAssistantTransport"],"sources":["../../../src/subscriberbot/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * subscriberbot adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\nimport { gatherPageContext } from '#subscriberbot/utils/pageContext';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'subscriberbot',\n gatherPageContext: gatherPageContext,\n enableCredits: true,\n });\n}\n"],"mappings":";;;AAyBA,SAAgBA,IAAmD;CACjE,OAAOC,EAAmB;EACxB,SAAS;EACU;EACnB,eAAe;CACjB,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { useSubscriberBotStore } from "./subscriberbotStore.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ViewMode } from '../types';
|
|
2
|
-
|
|
3
2
|
interface SubscriberBotState {
|
|
4
3
|
viewMode: ViewMode;
|
|
5
4
|
activeSection: string;
|
|
@@ -49,7 +48,7 @@ export declare const useSubscriberBotStore: import('zustand').UseBoundStore<Omit
|
|
|
49
48
|
persist: {
|
|
50
49
|
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<SubscriberBotState, unknown, unknown>>) => void;
|
|
51
50
|
clearStorage: () => void;
|
|
52
|
-
rehydrate: () => Promise<void
|
|
51
|
+
rehydrate: () => Promise<void>;
|
|
53
52
|
hasHydrated: () => boolean;
|
|
54
53
|
onHydrate: (fn: (state: SubscriberBotState) => void) => () => void;
|
|
55
54
|
onFinishHydration: (fn: (state: SubscriberBotState) => void) => () => void;
|
|
@@ -57,4 +56,3 @@ export declare const useSubscriberBotStore: import('zustand').UseBoundStore<Omit
|
|
|
57
56
|
};
|
|
58
57
|
}>;
|
|
59
58
|
export {};
|
|
60
|
-
//# sourceMappingURL=subscriberbotStore.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { create as e } from "zustand";
|
|
2
2
|
import { devtools as t, persist as n } from "zustand/middleware";
|
|
3
3
|
import { createProfileScopedStorage as r } from "@burdenoff/fe-libs/shared/utils";
|
|
4
|
-
|
|
4
|
+
// src/subscriberbot/store/subscriberbotStore.ts
|
|
5
5
|
var i = {
|
|
6
6
|
viewMode: "grid",
|
|
7
7
|
activeSection: "dashboard",
|
|
@@ -32,7 +32,6 @@ var i = {
|
|
|
32
32
|
name: "SubscriberBot Store",
|
|
33
33
|
enabled: !1
|
|
34
34
|
}));
|
|
35
|
-
//#endregion
|
|
36
35
|
export { a as useSubscriberBotStore };
|
|
37
36
|
|
|
38
37
|
//# sourceMappingURL=subscriberbotStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriberbotStore.js","names":[],"sources":["../../../src/subscriberbot/store/subscriberbotStore.ts"],"sourcesContent":["/**\n * SubscriberBot Zustand Store\n * @module subscriberbot/store\n */\n\nimport { create } from 'zustand';\nimport { devtools, persist } from 'zustand/middleware';\nimport { createProfileScopedStorage } from '@burdenoff/fe-libs/shared/utils';\nimport type { ViewMode } from '../types';\n\n// ============================================================================\n// State Interface\n// ============================================================================\n\ninterface SubscriberBotState {\n // View state\n viewMode: ViewMode;\n activeSection: string;\n sidebarCollapsed: boolean;\n\n // Search & filters\n searchQuery: string;\n categoryFilter: string;\n\n // Selected entities\n selectedCartId: string | null;\n selectedOrderId: string | null;\n\n // Actions\n setViewMode: (mode: ViewMode) => void;\n setActiveSection: (section: string) => void;\n setSearchQuery: (query: string) => void;\n setCategoryFilter: (category: string) => void;\n setSelectedCartId: (cartId: string | null) => void;\n setSelectedOrderId: (orderId: string | null) => void;\n toggleSidebar: () => void;\n reset: () => void;\n}\n\n// ============================================================================\n// Initial State\n// ============================================================================\n\nconst initialState = {\n viewMode: 'grid' as ViewMode,\n activeSection: 'dashboard',\n sidebarCollapsed: false,\n\n searchQuery: '',\n categoryFilter: '',\n\n selectedCartId: null,\n selectedOrderId: null,\n};\n\n// ============================================================================\n// Store\n// ============================================================================\n\nexport const useSubscriberBotStore = create<SubscriberBotState>()(\n devtools(\n persist(\n (set) => ({\n ...initialState,\n\n // View actions\n setViewMode: (mode) => set({ viewMode: mode }),\n setActiveSection: (section) => set({ activeSection: section }),\n toggleSidebar: () => set((state) => ({ sidebarCollapsed: !state.sidebarCollapsed })),\n\n // Search & filter actions\n setSearchQuery: (query) => set({ searchQuery: query }),\n setCategoryFilter: (category) => set({ categoryFilter: category }),\n\n // Selection actions\n setSelectedCartId: (cartId) => set({ selectedCartId: cartId }),\n setSelectedOrderId: (orderId) => set({ selectedOrderId: orderId }),\n\n // Reset\n reset: () => set(initialState),\n }),\n {\n name: 'burdenoff-subscriberbot-storage',\n storage: createProfileScopedStorage(),\n partialize: (state) => ({\n viewMode: state.viewMode,\n sidebarCollapsed: state.sidebarCollapsed,\n activeSection: state.activeSection,\n }),\n }\n ),\n { name: 'SubscriberBot Store', enabled: import.meta.env.DEV }\n )\n);\n"],"mappings":";;;;AA2CA,
|
|
1
|
+
{"version":3,"file":"subscriberbotStore.js","names":["initialState","useSubscriberBotStore","create","devtools","persist","set","mode","section","state","query","category","cartId","orderId","createProfileScopedStorage"],"sources":["../../../src/subscriberbot/store/subscriberbotStore.ts"],"sourcesContent":["/**\n * SubscriberBot Zustand Store\n * @module subscriberbot/store\n */\n\nimport { create } from 'zustand';\nimport { devtools, persist } from 'zustand/middleware';\nimport { createProfileScopedStorage } from '@burdenoff/fe-libs/shared/utils';\nimport type { ViewMode } from '../types';\n\n// ============================================================================\n// State Interface\n// ============================================================================\n\ninterface SubscriberBotState {\n // View state\n viewMode: ViewMode;\n activeSection: string;\n sidebarCollapsed: boolean;\n\n // Search & filters\n searchQuery: string;\n categoryFilter: string;\n\n // Selected entities\n selectedCartId: string | null;\n selectedOrderId: string | null;\n\n // Actions\n setViewMode: (mode: ViewMode) => void;\n setActiveSection: (section: string) => void;\n setSearchQuery: (query: string) => void;\n setCategoryFilter: (category: string) => void;\n setSelectedCartId: (cartId: string | null) => void;\n setSelectedOrderId: (orderId: string | null) => void;\n toggleSidebar: () => void;\n reset: () => void;\n}\n\n// ============================================================================\n// Initial State\n// ============================================================================\n\nconst initialState = {\n viewMode: 'grid' as ViewMode,\n activeSection: 'dashboard',\n sidebarCollapsed: false,\n\n searchQuery: '',\n categoryFilter: '',\n\n selectedCartId: null,\n selectedOrderId: null,\n};\n\n// ============================================================================\n// Store\n// ============================================================================\n\nexport const useSubscriberBotStore = create<SubscriberBotState>()(\n devtools(\n persist(\n (set) => ({\n ...initialState,\n\n // View actions\n setViewMode: (mode) => set({ viewMode: mode }),\n setActiveSection: (section) => set({ activeSection: section }),\n toggleSidebar: () => set((state) => ({ sidebarCollapsed: !state.sidebarCollapsed })),\n\n // Search & filter actions\n setSearchQuery: (query) => set({ searchQuery: query }),\n setCategoryFilter: (category) => set({ categoryFilter: category }),\n\n // Selection actions\n setSelectedCartId: (cartId) => set({ selectedCartId: cartId }),\n setSelectedOrderId: (orderId) => set({ selectedOrderId: orderId }),\n\n // Reset\n reset: () => set(initialState),\n }),\n {\n name: 'burdenoff-subscriberbot-storage',\n storage: createProfileScopedStorage(),\n partialize: (state) => ({\n viewMode: state.viewMode,\n sidebarCollapsed: state.sidebarCollapsed,\n activeSection: state.activeSection,\n }),\n }\n ),\n { name: 'SubscriberBot Store', enabled: import.meta.env.DEV }\n )\n);\n"],"mappings":";;;;AA2CA,IAAMA,IAAe;CACnB,UAAU;CACV,eAAe;CACf,kBAAkB;CAElB,aAAa;CACb,gBAAgB;CAEhB,gBAAgB;CAChB,iBAAiB;AACnB,GAMaC,IAAwBC,EAA2B,CAAC,CAC/DC,EACEC,GACG,OAAS;CACR,GAAGJ;CAGH,cAAc,MAASK,EAAI,EAAE,UAAUC,EAAK,CAAC;CAC7C,mBAAmB,MAAYD,EAAI,EAAE,eAAeE,EAAQ,CAAC;CAC7D,qBAAqBF,GAAK,OAAW,EAAE,kBAAkB,CAACG,EAAM,iBAAiB,EAAE;CAGnF,iBAAiB,MAAUH,EAAI,EAAE,aAAaI,EAAM,CAAC;CACrD,oBAAoB,MAAaJ,EAAI,EAAE,gBAAgBK,EAAS,CAAC;CAGjE,oBAAoB,MAAWL,EAAI,EAAE,gBAAgBM,EAAO,CAAC;CAC7D,qBAAqB,MAAYN,EAAI,EAAE,iBAAiBO,EAAQ,CAAC;CAGjE,aAAaP,EAAIL,CAAY;AAC/B,IACA;CACE,MAAM;CACN,SAASa,EAA2B;CACpC,aAAa,OAAW;EACtB,UAAUL,EAAM;EAChB,kBAAkBA,EAAM;EACxB,eAAeA,EAAM;CACvB;AACF,CACF,GACA;CAAE,MAAM;CAAuB,SAAA;AAA6B,CAC9D,CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AssistantUsecaseId } from '../config/assistantUsecases';
|
|
2
|
-
|
|
3
2
|
export type AssistantMode = AssistantUsecaseId;
|
|
4
3
|
export type AssistantSandboxStatus = 'none' | 'provisioning' | 'running' | 'stopping' | 'error';
|
|
5
4
|
export type AssistantConversationStatus = 'idle' | 'provisioning' | 'connecting' | 'streaming' | 'complete' | 'error';
|
|
@@ -54,4 +53,3 @@ export interface AssistantModeConfig {
|
|
|
54
53
|
suggestions: readonly string[];
|
|
55
54
|
}
|
|
56
55
|
export declare const ASSISTANT_MODES: AssistantModeConfig[];
|
|
57
|
-
//# sourceMappingURL=assistant.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SubBillingInterval } from './index';
|
|
2
|
-
|
|
3
2
|
export type SubBankAggregator = 'PLAID' | 'TRUELAYER' | 'ACCOUNT_AGGREGATOR' | 'STATEMENT_IMPORT';
|
|
4
3
|
/** How the browser runs an aggregator's flow (BOFF-10811). */
|
|
5
4
|
export type SubBankLinkMode = 'PLAID_LINK' | 'REDIRECT';
|
|
@@ -94,4 +93,3 @@ export interface SubCompleteBankLinkInput {
|
|
|
94
93
|
institutionId?: string | null;
|
|
95
94
|
institutionName?: string | null;
|
|
96
95
|
}
|
|
97
|
-
//# sourceMappingURL=banking.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Navigation item for shell integration
|
|
5
4
|
*/
|
|
@@ -1024,4 +1023,3 @@ export interface SubRenewalForecastArgs {
|
|
|
1024
1023
|
trialWindowDays?: number | null;
|
|
1025
1024
|
currency?: string | null;
|
|
1026
1025
|
}
|
|
1027
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SubBillingInterval } from './index';
|
|
2
|
-
|
|
3
2
|
export type SubNegotiationBillType = 'CABLE_TV' | 'INTERNET' | 'MOBILE_PHONE' | 'HOME_PHONE' | 'INSURANCE' | 'UTILITY' | 'SUBSCRIPTION' | 'OTHER';
|
|
4
3
|
export type SubNegotiationTarget = 'LOWER_PRICE' | 'REMOVE_FEES' | 'BETTER_PLAN_SAME_PRICE' | 'RETENTION_OFFER' | 'CANCEL_IF_NO_DEAL';
|
|
5
4
|
export type SubNegotiationMode = 'SELF_SERVE' | 'MANAGED';
|
|
@@ -98,4 +97,3 @@ export interface SubRecordNegotiationOutcomeInput {
|
|
|
98
97
|
summary?: string | null;
|
|
99
98
|
applyToRelationship?: boolean | null;
|
|
100
99
|
}
|
|
101
|
-
//# sourceMappingURL=negotiation.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SubBankAggregator } from '../types/banking';
|
|
2
|
-
|
|
3
2
|
export interface PendingBankLink {
|
|
4
3
|
aggregator: SubBankAggregator;
|
|
5
4
|
linkToken: string;
|
|
@@ -24,4 +23,3 @@ export declare function savePendingBankLink(pending: Omit<PendingBankLink, 'star
|
|
|
24
23
|
* the page was opened by one. Returns null when the URL carries no result.
|
|
25
24
|
*/
|
|
26
25
|
export declare function consumeBankRedirect(): BankRedirectResult | null;
|
|
27
|
-
//# sourceMappingURL=bankRedirectLink.d.ts.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
var e = "subscriberbot.bankLink.pending"
|
|
3
|
-
function
|
|
1
|
+
// src/subscriberbot/utils/bankRedirectLink.ts
|
|
2
|
+
var e = "subscriberbot.bankLink.pending";
|
|
3
|
+
function t() {
|
|
4
4
|
try {
|
|
5
5
|
return typeof window > "u" ? null : window.sessionStorage;
|
|
6
6
|
} catch {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
...
|
|
10
|
+
function n(n) {
|
|
11
|
+
t()?.setItem(e, JSON.stringify({
|
|
12
|
+
...n,
|
|
13
13
|
startedAt: Date.now()
|
|
14
14
|
}));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
16
|
+
function r() {
|
|
17
|
+
let n = t(), r = n?.getItem(e);
|
|
18
|
+
if (n?.removeItem(e), !r) return null;
|
|
19
19
|
try {
|
|
20
|
-
let e = JSON.parse(
|
|
21
|
-
if ((e.aggregator === "TRUELAYER" || e.aggregator === "ACCOUNT_AGGREGATOR") && typeof e.linkToken == "string" && typeof e.startedAt == "number" && Date.now() - e.startedAt <
|
|
20
|
+
let e = JSON.parse(r);
|
|
21
|
+
if ((e.aggregator === "TRUELAYER" || e.aggregator === "ACCOUNT_AGGREGATOR") && typeof e.linkToken == "string" && typeof e.startedAt == "number" && Date.now() - e.startedAt < 18e5) return {
|
|
22
22
|
aggregator: e.aggregator,
|
|
23
23
|
linkToken: e.linkToken,
|
|
24
24
|
connectionId: typeof e.connectionId == "string" ? e.connectionId : null,
|
|
@@ -27,7 +27,7 @@ function i() {
|
|
|
27
27
|
} catch {}
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var i = [
|
|
31
31
|
"code",
|
|
32
32
|
"state",
|
|
33
33
|
"error",
|
|
@@ -36,17 +36,17 @@ var a = [
|
|
|
36
36
|
"success",
|
|
37
37
|
"errorcode"
|
|
38
38
|
];
|
|
39
|
-
function
|
|
39
|
+
function a() {
|
|
40
40
|
if (typeof window > "u") return null;
|
|
41
|
-
let e = new URL(window.location.href), t = e.searchParams, n = t.get("code"),
|
|
41
|
+
let e = new URL(window.location.href), t = e.searchParams, n = t.get("code"), a = t.get("state"), o = t.get("error"), s = t.get("id"), c = t.get("success"), l = n !== null || o !== null, u = s !== null && c !== null;
|
|
42
42
|
if (!l && !u) return null;
|
|
43
|
-
let d =
|
|
44
|
-
for (let e of
|
|
43
|
+
let d = r();
|
|
44
|
+
for (let e of i) t.delete(e);
|
|
45
45
|
return window.history.replaceState(window.history.state, "", `${e.pathname}${e.search}${e.hash}`), d ? l && d.aggregator === "TRUELAYER" ? n ? {
|
|
46
46
|
kind: "complete",
|
|
47
47
|
aggregator: "TRUELAYER",
|
|
48
48
|
publicToken: n,
|
|
49
|
-
state:
|
|
49
|
+
state: a || d.linkToken,
|
|
50
50
|
connectionId: d.connectionId
|
|
51
51
|
} : {
|
|
52
52
|
kind: "declined",
|
|
@@ -62,7 +62,6 @@ function o() {
|
|
|
62
62
|
connectionId: d.connectionId
|
|
63
63
|
} : { kind: "expired" } : { kind: "expired" };
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
export { o as consumeBankRedirect, r as savePendingBankLink };
|
|
65
|
+
export { a as consumeBankRedirect, n as savePendingBankLink };
|
|
67
66
|
|
|
68
67
|
//# sourceMappingURL=bankRedirectLink.js.map
|