@camunda/camunda-composite-components 0.2.18-rc.0 → 0.2.18-rc.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.
- package/lib/esm/components/c3-help-center/c3-help-center.js +3 -11
- package/lib/esm/components/c3-help-center/c3-help-center.types.d.ts +0 -1
- package/lib/esm/components/c3-help-center/help-center.js +28 -24
- package/lib/esm/components/c3-help-center/tabs/feedback.js +6 -7
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +9 -11
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-org-sidebar.js +8 -39
- package/lib/esm/components/c3-navigation/story-helpers.d.ts +1 -2
- package/lib/esm/components/c3-navigation/story-helpers.js +24 -33
- 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-onboarding-survey/elements/dropdownSelect.js +3 -2
- package/lib/esm/components/c3-onboarding-survey/elements/textField.js +11 -8
- package/lib/esm/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +1 -5
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.d.ts +0 -5
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.js +2 -13
- package/package.json +4 -4
|
@@ -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
|
|
11
|
+
export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, mixpanelTrack, onRequestOpen, theme, onPersonaChange, activeTab, }) => {
|
|
12
12
|
const { isHelpCenterOpen: isOpen, setIsHelpCenterOpen } = useC3HelpCenter();
|
|
13
|
-
const { userToken, decodedToken, activeOrganizationId, handleTheme, decodedAudience,
|
|
13
|
+
const { userToken, decodedToken, activeOrganizationId, handleTheme, decodedAudience, } = useC3UserConfiguration() || {};
|
|
14
14
|
const { theme: themeConfig, isEnabled, reloadClusters } = useC3Profile();
|
|
15
15
|
const themeHandlingEnabled = isEnabled && !!handleTheme && !!themeConfig;
|
|
16
16
|
const themeRef = useRef();
|
|
@@ -20,14 +20,6 @@ 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
|
-
};
|
|
31
23
|
useEffect(() => {
|
|
32
24
|
const updateResolvedTheme = ({ matches }) => {
|
|
33
25
|
if (themeRef.current === "system") {
|
|
@@ -100,7 +92,7 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
100
92
|
});
|
|
101
93
|
setPersona({ wasShown: true });
|
|
102
94
|
}
|
|
103
|
-
mixpanelTrack?.(
|
|
95
|
+
mixpanelTrack?.(`helpcenter:open`, {
|
|
104
96
|
to: activeTab ?? firstTab,
|
|
105
97
|
from: origin,
|
|
106
98
|
});
|
|
@@ -152,30 +152,34 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
|
|
|
152
152
|
React.createElement(SideNavItems, null,
|
|
153
153
|
React.createElement(SideNavMenuItem, null,
|
|
154
154
|
React.createElement("h5", null, "Help Center")),
|
|
155
|
-
React.createElement("
|
|
156
|
-
React.createElement(Stack, null,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
155
|
+
React.createElement("li", { style: { marginTop: "4px" } },
|
|
156
|
+
React.createElement(Stack, null,
|
|
157
|
+
React.createElement("ul", null, tabBar.map(({ name, id, text }) => {
|
|
158
|
+
const active = activeTab === name;
|
|
159
|
+
let tabBackgroundColor = theme === "light" ? "#F4F4F4" : "#161616";
|
|
160
|
+
let tabButtonColor = theme === "light" ? "#525252" : "#f4f4f4";
|
|
161
|
+
if (active) {
|
|
162
|
+
tabBackgroundColor =
|
|
163
|
+
theme === "light" ? "#E5E5E5" : "#8D8D8D3D";
|
|
164
|
+
tabButtonColor =
|
|
165
|
+
theme === "light" ? "#161616" : "#f4f4f4";
|
|
166
|
+
}
|
|
167
|
+
return (React.createElement("li", { key: name },
|
|
168
|
+
React.createElement(Button, { className: active ? "active" : "", kind: "secondary", onClick: () => {
|
|
169
|
+
setActiveTab(name);
|
|
170
|
+
mixpanelTrack?.("helpcenter:open", {
|
|
171
|
+
to: id,
|
|
172
|
+
from: origin,
|
|
173
|
+
});
|
|
174
|
+
}, style: {
|
|
175
|
+
width: "100%",
|
|
176
|
+
backgroundColor: tabBackgroundColor,
|
|
177
|
+
color: tabButtonColor,
|
|
178
|
+
}, "aria-label": text }, text)));
|
|
179
|
+
})))),
|
|
180
|
+
React.createElement("li", { style: { position: "absolute", bottom: "20px" } },
|
|
181
|
+
React.createElement("ul", null, configuration.links.map((link) => (React.createElement(SideNavMenuItem, { key: link.label.split(" ").join("-").toLowerCase(), href: link.link, target: "_blank" },
|
|
182
|
+
React.createElement("span", { className: "cds--link" }, link.label)))))))),
|
|
179
183
|
content)),
|
|
180
184
|
persona.complete && activeTab === "recommendations" && (React.createElement(ModalFooter, { style: {
|
|
181
185
|
height: "62px",
|
|
@@ -157,13 +157,12 @@ export const Feedback = (props) => {
|
|
|
157
157
|
// eslint-disable-next-line
|
|
158
158
|
// @ts-ignore
|
|
159
159
|
align: "bottom" },
|
|
160
|
-
React.createElement(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
} })))),
|
|
160
|
+
React.createElement(Button, { kind: "ghost", "aria-label": "Information", renderIcon: Information, iconDescription: "Information", style: {
|
|
161
|
+
marginTop: "-10px",
|
|
162
|
+
backgroundColor: props.theme === "light" ? "#FFFFFF" : "#161616",
|
|
163
|
+
color: props.theme === "light" ? "#161616" : "#F4F4F4",
|
|
164
|
+
paddingLeft: "0px",
|
|
165
|
+
} }))),
|
|
167
166
|
React.createElement("p", { className: "cds--label-description", style: { marginTop: "-24px" } }, "Max. file size is 5MB. Supported file types are .jpg and .png."))),
|
|
168
167
|
!orgIsEnterPriseOrPaidCC &&
|
|
169
168
|
(() => {
|
package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts
CHANGED
|
@@ -10,21 +10,19 @@ 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
|
-
};
|
|
22
13
|
export type C3NavigationOrgSideBarProps = C3NavigationSideBarBaseProps & {
|
|
23
14
|
type: "org";
|
|
24
15
|
customElements?: {
|
|
25
|
-
activeOrganization?:
|
|
16
|
+
activeOrganization?: {
|
|
17
|
+
activeLabel: string;
|
|
18
|
+
otherLabel: string;
|
|
19
|
+
orgName: string;
|
|
20
|
+
action: {
|
|
21
|
+
label: string;
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
26
25
|
};
|
|
27
|
-
switchToOrg?: (orgId: string) => void;
|
|
28
26
|
};
|
|
29
27
|
export type C3NavigationInfoSideBarProps = C3NavigationSideBarBaseProps & {
|
|
30
28
|
type: "info";
|
|
@@ -4,47 +4,15 @@ 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";
|
|
9
7
|
const C3OrgSidebar = ({ sideBar }) => {
|
|
10
|
-
const { customElements,
|
|
8
|
+
const { customElements, ...sideBarProps } = sideBar;
|
|
9
|
+
const activeOrganization = customElements?.activeOrganization;
|
|
11
10
|
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
|
-
}));
|
|
42
11
|
const itemTabIndex = isOpen ? undefined : -1;
|
|
43
12
|
return (React.createElement(C3NavigationSideBar, { sideBar: {
|
|
44
13
|
...sideBarProps,
|
|
45
|
-
elements: elements || orgElements,
|
|
46
14
|
ariaLabel: sideBarProps.ariaLabel || "Organization Sidebars",
|
|
47
|
-
}, icon: React.createElement(Enterprise, { size: 20 }) },
|
|
15
|
+
}, icon: React.createElement(Enterprise, { size: 20 }) }, activeOrganization && (React.createElement(React.Fragment, null,
|
|
48
16
|
React.createElement("div", { style: {
|
|
49
17
|
padding: "1rem",
|
|
50
18
|
paddingTop: "1.5rem",
|
|
@@ -67,11 +35,12 @@ const C3OrgSidebar = ({ sideBar }) => {
|
|
|
67
35
|
overflow: "hidden",
|
|
68
36
|
whiteSpace: "nowrap",
|
|
69
37
|
}, title: activeOrganization.orgName }, activeOrganization.orgName)),
|
|
70
|
-
|
|
38
|
+
React.createElement(Button, { size: "md", kind: "ghost", key: "org-management", onClick: () => {
|
|
71
39
|
activeOrganization.action.onClick();
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
40
|
+
if (sideBar.closeOnClick !== false) {
|
|
41
|
+
setIsOpen(false);
|
|
42
|
+
}
|
|
43
|
+
}, tabIndex: itemTabIndex }, activeOrganization.action.label)),
|
|
75
44
|
sideBar.elements && sideBar.elements.length > 0 && (React.createElement(React.Fragment, null,
|
|
76
45
|
React.createElement(SwitcherDivider, null),
|
|
77
46
|
React.createElement(FormLabel, { style: {
|
|
@@ -15,8 +15,7 @@ export declare function createInfoSideBarProps(options: {
|
|
|
15
15
|
}): C3NavigationProps["infoSideBar"];
|
|
16
16
|
export declare function createOrgSideBarProps(options: {
|
|
17
17
|
isOpen: boolean;
|
|
18
|
-
orgCount
|
|
19
|
-
useConfig?: boolean;
|
|
18
|
+
orgCount: number;
|
|
20
19
|
}): C3NavigationProps["orgSideBar"];
|
|
21
20
|
export declare function createUserSideBarProps(options: {
|
|
22
21
|
isOpen: boolean;
|
|
@@ -125,45 +125,36 @@ export function createInfoSideBarProps(options) {
|
|
|
125
125
|
}
|
|
126
126
|
export function createOrgSideBarProps(options) {
|
|
127
127
|
const elements = [];
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
}
|
|
128
|
+
for (let i = 0; i < options.orgCount; i++) {
|
|
129
|
+
elements.push({
|
|
130
|
+
key: `org-${i}`,
|
|
131
|
+
label: `Organization ${i}`,
|
|
132
|
+
});
|
|
135
133
|
}
|
|
136
134
|
return {
|
|
137
135
|
isOpen: options.isOpen,
|
|
138
|
-
customElements:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
label: "Manage",
|
|
147
|
-
onClick: () => console.log("Manage organization"),
|
|
148
|
-
},
|
|
136
|
+
customElements: {
|
|
137
|
+
activeOrganization: {
|
|
138
|
+
activeLabel: "Active Organization",
|
|
139
|
+
otherLabel: "Other Organization",
|
|
140
|
+
orgName: "Camunda",
|
|
141
|
+
action: {
|
|
142
|
+
label: "Manage",
|
|
143
|
+
onClick: () => console.log("Manage organization"),
|
|
149
144
|
},
|
|
150
145
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
console.log("clicked");
|
|
161
|
-
},
|
|
146
|
+
},
|
|
147
|
+
elements,
|
|
148
|
+
bottomElements: [
|
|
149
|
+
{
|
|
150
|
+
key: "createTrial",
|
|
151
|
+
label: "Create new Trial Org",
|
|
152
|
+
renderIcon: Add,
|
|
153
|
+
onClick: () => {
|
|
154
|
+
console.log("clicked");
|
|
162
155
|
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
? (orgId) => console.log("Switch to org: ", orgId)
|
|
166
|
-
: undefined,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
167
158
|
};
|
|
168
159
|
}
|
|
169
160
|
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 { Dict } from "mixpanel-browser";
|
|
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?: (event: string, data: Dict | undefined) => void;
|
|
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
|
|
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);
|
|
@@ -22,6 +22,7 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
|
|
|
22
22
|
setSuggestion(input);
|
|
23
23
|
setElement(rawElement);
|
|
24
24
|
};
|
|
25
|
+
const titleId = title.replace(/\s/g, "-").toLowerCase();
|
|
25
26
|
return (React.createElement(React.Fragment, null,
|
|
26
27
|
React.createElement(Stack, null, (() => {
|
|
27
28
|
return (React.createElement(React.Fragment, null,
|
|
@@ -30,7 +31,7 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
|
|
|
30
31
|
gridTemplateColumns: "58% 42%",
|
|
31
32
|
} },
|
|
32
33
|
React.createElement(Stack, { gap: 1 },
|
|
33
|
-
React.createElement("h4",
|
|
34
|
+
React.createElement("h4", { id: titleId }, title),
|
|
34
35
|
(() => {
|
|
35
36
|
if (label) {
|
|
36
37
|
return React.createElement("p", { className: "cds--modal-header__label" }, label);
|
|
@@ -38,7 +39,7 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
|
|
|
38
39
|
return React.createElement(React.Fragment, null);
|
|
39
40
|
})(),
|
|
40
41
|
" "),
|
|
41
|
-
React.createElement(Select, { key: `select-${Math.random() * 10000}`, id: `select-${Math.random() * 10000}`, size: "lg", defaultValue: elements[0].value, labelText: "", onChange: (event) => {
|
|
42
|
+
React.createElement(Select, { key: `select-${Math.random() * 10000}`, id: `select-${Math.random() * 10000}`, size: "lg", defaultValue: elements[0].value, "aria-labelledby": titleId, labelText: "", onChange: (event) => {
|
|
42
43
|
const element = elements.find((e) => e.value === event.target.value);
|
|
43
44
|
if (element)
|
|
44
45
|
setElement(element.value);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { TextInput, Stack } from "@carbon/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
export const TextInputElement = ({ title, label, preFiledValue, setValue, placeholder }) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
export const TextInputElement = ({ title, label, preFiledValue, setValue, placeholder }) => {
|
|
4
|
+
const titleId = title.replace(/\s/g, "-").toLowerCase();
|
|
5
|
+
return (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement(Stack, { orientation: "horizontal" },
|
|
7
|
+
React.createElement(Stack, { gap: 1 },
|
|
8
|
+
React.createElement("h4", { id: titleId }, title),
|
|
9
|
+
label && React.createElement("p", { className: "cds--modal-header__label" }, label)),
|
|
10
|
+
React.createElement(TextInput, { id: `text-input-element-${Math.random() * 1000}`, placeholder: placeholder ?? "", labelText: "", value: preFiledValue ?? "", onChange: (event) => {
|
|
11
|
+
setValue(event.target.value);
|
|
12
|
+
}, "aria-labelledby": titleId }))));
|
|
13
|
+
};
|
|
@@ -37,11 +37,7 @@ export const C3ProfileProvider = ({ children }) => {
|
|
|
37
37
|
setActiveOrg(res?.find((org) => org.uuid === config.activeOrganizationId) || null);
|
|
38
38
|
});
|
|
39
39
|
loadClusters();
|
|
40
|
-
}, [
|
|
41
|
-
config?.activeOrganizationId,
|
|
42
|
-
JSON.stringify(decodedToken),
|
|
43
|
-
decodedAudience,
|
|
44
|
-
]);
|
|
40
|
+
}, [config?.activeOrganizationId, decodedToken, decodedAudience]);
|
|
45
41
|
useEffect(() => {
|
|
46
42
|
const updateSystemTheme = ({ matches }) => {
|
|
47
43
|
if (themeRef.current === "system")
|
|
@@ -1,13 +1,10 @@
|
|
|
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;
|
|
6
4
|
type C3UserConfigurationBase = {
|
|
7
5
|
activeOrganizationId: string;
|
|
8
6
|
userToken: string;
|
|
9
7
|
getNewUserToken: () => Promise<string>;
|
|
10
|
-
mixPanelTrack?: MixPanelTrack;
|
|
11
8
|
};
|
|
12
9
|
type C3UserConfigurationWithEndpoints = C3UserConfigurationBase & {
|
|
13
10
|
endpoints: Endpoints;
|
|
@@ -21,8 +18,6 @@ export type C3UserConfiguration = C3UserConfigurationWithEndpoints | C3UserConfi
|
|
|
21
18
|
export type C3UserConfigurationContextValue = C3UserConfiguration & {
|
|
22
19
|
decodedToken: DecodedToken | null;
|
|
23
20
|
decodedAudience: string | null;
|
|
24
|
-
setActiveOrgId: (newOrg: string) => void;
|
|
25
|
-
mixPanelTrack?: MixPanelTrack;
|
|
26
21
|
};
|
|
27
22
|
export declare const C3UserConfigurationContext: React.Context<C3UserConfigurationContextValue>;
|
|
28
23
|
declare const C3UserConfigurationProvider: FC<C3UserConfiguration & {
|
|
@@ -9,30 +9,19 @@ export const C3UserConfigurationContext = React.createContext({
|
|
|
9
9
|
decodedToken: null,
|
|
10
10
|
decodedAudience: null,
|
|
11
11
|
getNewUserToken: () => Promise.resolve(""),
|
|
12
|
-
setActiveOrgId: () => undefined,
|
|
13
12
|
});
|
|
14
|
-
const C3UserConfigurationProvider = ({ children,
|
|
13
|
+
const C3UserConfigurationProvider = ({ children, ...config }) => {
|
|
15
14
|
const [decodedToken, setDecodedToken] = useState(null);
|
|
16
15
|
const [decodedAudience, setDecodedAudience] = useState(null);
|
|
17
|
-
const [activeOrgId, setActiveOrgId] = useState(activeOrganizationId);
|
|
18
16
|
useEffect(() => {
|
|
19
17
|
if (config.userToken)
|
|
20
18
|
setDecodedToken(decodeJWT(config.userToken));
|
|
21
19
|
}, [config.userToken]);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
setActiveOrgId(activeOrganizationId);
|
|
24
|
-
}, [activeOrganizationId]);
|
|
25
20
|
useEffect(() => {
|
|
26
21
|
const { audience } = decodedToken || {};
|
|
27
22
|
setDecodedAudience((typeof audience === "string" ? audience : audience?.[0]) || null);
|
|
28
23
|
}, [decodedToken]);
|
|
29
|
-
return (React.createElement(C3UserConfigurationContext.Provider, { value: {
|
|
30
|
-
...config,
|
|
31
|
-
activeOrganizationId: activeOrgId,
|
|
32
|
-
setActiveOrgId,
|
|
33
|
-
decodedToken,
|
|
34
|
-
decodedAudience,
|
|
35
|
-
} },
|
|
24
|
+
return (React.createElement(C3UserConfigurationContext.Provider, { value: { ...config, decodedToken, decodedAudience } },
|
|
36
25
|
React.createElement(C3ProfileProvider, null,
|
|
37
26
|
React.createElement(C3HelpCenterProvider, null, children))));
|
|
38
27
|
};
|
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.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rimraf lib/",
|
|
6
6
|
"build": "yarn clean && tsc",
|
|
@@ -26,10 +26,10 @@
|
|
|
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.2",
|
|
30
|
+
"@babel/preset-env": "7.23.2",
|
|
31
31
|
"@babel/preset-react": "7.22.15",
|
|
32
|
-
"@babel/preset-typescript": "7.23.
|
|
32
|
+
"@babel/preset-typescript": "7.23.2",
|
|
33
33
|
"@carbon/react": "1.37.0",
|
|
34
34
|
"@mdx-js/react": "2.3.0",
|
|
35
35
|
"@playwright/test": "1.37.1",
|