@elevasis/ui 2.23.0 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/app/index.d.ts +2915 -0
  2. package/dist/app/index.js +5 -4
  3. package/dist/{chunk-7PGEGSUM.js → chunk-7D2HSSIW.js} +2 -2
  4. package/dist/{chunk-YU6MBDVO.js → chunk-ABV5LDDC.js} +4 -68
  5. package/dist/chunk-AZXSFDG2.js +474 -0
  6. package/dist/{chunk-6IA2OMAE.js → chunk-HC2KV6BU.js} +9 -0
  7. package/dist/{chunk-PXGSJNBH.js → chunk-HVC2BTFO.js} +783 -374
  8. package/dist/{chunk-3HEUGBOT.js → chunk-LK4MPIMK.js} +2 -2
  9. package/dist/{chunk-XOTJNW4Q.js → chunk-QIW6OCEI.js} +18 -1
  10. package/dist/{chunk-GUJUK6EH.js → chunk-QJLRDTYS.js} +198 -2
  11. package/dist/{chunk-QZJM3RYI.js → chunk-SNHGSCKH.js} +1 -1
  12. package/dist/{chunk-FXWETLEB.js → chunk-V3UOW2HG.js} +1 -1
  13. package/dist/{chunk-N6WLOWOD.js → chunk-WSC5LU3U.js} +3 -12
  14. package/dist/{chunk-EPV7NU2E.js → chunk-WWVSPOJY.js} +385 -188
  15. package/dist/{chunk-SQ5JGELM.js → chunk-ZDKQNQ4X.js} +19 -1
  16. package/dist/{chunk-PTUOINQ2.js → chunk-ZGZZIR6K.js} +3 -3
  17. package/dist/{chunk-D3KQAABP.js → chunk-ZMXZ476Y.js} +1 -1
  18. package/dist/components/index.d.ts +488 -452
  19. package/dist/components/index.js +127 -22
  20. package/dist/components/navigation/index.js +2 -2
  21. package/dist/features/auth/index.d.ts +463 -377
  22. package/dist/features/crm/index.d.ts +459 -379
  23. package/dist/features/crm/index.js +8 -8
  24. package/dist/features/dashboard/index.js +8 -8
  25. package/dist/features/delivery/index.d.ts +457 -371
  26. package/dist/features/delivery/index.js +8 -8
  27. package/dist/features/lead-gen/index.d.ts +225 -65
  28. package/dist/features/lead-gen/index.js +8 -8
  29. package/dist/features/monitoring/index.js +9 -9
  30. package/dist/features/monitoring/requests/index.js +7 -7
  31. package/dist/features/operations/index.js +10 -10
  32. package/dist/features/settings/index.d.ts +463 -377
  33. package/dist/features/settings/index.js +9 -9
  34. package/dist/hooks/delivery/index.d.ts +457 -371
  35. package/dist/hooks/index.d.ts +957 -718
  36. package/dist/hooks/index.js +7 -7
  37. package/dist/hooks/published.d.ts +957 -718
  38. package/dist/hooks/published.js +7 -7
  39. package/dist/index.d.ts +1327 -1020
  40. package/dist/index.js +8 -8
  41. package/dist/initialization/index.d.ts +463 -377
  42. package/dist/organization/index.d.ts +11 -1
  43. package/dist/organization/index.js +2 -2
  44. package/dist/profile/index.d.ts +463 -377
  45. package/dist/provider/index.d.ts +3132 -169
  46. package/dist/provider/index.js +6 -6
  47. package/dist/provider/published.d.ts +3098 -168
  48. package/dist/provider/published.js +3 -3
  49. package/dist/supabase/index.d.ts +559 -389
  50. package/dist/test-utils/index.d.ts +21 -1
  51. package/dist/test-utils/index.js +13 -4
  52. package/dist/theme/index.js +2 -2
  53. package/dist/types/index.d.ts +463 -377
  54. package/package.json +2 -2
  55. package/src/test-utils/README.md +2 -0
  56. package/dist/chunk-LVUCBY7X.js +0 -127
  57. /package/dist/{chunk-ZBCTB5CA.js → chunk-EIOJNUPL.js} +0 -0
package/dist/app/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { ElevasisUIProvider } from '../chunk-3HEUGBOT.js';
2
- import '../chunk-XOTJNW4Q.js';
1
+ import { ElevasisUIProvider } from '../chunk-LK4MPIMK.js';
2
+ import '../chunk-QIW6OCEI.js';
3
3
  import '../chunk-WLOQ4IBG.js';
4
- import '../chunk-LVUCBY7X.js';
4
+ import '../chunk-AZXSFDG2.js';
5
5
  import '../chunk-SZHARWKU.js';
6
6
  import '../chunk-T6INEVX6.js';
7
- import '../chunk-6IA2OMAE.js';
7
+ import '../chunk-HC2KV6BU.js';
8
8
  import '../chunk-QJ2KCHKX.js';
9
9
  import '../chunk-SGXXJE52.js';
10
10
  import '../chunk-KRWALB24.js';
@@ -58,6 +58,7 @@ function AppWithStore({ config }) {
58
58
  queryClient: config.queryClient,
59
59
  apiUrl: config.apiUrl,
60
60
  onError: config.onApiError ? handleApiError : void 0,
61
+ crmActions: config.crmActions,
61
62
  children: /* @__PURE__ */ jsx(AuthenticatedApp, { config })
62
63
  }
63
64
  );
@@ -2,9 +2,9 @@ import { ResourceHealthChart } from './chunk-LGKLC5MG.js';
2
2
  import { useCyberColors, HeroStatsRow } from './chunk-TSSKOQBX.js';
3
3
  import { AppShellCenteredContainer, AppShellLoader } from './chunk-M25JL54Z.js';
4
4
  import { STATUS_COLORS, getStatusIcon, formatDuration, getStatusColors, AGENT_CONSTANTS, shouldAnimateEdge, TIMELINE_CONSTANTS, calculateBarPosition, CONTAINER_CONSTANTS, useExecutionPath, useUnifiedWorkflowLayout, WORKFLOW_CONSTANTS, useReactFlowAgent } from './chunk-E4WQGJNS.js';
5
- import { useExecuteResource, useDashboardMetrics, useResources, useTimeRangeDates, useUnresolvedErrors, useRecentExecutionsByResource, useCommandQueue, useScheduledTasks, useResourcesHealth } from './chunk-GUJUK6EH.js';
5
+ import { useExecuteResource, useDashboardMetrics, useResources, useTimeRangeDates, useUnresolvedErrors, useRecentExecutionsByResource, useCommandQueue, useScheduledTasks, useResourcesHealth } from './chunk-QJLRDTYS.js';
6
6
  import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, useFitViewTrigger } from './chunk-22UVE3RA.js';
7
- import { glassBase } from './chunk-XOTJNW4Q.js';
7
+ import { glassBase } from './chunk-QIW6OCEI.js';
8
8
  import { GlowDot, CardHeader, EmptyState, PageTitleCaption, TabCountBadge } from './chunk-XUYBOO32.js';
9
9
  import { formatTimeAgo, getTimeRangeDates, formatRelativeTime } from './chunk-SGXXJE52.js';
10
10
  import { ResourceStatusColors } from './chunk-KRWALB24.js';
@@ -1,17 +1,18 @@
1
1
  import { ChatHeader, ChatSidebar } from './chunk-ROSMICXG.js';
2
2
  import { SubshellSidebarLoader, SubshellLoader } from './chunk-3JCMO7SD.js';
3
- import { BaseNode, useGraphTheme, BaseEdge, FormFieldRenderer, ExecutionStats, UnifiedWorkflowGraph, WorkflowExecutionTimeline, AgentExecutionVisualizer, AgentExecutionTimeline, GraphBackground, GraphFitViewButton, GraphFitViewHandler } from './chunk-7PGEGSUM.js';
4
- import { ResourceHealthPanel } from './chunk-D3KQAABP.js';
3
+ import { BaseNode, useGraphTheme, BaseEdge, FormFieldRenderer, ExecutionStats, UnifiedWorkflowGraph, WorkflowExecutionTimeline, AgentExecutionVisualizer, AgentExecutionTimeline, GraphBackground, GraphFitViewButton, GraphFitViewHandler } from './chunk-7D2HSSIW.js';
4
+ import { ResourceHealthPanel } from './chunk-ZMXZ476Y.js';
5
5
  import { useCyberColors, CyberDonut } from './chunk-TSSKOQBX.js';
6
6
  import { AppShellLoader } from './chunk-M25JL54Z.js';
7
7
  import { PageContainer } from './chunk-BZZCNLT6.js';
8
8
  import { SubshellSidebarSection } from './chunk-IIMU5YAJ.js';
9
9
  import { CustomModal, ConfirmationModal } from './chunk-KVJ3LFH2.js';
10
10
  import { getResourceStatusColor, useTimelineData, useAgentIterationData, getStatusIcon } from './chunk-E4WQGJNS.js';
11
- import { useErrorDetail, useExecution, useArchivedLogs, useDeleteExecution, useRetryExecution, useCancelExecution, useCommandQueueTotals, useStatusFilter, useResourceSearch, useResourcesDomainFilters, usePaginationState, useResources, useRecentExecutionsByResource, filterByDomainFilters, collectResourceFilterFacets, useExecuteAsync, useResourceDefinition, isSessionCapable, useDeleteTask, useCommandQueue, useSubmitAction, useCommandViewData, useCommandViewStats, useCommandViewStore, useResourceExecutions, useCheckpointTasks, COMMAND_VIEW_VISUALIZATION_MODES, useExecutionPanelState, useDeleteSession, useCreateSession, useSessions, useSessionExecutions, useSession, useBulkDeleteExecutions, getCommandViewGraphPositions } from './chunk-GUJUK6EH.js';
11
+ import { useErrorDetail, useExecution, useArchivedLogs, useDeleteExecution, useRetryExecution, useCancelExecution, useCommandQueueTotals, useStatusFilter, useResourceSearch, useResourcesDomainFilters, usePaginationState, useResources, useRecentExecutionsByResource, filterByDomainFilters, collectResourceFilterFacets, useExecuteAsync, useResourceDefinition, isSessionCapable, useDeleteTask, useCommandQueue, useSubmitAction, useCommandViewData, useCommandViewStats, useCommandViewStore, useResourceExecutions, useCheckpointTasks, COMMAND_VIEW_VISUALIZATION_MODES, useExecutionPanelState, useDeleteSession, useCreateSession, useSessions, useSessionExecutions, useSession, useBulkDeleteExecutions, getCommandViewGraphPositions } from './chunk-QJLRDTYS.js';
12
12
  import { showApiErrorNotification, showSuccessNotification } from './chunk-Z6FAH4XV.js';
13
13
  import { useGraphHighlighting, calculateGraphHeight, Graph_module_css_default, GRAPH_CONSTANTS } from './chunk-22UVE3RA.js';
14
14
  import { useMergedExecution } from './chunk-3ZMAGTWF.js';
15
+ import { LabelSchema, ColorTokenSchema, IconNameSchema, PathSchema, DescriptionSchema, DisplayMetadataSchema, ModelIdSchema, ReferenceIdsSchema, OrganizationModelSalesSchema } from './chunk-AZXSFDG2.js';
15
16
  import { useOptionalElevasisFeatures, useElevasisFeatures } from './chunk-LJWV4TWV.js';
16
17
  import { SubshellContentContainer } from './chunk-TKAYX2SP.js';
17
18
  import { JsonViewer, CardHeader, PageTitleCaption, CollapsibleSection, TabCountBadge, ResourceCard, ContextViewer, EmptyState, APIErrorAlert } from './chunk-XUYBOO32.js';
@@ -40,51 +41,6 @@ import cytoscape from 'cytoscape';
40
41
  import { create } from 'zustand';
41
42
  import { formatDistanceToNow } from 'date-fns';
42
43
 
43
- var ModelIdSchema = z.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
44
- var LabelSchema = z.string().trim().min(1).max(120);
45
- var DescriptionSchema = z.string().trim().min(1).max(2e3);
46
- var ColorTokenSchema = z.string().trim().min(1).max(50);
47
- var IconNameSchema = z.string().trim().min(1).max(80);
48
- var PathSchema = z.string().trim().startsWith("/").max(300);
49
- var ReferenceIdsSchema = z.array(ModelIdSchema).default([]);
50
- var DisplayMetadataSchema = z.object({
51
- label: LabelSchema,
52
- description: DescriptionSchema.optional(),
53
- color: ColorTokenSchema.optional(),
54
- icon: IconNameSchema.optional()
55
- });
56
- var TechStackEntrySchema = z.object({
57
- /** Name of the external platform (e.g. "HubSpot", "Stripe", "Notion"). */
58
- platform: z.string().trim().min(1).max(200),
59
- /** Free-form description of what this integration is used for. */
60
- purpose: z.string().trim().min(1).max(500),
61
- /**
62
- * Health of the credential backing this integration.
63
- * - configured: credential present and valid
64
- * - pending: not yet set up
65
- * - expired: credential existed but has lapsed
66
- * - missing: expected but not present
67
- */
68
- credentialStatus: z.enum(["configured", "pending", "expired", "missing"]),
69
- /**
70
- * Whether this integration is the primary system of record for its domain
71
- * (e.g. HubSpot is SoR for contacts). Defaults to false.
72
- */
73
- isSystemOfRecord: z.boolean().default(false)
74
- });
75
- DisplayMetadataSchema.extend({
76
- id: ModelIdSchema,
77
- resourceId: z.string().trim().min(1).max(255),
78
- resourceType: z.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
79
- featureIds: ReferenceIdsSchema,
80
- entityIds: ReferenceIdsSchema,
81
- surfaceIds: ReferenceIdsSchema,
82
- capabilityIds: ReferenceIdsSchema,
83
- /** Optional tech-stack metadata for external-SaaS integrations. */
84
- techStack: TechStackEntrySchema.optional()
85
- });
86
-
87
- // ../core/src/organization-model/domains/features.ts
88
44
  var NodeIdPathSchema = z.string().trim().min(1).max(100).regex(/^([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node IDs must be lowercase dotted paths");
89
45
  z.string().trim().min(1).max(200).regex(/^[a-z]+:([a-z0-9-]+)(\.[a-z0-9-]+)*$/, "Node references must use kind:dotted-path");
90
46
  var UiPositionSchema = z.enum(["sidebar-primary", "sidebar-bottom"]);
@@ -110,26 +66,6 @@ var OrganizationModelBrandingSchema = z.object({
110
66
  dark: z.string().trim().min(1).max(2048).optional()
111
67
  }).default({})
112
68
  });
113
- var SalesStageSemanticClassSchema = z.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
114
- var SalesStageSchema = DisplayMetadataSchema.extend({
115
- id: ModelIdSchema,
116
- order: z.number().int().min(0),
117
- semanticClass: SalesStageSemanticClassSchema,
118
- surfaceIds: ReferenceIdsSchema,
119
- resourceIds: ReferenceIdsSchema
120
- });
121
- var SalesPipelineSchema = z.object({
122
- id: ModelIdSchema,
123
- label: z.string().trim().min(1).max(120),
124
- description: DescriptionSchema.optional(),
125
- entityId: ModelIdSchema,
126
- stages: z.array(SalesStageSchema).min(1)
127
- });
128
- var OrganizationModelSalesSchema = z.object({
129
- entityId: ModelIdSchema,
130
- defaultPipelineId: ModelIdSchema,
131
- pipelines: z.array(SalesPipelineSchema).min(1)
132
- });
133
69
  var ProjectsDomainStateSchema = DisplayMetadataSchema.extend({
134
70
  id: ModelIdSchema,
135
71
  order: z.number().int().min(0)
@@ -0,0 +1,474 @@
1
+ import { ApiClientProvider, useApiClient } from './chunk-T6INEVX6.js';
2
+ import { OrganizationProvider } from './chunk-HC2KV6BU.js';
3
+ import { getErrorInfo, getErrorTitle, formatErrorMessage } from './chunk-SGXXJE52.js';
4
+ import { InitializationProvider } from './chunk-DK2HVHCY.js';
5
+ import { useOrganization } from './chunk-DD3CCMCZ.js';
6
+ import { ProfileProvider } from './chunk-QHSW4WHM.js';
7
+ import { ElevasisServiceProvider } from './chunk-IRW7JMQ4.js';
8
+ import { useAuthContext } from './chunk-BRJ3QZ4E.js';
9
+ import { createContext, lazy, useContext, Suspense, useRef } from 'react';
10
+ import { jsx } from 'react/jsx-runtime';
11
+ import { z } from 'zod';
12
+ import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
13
+
14
+ var consoleAdapter = {
15
+ success(title, message) {
16
+ console.log(`[Notification][Success] ${title}: ${message}`);
17
+ },
18
+ error(title, message) {
19
+ console.warn(`[Notification][Error] ${title}: ${message}`);
20
+ },
21
+ info(title, message) {
22
+ console.log(`[Notification][Info] ${title}: ${message}`);
23
+ },
24
+ warning(title, message) {
25
+ console.warn(`[Notification][Warning] ${title}: ${message}`);
26
+ },
27
+ apiError(error) {
28
+ const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
29
+ const title = getErrorTitle(code);
30
+ const formatted = formatErrorMessage(message, requestId, fields, retryAfter);
31
+ console.warn(`[Notification][API Error] ${title}: ${formatted}`);
32
+ }
33
+ };
34
+ var NotificationContext = createContext(consoleAdapter);
35
+ function NotificationProvider({ adapter, children }) {
36
+ return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: adapter, children });
37
+ }
38
+ function useNotificationAdapter() {
39
+ return useContext(NotificationContext);
40
+ }
41
+ var ModelIdSchema = z.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
42
+ var LabelSchema = z.string().trim().min(1).max(120);
43
+ var DescriptionSchema = z.string().trim().min(1).max(2e3);
44
+ var ColorTokenSchema = z.string().trim().min(1).max(50);
45
+ var IconNameSchema = z.string().trim().min(1).max(80);
46
+ var PathSchema = z.string().trim().startsWith("/").max(300);
47
+ var ReferenceIdsSchema = z.array(ModelIdSchema).default([]);
48
+ var DisplayMetadataSchema = z.object({
49
+ label: LabelSchema,
50
+ description: DescriptionSchema.optional(),
51
+ color: ColorTokenSchema.optional(),
52
+ icon: IconNameSchema.optional()
53
+ });
54
+ var TechStackEntrySchema = z.object({
55
+ /** Name of the external platform (e.g. "HubSpot", "Stripe", "Notion"). */
56
+ platform: z.string().trim().min(1).max(200),
57
+ /** Free-form description of what this integration is used for. */
58
+ purpose: z.string().trim().min(1).max(500),
59
+ /**
60
+ * Health of the credential backing this integration.
61
+ * - configured: credential present and valid
62
+ * - pending: not yet set up
63
+ * - expired: credential existed but has lapsed
64
+ * - missing: expected but not present
65
+ */
66
+ credentialStatus: z.enum(["configured", "pending", "expired", "missing"]),
67
+ /**
68
+ * Whether this integration is the primary system of record for its domain
69
+ * (e.g. HubSpot is SoR for contacts). Defaults to false.
70
+ */
71
+ isSystemOfRecord: z.boolean().default(false)
72
+ });
73
+ DisplayMetadataSchema.extend({
74
+ id: ModelIdSchema,
75
+ resourceId: z.string().trim().min(1).max(255),
76
+ resourceType: z.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
77
+ featureIds: ReferenceIdsSchema,
78
+ entityIds: ReferenceIdsSchema,
79
+ surfaceIds: ReferenceIdsSchema,
80
+ capabilityIds: ReferenceIdsSchema,
81
+ /** Optional tech-stack metadata for external-SaaS integrations. */
82
+ techStack: TechStackEntrySchema.optional()
83
+ });
84
+ var SalesStageSemanticClassSchema = z.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
85
+ var SalesStageSchema = DisplayMetadataSchema.extend({
86
+ id: ModelIdSchema,
87
+ order: z.number().int().min(0),
88
+ semanticClass: SalesStageSemanticClassSchema,
89
+ surfaceIds: ReferenceIdsSchema,
90
+ resourceIds: ReferenceIdsSchema
91
+ });
92
+ var SalesPipelineSchema = z.object({
93
+ id: ModelIdSchema,
94
+ label: z.string().trim().min(1).max(120),
95
+ description: DescriptionSchema.optional(),
96
+ entityId: ModelIdSchema,
97
+ stages: z.array(SalesStageSchema).min(1)
98
+ });
99
+ var OrganizationModelSalesSchema = z.object({
100
+ entityId: ModelIdSchema,
101
+ defaultPipelineId: ModelIdSchema,
102
+ pipelines: z.array(SalesPipelineSchema).min(1)
103
+ });
104
+ function findPipeline(definitions, pipelineKey) {
105
+ return definitions.find((def) => def.pipelineKey === pipelineKey);
106
+ }
107
+ function getValidStatesForStage(definition, stageKey) {
108
+ return definition.stages.find((s) => s.stageKey === stageKey)?.states ?? [];
109
+ }
110
+ var CRM_DISCOVERY_REPLIED_STATE = {
111
+ stateKey: "discovery_replied",
112
+ label: "Discovery Replied"
113
+ };
114
+ var CRM_DISCOVERY_LINK_SENT_STATE = {
115
+ stateKey: "discovery_link_sent",
116
+ label: "Discovery Link Sent"
117
+ };
118
+ var CRM_DISCOVERY_NUDGING_STATE = {
119
+ stateKey: "discovery_nudging",
120
+ label: "Discovery Nudging"
121
+ };
122
+ var CRM_DISCOVERY_BOOKING_CANCELLED_STATE = {
123
+ stateKey: "discovery_booking_cancelled",
124
+ label: "Discovery Booking Cancelled"
125
+ };
126
+ var CRM_REPLY_SENT_STATE = {
127
+ stateKey: "reply_sent",
128
+ label: "Reply Sent"
129
+ };
130
+ var CRM_FOLLOWUP_1_SENT_STATE = {
131
+ stateKey: "followup_1_sent",
132
+ label: "Follow-up 1 Sent"
133
+ };
134
+ var CRM_FOLLOWUP_2_SENT_STATE = {
135
+ stateKey: "followup_2_sent",
136
+ label: "Follow-up 2 Sent"
137
+ };
138
+ var CRM_FOLLOWUP_3_SENT_STATE = {
139
+ stateKey: "followup_3_sent",
140
+ label: "Follow-up 3 Sent"
141
+ };
142
+ var CRM_PIPELINE_DEFINITION = {
143
+ pipelineKey: "crm",
144
+ label: "CRM",
145
+ entityKey: "crm.deal",
146
+ stages: [
147
+ {
148
+ stageKey: "interested",
149
+ label: "Interested",
150
+ states: [
151
+ CRM_DISCOVERY_REPLIED_STATE,
152
+ CRM_DISCOVERY_LINK_SENT_STATE,
153
+ CRM_DISCOVERY_NUDGING_STATE,
154
+ CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
155
+ CRM_REPLY_SENT_STATE,
156
+ CRM_FOLLOWUP_1_SENT_STATE,
157
+ CRM_FOLLOWUP_2_SENT_STATE,
158
+ CRM_FOLLOWUP_3_SENT_STATE
159
+ ]
160
+ },
161
+ { stageKey: "proposal", label: "Proposal", states: [] },
162
+ { stageKey: "closing", label: "Closing", states: [] },
163
+ { stageKey: "closed_won", label: "Closed Won", states: [] },
164
+ { stageKey: "closed_lost", label: "Closed Lost", states: [] },
165
+ { stageKey: "nurturing", label: "Nurturing", states: [] }
166
+ ]
167
+ };
168
+ var PENDING_STATE = { stateKey: "pending", label: "Pending" };
169
+ var ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE = {
170
+ pipelineKey: "lead-gen",
171
+ label: "Lead Generation",
172
+ entityKey: "acq.list-member",
173
+ stages: [
174
+ {
175
+ stageKey: "outreach",
176
+ label: "Outreach",
177
+ states: [
178
+ PENDING_STATE,
179
+ { stateKey: "personalized", label: "Personalized" },
180
+ { stateKey: "uploaded", label: "Uploaded" },
181
+ { stateKey: "interested", label: "Interested" }
182
+ ]
183
+ },
184
+ {
185
+ stageKey: "prospecting",
186
+ label: "Prospecting",
187
+ states: [
188
+ PENDING_STATE,
189
+ { stateKey: "discovered", label: "Discovered" },
190
+ { stateKey: "verified", label: "Verified" }
191
+ ]
192
+ },
193
+ {
194
+ stageKey: "qualification",
195
+ label: "Qualification",
196
+ states: [PENDING_STATE]
197
+ }
198
+ ]
199
+ };
200
+ var ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE = {
201
+ pipelineKey: "lead-gen",
202
+ label: "Lead Generation",
203
+ entityKey: "acq.list-company",
204
+ stages: [
205
+ {
206
+ stageKey: "outreach",
207
+ label: "Outreach",
208
+ states: [PENDING_STATE]
209
+ },
210
+ {
211
+ stageKey: "prospecting",
212
+ label: "Prospecting",
213
+ states: [
214
+ PENDING_STATE,
215
+ { stateKey: "populated", label: "Populated" },
216
+ { stateKey: "extracted", label: "Extracted" }
217
+ ]
218
+ },
219
+ {
220
+ stageKey: "qualification",
221
+ label: "Qualification",
222
+ states: [PENDING_STATE, { stateKey: "qualified", label: "Qualified" }]
223
+ }
224
+ ]
225
+ };
226
+ var LEAD_GEN_PIPELINE_DEFINITIONS = {
227
+ "acq.list-member": [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
228
+ "acq.list-company": [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
229
+ };
230
+ var LEAD_GEN_STAGE_CATALOG = {
231
+ // Prospecting — company population
232
+ scraped: {
233
+ key: "scraped",
234
+ label: "Scraped",
235
+ description: "Company was scraped from a source directory (Apify actor run).",
236
+ order: 1,
237
+ entity: "company"
238
+ },
239
+ populated: {
240
+ key: "populated",
241
+ label: "Populated",
242
+ description: "Company record populated with structured data from scrape results.",
243
+ order: 2,
244
+ entity: "company"
245
+ },
246
+ extracted: {
247
+ key: "extracted",
248
+ label: "Extracted",
249
+ description: "Website content extracted and parsed for company intelligence.",
250
+ order: 3,
251
+ entity: "company"
252
+ },
253
+ enriched: {
254
+ key: "enriched",
255
+ label: "Enriched",
256
+ description: "Company or contact enriched with third-party data (e.g. Tomba, Anymailfinder).",
257
+ order: 4,
258
+ entity: "company"
259
+ },
260
+ // Prospecting — contact discovery
261
+ discovered: {
262
+ key: "discovered",
263
+ label: "Discovered",
264
+ description: "Contact email address discovered via an email-discovery workflow.",
265
+ order: 5,
266
+ entity: "contact"
267
+ },
268
+ verified: {
269
+ key: "verified",
270
+ label: "Verified",
271
+ description: "Contact email address verified as deliverable (email verification workflow).",
272
+ order: 6,
273
+ entity: "contact"
274
+ },
275
+ // Qualification
276
+ qualified: {
277
+ key: "qualified",
278
+ label: "Qualified",
279
+ description: "Company passed the ICP qualification rubric (company-qualification workflow).",
280
+ order: 7,
281
+ entity: "company"
282
+ },
283
+ // Outreach
284
+ personalized: {
285
+ key: "personalized",
286
+ label: "Personalized",
287
+ description: "Outreach message personalized for the contact (Instantly personalization workflow).",
288
+ order: 8,
289
+ entity: "contact"
290
+ },
291
+ uploaded: {
292
+ key: "uploaded",
293
+ label: "Uploaded",
294
+ description: "Contact uploaded to an Instantly campaign for outreach.",
295
+ order: 9,
296
+ entity: "contact"
297
+ },
298
+ interested: {
299
+ key: "interested",
300
+ label: "Interested",
301
+ description: "Contact replied with a positive signal (Instantly reply-handler transition).",
302
+ order: 10,
303
+ entity: "contact"
304
+ }
305
+ };
306
+ var SendReplyActionPayloadSchema = z.object({
307
+ replyBody: z.string().trim().min(1).max(1e4)
308
+ }).strict();
309
+ var DEFAULT_CRM_ACTIONS = [
310
+ {
311
+ key: "move_to_proposal",
312
+ label: "Move to Proposal",
313
+ isAvailableFor: (deal) => deal.stage_key === "interested",
314
+ workflowId: "move_to_proposal-workflow"
315
+ },
316
+ {
317
+ key: "move_to_closing",
318
+ label: "Move to Closing",
319
+ isAvailableFor: (deal) => deal.stage_key === "proposal",
320
+ workflowId: "move_to_closing-workflow"
321
+ },
322
+ {
323
+ key: "move_to_closed_won",
324
+ label: "Close Won",
325
+ isAvailableFor: (deal) => deal.stage_key === "closing",
326
+ workflowId: "move_to_closed_won-workflow"
327
+ },
328
+ {
329
+ key: "move_to_closed_lost",
330
+ label: "Close Lost",
331
+ isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
332
+ workflowId: "move_to_closed_lost-workflow"
333
+ },
334
+ {
335
+ key: "move_to_nurturing",
336
+ label: "Move to Nurturing",
337
+ isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
338
+ workflowId: "move_to_nurturing-workflow"
339
+ },
340
+ {
341
+ key: "send_reply",
342
+ label: "Send Reply",
343
+ isAvailableFor: (deal) => deal.stage_key === "interested" && (deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey || deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey || deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
344
+ workflowId: "crm-send-reply-workflow",
345
+ payloadSchema: SendReplyActionPayloadSchema
346
+ },
347
+ {
348
+ key: "send_link",
349
+ label: "Send Booking Link",
350
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
351
+ workflowId: "crm-send-booking-link-workflow"
352
+ },
353
+ {
354
+ key: "send_nudge",
355
+ label: "Send Nudge",
356
+ isAvailableFor: (deal) => deal.stage_key === "interested" && (deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey || deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
357
+ workflowId: "crm-send-nudge-workflow"
358
+ },
359
+ {
360
+ key: "mark_no_show",
361
+ label: "Mark No-Show",
362
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
363
+ // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
364
+ // both manual-click and timeout move the deal to closed_lost. The action_taken activity
365
+ // event captures operator intent and distinguishes the manual variant from the timed one.
366
+ workflowId: "mark_no_show-workflow"
367
+ },
368
+ {
369
+ key: "rebook",
370
+ label: "Rebook",
371
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
372
+ workflowId: "crm-rebook-workflow"
373
+ }
374
+ ];
375
+ function deriveActions(deal, actions = DEFAULT_CRM_ACTIONS) {
376
+ return actions.filter((a) => a.isAvailableFor(deal)).map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }));
377
+ }
378
+ var CrmActionsContext = createContext(DEFAULT_CRM_ACTIONS);
379
+ function CrmActionsProvider({ actions, children }) {
380
+ return /* @__PURE__ */ jsx(CrmActionsContext.Provider, { value: actions, children });
381
+ }
382
+ function useCrmActions() {
383
+ return useContext(CrmActionsContext);
384
+ }
385
+ var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-QC62UHTZ.js').then((m) => ({ default: m.CoreAuthKitInner })));
386
+ var defaultQueryClient = null;
387
+ function getDefaultQueryClient() {
388
+ if (!defaultQueryClient) {
389
+ defaultQueryClient = new QueryClient({
390
+ defaultOptions: { queries: { retry: 1 } }
391
+ });
392
+ }
393
+ return defaultQueryClient;
394
+ }
395
+ var consoleNotificationAdapter = {
396
+ success(title, message) {
397
+ console.log(`[Notification][Success] ${title}: ${message}`);
398
+ },
399
+ error(title, message) {
400
+ console.warn(`[Notification][Error] ${title}: ${message}`);
401
+ },
402
+ info(title, message) {
403
+ console.log(`[Notification][Info] ${title}: ${message}`);
404
+ },
405
+ warning(title, message) {
406
+ console.warn(`[Notification][Warning] ${title}: ${message}`);
407
+ },
408
+ apiError(error) {
409
+ console.warn(`[Notification][API Error]`, error);
410
+ }
411
+ };
412
+ function ElevasisCoreProvider({
413
+ auth,
414
+ queryClient,
415
+ apiUrl,
416
+ onError,
417
+ notifications,
418
+ crmActions,
419
+ children
420
+ }) {
421
+ if (auth.mode === "apiKey") {
422
+ throw new Error(
423
+ `ElevasisCoreProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit' mode is supported.`
424
+ );
425
+ }
426
+ const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
427
+ const resolvedCrmActions = crmActions ?? DEFAULT_CRM_ACTIONS;
428
+ const content = apiUrl ? /* @__PURE__ */ jsx(ServiceStack, { apiUrl, onError, notifications, children }) : children;
429
+ const AuthInner = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCoreAuthKitInner, { auth, children: content }) });
430
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: /* @__PURE__ */ jsx(CrmActionsProvider, { actions: resolvedCrmActions, children: AuthInner }) });
431
+ }
432
+ function ServiceStack({
433
+ apiUrl,
434
+ onError,
435
+ notifications,
436
+ children
437
+ }) {
438
+ const { getAccessToken } = useAuthContext();
439
+ const orgIdRef = useRef(null);
440
+ const getOrganizationId = useRef(() => orgIdRef.current).current;
441
+ return /* @__PURE__ */ jsx(
442
+ ApiClientProvider,
443
+ {
444
+ getAccessToken,
445
+ getOrganizationId,
446
+ isOrganizationReady: false,
447
+ onError,
448
+ children: /* @__PURE__ */ jsx(ServiceStackInner, { apiUrl, orgIdRef, notifications, children })
449
+ }
450
+ );
451
+ }
452
+ function ServiceStackInner({
453
+ apiUrl,
454
+ orgIdRef,
455
+ notifications,
456
+ children
457
+ }) {
458
+ const { apiRequest } = useApiClient(apiUrl);
459
+ const resolvedNotifications = notifications ?? consoleNotificationAdapter;
460
+ return /* @__PURE__ */ jsx(ProfileProvider, { apiRequest, children: /* @__PURE__ */ jsx(OrganizationProvider, { apiRequest, children: /* @__PURE__ */ jsx(OrgServiceBridge, { orgIdRef, apiRequest, notifications: resolvedNotifications, children }) }) });
461
+ }
462
+ function OrgServiceBridge({
463
+ orgIdRef,
464
+ apiRequest,
465
+ notifications,
466
+ children
467
+ }) {
468
+ const { currentWorkOSOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
469
+ orgIdRef.current = currentWorkOSOrganizationId;
470
+ const isReady = !!currentWorkOSOrganizationId && !isInitializing && !isOrgRefreshing;
471
+ return /* @__PURE__ */ jsx(ElevasisServiceProvider, { apiRequest, organizationId: currentWorkOSOrganizationId, isReady, children: /* @__PURE__ */ jsx(NotificationProvider, { adapter: notifications, children: /* @__PURE__ */ jsx(InitializationProvider, { children }) }) });
472
+ }
473
+
474
+ export { CRM_PIPELINE_DEFINITION, ColorTokenSchema, CrmActionsProvider, DescriptionSchema, DisplayMetadataSchema, ElevasisCoreProvider, IconNameSchema, LEAD_GEN_PIPELINE_DEFINITIONS, LEAD_GEN_STAGE_CATALOG, LabelSchema, ModelIdSchema, NotificationProvider, OrganizationModelSalesSchema, PathSchema, ReferenceIdsSchema, deriveActions, findPipeline, getValidStatesForStage, useCrmActions, useNotificationAdapter };
@@ -112,6 +112,15 @@ function OrganizationProvider({ apiRequest, children }) {
112
112
  if (!user?.id || !profileLoaded || hasInitializedRef.current) return;
113
113
  fetchAndInitialize();
114
114
  }, [user?.id, profileLoaded, fetchAndInitialize]);
115
+ useEffect(() => {
116
+ if (!hasInitializedRef.current) return;
117
+ if (!workosOrgId) return;
118
+ if (workosOrgId === currentWorkOSOrganizationId) return;
119
+ const target = memberships.find((m) => m.organization?.workos_org_id === workosOrgId);
120
+ if (!target) return;
121
+ applyMembership(target);
122
+ void queryClient.invalidateQueries();
123
+ }, [workosOrgId, currentWorkOSOrganizationId, memberships, applyMembership, queryClient]);
115
124
  const switchOrganization = useCallback(
116
125
  (workosOrgId2) => {
117
126
  const target = memberships.find((m) => m.organization?.workos_org_id === workosOrgId2);