@elevasis/ui 2.40.1 → 2.41.1

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 (92) hide show
  1. package/dist/api/index.js +4 -6
  2. package/dist/app/index.css +384 -0
  3. package/dist/app/index.d.ts +108 -0
  4. package/dist/app/index.js +17 -27
  5. package/dist/auth/index.css +659 -0
  6. package/dist/auth/index.js +19 -6
  7. package/dist/charts/index.css +533 -0
  8. package/dist/charts/index.js +18 -15
  9. package/dist/{chunk-RXH4D6TY.js → chunk-5M4HSHQ5.js} +631 -2
  10. package/dist/{chunk-TE4P6OSJ.js → chunk-7FJI76OH.js} +1 -1
  11. package/dist/chunk-GMXGDO3I.js +244 -0
  12. package/dist/{chunk-CXY7FMUM.js → chunk-GUKY77FJ.js} +50 -4
  13. package/dist/{chunk-5JYKCULK.js → chunk-NZ2F5RQ4.js} +44 -2
  14. package/dist/{chunk-WF7CONXF.js → chunk-OJJK27GC.js} +658 -6
  15. package/dist/{chunk-RX6RSKWC.js → chunk-QDXTIQT4.js} +29255 -18312
  16. package/dist/{chunk-73EWE2EW.js → chunk-V5HWC5EW.js} +1 -1
  17. package/dist/components/chat/index.js +1 -2
  18. package/dist/components/index.css +149 -149
  19. package/dist/components/index.js +13 -37
  20. package/dist/components/navigation/index.css +659 -0
  21. package/dist/components/navigation/index.js +25 -4
  22. package/dist/features/auth/index.js +14 -38
  23. package/dist/features/clients/index.css +149 -149
  24. package/dist/features/clients/index.js +13 -37
  25. package/dist/features/crm/index.js +13 -37
  26. package/dist/features/dashboard/index.js +13 -37
  27. package/dist/features/delivery/index.js +13 -37
  28. package/dist/features/knowledge/index.css +659 -0
  29. package/dist/features/knowledge/index.js +25 -248
  30. package/dist/features/lead-gen/index.d.ts +81 -0
  31. package/dist/features/lead-gen/index.js +13 -37
  32. package/dist/features/monitoring/index.js +13 -37
  33. package/dist/features/monitoring/requests/index.d.ts +69 -7
  34. package/dist/features/monitoring/requests/index.js +32 -41
  35. package/dist/features/operations/index.d.ts +79 -0
  36. package/dist/features/operations/index.js +13 -37
  37. package/dist/features/seo/index.js +1 -4
  38. package/dist/features/settings/index.js +13 -37
  39. package/dist/hooks/access/index.css +659 -0
  40. package/dist/hooks/access/index.js +19 -5
  41. package/dist/hooks/delivery/index.js +13 -37
  42. package/dist/hooks/index.d.ts +18 -6
  43. package/dist/hooks/index.js +13 -37
  44. package/dist/hooks/published.d.ts +18 -6
  45. package/dist/hooks/published.js +13 -37
  46. package/dist/index.d.ts +151 -7
  47. package/dist/index.js +14 -38
  48. package/dist/initialization/index.js +1 -1
  49. package/dist/knowledge/index.css +659 -0
  50. package/dist/knowledge/index.d.ts +81 -0
  51. package/dist/knowledge/index.js +25 -15
  52. package/dist/layout/index.css +659 -0
  53. package/dist/layout/index.d.ts +18 -2
  54. package/dist/layout/index.js +24 -7
  55. package/dist/organization/index.js +13 -37
  56. package/dist/provider/index.css +384 -0
  57. package/dist/provider/index.d.ts +120 -1
  58. package/dist/provider/index.js +18 -22
  59. package/dist/provider/published.css +533 -0
  60. package/dist/provider/published.d.ts +121 -2
  61. package/dist/provider/published.js +18 -17
  62. package/dist/test-utils/index.js +4 -6
  63. package/dist/theme/index.js +2 -5
  64. package/dist/theme/presets/index.js +1 -2
  65. package/dist/utils/index.js +1 -3
  66. package/package.json +3 -3
  67. package/dist/chunk-3KMDHCAR.js +0 -52
  68. package/dist/chunk-4DRI3G36.js +0 -1016
  69. package/dist/chunk-5EYJ2GIN.js +0 -122
  70. package/dist/chunk-66U7JOWV.js +0 -425
  71. package/dist/chunk-6D4LCJ52.js +0 -10
  72. package/dist/chunk-6EV47QQW.js +0 -340
  73. package/dist/chunk-6ROXVZ3L.js +0 -9
  74. package/dist/chunk-7MTWRSUZ.js +0 -357
  75. package/dist/chunk-7PHY5ONQ.js +0 -85
  76. package/dist/chunk-B2DZLPDL.js +0 -39
  77. package/dist/chunk-CLDCYJQT.js +0 -1
  78. package/dist/chunk-CTJBPF3Z.js +0 -734
  79. package/dist/chunk-DT3QYZVU.js +0 -23
  80. package/dist/chunk-IIMU5YAJ.js +0 -53
  81. package/dist/chunk-IUQAP4IO.js +0 -2131
  82. package/dist/chunk-J3FLIZY4.js +0 -423
  83. package/dist/chunk-K7GKKETO.js +0 -3157
  84. package/dist/chunk-L7GXUSCV.js +0 -215
  85. package/dist/chunk-LJDYY3XB.js +0 -133
  86. package/dist/chunk-NYBEU5TE.js +0 -118
  87. package/dist/chunk-RH5VWWSC.js +0 -624
  88. package/dist/chunk-SJNIOGVX.js +0 -112
  89. package/dist/chunk-TYRUKGGD.js +0 -46
  90. package/dist/chunk-WLOQ4IBG.js +0 -654
  91. package/dist/chunk-X4WBGKJQ.js +0 -138
  92. package/dist/chunk-X7D6SUKR.js +0 -1234
@@ -1,340 +0,0 @@
1
- import { FeatureUnavailableState } from './chunk-CTJBPF3Z.js';
2
- import { SubshellContainer, SubshellSidebar, SubshellRightSideContainer } from './chunk-L7GXUSCV.js';
3
- import { ApiClientProvider, useApiClient } from './chunk-TE4P6OSJ.js';
4
- import { useRouterContext } from './chunk-Q7DJKLEN.js';
5
- import { getErrorInfo, getErrorTitle, formatErrorMessage } from './chunk-RXH4D6TY.js';
6
- import { useElevasisSystems } from './chunk-J3FLIZY4.js';
7
- import { InitializationProvider } from './chunk-6DO4PE3O.js';
8
- import { OrganizationContext, useOrganization } from './chunk-DD3CCMCZ.js';
9
- import { useProfile, ProfileProvider } from './chunk-W2SFTXMT.js';
10
- import { ElevasisServiceProvider } from './chunk-2FTX4WO2.js';
11
- import { brandSupabaseOrgId, brandWorkOsOrgId } from './chunk-MQZE7SUI.js';
12
- import { useAuthContext } from './chunk-BRJ3QZ4E.js';
13
- import { createContext, lazy, useState, useRef, useEffect, useCallback, createElement, useContext, Suspense } from 'react';
14
- import { useQueryClient, QueryClientProvider, QueryClient } from '@tanstack/react-query';
15
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
16
-
17
- function OrganizationProvider({ apiRequest, children }) {
18
- const { user, organizationId: workosOrgId } = useAuthContext();
19
- const { profile, error: profileError } = useProfile();
20
- const queryClient = useQueryClient();
21
- const [memberships, setMemberships] = useState([]);
22
- const [currentWorkOSOrganizationId, setCurrentWorkOSOrganizationId] = useState(null);
23
- const [currentSupabaseOrganizationId, setCurrentSupabaseOrganizationId] = useState(null);
24
- const [currentMembership, setCurrentMembership] = useState(null);
25
- const [isInitializing, setIsInitializing] = useState(true);
26
- const [isOrgRefreshing, setIsOrgRefreshing] = useState(false);
27
- const [error, setError] = useState(null);
28
- const hasInitializedRef = useRef(false);
29
- const [profileLoaded, setProfileLoaded] = useState(false);
30
- useEffect(() => {
31
- if (profile !== void 0 && profile !== null) {
32
- setProfileLoaded(true);
33
- }
34
- }, [profile]);
35
- useEffect(() => {
36
- if (profileError && isInitializing && !hasInitializedRef.current) {
37
- setIsInitializing(false);
38
- }
39
- }, [profileError, isInitializing]);
40
- useEffect(() => {
41
- if (!user) {
42
- setMemberships([]);
43
- setCurrentWorkOSOrganizationId(null);
44
- setCurrentSupabaseOrganizationId(null);
45
- setCurrentMembership(null);
46
- setIsInitializing(false);
47
- setIsOrgRefreshing(false);
48
- setError(null);
49
- hasInitializedRef.current = false;
50
- setProfileLoaded(false);
51
- }
52
- }, [user]);
53
- const applyMembership = useCallback((membership) => {
54
- setCurrentMembership(membership);
55
- setCurrentSupabaseOrganizationId(brandSupabaseOrgId(membership?.organization?.id));
56
- setCurrentWorkOSOrganizationId(brandWorkOsOrgId(membership?.organization?.workos_org_id));
57
- }, []);
58
- const selectOrganization = useCallback(
59
- (data) => {
60
- let selected = null;
61
- if (workosOrgId) {
62
- selected = data.find((m) => m.organization?.workos_org_id === workosOrgId) ?? null;
63
- }
64
- if (!selected && profile?.last_visited_org) {
65
- selected = data.find((m) => m.organizationId === profile.last_visited_org) ?? null;
66
- }
67
- if (!selected && data.length > 0) {
68
- selected = data[0];
69
- }
70
- if (selected) {
71
- applyMembership(selected);
72
- }
73
- },
74
- [profile?.last_visited_org, workosOrgId, applyMembership]
75
- );
76
- const fetchAndInitialize = useCallback(async () => {
77
- if (!user?.id || !profileLoaded) return;
78
- setError(null);
79
- if (memberships.length === 0) {
80
- setIsInitializing(true);
81
- } else {
82
- setIsOrgRefreshing(true);
83
- }
84
- try {
85
- const data = await apiRequest("/memberships/my-memberships");
86
- if (!Array.isArray(data)) {
87
- throw new Error("Invalid memberships response");
88
- }
89
- setMemberships(data);
90
- if (data.length === 0) {
91
- hasInitializedRef.current = true;
92
- return;
93
- }
94
- if (!currentWorkOSOrganizationId) {
95
- selectOrganization(data);
96
- } else {
97
- const stillPresent = data.find((m) => m.organization?.workos_org_id === currentWorkOSOrganizationId);
98
- if (!stillPresent) {
99
- applyMembership(data[0] ?? null);
100
- } else {
101
- applyMembership(stillPresent);
102
- }
103
- }
104
- hasInitializedRef.current = true;
105
- } catch (err) {
106
- setError(err instanceof Error ? err.message : "Failed to load organizations");
107
- } finally {
108
- setIsInitializing(false);
109
- setIsOrgRefreshing(false);
110
- }
111
- }, [
112
- user?.id,
113
- profileLoaded,
114
- memberships.length,
115
- apiRequest,
116
- currentWorkOSOrganizationId,
117
- selectOrganization,
118
- applyMembership
119
- ]);
120
- useEffect(() => {
121
- if (!user?.id || !profileLoaded || hasInitializedRef.current) return;
122
- fetchAndInitialize();
123
- }, [user?.id, profileLoaded, fetchAndInitialize]);
124
- useEffect(() => {
125
- if (!hasInitializedRef.current) return;
126
- if (!workosOrgId) return;
127
- if (workosOrgId === currentWorkOSOrganizationId) return;
128
- const target = memberships.find((m) => m.organization?.workos_org_id === workosOrgId);
129
- if (!target) return;
130
- applyMembership(target);
131
- void queryClient.invalidateQueries();
132
- }, [workosOrgId, currentWorkOSOrganizationId, memberships, applyMembership, queryClient]);
133
- const switchOrganization = useCallback(
134
- (workosOrgId2, options) => {
135
- const target = memberships.find((m) => m.organization?.workos_org_id === workosOrgId2);
136
- if (!target) return;
137
- applyMembership(target);
138
- void queryClient.invalidateQueries();
139
- if (options?.persist !== false) {
140
- void apiRequest("/users/me", {
141
- method: "PATCH",
142
- headers: { "Content-Type": "application/json" },
143
- body: JSON.stringify({ lastVisitedOrg: target.organizationId })
144
- }).catch((err) => {
145
- console.warn("Failed to persist last_visited_org preference:", err);
146
- });
147
- }
148
- },
149
- [memberships, applyMembership, queryClient, apiRequest]
150
- );
151
- const retry = useCallback(async () => {
152
- hasInitializedRef.current = false;
153
- setError(null);
154
- await fetchAndInitialize();
155
- }, [fetchAndInitialize]);
156
- const value = {
157
- currentWorkOSOrganizationId,
158
- currentSupabaseOrganizationId,
159
- currentMembership,
160
- memberships,
161
- isInitializing,
162
- isOrgRefreshing,
163
- error,
164
- switchOrganization,
165
- retry
166
- };
167
- return createElement(OrganizationContext.Provider, { value }, children);
168
- }
169
- var consoleAdapter = {
170
- success(title, message) {
171
- console.log(`[Notification][Success] ${title}: ${message}`);
172
- },
173
- error(title, message) {
174
- console.warn(`[Notification][Error] ${title}: ${message}`);
175
- },
176
- info(title, message) {
177
- console.log(`[Notification][Info] ${title}: ${message}`);
178
- },
179
- warning(title, message) {
180
- console.warn(`[Notification][Warning] ${title}: ${message}`);
181
- },
182
- apiError(error) {
183
- const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
184
- const title = getErrorTitle(code);
185
- const formatted = formatErrorMessage(message, requestId, fields, retryAfter);
186
- console.warn(`[Notification][API Error] ${title}: ${formatted}`);
187
- }
188
- };
189
- var NotificationContext = createContext(consoleAdapter);
190
- function NotificationProvider({ adapter, children }) {
191
- return /* @__PURE__ */ jsx(NotificationContext.Provider, { value: adapter, children });
192
- }
193
- function useNotificationAdapter() {
194
- return useContext(NotificationContext);
195
- }
196
- var CrmActionsContext = createContext([]);
197
- function CrmActionsProvider({ actions, children }) {
198
- return /* @__PURE__ */ jsx(CrmActionsContext.Provider, { value: actions, children });
199
- }
200
- function useCrmActions() {
201
- return useContext(CrmActionsContext);
202
- }
203
- var EMPTY_LIST_ACTIONS = Object.freeze([]);
204
- var ListActionsContext = createContext(EMPTY_LIST_ACTIONS);
205
- function ListActionsProvider({
206
- registry = EMPTY_LIST_ACTIONS,
207
- children
208
- }) {
209
- return /* @__PURE__ */ jsx(ListActionsContext.Provider, { value: registry, children });
210
- }
211
- function useListActions() {
212
- return useContext(ListActionsContext);
213
- }
214
- function findListActionByAction(registry, actionKey) {
215
- return registry.find((action) => action.actionKey === actionKey);
216
- }
217
- function getListActionWorkflowId(action) {
218
- return action.workflowId ?? action.resourceId;
219
- }
220
- var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-PSTKG4B3.js').then((m) => ({ default: m.CoreAuthKitInner })));
221
- var defaultQueryClient = null;
222
- function getDefaultQueryClient() {
223
- if (!defaultQueryClient) {
224
- defaultQueryClient = new QueryClient({
225
- defaultOptions: { queries: { retry: 1 } }
226
- });
227
- }
228
- return defaultQueryClient;
229
- }
230
- var consoleNotificationAdapter = {
231
- success(title, message) {
232
- console.log(`[Notification][Success] ${title}: ${message}`);
233
- },
234
- error(title, message) {
235
- console.warn(`[Notification][Error] ${title}: ${message}`);
236
- },
237
- info(title, message) {
238
- console.log(`[Notification][Info] ${title}: ${message}`);
239
- },
240
- warning(title, message) {
241
- console.warn(`[Notification][Warning] ${title}: ${message}`);
242
- },
243
- apiError(error) {
244
- console.warn(`[Notification][API Error]`, error);
245
- }
246
- };
247
- function ElevasisCoreProvider({
248
- auth,
249
- queryClient,
250
- apiUrl,
251
- onError,
252
- notifications,
253
- crmActions,
254
- listActions,
255
- children
256
- }) {
257
- if (auth.mode === "apiKey") {
258
- throw new Error(
259
- `ElevasisCoreProvider: auth mode 'apiKey' is not yet implemented. Only 'authkit' mode is supported.`
260
- );
261
- }
262
- const resolvedQueryClient = queryClient ?? getDefaultQueryClient();
263
- const resolvedCrmActions = crmActions ?? [];
264
- const resolvedListActions = listActions ?? EMPTY_LIST_ACTIONS;
265
- const content = apiUrl ? /* @__PURE__ */ jsx(ServiceStack, { apiUrl, onError, notifications, children }) : children;
266
- const AuthInner = /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCoreAuthKitInner, { auth, children: content }) });
267
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: resolvedQueryClient, children: /* @__PURE__ */ jsx(CrmActionsProvider, { actions: resolvedCrmActions, children: /* @__PURE__ */ jsx(ListActionsProvider, { registry: resolvedListActions, children: AuthInner }) }) });
268
- }
269
- function ServiceStack({
270
- apiUrl,
271
- onError,
272
- notifications,
273
- children
274
- }) {
275
- const { getAccessToken } = useAuthContext();
276
- const orgIdRef = useRef(null);
277
- const getOrganizationId = useRef(() => orgIdRef.current).current;
278
- return /* @__PURE__ */ jsx(
279
- ApiClientProvider,
280
- {
281
- getAccessToken,
282
- getOrganizationId,
283
- isOrganizationReady: false,
284
- onError,
285
- children: /* @__PURE__ */ jsx(ServiceStackInner, { apiUrl, orgIdRef, notifications, children })
286
- }
287
- );
288
- }
289
- function ServiceStackInner({
290
- apiUrl,
291
- orgIdRef,
292
- notifications,
293
- children
294
- }) {
295
- const { apiRequest } = useApiClient(apiUrl);
296
- const resolvedNotifications = notifications ?? consoleNotificationAdapter;
297
- return /* @__PURE__ */ jsx(ProfileProvider, { apiRequest, children: /* @__PURE__ */ jsx(OrganizationProvider, { apiRequest, children: /* @__PURE__ */ jsx(OrgServiceBridge, { orgIdRef, apiRequest, notifications: resolvedNotifications, children }) }) });
298
- }
299
- function OrgServiceBridge({
300
- orgIdRef,
301
- apiRequest,
302
- notifications,
303
- children
304
- }) {
305
- const { currentWorkOSOrganizationId, isInitializing, isOrgRefreshing } = useOrganization();
306
- orgIdRef.current = currentWorkOSOrganizationId;
307
- const isReady = !!currentWorkOSOrganizationId && !isInitializing && !isOrgRefreshing;
308
- return /* @__PURE__ */ jsx(
309
- ElevasisServiceProvider,
310
- {
311
- apiRequest,
312
- workOSOrganizationId: currentWorkOSOrganizationId,
313
- isReady,
314
- children: /* @__PURE__ */ jsx(NotificationProvider, { adapter: notifications, children: /* @__PURE__ */ jsx(InitializationProvider, { children }) })
315
- }
316
- );
317
- }
318
- var defaultSystemSidebarWidth = 250;
319
- function SystemShell({ children }) {
320
- const { shellRuntime } = useElevasisSystems();
321
- const { currentPath } = useRouterContext();
322
- const routeMatch = shellRuntime.resolveRoute(currentPath);
323
- if (routeMatch.status === "hidden") {
324
- return /* @__PURE__ */ jsx(FeatureUnavailableState, { path: currentPath });
325
- }
326
- if (routeMatch.status !== "matched" || !routeMatch.system?.sidebar) {
327
- return /* @__PURE__ */ jsx(Fragment, { children });
328
- }
329
- const SidebarComponent = routeMatch.system.sidebar;
330
- const sidebarWidth = typeof routeMatch.system.sidebarWidth === "function" ? routeMatch.system.sidebarWidth({ currentPath }) : routeMatch.system.sidebarWidth ?? defaultSystemSidebarWidth;
331
- if (sidebarWidth === 0) {
332
- return /* @__PURE__ */ jsx(Fragment, { children });
333
- }
334
- return /* @__PURE__ */ jsxs(SubshellContainer, { children: [
335
- /* @__PURE__ */ jsx(SubshellSidebar, { width: sidebarWidth, children: /* @__PURE__ */ jsx(SidebarComponent, {}) }),
336
- /* @__PURE__ */ jsx(SubshellRightSideContainer, { children })
337
- ] });
338
- }
339
-
340
- export { CrmActionsProvider, EMPTY_LIST_ACTIONS, ElevasisCoreProvider, ListActionsProvider, NotificationProvider, OrganizationProvider, SystemShell, findListActionByAction, getListActionWorkflowId, useCrmActions, useListActions, useNotificationAdapter };
@@ -1,9 +0,0 @@
1
- // src/utils/constants/cache.ts
2
- var STALE_TIME_MONITORING = 3e4;
3
- var STALE_TIME_ADMIN = 6e4;
4
- var STALE_TIME_DEFAULT = 3e5;
5
- var GC_TIME_SHORT = 3e5;
6
- var GC_TIME_MEDIUM = 6e5;
7
- var GC_TIME_LONG = 18e5;
8
-
9
- export { GC_TIME_LONG, GC_TIME_MEDIUM, GC_TIME_SHORT, STALE_TIME_ADMIN, STALE_TIME_DEFAULT, STALE_TIME_MONITORING };