@camunda/camunda-composite-components 0.3.0 → 0.3.1-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/api/api.js +1 -1
- package/lib/esm/components/c3-help-center/c3-help-center-provider.d.ts +6 -0
- package/lib/esm/components/c3-help-center/c3-help-center-provider.js +19 -1
- package/lib/esm/components/c3-help-center/help-center-hint.d.ts +5 -0
- package/lib/esm/components/c3-help-center/help-center-hint.js +17 -0
- package/lib/esm/components/c3-navigation/c3-navigation.js +5 -3
- package/lib/esm/components/c3-onboarding-survey/onboardingSurvey.js +7 -0
- package/package.json +16 -16
package/lib/esm/api/api.js
CHANGED
|
@@ -68,7 +68,7 @@ export async function request(payload) {
|
|
|
68
68
|
success = false;
|
|
69
69
|
}
|
|
70
70
|
if (!success) {
|
|
71
|
-
|
|
71
|
+
console.error(response.statusText, response.status);
|
|
72
72
|
}
|
|
73
73
|
const responseType = payload.responseType ?? type;
|
|
74
74
|
switch (responseType) {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import React, { FC, PropsWithChildren } from "react";
|
|
2
|
+
import { HelpCenterHintType } from "./help-center-hint";
|
|
2
3
|
export type C3HelpCenterContextValue = {
|
|
3
4
|
openHelpCenter: (showTabId?: string) => void;
|
|
4
5
|
setIsHelpCenterOpen: (isOpen: boolean) => void;
|
|
5
6
|
isHelpCenterOpen: boolean;
|
|
6
7
|
showTabId?: string | null;
|
|
8
|
+
showHint: boolean;
|
|
9
|
+
setShowHint: (showHint: boolean) => void;
|
|
10
|
+
setShowHintOnClose: (showHintOnClose: boolean) => void;
|
|
11
|
+
hintType: HelpCenterHintType;
|
|
12
|
+
setHintType: (hintType: HelpCenterHintType) => void;
|
|
7
13
|
};
|
|
8
14
|
export declare const C3HelpCenterContext: React.Context<C3HelpCenterContextValue>;
|
|
9
15
|
export declare const C3HelpCenterProvider: FC<PropsWithChildren>;
|
|
@@ -3,10 +3,18 @@ export const C3HelpCenterContext = React.createContext({
|
|
|
3
3
|
openHelpCenter: () => undefined,
|
|
4
4
|
setIsHelpCenterOpen: () => undefined,
|
|
5
5
|
isHelpCenterOpen: false,
|
|
6
|
+
showHint: false,
|
|
7
|
+
setShowHint: () => undefined,
|
|
8
|
+
setShowHintOnClose: () => undefined,
|
|
9
|
+
hintType: "help-center",
|
|
10
|
+
setHintType: () => undefined,
|
|
6
11
|
});
|
|
7
12
|
export const C3HelpCenterProvider = ({ children }) => {
|
|
8
13
|
const [isHelpCenterOpen, setIsHelpCenterOpen] = useState(false);
|
|
9
14
|
const [activeTabId, setActiveTabId] = useState(null);
|
|
15
|
+
const [showHint, setShowHint] = useState(false);
|
|
16
|
+
const [showHintOnClose, setShowHintOnClose] = useState(false);
|
|
17
|
+
const [hintType, setHintType] = useState("help-center");
|
|
10
18
|
const openHelpCenter = (showTabId) => {
|
|
11
19
|
if (!isHelpCenterOpen) {
|
|
12
20
|
setIsHelpCenterOpen(true);
|
|
@@ -15,14 +23,24 @@ export const C3HelpCenterProvider = ({ children }) => {
|
|
|
15
23
|
setActiveTabId(showTabId);
|
|
16
24
|
};
|
|
17
25
|
useEffect(() => {
|
|
18
|
-
if (!isHelpCenterOpen)
|
|
26
|
+
if (!isHelpCenterOpen) {
|
|
19
27
|
setActiveTabId(null);
|
|
28
|
+
if (showHintOnClose) {
|
|
29
|
+
setShowHint(true);
|
|
30
|
+
setShowHintOnClose(false);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
20
33
|
}, [isHelpCenterOpen]);
|
|
21
34
|
return (React.createElement(C3HelpCenterContext.Provider, { value: {
|
|
22
35
|
openHelpCenter,
|
|
23
36
|
setIsHelpCenterOpen,
|
|
24
37
|
isHelpCenterOpen,
|
|
25
38
|
showTabId: activeTabId,
|
|
39
|
+
showHint,
|
|
40
|
+
setShowHint,
|
|
41
|
+
setShowHintOnClose,
|
|
42
|
+
hintType,
|
|
43
|
+
setHintType,
|
|
26
44
|
} }, children));
|
|
27
45
|
};
|
|
28
46
|
export const useC3HelpCenter = () => React.useContext(C3HelpCenterContext);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Toggletip, ToggletipActions, ToggletipContent, } from "@carbon/react";
|
|
3
|
+
import { useC3HelpCenter } from "./c3-help-center-provider";
|
|
4
|
+
export const HelpCenterHint = ({ children, type }) => {
|
|
5
|
+
const { showHint, setShowHint } = useC3HelpCenter();
|
|
6
|
+
return setShowHint ? (React.createElement(Toggletip, { defaultOpen: showHint,
|
|
7
|
+
// eslint-disable-next-line
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
align: "bottom-right" },
|
|
10
|
+
children,
|
|
11
|
+
React.createElement(ToggletipContent, null,
|
|
12
|
+
React.createElement("p", null, type === "help-center"
|
|
13
|
+
? "Access the help center at any time to see your recommendations, discover guides, tutorials, or to share feedback."
|
|
14
|
+
: "Access the onboarding survey to get personalized next steps and educational content"),
|
|
15
|
+
React.createElement(ToggletipActions, null,
|
|
16
|
+
React.createElement(Button, { size: "sm", onClick: () => setShowHint(false) }, "Got it"))))) : (children);
|
|
17
|
+
};
|
|
@@ -15,6 +15,7 @@ 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
17
|
import { useC3Profile } from "../c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
18
|
+
import { HelpCenterHint } from "../c3-help-center/help-center-hint";
|
|
18
19
|
/**
|
|
19
20
|
* UI SHELL
|
|
20
21
|
* Docs: https://react.carbondesignsystem.com/?path=/story/components-ui-shell--fixed-side-nav
|
|
@@ -110,9 +111,10 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
|
|
|
110
111
|
...orgSideBar,
|
|
111
112
|
type: "org",
|
|
112
113
|
} })),
|
|
113
|
-
infoButton || helpCenter ? (React.createElement(
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
infoButton || helpCenter ? (React.createElement(HelpCenterHint, { type: "onboarding" },
|
|
115
|
+
React.createElement(InfoButton, { onClick: infoButton
|
|
116
|
+
? infoButton.onClick
|
|
117
|
+
: () => setIsHelpCenterOpen(!isHelpCenterOpen) }))) : (infoSideBar && (React.createElement(C3InfoSidebar, { sideBar: { ...infoSideBar, type: "info" } }))),
|
|
116
118
|
userSideBar && (React.createElement(C3UserSidebar, { sideBar: {
|
|
117
119
|
...userSideBar,
|
|
118
120
|
type: "user",
|
|
@@ -4,7 +4,9 @@ import { OnboardingModal } from "./onboardingModal";
|
|
|
4
4
|
import { OnboardingPage } from "./onboardingPage";
|
|
5
5
|
import { OnboardingStep } from "./step";
|
|
6
6
|
import { Body01 } from "../styles";
|
|
7
|
+
import { useC3HelpCenter } from "../c3-help-center/c3-help-center-provider";
|
|
7
8
|
export const OnboardingSurvey = ({ appTheme, persona, userFirstName, syncPersona, setPersona, mixpanelTrack, onRequestClose, onboardingConfiguration, isLoadingConfig, modal, origin, }) => {
|
|
9
|
+
const { setShowHintOnClose, setHintType } = useC3HelpCenter();
|
|
8
10
|
const [step, setStep] = useState(persona?.nextStep ?? 0);
|
|
9
11
|
const [isDoingAsyncWork, setIsDoingAsyncWork] = useState(false);
|
|
10
12
|
React.useEffect(() => {
|
|
@@ -19,10 +21,15 @@ export const OnboardingSurvey = ({ appTheme, persona, userFirstName, syncPersona
|
|
|
19
21
|
wasShown: true,
|
|
20
22
|
},
|
|
21
23
|
};
|
|
24
|
+
if (!persona?.wasShown) {
|
|
25
|
+
setShowHintOnClose(true);
|
|
26
|
+
setHintType("onboarding");
|
|
27
|
+
}
|
|
22
28
|
if (committedStep >= onboardingConfiguration.steps.length) {
|
|
23
29
|
newPersona.nextStep = 0;
|
|
24
30
|
newPersona.complete = true;
|
|
25
31
|
await syncPersona(newPersona, true);
|
|
32
|
+
setHintType("help-center");
|
|
26
33
|
}
|
|
27
34
|
else {
|
|
28
35
|
newPersona.nextStep = step + 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/camunda-composite-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1-rc.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rimraf lib/",
|
|
6
6
|
"build": "yarn clean && tsc",
|
|
@@ -26,24 +26,24 @@
|
|
|
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.23.
|
|
31
|
-
"@babel/preset-react": "7.
|
|
32
|
-
"@babel/preset-typescript": "7.23.
|
|
29
|
+
"@babel/core": "7.23.3",
|
|
30
|
+
"@babel/preset-env": "7.23.3",
|
|
31
|
+
"@babel/preset-react": "7.23.3",
|
|
32
|
+
"@babel/preset-typescript": "7.23.3",
|
|
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.5.
|
|
37
|
-
"@storybook/addon-actions": "7.5.
|
|
38
|
-
"@storybook/addon-docs": "7.5.
|
|
39
|
-
"@storybook/addon-essentials": "7.5.
|
|
40
|
-
"@storybook/addon-interactions": "7.5.
|
|
41
|
-
"@storybook/addon-links": "7.5.
|
|
42
|
-
"@storybook/blocks": "7.5.
|
|
36
|
+
"@storybook/addon-a11y": "7.5.3",
|
|
37
|
+
"@storybook/addon-actions": "7.5.3",
|
|
38
|
+
"@storybook/addon-docs": "7.5.3",
|
|
39
|
+
"@storybook/addon-essentials": "7.5.3",
|
|
40
|
+
"@storybook/addon-interactions": "7.5.3",
|
|
41
|
+
"@storybook/addon-links": "7.5.3",
|
|
42
|
+
"@storybook/blocks": "7.5.3",
|
|
43
43
|
"@storybook/preset-scss": "1.0.3",
|
|
44
|
-
"@storybook/react": "7.5.
|
|
45
|
-
"@storybook/react-webpack5": "7.5.
|
|
46
|
-
"@storybook/test-runner": "0.
|
|
44
|
+
"@storybook/react": "7.5.3",
|
|
45
|
+
"@storybook/react-webpack5": "7.5.3",
|
|
46
|
+
"@storybook/test-runner": "0.14.1",
|
|
47
47
|
"@storybook/testing-library": "0.2.2",
|
|
48
48
|
"@types/carbon-components-react": "7.55.3",
|
|
49
49
|
"@types/event-source-polyfill": "1.0.1",
|
|
@@ -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.5.
|
|
79
|
+
"storybook": "7.5.3",
|
|
80
80
|
"style-loader": "3.3.3",
|
|
81
81
|
"styled-components": "6.0.7",
|
|
82
82
|
"typescript": "5.2.2",
|