@elevasis/ui 2.24.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 (33) hide show
  1. package/dist/app/index.js +2 -2
  2. package/dist/{chunk-FUEXGRFR.js → chunk-7D2HSSIW.js} +1 -1
  3. package/dist/{chunk-KCJ6VATY.js → chunk-ABV5LDDC.js} +4 -4
  4. package/dist/chunk-AZXSFDG2.js +474 -0
  5. package/dist/{chunk-M2HWJY6O.js → chunk-HVC2BTFO.js} +92 -12
  6. package/dist/{chunk-2WZ635SS.js → chunk-LK4MPIMK.js} +1 -1
  7. package/dist/{chunk-QULLZ5PE.js → chunk-QJLRDTYS.js} +28 -2
  8. package/dist/{chunk-KLFIJDTD.js → chunk-V3UOW2HG.js} +1 -1
  9. package/dist/{chunk-MTR6AN2C.js → chunk-WSC5LU3U.js} +1 -1
  10. package/dist/{chunk-VGNAV3TH.js → chunk-WWVSPOJY.js} +2 -2
  11. package/dist/{chunk-YBZT7MJR.js → chunk-ZGZZIR6K.js} +1 -1
  12. package/dist/{chunk-4NWNS7TX.js → chunk-ZMXZ476Y.js} +1 -1
  13. package/dist/components/index.js +85 -16
  14. package/dist/features/crm/index.js +4 -4
  15. package/dist/features/dashboard/index.js +4 -4
  16. package/dist/features/delivery/index.js +4 -4
  17. package/dist/features/lead-gen/index.d.ts +14 -2
  18. package/dist/features/lead-gen/index.js +4 -5
  19. package/dist/features/monitoring/index.js +5 -5
  20. package/dist/features/monitoring/requests/index.js +3 -3
  21. package/dist/features/operations/index.js +6 -7
  22. package/dist/features/settings/index.js +4 -4
  23. package/dist/hooks/index.d.ts +25 -4
  24. package/dist/hooks/index.js +3 -3
  25. package/dist/hooks/published.d.ts +25 -4
  26. package/dist/hooks/published.js +3 -3
  27. package/dist/index.d.ts +25 -4
  28. package/dist/index.js +3 -3
  29. package/dist/provider/index.js +2 -2
  30. package/dist/provider/published.js +1 -1
  31. package/package.json +4 -4
  32. package/dist/chunk-OWHQ65EQ.js +0 -211
  33. package/dist/chunk-UDJE54WN.js +0 -209
package/dist/app/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { ElevasisUIProvider } from '../chunk-2WZ635SS.js';
1
+ import { ElevasisUIProvider } from '../chunk-LK4MPIMK.js';
2
2
  import '../chunk-QIW6OCEI.js';
3
3
  import '../chunk-WLOQ4IBG.js';
4
- import '../chunk-UDJE54WN.js';
4
+ import '../chunk-AZXSFDG2.js';
5
5
  import '../chunk-SZHARWKU.js';
6
6
  import '../chunk-T6INEVX6.js';
7
7
  import '../chunk-HC2KV6BU.js';
@@ -2,7 +2,7 @@ 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-QULLZ5PE.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
7
  import { glassBase } from './chunk-QIW6OCEI.js';
8
8
  import { GlowDot, CardHeader, EmptyState, PageTitleCaption, TabCountBadge } from './chunk-XUYBOO32.js';
@@ -1,18 +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-FUEXGRFR.js';
4
- import { LabelSchema, ColorTokenSchema, IconNameSchema, PathSchema, DescriptionSchema, DisplayMetadataSchema, ModelIdSchema, ReferenceIdsSchema, OrganizationModelSalesSchema } from './chunk-OWHQ65EQ.js';
5
- import { ResourceHealthPanel } from './chunk-4NWNS7TX.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';
6
5
  import { useCyberColors, CyberDonut } from './chunk-TSSKOQBX.js';
7
6
  import { AppShellLoader } from './chunk-M25JL54Z.js';
8
7
  import { PageContainer } from './chunk-BZZCNLT6.js';
9
8
  import { SubshellSidebarSection } from './chunk-IIMU5YAJ.js';
10
9
  import { CustomModal, ConfirmationModal } from './chunk-KVJ3LFH2.js';
11
10
  import { getResourceStatusColor, useTimelineData, useAgentIterationData, getStatusIcon } from './chunk-E4WQGJNS.js';
12
- 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-QULLZ5PE.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';
13
12
  import { showApiErrorNotification, showSuccessNotification } from './chunk-Z6FAH4XV.js';
14
13
  import { useGraphHighlighting, calculateGraphHeight, Graph_module_css_default, GRAPH_CONSTANTS } from './chunk-22UVE3RA.js';
15
14
  import { useMergedExecution } from './chunk-3ZMAGTWF.js';
15
+ import { LabelSchema, ColorTokenSchema, IconNameSchema, PathSchema, DescriptionSchema, DisplayMetadataSchema, ModelIdSchema, ReferenceIdsSchema, OrganizationModelSalesSchema } from './chunk-AZXSFDG2.js';
16
16
  import { useOptionalElevasisFeatures, useElevasisFeatures } from './chunk-LJWV4TWV.js';
17
17
  import { SubshellContentContainer } from './chunk-TKAYX2SP.js';
18
18
  import { JsonViewer, CardHeader, PageTitleCaption, CollapsibleSection, TabCountBadge, ResourceCard, ContextViewer, EmptyState, APIErrorAlert } from './chunk-XUYBOO32.js';
@@ -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 };