@elevasis/ui 2.22.0 → 2.24.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-3HEUGBOT.js → chunk-2WZ635SS.js} +2 -2
  4. package/dist/{chunk-GJ7EIABJ.js → chunk-4NWNS7TX.js} +1 -1
  5. package/dist/{chunk-LKVBEE63.js → chunk-FUEXGRFR.js} +2 -2
  6. package/dist/{chunk-6IA2OMAE.js → chunk-HC2KV6BU.js} +9 -0
  7. package/dist/{chunk-IBUYJXA3.js → chunk-KCJ6VATY.js} +1133 -578
  8. package/dist/{chunk-WWJ6S2HQ.js → chunk-KLFIJDTD.js} +1 -1
  9. package/dist/{chunk-COG4ABRI.js → chunk-M2HWJY6O.js} +704 -375
  10. package/dist/{chunk-LVJGPE6H.js → chunk-MTR6AN2C.js} +3 -12
  11. package/dist/chunk-OWHQ65EQ.js +211 -0
  12. package/dist/{chunk-XOTJNW4Q.js → chunk-QIW6OCEI.js} +18 -1
  13. package/dist/{chunk-B4FHWKEF.js → chunk-QULLZ5PE.js} +193 -10
  14. package/dist/{chunk-QZJM3RYI.js → chunk-SNHGSCKH.js} +1 -1
  15. package/dist/{chunk-LVUCBY7X.js → chunk-UDJE54WN.js} +85 -3
  16. package/dist/{chunk-IOTLB6ND.js → chunk-VGNAV3TH.js} +406 -195
  17. package/dist/{chunk-BSZRKBAW.js → chunk-YBZT7MJR.js} +3 -3
  18. package/dist/{chunk-SQ5JGELM.js → chunk-ZDKQNQ4X.js} +19 -1
  19. package/dist/components/index.d.ts +500 -466
  20. package/dist/components/index.js +75 -32
  21. package/dist/components/navigation/index.js +2 -2
  22. package/dist/features/auth/index.d.ts +472 -389
  23. package/dist/features/crm/index.d.ts +468 -391
  24. package/dist/features/crm/index.js +8 -8
  25. package/dist/features/dashboard/index.js +8 -8
  26. package/dist/features/delivery/index.d.ts +466 -383
  27. package/dist/features/delivery/index.js +8 -8
  28. package/dist/features/lead-gen/index.d.ts +213 -65
  29. package/dist/features/lead-gen/index.js +9 -8
  30. package/dist/features/monitoring/index.js +9 -9
  31. package/dist/features/monitoring/requests/index.js +7 -7
  32. package/dist/features/operations/index.js +11 -10
  33. package/dist/features/settings/index.d.ts +472 -389
  34. package/dist/features/settings/index.js +9 -9
  35. package/dist/hooks/delivery/index.d.ts +466 -383
  36. package/dist/hooks/index.d.ts +967 -744
  37. package/dist/hooks/index.js +7 -7
  38. package/dist/hooks/published.d.ts +967 -744
  39. package/dist/hooks/published.js +7 -7
  40. package/dist/index.d.ts +1360 -1069
  41. package/dist/index.js +8 -8
  42. package/dist/initialization/index.d.ts +472 -389
  43. package/dist/organization/index.d.ts +11 -1
  44. package/dist/organization/index.js +2 -2
  45. package/dist/profile/index.d.ts +472 -389
  46. package/dist/provider/index.d.ts +3132 -169
  47. package/dist/provider/index.js +6 -6
  48. package/dist/provider/published.d.ts +3098 -168
  49. package/dist/provider/published.js +3 -3
  50. package/dist/supabase/index.d.ts +577 -413
  51. package/dist/test-utils/index.d.ts +21 -1
  52. package/dist/test-utils/index.js +13 -4
  53. package/dist/theme/index.js +2 -2
  54. package/dist/types/index.d.ts +472 -389
  55. package/package.json +2 -2
  56. package/src/test-utils/README.md +2 -0
  57. /package/dist/{chunk-ZBCTB5CA.js → chunk-EIOJNUPL.js} +0 -0
@@ -5,7 +5,7 @@ import { SubshellNavItem } from './chunk-CEWTOKE7.js';
5
5
  import { SubshellSidebarSection } from './chunk-IIMU5YAJ.js';
6
6
  import { FilterBar } from './chunk-PDHTXPSF.js';
7
7
  import { CustomModal } from './chunk-KVJ3LFH2.js';
8
- import { useProjectRealtime, useTableSort, sortData, usePaginationState, useTableSelection, useProjectActivities } from './chunk-B4FHWKEF.js';
8
+ import { useProjectRealtime, useTableSort, sortData, usePaginationState, useTableSelection, useProjectActivities } from './chunk-QULLZ5PE.js';
9
9
  import { useCreateTask, useCreateMilestone, useProjectMilestones, useUpdateTask, useProjects, useDeleteProject, useProject, useProjectNotes, useUpdateMilestone, useCreateNote, showApiErrorNotification, projectKeys } from './chunk-Z6FAH4XV.js';
10
10
  import { SubshellContentContainer } from './chunk-TKAYX2SP.js';
11
11
  import { StatusBadge, EmptyState, PageTitleCaption, CenteredErrorState, StatCard, CardHeader } from './chunk-XUYBOO32.js';
@@ -1097,10 +1097,9 @@ function renderMilestoneBullet(status) {
1097
1097
  function getMilestoneSurfaceStyles(status) {
1098
1098
  const normalizedStatus = status ?? "upcoming";
1099
1099
  const accent = normalizedStatus === "completed" ? "var(--color-primary)" : normalizedStatus === "in_progress" ? "color-mix(in srgb, var(--color-primary) 72%, white)" : "color-mix(in srgb, var(--color-primary) 36%, var(--color-border))";
1100
- const background = normalizedStatus === "completed" ? "linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 1.5%, transparent) 0%, transparent 100%)" : normalizedStatus === "in_progress" ? "linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 3%, transparent) 0%, transparent 100%)" : "linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 1.5%, transparent) 0%, transparent 100%)";
1101
1100
  return {
1102
1101
  accent,
1103
- background
1102
+ background: "transparent"
1104
1103
  };
1105
1104
  }
1106
1105
  function MilestoneChecklist({ milestone }) {
@@ -1477,15 +1476,7 @@ function ProjectDetailPage({ projectId, onBack, backLabel = "Projects" }) {
1477
1476
  /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "flex-start", wrap: "wrap", children: [
1478
1477
  /* @__PURE__ */ jsxs(Stack, { gap: 6, style: { flex: 1, minWidth: 260 }, children: [
1479
1478
  /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "wrap", children: [
1480
- /* @__PURE__ */ jsx(
1481
- Text,
1482
- {
1483
- fw: 700,
1484
- size: "lg",
1485
- c: "var(--color-text)",
1486
- children: milestone.name
1487
- }
1488
- ),
1479
+ /* @__PURE__ */ jsx(Text, { fw: 700, size: "lg", c: "var(--color-text)", children: milestone.name }),
1489
1480
  /* @__PURE__ */ jsx(
1490
1481
  Badge,
1491
1482
  {
@@ -0,0 +1,211 @@
1
+ import { z } from 'zod';
2
+
3
+ // ../core/src/organization-model/domains/sales.ts
4
+ var ModelIdSchema = z.string().trim().min(1).max(100).regex(/^[a-z0-9]+(?:[-._][a-z0-9]+)*$/, "IDs must be lowercase and use -, _, or . separators");
5
+ var LabelSchema = z.string().trim().min(1).max(120);
6
+ var DescriptionSchema = z.string().trim().min(1).max(2e3);
7
+ var ColorTokenSchema = z.string().trim().min(1).max(50);
8
+ var IconNameSchema = z.string().trim().min(1).max(80);
9
+ var PathSchema = z.string().trim().startsWith("/").max(300);
10
+ var ReferenceIdsSchema = z.array(ModelIdSchema).default([]);
11
+ var DisplayMetadataSchema = z.object({
12
+ label: LabelSchema,
13
+ description: DescriptionSchema.optional(),
14
+ color: ColorTokenSchema.optional(),
15
+ icon: IconNameSchema.optional()
16
+ });
17
+ var TechStackEntrySchema = z.object({
18
+ /** Name of the external platform (e.g. "HubSpot", "Stripe", "Notion"). */
19
+ platform: z.string().trim().min(1).max(200),
20
+ /** Free-form description of what this integration is used for. */
21
+ purpose: z.string().trim().min(1).max(500),
22
+ /**
23
+ * Health of the credential backing this integration.
24
+ * - configured: credential present and valid
25
+ * - pending: not yet set up
26
+ * - expired: credential existed but has lapsed
27
+ * - missing: expected but not present
28
+ */
29
+ credentialStatus: z.enum(["configured", "pending", "expired", "missing"]),
30
+ /**
31
+ * Whether this integration is the primary system of record for its domain
32
+ * (e.g. HubSpot is SoR for contacts). Defaults to false.
33
+ */
34
+ isSystemOfRecord: z.boolean().default(false)
35
+ });
36
+ DisplayMetadataSchema.extend({
37
+ id: ModelIdSchema,
38
+ resourceId: z.string().trim().min(1).max(255),
39
+ resourceType: z.enum(["workflow", "agent", "trigger", "integration", "external", "human_checkpoint"]),
40
+ featureIds: ReferenceIdsSchema,
41
+ entityIds: ReferenceIdsSchema,
42
+ surfaceIds: ReferenceIdsSchema,
43
+ capabilityIds: ReferenceIdsSchema,
44
+ /** Optional tech-stack metadata for external-SaaS integrations. */
45
+ techStack: TechStackEntrySchema.optional()
46
+ });
47
+
48
+ // ../core/src/organization-model/domains/sales.ts
49
+ var SalesStageSemanticClassSchema = z.enum(["open", "active", "nurturing", "closed_won", "closed_lost"]);
50
+ var SalesStageSchema = DisplayMetadataSchema.extend({
51
+ id: ModelIdSchema,
52
+ order: z.number().int().min(0),
53
+ semanticClass: SalesStageSemanticClassSchema,
54
+ surfaceIds: ReferenceIdsSchema,
55
+ resourceIds: ReferenceIdsSchema
56
+ });
57
+ var SalesPipelineSchema = z.object({
58
+ id: ModelIdSchema,
59
+ label: z.string().trim().min(1).max(120),
60
+ description: DescriptionSchema.optional(),
61
+ entityId: ModelIdSchema,
62
+ stages: z.array(SalesStageSchema).min(1)
63
+ });
64
+ var OrganizationModelSalesSchema = z.object({
65
+ entityId: ModelIdSchema,
66
+ defaultPipelineId: ModelIdSchema,
67
+ pipelines: z.array(SalesPipelineSchema).min(1)
68
+ });
69
+ function findPipeline(definitions, pipelineKey) {
70
+ return definitions.find((def) => def.pipelineKey === pipelineKey);
71
+ }
72
+ var PENDING_STATE = { stateKey: "pending", label: "Pending" };
73
+ var ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE = {
74
+ pipelineKey: "lead-gen",
75
+ label: "Lead Generation",
76
+ entityKey: "acq.list-member",
77
+ stages: [
78
+ {
79
+ stageKey: "outreach",
80
+ label: "Outreach",
81
+ states: [
82
+ PENDING_STATE,
83
+ { stateKey: "personalized", label: "Personalized" },
84
+ { stateKey: "uploaded", label: "Uploaded" },
85
+ { stateKey: "interested", label: "Interested" }
86
+ ]
87
+ },
88
+ {
89
+ stageKey: "prospecting",
90
+ label: "Prospecting",
91
+ states: [
92
+ PENDING_STATE,
93
+ { stateKey: "discovered", label: "Discovered" },
94
+ { stateKey: "verified", label: "Verified" }
95
+ ]
96
+ },
97
+ {
98
+ stageKey: "qualification",
99
+ label: "Qualification",
100
+ states: [PENDING_STATE]
101
+ }
102
+ ]
103
+ };
104
+ var ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE = {
105
+ pipelineKey: "lead-gen",
106
+ label: "Lead Generation",
107
+ entityKey: "acq.list-company",
108
+ stages: [
109
+ {
110
+ stageKey: "outreach",
111
+ label: "Outreach",
112
+ states: [PENDING_STATE]
113
+ },
114
+ {
115
+ stageKey: "prospecting",
116
+ label: "Prospecting",
117
+ states: [
118
+ PENDING_STATE,
119
+ { stateKey: "populated", label: "Populated" },
120
+ { stateKey: "extracted", label: "Extracted" }
121
+ ]
122
+ },
123
+ {
124
+ stageKey: "qualification",
125
+ label: "Qualification",
126
+ states: [PENDING_STATE, { stateKey: "qualified", label: "Qualified" }]
127
+ }
128
+ ]
129
+ };
130
+ var LEAD_GEN_PIPELINE_DEFINITIONS = {
131
+ "acq.list-member": [ACQ_LIST_MEMBERS_LEAD_GEN_PIPELINE],
132
+ "acq.list-company": [ACQ_LIST_COMPANIES_LEAD_GEN_PIPELINE]
133
+ };
134
+ var LEAD_GEN_STAGE_CATALOG = {
135
+ // Prospecting — company population
136
+ scraped: {
137
+ key: "scraped",
138
+ label: "Scraped",
139
+ description: "Company was scraped from a source directory (Apify actor run).",
140
+ order: 1,
141
+ entity: "company"
142
+ },
143
+ populated: {
144
+ key: "populated",
145
+ label: "Populated",
146
+ description: "Company record populated with structured data from scrape results.",
147
+ order: 2,
148
+ entity: "company"
149
+ },
150
+ extracted: {
151
+ key: "extracted",
152
+ label: "Extracted",
153
+ description: "Website content extracted and parsed for company intelligence.",
154
+ order: 3,
155
+ entity: "company"
156
+ },
157
+ enriched: {
158
+ key: "enriched",
159
+ label: "Enriched",
160
+ description: "Company or contact enriched with third-party data (e.g. Tomba, Anymailfinder).",
161
+ order: 4,
162
+ entity: "company"
163
+ },
164
+ // Prospecting — contact discovery
165
+ discovered: {
166
+ key: "discovered",
167
+ label: "Discovered",
168
+ description: "Contact email address discovered via an email-discovery workflow.",
169
+ order: 5,
170
+ entity: "contact"
171
+ },
172
+ verified: {
173
+ key: "verified",
174
+ label: "Verified",
175
+ description: "Contact email address verified as deliverable (email verification workflow).",
176
+ order: 6,
177
+ entity: "contact"
178
+ },
179
+ // Qualification
180
+ qualified: {
181
+ key: "qualified",
182
+ label: "Qualified",
183
+ description: "Company passed the ICP qualification rubric (company-qualification workflow).",
184
+ order: 7,
185
+ entity: "company"
186
+ },
187
+ // Outreach
188
+ personalized: {
189
+ key: "personalized",
190
+ label: "Personalized",
191
+ description: "Outreach message personalized for the contact (Instantly personalization workflow).",
192
+ order: 8,
193
+ entity: "contact"
194
+ },
195
+ uploaded: {
196
+ key: "uploaded",
197
+ label: "Uploaded",
198
+ description: "Contact uploaded to an Instantly campaign for outreach.",
199
+ order: 9,
200
+ entity: "contact"
201
+ },
202
+ interested: {
203
+ key: "interested",
204
+ label: "Interested",
205
+ description: "Contact replied with a positive signal (Instantly reply-handler transition).",
206
+ order: 10,
207
+ entity: "contact"
208
+ }
209
+ };
210
+
211
+ export { ColorTokenSchema, DescriptionSchema, DisplayMetadataSchema, IconNameSchema, LEAD_GEN_PIPELINE_DEFINITIONS, LEAD_GEN_STAGE_CATALOG, LabelSchema, ModelIdSchema, OrganizationModelSalesSchema, PathSchema, ReferenceIdsSchema, findPipeline };
@@ -1,7 +1,7 @@
1
1
  import { AppBackground, AmbientBloomGrid, CyberBackground, FloatingMotes, WaveBackground } from './chunk-WLOQ4IBG.js';
2
2
  import { createElement, Fragment, createContext, useRef, useEffect, useContext } from 'react';
3
3
  import { jsxs, Fragment as Fragment$1, jsx } from 'react/jsx-runtime';
4
- import { Tooltip, Text, Tabs, Table, Stack, SimpleGrid, Select, Combobox, SegmentedControl, ScrollArea, Paper, Popover, Notification, Modal, Menu, Input, HoverCard, Group, Grid, Flex, Code, Divider, Card, Button, Accordion, createTheme } from '@mantine/core';
4
+ import { Tooltip, Text, Tabs, Table, Stack, SimpleGrid, Select, Combobox, SegmentedControl, ScrollArea, Paper, Popover, Notification, Modal, Menu, Input, HoverCard, Group, Grid, Flex, Drawer, Code, Divider, Card, Button, Accordion, createTheme } from '@mantine/core';
5
5
 
6
6
  // src/theme/presets/utils.ts
7
7
  function hexToRgb(hex) {
@@ -2574,6 +2574,23 @@ var componentThemes = {
2574
2574
  }
2575
2575
  }
2576
2576
  }),
2577
+ Drawer: Drawer.extend({
2578
+ styles: {
2579
+ header: {
2580
+ backgroundColor: "transparent"
2581
+ },
2582
+ title: {
2583
+ fontFamily: "var(--font-sans, var(--mantine-font-family))",
2584
+ fontSize: "var(--mantine-font-size-xl)",
2585
+ fontWeight: 600,
2586
+ color: "var(--color-text)"
2587
+ },
2588
+ content: {
2589
+ backgroundColor: "var(--color-elevated, var(--color-background))",
2590
+ ...glassBase
2591
+ }
2592
+ }
2593
+ }),
2577
2594
  Flex: Flex.extend({
2578
2595
  defaultProps: {
2579
2596
  gap: DEFAULT_SIZE
@@ -2,7 +2,7 @@ import { useSupabase } from './chunk-BRXELOHC.js';
2
2
  import { observabilityKeys } from './chunk-QSTH6T77.js';
3
3
  import { showApiErrorNotification, showSuccessNotification, projectKeys, noteKeys, taskKeys, milestoneKeys } from './chunk-Z6FAH4XV.js';
4
4
  import { GRAPH_CONSTANTS } from './chunk-22UVE3RA.js';
5
- import { useNotificationAdapter } from './chunk-LVUCBY7X.js';
5
+ import { useNotificationAdapter, deriveActions } from './chunk-UDJE54WN.js';
6
6
  import { useOptionalElevasisFeatures } from './chunk-LJWV4TWV.js';
7
7
  import { HTTP_HEADERS } from './chunk-T6INEVX6.js';
8
8
  import { ResourceTypeSchema, NonEmptyStringSchema, OriginResourceTypeSchema, UuidSchema, CredentialNameSchema, STALE_TIME_DEFAULT, REFETCH_INTERVAL_DASHBOARD, STALE_TIME_MONITORING, STALE_TIME_ADMIN, getTimeRangeDates, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, APIClientError, GC_TIME_MEDIUM, GC_TIME_SHORT } from './chunk-SGXXJE52.js';
@@ -30,7 +30,8 @@ var PERMISSIONS = {
30
30
  SECRETS_MANAGE: "secrets.manage",
31
31
  OPERATIONS_READ: "operations.read",
32
32
  OPERATIONS_MANAGE: "operations.manage",
33
- WORK_MANAGE: "work.manage"
33
+ ACQUISITION_MANAGE: "acquisition.manage",
34
+ PROJECTS_MANAGE: "projects.manage"
34
35
  };
35
36
  var PERMISSION_CATALOG = [
36
37
  {
@@ -74,9 +75,14 @@ var PERMISSION_CATALOG = [
74
75
  isOrgGrantable: true
75
76
  },
76
77
  {
77
- key: "work.manage",
78
- description: "Create and edit business-domain records (acq_*, prj_*)",
79
- isOrgGrantable: true
78
+ key: "acquisition.manage",
79
+ description: "Create, update, and delete acquisition records (acq_companies, acq_contacts, acq_deals, acq_lists*, acq_content*, acquisition storage files)",
80
+ isOrgGrantable: false
81
+ },
82
+ {
83
+ key: "projects.manage",
84
+ description: "Create, update, and delete project records (prj_projects, prj_milestones, prj_tasks, prj_notes)",
85
+ isOrgGrantable: false
80
86
  }
81
87
  ];
82
88
  new Set(PERMISSION_CATALOG.map((p) => p.key));
@@ -2377,14 +2383,21 @@ function useDeleteDeal() {
2377
2383
  }
2378
2384
  });
2379
2385
  }
2380
- function useSyncDealStage() {
2386
+ function useTransitionItem() {
2381
2387
  const { apiRequest, organizationId } = useElevasisServices();
2382
2388
  const queryClient = useQueryClient();
2383
2389
  return useMutation({
2384
- mutationFn: async ({ dealId, stage }) => {
2385
- await apiRequest(`/deals/${dealId}/sync-stage`, {
2390
+ mutationFn: async (input) => {
2391
+ const { dealId, pipelineKey, stageKey, stateKey, reason, expectedUpdatedAt } = input;
2392
+ await apiRequest(`/deals/${dealId}/transition`, {
2386
2393
  method: "PATCH",
2387
- body: JSON.stringify({ stage })
2394
+ body: JSON.stringify({
2395
+ pipelineKey,
2396
+ stageKey,
2397
+ ...stateKey !== void 0 ? { stateKey } : {},
2398
+ ...reason !== void 0 ? { reason } : {},
2399
+ ...expectedUpdatedAt !== void 0 ? { expectedUpdatedAt } : {}
2400
+ })
2388
2401
  });
2389
2402
  },
2390
2403
  onSuccess: (_, variables) => {
@@ -2858,6 +2871,155 @@ function useDeleteContacts() {
2858
2871
  }
2859
2872
  });
2860
2873
  }
2874
+ var leadGenArtifactKeys = {
2875
+ all: ["lead-gen-artifacts"],
2876
+ list: (organizationId, ownerKind, ownerId) => [...leadGenArtifactKeys.all, organizationId, ownerKind, ownerId]
2877
+ };
2878
+ function useArtifacts({ ownerKind, ownerId }) {
2879
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
2880
+ return useQuery({
2881
+ queryKey: leadGenArtifactKeys.list(organizationId, ownerKind, ownerId),
2882
+ queryFn: () => apiRequest(
2883
+ `/acquisition/artifacts?ownerKind=${encodeURIComponent(ownerKind)}&ownerId=${encodeURIComponent(ownerId)}`
2884
+ ),
2885
+ enabled: isReady && !!ownerId
2886
+ });
2887
+ }
2888
+ function useCreateArtifact() {
2889
+ const { apiRequest, organizationId } = useElevasisServices();
2890
+ const queryClient = useQueryClient();
2891
+ return useMutation({
2892
+ mutationFn: (body) => apiRequest("/acquisition/artifacts", {
2893
+ method: "POST",
2894
+ body: JSON.stringify(body)
2895
+ }),
2896
+ onSuccess: (_, variables) => {
2897
+ queryClient.invalidateQueries({
2898
+ queryKey: leadGenArtifactKeys.list(organizationId, variables.ownerKind, variables.ownerId)
2899
+ });
2900
+ showSuccessNotification("Artifact created");
2901
+ },
2902
+ onError: (error) => {
2903
+ showApiErrorNotification(error);
2904
+ }
2905
+ });
2906
+ }
2907
+ var leadGenListMemberKeys = {
2908
+ all: ["lead-gen-list-members"],
2909
+ list: (organizationId, listId) => [...leadGenListMemberKeys.all, organizationId, "list", listId],
2910
+ detail: (organizationId, memberId) => [...leadGenListMemberKeys.all, organizationId, "detail", memberId]
2911
+ };
2912
+ function useListMembers({ listId }) {
2913
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
2914
+ return useQuery({
2915
+ queryKey: leadGenListMemberKeys.list(organizationId, listId),
2916
+ queryFn: () => apiRequest(`/acquisition/lists/${listId}/members`),
2917
+ enabled: isReady && !!listId
2918
+ });
2919
+ }
2920
+ function useListMember(memberId) {
2921
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
2922
+ return useQuery({
2923
+ queryKey: leadGenListMemberKeys.detail(organizationId, memberId),
2924
+ queryFn: () => apiRequest(`/acquisition/list-members/${memberId}`),
2925
+ enabled: isReady && !!memberId
2926
+ });
2927
+ }
2928
+ function useTransitionListMember() {
2929
+ const { apiRequest, organizationId } = useElevasisServices();
2930
+ const queryClient = useQueryClient();
2931
+ return useMutation({
2932
+ mutationFn: async (input) => {
2933
+ const { memberId, pipelineKey, stageKey, stateKey, reason, expectedUpdatedAt } = input;
2934
+ await apiRequest(`/acquisition/list-members/${memberId}/transition`, {
2935
+ method: "PATCH",
2936
+ body: JSON.stringify({
2937
+ pipelineKey,
2938
+ stageKey,
2939
+ ...stateKey !== void 0 ? { stateKey } : {},
2940
+ ...reason !== void 0 ? { reason } : {},
2941
+ ...expectedUpdatedAt !== void 0 ? { expectedUpdatedAt } : {}
2942
+ })
2943
+ });
2944
+ },
2945
+ onSuccess: (_, variables) => {
2946
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.detail(organizationId, variables.memberId) });
2947
+ if (variables.listId) {
2948
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, variables.listId) });
2949
+ }
2950
+ },
2951
+ onError: (error) => {
2952
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.all });
2953
+ showApiErrorNotification(error);
2954
+ }
2955
+ });
2956
+ }
2957
+ var leadGenListCompanyKeys = {
2958
+ all: ["lead-gen-list-companies"],
2959
+ detail: (organizationId, listCompanyId) => [...leadGenListCompanyKeys.all, organizationId, "detail", listCompanyId]
2960
+ };
2961
+ function useTransitionListCompany() {
2962
+ const { apiRequest, organizationId } = useElevasisServices();
2963
+ const queryClient = useQueryClient();
2964
+ return useMutation({
2965
+ mutationFn: async (input) => {
2966
+ const { listCompanyId, pipelineKey, stageKey, stateKey, reason, expectedUpdatedAt } = input;
2967
+ await apiRequest(`/acquisition/list-companies/${listCompanyId}/transition`, {
2968
+ method: "PATCH",
2969
+ body: JSON.stringify({
2970
+ pipelineKey,
2971
+ stageKey,
2972
+ ...stateKey !== void 0 ? { stateKey } : {},
2973
+ ...reason !== void 0 ? { reason } : {},
2974
+ ...expectedUpdatedAt !== void 0 ? { expectedUpdatedAt } : {}
2975
+ })
2976
+ });
2977
+ },
2978
+ onSuccess: (_, variables) => {
2979
+ queryClient.invalidateQueries({
2980
+ queryKey: leadGenListCompanyKeys.detail(organizationId, variables.listCompanyId)
2981
+ });
2982
+ if (variables.listId) {
2983
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
2984
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, variables.listId) });
2985
+ }
2986
+ },
2987
+ onError: (error) => {
2988
+ queryClient.invalidateQueries({ queryKey: leadGenListCompanyKeys.all });
2989
+ showApiErrorNotification(error);
2990
+ }
2991
+ });
2992
+ }
2993
+ function useDeriveActions(item) {
2994
+ return useMemo(() => {
2995
+ if (!item) return [];
2996
+ if (item.pipeline_key !== "lead-gen") {
2997
+ return deriveActions(item);
2998
+ }
2999
+ return [];
3000
+ }, [item]);
3001
+ }
3002
+ function useUpdateListStatus() {
3003
+ const { apiRequest, organizationId } = useElevasisServices();
3004
+ const queryClient = useQueryClient();
3005
+ return useMutation({
3006
+ mutationFn: async (input) => {
3007
+ await apiRequest(`/acquisition/lists/${input.listId}/status`, {
3008
+ method: "PATCH",
3009
+ body: JSON.stringify({ status: input.status })
3010
+ });
3011
+ },
3012
+ onSuccess: (_, variables) => {
3013
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
3014
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, variables.listId) });
3015
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
3016
+ },
3017
+ onError: (error) => {
3018
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
3019
+ showApiErrorNotification(error);
3020
+ }
3021
+ });
3022
+ }
2861
3023
  var projectActivityKeys = {
2862
3024
  all: ["project-activities"],
2863
3025
  list: (projectId) => [...projectActivityKeys.all, "list", projectId]
@@ -4315,6 +4477,27 @@ function useDealDetail(acqDealId) {
4315
4477
  enabled: isReady && !!acqDealId
4316
4478
  });
4317
4479
  }
4480
+ function useExecuteAction({ dealId }) {
4481
+ const { apiRequest, organizationId } = useElevasisServices();
4482
+ const queryClient = useQueryClient();
4483
+ return useMutation({
4484
+ mutationFn: async ({ key, payload }) => {
4485
+ await apiRequest(`/deals/${dealId}/actions/${encodeURIComponent(key)}`, {
4486
+ method: "POST",
4487
+ body: JSON.stringify({ payload })
4488
+ });
4489
+ },
4490
+ onSuccess: () => {
4491
+ queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
4492
+ queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
4493
+ queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, dealId] });
4494
+ },
4495
+ onError: (error) => {
4496
+ queryClient.invalidateQueries({ queryKey: dealKeys.all });
4497
+ showApiErrorNotification(error);
4498
+ }
4499
+ });
4500
+ }
4318
4501
 
4319
4502
  // src/hooks/acquisition/useBatchTelemetry.ts
4320
4503
  function useBatchTelemetry() {
@@ -4871,4 +5054,4 @@ function useProjectRealtime(projectId) {
4871
5054
  });
4872
5055
  }
4873
5056
 
4874
- export { ApiKeyService, COMMAND_VIEW_VISUALIZATION_MODES, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, collectResourceFilterFacets, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getCommandViewGraphPositions, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useHasPermission, useList, useListApiKeys, useListDeployments, useListExecutions, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrgRoles, useOrganizationMembers, useOrganizationPermissions, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useRevokeRole, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useSyncDealStage, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateMemberConfig, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
5057
+ export { ApiKeyService, COMMAND_VIEW_VISUALIZATION_MODES, CredentialSchemas, CredentialService, DeploymentService, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, collectResourceFilterFacets, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, filterByDomainFilters, getCommandViewGraphPositions, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, leadGenArtifactKeys, leadGenListCompanyKeys, leadGenListMemberKeys, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewLayout, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateArtifact, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteCompanies, useDeleteContacts, useDeleteCredential, useDeleteDeal, useDeleteDeployment, useDeleteExecution, useDeleteList, useDeleteOrgRole, useDeleteRequest, useDeleteSchedule, useDeleteSession, useDeleteTask, useDeleteWebhookEndpoint, useDeriveActions, useEffectivePermissions, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useExecuteAction, useExecuteAsync, useExecuteResource, useExecution, useExecutionHealth, useExecutionLogSSE, useExecutionLogs, useExecutionLogsFilters, useExecutionPanelState, useExecutions, useGetExecutionHistory, useGetSchedule, useGraphStats, useHasPermission, useList, useListApiKeys, useListDeployments, useListExecutions, useListMember, useListMembers, useListProgress, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrgRoles, useOrganizationMembers, useOrganizationPermissions, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRequest, useRequestsList, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResourceErrors, useResourceExecutions, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useResumeSchedule, useRetryExecution, useRevokeRole, useSSEConnection, useScheduledTasks, useSession, useSessionExecution, useSessionExecutions, useSessionMessages, useSessionWebSocket, useSessions, useSortedData, useStatusFilter, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTestNotification, useTimeRangeDates, useTopFailingResources, useTransitionItem, useTransitionListCompany, useTransitionListMember, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMemberConfig, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification };
@@ -1,4 +1,4 @@
1
- import { usePresetsContext } from './chunk-XOTJNW4Q.js';
1
+ import { usePresetsContext } from './chunk-QIW6OCEI.js';
2
2
  import { useMemo } from 'react';
3
3
 
4
4
  var BUILT_IN_NAMES = /* @__PURE__ */ new Set([
@@ -1,5 +1,5 @@
1
1
  import { ApiClientProvider, useApiClient } from './chunk-T6INEVX6.js';
2
- import { OrganizationProvider } from './chunk-6IA2OMAE.js';
2
+ import { OrganizationProvider } from './chunk-HC2KV6BU.js';
3
3
  import { getErrorInfo, getErrorTitle, formatErrorMessage } from './chunk-SGXXJE52.js';
4
4
  import { InitializationProvider } from './chunk-DK2HVHCY.js';
5
5
  import { useOrganization } from './chunk-DD3CCMCZ.js';
@@ -8,6 +8,7 @@ import { ElevasisServiceProvider } from './chunk-IRW7JMQ4.js';
8
8
  import { useAuthContext } from './chunk-BRJ3QZ4E.js';
9
9
  import { createContext, lazy, useContext, Suspense, useRef } from 'react';
10
10
  import { jsx } from 'react/jsx-runtime';
11
+ import { z } from 'zod';
11
12
  import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
12
13
 
13
14
  var consoleAdapter = {
@@ -37,6 +38,85 @@ function NotificationProvider({ adapter, children }) {
37
38
  function useNotificationAdapter() {
38
39
  return useContext(NotificationContext);
39
40
  }
41
+ var SendReplyActionPayloadSchema = z.object({
42
+ replyBody: z.string().trim().min(1).max(1e4)
43
+ }).strict();
44
+ var DEFAULT_CRM_ACTIONS = [
45
+ {
46
+ key: "move_to_proposal",
47
+ label: "Move to Proposal",
48
+ isAvailableFor: (deal) => deal.stage_key === "interested",
49
+ workflowId: "move_to_proposal-workflow"
50
+ },
51
+ {
52
+ key: "move_to_closing",
53
+ label: "Move to Closing",
54
+ isAvailableFor: (deal) => deal.stage_key === "proposal",
55
+ workflowId: "move_to_closing-workflow"
56
+ },
57
+ {
58
+ key: "move_to_closed_won",
59
+ label: "Close Won",
60
+ isAvailableFor: (deal) => deal.stage_key === "closing",
61
+ workflowId: "move_to_closed_won-workflow"
62
+ },
63
+ {
64
+ key: "move_to_closed_lost",
65
+ label: "Close Lost",
66
+ isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
67
+ workflowId: "move_to_closed_lost-workflow"
68
+ },
69
+ {
70
+ key: "move_to_nurturing",
71
+ label: "Move to Nurturing",
72
+ isAvailableFor: (deal) => deal.stage_key === "interested" || deal.stage_key === "proposal" || deal.stage_key === "closing",
73
+ workflowId: "move_to_nurturing-workflow"
74
+ },
75
+ {
76
+ key: "send_reply",
77
+ label: "Send Reply",
78
+ isAvailableFor: (deal) => deal.stage_key === "interested" && (deal.state_key === "discovery_replied" || deal.state_key === "discovery_link_sent" || deal.state_key === "discovery_nudging"),
79
+ workflowId: "crm-send-reply-workflow",
80
+ payloadSchema: SendReplyActionPayloadSchema
81
+ },
82
+ {
83
+ key: "send_link",
84
+ label: "Send Booking Link",
85
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === "discovery_replied",
86
+ workflowId: "crm-send-booking-link-workflow"
87
+ },
88
+ {
89
+ key: "send_nudge",
90
+ label: "Send Nudge",
91
+ isAvailableFor: (deal) => deal.stage_key === "interested" && (deal.state_key === "discovery_link_sent" || deal.state_key === "discovery_nudging"),
92
+ workflowId: "crm-send-nudge-workflow"
93
+ },
94
+ {
95
+ key: "mark_no_show",
96
+ label: "Mark No-Show",
97
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === "discovery_nudging",
98
+ // Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
99
+ // both manual-click and timeout move the deal to closed_lost. The action_taken activity
100
+ // event captures operator intent and distinguishes the manual variant from the timed one.
101
+ workflowId: "mark_no_show-workflow"
102
+ },
103
+ {
104
+ key: "rebook",
105
+ label: "Rebook",
106
+ isAvailableFor: (deal) => deal.stage_key === "interested" && deal.state_key === "discovery_booking_cancelled",
107
+ workflowId: "crm-rebook-workflow"
108
+ }
109
+ ];
110
+ function deriveActions(deal, actions = DEFAULT_CRM_ACTIONS) {
111
+ return actions.filter((a) => a.isAvailableFor(deal)).map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }));
112
+ }
113
+ var CrmActionsContext = createContext(DEFAULT_CRM_ACTIONS);
114
+ function CrmActionsProvider({ actions, children }) {
115
+ return /* @__PURE__ */ jsx(CrmActionsContext.Provider, { value: actions, children });
116
+ }
117
+ function useCrmActions() {
118
+ return useContext(CrmActionsContext);
119
+ }
40
120
  var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-QC62UHTZ.js').then((m) => ({ default: m.CoreAuthKitInner })));
41
121
  var defaultQueryClient = null;
42
122
  function getDefaultQueryClient() {
@@ -70,6 +150,7 @@ function ElevasisCoreProvider({
70
150
  apiUrl,
71
151
  onError,
72
152
  notifications,
153
+ crmActions,
73
154
  children
74
155
  }) {
75
156
  if (auth.mode === "apiKey") {
@@ -78,9 +159,10 @@ function ElevasisCoreProvider({
78
159
  );
79
160
  }
80
161
  const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
162
+ const resolvedCrmActions = crmActions ?? DEFAULT_CRM_ACTIONS;
81
163
  const content = apiUrl ? /* @__PURE__ */ jsx(ServiceStack, { apiUrl, onError, notifications, children }) : children;
82
164
  const AuthInner = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCoreAuthKitInner, { auth, children: content }) });
83
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: AuthInner });
165
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: /* @__PURE__ */ jsx(CrmActionsProvider, { actions: resolvedCrmActions, children: AuthInner }) });
84
166
  }
85
167
  function ServiceStack({
86
168
  apiUrl,
@@ -124,4 +206,4 @@ function OrgServiceBridge({
124
206
  return /* @__PURE__ */ jsx(ElevasisServiceProvider, { apiRequest, organizationId: currentWorkOSOrganizationId, isReady, children: /* @__PURE__ */ jsx(NotificationProvider, { adapter: notifications, children: /* @__PURE__ */ jsx(InitializationProvider, { children }) }) });
125
207
  }
126
208
 
127
- export { ElevasisCoreProvider, NotificationProvider, useNotificationAdapter };
209
+ export { CrmActionsProvider, ElevasisCoreProvider, NotificationProvider, deriveActions, useCrmActions, useNotificationAdapter };