@camunda/camunda-composite-components 0.2.18-rc.2 → 0.2.18-rc.3
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/lib/esm/components/c3-help-center/c3-help-center.js +11 -3
- package/lib/esm/components/c3-help-center/c3-help-center.types.d.ts +1 -0
- package/lib/esm/components/c3-help-center/help-center.js +4 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +11 -9
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-org-sidebar.js +39 -8
- package/lib/esm/components/c3-navigation/c3-navigation.js +5 -2
- package/lib/esm/components/c3-navigation/story-helpers.d.ts +4 -2
- package/lib/esm/components/c3-navigation/story-helpers.js +36 -27
- package/lib/esm/components/c3-onboarding-survey/c3-onboarding-survey.d.ts +2 -2
- package/lib/esm/components/c3-onboarding-survey/c3-onboarding-survey.js +1 -1
- package/lib/esm/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +5 -1
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.d.ts +5 -0
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.js +13 -2
- package/package.json +15 -15
|
@@ -8,9 +8,9 @@ import { useC3UserConfiguration } from "../c3-user-configuration/c3-user-configu
|
|
|
8
8
|
import { defaultTheme, useC3Profile, } from "../c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
9
9
|
import { resolveTheme, } from "../c3-user-configuration/c3-profile-provider/carbon-theme-provider";
|
|
10
10
|
import { useC3HelpCenter } from "./c3-help-center-provider";
|
|
11
|
-
export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, mixpanelTrack, onRequestOpen, theme, onPersonaChange, activeTab, }) => {
|
|
11
|
+
export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, mixpanelTrack: customMixpanelTrack, onRequestOpen, theme, onPersonaChange, activeTab, }) => {
|
|
12
12
|
const { isHelpCenterOpen: isOpen, setIsHelpCenterOpen } = useC3HelpCenter();
|
|
13
|
-
const { userToken, decodedToken, activeOrganizationId, handleTheme, decodedAudience, } = useC3UserConfiguration() || {};
|
|
13
|
+
const { userToken, decodedToken, activeOrganizationId, handleTheme, decodedAudience, mixPanelTrack: configMixpanelTrack, } = useC3UserConfiguration() || {};
|
|
14
14
|
const { theme: themeConfig, isEnabled, reloadClusters } = useC3Profile();
|
|
15
15
|
const themeHandlingEnabled = isEnabled && !!handleTheme && !!themeConfig;
|
|
16
16
|
const themeRef = useRef();
|
|
@@ -20,6 +20,14 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
20
20
|
const [helpCenterConfig, setHelpCenterConfig] = useState(defaultHelpCenterConfig);
|
|
21
21
|
const [email, setEmail] = useState("");
|
|
22
22
|
const [showSurvey, setShowSurvey] = useState(autoStartSurvey);
|
|
23
|
+
const mixpanelTrack = (event, data) => {
|
|
24
|
+
if (customMixpanelTrack) {
|
|
25
|
+
customMixpanelTrack(event, data);
|
|
26
|
+
}
|
|
27
|
+
else if (configMixpanelTrack) {
|
|
28
|
+
configMixpanelTrack(event, data);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
23
31
|
useEffect(() => {
|
|
24
32
|
const updateResolvedTheme = ({ matches }) => {
|
|
25
33
|
if (themeRef.current === "system") {
|
|
@@ -92,7 +100,7 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
92
100
|
});
|
|
93
101
|
setPersona({ wasShown: true });
|
|
94
102
|
}
|
|
95
|
-
mixpanelTrack?.(
|
|
103
|
+
mixpanelTrack?.("helpcenter:open", {
|
|
96
104
|
to: activeTab ?? firstTab,
|
|
97
105
|
from: origin,
|
|
98
106
|
});
|
|
@@ -73,6 +73,9 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
|
|
|
73
73
|
}, [showTabId]);
|
|
74
74
|
if (activeTab === "feedback") {
|
|
75
75
|
header = "Share your feedback";
|
|
76
|
+
content = (React.createElement(Feedback, { audience: audience, theme: theme, mixpanelTrack: mixpanelTrack, setHeader: (head) => {
|
|
77
|
+
header = head;
|
|
78
|
+
}, salesPlanType: organization?.salesPlan?.type ?? "" }));
|
|
76
79
|
}
|
|
77
80
|
else if (activeTab === "recommendations" &&
|
|
78
81
|
Object.keys(tabTiles).length === 0 &&
|
|
@@ -173,11 +176,7 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
|
|
|
173
176
|
}))),
|
|
174
177
|
React.createElement("div", { style: { position: "absolute", bottom: "20px" } }, configuration.links.map((link) => (React.createElement(SideNavMenuItem, { key: link.label.split(" ").join("-").toLowerCase(), href: link.link, target: "_blank" },
|
|
175
178
|
React.createElement("span", { className: "cds--link" }, link.label))))))),
|
|
176
|
-
content,
|
|
177
|
-
React.createElement("div", { style: { display: activeTab === "feedback" ? "block" : "none" } },
|
|
178
|
-
React.createElement(Feedback, { audience: audience, theme: theme, mixpanelTrack: mixpanelTrack, setHeader: (head) => {
|
|
179
|
-
header = head;
|
|
180
|
-
}, salesPlanType: organization?.salesPlan?.type ?? "" })))),
|
|
179
|
+
content)),
|
|
181
180
|
persona.complete && activeTab === "recommendations" && (React.createElement(ModalFooter, { style: {
|
|
182
181
|
height: "62px",
|
|
183
182
|
paddingRight: "16px",
|
package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts
CHANGED
|
@@ -10,19 +10,21 @@ export type C3NavigationSideBarBaseProps = {
|
|
|
10
10
|
elements?: C3NavigationElementProps[];
|
|
11
11
|
bottomElements?: C3NavigationElementProps[];
|
|
12
12
|
};
|
|
13
|
+
export type CamundaOrg = {
|
|
14
|
+
activeLabel: string;
|
|
15
|
+
otherLabel: string;
|
|
16
|
+
orgName: string;
|
|
17
|
+
action: {
|
|
18
|
+
label: string;
|
|
19
|
+
onClick: () => void;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
13
22
|
export type C3NavigationOrgSideBarProps = C3NavigationSideBarBaseProps & {
|
|
14
23
|
type: "org";
|
|
15
24
|
customElements?: {
|
|
16
|
-
activeOrganization?:
|
|
17
|
-
activeLabel: string;
|
|
18
|
-
otherLabel: string;
|
|
19
|
-
orgName: string;
|
|
20
|
-
action: {
|
|
21
|
-
label: string;
|
|
22
|
-
onClick: () => void;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
+
activeOrganization?: CamundaOrg;
|
|
25
26
|
};
|
|
27
|
+
switchToOrg?: (orgId: string) => void;
|
|
26
28
|
};
|
|
27
29
|
export type C3NavigationInfoSideBarProps = C3NavigationSideBarBaseProps & {
|
|
28
30
|
type: "info";
|
|
@@ -4,15 +4,47 @@ import { Enterprise } from "@carbon/react/icons";
|
|
|
4
4
|
import C3NavigationSideBar from "./c3-navigation-sidebar";
|
|
5
5
|
import { SwitcherDivider } from "./components";
|
|
6
6
|
import { useOrgSidebarState } from "./c3-sidebar-state-provider";
|
|
7
|
+
import { useC3Profile } from "../../c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
8
|
+
import { useC3UserConfiguration } from "../../c3-user-configuration/c3-user-configuration-provider";
|
|
7
9
|
const C3OrgSidebar = ({ sideBar }) => {
|
|
8
|
-
const { customElements, ...sideBarProps } = sideBar;
|
|
9
|
-
const activeOrganization = customElements?.activeOrganization;
|
|
10
|
+
const { customElements, switchToOrg, elements, ...sideBarProps } = sideBar;
|
|
10
11
|
const { isOpen, setIsOpen } = useOrgSidebarState();
|
|
12
|
+
const { decodedAudience, setActiveOrgId, mixPanelTrack } = useC3UserConfiguration();
|
|
13
|
+
const { activeOrg, orgs } = useC3Profile();
|
|
14
|
+
const isCustomized = Boolean(customElements?.activeOrganization);
|
|
15
|
+
const onManageOrg = () => {
|
|
16
|
+
if (!isCustomized) {
|
|
17
|
+
mixPanelTrack?.("navBar:orgSettings:click", { orgId: activeOrg?.uuid });
|
|
18
|
+
}
|
|
19
|
+
if (sideBar.closeOnClick !== false)
|
|
20
|
+
setIsOpen(false);
|
|
21
|
+
};
|
|
22
|
+
const activeOrganization = customElements?.activeOrganization || {
|
|
23
|
+
activeLabel: "Active Organization",
|
|
24
|
+
orgName: activeOrg?.name || "",
|
|
25
|
+
action: {
|
|
26
|
+
onClick: onManageOrg,
|
|
27
|
+
label: "Manage",
|
|
28
|
+
},
|
|
29
|
+
otherLabel: "Other Organizations",
|
|
30
|
+
};
|
|
31
|
+
const switchOrg = (orgId) => {
|
|
32
|
+
setActiveOrgId(orgId);
|
|
33
|
+
mixPanelTrack?.("navBar:orgSwitch:click", { orgId });
|
|
34
|
+
switchToOrg?.(orgId);
|
|
35
|
+
setIsOpen(false);
|
|
36
|
+
};
|
|
37
|
+
const orgElements = orgs?.map((org) => ({
|
|
38
|
+
key: org.uuid,
|
|
39
|
+
label: org.name,
|
|
40
|
+
onClick: () => switchOrg(org.uuid),
|
|
41
|
+
}));
|
|
11
42
|
const itemTabIndex = isOpen ? undefined : -1;
|
|
12
43
|
return (React.createElement(C3NavigationSideBar, { sideBar: {
|
|
13
44
|
...sideBarProps,
|
|
45
|
+
elements: elements || orgElements,
|
|
14
46
|
ariaLabel: sideBarProps.ariaLabel || "Organization Sidebars",
|
|
15
|
-
}, icon: React.createElement(Enterprise, { size: 20 }) }, activeOrganization && (React.createElement(React.Fragment, null,
|
|
47
|
+
}, icon: React.createElement(Enterprise, { size: 20 }) }, (customElements?.activeOrganization || activeOrg) && (React.createElement(React.Fragment, null,
|
|
16
48
|
React.createElement("div", { style: {
|
|
17
49
|
padding: "1rem",
|
|
18
50
|
paddingTop: "1.5rem",
|
|
@@ -35,12 +67,11 @@ const C3OrgSidebar = ({ sideBar }) => {
|
|
|
35
67
|
overflow: "hidden",
|
|
36
68
|
whiteSpace: "nowrap",
|
|
37
69
|
}, title: activeOrganization.orgName }, activeOrganization.orgName)),
|
|
38
|
-
React.createElement(Button, { size: "md", kind: "ghost",
|
|
70
|
+
isCustomized ? (React.createElement(Button, { size: "md", kind: "ghost", onClick: () => {
|
|
39
71
|
activeOrganization.action.onClick();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, tabIndex: itemTabIndex }, activeOrganization.action.label)),
|
|
72
|
+
onManageOrg();
|
|
73
|
+
}, tabIndex: itemTabIndex }, activeOrganization.action?.label)) : (activeOrg?.uuid &&
|
|
74
|
+
decodedAudience && (React.createElement(Button, { as: "a", size: "md", kind: "ghost", key: "org-management", href: `https://console.${decodedAudience}/org/${activeOrg?.uuid}/management`, onClick: onManageOrg, tabIndex: itemTabIndex }, activeOrganization.action?.label)))),
|
|
44
75
|
sideBar.elements && sideBar.elements.length > 0 && (React.createElement(React.Fragment, null,
|
|
45
76
|
React.createElement(SwitcherDivider, null),
|
|
46
77
|
React.createElement(FormLabel, { style: {
|
|
@@ -14,6 +14,7 @@ import { C3SidebarStateProvider } from "./c3-navigation-sidebar/c3-sidebar-state
|
|
|
14
14
|
import { C3HelpCenter } from "../c3-help-center/c3-help-center";
|
|
15
15
|
import { C3ClusterTag } from "../c3-cluster-tag/c3-cluster-tag";
|
|
16
16
|
import { useC3HelpCenter } from "../c3-help-center/c3-help-center-provider";
|
|
17
|
+
import { useC3Profile } from "../c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
17
18
|
/**
|
|
18
19
|
* UI SHELL
|
|
19
20
|
* Docs: https://react.carbondesignsystem.com/?path=/story/components-ui-shell--fixed-side-nav
|
|
@@ -40,9 +41,11 @@ const ClusterTagWrapper = styled.div `
|
|
|
40
41
|
`;
|
|
41
42
|
export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, helpCenter, actionButtons, userSideBar, notificationSideBar, clusterUuid, options, }) => {
|
|
42
43
|
const { setIsHelpCenterOpen, isHelpCenterOpen } = useC3HelpCenter();
|
|
44
|
+
const { activeOrg } = useC3Profile();
|
|
43
45
|
const isLargeScreen = useMediaQuery(`(min-width: ${BREAKPOINT_LG_WIDTH}`);
|
|
44
46
|
const appBarElementsLength = appBar.elements?.length ?? 0;
|
|
45
47
|
const displayAppBar = appBarElementsLength > 0 || (!isLargeScreen && navbar.elements.length > 0);
|
|
48
|
+
const orgName = activeOrg?.name || navbar.orgName;
|
|
46
49
|
if (app.prefix)
|
|
47
50
|
console.warn("The `prefix` prop is deprecated and will be removed in a future release. It has been replaced with a Camunda icon.");
|
|
48
51
|
return (React.createElement(C3SidebarStateProvider, { isNotificationSidebarOpen: notificationSideBar?.isOpen, isOrgSidebarOpen: orgSideBar?.isOpen, isInfoSidebarOpen: infoSideBar?.isOpen, isUserSidebarOpen: userSideBar?.isOpen },
|
|
@@ -90,14 +93,14 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
|
|
|
90
93
|
}),
|
|
91
94
|
clusterUuid && (React.createElement(ClusterTagWrapper, null,
|
|
92
95
|
React.createElement(C3ClusterTag, { clusterUuid: clusterUuid, conditionalRendering: options?.conditionalTagRendering }))),
|
|
93
|
-
|
|
96
|
+
orgName && (React.createElement("div", { className: "bodyText", style: {
|
|
94
97
|
fontSize: "14px",
|
|
95
98
|
lineHeight: "3rem",
|
|
96
99
|
textOverflow: "ellipsis",
|
|
97
100
|
whiteSpace: "nowrap",
|
|
98
101
|
overflow: "hidden",
|
|
99
102
|
maxWidth: "150px",
|
|
100
|
-
} },
|
|
103
|
+
} }, orgName))),
|
|
101
104
|
actionButtons && React.createElement(C3ActionButtons, { elements: actionButtons }),
|
|
102
105
|
notificationSideBar && (React.createElement(C3NotificationSidebar, { sideBar: {
|
|
103
106
|
...notificationSideBar,
|
|
@@ -6,8 +6,9 @@ export declare function createAppBarProps(options?: {
|
|
|
6
6
|
isOpen?: boolean;
|
|
7
7
|
elements?: Array<C3NavigationElementProps>;
|
|
8
8
|
}): C3NavigationProps["appBar"];
|
|
9
|
-
export declare function createNavBarBarProps(
|
|
9
|
+
export declare function createNavBarBarProps({ orgName, elements, }?: {
|
|
10
10
|
elements?: C3NavigationNavBarProps["elements"];
|
|
11
|
+
orgName?: string;
|
|
11
12
|
}): C3NavigationNavBarProps;
|
|
12
13
|
export declare function createInfoSideBarProps(options: {
|
|
13
14
|
isOpen: boolean;
|
|
@@ -15,7 +16,8 @@ export declare function createInfoSideBarProps(options: {
|
|
|
15
16
|
}): C3NavigationProps["infoSideBar"];
|
|
16
17
|
export declare function createOrgSideBarProps(options: {
|
|
17
18
|
isOpen: boolean;
|
|
18
|
-
orgCount
|
|
19
|
+
orgCount?: number;
|
|
20
|
+
useConfig?: boolean;
|
|
19
21
|
}): C3NavigationProps["orgSideBar"];
|
|
20
22
|
export declare function createUserSideBarProps(options: {
|
|
21
23
|
isOpen: boolean;
|
|
@@ -61,9 +61,9 @@ export function createAppBarProps(options = {}) {
|
|
|
61
61
|
elementClicked: (element) => console.log(`event coming from the appBarProps: ${element} has been clicked`),
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
export function createNavBarBarProps(
|
|
64
|
+
export function createNavBarBarProps({ orgName = "Camunda", elements = undefined, } = {}) {
|
|
65
65
|
return {
|
|
66
|
-
elements:
|
|
66
|
+
elements: elements ?? [
|
|
67
67
|
{
|
|
68
68
|
key: "dashboard",
|
|
69
69
|
label: "Dashboard",
|
|
@@ -79,7 +79,7 @@ export function createNavBarBarProps(options = {}) {
|
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
],
|
|
82
|
-
orgName
|
|
82
|
+
orgName,
|
|
83
83
|
tags: [
|
|
84
84
|
{
|
|
85
85
|
key: "stage",
|
|
@@ -125,36 +125,45 @@ export function createInfoSideBarProps(options) {
|
|
|
125
125
|
}
|
|
126
126
|
export function createOrgSideBarProps(options) {
|
|
127
127
|
const elements = [];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
if (options.orgCount !== undefined) {
|
|
129
|
+
for (let i = 0; i < options.orgCount; i++) {
|
|
130
|
+
elements.push({
|
|
131
|
+
key: `org-${i}`,
|
|
132
|
+
label: `Organization ${i}`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
133
135
|
}
|
|
134
136
|
return {
|
|
135
137
|
isOpen: options.isOpen,
|
|
136
|
-
customElements:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
customElements: options.useConfig
|
|
139
|
+
? undefined
|
|
140
|
+
: {
|
|
141
|
+
activeOrganization: {
|
|
142
|
+
activeLabel: "Active Organization",
|
|
143
|
+
otherLabel: "Other Organization",
|
|
144
|
+
orgName: "Camunda",
|
|
145
|
+
action: {
|
|
146
|
+
label: "Manage",
|
|
147
|
+
onClick: () => console.log("Manage organization"),
|
|
148
|
+
},
|
|
144
149
|
},
|
|
145
150
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
elements: options.useConfig ? undefined : elements,
|
|
152
|
+
bottomElements: options.useConfig
|
|
153
|
+
? undefined
|
|
154
|
+
: [
|
|
155
|
+
{
|
|
156
|
+
key: "createTrial",
|
|
157
|
+
label: "Create new Trial Org",
|
|
158
|
+
renderIcon: Add,
|
|
159
|
+
onClick: () => {
|
|
160
|
+
console.log("clicked");
|
|
161
|
+
},
|
|
155
162
|
},
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
],
|
|
164
|
+
switchToOrg: options.useConfig
|
|
165
|
+
? (orgId) => console.log("Switch to org: ", orgId)
|
|
166
|
+
: undefined,
|
|
158
167
|
};
|
|
159
168
|
}
|
|
160
169
|
export function createUserSideBarProps(options) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { Persona } from "../c3-help-center/c3-help-center.types";
|
|
3
|
-
import {
|
|
3
|
+
import { MixPanelTrack } from "../c3-user-configuration/c3-user-configuration-provider";
|
|
4
4
|
export type C3OnboardingSurveyProps = {
|
|
5
5
|
onRequestClose: () => void;
|
|
6
6
|
onRequestSkip: () => void;
|
|
7
7
|
personaCallback: (persona: Persona) => void;
|
|
8
8
|
theme: "light" | "dark";
|
|
9
|
-
mixpanelTrack?:
|
|
9
|
+
mixpanelTrack?: MixPanelTrack;
|
|
10
10
|
origin: "console" | "webmodeler" | "operate" | "tasklist" | "optimize";
|
|
11
11
|
modal: boolean;
|
|
12
12
|
persona: Persona | undefined;
|
|
@@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { OnboardingSurvey } from "./onboardingSurvey";
|
|
3
3
|
import { defaultOnboardingConfig } from "./defaultOnboardingConfig";
|
|
4
4
|
import { getOnboardingConfig, submitSurvey, updatePersona, } from "../../api/help-center";
|
|
5
|
-
import { useC3UserConfiguration } from "../c3-user-configuration/c3-user-configuration-provider";
|
|
5
|
+
import { useC3UserConfiguration, } from "../c3-user-configuration/c3-user-configuration-provider";
|
|
6
6
|
export const C3OnboardingSurvey = (props) => {
|
|
7
7
|
const { userToken, decodedToken, activeOrganizationId, decodedAudience } = useC3UserConfiguration() || {};
|
|
8
8
|
const [persona, setPersona] = useState(props.persona);
|
|
@@ -37,7 +37,11 @@ export const C3ProfileProvider = ({ children }) => {
|
|
|
37
37
|
setActiveOrg(res?.find((org) => org.uuid === config.activeOrganizationId) || null);
|
|
38
38
|
});
|
|
39
39
|
loadClusters();
|
|
40
|
-
}, [
|
|
40
|
+
}, [
|
|
41
|
+
config?.activeOrganizationId,
|
|
42
|
+
JSON.stringify(decodedToken),
|
|
43
|
+
decodedAudience,
|
|
44
|
+
]);
|
|
41
45
|
useEffect(() => {
|
|
42
46
|
const updateSystemTheme = ({ matches }) => {
|
|
43
47
|
if (themeRef.current === "system")
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React, { FC, ReactNode } from "react";
|
|
2
2
|
import { Endpoints, Stage } from "../../api/endpoints.const";
|
|
3
3
|
import { DecodedToken } from "./authToken";
|
|
4
|
+
import { Dict } from "mixpanel-browser";
|
|
5
|
+
export type MixPanelTrack = (event: string, data?: Dict) => void;
|
|
4
6
|
type C3UserConfigurationBase = {
|
|
5
7
|
activeOrganizationId: string;
|
|
6
8
|
userToken: string;
|
|
7
9
|
getNewUserToken: () => Promise<string>;
|
|
10
|
+
mixPanelTrack?: MixPanelTrack;
|
|
8
11
|
};
|
|
9
12
|
type C3UserConfigurationWithEndpoints = C3UserConfigurationBase & {
|
|
10
13
|
endpoints: Endpoints;
|
|
@@ -18,6 +21,8 @@ export type C3UserConfiguration = C3UserConfigurationWithEndpoints | C3UserConfi
|
|
|
18
21
|
export type C3UserConfigurationContextValue = C3UserConfiguration & {
|
|
19
22
|
decodedToken: DecodedToken | null;
|
|
20
23
|
decodedAudience: string | null;
|
|
24
|
+
setActiveOrgId: (newOrg: string) => void;
|
|
25
|
+
mixPanelTrack?: MixPanelTrack;
|
|
21
26
|
};
|
|
22
27
|
export declare const C3UserConfigurationContext: React.Context<C3UserConfigurationContextValue>;
|
|
23
28
|
declare const C3UserConfigurationProvider: FC<C3UserConfiguration & {
|
|
@@ -9,19 +9,30 @@ export const C3UserConfigurationContext = React.createContext({
|
|
|
9
9
|
decodedToken: null,
|
|
10
10
|
decodedAudience: null,
|
|
11
11
|
getNewUserToken: () => Promise.resolve(""),
|
|
12
|
+
setActiveOrgId: () => undefined,
|
|
12
13
|
});
|
|
13
|
-
const C3UserConfigurationProvider = ({ children, ...config }) => {
|
|
14
|
+
const C3UserConfigurationProvider = ({ children, activeOrganizationId, ...config }) => {
|
|
14
15
|
const [decodedToken, setDecodedToken] = useState(null);
|
|
15
16
|
const [decodedAudience, setDecodedAudience] = useState(null);
|
|
17
|
+
const [activeOrgId, setActiveOrgId] = useState(activeOrganizationId);
|
|
16
18
|
useEffect(() => {
|
|
17
19
|
if (config.userToken)
|
|
18
20
|
setDecodedToken(decodeJWT(config.userToken));
|
|
19
21
|
}, [config.userToken]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setActiveOrgId(activeOrganizationId);
|
|
24
|
+
}, [activeOrganizationId]);
|
|
20
25
|
useEffect(() => {
|
|
21
26
|
const { audience } = decodedToken || {};
|
|
22
27
|
setDecodedAudience((typeof audience === "string" ? audience : audience?.[0]) || null);
|
|
23
28
|
}, [decodedToken]);
|
|
24
|
-
return (React.createElement(C3UserConfigurationContext.Provider, { value: {
|
|
29
|
+
return (React.createElement(C3UserConfigurationContext.Provider, { value: {
|
|
30
|
+
...config,
|
|
31
|
+
activeOrganizationId: activeOrgId,
|
|
32
|
+
setActiveOrgId,
|
|
33
|
+
decodedToken,
|
|
34
|
+
decodedAudience,
|
|
35
|
+
} },
|
|
25
36
|
React.createElement(C3ProfileProvider, null,
|
|
26
37
|
React.createElement(C3HelpCenterProvider, null, children))));
|
|
27
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/camunda-composite-components",
|
|
3
|
-
"version": "0.2.18-rc.
|
|
3
|
+
"version": "0.2.18-rc.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rimraf lib/",
|
|
6
6
|
"build": "yarn clean && tsc",
|
|
@@ -26,23 +26,23 @@
|
|
|
26
26
|
"test": "yarn test:ts && yarn test:storybook && yarn test:visual-regression:docker"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@babel/core": "7.23.
|
|
30
|
-
"@babel/preset-env": "7.
|
|
29
|
+
"@babel/core": "7.23.0",
|
|
30
|
+
"@babel/preset-env": "7.22.20",
|
|
31
31
|
"@babel/preset-react": "7.22.15",
|
|
32
|
-
"@babel/preset-typescript": "7.23.
|
|
32
|
+
"@babel/preset-typescript": "7.23.0",
|
|
33
33
|
"@carbon/react": "1.37.0",
|
|
34
34
|
"@mdx-js/react": "2.3.0",
|
|
35
35
|
"@playwright/test": "1.37.1",
|
|
36
|
-
"@storybook/addon-a11y": "7.
|
|
37
|
-
"@storybook/addon-actions": "7.
|
|
38
|
-
"@storybook/addon-docs": "7.
|
|
39
|
-
"@storybook/addon-essentials": "7.
|
|
40
|
-
"@storybook/addon-interactions": "7.
|
|
41
|
-
"@storybook/addon-links": "7.
|
|
42
|
-
"@storybook/blocks": "7.
|
|
36
|
+
"@storybook/addon-a11y": "7.4.6",
|
|
37
|
+
"@storybook/addon-actions": "7.4.6",
|
|
38
|
+
"@storybook/addon-docs": "7.4.6",
|
|
39
|
+
"@storybook/addon-essentials": "7.4.6",
|
|
40
|
+
"@storybook/addon-interactions": "7.4.6",
|
|
41
|
+
"@storybook/addon-links": "7.4.6",
|
|
42
|
+
"@storybook/blocks": "7.4.6",
|
|
43
43
|
"@storybook/preset-scss": "1.0.3",
|
|
44
|
-
"@storybook/react": "7.
|
|
45
|
-
"@storybook/react-webpack5": "7.
|
|
44
|
+
"@storybook/react": "7.4.6",
|
|
45
|
+
"@storybook/react-webpack5": "7.4.6",
|
|
46
46
|
"@storybook/test-runner": "0.13.0",
|
|
47
47
|
"@storybook/testing-library": "0.2.2",
|
|
48
48
|
"@types/carbon-components-react": "7.55.3",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"eslint-plugin-prettier": "5.0.1",
|
|
66
66
|
"eslint-plugin-react": "7.33.2",
|
|
67
67
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
68
|
-
"eslint-plugin-storybook": "0.6.
|
|
68
|
+
"eslint-plugin-storybook": "0.6.14",
|
|
69
69
|
"event-source-polyfill": "1.0.31",
|
|
70
70
|
"husky": "8.0.3",
|
|
71
71
|
"mixpanel-browser": "2.47.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"sass": "1.66.1",
|
|
77
77
|
"sass-loader": "13.3.2",
|
|
78
78
|
"serve": "14.2.1",
|
|
79
|
-
"storybook": "7.
|
|
79
|
+
"storybook": "7.4.6",
|
|
80
80
|
"style-loader": "3.3.3",
|
|
81
81
|
"styled-components": "6.0.7",
|
|
82
82
|
"typescript": "5.2.2",
|