@camunda/camunda-composite-components 0.2.16 → 0.2.17-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.
|
@@ -20,7 +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 shouldShowSurvey = showSurvey || !persona?.wasShown;
|
|
24
23
|
useEffect(() => {
|
|
25
24
|
const updateResolvedTheme = ({ matches }) => {
|
|
26
25
|
if (themeRef.current === "system") {
|
|
@@ -50,10 +49,10 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
50
49
|
const fetchData = async () => {
|
|
51
50
|
if (!userToken || !decodedToken || !decodedAudience)
|
|
52
51
|
return;
|
|
53
|
-
const { userId, meta, persona } = decodedToken;
|
|
54
|
-
if (
|
|
55
|
-
setPersona(
|
|
56
|
-
if (
|
|
52
|
+
const { userId, meta, persona: tokenPersona } = decodedToken;
|
|
53
|
+
if (tokenPersona !== undefined) {
|
|
54
|
+
setPersona(tokenPersona);
|
|
55
|
+
if (tokenPersona.wasShown) {
|
|
57
56
|
setShowSurvey(false);
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -64,8 +63,11 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
64
63
|
setEmail(meta.email);
|
|
65
64
|
if (userId)
|
|
66
65
|
setUserId(userId);
|
|
67
|
-
if (
|
|
68
|
-
|
|
66
|
+
if (autoStartSurvey && !tokenPersona?.wasShown) {
|
|
67
|
+
if (showSurvey || !tokenPersona?.wasShown) {
|
|
68
|
+
console.log("show survey", showSurvey);
|
|
69
|
+
setShowSurvey(true);
|
|
70
|
+
}
|
|
69
71
|
setIsHelpCenterOpen(true);
|
|
70
72
|
onRequestOpen?.();
|
|
71
73
|
}
|
|
@@ -84,8 +86,6 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
84
86
|
const tabs = helpCenterConfig.tabs;
|
|
85
87
|
const firstTab = tabs[0].id;
|
|
86
88
|
if (isOpen) {
|
|
87
|
-
if (shouldShowSurvey)
|
|
88
|
-
setShowSurvey(true);
|
|
89
89
|
mixpanelTrack?.(`helpcenter:open`, {
|
|
90
90
|
to: activeTab ?? firstTab,
|
|
91
91
|
from: origin,
|
|
@@ -166,5 +166,5 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, m
|
|
|
166
166
|
reloadClusters();
|
|
167
167
|
};
|
|
168
168
|
return (React.createElement(Layer, null,
|
|
169
|
-
React.createElement(ComposedModal, { open: isOpen, size: "lg", onClose: closeFn, className: "help-center", "aria-label": "HelpCenter" },
|
|
169
|
+
React.createElement(ComposedModal, { open: isOpen, size: "lg", onClose: closeFn, className: "help-center", "aria-label": "HelpCenter" }, showSurvey || !persona?.wasShown ? (React.createElement(C3OnboardingSurvey, { personaCallback: personaCallback, persona: persona, mixpanelTrack: mixpanelTrack, onRequestClose: closeFn, onRequestSkip: onRequestSkipSurvey, theme: resolvedTheme, origin: origin, modal: true })) : (React.createElement(HelpCenter, { configuration: helpCenterConfig, persona: persona, audience: decodedAudience || "", organization: activeOrg, clusters: clusters || [], flags: flags, onRequestResumeSurvey: onRequestResumeSurvey, onRequestRetakeSurvey: onRequestRetakeSurvey, onRequestClose: closeFn, mixpanelTrack: mixpanelTrack, email: email, theme: resolvedTheme, origin: origin, initialTab: activeTab })))));
|
|
170
170
|
};
|
|
@@ -25,4 +25,4 @@ export declare function createUserSideBarProps(options: {
|
|
|
25
25
|
export declare function createNotificationSideBarProps(options: {
|
|
26
26
|
isOpen: boolean;
|
|
27
27
|
}): C3NavigationProps["notificationSideBar"];
|
|
28
|
-
export declare const createHelpCenterProps: (options?: C3HelpCenterProps) => C3NavigationProps["helpCenter"];
|
|
28
|
+
export declare const createHelpCenterProps: (options?: Partial<C3HelpCenterProps>) => C3NavigationProps["helpCenter"];
|
|
@@ -215,5 +215,6 @@ export function createNotificationSideBarProps(options) {
|
|
|
215
215
|
export const createHelpCenterProps = (options) => ({
|
|
216
216
|
origin: options?.origin || "console",
|
|
217
217
|
theme: options?.theme,
|
|
218
|
+
autoStartSurvey: options?.autoStartSurvey,
|
|
218
219
|
mixpanelTrack: (event, data) => console.log(`Mixpanel event ${event} tracked: ${data}`),
|
|
219
220
|
});
|