@camunda/camunda-composite-components 0.6.1 → 0.6.2

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.
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/camunda-cloud/camunda-composite-components.git"
6
6
  },
7
- "version": "0.6.1-rc.5",
7
+ "version": "0.6.1-rc.8",
8
8
  "scripts": {
9
9
  "clean": "rimraf lib/",
10
10
  "build": "yarn clean && tsc",
@@ -30,11 +30,11 @@
30
30
  "test": "yarn test:ts && yarn test:storybook && yarn test:visual-regression:docker"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "7.24.0",
34
- "@babel/preset-env": "7.24.0",
35
- "@babel/preset-react": "7.23.3",
36
- "@babel/preset-typescript": "7.23.3",
37
- "@carbon/react": "1.53.1",
33
+ "@babel/core": "7.24.3",
34
+ "@babel/preset-env": "7.24.3",
35
+ "@babel/preset-react": "7.24.1",
36
+ "@babel/preset-typescript": "7.24.1",
37
+ "@carbon/react": "1.54.0",
38
38
  "@mdx-js/react": "3.0.1",
39
39
  "@playwright/test": "1.42.1",
40
40
  "@semantic-release/changelog": "6.0.3",
@@ -54,34 +54,34 @@
54
54
  "@types/carbon-components-react": "7.55.10",
55
55
  "@types/event-source-polyfill": "1.0.5",
56
56
  "@types/mixpanel-browser": "2.49.0",
57
- "@types/node": "20.11.30",
58
- "@types/react": "18.2.71",
59
- "@types/react-dom": "18.2.22",
57
+ "@types/node": "20.12.2",
58
+ "@types/react": "18.2.73",
59
+ "@types/react-dom": "18.2.23",
60
60
  "@types/styled-components": "5.1.34",
61
- "@typescript-eslint/eslint-plugin": "6.19.1",
62
- "@typescript-eslint/parser": "6.19.1",
63
- "axe-playwright": "1.2.3",
61
+ "@typescript-eslint/eslint-plugin": "7.4.0",
62
+ "@typescript-eslint/parser": "7.4.0",
63
+ "axe-playwright": "2.0.1",
64
64
  "babel-loader": "9.1.3",
65
65
  "conventional-changelog-conventionalcommits": "7.0.2",
66
66
  "copyfiles": "2.4.1",
67
67
  "css-loader": "6.10.0",
68
- "eslint": "8.56.0",
68
+ "eslint": "8.57.0",
69
69
  "eslint-config-prettier": "9.1.0",
70
70
  "eslint-import-resolver-typescript": "3.6.1",
71
71
  "eslint-plugin-import": "2.29.1",
72
72
  "eslint-plugin-prettier": "5.1.3",
73
- "eslint-plugin-react": "7.33.2",
73
+ "eslint-plugin-react": "7.34.1",
74
74
  "eslint-plugin-react-hooks": "4.6.0",
75
75
  "eslint-plugin-storybook": "0.8.0",
76
76
  "event-source-polyfill": "1.0.31",
77
- "husky": "9.0.5",
77
+ "husky": "9.0.11",
78
78
  "mixpanel-browser": "2.49.0",
79
- "prettier": "3.2.4",
79
+ "prettier": "3.2.5",
80
80
  "react": "18.2.0",
81
81
  "react-dom": "18.2.0",
82
82
  "rimraf": "5.0.5",
83
83
  "sass": "1.72.0",
84
- "sass-loader": "13.3.3",
84
+ "sass-loader": "14.1.1",
85
85
  "semantic-release": "23.0.6",
86
86
  "serve": "14.2.1",
87
87
  "storybook": "7.6.17",
@@ -110,5 +110,5 @@
110
110
  ],
111
111
  "author": "Camunda",
112
112
  "license": "Apache-2.0",
113
- "packageManager": "yarn@4.0.2"
113
+ "packageManager": "yarn@4.1.1"
114
114
  }
@@ -3,17 +3,14 @@ import { Persona, TileConfig, WpCardType } from "../components/c3-help-center/c3
3
3
  import { OnboardingConfig } from "../components/c3-onboarding-survey/defaultOnboardingConfig";
4
4
  import { RequestPayload } from "./api";
5
5
  export declare const getConfig: (accessToken: string, audience: string, orgId: string) => Promise<HelpCenterConfig | null>;
6
- export declare const getTiles: ({ accessToken, tileConfig, salesPlanType, clusterIds, currentOrgId, persona, flags, email, cloudAudience, domain, }: {
6
+ export declare const getTiles: ({ accessToken, tileConfig, salesPlanType, clusterIds, persona, flags, cloudAudience, }: {
7
7
  accessToken: string;
8
8
  tileConfig: TileConfig[];
9
9
  cloudAudience: string;
10
- domain: string;
11
10
  persona: {
12
11
  [id: string]: unknown;
13
12
  };
14
13
  clusterIds: string[];
15
- email: string;
16
- currentOrgId: string;
17
14
  salesPlanType: string;
18
15
  flags: string[];
19
16
  }) => Promise<WpCardType[]>;
@@ -8,21 +8,13 @@ export const getConfig = async (accessToken, audience, orgId) => {
8
8
  },
9
9
  });
10
10
  };
11
- export const getTiles = async ({ accessToken, tileConfig, salesPlanType, clusterIds, currentOrgId, persona, flags, email, cloudAudience, domain, }) => {
11
+ export const getTiles = async ({ accessToken, tileConfig, salesPlanType, clusterIds, persona, flags, cloudAudience, }) => {
12
12
  const availableTileTypes = recommendations(persona, flags, tileConfig, salesPlanType, clusterIds?.length > 0);
13
- let cards = await request({
13
+ return await request({
14
14
  url: `https://helpcenter.${cloudAudience}/cards?card_id=${availableTileTypes.join(",")}`,
15
15
  responseType: "json",
16
16
  camundaAuth: { token: accessToken },
17
17
  });
18
- cards = cards.map((card) => {
19
- card.link = card.link?.replaceAll("{cloudAudience}", domain);
20
- card.link = card.link?.replaceAll("{currentOrgId}", currentOrgId);
21
- card.link = card.link?.replaceAll("{clusterId}", clusterIds[0]);
22
- card.link = card.link?.replaceAll("{email}", email);
23
- return card;
24
- });
25
- return cards;
26
18
  };
27
19
  export const getOnboardingConfig = ({ camundaAuth, audience, orgId, }) => request({
28
20
  url: `https://helpcenter.${audience}/survey/config/${orgId}`,
@@ -14,8 +14,10 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
14
14
  const firstTab = tabs[0].id;
15
15
  const { userToken: token, activeOrganizationId, domain, } = useC3UserConfiguration();
16
16
  const { activeOrg: organization, clusters } = useC3Profile();
17
+ const clusterIds = (clusters || []).map((cluster) => cluster.uuid);
17
18
  const { showTabId } = useC3HelpCenter();
18
19
  const [activeTab, setActiveTab] = useState(firstTab);
20
+ const [rawTabTiles, setRawTabTiles] = useState({});
19
21
  const [tabTiles, setTabTiles] = useState({});
20
22
  const [isLoadingTiles, setIsLoadingTiles] = useState(false);
21
23
  let header = "";
@@ -30,11 +32,8 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
30
32
  tiles[singleTab.id] = await getTiles({
31
33
  tileConfig: singleTab.tiles,
32
34
  cloudAudience: audience,
33
- domain: domain || "",
34
35
  persona,
35
- clusterIds: (clusters || []).map((cluster) => cluster.uuid),
36
- email,
37
- currentOrgId: activeOrganizationId ?? "",
36
+ clusterIds,
38
37
  salesPlanType: organization?.salesPlan?.type ?? "",
39
38
  flags,
40
39
  accessToken: token,
@@ -42,7 +41,7 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
42
41
  }
43
42
  }
44
43
  setIsLoadingTiles(false);
45
- setTabTiles(tiles);
44
+ setRawTabTiles(tiles);
46
45
  })();
47
46
  }, [
48
47
  token,
@@ -52,6 +51,24 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
52
51
  JSON.stringify(clusters),
53
52
  JSON.stringify(tabs),
54
53
  ]);
54
+ useEffect(() => {
55
+ if (!tabs || !rawTabTiles)
56
+ return;
57
+ const tiles = {};
58
+ for (const tab of tabs) {
59
+ if (rawTabTiles[tab.id])
60
+ tiles[tab.id] =
61
+ rawTabTiles[tab.id]?.map((card) => {
62
+ if (domain)
63
+ card.link = card.link?.replaceAll("{cloudAudience}", domain);
64
+ card.link = card.link?.replaceAll("{currentOrgId}", activeOrganizationId);
65
+ card.link = card.link?.replaceAll("{clusterId}", clusterIds[0]);
66
+ card.link = card.link?.replaceAll("{email}", email);
67
+ return card;
68
+ }) || [];
69
+ }
70
+ setTabTiles(tiles);
71
+ }, [JSON.stringify(rawTabTiles), email, domain]);
55
72
  useEffect(() => {
56
73
  setActiveTab(initialTab ?? firstTab);
57
74
  }, [initialTab]);
@@ -76,7 +76,7 @@ export const C3NavigationAppBar = ({ app: appProps, appBar, forwardRef, navbar,
76
76
  defaultElements.push(element);
77
77
  });
78
78
  setAppElements(defaultElements);
79
- }, [JSON.stringify(clusters), currentApp]);
79
+ }, [JSON.stringify(clusters), currentApp, domain]);
80
80
  const appBarElements = appBar.elements || (clusters ? appElements : null);
81
81
  return (React.createElement(React.Fragment, null,
82
82
  React.createElement(HeaderGlobalAction, { ref: iconRef, "aria-label": "Camunda components", isActive: appBarOpen, onClick: () => {
@@ -35,7 +35,7 @@ const C3UserConfigurationProvider = ({ children, activeOrganizationId, ...config
35
35
  setDomain(config.noCloudInUrl
36
36
  ? decodedAudience.replace("cloud.", "")
37
37
  : decodedAudience);
38
- }, [decodedAudience]);
38
+ }, [decodedAudience, config.noCloudInUrl]);
39
39
  return (React.createElement(C3UserConfigurationContext.Provider, { value: {
40
40
  ...config,
41
41
  activeOrganizationId: activeOrgId,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/camunda-cloud/camunda-composite-components.git"
6
6
  },
7
- "version": "0.6.1",
7
+ "version": "0.6.2",
8
8
  "scripts": {
9
9
  "clean": "rimraf lib/",
10
10
  "build": "yarn clean && tsc",
@@ -30,11 +30,11 @@
30
30
  "test": "yarn test:ts && yarn test:storybook && yarn test:visual-regression:docker"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "7.24.0",
34
- "@babel/preset-env": "7.24.0",
35
- "@babel/preset-react": "7.23.3",
36
- "@babel/preset-typescript": "7.23.3",
37
- "@carbon/react": "1.53.1",
33
+ "@babel/core": "7.24.3",
34
+ "@babel/preset-env": "7.24.3",
35
+ "@babel/preset-react": "7.24.1",
36
+ "@babel/preset-typescript": "7.24.1",
37
+ "@carbon/react": "1.54.0",
38
38
  "@mdx-js/react": "3.0.1",
39
39
  "@playwright/test": "1.42.1",
40
40
  "@semantic-release/changelog": "6.0.3",
@@ -54,34 +54,34 @@
54
54
  "@types/carbon-components-react": "7.55.10",
55
55
  "@types/event-source-polyfill": "1.0.5",
56
56
  "@types/mixpanel-browser": "2.49.0",
57
- "@types/node": "20.11.30",
58
- "@types/react": "18.2.71",
59
- "@types/react-dom": "18.2.22",
57
+ "@types/node": "20.12.2",
58
+ "@types/react": "18.2.73",
59
+ "@types/react-dom": "18.2.23",
60
60
  "@types/styled-components": "5.1.34",
61
- "@typescript-eslint/eslint-plugin": "6.19.1",
62
- "@typescript-eslint/parser": "6.19.1",
63
- "axe-playwright": "1.2.3",
61
+ "@typescript-eslint/eslint-plugin": "7.4.0",
62
+ "@typescript-eslint/parser": "7.4.0",
63
+ "axe-playwright": "2.0.1",
64
64
  "babel-loader": "9.1.3",
65
65
  "conventional-changelog-conventionalcommits": "7.0.2",
66
66
  "copyfiles": "2.4.1",
67
67
  "css-loader": "6.10.0",
68
- "eslint": "8.56.0",
68
+ "eslint": "8.57.0",
69
69
  "eslint-config-prettier": "9.1.0",
70
70
  "eslint-import-resolver-typescript": "3.6.1",
71
71
  "eslint-plugin-import": "2.29.1",
72
72
  "eslint-plugin-prettier": "5.1.3",
73
- "eslint-plugin-react": "7.33.2",
73
+ "eslint-plugin-react": "7.34.1",
74
74
  "eslint-plugin-react-hooks": "4.6.0",
75
75
  "eslint-plugin-storybook": "0.8.0",
76
76
  "event-source-polyfill": "1.0.31",
77
- "husky": "9.0.5",
77
+ "husky": "9.0.11",
78
78
  "mixpanel-browser": "2.49.0",
79
- "prettier": "3.2.4",
79
+ "prettier": "3.2.5",
80
80
  "react": "18.2.0",
81
81
  "react-dom": "18.2.0",
82
82
  "rimraf": "5.0.5",
83
83
  "sass": "1.72.0",
84
- "sass-loader": "13.3.3",
84
+ "sass-loader": "14.1.1",
85
85
  "semantic-release": "23.0.6",
86
86
  "serve": "14.2.1",
87
87
  "storybook": "7.6.17",
@@ -110,5 +110,5 @@
110
110
  ],
111
111
  "author": "Camunda",
112
112
  "license": "Apache-2.0",
113
- "packageManager": "yarn@4.0.2"
113
+ "packageManager": "yarn@4.1.1"
114
114
  }