@camunda/camunda-composite-components 0.2.18-rc.5 → 0.2.18-rc.7

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.
@@ -73,9 +73,6 @@ 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 ?? "" }));
79
76
  }
80
77
  else if (activeTab === "recommendations" &&
81
78
  Object.keys(tabTiles).length === 0 &&
@@ -176,7 +173,11 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
176
173
  }))),
177
174
  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" },
178
175
  React.createElement("span", { className: "cds--link" }, link.label))))))),
179
- content)),
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 ?? "" })))),
180
181
  persona.complete && activeTab === "recommendations" && (React.createElement(ModalFooter, { style: {
181
182
  height: "62px",
182
183
  paddingRight: "16px",
@@ -21,7 +21,7 @@ export const C3NavigationAppBar = ({ appBar, forwardRef, navbar, }) => {
21
21
  const [appBarOpen, setAppBarOpen] = useState(appBar.isOpen);
22
22
  const [panelRef, iconRef] = useOnClickOutside(() => setAppBarOpen(false));
23
23
  return (React.createElement(React.Fragment, null,
24
- React.createElement(HeaderGlobalAction, { ref: iconRef, "aria-label": "Camunda apps", isActive: appBarOpen, onClick: () => {
24
+ React.createElement(HeaderGlobalAction, { ref: iconRef, "aria-label": "Camunda components", isActive: appBarOpen, onClick: () => {
25
25
  setAppBarOpen(!appBarOpen);
26
26
  }, tooltipAlignment: "start",
27
27
  /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
@@ -9,7 +9,7 @@ import { useC3UserConfiguration } from "../../c3-user-configuration/c3-user-conf
9
9
  const C3OrgSidebar = ({ sideBar }) => {
10
10
  const { customElements, switchToOrg, elements, ...sideBarProps } = sideBar;
11
11
  const { isOpen, setIsOpen } = useOrgSidebarState();
12
- const { decodedAudience, setActiveOrgId, analyticsTrack } = useC3UserConfiguration();
12
+ const { decodedAudience, analyticsTrack, setActiveOrgId } = useC3UserConfiguration();
13
13
  const { activeOrg, orgs } = useC3Profile();
14
14
  const isCustomized = Boolean(customElements?.activeOrganization);
15
15
  const onManageOrg = () => {
@@ -8,6 +8,7 @@ export type C3ProfileContextValue = {
8
8
  theme: Theme;
9
9
  orgs: Organization[] | null;
10
10
  activeOrg: Organization | null;
11
+ reloadOrgs: () => void;
11
12
  clusters: Cluster[] | null;
12
13
  reloadClusters: () => void;
13
14
  resolvedTheme: ResolvedTheme;
@@ -8,6 +8,7 @@ export const C3ProfileContext = createContext({
8
8
  theme: defaultTheme,
9
9
  orgs: null,
10
10
  activeOrg: null,
11
+ reloadOrgs: () => undefined,
11
12
  clusters: null,
12
13
  reloadClusters: () => undefined,
13
14
  resolvedTheme: defaultTheme,
@@ -21,21 +22,32 @@ export const C3ProfileProvider = ({ children }) => {
21
22
  const [orgs, setOrgs] = useState(null);
22
23
  const [activeOrg, setActiveOrg] = useState(null);
23
24
  const [clusters, setClusters] = useState(null);
25
+ const isConfigValid = config.userToken && config.activeOrganizationId && decodedAudience;
24
26
  const loadClusters = () => {
25
- if (!config.userToken || !decodedAudience || !config.activeOrganizationId)
27
+ if (!isConfigValid)
26
28
  return;
27
29
  getClusters(decodedAudience, config.userToken, config.activeOrganizationId).then((res) => {
28
30
  setClusters(res);
29
31
  });
30
32
  };
31
- useEffect(() => {
32
- if (!decodedToken || !decodedAudience || !config.activeOrganizationId) {
33
+ const loadOrgs = () => {
34
+ if (!isConfigValid)
33
35
  return;
34
- }
35
36
  getOrgs(decodedAudience, config.userToken).then((res) => {
36
37
  setOrgs(res);
37
38
  setActiveOrg(res?.find((org) => org.uuid === config.activeOrganizationId) || null);
38
39
  });
40
+ };
41
+ useEffect(() => {
42
+ if (config?.activeOrganizationId) {
43
+ const org = orgs?.find((org) => org.uuid === config.activeOrganizationId);
44
+ if (org) {
45
+ setActiveOrg(org);
46
+ }
47
+ else {
48
+ loadOrgs();
49
+ }
50
+ }
39
51
  loadClusters();
40
52
  }, [
41
53
  config?.activeOrganizationId,
@@ -81,6 +93,7 @@ export const C3ProfileProvider = ({ children }) => {
81
93
  resolvedTheme,
82
94
  orgs,
83
95
  activeOrg,
96
+ reloadOrgs: loadOrgs,
84
97
  clusters,
85
98
  reloadClusters: loadClusters,
86
99
  onThemeChange,
@@ -21,7 +21,7 @@ export type C3UserConfiguration = C3UserConfigurationWithEndpoints | C3UserConfi
21
21
  export type C3UserConfigurationContextValue = C3UserConfiguration & {
22
22
  decodedToken: DecodedToken | null;
23
23
  decodedAudience: string | null;
24
- setActiveOrgId: (newOrg: string) => void;
24
+ setActiveOrgId: (id: string) => void;
25
25
  analyticsTrack?: MixPanelTrack;
26
26
  };
27
27
  export declare const C3UserConfigurationContext: React.Context<C3UserConfigurationContextValue>;
@@ -5,11 +5,11 @@ import { C3HelpCenterProvider } from "../c3-help-center/c3-help-center-provider"
5
5
  export const C3UserConfigurationContext = React.createContext({
6
6
  stage: "dev",
7
7
  activeOrganizationId: "",
8
+ setActiveOrgId: () => undefined,
8
9
  userToken: "",
9
10
  decodedToken: null,
10
11
  decodedAudience: null,
11
12
  getNewUserToken: () => Promise.resolve(""),
12
- setActiveOrgId: () => undefined,
13
13
  });
14
14
  const C3UserConfigurationProvider = ({ children, activeOrganizationId, ...config }) => {
15
15
  const [decodedToken, setDecodedToken] = useState(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.2.18-rc.5",
3
+ "version": "0.2.18-rc.7",
4
4
  "scripts": {
5
5
  "clean": "rimraf lib/",
6
6
  "build": "yarn clean && tsc",
@@ -33,16 +33,16 @@
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.1",
37
- "@storybook/addon-actions": "7.5.1",
38
- "@storybook/addon-docs": "7.5.1",
39
- "@storybook/addon-essentials": "7.5.1",
40
- "@storybook/addon-interactions": "7.5.1",
41
- "@storybook/addon-links": "7.5.1",
42
- "@storybook/blocks": "7.5.1",
36
+ "@storybook/addon-a11y": "7.5.2",
37
+ "@storybook/addon-actions": "7.5.2",
38
+ "@storybook/addon-docs": "7.5.2",
39
+ "@storybook/addon-essentials": "7.5.2",
40
+ "@storybook/addon-interactions": "7.5.2",
41
+ "@storybook/addon-links": "7.5.2",
42
+ "@storybook/blocks": "7.5.2",
43
43
  "@storybook/preset-scss": "1.0.3",
44
- "@storybook/react": "7.5.1",
45
- "@storybook/react-webpack5": "7.5.1",
44
+ "@storybook/react": "7.5.2",
45
+ "@storybook/react-webpack5": "7.5.2",
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",
@@ -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.1",
79
+ "storybook": "7.5.2",
80
80
  "style-loader": "3.3.3",
81
81
  "styled-components": "6.0.7",
82
82
  "typescript": "5.2.2",