@elevasis/ui 2.41.0 → 2.42.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.
- package/dist/api/index.js +4 -6
- package/dist/app/index.css +384 -0
- package/dist/app/index.d.ts +5 -1
- package/dist/app/index.js +17 -26
- package/dist/auth/index.css +659 -0
- package/dist/auth/index.js +19 -5
- package/dist/charts/index.css +533 -0
- package/dist/charts/index.js +18 -14
- package/dist/{chunk-JAN2ZXN5.js → chunk-3MTAHV5M.js} +28535 -18021
- package/dist/{chunk-73EWE2EW.js → chunk-EDVZ3AHA.js} +1 -1
- package/dist/chunk-GMXGDO3I.js +244 -0
- package/dist/{chunk-CXY7FMUM.js → chunk-GUKY77FJ.js} +50 -4
- package/dist/{chunk-TE4P6OSJ.js → chunk-MA7YCY7C.js} +1 -1
- package/dist/{chunk-5JYKCULK.js → chunk-NZ2F5RQ4.js} +44 -2
- package/dist/{chunk-WF7CONXF.js → chunk-OJJK27GC.js} +658 -6
- package/dist/chunk-YEGMSADG.js +1781 -0
- package/dist/components/chat/index.js +1 -2
- package/dist/components/index.css +149 -149
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +13 -36
- package/dist/components/navigation/index.css +659 -0
- package/dist/components/navigation/index.js +25 -3
- package/dist/features/auth/index.js +14 -37
- package/dist/features/clients/index.css +149 -149
- package/dist/features/clients/index.js +13 -36
- package/dist/features/crm/index.js +13 -36
- package/dist/features/dashboard/index.d.ts +5 -1
- package/dist/features/dashboard/index.js +13 -36
- package/dist/features/delivery/index.js +13 -36
- package/dist/features/knowledge/index.css +659 -0
- package/dist/features/knowledge/index.js +25 -247
- package/dist/features/lead-gen/index.d.ts +5 -1
- package/dist/features/lead-gen/index.js +13 -36
- package/dist/features/monitoring/index.js +13 -36
- package/dist/features/monitoring/requests/index.js +19 -149
- package/dist/features/operations/index.d.ts +5 -1
- package/dist/features/operations/index.js +13 -36
- package/dist/features/seo/index.js +1 -4
- package/dist/features/settings/index.js +13 -36
- package/dist/hooks/access/index.css +659 -0
- package/dist/hooks/access/index.js +19 -4
- package/dist/hooks/delivery/index.js +13 -36
- package/dist/hooks/index.d.ts +5 -1
- package/dist/hooks/index.js +13 -36
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +5 -1
- package/dist/hooks/published.d.ts +5 -1
- package/dist/hooks/published.js +13 -36
- package/dist/index.d.ts +5 -1
- package/dist/index.js +14 -37
- package/dist/initialization/index.js +1 -1
- package/dist/knowledge/index.css +659 -0
- package/dist/knowledge/index.d.ts +5 -1
- package/dist/knowledge/index.js +25 -15
- package/dist/layout/index.css +659 -0
- package/dist/layout/index.js +24 -9
- package/dist/organization/index.js +13 -36
- package/dist/provider/index.css +384 -0
- package/dist/provider/index.d.ts +5 -1
- package/dist/provider/index.js +18 -21
- package/dist/provider/published.css +533 -0
- package/dist/provider/published.d.ts +5 -1
- package/dist/provider/published.js +18 -16
- package/dist/test-utils/index.js +4 -6
- package/dist/theme/index.js +2 -5
- package/dist/theme/presets/index.js +1 -2
- package/dist/types/index.d.ts +5 -1
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/index.js +1 -3
- package/package.json +3 -3
- package/dist/chunk-3KMDHCAR.js +0 -52
- package/dist/chunk-4DRI3G36.js +0 -1016
- package/dist/chunk-56O7QQE7.js +0 -356
- package/dist/chunk-5EYJ2GIN.js +0 -122
- package/dist/chunk-66U7JOWV.js +0 -425
- package/dist/chunk-6D4LCJ52.js +0 -10
- package/dist/chunk-6ROXVZ3L.js +0 -9
- package/dist/chunk-A2XN6PR2.js +0 -111
- package/dist/chunk-B2DZLPDL.js +0 -39
- package/dist/chunk-CLDCYJQT.js +0 -1
- package/dist/chunk-CTJBPF3Z.js +0 -734
- package/dist/chunk-DT3QYZVU.js +0 -23
- package/dist/chunk-FIMGOWOT.js +0 -3644
- package/dist/chunk-IIMU5YAJ.js +0 -53
- package/dist/chunk-JHVEA5NE.js +0 -133
- package/dist/chunk-L7GXUSCV.js +0 -215
- package/dist/chunk-NYBEU5TE.js +0 -118
- package/dist/chunk-QVQMOQXB.js +0 -1240
- package/dist/chunk-RH5VWWSC.js +0 -624
- package/dist/chunk-RXH4D6TY.js +0 -801
- package/dist/chunk-S4R2ZQS7.js +0 -2131
- package/dist/chunk-TYRUKGGD.js +0 -46
- package/dist/chunk-VAAU2Z3S.js +0 -85
- package/dist/chunk-WLOQ4IBG.js +0 -654
- package/dist/chunk-X4WBGKJQ.js +0 -138
- package/dist/chunk-YPWN2WQ3.js +0 -340
package/dist/chunk-X4WBGKJQ.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { subshellNavItemIconSize } from './chunk-DT3QYZVU.js';
|
|
2
|
-
import { UnstyledButton, Stack, Group, Text } from '@mantine/core';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
var activeColor = "var(--color-primary)";
|
|
6
|
-
var defaultColor = "var(--color-text-subtle)";
|
|
7
|
-
var hoverColor = "var(--color-text)";
|
|
8
|
-
var activeBg = `color-mix(in srgb, ${activeColor} 10%, transparent)`;
|
|
9
|
-
var SubshellNavItem = ({
|
|
10
|
-
icon: Icon,
|
|
11
|
-
label,
|
|
12
|
-
isActive = false,
|
|
13
|
-
onClick,
|
|
14
|
-
description,
|
|
15
|
-
badge,
|
|
16
|
-
disabled = false,
|
|
17
|
-
href
|
|
18
|
-
}) => {
|
|
19
|
-
const handleAnchorClick = disabled ? void 0 : (event) => {
|
|
20
|
-
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
event.preventDefault();
|
|
24
|
-
onClick();
|
|
25
|
-
};
|
|
26
|
-
const sharedStyle = {
|
|
27
|
-
width: "100%",
|
|
28
|
-
padding: "var(--mantine-spacing-xs)",
|
|
29
|
-
backgroundColor: isActive ? activeBg : "transparent",
|
|
30
|
-
borderRadius: "var(--mantine-radius-default)",
|
|
31
|
-
transition: `all var(--duration-fast) var(--easing)`,
|
|
32
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
33
|
-
opacity: disabled ? 0.5 : 1,
|
|
34
|
-
color: "inherit",
|
|
35
|
-
textDecoration: "none",
|
|
36
|
-
display: "block"
|
|
37
|
-
};
|
|
38
|
-
const handleMouseEnter = (e) => {
|
|
39
|
-
if (!isActive && !disabled) {
|
|
40
|
-
e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
|
|
41
|
-
const textElements = e.currentTarget.querySelectorAll("[data-text-element]");
|
|
42
|
-
textElements.forEach((el) => {
|
|
43
|
-
el.style.color = hoverColor;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const handleMouseLeave = (e) => {
|
|
48
|
-
if (!isActive && !disabled) {
|
|
49
|
-
e.currentTarget.style.backgroundColor = "transparent";
|
|
50
|
-
const textElements = e.currentTarget.querySelectorAll("[data-text-element]");
|
|
51
|
-
textElements.forEach((el) => {
|
|
52
|
-
el.style.color = defaultColor;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const inner = /* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
|
|
57
|
-
/* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
Icon,
|
|
60
|
-
{
|
|
61
|
-
size: subshellNavItemIconSize,
|
|
62
|
-
style: {
|
|
63
|
-
flexShrink: 0,
|
|
64
|
-
opacity: isActive ? 1 : 0.6,
|
|
65
|
-
color: isActive ? activeColor : defaultColor
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
/* @__PURE__ */ jsx(
|
|
70
|
-
Text,
|
|
71
|
-
{
|
|
72
|
-
size: "sm",
|
|
73
|
-
fw: isActive ? 600 : 400,
|
|
74
|
-
style: {
|
|
75
|
-
overflow: "hidden",
|
|
76
|
-
textOverflow: "ellipsis",
|
|
77
|
-
whiteSpace: "nowrap",
|
|
78
|
-
flex: 1,
|
|
79
|
-
fontFamily: "var(--elevasis-font-family-subtitle)",
|
|
80
|
-
color: isActive ? activeColor : defaultColor,
|
|
81
|
-
transition: `color var(--duration-fast) var(--easing)`
|
|
82
|
-
},
|
|
83
|
-
"data-text-element": true,
|
|
84
|
-
children: label
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
badge && /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: badge })
|
|
88
|
-
] }),
|
|
89
|
-
description && /* @__PURE__ */ jsx(
|
|
90
|
-
Text,
|
|
91
|
-
{
|
|
92
|
-
size: "xs",
|
|
93
|
-
c: "dimmed",
|
|
94
|
-
style: {
|
|
95
|
-
paddingLeft: "22px",
|
|
96
|
-
lineHeight: 1.2,
|
|
97
|
-
color: isActive ? activeColor : defaultColor,
|
|
98
|
-
opacity: isActive ? 0.8 : 0.6,
|
|
99
|
-
transition: `all var(--duration-fast) var(--easing)`,
|
|
100
|
-
display: "-webkit-box",
|
|
101
|
-
WebkitLineClamp: 2,
|
|
102
|
-
WebkitBoxOrient: "vertical",
|
|
103
|
-
overflow: "hidden",
|
|
104
|
-
textOverflow: "ellipsis"
|
|
105
|
-
},
|
|
106
|
-
"data-text-element": true,
|
|
107
|
-
children: description
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
] });
|
|
111
|
-
if (href) {
|
|
112
|
-
return /* @__PURE__ */ jsx(
|
|
113
|
-
UnstyledButton,
|
|
114
|
-
{
|
|
115
|
-
component: "a",
|
|
116
|
-
href,
|
|
117
|
-
onClick: handleAnchorClick,
|
|
118
|
-
style: sharedStyle,
|
|
119
|
-
onMouseEnter: handleMouseEnter,
|
|
120
|
-
onMouseLeave: handleMouseLeave,
|
|
121
|
-
children: inner
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return /* @__PURE__ */ jsx(
|
|
126
|
-
UnstyledButton,
|
|
127
|
-
{
|
|
128
|
-
onClick: disabled ? void 0 : onClick,
|
|
129
|
-
disabled,
|
|
130
|
-
style: sharedStyle,
|
|
131
|
-
onMouseEnter: handleMouseEnter,
|
|
132
|
-
onMouseLeave: handleMouseLeave,
|
|
133
|
-
children: inner
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export { SubshellNavItem };
|
package/dist/chunk-YPWN2WQ3.js
DELETED
|
@@ -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 { InitializationProvider } from './chunk-6DO4PE3O.js';
|
|
7
|
-
import { useElevasisSystems } from './chunk-FIMGOWOT.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 };
|