@elevasis/ui 2.29.0 → 2.31.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 (125) hide show
  1. package/dist/{CoreAuthKitInner-QC62UHTZ.js → CoreAuthKitInner-KSEGSB67.js} +1 -1
  2. package/dist/api/index.js +3 -3
  3. package/dist/app/index.d.ts +176 -1
  4. package/dist/app/index.js +11 -11
  5. package/dist/auth/context.js +1 -1
  6. package/dist/auth/index.js +5 -5
  7. package/dist/charts/index.d.ts +2 -1
  8. package/dist/charts/index.js +9 -9
  9. package/dist/{chunk-XTVZFT7U.js → chunk-2Q2JQSQO.js} +1 -1
  10. package/dist/{chunk-LH4GPYDX.js → chunk-3BAPR3KA.js} +19 -3
  11. package/dist/{chunk-HLFFKKT3.js → chunk-3FV6HBXS.js} +17 -17
  12. package/dist/{chunk-WKJ47GIW.js → chunk-533DUEQY.js} +1 -1
  13. package/dist/{chunk-SZWXQHKO.js → chunk-542WPQU2.js} +9 -8
  14. package/dist/{chunk-5CW2HXQA.js → chunk-5LJAEZMA.js} +7 -28
  15. package/dist/{chunk-V3HUIZJX.js → chunk-6IXOKUBC.js} +1 -1
  16. package/dist/{chunk-VKMNWHTL.js → chunk-6YT4IKJ7.js} +3 -3
  17. package/dist/{chunk-CEHUFNAL.js → chunk-7HMCB26R.js} +12 -12
  18. package/dist/chunk-7KC4P3AU.js +357 -0
  19. package/dist/{chunk-OWESKPTJ.js → chunk-CQZ3DNQY.js} +30 -11
  20. package/dist/{chunk-ROSMICXG.js → chunk-CXY7FMUM.js} +35 -20
  21. package/dist/{chunk-I2KLQ2HA.js → chunk-DZTG5IAC.js} +7 -1
  22. package/dist/{chunk-JCGD4GM6.js → chunk-GRDLB6LM.js} +1 -0
  23. package/dist/{chunk-FGDUK74A.js → chunk-HQGF4ATG.js} +10 -56
  24. package/dist/{chunk-HOIT677G.js → chunk-HUJCU55S.js} +1 -1
  25. package/dist/{chunk-OIMPGKDB.js → chunk-HYNYEBHM.js} +4 -4
  26. package/dist/{chunk-GESXCQWY.js → chunk-JA5ECJJB.js} +1 -1
  27. package/dist/{chunk-KU7ZDWQ7.js → chunk-JBWJ6WHZ.js} +1 -1
  28. package/dist/{chunk-HNFQCOD2.js → chunk-JKSUN5GN.js} +1107 -370
  29. package/dist/{chunk-5WWZXCS5.js → chunk-KJ3QUBNU.js} +9 -2
  30. package/dist/{chunk-OHGNCWJP.js → chunk-L2NVFLXU.js} +3 -3
  31. package/dist/{chunk-6WXDE5LZ.js → chunk-L3BVJWML.js} +1 -1
  32. package/dist/{chunk-3DUOPXOJ.js → chunk-MVFCLZSK.js} +691 -222
  33. package/dist/{chunk-A7R2URMV.js → chunk-ND42LPY4.js} +44 -10
  34. package/dist/{chunk-CLUP5H3C.js → chunk-O2QOPJI5.js} +360 -126
  35. package/dist/{chunk-VMJVQAFZ.js → chunk-OAVTMITG.js} +1 -1
  36. package/dist/{chunk-X2SUMO3P.js → chunk-P55BJZZW.js} +2 -1
  37. package/dist/{chunk-QNL7UI5G.js → chunk-Q6OYNEGR.js} +6 -6
  38. package/dist/{chunk-Y3YJKKEB.js → chunk-QDEETKYT.js} +5 -2
  39. package/dist/{chunk-XBMCDGHA.js → chunk-QHEWXU7I.js} +1 -1
  40. package/dist/chunk-R2XR4FCV.js +48 -0
  41. package/dist/chunk-R66W5UDG.js +26 -0
  42. package/dist/{chunk-65RQE3XF.js → chunk-SHQXMW4F.js} +1051 -380
  43. package/dist/{chunk-AK5E6ILJ.js → chunk-T3IPHEYJ.js} +1893 -305
  44. package/dist/{chunk-7E3FUTND.js → chunk-TOIXUWR6.js} +1 -1
  45. package/dist/{chunk-FFDAE2QI.js → chunk-TVRQ6AQI.js} +172 -26
  46. package/dist/{chunk-CN2HC4D4.js → chunk-UFTM5SZZ.js} +2 -2
  47. package/dist/{chunk-WFTNY755.js → chunk-VKIZUUPM.js} +1 -1
  48. package/dist/{chunk-KVJ3LFH2.js → chunk-VNFR57DF.js} +4 -24
  49. package/dist/{chunk-S66IQSSR.js → chunk-WF227UBV.js} +1 -1
  50. package/dist/{chunk-6NHCE7JM.js → chunk-Y4FWCG7Y.js} +159 -314
  51. package/dist/components/chat/index.d.ts +2 -1
  52. package/dist/components/chat/index.js +2 -2
  53. package/dist/components/index.d.ts +205 -11
  54. package/dist/components/index.js +51 -48
  55. package/dist/components/navigation/index.js +9 -9
  56. package/dist/execution/index.d.ts +2 -1
  57. package/dist/execution/index.js +1 -1
  58. package/dist/features/auth/index.d.ts +121 -0
  59. package/dist/features/auth/index.js +6 -6
  60. package/dist/features/clients/index.css +611 -0
  61. package/dist/features/clients/index.d.ts +86 -0
  62. package/dist/features/clients/index.js +719 -0
  63. package/dist/features/crm/index.d.ts +148 -2
  64. package/dist/features/crm/index.js +27 -25
  65. package/dist/features/dashboard/index.d.ts +36 -1
  66. package/dist/features/dashboard/index.js +23 -23
  67. package/dist/features/delivery/index.d.ts +121 -0
  68. package/dist/features/delivery/index.js +27 -25
  69. package/dist/features/knowledge/index.js +52 -29
  70. package/dist/features/lead-gen/index.d.ts +116 -12
  71. package/dist/features/lead-gen/index.js +28 -26
  72. package/dist/features/monitoring/index.js +26 -25
  73. package/dist/features/monitoring/requests/index.js +23 -22
  74. package/dist/features/operations/index.d.ts +38 -2
  75. package/dist/features/operations/index.js +32 -31
  76. package/dist/features/seo/index.js +1 -1
  77. package/dist/features/settings/index.d.ts +121 -0
  78. package/dist/features/settings/index.js +25 -24
  79. package/dist/graph/index.js +1 -1
  80. package/dist/hooks/delivery/index.d.ts +140 -0
  81. package/dist/hooks/delivery/index.js +4 -4
  82. package/dist/hooks/index.d.ts +844 -21
  83. package/dist/hooks/index.js +21 -21
  84. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +82 -1
  85. package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +1 -1
  86. package/dist/hooks/published.d.ts +844 -21
  87. package/dist/hooks/published.js +21 -21
  88. package/dist/index.d.ts +1056 -27
  89. package/dist/index.js +22 -22
  90. package/dist/initialization/index.d.ts +121 -0
  91. package/dist/initialization/index.js +5 -5
  92. package/dist/knowledge/index.d.ts +151 -1
  93. package/dist/knowledge/index.js +1692 -1039
  94. package/dist/layout/index.d.ts +6 -0
  95. package/dist/layout/index.js +4 -4
  96. package/dist/organization/index.js +5 -5
  97. package/dist/profile/index.d.ts +121 -0
  98. package/dist/profile/index.js +3 -3
  99. package/dist/provider/ElevasisServiceContext.d.ts +11 -5
  100. package/dist/provider/ElevasisServiceContext.js +2 -2
  101. package/dist/provider/index.d.ts +337 -7
  102. package/dist/provider/index.js +18 -18
  103. package/dist/provider/published.d.ts +337 -7
  104. package/dist/provider/published.js +14 -14
  105. package/dist/router/context.js +1 -1
  106. package/dist/router/index.js +1 -1
  107. package/dist/sse/index.js +1 -1
  108. package/dist/supabase/index.d.ts +232 -0
  109. package/dist/supabase/index.js +1 -1
  110. package/dist/test-utils/index.d.ts +3 -0
  111. package/dist/test-utils/index.js +31 -7
  112. package/dist/test-utils/setup-integration.js +1 -1
  113. package/dist/test-utils/setup.js +2 -2
  114. package/dist/theme/index.js +4 -4
  115. package/dist/theme/presets/index.js +2 -2
  116. package/dist/typeform/index.js +1 -1
  117. package/dist/typeform/schemas.js +1 -1
  118. package/dist/types/index.d.ts +204 -1
  119. package/dist/utils/index.d.ts +36 -1
  120. package/dist/utils/index.js +2 -2
  121. package/dist/vite/index.js +3 -3
  122. package/dist/vite-plugin-knowledge/index.js +2 -2
  123. package/dist/zustand/index.js +1 -1
  124. package/package.json +14 -5
  125. /package/dist/{chunk-HXZQWMKE.js → chunk-XQHZBA65.js} +0 -0
@@ -1,14 +1,14 @@
1
- import { observabilityKeys } from './chunk-VKMNWHTL.js';
2
- import { showApiErrorNotification, showSuccessNotification, projectKeys, noteKeys, taskKeys, milestoneKeys } from './chunk-CEHUFNAL.js';
1
+ import { observabilityKeys } from './chunk-6YT4IKJ7.js';
2
+ import { showApiErrorNotification, showSuccessNotification, projectKeys, noteKeys, taskKeys, milestoneKeys } from './chunk-7HMCB26R.js';
3
3
  import { useSupabase } from './chunk-BRXELOHC.js';
4
- import { useNotificationAdapter, deriveActions } from './chunk-OWESKPTJ.js';
5
- import { useOptionalElevasisFeatures } from './chunk-V3HUIZJX.js';
6
- import { HTTP_HEADERS } from './chunk-7E3FUTND.js';
7
- import { ResourceTypeSchema, NonEmptyStringSchema, OriginResourceTypeSchema, UuidSchema, CredentialNameSchema, STALE_TIME_DEFAULT, REFETCH_INTERVAL_DASHBOARD, STALE_TIME_MONITORING, getTimeRangeDates, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, STALE_TIME_ADMIN, APIClientError, GC_TIME_MEDIUM, GC_TIME_SHORT } from './chunk-HXZQWMKE.js';
8
- import { useStableAccessToken } from './chunk-WFTNY755.js';
9
- import { useInitialization } from './chunk-WKJ47GIW.js';
4
+ import { useOptionalElevasisFeatures } from './chunk-6IXOKUBC.js';
5
+ import { useNotificationAdapter, deriveActions } from './chunk-CQZ3DNQY.js';
6
+ import { HTTP_HEADERS } from './chunk-TOIXUWR6.js';
7
+ import { ResourceTypeSchema, NonEmptyStringSchema, OriginResourceTypeSchema, UuidSchema, CredentialNameSchema, STALE_TIME_DEFAULT, REFETCH_INTERVAL_DASHBOARD, STALE_TIME_MONITORING, getTimeRangeDates, REFETCH_INTERVAL_RUNNING, WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, STALE_TIME_ADMIN, APIClientError, GC_TIME_MEDIUM, GC_TIME_SHORT } from './chunk-XQHZBA65.js';
8
+ import { useStableAccessToken } from './chunk-VKIZUUPM.js';
9
+ import { useInitialization } from './chunk-533DUEQY.js';
10
10
  import { useOrganization } from './chunk-DD3CCMCZ.js';
11
- import { useElevasisServices } from './chunk-5WWZXCS5.js';
11
+ import { useElevasisServices } from './chunk-KJ3QUBNU.js';
12
12
  import { useAuthContext } from './chunk-BRJ3QZ4E.js';
13
13
  import { useMemo, useCallback, useState, useEffect, useId, useRef } from 'react';
14
14
  import { useQuery, useQueryClient, useMutation, useQueries } from '@tanstack/react-query';
@@ -29,7 +29,8 @@ var PERMISSIONS = {
29
29
  OPERATIONS_READ: "operations.read",
30
30
  OPERATIONS_MANAGE: "operations.manage",
31
31
  ACQUISITION_MANAGE: "acquisition.manage",
32
- PROJECTS_MANAGE: "projects.manage"
32
+ PROJECTS_MANAGE: "projects.manage",
33
+ CLIENTS_MANAGE: "clients.manage"
33
34
  };
34
35
  var PERMISSION_CATALOG = [
35
36
  {
@@ -81,6 +82,11 @@ var PERMISSION_CATALOG = [
81
82
  key: "projects.manage",
82
83
  description: "Create, update, and delete project records (prj_projects, prj_milestones, prj_tasks, prj_notes)",
83
84
  isOrgGrantable: false
85
+ },
86
+ {
87
+ key: "clients.manage",
88
+ description: "Create, update, and delete client hub records (clients, clt_* satellites)",
89
+ isOrgGrantable: false
84
90
  }
85
91
  ];
86
92
  new Set(PERMISSION_CATALOG.map((p) => p.key));
@@ -395,7 +401,7 @@ z.object({
395
401
  z.object({
396
402
  ids: z.array(UuidSchema).min(1).max(500)
397
403
  }).strict();
398
- var CredentialTypeSchema = z.enum(["oauth", "api-key", "webhook-secret", "api-key-secret"]);
404
+ var CredentialTypeSchema = z.enum(["oauth", "api-key", "webhook-secret", "api-key-secret", "clickup"]);
399
405
  var CredentialValueSchema = z.record(z.string(), z.unknown()).refine((val) => Object.keys(val).length > 0, { message: "Credential value must not be empty" }).refine((val) => Object.keys(val).length <= 50, { message: "Credential value has too many keys (max 50)" }).refine(
400
406
  (val) => {
401
407
  for (const v of Object.values(val)) {
@@ -442,25 +448,37 @@ var UpdateCredentialRequestSchema = z.object({
442
448
  var DeleteCredentialParamsSchema = z.object({
443
449
  credentialId: UuidSchema
444
450
  });
451
+ var VerifyCredentialParamsSchema = z.object({
452
+ credentialId: UuidSchema
453
+ });
454
+ var VerifyCredentialResponseSchema = z.object({
455
+ ok: z.boolean(),
456
+ provider: z.string(),
457
+ checkedAt: z.string().datetime(),
458
+ message: z.string().optional(),
459
+ details: z.record(z.string(), z.unknown()).optional()
460
+ });
445
461
  var CredentialSchemas = {
446
462
  CreateRequest: CreateCredentialRequestSchema,
447
463
  CreateResponse: CreateCredentialResponseSchema,
448
464
  ListResponse: ListCredentialsResponseSchema,
449
465
  UpdateParams: UpdateCredentialParamsSchema,
450
466
  UpdateRequest: UpdateCredentialRequestSchema,
451
- DeleteParams: DeleteCredentialParamsSchema
467
+ DeleteParams: DeleteCredentialParamsSchema,
468
+ VerifyParams: VerifyCredentialParamsSchema,
469
+ VerifyResponse: VerifyCredentialResponseSchema
452
470
  };
453
471
 
454
472
  // src/hooks/auth/useOrganizationPermissions.ts
455
473
  var ALL_PERMISSIONS = Object.values(PERMISSIONS);
456
474
  function useOrganizationPermissions() {
457
- const { apiRequest, organizationId, isReady } = useElevasisServices();
475
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
458
476
  const { profile } = useInitialization();
459
477
  const isPlatformAdmin = profile?.is_platform_admin === true;
460
478
  const query = useQuery({
461
- queryKey: ["organization-permissions", organizationId],
462
- queryFn: () => apiRequest(`/memberships/my-permissions/${organizationId}`),
463
- enabled: isReady && !!organizationId && !isPlatformAdmin,
479
+ queryKey: ["organization-permissions", workOSOrganizationId],
480
+ queryFn: () => apiRequest(`/memberships/my-permissions/${workOSOrganizationId}`),
481
+ enabled: isReady && !!workOSOrganizationId && !isPlatformAdmin,
464
482
  staleTime: STALE_TIME_DEFAULT
465
483
  });
466
484
  const permissions = useMemo(
@@ -493,9 +511,9 @@ var executionsKeys = {
493
511
  execution: (orgId, resourceId, executionId) => [...executionsKeys.all, "execution", orgId, resourceId, executionId]
494
512
  };
495
513
  function useExecutions(resourceId, resourceStatus, limit, offset) {
496
- const { apiRequest, organizationId, isReady } = useElevasisServices();
514
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
497
515
  return useQuery({
498
- queryKey: executionsKeys.executions(organizationId, resourceId, resourceStatus, limit, offset),
516
+ queryKey: executionsKeys.executions(workOSOrganizationId, resourceId, resourceStatus, limit, offset),
499
517
  queryFn: async () => {
500
518
  const params = new URLSearchParams();
501
519
  if (resourceStatus && resourceStatus !== "all") {
@@ -514,11 +532,39 @@ function useExecutions(resourceId, resourceStatus, limit, offset) {
514
532
  enabled: isReady && !!resourceId
515
533
  });
516
534
  }
535
+ function useInFlightExecutions(resourceId, options = {}) {
536
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
537
+ const limit = options.limit ?? 20;
538
+ const offset = options.offset ?? 0;
539
+ return useQuery({
540
+ queryKey: [
541
+ ...executionsKeys.executions(workOSOrganizationId, resourceId, "all", limit, offset),
542
+ "in-flight"
543
+ ],
544
+ queryFn: async () => {
545
+ const params = new URLSearchParams({
546
+ limit: String(limit),
547
+ offset: String(offset)
548
+ });
549
+ const response = await apiRequest(
550
+ `/execution-engine/executions/${resourceId}?${params.toString()}`
551
+ );
552
+ const executions = response.executions.filter((execution) => execution.status === "running");
553
+ return {
554
+ ...response,
555
+ executions,
556
+ total: executions.length
557
+ };
558
+ },
559
+ enabled: isReady && !!resourceId && (options.enabled ?? true),
560
+ refetchInterval: options.refetchInterval
561
+ });
562
+ }
517
563
  var REFETCH_INTERVAL_RUNNING2 = 2e3;
518
564
  function useExecution(resourceId, executionId) {
519
- const { apiRequest, organizationId, isReady } = useElevasisServices();
565
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
520
566
  return useQuery({
521
- queryKey: executionsKeys.execution(organizationId, resourceId, executionId),
567
+ queryKey: executionsKeys.execution(workOSOrganizationId, resourceId, executionId),
522
568
  queryFn: () => apiRequest(`/execution-engine/executions/${resourceId}/${executionId}`),
523
569
  enabled: isReady && !!resourceId && !!executionId,
524
570
  refetchInterval: (query) => {
@@ -528,7 +574,7 @@ function useExecution(resourceId, executionId) {
528
574
  });
529
575
  }
530
576
  function useExecuteAsync() {
531
- const { apiRequest, organizationId } = useElevasisServices();
577
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
532
578
  const queryClient = useQueryClient();
533
579
  return useMutation({
534
580
  mutationFn: async ({ resourceId, resourceType, input }) => {
@@ -540,21 +586,21 @@ function useExecuteAsync() {
540
586
  },
541
587
  onSuccess: (data) => {
542
588
  queryClient.invalidateQueries({
543
- queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
589
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, data.resourceId)
544
590
  });
545
591
  }
546
592
  });
547
593
  }
548
594
  function useCreateOrgRole() {
549
- const { apiRequest, organizationId } = useElevasisServices();
595
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
550
596
  const queryClient = useQueryClient();
551
597
  return useMutation({
552
- mutationFn: (input) => apiRequest(`/organizations/${organizationId}/roles`, {
598
+ mutationFn: (input) => apiRequest(`/organizations/${workOSOrganizationId}/roles`, {
553
599
  method: "POST",
554
600
  body: JSON.stringify(input)
555
601
  }),
556
602
  onSettled: () => {
557
- queryClient.invalidateQueries({ queryKey: ["org-roles", organizationId] });
603
+ queryClient.invalidateQueries({ queryKey: ["org-roles", workOSOrganizationId] });
558
604
  }
559
605
  });
560
606
  }
@@ -569,12 +615,12 @@ function usePermissionCatalog() {
569
615
  });
570
616
  }
571
617
  function useResourcesHealth(params) {
572
- const { apiRequest, isReady, organizationId } = useElevasisServices();
618
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
573
619
  const resourcesKey = params.resources.map((r) => `${r.entityType}-${r.entityId}`).join(",");
574
620
  return useQuery({
575
621
  // eslint-disable-next-line @tanstack/query/exhaustive-deps -- resourcesKey is derived from params.resources
576
622
  queryKey: observabilityKeys.resourcesHealth(
577
- organizationId,
623
+ workOSOrganizationId,
578
624
  resourcesKey,
579
625
  params.startDate,
580
626
  params.endDate,
@@ -596,9 +642,9 @@ function useResourcesHealth(params) {
596
642
  });
597
643
  }
598
644
  function useErrorDetails(filters) {
599
- const { apiRequest, isReady, organizationId } = useElevasisServices();
645
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
600
646
  return useQuery({
601
- queryKey: observabilityKeys.errorDetails(organizationId, filters),
647
+ queryKey: observabilityKeys.errorDetails(workOSOrganizationId, filters),
602
648
  queryFn: async () => {
603
649
  const params = new URLSearchParams();
604
650
  if (filters.errorType) params.append("errorType", filters.errorType);
@@ -619,9 +665,9 @@ function useErrorDetails(filters) {
619
665
  });
620
666
  }
621
667
  function useErrorDetail(executionId) {
622
- const { apiRequest, isReady, organizationId } = useElevasisServices();
668
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
623
669
  return useQuery({
624
- queryKey: observabilityKeys.errorDetail(organizationId, executionId),
670
+ queryKey: observabilityKeys.errorDetail(workOSOrganizationId, executionId),
625
671
  queryFn: async () => {
626
672
  if (!executionId) return null;
627
673
  const response = await apiRequest(`/observability/error-details/${executionId}`);
@@ -775,9 +821,9 @@ var ApiKeyService = class {
775
821
  }
776
822
  };
777
823
  function useListApiKeys() {
778
- const { apiRequest, organizationId, isReady } = useElevasisServices();
824
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
779
825
  return useQuery({
780
- queryKey: ["api-keys", organizationId],
826
+ queryKey: ["api-keys", workOSOrganizationId],
781
827
  queryFn: async () => {
782
828
  const service = new ApiKeyService(apiRequest);
783
829
  return await service.listApiKeys();
@@ -901,11 +947,21 @@ var CredentialService = class {
901
947
  method: "DELETE"
902
948
  });
903
949
  }
950
+ /**
951
+ * Verify a credential server-side without exposing secret material
952
+ */
953
+ async verifyCredential(credentialId) {
954
+ CredentialSchemas.VerifyParams.parse({ credentialId });
955
+ const response = await this.apiRequest(`/credentials/${credentialId}/verify`, {
956
+ method: "POST"
957
+ });
958
+ return CredentialSchemas.VerifyResponse.parse(response);
959
+ }
904
960
  };
905
961
  function useCredentials() {
906
- const { apiRequest, organizationId, isReady } = useElevasisServices();
962
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
907
963
  return useQuery({
908
- queryKey: ["credentials", organizationId],
964
+ queryKey: ["credentials", workOSOrganizationId],
909
965
  queryFn: async () => {
910
966
  const service = new CredentialService(apiRequest);
911
967
  return await service.listCredentials();
@@ -913,6 +969,15 @@ function useCredentials() {
913
969
  enabled: isReady
914
970
  });
915
971
  }
972
+ function useVerifyCredential() {
973
+ const { apiRequest } = useElevasisServices();
974
+ return useMutation({
975
+ mutationFn: async (credentialId) => {
976
+ const service = new CredentialService(apiRequest);
977
+ return await service.verifyCredential(credentialId);
978
+ }
979
+ });
980
+ }
916
981
  function useCreateCredential() {
917
982
  const { apiRequest } = useElevasisServices();
918
983
  const adapter = useNotificationAdapter();
@@ -1017,7 +1082,7 @@ var DeploymentService = class {
1017
1082
 
1018
1083
  // src/hooks/settings/deployments/useDeploymentActions.ts
1019
1084
  function useActivateDeployment() {
1020
- const { apiRequest, organizationId } = useElevasisServices();
1085
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1021
1086
  const queryClient = useQueryClient();
1022
1087
  const showError = useErrorNotification();
1023
1088
  return useMutation({
@@ -1026,7 +1091,7 @@ function useActivateDeployment() {
1026
1091
  return service.activateDeployment(deploymentId);
1027
1092
  },
1028
1093
  onSuccess: () => {
1029
- queryClient.invalidateQueries({ queryKey: ["deployments", organizationId] });
1094
+ queryClient.invalidateQueries({ queryKey: ["deployments", workOSOrganizationId] });
1030
1095
  notifications.show({ title: "Success", message: "Deployment activated", color: "teal" });
1031
1096
  },
1032
1097
  onError: (error) => {
@@ -1036,7 +1101,7 @@ function useActivateDeployment() {
1036
1101
  });
1037
1102
  }
1038
1103
  function useDeactivateDeployment() {
1039
- const { apiRequest, organizationId } = useElevasisServices();
1104
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1040
1105
  const queryClient = useQueryClient();
1041
1106
  const showError = useErrorNotification();
1042
1107
  return useMutation({
@@ -1045,7 +1110,7 @@ function useDeactivateDeployment() {
1045
1110
  return service.deactivateDeployment(deploymentId);
1046
1111
  },
1047
1112
  onSuccess: () => {
1048
- queryClient.invalidateQueries({ queryKey: ["deployments", organizationId] });
1113
+ queryClient.invalidateQueries({ queryKey: ["deployments", workOSOrganizationId] });
1049
1114
  notifications.show({ title: "Success", message: "Deployment deactivated", color: "teal" });
1050
1115
  },
1051
1116
  onError: (error) => {
@@ -1055,7 +1120,7 @@ function useDeactivateDeployment() {
1055
1120
  });
1056
1121
  }
1057
1122
  function useDeleteDeployment() {
1058
- const { apiRequest, organizationId } = useElevasisServices();
1123
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1059
1124
  const queryClient = useQueryClient();
1060
1125
  const showError = useErrorNotification();
1061
1126
  return useMutation({
@@ -1064,7 +1129,7 @@ function useDeleteDeployment() {
1064
1129
  return service.deleteDeployment(deploymentId);
1065
1130
  },
1066
1131
  onSuccess: () => {
1067
- queryClient.invalidateQueries({ queryKey: ["deployments", organizationId] });
1132
+ queryClient.invalidateQueries({ queryKey: ["deployments", workOSOrganizationId] });
1068
1133
  notifications.show({ title: "Success", message: "Deployment deleted", color: "teal" });
1069
1134
  },
1070
1135
  onError: (error) => {
@@ -1074,9 +1139,9 @@ function useDeleteDeployment() {
1074
1139
  });
1075
1140
  }
1076
1141
  function useListDeployments() {
1077
- const { apiRequest, organizationId, isReady } = useElevasisServices();
1142
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
1078
1143
  return useQuery({
1079
- queryKey: ["deployments", organizationId],
1144
+ queryKey: ["deployments", workOSOrganizationId],
1080
1145
  queryFn: async () => {
1081
1146
  const service = new DeploymentService(apiRequest);
1082
1147
  return await service.listDeployments();
@@ -1089,9 +1154,9 @@ function useListDeployments() {
1089
1154
  });
1090
1155
  }
1091
1156
  function useScheduledTasks(options = {}) {
1092
- const { apiRequest, organizationId, isReady } = useElevasisServices();
1157
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
1093
1158
  return useQuery({
1094
- queryKey: ["schedules", "dashboard", organizationId, options.status, options.targetResourceType],
1159
+ queryKey: ["schedules", "dashboard", workOSOrganizationId, options.status, options.targetResourceType],
1095
1160
  queryFn: async () => {
1096
1161
  const params = new URLSearchParams();
1097
1162
  if (options.status) params.append("status", options.status);
@@ -1117,9 +1182,9 @@ var scheduleKeys = {
1117
1182
  executions: (orgId, id) => [...scheduleKeys.detail(orgId, id), "executions"]
1118
1183
  };
1119
1184
  function useListSchedules(filters) {
1120
- const { apiRequest, organizationId, isReady } = useElevasisServices();
1185
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
1121
1186
  return useQuery({
1122
- queryKey: scheduleKeys.list(organizationId, filters),
1187
+ queryKey: scheduleKeys.list(workOSOrganizationId, filters),
1123
1188
  queryFn: async () => {
1124
1189
  const params = new URLSearchParams();
1125
1190
  if (filters?.status) params.set("status", filters.status);
@@ -1135,9 +1200,9 @@ function useListSchedules(filters) {
1135
1200
  });
1136
1201
  }
1137
1202
  function useGetSchedule(id) {
1138
- const { apiRequest, organizationId, isReady } = useElevasisServices();
1203
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
1139
1204
  return useQuery({
1140
- queryKey: scheduleKeys.detail(organizationId, id),
1205
+ queryKey: scheduleKeys.detail(workOSOrganizationId, id),
1141
1206
  queryFn: async () => {
1142
1207
  const data = await apiRequest(`/task-scheduler/schedules/${id}`);
1143
1208
  return data.schedule;
@@ -1146,9 +1211,9 @@ function useGetSchedule(id) {
1146
1211
  });
1147
1212
  }
1148
1213
  function useGetExecutionHistory(scheduleId, options) {
1149
- const { apiRequest, organizationId, isReady } = useElevasisServices();
1214
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
1150
1215
  return useQuery({
1151
- queryKey: [...scheduleKeys.executions(organizationId, scheduleId), options?.limit, options?.offset],
1216
+ queryKey: [...scheduleKeys.executions(workOSOrganizationId, scheduleId), options?.limit, options?.offset],
1152
1217
  queryFn: async () => {
1153
1218
  const params = new URLSearchParams();
1154
1219
  if (options?.limit) params.set("limit", String(options.limit));
@@ -1162,7 +1227,7 @@ function useGetExecutionHistory(scheduleId, options) {
1162
1227
  }
1163
1228
  function useCreateSchedule() {
1164
1229
  const queryClient = useQueryClient();
1165
- const { apiRequest, organizationId } = useElevasisServices();
1230
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1166
1231
  return useMutation({
1167
1232
  mutationFn: async (input) => {
1168
1233
  const validated = CreateScheduleRequestSchema.parse(input);
@@ -1173,13 +1238,13 @@ function useCreateSchedule() {
1173
1238
  return data.schedule;
1174
1239
  },
1175
1240
  onSuccess: () => {
1176
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1241
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1177
1242
  }
1178
1243
  });
1179
1244
  }
1180
1245
  function useUpdateSchedule() {
1181
1246
  const queryClient = useQueryClient();
1182
- const { apiRequest, organizationId } = useElevasisServices();
1247
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1183
1248
  return useMutation({
1184
1249
  mutationFn: async ({ id, ...fields }) => {
1185
1250
  GetScheduleParamsSchema.parse({ id });
@@ -1192,15 +1257,15 @@ function useUpdateSchedule() {
1192
1257
  },
1193
1258
  onSuccess: (_, variables) => {
1194
1259
  queryClient.invalidateQueries({
1195
- queryKey: scheduleKeys.detail(organizationId, variables.id)
1260
+ queryKey: scheduleKeys.detail(workOSOrganizationId, variables.id)
1196
1261
  });
1197
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1262
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1198
1263
  }
1199
1264
  });
1200
1265
  }
1201
1266
  function useUpdateAnchor() {
1202
1267
  const queryClient = useQueryClient();
1203
- const { apiRequest, organizationId } = useElevasisServices();
1268
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1204
1269
  return useMutation({
1205
1270
  mutationFn: async ({ id, anchorAt }) => {
1206
1271
  GetScheduleParamsSchema.parse({ id });
@@ -1213,15 +1278,15 @@ function useUpdateAnchor() {
1213
1278
  },
1214
1279
  onSuccess: (_, variables) => {
1215
1280
  queryClient.invalidateQueries({
1216
- queryKey: scheduleKeys.detail(organizationId, variables.id)
1281
+ queryKey: scheduleKeys.detail(workOSOrganizationId, variables.id)
1217
1282
  });
1218
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1283
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1219
1284
  }
1220
1285
  });
1221
1286
  }
1222
1287
  function usePauseSchedule() {
1223
1288
  const queryClient = useQueryClient();
1224
- const { apiRequest, organizationId } = useElevasisServices();
1289
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1225
1290
  return useMutation({
1226
1291
  mutationFn: async (id) => {
1227
1292
  GetScheduleParamsSchema.parse({ id });
@@ -1231,14 +1296,14 @@ function usePauseSchedule() {
1231
1296
  return data.schedule;
1232
1297
  },
1233
1298
  onSuccess: (_, id) => {
1234
- queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(organizationId, id) });
1235
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1299
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
1300
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1236
1301
  }
1237
1302
  });
1238
1303
  }
1239
1304
  function useResumeSchedule() {
1240
1305
  const queryClient = useQueryClient();
1241
- const { apiRequest, organizationId } = useElevasisServices();
1306
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1242
1307
  return useMutation({
1243
1308
  mutationFn: async (id) => {
1244
1309
  GetScheduleParamsSchema.parse({ id });
@@ -1248,14 +1313,14 @@ function useResumeSchedule() {
1248
1313
  return data.schedule;
1249
1314
  },
1250
1315
  onSuccess: (_, id) => {
1251
- queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(organizationId, id) });
1252
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1316
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
1317
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1253
1318
  }
1254
1319
  });
1255
1320
  }
1256
1321
  function useCancelSchedule() {
1257
1322
  const queryClient = useQueryClient();
1258
- const { apiRequest, organizationId } = useElevasisServices();
1323
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1259
1324
  return useMutation({
1260
1325
  mutationFn: async (id) => {
1261
1326
  GetScheduleParamsSchema.parse({ id });
@@ -1265,22 +1330,22 @@ function useCancelSchedule() {
1265
1330
  return data.schedule;
1266
1331
  },
1267
1332
  onSuccess: (_, id) => {
1268
- queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(organizationId, id) });
1269
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1333
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
1334
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1270
1335
  }
1271
1336
  });
1272
1337
  }
1273
1338
  function useDeleteSchedule() {
1274
1339
  const queryClient = useQueryClient();
1275
- const { apiRequest, organizationId } = useElevasisServices();
1340
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1276
1341
  return useMutation({
1277
1342
  mutationFn: async (id) => {
1278
1343
  GetScheduleParamsSchema.parse({ id });
1279
1344
  await apiRequest(`/task-scheduler/schedules/${id}`, { method: "DELETE" });
1280
1345
  },
1281
1346
  onSuccess: (_, id) => {
1282
- queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(organizationId, id) });
1283
- queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(organizationId) });
1347
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.detail(workOSOrganizationId, id) });
1348
+ queryClient.invalidateQueries({ queryKey: scheduleKeys.lists(workOSOrganizationId) });
1284
1349
  }
1285
1350
  });
1286
1351
  }
@@ -1387,9 +1452,9 @@ var OperationsService = class {
1387
1452
 
1388
1453
  // src/hooks/executions/useResources.ts
1389
1454
  function useResources() {
1390
- const { apiRequest, organizationId, isReady } = useElevasisServices();
1455
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
1391
1456
  return useQuery({
1392
- queryKey: executionsKeys.resources(organizationId),
1457
+ queryKey: executionsKeys.resources(workOSOrganizationId),
1393
1458
  queryFn: async () => {
1394
1459
  const service = new OperationsService(apiRequest);
1395
1460
  const result = await service.getResources();
@@ -1412,12 +1477,12 @@ function useCommandQueue({
1412
1477
  priorityMin,
1413
1478
  priorityMax
1414
1479
  } = {}) {
1415
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1480
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1416
1481
  return useQuery({
1417
1482
  queryKey: [
1418
1483
  "command-queue",
1419
1484
  "list",
1420
- organizationId,
1485
+ workOSOrganizationId,
1421
1486
  status,
1422
1487
  humanCheckpoint,
1423
1488
  timeRange,
@@ -1547,9 +1612,9 @@ function useCommandQueueTotals({
1547
1612
  priorityMax,
1548
1613
  status
1549
1614
  } = {}) {
1550
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1615
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1551
1616
  return useQuery({
1552
- queryKey: ["command-queue", "checkpoints", organizationId, timeRange, priorityMin, priorityMax, status],
1617
+ queryKey: ["command-queue", "checkpoints", workOSOrganizationId, timeRange, priorityMin, priorityMax, status],
1553
1618
  queryFn: async () => {
1554
1619
  const params = new URLSearchParams();
1555
1620
  params.set("timeRange", timeRange);
@@ -1630,10 +1695,10 @@ var dealKeys = {
1630
1695
  detail: (id) => [...dealKeys.all, "detail", id]
1631
1696
  };
1632
1697
  function useDeals(filters = {}) {
1633
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1698
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1634
1699
  const normalizedFilters = normalizeDealFilters(filters);
1635
1700
  const query = useQuery({
1636
- queryKey: dealKeys.list(organizationId, normalizedFilters),
1701
+ queryKey: dealKeys.list(workOSOrganizationId, normalizedFilters),
1637
1702
  queryFn: async () => {
1638
1703
  const params = new URLSearchParams();
1639
1704
  if (normalizedFilters.stage) params.set("stage", normalizedFilters.stage);
@@ -1678,9 +1743,9 @@ function useDeals(filters = {}) {
1678
1743
  };
1679
1744
  }
1680
1745
  function useDealsSummary() {
1681
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1746
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1682
1747
  return useQuery({
1683
- queryKey: dealKeys.summary(organizationId),
1748
+ queryKey: dealKeys.summary(workOSOrganizationId),
1684
1749
  queryFn: async () => {
1685
1750
  return apiRequest("/deals/summary");
1686
1751
  },
@@ -1688,10 +1753,10 @@ function useDealsSummary() {
1688
1753
  });
1689
1754
  }
1690
1755
  function useDealsLookup(filters = {}, options) {
1691
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1756
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1692
1757
  const normalizedFilters = normalizeLookupFilters(filters);
1693
1758
  return useQuery({
1694
- queryKey: dealKeys.lookup(organizationId, normalizedFilters),
1759
+ queryKey: dealKeys.lookup(workOSOrganizationId, normalizedFilters),
1695
1760
  queryFn: async () => {
1696
1761
  const params = new URLSearchParams();
1697
1762
  if (normalizedFilters.search) params.set("search", normalizedFilters.search);
@@ -1702,14 +1767,14 @@ function useDealsLookup(filters = {}, options) {
1702
1767
  });
1703
1768
  }
1704
1769
  function useDeleteDeal() {
1705
- const { apiRequest, organizationId } = useElevasisServices();
1770
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1706
1771
  const queryClient = useQueryClient();
1707
1772
  return useMutation({
1708
1773
  mutationFn: async (dealId) => {
1709
1774
  await apiRequest(`/deals/${dealId}`, { method: "DELETE" });
1710
1775
  },
1711
1776
  onSuccess: (_, dealId) => {
1712
- queryClient.removeQueries({ queryKey: ["deal-detail", organizationId, dealId], exact: true });
1777
+ queryClient.removeQueries({ queryKey: ["deal-detail", workOSOrganizationId, dealId], exact: true });
1713
1778
  queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
1714
1779
  queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
1715
1780
  queryClient.invalidateQueries({ queryKey: dealKeys.lookups() });
@@ -1720,7 +1785,7 @@ function useDeleteDeal() {
1720
1785
  });
1721
1786
  }
1722
1787
  function useTransitionItem() {
1723
- const { apiRequest, organizationId } = useElevasisServices();
1788
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1724
1789
  const queryClient = useQueryClient();
1725
1790
  return useMutation({
1726
1791
  mutationFn: async (input) => {
@@ -1739,7 +1804,7 @@ function useTransitionItem() {
1739
1804
  onSuccess: (_, variables) => {
1740
1805
  queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
1741
1806
  queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
1742
- queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
1807
+ queryClient.invalidateQueries({ queryKey: ["deal-detail", workOSOrganizationId, variables.dealId] });
1743
1808
  },
1744
1809
  onError: (error) => {
1745
1810
  queryClient.invalidateQueries({ queryKey: dealKeys.all });
@@ -1753,9 +1818,9 @@ var dealTaskKeys = {
1753
1818
  due: (orgId, window, assigneeUserId) => ["deal-tasks-due", orgId, window, assigneeUserId]
1754
1819
  };
1755
1820
  function useDealTasks(dealId) {
1756
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1821
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1757
1822
  return useQuery({
1758
- queryKey: dealTaskKeys.list(organizationId, dealId ?? ""),
1823
+ queryKey: dealTaskKeys.list(workOSOrganizationId, dealId ?? ""),
1759
1824
  queryFn: async () => {
1760
1825
  return apiRequest(`/deals/${dealId}/tasks`);
1761
1826
  },
@@ -1763,11 +1828,11 @@ function useDealTasks(dealId) {
1763
1828
  });
1764
1829
  }
1765
1830
  function useDealTasksDue(opts) {
1766
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1831
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1767
1832
  const window = opts?.window ?? "today_and_overdue";
1768
1833
  const assigneeUserId = opts?.assigneeUserId ?? null;
1769
1834
  return useQuery({
1770
- queryKey: dealTaskKeys.due(organizationId, window, assigneeUserId),
1835
+ queryKey: dealTaskKeys.due(workOSOrganizationId, window, assigneeUserId),
1771
1836
  queryFn: async () => {
1772
1837
  const params = new URLSearchParams({ window });
1773
1838
  if (assigneeUserId) params.set("assigneeUserId", assigneeUserId);
@@ -1777,7 +1842,7 @@ function useDealTasksDue(opts) {
1777
1842
  });
1778
1843
  }
1779
1844
  function useCreateDealTask() {
1780
- const { apiRequest, organizationId } = useElevasisServices();
1845
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1781
1846
  const queryClient = useQueryClient();
1782
1847
  return useMutation({
1783
1848
  mutationFn: async (params) => {
@@ -1794,8 +1859,8 @@ function useCreateDealTask() {
1794
1859
  });
1795
1860
  },
1796
1861
  onSuccess: (_, variables) => {
1797
- queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
1798
- queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
1862
+ queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(workOSOrganizationId, variables.dealId) });
1863
+ queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", workOSOrganizationId] });
1799
1864
  showSuccessNotification("Task created");
1800
1865
  },
1801
1866
  onError: (error) => {
@@ -1804,7 +1869,7 @@ function useCreateDealTask() {
1804
1869
  });
1805
1870
  }
1806
1871
  function useCompleteDealTask() {
1807
- const { apiRequest, organizationId } = useElevasisServices();
1872
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
1808
1873
  const queryClient = useQueryClient();
1809
1874
  return useMutation({
1810
1875
  mutationFn: async ({ taskId, dealId }) => {
@@ -1813,8 +1878,8 @@ function useCompleteDealTask() {
1813
1878
  });
1814
1879
  },
1815
1880
  onSuccess: (_, variables) => {
1816
- queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(organizationId, variables.dealId) });
1817
- queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", organizationId] });
1881
+ queryClient.invalidateQueries({ queryKey: dealTaskKeys.list(workOSOrganizationId, variables.dealId) });
1882
+ queryClient.invalidateQueries({ queryKey: ["deal-tasks-due", workOSOrganizationId] });
1818
1883
  showSuccessNotification("Task completed");
1819
1884
  },
1820
1885
  onError: (error) => {
@@ -1838,9 +1903,9 @@ function buildQueryString(params) {
1838
1903
  return queryString ? `?${queryString}` : "";
1839
1904
  }
1840
1905
  function useCompanies(filters = {}) {
1841
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1906
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1842
1907
  return useQuery({
1843
- queryKey: companyKeys.list(organizationId, filters),
1908
+ queryKey: companyKeys.list(workOSOrganizationId, filters),
1844
1909
  queryFn: async () => {
1845
1910
  const queryString = buildQueryString({
1846
1911
  listId: filters.listId,
@@ -1857,26 +1922,26 @@ function useCompanies(filters = {}) {
1857
1922
  });
1858
1923
  return apiRequest(`/acquisition/companies${queryString}`);
1859
1924
  },
1860
- enabled: isReady && !!organizationId
1925
+ enabled: isReady && !!workOSOrganizationId
1861
1926
  });
1862
1927
  }
1863
1928
  function useCompanyFacets() {
1864
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1929
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1865
1930
  return useQuery({
1866
- queryKey: companyKeys.facets(organizationId),
1931
+ queryKey: companyKeys.facets(workOSOrganizationId),
1867
1932
  queryFn: () => apiRequest("/acquisition/companies/facets"),
1868
- enabled: isReady && !!organizationId
1933
+ enabled: isReady && !!workOSOrganizationId
1869
1934
  });
1870
1935
  }
1871
1936
  function useCompany(companyId) {
1872
- const { apiRequest, isReady, organizationId } = useElevasisServices();
1937
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1873
1938
  return useQuery({
1874
- queryKey: companyKeys.detail(organizationId, companyId),
1939
+ queryKey: companyKeys.detail(workOSOrganizationId, companyId),
1875
1940
  queryFn: async () => {
1876
1941
  if (!companyId) return null;
1877
1942
  return apiRequest(`/acquisition/companies/${companyId}`);
1878
1943
  },
1879
- enabled: isReady && !!organizationId && !!companyId
1944
+ enabled: isReady && !!workOSOrganizationId && !!companyId
1880
1945
  });
1881
1946
  }
1882
1947
  function useCreateCompany() {
@@ -1958,9 +2023,9 @@ function buildQueryString2(params) {
1958
2023
  return queryString ? `?${queryString}` : "";
1959
2024
  }
1960
2025
  function useContacts(filters = {}) {
1961
- const { apiRequest, isReady, organizationId } = useElevasisServices();
2026
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1962
2027
  return useQuery({
1963
- queryKey: contactKeys.list(organizationId, filters),
2028
+ queryKey: contactKeys.list(workOSOrganizationId, filters),
1964
2029
  queryFn: async () => {
1965
2030
  const queryString = buildQueryString2({
1966
2031
  listId: filters.listId,
@@ -1973,18 +2038,18 @@ function useContacts(filters = {}) {
1973
2038
  });
1974
2039
  return apiRequest(`/acquisition/contacts${queryString}`);
1975
2040
  },
1976
- enabled: isReady && !!organizationId
2041
+ enabled: isReady && !!workOSOrganizationId
1977
2042
  });
1978
2043
  }
1979
2044
  function useContact(contactId) {
1980
- const { apiRequest, isReady, organizationId } = useElevasisServices();
2045
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
1981
2046
  return useQuery({
1982
- queryKey: contactKeys.detail(organizationId, contactId),
2047
+ queryKey: contactKeys.detail(workOSOrganizationId, contactId),
1983
2048
  queryFn: async () => {
1984
2049
  if (!contactId) return null;
1985
2050
  return apiRequest(`/acquisition/contacts/${contactId}`);
1986
2051
  },
1987
- enabled: isReady && !!organizationId && !!contactId
2052
+ enabled: isReady && !!workOSOrganizationId && !!contactId
1988
2053
  });
1989
2054
  }
1990
2055
  function useCreateContact() {
@@ -2056,9 +2121,9 @@ var leadGenArtifactKeys = {
2056
2121
  list: (organizationId, ownerKind, ownerId) => [...leadGenArtifactKeys.all, organizationId, ownerKind, ownerId]
2057
2122
  };
2058
2123
  function useArtifacts({ ownerKind, ownerId }) {
2059
- const { apiRequest, isReady, organizationId } = useElevasisServices();
2124
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2060
2125
  return useQuery({
2061
- queryKey: leadGenArtifactKeys.list(organizationId, ownerKind, ownerId),
2126
+ queryKey: leadGenArtifactKeys.list(workOSOrganizationId, ownerKind, ownerId),
2062
2127
  queryFn: () => apiRequest(
2063
2128
  `/acquisition/artifacts?ownerKind=${encodeURIComponent(ownerKind)}&ownerId=${encodeURIComponent(ownerId)}`
2064
2129
  ),
@@ -2066,7 +2131,7 @@ function useArtifacts({ ownerKind, ownerId }) {
2066
2131
  });
2067
2132
  }
2068
2133
  function useCreateArtifact() {
2069
- const { apiRequest, organizationId } = useElevasisServices();
2134
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
2070
2135
  const queryClient = useQueryClient();
2071
2136
  return useMutation({
2072
2137
  mutationFn: (body) => apiRequest("/acquisition/artifacts", {
@@ -2075,7 +2140,7 @@ function useCreateArtifact() {
2075
2140
  }),
2076
2141
  onSuccess: (_, variables) => {
2077
2142
  queryClient.invalidateQueries({
2078
- queryKey: leadGenArtifactKeys.list(organizationId, variables.ownerKind, variables.ownerId)
2143
+ queryKey: leadGenArtifactKeys.list(workOSOrganizationId, variables.ownerKind, variables.ownerId)
2079
2144
  });
2080
2145
  showSuccessNotification("Artifact created");
2081
2146
  },
@@ -2090,23 +2155,23 @@ var leadGenListMemberKeys = {
2090
2155
  detail: (organizationId, memberId) => [...leadGenListMemberKeys.all, organizationId, "detail", memberId]
2091
2156
  };
2092
2157
  function useListMembers({ listId }) {
2093
- const { apiRequest, isReady, organizationId } = useElevasisServices();
2158
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2094
2159
  return useQuery({
2095
- queryKey: leadGenListMemberKeys.list(organizationId, listId),
2160
+ queryKey: leadGenListMemberKeys.list(workOSOrganizationId, listId),
2096
2161
  queryFn: () => apiRequest(`/acquisition/lists/${listId}/members`),
2097
2162
  enabled: isReady && !!listId
2098
2163
  });
2099
2164
  }
2100
2165
  function useListMember(memberId) {
2101
- const { apiRequest, isReady, organizationId } = useElevasisServices();
2166
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2102
2167
  return useQuery({
2103
- queryKey: leadGenListMemberKeys.detail(organizationId, memberId),
2168
+ queryKey: leadGenListMemberKeys.detail(workOSOrganizationId, memberId),
2104
2169
  queryFn: () => apiRequest(`/acquisition/list-members/${memberId}`),
2105
2170
  enabled: isReady && !!memberId
2106
2171
  });
2107
2172
  }
2108
2173
  function useTransitionListMember() {
2109
- const { apiRequest, organizationId } = useElevasisServices();
2174
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
2110
2175
  const queryClient = useQueryClient();
2111
2176
  return useMutation({
2112
2177
  mutationFn: async (input) => {
@@ -2123,9 +2188,11 @@ function useTransitionListMember() {
2123
2188
  });
2124
2189
  },
2125
2190
  onSuccess: (_, variables) => {
2126
- queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.detail(organizationId, variables.memberId) });
2191
+ queryClient.invalidateQueries({
2192
+ queryKey: leadGenListMemberKeys.detail(workOSOrganizationId, variables.memberId)
2193
+ });
2127
2194
  if (variables.listId) {
2128
- queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, variables.listId) });
2195
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(workOSOrganizationId, variables.listId) });
2129
2196
  }
2130
2197
  },
2131
2198
  onError: (error) => {
@@ -2139,7 +2206,7 @@ var leadGenListCompanyKeys = {
2139
2206
  detail: (organizationId, listCompanyId) => [...leadGenListCompanyKeys.all, organizationId, "detail", listCompanyId]
2140
2207
  };
2141
2208
  function useTransitionListCompany() {
2142
- const { apiRequest, organizationId } = useElevasisServices();
2209
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
2143
2210
  const queryClient = useQueryClient();
2144
2211
  return useMutation({
2145
2212
  mutationFn: async (input) => {
@@ -2157,11 +2224,11 @@ function useTransitionListCompany() {
2157
2224
  },
2158
2225
  onSuccess: (_, variables) => {
2159
2226
  queryClient.invalidateQueries({
2160
- queryKey: leadGenListCompanyKeys.detail(organizationId, variables.listCompanyId)
2227
+ queryKey: leadGenListCompanyKeys.detail(workOSOrganizationId, variables.listCompanyId)
2161
2228
  });
2162
2229
  if (variables.listId) {
2163
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
2164
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, variables.listId) });
2230
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(workOSOrganizationId) });
2231
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, variables.listId) });
2165
2232
  }
2166
2233
  },
2167
2234
  onError: (error) => {
@@ -2180,7 +2247,7 @@ function useDeriveActions(item) {
2180
2247
  }, [item]);
2181
2248
  }
2182
2249
  function useUpdateListStatus() {
2183
- const { apiRequest, organizationId } = useElevasisServices();
2250
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
2184
2251
  const queryClient = useQueryClient();
2185
2252
  return useMutation({
2186
2253
  mutationFn: async (input) => {
@@ -2190,9 +2257,9 @@ function useUpdateListStatus() {
2190
2257
  });
2191
2258
  },
2192
2259
  onSuccess: (_, variables) => {
2193
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
2194
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, variables.listId) });
2195
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
2260
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(workOSOrganizationId) });
2261
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, variables.listId) });
2262
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(workOSOrganizationId) });
2196
2263
  },
2197
2264
  onError: (error) => {
2198
2265
  queryClient.invalidateQueries({ queryKey: acquisitionListKeys.all });
@@ -2205,9 +2272,9 @@ var projectActivityKeys = {
2205
2272
  list: (projectId) => [...projectActivityKeys.all, "list", projectId]
2206
2273
  };
2207
2274
  function useProjectActivities(projectId, enabled = true) {
2208
- const { apiRequest, isReady, organizationId } = useElevasisServices();
2275
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2209
2276
  return useQuery({
2210
- queryKey: [...projectActivityKeys.list(projectId), organizationId],
2277
+ queryKey: [...projectActivityKeys.list(projectId), workOSOrganizationId],
2211
2278
  queryFn: async () => {
2212
2279
  const params = new URLSearchParams();
2213
2280
  params.set("entityType", "project");
@@ -2224,9 +2291,9 @@ function useProjectActivities(projectId, enabled = true) {
2224
2291
  });
2225
2292
  }
2226
2293
  function useCommandViewData() {
2227
- const { apiRequest, organizationId, isReady } = useElevasisServices();
2294
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
2228
2295
  return useQuery({
2229
- queryKey: ["command-view", organizationId],
2296
+ queryKey: ["command-view", workOSOrganizationId],
2230
2297
  queryFn: async () => {
2231
2298
  return apiRequest("/command-view");
2232
2299
  },
@@ -2235,9 +2302,9 @@ function useCommandViewData() {
2235
2302
  });
2236
2303
  }
2237
2304
  function useCommandViewStats(timeRange = "30d", options) {
2238
- const { apiRequest, organizationId, isReady } = useElevasisServices();
2305
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
2239
2306
  return useQuery({
2240
- queryKey: ["command-view-stats", organizationId, timeRange],
2307
+ queryKey: ["command-view-stats", workOSOrganizationId, timeRange],
2241
2308
  queryFn: async () => {
2242
2309
  return apiRequest(`/command-view/stats?timeRange=${timeRange}`);
2243
2310
  },
@@ -2246,9 +2313,9 @@ function useCommandViewStats(timeRange = "30d", options) {
2246
2313
  });
2247
2314
  }
2248
2315
  function useCheckpointTasks({ checkpointId, enabled = true }) {
2249
- const { apiRequest, organizationId, isReady } = useElevasisServices();
2316
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
2250
2317
  return useQuery({
2251
- queryKey: ["checkpoint-tasks", organizationId, checkpointId],
2318
+ queryKey: ["checkpoint-tasks", workOSOrganizationId, checkpointId],
2252
2319
  queryFn: async () => {
2253
2320
  return apiRequest(
2254
2321
  `/command-queue?humanCheckpoint=${checkpointId}&status=pending&limit=10`
@@ -2266,9 +2333,9 @@ function useResourceExecutions({
2266
2333
  limit = 10,
2267
2334
  enabled = true
2268
2335
  }) {
2269
- const { apiRequest, organizationId, isReady } = useElevasisServices();
2336
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
2270
2337
  return useQuery({
2271
- queryKey: ["resource-executions", organizationId, resourceId, timeRange, page, limit],
2338
+ queryKey: ["resource-executions", workOSOrganizationId, resourceId, timeRange, page, limit],
2272
2339
  queryFn: async () => {
2273
2340
  return apiRequest(
2274
2341
  `/command-view/resource-executions?resourceId=${resourceId}&timeRange=${timeRange}&page=${page}&limit=${limit}`
@@ -2281,18 +2348,41 @@ function useResourceExecutions({
2281
2348
  }
2282
2349
 
2283
2350
  // src/features/operations/organization-graph/commandViewVisualizationModes.ts
2351
+ var DEFAULT_CLUSTER_PARAMETERS = {
2352
+ zonePadding: 86,
2353
+ interZoneGap: 325
2354
+ };
2355
+ var DEFAULT_SWIMLANE_PARAMETERS = {
2356
+ laneHeight: 140,
2357
+ sortKey: "kind"
2358
+ };
2359
+ var DEFAULT_FOCUS_PARAMETERS = {
2360
+ depth: 2,
2361
+ radius: 390
2362
+ };
2363
+ var DEFAULT_NETWORK_PARAMETERS = {
2364
+ linkLength: 82,
2365
+ repulsion: 150
2366
+ };
2367
+ var DEFAULT_FORCE_PARAMETERS = {
2368
+ nodeRepulsion: 4500,
2369
+ idealEdgeLength: 80,
2370
+ gravity: 0.25
2371
+ };
2284
2372
  var COMMAND_VIEW_VISUALIZATION_MODES = [
2373
+ { label: "Explore", value: "explore" },
2285
2374
  { label: "Cluster", value: "cluster" },
2286
2375
  { label: "Swimlane", value: "swimlane" },
2287
2376
  { label: "Focus", value: "focus" },
2288
- { label: "Network", value: "network" }
2377
+ { label: "Network", value: "network" },
2378
+ { label: "Force", value: "force" }
2289
2379
  ];
2290
- var DEFAULT_COMMAND_VIEW_VISUALIZATION_MODE = "network";
2291
2380
  var DOMAIN_ORDER = [
2292
2381
  "operations",
2293
2382
  "runtime",
2294
2383
  "business",
2295
2384
  "delivery",
2385
+ "knowledge",
2296
2386
  "admin",
2297
2387
  "system",
2298
2388
  "platform",
@@ -2313,6 +2403,7 @@ var DOMAIN_KEYWORDS = {
2313
2403
  runtime: ["execution", "runner", "log", "session", "deploy", "webhook", "api key", "credential", "activity"],
2314
2404
  business: ["sales", "crm", "lead", "seo", "analytics", "cost", "account"],
2315
2405
  delivery: ["project", "task", "submission", "request", "design"],
2406
+ knowledge: [],
2316
2407
  admin: ["admin", "user", "organization", "notification", "archive"],
2317
2408
  system: ["setting", "appearance", "debug", "monitoring", "health"],
2318
2409
  platform: ["surface", "capability", "entity", "feature"],
@@ -2324,16 +2415,22 @@ function spread(index, count, spacing) {
2324
2415
  function getNodeSortValue(node) {
2325
2416
  return `${node.kind}:${node.label}:${node.id}`;
2326
2417
  }
2418
+ function getCommandViewNodeDomain(node) {
2419
+ return getNodeDomain(node);
2420
+ }
2327
2421
  function getNodeDomain(node) {
2328
- if (node.kind === "organization") {
2422
+ if (node.kind === "organization" || node.kind === "surface" || node.kind === "capability" || node.kind === "entity") {
2329
2423
  return "platform";
2330
2424
  }
2331
- if (node.kind !== "feature" && node.kind !== "resource") {
2332
- return "platform";
2425
+ if (node.kind === "knowledge") {
2426
+ return "knowledge";
2427
+ }
2428
+ if (node.kind === "stage") {
2429
+ return "business";
2333
2430
  }
2334
2431
  const searchable = `${node.id} ${node.sourceId ?? ""} ${node.featureId ?? ""} ${node.resourceType ?? ""} ${node.label}`.toLowerCase();
2335
2432
  for (const domain of DOMAIN_ORDER) {
2336
- if (domain === "other") {
2433
+ if (DOMAIN_KEYWORDS[domain].length === 0) {
2337
2434
  continue;
2338
2435
  }
2339
2436
  if (DOMAIN_KEYWORDS[domain].some((keyword) => searchable.includes(keyword))) {
@@ -2369,19 +2466,34 @@ function getNeighbors(graph, nodeId) {
2369
2466
  }
2370
2467
  return neighbors;
2371
2468
  }
2372
- function getClusterGraphPositions(graph) {
2469
+ var CLUSTER_ZONE_ORIGINS = {
2470
+ operations: { x: -520, y: -270, columns: 3, xGap: 188, yGap: 86 },
2471
+ runtime: { x: 130, y: -270, columns: 3, xGap: 188, yGap: 86 },
2472
+ business: { x: -520, y: 95, columns: 3, xGap: 188, yGap: 86 },
2473
+ delivery: { x: 130, y: 95, columns: 3, xGap: 188, yGap: 86 },
2474
+ knowledge: { x: 0, y: 605, columns: 4, xGap: 200, yGap: 86 },
2475
+ admin: { x: -520, y: 420, columns: 3, xGap: 188, yGap: 86 },
2476
+ system: { x: 130, y: 420, columns: 3, xGap: 188, yGap: 86 },
2477
+ platform: { x: 0, y: -520, columns: 4, xGap: 205, yGap: 90 },
2478
+ other: { x: 0, y: 800, columns: 6, xGap: 176, yGap: 78 }
2479
+ };
2480
+ function getClusterGraphPositions(graph, params) {
2373
2481
  const positions = /* @__PURE__ */ new Map();
2374
2482
  const groups = groupNodesByDomain(graph);
2375
- const zoneConfig = {
2376
- operations: { x: -520, y: -270, columns: 3, xGap: 188, yGap: 86 },
2377
- runtime: { x: 130, y: -270, columns: 3, xGap: 188, yGap: 86 },
2378
- business: { x: -520, y: 95, columns: 3, xGap: 188, yGap: 86 },
2379
- delivery: { x: 130, y: 95, columns: 3, xGap: 188, yGap: 86 },
2380
- admin: { x: -520, y: 420, columns: 3, xGap: 188, yGap: 86 },
2381
- system: { x: 130, y: 420, columns: 3, xGap: 188, yGap: 86 },
2382
- platform: { x: 0, y: -520, columns: 4, xGap: 205, yGap: 90 },
2383
- other: { x: 0, y: 710, columns: 6, xGap: 176, yGap: 78 }
2384
- };
2483
+ const zoneConfig = params === void 0 ? CLUSTER_ZONE_ORIGINS : (() => {
2484
+ const yGapScale = params.zonePadding / DEFAULT_CLUSTER_PARAMETERS.zonePadding;
2485
+ const yOriginScale = params.interZoneGap / DEFAULT_CLUSTER_PARAMETERS.interZoneGap;
2486
+ return Object.fromEntries(
2487
+ Object.entries(CLUSTER_ZONE_ORIGINS).map(([domain, cfg]) => [
2488
+ domain,
2489
+ {
2490
+ ...cfg,
2491
+ y: Math.round(cfg.y * yOriginScale),
2492
+ yGap: Math.round(cfg.yGap * yGapScale)
2493
+ }
2494
+ ])
2495
+ );
2496
+ })();
2385
2497
  for (const domain of DOMAIN_ORDER) {
2386
2498
  const nodes = groups.get(domain) ?? [];
2387
2499
  const zone = zoneConfig[domain];
@@ -2397,21 +2509,41 @@ function getClusterGraphPositions(graph) {
2397
2509
  }
2398
2510
  return positions;
2399
2511
  }
2400
- function getSwimlaneGraphPositions(graph) {
2512
+ var SWIMLANE_BASE_LANE_Y = {
2513
+ platform: -360,
2514
+ operations: -220,
2515
+ runtime: -80,
2516
+ business: 60,
2517
+ delivery: 200,
2518
+ knowledge: 340,
2519
+ admin: 480,
2520
+ system: 620,
2521
+ other: 760
2522
+ };
2523
+ function getSwimlaneGraphPositions(graph, params) {
2401
2524
  const positions = /* @__PURE__ */ new Map();
2402
- const groups = groupNodesByDomain(graph);
2403
- const laneY = {
2404
- platform: -360,
2405
- operations: -220,
2406
- runtime: -80,
2407
- business: 60,
2408
- delivery: 200,
2409
- admin: 340,
2410
- system: 480,
2411
- other: 620
2412
- };
2525
+ const rawGroups = groupNodesByDomain(graph);
2526
+ if (params !== void 0 && params.sortKey !== "kind") {
2527
+ for (const [, nodes] of rawGroups) {
2528
+ nodes.sort((left, right) => {
2529
+ if (params.sortKey === "domain") {
2530
+ return left.label.localeCompare(right.label);
2531
+ }
2532
+ return left.kind.localeCompare(right.kind) || left.label.localeCompare(right.label);
2533
+ });
2534
+ }
2535
+ }
2536
+ const laneY = params === void 0 ? SWIMLANE_BASE_LANE_Y : (() => {
2537
+ const scale = params.laneHeight / DEFAULT_SWIMLANE_PARAMETERS.laneHeight;
2538
+ return Object.fromEntries(
2539
+ Object.keys(SWIMLANE_BASE_LANE_Y).map((domain) => [
2540
+ domain,
2541
+ Math.round(SWIMLANE_BASE_LANE_Y[domain] * scale)
2542
+ ])
2543
+ );
2544
+ })();
2413
2545
  for (const domain of DOMAIN_ORDER) {
2414
- const nodes = groups.get(domain) ?? [];
2546
+ const nodes = rawGroups.get(domain) ?? [];
2415
2547
  const columns = Math.min(8, Math.max(1, Math.ceil(Math.sqrt(nodes.length) * 1.6)));
2416
2548
  for (const [index, node] of nodes.entries()) {
2417
2549
  const column = index % columns;
@@ -2425,7 +2557,7 @@ function getSwimlaneGraphPositions(graph) {
2425
2557
  }
2426
2558
  return positions;
2427
2559
  }
2428
- function getFocusGraphPositions(graph, selectedNodeId) {
2560
+ function getFocusGraphPositions(graph, selectedNodeId, params) {
2429
2561
  if (!selectedNodeId || !graph.nodes.some((node) => node.id === selectedNodeId)) {
2430
2562
  return getNetworkGraphPositions(graph);
2431
2563
  }
@@ -2440,6 +2572,10 @@ function getFocusGraphPositions(graph, selectedNodeId) {
2440
2572
  }
2441
2573
  }
2442
2574
  positions.set(selectedNodeId, { x: 0, y: 0 });
2575
+ const ring1RadiusX = params === void 0 ? 390 : params.radius;
2576
+ const ring1RadiusY = params === void 0 ? 210 : Math.round(params.radius * (210 / 390));
2577
+ const ring2RadiusX = params === void 0 ? 680 : Math.round(params.radius * (680 / 390));
2578
+ const ring2RadiusY = params === void 0 ? 360 : Math.round(params.radius * (360 / 390));
2443
2579
  const placeRing = (ids, radiusX, radiusY, yOffset = 0) => {
2444
2580
  ids.forEach((id, index) => {
2445
2581
  const angle = -Math.PI / 2 + index / Math.max(1, ids.length) * Math.PI * 2;
@@ -2449,8 +2585,11 @@ function getFocusGraphPositions(graph, selectedNodeId) {
2449
2585
  });
2450
2586
  });
2451
2587
  };
2452
- placeRing([...firstDegree].sort(), 390, 210);
2453
- placeRing([...secondDegree].sort(), 680, 360);
2588
+ placeRing([...firstDegree].sort(), ring1RadiusX, ring1RadiusY);
2589
+ const effectiveDepth = params === void 0 ? DEFAULT_FOCUS_PARAMETERS.depth : params.depth;
2590
+ if (effectiveDepth >= 2) {
2591
+ placeRing([...secondDegree].sort(), ring2RadiusX, ring2RadiusY);
2592
+ }
2454
2593
  const remaining = graph.nodes.filter((node) => !positions.has(node.id)).sort((left, right) => left.label.localeCompare(right.label));
2455
2594
  for (const [index, node] of remaining.entries()) {
2456
2595
  const column = index % 8;
@@ -2462,18 +2601,20 @@ function getFocusGraphPositions(graph, selectedNodeId) {
2462
2601
  }
2463
2602
  return positions;
2464
2603
  }
2465
- function getNetworkGraphPositions(graph) {
2604
+ function getNetworkGraphPositions(graph, params) {
2466
2605
  const positions = /* @__PURE__ */ new Map();
2467
2606
  const nodes = [...graph.nodes].sort((left, right) => {
2468
2607
  const degreeDelta = getNodeDegree(graph, right.id) - getNodeDegree(graph, left.id);
2469
2608
  return degreeDelta || left.label.localeCompare(right.label);
2470
2609
  });
2610
+ const baseRepulsion = params === void 0 ? 150 : params.repulsion;
2611
+ const linkLength = params === void 0 ? 82 : params.linkLength;
2471
2612
  for (const [index, node] of nodes.entries()) {
2472
2613
  if (index === 0) {
2473
2614
  positions.set(node.id, { x: 0, y: 0 });
2474
2615
  continue;
2475
2616
  }
2476
- const radius = 150 + Math.sqrt(index) * 82;
2617
+ const radius = baseRepulsion + Math.sqrt(index) * linkLength;
2477
2618
  const angle = index * 2.399963229728653;
2478
2619
  positions.set(node.id, {
2479
2620
  x: Math.cos(angle) * radius,
@@ -2482,13 +2623,183 @@ function getNetworkGraphPositions(graph) {
2482
2623
  }
2483
2624
  return positions;
2484
2625
  }
2485
- function getSpatialGraphPositions(graph) {
2486
- const positions = getSwimlaneGraphPositions(graph);
2487
- for (const [nodeId, position] of positions.entries()) {
2488
- const degree = getNodeDegree(graph, nodeId);
2489
- positions.set(nodeId, {
2490
- x: position.x + degree * 12,
2491
- y: position.y - degree * 8
2626
+ function getDefaultParameters(mode) {
2627
+ switch (mode) {
2628
+ case "swimlane":
2629
+ return { mode: "swimlane", ...DEFAULT_SWIMLANE_PARAMETERS };
2630
+ case "focus":
2631
+ return { mode: "focus", ...DEFAULT_FOCUS_PARAMETERS };
2632
+ case "network":
2633
+ return { mode: "network", ...DEFAULT_NETWORK_PARAMETERS };
2634
+ case "force":
2635
+ return { mode: "force", ...DEFAULT_FORCE_PARAMETERS };
2636
+ case "cluster":
2637
+ return { mode: "cluster", ...DEFAULT_CLUSTER_PARAMETERS, zonePadding: 110, interZoneGap: 400 };
2638
+ case "explore":
2639
+ return { mode: "explore" };
2640
+ }
2641
+ }
2642
+ var EXPLORE_ZONE_ORDER = [
2643
+ "platform",
2644
+ "operations",
2645
+ "runtime",
2646
+ "business",
2647
+ "delivery",
2648
+ "knowledge",
2649
+ "admin",
2650
+ "system",
2651
+ "other"
2652
+ ];
2653
+ var EXPLORE_ZONE_DISPLAY_NAME = {
2654
+ platform: "Platform",
2655
+ operations: "Operations",
2656
+ runtime: "Runtime",
2657
+ business: "Business",
2658
+ delivery: "Delivery",
2659
+ knowledge: "Knowledge",
2660
+ admin: "Admin",
2661
+ system: "System",
2662
+ other: "Other"
2663
+ };
2664
+ var EXPLORE_OM_ROOT_ID = "explore-om-root";
2665
+ function getExploreProjection() {
2666
+ const CENTROID_RADIUS = 340;
2667
+ const count = EXPLORE_ZONE_ORDER.length;
2668
+ const positions = /* @__PURE__ */ new Map();
2669
+ const syntheticNodes = [];
2670
+ const backboneEdges = [];
2671
+ syntheticNodes.push({
2672
+ id: EXPLORE_OM_ROOT_ID,
2673
+ kind: "organization",
2674
+ label: "Organization Model",
2675
+ isCentroid: "false",
2676
+ domainZone: null,
2677
+ zoneTint: null,
2678
+ isOmRoot: true
2679
+ });
2680
+ positions.set(EXPLORE_OM_ROOT_ID, { x: 0, y: 0 });
2681
+ for (const [index, zone] of EXPLORE_ZONE_ORDER.entries()) {
2682
+ const angle = -Math.PI / 2 + index / count * Math.PI * 2;
2683
+ const x = Math.cos(angle) * CENTROID_RADIUS;
2684
+ const y = Math.sin(angle) * CENTROID_RADIUS;
2685
+ const centroidId = `centroid:${zone}`;
2686
+ syntheticNodes.push({
2687
+ id: centroidId,
2688
+ kind: "centroid",
2689
+ label: EXPLORE_ZONE_DISPLAY_NAME[zone],
2690
+ isCentroid: "true",
2691
+ domainZone: zone,
2692
+ zoneTint: DOMAIN_ZONE_TINT_COLOR[zone] ?? null
2693
+ });
2694
+ positions.set(centroidId, { x, y });
2695
+ backboneEdges.push({ source: EXPLORE_OM_ROOT_ID, target: centroidId });
2696
+ }
2697
+ return { syntheticNodes, backboneEdges, positions };
2698
+ }
2699
+ function buildCommandViewGraphIndex(graph) {
2700
+ const nodesByDomain = /* @__PURE__ */ new Map();
2701
+ const nodeById = /* @__PURE__ */ new Map();
2702
+ const containsChildrenByParentId = /* @__PURE__ */ new Map();
2703
+ const containsParentIdsByChildId = /* @__PURE__ */ new Map();
2704
+ const childBearingNodeIds = /* @__PURE__ */ new Set();
2705
+ const degreeByNodeId = /* @__PURE__ */ new Map();
2706
+ for (const node of graph.nodes) {
2707
+ const zone = getNodeDomain(node);
2708
+ nodeById.set(node.id, node);
2709
+ degreeByNodeId.set(node.id, 0);
2710
+ const existing = nodesByDomain.get(zone);
2711
+ if (existing) {
2712
+ existing.push(node.id);
2713
+ } else {
2714
+ nodesByDomain.set(zone, [node.id]);
2715
+ }
2716
+ }
2717
+ for (const edge of graph.edges) {
2718
+ degreeByNodeId.set(edge.sourceId, (degreeByNodeId.get(edge.sourceId) ?? 0) + 1);
2719
+ degreeByNodeId.set(edge.targetId, (degreeByNodeId.get(edge.targetId) ?? 0) + 1);
2720
+ if (edge.kind !== "contains") continue;
2721
+ childBearingNodeIds.add(edge.sourceId);
2722
+ const children = containsChildrenByParentId.get(edge.sourceId);
2723
+ if (children) {
2724
+ children.push(edge.targetId);
2725
+ } else {
2726
+ containsChildrenByParentId.set(edge.sourceId, [edge.targetId]);
2727
+ }
2728
+ const parents = containsParentIdsByChildId.get(edge.targetId);
2729
+ if (parents) {
2730
+ parents.push(edge.sourceId);
2731
+ } else {
2732
+ containsParentIdsByChildId.set(edge.targetId, [edge.sourceId]);
2733
+ }
2734
+ }
2735
+ return {
2736
+ nodesByDomain,
2737
+ nodeById,
2738
+ containsChildrenByParentId,
2739
+ containsParentIdsByChildId,
2740
+ childBearingNodeIds,
2741
+ degreeByNodeId
2742
+ };
2743
+ }
2744
+ function getIndexedDomainNodeIds(graph, zone, lookup) {
2745
+ if (lookup instanceof Map) {
2746
+ return lookup.get(zone) ?? graph.nodes.filter((node) => getNodeDomain(node) === zone).map((node) => node.id);
2747
+ }
2748
+ return lookup?.nodesByDomain.get(zone) ?? graph.nodes.filter((node) => getNodeDomain(node) === zone).map((node) => node.id);
2749
+ }
2750
+ function getIndexedContainsChildIds(graph, parentId, lookup) {
2751
+ if (lookup && !(lookup instanceof Map)) {
2752
+ return lookup.containsChildrenByParentId.get(parentId) ?? [];
2753
+ }
2754
+ return graph.edges.filter((e) => e.kind === "contains" && e.sourceId === parentId).map((e) => e.targetId);
2755
+ }
2756
+ function getRadialFromAnchorProjection(graph, anchorId, anchorPos, level, lookup) {
2757
+ const RADIUS_BY_LEVEL = {
2758
+ 1: 260,
2759
+ 2: 170,
2760
+ 3: 110
2761
+ };
2762
+ const radius = RADIUS_BY_LEVEL[level] ?? 110;
2763
+ const positions = /* @__PURE__ */ new Map();
2764
+ let childIds;
2765
+ if (anchorId.startsWith("centroid:")) {
2766
+ const zone = anchorId.slice("centroid:".length);
2767
+ childIds = getIndexedDomainNodeIds(graph, zone, lookup);
2768
+ } else {
2769
+ childIds = getIndexedContainsChildIds(graph, anchorId, lookup);
2770
+ }
2771
+ const outwardAngle = anchorPos.x === 0 && anchorPos.y === 0 ? -Math.PI / 2 : Math.atan2(anchorPos.y, anchorPos.x);
2772
+ const NODE_SLOT = 92;
2773
+ const BASE_ARC = Math.PI / 2.5;
2774
+ const PREFERRED_ARC = Math.PI / 1.8;
2775
+ const MAX_ARC = Math.PI * 0.95;
2776
+ const n = childIds.length;
2777
+ let effectiveRadius = radius;
2778
+ let arcSpan;
2779
+ if (n <= 1) {
2780
+ arcSpan = BASE_ARC;
2781
+ } else {
2782
+ const minArcAtBase = n * NODE_SLOT / effectiveRadius;
2783
+ if (minArcAtBase <= BASE_ARC) {
2784
+ arcSpan = BASE_ARC;
2785
+ } else if (minArcAtBase <= PREFERRED_ARC) {
2786
+ arcSpan = minArcAtBase;
2787
+ } else {
2788
+ arcSpan = PREFERRED_ARC;
2789
+ effectiveRadius = Math.max(effectiveRadius, n * NODE_SLOT / PREFERRED_ARC);
2790
+ const MAX_RADIUS = radius * 2.4;
2791
+ if (effectiveRadius > MAX_RADIUS) {
2792
+ effectiveRadius = MAX_RADIUS;
2793
+ arcSpan = Math.min(MAX_ARC, n * NODE_SLOT / effectiveRadius);
2794
+ }
2795
+ }
2796
+ }
2797
+ for (const [index, childId] of childIds.entries()) {
2798
+ const t = n === 1 ? 0.5 : (index + 0.5) / n;
2799
+ const angle = outwardAngle - arcSpan / 2 + t * arcSpan;
2800
+ positions.set(childId, {
2801
+ x: anchorPos.x + Math.cos(angle) * effectiveRadius,
2802
+ y: anchorPos.y + Math.sin(angle) * effectiveRadius
2492
2803
  });
2493
2804
  }
2494
2805
  return positions;
@@ -2496,24 +2807,272 @@ function getSpatialGraphPositions(graph) {
2496
2807
  function getCommandViewGraphPositions({
2497
2808
  graph,
2498
2809
  visualizationMode,
2499
- selectedNodeId
2810
+ selectedNodeId,
2811
+ parameters,
2812
+ expandedNodeIds
2500
2813
  }) {
2501
2814
  switch (visualizationMode) {
2502
- case "swimlane":
2503
- return getSwimlaneGraphPositions(graph);
2504
- case "focus":
2505
- return getFocusGraphPositions(graph, selectedNodeId);
2506
- case "network":
2507
- return getNetworkGraphPositions(graph);
2508
- case "spatial":
2509
- return getSpatialGraphPositions(graph);
2815
+ case "swimlane": {
2816
+ const p = parameters?.mode === "swimlane" ? parameters : void 0;
2817
+ return getSwimlaneGraphPositions(graph, p);
2818
+ }
2819
+ case "focus": {
2820
+ const p = parameters?.mode === "focus" ? parameters : void 0;
2821
+ return getFocusGraphPositions(graph, selectedNodeId, p);
2822
+ }
2823
+ case "network": {
2824
+ const p = parameters?.mode === "network" ? parameters : void 0;
2825
+ return getNetworkGraphPositions(graph, p);
2826
+ }
2827
+ case "force":
2828
+ return /* @__PURE__ */ new Map();
2829
+ case "explore": {
2830
+ const { positions: explorePositions } = getExploreProjection();
2831
+ if (expandedNodeIds && expandedNodeIds.size > 0) {
2832
+ const graphIndex = buildCommandViewGraphIndex(graph);
2833
+ for (const nodeId of expandedNodeIds) {
2834
+ const isCentroid = nodeId.startsWith("centroid:");
2835
+ const level = isCentroid ? 1 : getExpandDepthForNode(graph, nodeId, expandedNodeIds, graphIndex);
2836
+ if (level >= 3) {
2837
+ continue;
2838
+ }
2839
+ const anchorPos = explorePositions.get(nodeId);
2840
+ if (!anchorPos) continue;
2841
+ const childPositions = getRadialFromAnchorProjection(graph, nodeId, anchorPos, level + 1, graphIndex);
2842
+ for (const [id, pos] of childPositions) {
2843
+ explorePositions.set(id, pos);
2844
+ }
2845
+ }
2846
+ }
2847
+ return explorePositions;
2848
+ }
2510
2849
  case "cluster":
2511
- default:
2512
- return getClusterGraphPositions(graph);
2850
+ default: {
2851
+ const p = parameters?.mode === "cluster" ? parameters : void 0;
2852
+ return getClusterGraphPositions(graph, p);
2853
+ }
2513
2854
  }
2514
2855
  }
2856
+ function getExpandDepthForNode(graph, nodeId, expandedNodeIds, graphIndex) {
2857
+ const node = graphIndex?.nodeById.get(nodeId) ?? graph.nodes.find((n) => n.id === nodeId);
2858
+ for (const expandedId of expandedNodeIds) {
2859
+ if (!expandedId.startsWith("centroid:")) continue;
2860
+ const zone = expandedId.slice("centroid:".length);
2861
+ const isDirectChild = node ? getNodeDomain(node) === zone : false;
2862
+ if (isDirectChild) return 2;
2863
+ }
2864
+ for (const expandedId of expandedNodeIds) {
2865
+ if (expandedId.startsWith("centroid:")) continue;
2866
+ const isContainsChild = getIndexedContainsChildIds(graph, expandedId, graphIndex).includes(nodeId);
2867
+ if (isContainsChild) return 3;
2868
+ }
2869
+ return 2;
2870
+ }
2871
+ function exploreNodeHasChildren(graph, nodeId, graphIndex) {
2872
+ if (nodeId.startsWith("centroid:")) return true;
2873
+ return graphIndex?.childBearingNodeIds.has(nodeId) ?? graph.edges.some((e) => e.kind === "contains" && e.sourceId === nodeId);
2874
+ }
2875
+ function findExploreParent(graph, childId, expandedNodeIds, graphIndex) {
2876
+ if (childId.startsWith("centroid:")) {
2877
+ return EXPLORE_OM_ROOT_ID;
2878
+ }
2879
+ for (const parentId2 of expandedNodeIds) {
2880
+ if (parentId2.startsWith("centroid:")) continue;
2881
+ const hasEdge = getIndexedContainsChildIds(graph, parentId2, graphIndex).includes(childId);
2882
+ if (hasEdge) return parentId2;
2883
+ }
2884
+ const childNode = graphIndex?.nodeById.get(childId) ?? graph.nodes.find((n) => n.id === childId);
2885
+ if (childNode) {
2886
+ const childCentroidId = `centroid:${getNodeDomain(childNode)}`;
2887
+ if (expandedNodeIds.has(childCentroidId)) {
2888
+ return childCentroidId;
2889
+ }
2890
+ }
2891
+ const parentId = graphIndex?.containsParentIdsByChildId.get(childId)?.[0];
2892
+ if (parentId) return parentId;
2893
+ const parentEdge = graph.edges.find((e) => e.kind === "contains" && e.targetId === childId);
2894
+ if (parentEdge) return parentEdge.sourceId;
2895
+ if (childNode) return `centroid:${getNodeDomain(childNode)}`;
2896
+ return null;
2897
+ }
2898
+ function getExploreFocusSet(graph, selectedId, expandedNodeIds, graphIndex) {
2899
+ const nodeIds = /* @__PURE__ */ new Set();
2900
+ const edgeIds = /* @__PURE__ */ new Set();
2901
+ nodeIds.add(EXPLORE_OM_ROOT_ID);
2902
+ if (selectedId === EXPLORE_OM_ROOT_ID) {
2903
+ return { nodeIds, edgeIds };
2904
+ }
2905
+ const ancestorChain = [selectedId];
2906
+ let cursor = selectedId;
2907
+ for (let i = 0; i < 8 && cursor !== EXPLORE_OM_ROOT_ID; i++) {
2908
+ if (cursor.startsWith("centroid:")) {
2909
+ ancestorChain.push(EXPLORE_OM_ROOT_ID);
2910
+ break;
2911
+ }
2912
+ const parentId = findExploreParent(graph, cursor, expandedNodeIds, graphIndex);
2913
+ if (!parentId) break;
2914
+ ancestorChain.push(parentId);
2915
+ cursor = parentId;
2916
+ }
2917
+ for (let i = 0; i < ancestorChain.length; i++) {
2918
+ nodeIds.add(ancestorChain[i]);
2919
+ if (i > 0) {
2920
+ const child = ancestorChain[i - 1];
2921
+ const parent = ancestorChain[i];
2922
+ if (parent === EXPLORE_OM_ROOT_ID && child.startsWith("centroid:")) {
2923
+ edgeIds.add(`backbone:${parent}:${child}`);
2924
+ } else {
2925
+ edgeIds.add(`expand:${parent}:${child}`);
2926
+ }
2927
+ }
2928
+ }
2929
+ if (expandedNodeIds.has(selectedId)) {
2930
+ const queue = [selectedId];
2931
+ while (queue.length > 0) {
2932
+ const id = queue.shift();
2933
+ let children;
2934
+ if (id.startsWith("centroid:")) {
2935
+ const zone = id.slice("centroid:".length);
2936
+ children = getIndexedDomainNodeIds(graph, zone, graphIndex);
2937
+ } else {
2938
+ children = getIndexedContainsChildIds(graph, id, graphIndex);
2939
+ }
2940
+ for (const c of children) {
2941
+ nodeIds.add(c);
2942
+ edgeIds.add(`expand:${id}:${c}`);
2943
+ if (expandedNodeIds.has(c)) queue.push(c);
2944
+ }
2945
+ }
2946
+ }
2947
+ return { nodeIds, edgeIds };
2948
+ }
2949
+ function getNextExpandedSetForToggle(graph, toggleId, currentExpanded, graphIndex) {
2950
+ if (currentExpanded.has(toggleId)) {
2951
+ return removeExpandedSubtree(graph, toggleId, currentExpanded, graphIndex);
2952
+ }
2953
+ const siblings = getSameParentExpandedSiblings(graph, toggleId, currentExpanded, graphIndex);
2954
+ let next = new Set(currentExpanded);
2955
+ for (const siblingId of siblings) {
2956
+ next = removeExpandedSubtree(graph, siblingId, next, graphIndex);
2957
+ }
2958
+ next.add(toggleId);
2959
+ return next;
2960
+ }
2961
+ function removeExpandedSubtree(graph, rootId, set, graphIndex) {
2962
+ const result = new Set(set);
2963
+ if (!result.has(rootId)) return result;
2964
+ result.delete(rootId);
2965
+ const queue = [rootId];
2966
+ while (queue.length > 0) {
2967
+ const id = queue.shift();
2968
+ let children;
2969
+ if (id.startsWith("centroid:")) {
2970
+ const zone = id.slice("centroid:".length);
2971
+ children = getIndexedDomainNodeIds(graph, zone, graphIndex);
2972
+ } else {
2973
+ children = getIndexedContainsChildIds(graph, id, graphIndex);
2974
+ }
2975
+ for (const c of children) {
2976
+ if (result.has(c)) {
2977
+ result.delete(c);
2978
+ queue.push(c);
2979
+ }
2980
+ }
2981
+ }
2982
+ return result;
2983
+ }
2984
+ function getSameParentExpandedSiblings(graph, nodeId, expandedSet, graphIndex) {
2985
+ if (nodeId.startsWith("centroid:")) {
2986
+ return Array.from(expandedSet).filter((id) => id !== nodeId && id.startsWith("centroid:"));
2987
+ }
2988
+ let parentId = null;
2989
+ const directParents = graphIndex?.containsParentIdsByChildId.get(nodeId) ?? graph.edges.filter((e) => e.kind === "contains" && e.targetId === nodeId).map((e) => e.sourceId);
2990
+ parentId = directParents.find((p) => expandedSet.has(p)) ?? null;
2991
+ if (!parentId) {
2992
+ const node = graphIndex?.nodeById.get(nodeId) ?? graph.nodes.find((n) => n.id === nodeId);
2993
+ if (node) {
2994
+ const centroidId = `centroid:${getNodeDomain(node)}`;
2995
+ if (expandedSet.has(centroidId)) parentId = centroidId;
2996
+ }
2997
+ }
2998
+ if (!parentId) return [];
2999
+ if (parentId.startsWith("centroid:")) {
3000
+ const zone = parentId.slice("centroid:".length);
3001
+ return Array.from(expandedSet).filter((id) => {
3002
+ if (id === nodeId || id.startsWith("centroid:")) return false;
3003
+ const n = graphIndex?.nodeById.get(id) ?? graph.nodes.find((nn) => nn.id === id);
3004
+ return n ? getNodeDomain(n) === zone : false;
3005
+ });
3006
+ }
3007
+ const childrenOfParent = new Set(getIndexedContainsChildIds(graph, parentId, graphIndex));
3008
+ return Array.from(expandedSet).filter((id) => id !== nodeId && childrenOfParent.has(id));
3009
+ }
3010
+ var DOMAIN_ZONE_TINT_COLOR = {
3011
+ operations: "#3b82a0",
3012
+ runtime: "#7c6ea8",
3013
+ business: "#3f8f7a",
3014
+ delivery: "#4b97a6",
3015
+ knowledge: "#6673a6",
3016
+ admin: "#7b838a",
3017
+ system: "#536b9a",
3018
+ platform: "#8d679b",
3019
+ other: "#6f757b"
3020
+ };
3021
+ var DOMAIN_DISPLAY_NAME = {
3022
+ operations: "Operations",
3023
+ runtime: "Runtime",
3024
+ business: "Business",
3025
+ delivery: "Delivery",
3026
+ knowledge: "Knowledge",
3027
+ admin: "Admin",
3028
+ system: "System",
3029
+ platform: "Platform",
3030
+ other: "Other"
3031
+ };
3032
+ function getCommandViewSwimlaneLaneLabels() {
3033
+ const laneY = {
3034
+ platform: -360,
3035
+ operations: -220,
3036
+ runtime: -80,
3037
+ business: 60,
3038
+ delivery: 200,
3039
+ knowledge: 340,
3040
+ admin: 480,
3041
+ system: 620,
3042
+ other: 760
3043
+ };
3044
+ return DOMAIN_ORDER.map((domain) => ({
3045
+ domain,
3046
+ text: DOMAIN_DISPLAY_NAME[domain],
3047
+ y: laneY[domain],
3048
+ x: 0
3049
+ }));
3050
+ }
3051
+ function getCommandViewClusterZoneLabels() {
3052
+ const zoneOrigins = {
3053
+ operations: { x: -520, y: -270 },
3054
+ runtime: { x: 130, y: -270 },
3055
+ business: { x: -520, y: 95 },
3056
+ delivery: { x: 130, y: 95 },
3057
+ knowledge: { x: 0, y: 605 },
3058
+ admin: { x: -520, y: 420 },
3059
+ system: { x: 130, y: 420 },
3060
+ platform: { x: 0, y: -520 },
3061
+ other: { x: 0, y: 800 }
3062
+ };
3063
+ return DOMAIN_ORDER.map((domain) => ({
3064
+ domain,
3065
+ text: DOMAIN_DISPLAY_NAME[domain],
3066
+ x: zoneOrigins[domain].x,
3067
+ y: zoneOrigins[domain].y
3068
+ }));
3069
+ }
2515
3070
 
2516
3071
  // src/hooks/operations/command-view/useCommandViewStore.ts
3072
+ var VALID_VISUALIZATION_MODES = new Set(
3073
+ COMMAND_VIEW_VISUALIZATION_MODES.map((entry) => entry.value)
3074
+ );
3075
+ var NEW_SESSION_VISUALIZATION_MODE = "explore";
2517
3076
  var DEFAULT_DIAGNOSTIC_CATEGORIES = ["diagnostic", "testing"];
2518
3077
  var useCommandViewStore = create()(
2519
3078
  persist(
@@ -2524,8 +3083,12 @@ var useCommandViewStore = create()(
2524
3083
  setShowIntegrations: (showIntegrations) => set({ showIntegrations }),
2525
3084
  fitViewOnFilter: true,
2526
3085
  setFitViewOnFilter: (fitViewOnFilter) => set({ fitViewOnFilter }),
2527
- visualizationMode: DEFAULT_COMMAND_VIEW_VISUALIZATION_MODE,
2528
- setVisualizationMode: (visualizationMode) => set({ visualizationMode }),
3086
+ // New sessions default to 'explore'; returning sessions get their stored mode via persist.
3087
+ visualizationMode: NEW_SESSION_VISUALIZATION_MODE,
3088
+ setVisualizationMode: (visualizationMode) => set({ visualizationMode, lastUsedVisualizationMode: visualizationMode }),
3089
+ lastUsedVisualizationMode: null,
3090
+ lastOpenBottomTab: null,
3091
+ setLastOpenBottomTab: (lastOpenBottomTab) => set({ lastOpenBottomTab }),
2529
3092
  selectedNodeId: null,
2530
3093
  setSelectedNodeId: (selectedNodeId) => set({ selectedNodeId }),
2531
3094
  resourcesHidden: true,
@@ -2538,7 +3101,29 @@ var useCommandViewStore = create()(
2538
3101
  clearRevealedIds: () => set({ revealedIds: /* @__PURE__ */ new Set() }),
2539
3102
  hasVisibilityInteraction: false,
2540
3103
  markVisibilityInteraction: () => set({ hasVisibilityInteraction: true }),
2541
- resetVisibilityInteraction: () => set({ hasVisibilityInteraction: false })
3104
+ resetVisibilityInteraction: () => set({ hasVisibilityInteraction: false }),
3105
+ expandedClusterDomains: [],
3106
+ toggleClusterDomain: (domain) => set((s) => ({
3107
+ expandedClusterDomains: s.expandedClusterDomains.includes(domain) ? s.expandedClusterDomains.filter((d) => d !== domain) : [...s.expandedClusterDomains, domain]
3108
+ })),
3109
+ setExpandedClusterDomains: (expandedClusterDomains) => set({ expandedClusterDomains }),
3110
+ expandedNodeIdsArray: [],
3111
+ expandedNodeIds: /* @__PURE__ */ new Set(),
3112
+ toggleNodeExpansion: (nodeId) => set((s) => {
3113
+ const currentSet = s.expandedNodeIds;
3114
+ const isCurrentlyExpanded = currentSet.has(nodeId);
3115
+ if (isCurrentlyExpanded) {
3116
+ const next2 = new Set(currentSet);
3117
+ next2.delete(nodeId);
3118
+ const nextArray2 = [...next2];
3119
+ return { expandedNodeIdsArray: nextArray2, expandedNodeIds: next2 };
3120
+ }
3121
+ const next = new Set(currentSet);
3122
+ next.add(nodeId);
3123
+ const nextArray = [...next];
3124
+ return { expandedNodeIdsArray: nextArray, expandedNodeIds: next };
3125
+ }),
3126
+ clearExpandedNodes: () => set({ expandedNodeIdsArray: [], expandedNodeIds: /* @__PURE__ */ new Set() })
2542
3127
  }),
2543
3128
  {
2544
3129
  name: "command-view-store",
@@ -2546,9 +3131,29 @@ var useCommandViewStore = create()(
2546
3131
  showIntegrations: s.showIntegrations,
2547
3132
  fitViewOnFilter: s.fitViewOnFilter,
2548
3133
  visualizationMode: s.visualizationMode,
3134
+ lastUsedVisualizationMode: s.lastUsedVisualizationMode,
2549
3135
  resourcesHidden: s.resourcesHidden,
2550
- diagnosticsHidden: s.diagnosticsHidden
2551
- })
3136
+ diagnosticsHidden: s.diagnosticsHidden,
3137
+ lastOpenBottomTab: s.lastOpenBottomTab,
3138
+ expandedClusterDomains: s.expandedClusterDomains
3139
+ }),
3140
+ // Guard against stale localStorage with an invalid mode name (e.g. old 'overview' → 'explore' rename).
3141
+ merge: (persisted, current) => {
3142
+ const stored = persisted;
3143
+ const storedMode = stored.visualizationMode;
3144
+ const storedLastUsed = stored.lastUsedVisualizationMode;
3145
+ const migratedMode = storedMode === "overview" ? "explore" : storedMode;
3146
+ const migratedLastUsed = storedLastUsed === "overview" ? "explore" : storedLastUsed;
3147
+ const { expandedZonesArray: _dropped, ...restStored } = stored;
3148
+ return {
3149
+ ...current,
3150
+ ...restStored,
3151
+ // If the stored mode is unrecognized (stale rename), fall back to new-session default.
3152
+ visualizationMode: migratedMode !== void 0 && VALID_VISUALIZATION_MODES.has(migratedMode) ? migratedMode : NEW_SESSION_VISUALIZATION_MODE,
3153
+ // Validate lastUsedVisualizationMode the same way.
3154
+ lastUsedVisualizationMode: migratedLastUsed !== void 0 && migratedLastUsed !== null && VALID_VISUALIZATION_MODES.has(migratedLastUsed) ? migratedLastUsed : current.lastUsedVisualizationMode
3155
+ };
3156
+ }
2552
3157
  }
2553
3158
  )
2554
3159
  );
@@ -2634,7 +3239,7 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
2634
3239
  const queryClient = useQueryClient();
2635
3240
  const [liveExecutions, setLiveExecutions] = useState(/* @__PURE__ */ new Set());
2636
3241
  const [streamingLogs, setStreamingLogs] = useState(/* @__PURE__ */ new Map());
2637
- const { isReady: isOrganizationReady, organizationId } = useElevasisServices();
3242
+ const { isReady: isOrganizationReady, workOSOrganizationId } = useElevasisServices();
2638
3243
  const { currentMembership } = useOrganization();
2639
3244
  const currentWorkOSOrganizationId = currentMembership?.organization?.workos_org_id;
2640
3245
  const sseUrl = `${apiUrl}/api/execution-engine/sse/${resourceId}`;
@@ -2658,7 +3263,7 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
2658
3263
  return updated;
2659
3264
  });
2660
3265
  queryClient.invalidateQueries({
2661
- queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
3266
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, resourceId)
2662
3267
  });
2663
3268
  }
2664
3269
  break;
@@ -2675,10 +3280,10 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
2675
3280
  return updated;
2676
3281
  });
2677
3282
  queryClient.invalidateQueries({
2678
- queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
3283
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, resourceId)
2679
3284
  });
2680
3285
  queryClient.invalidateQueries({
2681
- queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
3286
+ queryKey: executionsKeys.execution(workOSOrganizationId, resourceId, event.executionId)
2682
3287
  });
2683
3288
  }
2684
3289
  break;
@@ -2693,7 +3298,7 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
2693
3298
  });
2694
3299
  }
2695
3300
  queryClient.invalidateQueries({
2696
- queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
3301
+ queryKey: executionsKeys.execution(workOSOrganizationId, resourceId, event.executionId)
2697
3302
  });
2698
3303
  }
2699
3304
  break;
@@ -2701,13 +3306,13 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
2701
3306
  } catch {
2702
3307
  }
2703
3308
  },
2704
- [organizationId, resourceId, queryClient]
3309
+ [workOSOrganizationId, resourceId, queryClient]
2705
3310
  );
2706
3311
  const { connected, error } = useSSEConnection({
2707
3312
  manager,
2708
3313
  connectionKey: `resource-${resourceId}`,
2709
3314
  url: sseUrl,
2710
- enabled: !!resourceId && !!organizationId && isOrganizationReady,
3315
+ enabled: !!resourceId && !!workOSOrganizationId && isOrganizationReady,
2711
3316
  headers,
2712
3317
  onmessage: handleMessage,
2713
3318
  onopen: (response) => response.status === 403 ? "Organization access denied" : void 0
@@ -2717,7 +3322,7 @@ function useExecutionLogSSE(resourceId, manager, apiUrl) {
2717
3322
  setLiveExecutions(/* @__PURE__ */ new Set());
2718
3323
  setStreamingLogs(/* @__PURE__ */ new Map());
2719
3324
  };
2720
- }, [resourceId, organizationId, isOrganizationReady]);
3325
+ }, [resourceId, workOSOrganizationId, isOrganizationReady]);
2721
3326
  return {
2722
3327
  liveExecutions,
2723
3328
  connected,
@@ -2739,7 +3344,7 @@ function useExecutionPanelState({
2739
3344
  }) {
2740
3345
  const queryClient = useQueryClient();
2741
3346
  const navigate = useNavigate();
2742
- const { organizationId } = useElevasisServices();
3347
+ const { workOSOrganizationId } = useElevasisServices();
2743
3348
  const [resourceStatusFilter, setResourceStatusFilter] = useState("all");
2744
3349
  const { data: executionsData, isLoading, isFetched } = useExecutions(resourceId, resourceStatusFilter, limit, offset);
2745
3350
  const { liveExecutions, connected, runningCount, streamingLogs } = useExecutionLogSSE(resourceId, manager, apiUrl);
@@ -2774,12 +3379,12 @@ function useExecutionPanelState({
2774
3379
  }
2775
3380
  }, [resourceId, setSelectedId]);
2776
3381
  useEffect(() => {
2777
- if (organizationId) {
3382
+ if (workOSOrganizationId) {
2778
3383
  queryClient.invalidateQueries({
2779
3384
  queryKey: [...executionsKeys.all, "execution"]
2780
3385
  });
2781
3386
  }
2782
- }, [resourceId, queryClient, organizationId]);
3387
+ }, [resourceId, queryClient, workOSOrganizationId]);
2783
3388
  useEffect(() => {
2784
3389
  const sortedExecutions = [...executions].sort((a, b) => b.startTime - a.startTime);
2785
3390
  const newestExecution = sortedExecutions[0];
@@ -2918,9 +3523,9 @@ function useSortedData(data, defaultColumn, accessors, defaultDirection = "desc"
2918
3523
  return { sorted, sort, toggleSort };
2919
3524
  }
2920
3525
  function useActivityTrend(params = {}) {
2921
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3526
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2922
3527
  return useQuery({
2923
- queryKey: ["activities", "trend", organizationId, params],
3528
+ queryKey: ["activities", "trend", workOSOrganizationId, params],
2924
3529
  queryFn: async () => {
2925
3530
  const queryParams = new URLSearchParams();
2926
3531
  if (params.activityType) queryParams.set("activityType", params.activityType);
@@ -2942,9 +3547,9 @@ function useActivityTrend(params = {}) {
2942
3547
  });
2943
3548
  }
2944
3549
  function useActivities(params = {}) {
2945
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3550
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2946
3551
  return useQuery({
2947
- queryKey: ["activities", "list", organizationId, params],
3552
+ queryKey: ["activities", "list", workOSOrganizationId, params],
2948
3553
  queryFn: async () => {
2949
3554
  const queryParams = new URLSearchParams();
2950
3555
  if (params.limit) queryParams.set("limit", params.limit.toString());
@@ -2976,14 +3581,15 @@ function useActivities(params = {}) {
2976
3581
  });
2977
3582
  }
2978
3583
  function useExecutionLogs(params = {}) {
2979
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3584
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
2980
3585
  return useQuery({
2981
- queryKey: ["monitoring", "execution-logs", organizationId, params],
3586
+ queryKey: ["monitoring", "execution-logs", workOSOrganizationId, params],
2982
3587
  queryFn: async () => {
2983
3588
  const queryParams = new URLSearchParams();
2984
3589
  if (params.resourceId) queryParams.set("resourceId", params.resourceId);
2985
3590
  if (params.status && params.status !== "all") queryParams.set("status", params.status);
2986
- if (params.resourceStatus && params.resourceStatus !== "all") queryParams.set("resourceStatus", params.resourceStatus);
3591
+ if (params.resourceStatus && params.resourceStatus !== "all")
3592
+ queryParams.set("resourceStatus", params.resourceStatus);
2987
3593
  if (params.startDate !== void 0) queryParams.set("startDate", params.startDate.toString());
2988
3594
  if (params.endDate !== void 0) queryParams.set("endDate", params.endDate.toString());
2989
3595
  if (params.limit !== void 0) queryParams.set("limit", params.limit.toString());
@@ -3000,9 +3606,9 @@ function useExecutionLogs(params = {}) {
3000
3606
  });
3001
3607
  }
3002
3608
  function useNotifications({ limit = 20, offset = 0 } = {}) {
3003
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3609
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3004
3610
  return useQuery({
3005
- queryKey: ["notifications", organizationId, { limit, offset }],
3611
+ queryKey: ["notifications", workOSOrganizationId, { limit, offset }],
3006
3612
  queryFn: async () => {
3007
3613
  const params = GetNotificationsQuerySchema.parse({ limit, offset });
3008
3614
  const response = await apiRequest(
@@ -3014,14 +3620,12 @@ function useNotifications({ limit = 20, offset = 0 } = {}) {
3014
3620
  });
3015
3621
  }
3016
3622
  function useCostSummary(timeRange) {
3017
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3623
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3018
3624
  return useQuery({
3019
- queryKey: ["cost-analytics", "cost-summary", organizationId, timeRange],
3625
+ queryKey: ["cost-analytics", "cost-summary", workOSOrganizationId, timeRange],
3020
3626
  queryFn: async () => {
3021
3627
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3022
- return apiRequest(
3023
- `/observability/cost-summary?startDate=${startDate}&endDate=${endDate}`
3024
- );
3628
+ return apiRequest(`/observability/cost-summary?startDate=${startDate}&endDate=${endDate}`);
3025
3629
  },
3026
3630
  enabled: isReady,
3027
3631
  refetchInterval: 6e4
@@ -3029,14 +3633,12 @@ function useCostSummary(timeRange) {
3029
3633
  });
3030
3634
  }
3031
3635
  function useExecutionHealth({ timeRange }) {
3032
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3636
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3033
3637
  return useQuery({
3034
- queryKey: ["monitoring", "execution-health", organizationId, timeRange],
3638
+ queryKey: ["monitoring", "execution-health", workOSOrganizationId, timeRange],
3035
3639
  queryFn: async () => {
3036
3640
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3037
- return apiRequest(
3038
- `/observability/dashboard?startDate=${startDate}&endDate=${endDate}`
3039
- );
3641
+ return apiRequest(`/observability/dashboard?startDate=${startDate}&endDate=${endDate}`);
3040
3642
  },
3041
3643
  enabled: isReady,
3042
3644
  refetchInterval: 6e4,
@@ -3047,9 +3649,9 @@ function useExecutionHealth({ timeRange }) {
3047
3649
  }
3048
3650
  function useNotificationCount(args) {
3049
3651
  const { notificationCount, notificationConnected, notificationError } = args;
3050
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3652
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3051
3653
  const query = useQuery({
3052
- queryKey: ["notifications", "unread-count", organizationId],
3654
+ queryKey: ["notifications", "unread-count", workOSOrganizationId],
3053
3655
  queryFn: async () => {
3054
3656
  const response = await apiRequest("/notifications/unread-count");
3055
3657
  return response.count;
@@ -3260,9 +3862,9 @@ function useCreateWebhookEndpoint() {
3260
3862
  });
3261
3863
  }
3262
3864
  function useListWebhookEndpoints() {
3263
- const { apiRequest, organizationId, isReady } = useElevasisServices();
3865
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
3264
3866
  return useQuery({
3265
- queryKey: ["webhook-endpoints", organizationId],
3867
+ queryKey: ["webhook-endpoints", workOSOrganizationId],
3266
3868
  queryFn: async () => {
3267
3869
  const service = new WebhookEndpointService(apiRequest);
3268
3870
  return await service.listEndpoints();
@@ -3271,8 +3873,8 @@ function useListWebhookEndpoints() {
3271
3873
  });
3272
3874
  }
3273
3875
  function useOrgRoles(orgId) {
3274
- const { apiRequest, organizationId, isReady } = useElevasisServices();
3275
- const targetOrgId = orgId ?? organizationId;
3876
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
3877
+ const targetOrgId = orgId ?? workOSOrganizationId;
3276
3878
  return useQuery({
3277
3879
  queryKey: ["org-roles", targetOrgId],
3278
3880
  queryFn: () => apiRequest(`/organizations/${targetOrgId}/roles`),
@@ -3281,33 +3883,33 @@ function useOrgRoles(orgId) {
3281
3883
  });
3282
3884
  }
3283
3885
  function useUpdateOrgRole() {
3284
- const { apiRequest, organizationId } = useElevasisServices();
3886
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3285
3887
  const queryClient = useQueryClient();
3286
3888
  return useMutation({
3287
- mutationFn: ({ roleId, input }) => apiRequest(`/organizations/${organizationId}/roles/${roleId}`, {
3889
+ mutationFn: ({ roleId, input }) => apiRequest(`/organizations/${workOSOrganizationId}/roles/${roleId}`, {
3288
3890
  method: "PATCH",
3289
3891
  body: JSON.stringify(input)
3290
3892
  }),
3291
3893
  onSettled: (_data, _error, { roleId }) => {
3292
- queryClient.invalidateQueries({ queryKey: ["org-roles", organizationId] });
3293
- queryClient.invalidateQueries({ queryKey: ["org-role", organizationId, roleId] });
3894
+ queryClient.invalidateQueries({ queryKey: ["org-roles", workOSOrganizationId] });
3895
+ queryClient.invalidateQueries({ queryKey: ["org-role", workOSOrganizationId, roleId] });
3294
3896
  }
3295
3897
  });
3296
3898
  }
3297
3899
  function useDeleteOrgRole() {
3298
- const { apiRequest, organizationId } = useElevasisServices();
3900
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3299
3901
  const queryClient = useQueryClient();
3300
3902
  return useMutation({
3301
- mutationFn: (roleId) => apiRequest(`/organizations/${organizationId}/roles/${roleId}`, {
3903
+ mutationFn: (roleId) => apiRequest(`/organizations/${workOSOrganizationId}/roles/${roleId}`, {
3302
3904
  method: "DELETE"
3303
3905
  }),
3304
3906
  onSettled: () => {
3305
- queryClient.invalidateQueries({ queryKey: ["org-roles", organizationId] });
3907
+ queryClient.invalidateQueries({ queryKey: ["org-roles", workOSOrganizationId] });
3306
3908
  }
3307
3909
  });
3308
3910
  }
3309
3911
  function useAssignRole() {
3310
- const { apiRequest, organizationId } = useElevasisServices();
3912
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3311
3913
  const queryClient = useQueryClient();
3312
3914
  return useMutation({
3313
3915
  mutationFn: ({ membershipId, roleId }) => apiRequest(`/memberships/${membershipId}/roles`, {
@@ -3315,30 +3917,30 @@ function useAssignRole() {
3315
3917
  body: JSON.stringify({ roleId })
3316
3918
  }),
3317
3919
  onSettled: (_data, _error, { membershipId }) => {
3318
- queryClient.invalidateQueries({ queryKey: ["member-roles", organizationId, membershipId] });
3319
- queryClient.invalidateQueries({ queryKey: ["organization-permissions", organizationId] });
3320
- queryClient.invalidateQueries({ queryKey: ["org-roles", organizationId] });
3920
+ queryClient.invalidateQueries({ queryKey: ["member-roles", workOSOrganizationId, membershipId] });
3921
+ queryClient.invalidateQueries({ queryKey: ["organization-permissions", workOSOrganizationId] });
3922
+ queryClient.invalidateQueries({ queryKey: ["org-roles", workOSOrganizationId] });
3321
3923
  }
3322
3924
  });
3323
3925
  }
3324
3926
  function useRevokeRole() {
3325
- const { apiRequest, organizationId } = useElevasisServices();
3927
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3326
3928
  const queryClient = useQueryClient();
3327
3929
  return useMutation({
3328
3930
  mutationFn: ({ membershipId, roleId }) => apiRequest(`/memberships/${membershipId}/roles/${roleId}`, {
3329
3931
  method: "DELETE"
3330
3932
  }),
3331
3933
  onSettled: (_data, _error, { membershipId }) => {
3332
- queryClient.invalidateQueries({ queryKey: ["member-roles", organizationId, membershipId] });
3333
- queryClient.invalidateQueries({ queryKey: ["organization-permissions", organizationId] });
3334
- queryClient.invalidateQueries({ queryKey: ["org-roles", organizationId] });
3934
+ queryClient.invalidateQueries({ queryKey: ["member-roles", workOSOrganizationId, membershipId] });
3935
+ queryClient.invalidateQueries({ queryKey: ["organization-permissions", workOSOrganizationId] });
3936
+ queryClient.invalidateQueries({ queryKey: ["org-roles", workOSOrganizationId] });
3335
3937
  }
3336
3938
  });
3337
3939
  }
3338
3940
  function useEffectivePermissions(membershipId) {
3339
- const { apiRequest, organizationId, isReady } = useElevasisServices();
3941
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
3340
3942
  return useQuery({
3341
- queryKey: ["member-roles", organizationId, membershipId],
3943
+ queryKey: ["member-roles", workOSOrganizationId, membershipId],
3342
3944
  queryFn: () => apiRequest(`/memberships/${membershipId}/effective-permissions`),
3343
3945
  enabled: isReady && !!membershipId,
3344
3946
  staleTime: STALE_TIME_DEFAULT
@@ -3352,44 +3954,78 @@ var acquisitionListKeys = {
3352
3954
  detail: (organizationId, listId) => [...acquisitionListKeys.all, organizationId, listId],
3353
3955
  telemetry: (organizationId) => [...acquisitionListKeys.all, "telemetry", organizationId],
3354
3956
  progress: (organizationId, listId) => [...acquisitionListKeys.all, "progress", organizationId, listId],
3355
- executions: (organizationId, listId, filters) => [...acquisitionListKeys.all, "executions", organizationId, listId, filters?.resourceId ?? null, filters?.limit ?? null]
3957
+ records: (organizationId, listId, filters) => [
3958
+ ...acquisitionListKeys.all,
3959
+ "records",
3960
+ organizationId,
3961
+ listId,
3962
+ filters.entity,
3963
+ filters.stage ?? null,
3964
+ filters.limit ?? null,
3965
+ filters.offset ?? null
3966
+ ],
3967
+ executions: (organizationId, listId, filters) => [
3968
+ ...acquisitionListKeys.all,
3969
+ "executions",
3970
+ organizationId,
3971
+ listId,
3972
+ filters?.resourceId ?? null,
3973
+ filters?.limit ?? null
3974
+ ]
3356
3975
  };
3357
3976
  function useLists() {
3358
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3977
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3359
3978
  return useQuery({
3360
- queryKey: acquisitionListKeys.list(organizationId),
3979
+ queryKey: acquisitionListKeys.list(workOSOrganizationId),
3361
3980
  queryFn: () => apiRequest("/acquisition/lists"),
3362
3981
  enabled: isReady
3363
3982
  });
3364
3983
  }
3365
3984
  function useList(listId) {
3366
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3985
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3367
3986
  return useQuery({
3368
- queryKey: acquisitionListKeys.detail(organizationId, listId),
3987
+ queryKey: acquisitionListKeys.detail(workOSOrganizationId, listId),
3369
3988
  queryFn: () => apiRequest(`/acquisition/lists/${listId}`),
3370
3989
  enabled: isReady && !!listId
3371
3990
  });
3372
3991
  }
3373
3992
  function useListsTelemetry() {
3374
- const { apiRequest, isReady, organizationId } = useElevasisServices();
3993
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3375
3994
  return useQuery({
3376
- queryKey: acquisitionListKeys.telemetry(organizationId),
3995
+ queryKey: acquisitionListKeys.telemetry(workOSOrganizationId),
3377
3996
  queryFn: () => apiRequest("/acquisition/lists/telemetry"),
3378
3997
  enabled: isReady
3379
3998
  });
3380
3999
  }
3381
- function useListProgress(listId) {
3382
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4000
+ function useListProgress(listId, options = {}) {
4001
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3383
4002
  return useQuery({
3384
- queryKey: acquisitionListKeys.progress(organizationId, listId),
4003
+ queryKey: acquisitionListKeys.progress(workOSOrganizationId, listId),
3385
4004
  queryFn: () => apiRequest(`/acquisition/lists/${listId}/progress`),
3386
- enabled: isReady && !!listId
4005
+ enabled: isReady && !!listId && (options.enabled ?? true),
4006
+ refetchInterval: options.refetchInterval
4007
+ });
4008
+ }
4009
+ function useListRecords(listId, filters) {
4010
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
4011
+ return useQuery({
4012
+ queryKey: acquisitionListKeys.records(workOSOrganizationId, listId, filters),
4013
+ queryFn: () => {
4014
+ const params = new URLSearchParams({
4015
+ entity: filters.entity,
4016
+ limit: String(filters.limit ?? 50),
4017
+ offset: String(filters.offset ?? 0)
4018
+ });
4019
+ if (filters.stage) params.set("stage", filters.stage);
4020
+ return apiRequest(`/acquisition/lists/${listId}/records?${params.toString()}`);
4021
+ },
4022
+ enabled: isReady && !!listId && !!filters.entity
3387
4023
  });
3388
4024
  }
3389
4025
  function useListExecutions(listId, filters = {}) {
3390
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4026
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3391
4027
  return useQuery({
3392
- queryKey: acquisitionListKeys.executions(organizationId, listId, filters),
4028
+ queryKey: acquisitionListKeys.executions(workOSOrganizationId, listId, filters),
3393
4029
  queryFn: async () => {
3394
4030
  const executions = await apiRequest(`/acquisition/lists/${listId}/executions`);
3395
4031
  const filteredExecutions = filters.resourceId ? executions.filter((execution) => execution.resourceId === filters.resourceId) : executions;
@@ -3399,7 +4035,7 @@ function useListExecutions(listId, filters = {}) {
3399
4035
  });
3400
4036
  }
3401
4037
  function useCreateList() {
3402
- const { apiRequest, organizationId } = useElevasisServices();
4038
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3403
4039
  const queryClient = useQueryClient();
3404
4040
  return useMutation({
3405
4041
  mutationFn: (body) => apiRequest("/acquisition/lists", {
@@ -3407,8 +4043,8 @@ function useCreateList() {
3407
4043
  body: JSON.stringify(body)
3408
4044
  }),
3409
4045
  onSuccess: () => {
3410
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
3411
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
4046
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(workOSOrganizationId) });
4047
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(workOSOrganizationId) });
3412
4048
  showSuccessNotification("List created");
3413
4049
  },
3414
4050
  onError: (error) => {
@@ -3417,7 +4053,7 @@ function useCreateList() {
3417
4053
  });
3418
4054
  }
3419
4055
  function useUpdateList(listId) {
3420
- const { apiRequest, organizationId } = useElevasisServices();
4056
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3421
4057
  const queryClient = useQueryClient();
3422
4058
  return useMutation({
3423
4059
  mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}`, {
@@ -3425,9 +4061,9 @@ function useUpdateList(listId) {
3425
4061
  body: JSON.stringify(body)
3426
4062
  }),
3427
4063
  onSuccess: () => {
3428
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
3429
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
3430
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
4064
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(workOSOrganizationId) });
4065
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, listId) });
4066
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(workOSOrganizationId) });
3431
4067
  showSuccessNotification("List updated");
3432
4068
  },
3433
4069
  onError: (error) => {
@@ -3436,7 +4072,7 @@ function useUpdateList(listId) {
3436
4072
  });
3437
4073
  }
3438
4074
  function useUpdateListConfig(listId) {
3439
- const { apiRequest, organizationId } = useElevasisServices();
4075
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3440
4076
  const queryClient = useQueryClient();
3441
4077
  return useMutation({
3442
4078
  mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/config`, {
@@ -3444,8 +4080,8 @@ function useUpdateListConfig(listId) {
3444
4080
  body: JSON.stringify(body)
3445
4081
  }),
3446
4082
  onSuccess: () => {
3447
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
3448
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
4083
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(workOSOrganizationId) });
4084
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, listId) });
3449
4085
  showSuccessNotification("List configuration saved");
3450
4086
  },
3451
4087
  onError: (error) => {
@@ -3454,15 +4090,15 @@ function useUpdateListConfig(listId) {
3454
4090
  });
3455
4091
  }
3456
4092
  function useDeleteList() {
3457
- const { apiRequest, organizationId } = useElevasisServices();
4093
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3458
4094
  const queryClient = useQueryClient();
3459
4095
  return useMutation({
3460
4096
  mutationFn: (listId) => apiRequest(`/acquisition/lists/${listId}`, {
3461
4097
  method: "DELETE"
3462
4098
  }),
3463
4099
  onSuccess: () => {
3464
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(organizationId) });
3465
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(organizationId) });
4100
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.list(workOSOrganizationId) });
4101
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.telemetry(workOSOrganizationId) });
3466
4102
  showSuccessNotification("List deleted");
3467
4103
  },
3468
4104
  onError: (error) => {
@@ -3472,13 +4108,10 @@ function useDeleteList() {
3472
4108
  }
3473
4109
 
3474
4110
  // src/hooks/executions/useWorkflowExecution.ts
3475
- function useWorkflowExecution({
3476
- workflowId,
3477
- listId
3478
- }) {
4111
+ function useWorkflowExecution({ workflowId, listId }) {
3479
4112
  const mutation = useExecuteAsync();
3480
4113
  const queryClient = useQueryClient();
3481
- const { organizationId } = useElevasisServices();
4114
+ const { workOSOrganizationId } = useElevasisServices();
3482
4115
  const execute = useCallback(
3483
4116
  async ({ input }) => {
3484
4117
  const result = await mutation.mutateAsync({
@@ -3487,16 +4120,16 @@ function useWorkflowExecution({
3487
4120
  input
3488
4121
  });
3489
4122
  queryClient.invalidateQueries({
3490
- queryKey: executionsKeys.executionsListBase(organizationId, workflowId)
4123
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, workflowId)
3491
4124
  });
3492
4125
  if (listId) {
3493
4126
  queryClient.invalidateQueries({
3494
- queryKey: acquisitionListKeys.executions(organizationId, listId)
4127
+ queryKey: acquisitionListKeys.executions(workOSOrganizationId, listId)
3495
4128
  });
3496
4129
  }
3497
4130
  return result;
3498
4131
  },
3499
- [listId, mutation, organizationId, queryClient, workflowId]
4132
+ [listId, mutation, workOSOrganizationId, queryClient, workflowId]
3500
4133
  );
3501
4134
  return {
3502
4135
  execute,
@@ -3524,21 +4157,15 @@ function useExecutionSSE(resourceId, options = {}) {
3524
4157
  const queryClient = useQueryClient();
3525
4158
  const features = useOptionalElevasisFeatures();
3526
4159
  const { currentMembership } = useOrganization();
3527
- const { isReady, organizationId } = useElevasisServices();
3528
- const {
3529
- enabled = true,
3530
- apiUrl: apiUrlOverride,
3531
- manager: managerOverride,
3532
- listId,
3533
- onEvent
3534
- } = options;
4160
+ const { isReady, workOSOrganizationId: serviceWorkOSOrganizationId } = useElevasisServices();
4161
+ const { enabled = true, apiUrl: apiUrlOverride, manager: managerOverride, listId, onEvent } = options;
3535
4162
  const [events, setEvents] = useState([]);
3536
4163
  const [liveExecutions, setLiveExecutions] = useState(/* @__PURE__ */ new Set());
3537
4164
  const [streamingLogs, setStreamingLogs] = useState(/* @__PURE__ */ new Map());
3538
4165
  const disabledManager = useMemo(() => createDisabledManager(), []);
3539
4166
  const apiUrl = apiUrlOverride ?? features?.operationsApiUrl;
3540
4167
  const manager = managerOverride ?? features?.operationsSSEManager ?? disabledManager;
3541
- const workOSOrganizationId = currentMembership?.organization?.workos_org_id ?? organizationId;
4168
+ const workOSOrganizationId = currentMembership?.organization?.workos_org_id ?? serviceWorkOSOrganizationId;
3542
4169
  const connectionKey = `execution-sse-${workOSOrganizationId ?? "unknown"}-${resourceId}`;
3543
4170
  const headers = useMemo(() => {
3544
4171
  if (!workOSOrganizationId) return {};
@@ -3565,7 +4192,7 @@ function useExecutionSSE(resourceId, options = {}) {
3565
4192
  return next;
3566
4193
  });
3567
4194
  queryClient.invalidateQueries({
3568
- queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
4195
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, resourceId)
3569
4196
  });
3570
4197
  break;
3571
4198
  case "execution-complete":
@@ -3580,17 +4207,17 @@ function useExecutionSSE(resourceId, options = {}) {
3580
4207
  return next;
3581
4208
  });
3582
4209
  queryClient.invalidateQueries({
3583
- queryKey: executionsKeys.executionsListBase(organizationId, resourceId)
4210
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, resourceId)
3584
4211
  });
3585
4212
  queryClient.invalidateQueries({
3586
- queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
4213
+ queryKey: executionsKeys.execution(workOSOrganizationId, resourceId, event.executionId)
3587
4214
  });
3588
4215
  if (listId) {
3589
4216
  queryClient.invalidateQueries({
3590
- queryKey: acquisitionListKeys.executions(organizationId, listId)
4217
+ queryKey: acquisitionListKeys.executions(workOSOrganizationId, listId)
3591
4218
  });
3592
4219
  queryClient.invalidateQueries({
3593
- queryKey: acquisitionListKeys.progress(organizationId, listId)
4220
+ queryKey: acquisitionListKeys.progress(workOSOrganizationId, listId)
3594
4221
  });
3595
4222
  }
3596
4223
  break;
@@ -3602,7 +4229,7 @@ function useExecutionSSE(resourceId, options = {}) {
3602
4229
  return next;
3603
4230
  });
3604
4231
  queryClient.invalidateQueries({
3605
- queryKey: executionsKeys.execution(organizationId, resourceId, event.executionId)
4232
+ queryKey: executionsKeys.execution(workOSOrganizationId, resourceId, event.executionId)
3606
4233
  });
3607
4234
  break;
3608
4235
  case "connected":
@@ -3611,7 +4238,7 @@ function useExecutionSSE(resourceId, options = {}) {
3611
4238
  } catch {
3612
4239
  }
3613
4240
  },
3614
- [listId, onEvent, organizationId, queryClient, resourceId]
4241
+ [listId, onEvent, workOSOrganizationId, queryClient, resourceId]
3615
4242
  );
3616
4243
  const { connected, error } = useSSEConnection({
3617
4244
  manager,
@@ -3636,7 +4263,7 @@ function useExecutionSSE(resourceId, options = {}) {
3636
4263
  };
3637
4264
  }
3638
4265
  function useRetryExecution() {
3639
- const { apiRequest, organizationId } = useElevasisServices();
4266
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3640
4267
  const queryClient = useQueryClient();
3641
4268
  return useMutation({
3642
4269
  mutationFn: async ({ resourceId, resourceType, input }) => {
@@ -3648,13 +4275,13 @@ function useRetryExecution() {
3648
4275
  },
3649
4276
  onSuccess: (data) => {
3650
4277
  queryClient.invalidateQueries({
3651
- queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
4278
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, data.resourceId)
3652
4279
  });
3653
4280
  }
3654
4281
  });
3655
4282
  }
3656
4283
  function useCancelExecution() {
3657
- const { apiRequest, organizationId } = useElevasisServices();
4284
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3658
4285
  const queryClient = useQueryClient();
3659
4286
  return useMutation({
3660
4287
  mutationFn: async ({ resourceId, executionId }) => {
@@ -3666,16 +4293,16 @@ function useCancelExecution() {
3666
4293
  },
3667
4294
  onSuccess: (data) => {
3668
4295
  queryClient.invalidateQueries({
3669
- queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
4296
+ queryKey: executionsKeys.execution(workOSOrganizationId, data.resourceId, data.executionId)
3670
4297
  });
3671
4298
  queryClient.invalidateQueries({
3672
- queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
4299
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, data.resourceId)
3673
4300
  });
3674
4301
  }
3675
4302
  });
3676
4303
  }
3677
4304
  function useDeleteExecution() {
3678
- const { apiRequest, organizationId } = useElevasisServices();
4305
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3679
4306
  const queryClient = useQueryClient();
3680
4307
  return useMutation({
3681
4308
  mutationFn: async ({ resourceId, executionId }) => {
@@ -3686,16 +4313,16 @@ function useDeleteExecution() {
3686
4313
  },
3687
4314
  onSuccess: (data) => {
3688
4315
  queryClient.removeQueries({
3689
- queryKey: executionsKeys.execution(organizationId, data.resourceId, data.executionId)
4316
+ queryKey: executionsKeys.execution(workOSOrganizationId, data.resourceId, data.executionId)
3690
4317
  });
3691
4318
  queryClient.invalidateQueries({
3692
- queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
4319
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, data.resourceId)
3693
4320
  });
3694
4321
  }
3695
4322
  });
3696
4323
  }
3697
4324
  function useBulkDeleteExecutions() {
3698
- const { apiRequest, organizationId } = useElevasisServices();
4325
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
3699
4326
  const queryClient = useQueryClient();
3700
4327
  return useMutation({
3701
4328
  mutationFn: async ({
@@ -3716,15 +4343,15 @@ function useBulkDeleteExecutions() {
3716
4343
  },
3717
4344
  onSuccess: (data) => {
3718
4345
  queryClient.invalidateQueries({
3719
- queryKey: executionsKeys.executionsListBase(organizationId, data.resourceId)
4346
+ queryKey: executionsKeys.executionsListBase(workOSOrganizationId, data.resourceId)
3720
4347
  });
3721
4348
  }
3722
4349
  });
3723
4350
  }
3724
4351
  function useResourceDefinition(resourceId, enabled = true) {
3725
- const { apiRequest, organizationId, isReady } = useElevasisServices();
4352
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
3726
4353
  return useQuery({
3727
- queryKey: executionsKeys.resourceDefinition(organizationId, resourceId),
4354
+ queryKey: executionsKeys.resourceDefinition(workOSOrganizationId, resourceId),
3728
4355
  queryFn: () => {
3729
4356
  const service = new OperationsService(apiRequest);
3730
4357
  return service.getResourceDefinition(resourceId);
@@ -3781,9 +4408,9 @@ function useActivitiesRealtime(organizationId, enabled) {
3781
4408
  }, [organizationId, enabled, queryClient, supabase]);
3782
4409
  }
3783
4410
  function useErrorAnalysis(timeRange) {
3784
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4411
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3785
4412
  return useQuery({
3786
- queryKey: observabilityKeys.errorAnalysis(organizationId, timeRange),
4413
+ queryKey: observabilityKeys.errorAnalysis(workOSOrganizationId, timeRange),
3787
4414
  queryFn: async () => {
3788
4415
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3789
4416
  return apiRequest(`/observability/error-analysis?startDate=${startDate}&endDate=${endDate}`);
@@ -3793,9 +4420,9 @@ function useErrorAnalysis(timeRange) {
3793
4420
  });
3794
4421
  }
3795
4422
  function useErrorDistribution({ startDate, endDate, groupBy }) {
3796
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4423
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3797
4424
  return useQuery({
3798
- queryKey: observabilityKeys.errorDistribution(organizationId, startDate, endDate, groupBy),
4425
+ queryKey: observabilityKeys.errorDistribution(workOSOrganizationId, startDate, endDate, groupBy),
3799
4426
  queryFn: async () => {
3800
4427
  const params = new URLSearchParams({ startDate, endDate, groupBy });
3801
4428
  return apiRequest(`/observability/error-analytics/distribution?${params.toString()}`);
@@ -3806,9 +4433,9 @@ function useErrorDistribution({ startDate, endDate, groupBy }) {
3806
4433
  });
3807
4434
  }
3808
4435
  function useTopFailingResources({ startDate, endDate, limit = 10 }) {
3809
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4436
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3810
4437
  return useQuery({
3811
- queryKey: observabilityKeys.topFailingResources(organizationId, startDate, endDate, limit),
4438
+ queryKey: observabilityKeys.topFailingResources(workOSOrganizationId, startDate, endDate, limit),
3812
4439
  queryFn: async () => {
3813
4440
  const params = new URLSearchParams({ startDate, endDate, limit: String(limit) });
3814
4441
  return apiRequest(`/observability/error-analytics/top-resources?${params.toString()}`);
@@ -3823,9 +4450,9 @@ function getGranularityFromTimeRange(timeRange) {
3823
4450
  }
3824
4451
  function useCostTrends(timeRange, granularity) {
3825
4452
  const resolvedGranularity = granularity ?? getGranularityFromTimeRange(timeRange);
3826
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4453
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3827
4454
  return useQuery({
3828
- queryKey: observabilityKeys.costTrends(organizationId, timeRange, resolvedGranularity),
4455
+ queryKey: observabilityKeys.costTrends(workOSOrganizationId, timeRange, resolvedGranularity),
3829
4456
  queryFn: async () => {
3830
4457
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3831
4458
  const params = new URLSearchParams({ startDate, endDate, granularity: resolvedGranularity });
@@ -3836,9 +4463,9 @@ function useCostTrends(timeRange, granularity) {
3836
4463
  });
3837
4464
  }
3838
4465
  function useCostByModel(timeRange) {
3839
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4466
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3840
4467
  return useQuery({
3841
- queryKey: observabilityKeys.costByModel(organizationId, timeRange),
4468
+ queryKey: observabilityKeys.costByModel(workOSOrganizationId, timeRange),
3842
4469
  queryFn: async () => {
3843
4470
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3844
4471
  const params = new URLSearchParams({ startDate, endDate });
@@ -3849,9 +4476,9 @@ function useCostByModel(timeRange) {
3849
4476
  });
3850
4477
  }
3851
4478
  function useCostBreakdown(timeRange) {
3852
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4479
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3853
4480
  return useQuery({
3854
- queryKey: observabilityKeys.costBreakdown(organizationId, timeRange),
4481
+ queryKey: observabilityKeys.costBreakdown(workOSOrganizationId, timeRange),
3855
4482
  queryFn: async () => {
3856
4483
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3857
4484
  const params = new URLSearchParams({ startDate, endDate });
@@ -3862,9 +4489,9 @@ function useCostBreakdown(timeRange) {
3862
4489
  });
3863
4490
  }
3864
4491
  function useDashboardMetrics(timeRange) {
3865
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4492
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3866
4493
  return useQuery({
3867
- queryKey: observabilityKeys.dashboardMetrics(organizationId, timeRange),
4494
+ queryKey: observabilityKeys.dashboardMetrics(workOSOrganizationId, timeRange),
3868
4495
  queryFn: async () => {
3869
4496
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3870
4497
  const params = new URLSearchParams({ startDate, endDate });
@@ -3875,9 +4502,9 @@ function useDashboardMetrics(timeRange) {
3875
4502
  });
3876
4503
  }
3877
4504
  function useBusinessImpact(timeRange) {
3878
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4505
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3879
4506
  return useQuery({
3880
- queryKey: observabilityKeys.businessImpact(organizationId, timeRange),
4507
+ queryKey: observabilityKeys.businessImpact(workOSOrganizationId, timeRange),
3881
4508
  queryFn: async () => {
3882
4509
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3883
4510
  const params = new URLSearchParams({ startDate, endDate });
@@ -3889,7 +4516,7 @@ function useBusinessImpact(timeRange) {
3889
4516
  }
3890
4517
  var BATCH_SIZE = 20;
3891
4518
  function useBatchedResourcesHealth(params) {
3892
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4519
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3893
4520
  const batches = useMemo(() => {
3894
4521
  const result = [];
3895
4522
  for (let i = 0; i < params.resources.length; i += BATCH_SIZE) {
@@ -3900,7 +4527,7 @@ function useBatchedResourcesHealth(params) {
3900
4527
  const queryResults = useQueries({
3901
4528
  queries: batches.map((batch) => ({
3902
4529
  queryKey: observabilityKeys.resourcesHealth(
3903
- organizationId,
4530
+ workOSOrganizationId,
3904
4531
  batch.map((r) => `${r.entityType}-${r.entityId}`).join(","),
3905
4532
  params.startDate,
3906
4533
  params.endDate,
@@ -3935,9 +4562,9 @@ function useBatchedResourcesHealth(params) {
3935
4562
  return { healthLookup };
3936
4563
  }
3937
4564
  function useUnresolvedErrors({ startDate, endDate }) {
3938
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4565
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3939
4566
  return useQuery({
3940
- queryKey: observabilityKeys.unresolvedErrors(organizationId, startDate, endDate),
4567
+ queryKey: observabilityKeys.unresolvedErrors(workOSOrganizationId, startDate, endDate),
3941
4568
  queryFn: async () => {
3942
4569
  const params = new URLSearchParams({
3943
4570
  resolved: "false",
@@ -3954,9 +4581,9 @@ function useUnresolvedErrors({ startDate, endDate }) {
3954
4581
  });
3955
4582
  }
3956
4583
  function useRecentExecutionsByResource({ timeRange, limit }) {
3957
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4584
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
3958
4585
  return useQuery({
3959
- queryKey: observabilityKeys.recentExecutionsByResource(organizationId, timeRange, limit),
4586
+ queryKey: observabilityKeys.recentExecutionsByResource(workOSOrganizationId, timeRange, limit),
3960
4587
  queryFn: async () => {
3961
4588
  const { startDate, endDate } = getTimeRangeDates(timeRange);
3962
4589
  const params = new URLSearchParams({
@@ -4334,9 +4961,9 @@ var requestsKeys = {
4334
4961
  detail: (organizationId, id) => [...requestsKeys.details(), organizationId, id]
4335
4962
  };
4336
4963
  function useRequestsList(filters = {}) {
4337
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4964
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
4338
4965
  return useQuery({
4339
- queryKey: requestsKeys.list(organizationId ?? void 0, filters),
4966
+ queryKey: requestsKeys.list(workOSOrganizationId ?? void 0, filters),
4340
4967
  queryFn: async () => {
4341
4968
  const { type, severity, status, source, limit, offset } = filters;
4342
4969
  const params = new URLSearchParams();
@@ -4354,9 +4981,9 @@ function useRequestsList(filters = {}) {
4354
4981
  });
4355
4982
  }
4356
4983
  function useRequest(id) {
4357
- const { apiRequest, isReady, organizationId } = useElevasisServices();
4984
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
4358
4985
  return useQuery({
4359
- queryKey: requestsKeys.detail(organizationId ?? void 0, id),
4986
+ queryKey: requestsKeys.detail(workOSOrganizationId ?? void 0, id),
4360
4987
  queryFn: async () => {
4361
4988
  const { request } = await apiRequest(`/requests/${id}`);
4362
4989
  return request;
@@ -4365,7 +4992,7 @@ function useRequest(id) {
4365
4992
  });
4366
4993
  }
4367
4994
  function useUpdateRequestStatus() {
4368
- const { apiRequest, organizationId } = useElevasisServices();
4995
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4369
4996
  const queryClient = useQueryClient();
4370
4997
  return useMutation({
4371
4998
  mutationFn: async ({ id, status }) => {
@@ -4378,7 +5005,7 @@ function useUpdateRequestStatus() {
4378
5005
  onSuccess: (_data, { id }) => {
4379
5006
  queryClient.invalidateQueries({ queryKey: requestsKeys.lists() });
4380
5007
  queryClient.invalidateQueries({
4381
- queryKey: requestsKeys.detail(organizationId ?? void 0, id)
5008
+ queryKey: requestsKeys.detail(workOSOrganizationId ?? void 0, id)
4382
5009
  });
4383
5010
  }
4384
5011
  });
@@ -4396,10 +5023,120 @@ function useDeleteRequest() {
4396
5023
  }
4397
5024
  });
4398
5025
  }
5026
+
5027
+ // src/hooks/clients/queryKeys.ts
5028
+ var clientsKeys = {
5029
+ all: ["clients"],
5030
+ lists: () => [...clientsKeys.all, "list"],
5031
+ list: (organizationId, filters) => [...clientsKeys.lists(), organizationId, filters],
5032
+ statuses: () => [...clientsKeys.all, "status"],
5033
+ status: (organizationId) => [...clientsKeys.statuses(), organizationId],
5034
+ details: () => [...clientsKeys.all, "detail"],
5035
+ detail: (organizationId, id) => [...clientsKeys.details(), organizationId, id]
5036
+ };
5037
+ function useClients(filters = {}) {
5038
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
5039
+ return useQuery({
5040
+ queryKey: clientsKeys.list(workOSOrganizationId ?? void 0, filters),
5041
+ queryFn: async () => {
5042
+ const { status, search, limit, offset } = filters;
5043
+ const params = new URLSearchParams();
5044
+ if (status) params.set("status", status);
5045
+ if (search) params.set("search", search);
5046
+ if (limit !== void 0) params.set("limit", String(limit));
5047
+ if (offset !== void 0) params.set("offset", String(offset));
5048
+ const query = params.toString();
5049
+ return apiRequest(`/clients${query ? "?" + query : ""}`);
5050
+ },
5051
+ enabled: isReady
5052
+ });
5053
+ }
5054
+ function useClientStatus() {
5055
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
5056
+ return useQuery({
5057
+ queryKey: clientsKeys.status(workOSOrganizationId ?? void 0),
5058
+ queryFn: async () => {
5059
+ return apiRequest("/clients/status");
5060
+ },
5061
+ enabled: isReady
5062
+ });
5063
+ }
5064
+ function useClient(clientId) {
5065
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
5066
+ return useQuery({
5067
+ queryKey: clientsKeys.detail(workOSOrganizationId ?? void 0, clientId),
5068
+ queryFn: async () => {
5069
+ return apiRequest(`/clients/${clientId}`);
5070
+ },
5071
+ enabled: isReady && !!clientId
5072
+ });
5073
+ }
5074
+ function useCreateClient() {
5075
+ const { apiRequest } = useElevasisServices();
5076
+ const queryClient = useQueryClient();
5077
+ return useMutation({
5078
+ mutationFn: async (data) => {
5079
+ return apiRequest("/clients", {
5080
+ method: "POST",
5081
+ body: JSON.stringify(data)
5082
+ });
5083
+ },
5084
+ onSuccess: () => {
5085
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.lists() });
5086
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.statuses() });
5087
+ },
5088
+ onError: (error) => {
5089
+ console.error("Failed to create client:", error);
5090
+ showApiErrorNotification(error);
5091
+ }
5092
+ });
5093
+ }
5094
+ function useUpdateClient() {
5095
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
5096
+ const queryClient = useQueryClient();
5097
+ return useMutation({
5098
+ mutationFn: async ({ clientId, updates }) => {
5099
+ return apiRequest(`/clients/${clientId}`, {
5100
+ method: "PATCH",
5101
+ body: JSON.stringify(updates)
5102
+ });
5103
+ },
5104
+ onSuccess: (_data, { clientId }) => {
5105
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.lists() });
5106
+ void queryClient.invalidateQueries({
5107
+ queryKey: clientsKeys.detail(workOSOrganizationId ?? void 0, clientId)
5108
+ });
5109
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.statuses() });
5110
+ },
5111
+ onError: (error) => {
5112
+ console.error("Failed to update client:", error);
5113
+ showApiErrorNotification(error);
5114
+ }
5115
+ });
5116
+ }
5117
+ function useDeleteClient() {
5118
+ const { apiRequest } = useElevasisServices();
5119
+ const queryClient = useQueryClient();
5120
+ return useMutation({
5121
+ mutationFn: async (clientId) => {
5122
+ await apiRequest(`/clients/${clientId}`, {
5123
+ method: "DELETE"
5124
+ });
5125
+ },
5126
+ onSuccess: () => {
5127
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.lists() });
5128
+ void queryClient.invalidateQueries({ queryKey: clientsKeys.statuses() });
5129
+ },
5130
+ onError: (error) => {
5131
+ console.error("Failed to delete client:", error);
5132
+ showApiErrorNotification(error);
5133
+ }
5134
+ });
5135
+ }
4399
5136
  function useResourceErrors({ resourceId, timeRange, hasFailures }) {
4400
- const { apiRequest, organizationId, isReady } = useElevasisServices();
5137
+ const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
4401
5138
  return useQuery({
4402
- queryKey: ["resource-errors", organizationId, resourceId, timeRange],
5139
+ queryKey: ["resource-errors", workOSOrganizationId, resourceId, timeRange],
4403
5140
  queryFn: async () => {
4404
5141
  return apiRequest(
4405
5142
  `/command-view/resource-errors?resourceId=${resourceId}&timeRange=${timeRange}`
@@ -4411,9 +5148,9 @@ function useResourceErrors({ resourceId, timeRange, hasFailures }) {
4411
5148
  });
4412
5149
  }
4413
5150
  function useDealDetail(acqDealId) {
4414
- const { apiRequest, isReady, organizationId } = useElevasisServices();
5151
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
4415
5152
  return useQuery({
4416
- queryKey: ["deal-detail", organizationId, acqDealId],
5153
+ queryKey: ["deal-detail", workOSOrganizationId, acqDealId],
4417
5154
  queryFn: async () => {
4418
5155
  if (!acqDealId) return null;
4419
5156
  try {
@@ -4427,7 +5164,7 @@ function useDealDetail(acqDealId) {
4427
5164
  });
4428
5165
  }
4429
5166
  function useTransitionState() {
4430
- const { apiRequest, organizationId } = useElevasisServices();
5167
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4431
5168
  const queryClient = useQueryClient();
4432
5169
  return useMutation({
4433
5170
  mutationFn: async (input) => {
@@ -4444,7 +5181,7 @@ function useTransitionState() {
4444
5181
  onSuccess: (_, variables) => {
4445
5182
  queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
4446
5183
  queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
4447
- queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, variables.dealId] });
5184
+ queryClient.invalidateQueries({ queryKey: ["deal-detail", workOSOrganizationId, variables.dealId] });
4448
5185
  },
4449
5186
  onError: (error) => {
4450
5187
  queryClient.invalidateQueries({ queryKey: dealKeys.all });
@@ -4453,7 +5190,7 @@ function useTransitionState() {
4453
5190
  });
4454
5191
  }
4455
5192
  function useExecuteAction({ dealId }) {
4456
- const { apiRequest, organizationId } = useElevasisServices();
5193
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4457
5194
  const queryClient = useQueryClient();
4458
5195
  return useMutation({
4459
5196
  mutationFn: async ({ key, payload }) => {
@@ -4465,7 +5202,7 @@ function useExecuteAction({ dealId }) {
4465
5202
  onSuccess: () => {
4466
5203
  queryClient.invalidateQueries({ queryKey: dealKeys.lists() });
4467
5204
  queryClient.invalidateQueries({ queryKey: dealKeys.summaries() });
4468
- queryClient.invalidateQueries({ queryKey: ["deal-detail", organizationId, dealId] });
5205
+ queryClient.invalidateQueries({ queryKey: ["deal-detail", workOSOrganizationId, dealId] });
4469
5206
  },
4470
5207
  onError: (error) => {
4471
5208
  queryClient.invalidateQueries({ queryKey: dealKeys.all });
@@ -4478,9 +5215,9 @@ var dealNoteKeys = {
4478
5215
  list: (organizationId, dealId) => ["deal-notes", organizationId, dealId]
4479
5216
  };
4480
5217
  function useDealNotes(dealId) {
4481
- const { apiRequest, isReady, organizationId } = useElevasisServices();
5218
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
4482
5219
  return useQuery({
4483
- queryKey: dealNoteKeys.list(organizationId, dealId),
5220
+ queryKey: dealNoteKeys.list(workOSOrganizationId, dealId),
4484
5221
  queryFn: async () => {
4485
5222
  return apiRequest(`/deals/${dealId}/notes`);
4486
5223
  },
@@ -4488,7 +5225,7 @@ function useDealNotes(dealId) {
4488
5225
  });
4489
5226
  }
4490
5227
  function useCreateDealNote() {
4491
- const { apiRequest, organizationId } = useElevasisServices();
5228
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4492
5229
  const queryClient = useQueryClient();
4493
5230
  return useMutation({
4494
5231
  mutationFn: async ({ dealId, body }) => {
@@ -4498,8 +5235,8 @@ function useCreateDealNote() {
4498
5235
  });
4499
5236
  },
4500
5237
  onSuccess: (_, variables) => {
4501
- queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(organizationId, variables.dealId) });
4502
- queryClient.invalidateQueries({ queryKey: ["recent-crm-activity", organizationId] });
5238
+ queryClient.invalidateQueries({ queryKey: dealNoteKeys.list(workOSOrganizationId, variables.dealId) });
5239
+ queryClient.invalidateQueries({ queryKey: ["recent-crm-activity", workOSOrganizationId] });
4503
5240
  showSuccessNotification("Note added");
4504
5241
  },
4505
5242
  onError: (error) => {
@@ -4508,7 +5245,7 @@ function useCreateDealNote() {
4508
5245
  });
4509
5246
  }
4510
5247
  function useAddCompaniesToList(listId) {
4511
- const { apiRequest, organizationId } = useElevasisServices();
5248
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4512
5249
  const queryClient = useQueryClient();
4513
5250
  return useMutation({
4514
5251
  mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/companies`, {
@@ -4517,9 +5254,9 @@ function useAddCompaniesToList(listId) {
4517
5254
  }),
4518
5255
  onSuccess: () => {
4519
5256
  queryClient.invalidateQueries({ queryKey: companyKeys.all });
4520
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
4521
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(organizationId, listId) });
4522
- queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, listId) });
5257
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, listId) });
5258
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(workOSOrganizationId, listId) });
5259
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(workOSOrganizationId, listId) });
4523
5260
  showSuccessNotification("Companies added to list");
4524
5261
  },
4525
5262
  onError: (error) => {
@@ -4528,7 +5265,7 @@ function useAddCompaniesToList(listId) {
4528
5265
  });
4529
5266
  }
4530
5267
  function useRemoveCompaniesFromList(listId) {
4531
- const { apiRequest, organizationId } = useElevasisServices();
5268
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4532
5269
  const queryClient = useQueryClient();
4533
5270
  return useMutation({
4534
5271
  mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/companies`, {
@@ -4537,9 +5274,9 @@ function useRemoveCompaniesFromList(listId) {
4537
5274
  }),
4538
5275
  onSuccess: () => {
4539
5276
  queryClient.invalidateQueries({ queryKey: companyKeys.all });
4540
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
4541
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(organizationId, listId) });
4542
- queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, listId) });
5277
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, listId) });
5278
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(workOSOrganizationId, listId) });
5279
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(workOSOrganizationId, listId) });
4543
5280
  showSuccessNotification("Companies removed from list");
4544
5281
  },
4545
5282
  onError: (error) => {
@@ -4548,7 +5285,7 @@ function useRemoveCompaniesFromList(listId) {
4548
5285
  });
4549
5286
  }
4550
5287
  function useAddContactsToList(listId) {
4551
- const { apiRequest, organizationId } = useElevasisServices();
5288
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
4552
5289
  const queryClient = useQueryClient();
4553
5290
  return useMutation({
4554
5291
  mutationFn: (body) => apiRequest(`/acquisition/lists/${listId}/contacts`, {
@@ -4557,9 +5294,9 @@ function useAddContactsToList(listId) {
4557
5294
  }),
4558
5295
  onSuccess: () => {
4559
5296
  queryClient.invalidateQueries({ queryKey: contactKeys.all });
4560
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(organizationId, listId) });
4561
- queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(organizationId, listId) });
4562
- queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(organizationId, listId) });
5297
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.detail(workOSOrganizationId, listId) });
5298
+ queryClient.invalidateQueries({ queryKey: acquisitionListKeys.progress(workOSOrganizationId, listId) });
5299
+ queryClient.invalidateQueries({ queryKey: leadGenListMemberKeys.list(workOSOrganizationId, listId) });
4563
5300
  showSuccessNotification("Contacts added to list");
4564
5301
  },
4565
5302
  onError: (error) => {
@@ -5067,7 +5804,7 @@ var noopSSEManager = {
5067
5804
  function useProjectRealtime(projectId) {
5068
5805
  const queryClient = useQueryClient();
5069
5806
  const features = useOptionalElevasisFeatures();
5070
- const { isReady, organizationId } = useElevasisServices();
5807
+ const { isReady, workOSOrganizationId } = useElevasisServices();
5071
5808
  const { currentMembership } = useOrganization();
5072
5809
  const deliveryApiUrl = features?.deliveryApiUrl;
5073
5810
  const deliverySSEManager = features?.deliverySSEManager ?? noopSSEManager;
@@ -5114,7 +5851,7 @@ function useProjectRealtime(projectId) {
5114
5851
  );
5115
5852
  useSSEConnection({
5116
5853
  manager: deliverySSEManager,
5117
- connectionKey: `delivery-${currentWorkOSOrganizationId ?? organizationId ?? projectId ?? "unknown"}`,
5854
+ connectionKey: `delivery-${currentWorkOSOrganizationId ?? workOSOrganizationId ?? projectId ?? "unknown"}`,
5118
5855
  url: deliveryApiUrl ? `${deliveryApiUrl}/api/projects/sse` : "",
5119
5856
  enabled: Boolean(deliveryApiUrl && features?.deliverySSEManager && currentWorkOSOrganizationId && isReady),
5120
5857
  headers,
@@ -5123,4 +5860,4 @@ function useProjectRealtime(projectId) {
5123
5860
  });
5124
5861
  }
5125
5862
 
5126
- 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, useAddCompaniesToList, useAddContactsToList, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, 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, useExecutionSSE, useExecutions, useGetExecutionHistory, useGetSchedule, 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, useRemoveCompaniesFromList, 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, useTransitionState, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMemberConfig, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVisibleResources, useWarningNotification, useWorkflowExecution };
5863
+ export { ApiKeyService, COMMAND_VIEW_VISUALIZATION_MODES, CredentialSchemas, CredentialService, DEFAULT_CLUSTER_PARAMETERS, DEFAULT_FOCUS_PARAMETERS, DEFAULT_FORCE_PARAMETERS, DEFAULT_NETWORK_PARAMETERS, DEFAULT_SWIMLANE_PARAMETERS, DOMAIN_ZONE_TINT_COLOR, DeploymentService, EXPLORE_OM_ROOT_ID, MEMBERSHIP_STATUS_COLORS, OperationsService, OrganizationMembershipService, WebhookEndpointService, acquisitionListKeys, buildCommandViewGraphIndex, clientsKeys, collectResourceFilterFacets, companyKeys, contactKeys, dealKeys, dealNoteKeys, dealTaskKeys, executionsKeys, exploreNodeHasChildren, filterByDomainFilters, getCommandViewClusterZoneLabels, getCommandViewGraphPositions, getCommandViewNodeDomain, getCommandViewSwimlaneLaneLabels, getDefaultParameters, getExploreFocusSet, getExploreProjection, getNextExpandedSetForToggle, getRadialFromAnchorProjection, getResourceFilterFacetIds, isSessionCapable, labelResourceFilterFacet, leadGenArtifactKeys, leadGenListCompanyKeys, leadGenListMemberKeys, operationsKeys, projectActivityKeys, requestsKeys, scheduleKeys, sessionsKeys, sortData, transformMembershipToTableRow, useActivateDeployment, useActivities, useActivitiesRealtime, useActivityFilters, useActivityTrend, useAddCompaniesToList, useAddContactsToList, useArchiveSession, useArchivedLogs, useArtifacts, useAssignRole, useBatchDelete, useBatchTelemetry, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCheckpointTasks, useClient, useClientStatus, useClients, useCommandQueue, useCommandQueueTotals, useCommandViewData, useCommandViewDomainFilters, useCommandViewStats, useCommandViewStore, useCompanies, useCompany, useCompanyFacets, useCompleteDealTask, useContact, useContacts, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateApiKey, useCreateArtifact, useCreateClient, useCreateCompany, useCreateContact, useCreateCredential, useCreateDealNote, useCreateDealTask, useCreateList, useCreateOrgRole, useCreateSchedule, useCreateSession, useCreateWebhookEndpoint, useCredentials, useDashboardMetrics, useDeactivateDeployment, useDeactivateMembership, useDealDetail, useDealNotes, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteApiKey, useDeleteClient, 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, useExecutionSSE, useExecutions, useGetExecutionHistory, useGetSchedule, useHasPermission, useInFlightExecutions, useList, useListApiKeys, useListDeployments, useListExecutions, useListMember, useListMembers, useListProgress, useListRecords, useListSchedules, useListWebhookEndpoints, useLists, useListsTelemetry, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, useOrgRoles, useOrganizationMembers, useOrganizationPermissions, usePaginationState, usePatchTask, usePauseSchedule, usePermissionCatalog, useProjectActivities, useProjectRealtime, useReactivateMembership, useRecentExecutionsByResource, useRemoveCompaniesFromList, 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, useTransitionState, useUnresolveError, useUnresolvedErrors, useUpdateAnchor, useUpdateApiKey, useUpdateClient, useUpdateCompany, useUpdateContact, useUpdateCredential, useUpdateList, useUpdateListConfig, useUpdateListStatus, useUpdateMemberConfig, useUpdateOrgRole, useUpdateRequestStatus, useUpdateSchedule, useUpdateWebhookEndpoint, useUserMemberships, useVerifyCredential, useVisibleResources, useWarningNotification, useWorkflowExecution };