@camunda/camunda-composite-components 0.10.0 → 0.11.0

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.9.0",
7
+ "version": "0.10.1-rc.2",
8
8
  "scripts": {
9
9
  "clean": "rimraf lib/",
10
10
  "build": "yarn clean && tsc",
@@ -1,3 +1,7 @@
1
1
  import React from "react";
2
2
  import { C3NavigationProps } from "./c3-navigation.types";
3
+ export declare const SECOND = 1000;
4
+ export declare const MINUTE: number;
5
+ export declare const HOUR: number;
6
+ export declare const DAY: number;
3
7
  export declare const C3Navigation: ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, helpCenter, actionButtons, userSideBar, notificationSideBar, clusterUuid, options, }: C3NavigationProps) => React.JSX.Element;
@@ -17,6 +17,7 @@ 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
18
  import { HelpCenterHint } from "../c3-help-center/help-center-hint";
19
19
  import { useC3UserConfiguration } from "../c3-user-configuration/c3-user-configuration-provider";
20
+ import { Time, Warning } from "@carbon/react/icons";
20
21
  /**
21
22
  * UI SHELL
22
23
  * Docs: https://react.carbondesignsystem.com/?path=/story/components-ui-shell--fixed-side-nav
@@ -43,6 +44,11 @@ const ClusterTagWrapper = styled.div `
43
44
  `;
44
45
  const NON_PRODUCTION_TERMS_LINK = "https://legal.camunda.com/#self-managed-non-production-terms";
45
46
  const SALES_CONTACT_LINK = "https://camunda.com/contact/";
47
+ export const SECOND = 1000;
48
+ export const MINUTE = SECOND * 60;
49
+ export const HOUR = MINUTE * 60;
50
+ export const DAY = HOUR * 24;
51
+ const LICENSE_EXPIRY = DAY * 30;
46
52
  export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, helpCenter, actionButtons, userSideBar, notificationSideBar, clusterUuid, options, }) => {
47
53
  const { openHelpCenter } = useC3HelpCenter();
48
54
  const { currentClusterUuid } = useC3UserConfiguration();
@@ -53,6 +59,15 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
53
59
  appBar.appTeaserRouteProps ||
54
60
  (!isLargeScreen && navbar.elements.length > 0);
55
61
  const orgName = activeOrg?.name || navbar.orgName;
62
+ let expiresAt;
63
+ if (navbar.licenseTag?.expiresAt !== undefined) {
64
+ if (typeof navbar.licenseTag?.expiresAt === "string") {
65
+ expiresAt = Date.parse(navbar.licenseTag?.expiresAt);
66
+ }
67
+ if (typeof navbar.licenseTag?.expiresAt === "number") {
68
+ expiresAt = navbar.licenseTag?.expiresAt;
69
+ }
70
+ }
56
71
  const tags = [
57
72
  ...(navbar.tags || []),
58
73
  ...(navbar.licenseTag?.show
@@ -80,6 +95,52 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
80
95
  },
81
96
  ]
82
97
  : []),
98
+ ...(navbar.licenseTag?.show &&
99
+ navbar.licenseTag?.isCommercial === false &&
100
+ (expiresAt === undefined || expiresAt - LICENSE_EXPIRY >= Date.now())
101
+ ? [
102
+ {
103
+ key: "non-commercial-license-tag",
104
+ label: `Non-commercial license`,
105
+ color: "gray",
106
+ },
107
+ ]
108
+ : []),
109
+ ...(navbar.licenseTag?.show &&
110
+ expiresAt &&
111
+ navbar.licenseTag?.isCommercial === false &&
112
+ expiresAt - LICENSE_EXPIRY < Date.now() &&
113
+ expiresAt > Date.now()
114
+ ? [
115
+ {
116
+ key: "non-commercial-license-tag-about-to-expire",
117
+ label: `Non-commercial license - ${Math.floor((expiresAt - Date.now()) / DAY)} ${Math.floor((expiresAt - Date.now()) / DAY) > 1 ? "days" : "day"} left`,
118
+ color: "blue",
119
+ renderIcon: Time,
120
+ tooltip: {
121
+ content: (React.createElement("p", null, "Please renew and provide new license keys to continue production use of Camunda.")),
122
+ buttonLabel: "Learn more",
123
+ },
124
+ },
125
+ ]
126
+ : []),
127
+ ...(navbar.licenseTag?.show &&
128
+ navbar.licenseTag?.expiresAt &&
129
+ navbar.licenseTag?.isCommercial === false &&
130
+ expiresAt < Date.now()
131
+ ? [
132
+ {
133
+ key: "non-commercial-license-tag-is-expired",
134
+ label: `Non-commercial license - expired`,
135
+ color: "red",
136
+ renderIcon: Warning,
137
+ tooltip: {
138
+ content: (React.createElement("p", null, "To continue using all features, please renew your license.")),
139
+ buttonLabel: "Learn more",
140
+ },
141
+ },
142
+ ]
143
+ : []),
83
144
  ];
84
145
  if (app.prefix)
85
146
  console.warn("The `prefix` prop is deprecated and will be removed in a future release. It has been replaced with a Camunda icon.");
@@ -112,15 +173,21 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
112
173
  } },
113
174
  React.createElement(Toggletip, null,
114
175
  React.createElement(ToggletipButton, { label: buttonLabel },
115
- React.createElement(Tag, { type: tag.color, style: {
176
+ React.createElement(Tag, { type: tag.color, renderIcon: tag.renderIcon, style: {
116
177
  margin: "0",
117
178
  cursor: "pointer",
179
+ overflow: "hidden",
180
+ whiteSpace: "nowrap",
181
+ textOverflow: "ellipsis",
118
182
  } }, tag.label)),
119
183
  React.createElement(StyledToggletipContent, null, content))));
120
184
  }
121
- return (React.createElement(Tag, { key: tag.key, style: {
185
+ return (React.createElement(Tag, { key: tag.key, renderIcon: tag.renderIcon, style: {
122
186
  height: "1.5rem",
123
187
  marginTop: "0.75rem",
188
+ overflow: "hidden",
189
+ whiteSpace: "nowrap",
190
+ textOverflow: "ellipsis",
124
191
  }, type: tag.color }, tag.label));
125
192
  }),
126
193
  (clusterUuid || currentClusterUuid) && (React.createElement(ClusterTagWrapper, null,
@@ -4,6 +4,7 @@ import { C3NavigationAppBarProps, C3NavigationInfoSideBarProps, C3NavigationNoti
4
4
  import { C3ActionButtonsProps } from "./c3-navigation-actions/c3-action-buttons.types";
5
5
  import { C3HelpCenterProps } from "../c3-help-center/c3-help-center";
6
6
  import { CamundaClusterStage } from "../c3-cluster-tag/c3-cluster-tag.types";
7
+ import { CarbonIconType } from "@carbon/react/icons";
7
8
  export interface C3NavigationAppProps {
8
9
  prefix?: string;
9
10
  name: string;
@@ -37,6 +38,7 @@ export interface C3NavigationNavBarProps {
37
38
  label: string;
38
39
  key: string;
39
40
  color?: React.ComponentProps<typeof Tag>["type"];
41
+ renderIcon?: CarbonIconType;
40
42
  tooltip?: {
41
43
  content: React.ReactNode;
42
44
  buttonLabel: string;
@@ -45,6 +47,8 @@ export interface C3NavigationNavBarProps {
45
47
  licenseTag?: {
46
48
  show: boolean;
47
49
  isProductionLicense: boolean;
50
+ isCommercial?: boolean;
51
+ expiresAt?: number | string;
48
52
  };
49
53
  orgName?: string;
50
54
  }
@@ -7,11 +7,13 @@ export declare function createAppBarProps(options?: {
7
7
  elements?: Array<C3NavigationElementProps>;
8
8
  useElementsFromConfig?: boolean;
9
9
  }): C3NavigationProps["appBar"];
10
- export declare function createNavBarBarProps({ orgName, elements, showLicenseTag, showProductionLicense, }?: {
10
+ export declare function createNavBarBarProps({ orgName, elements, showLicenseTag, showProductionLicense, isCommercial, expiresAt, }?: {
11
11
  elements?: C3NavigationNavBarProps["elements"];
12
12
  orgName?: string;
13
13
  showLicenseTag?: boolean;
14
14
  showProductionLicense?: boolean;
15
+ isCommercial?: boolean;
16
+ expiresAt?: number | string;
15
17
  }): C3NavigationNavBarProps;
16
18
  export declare function createInfoSideBarProps(options: {
17
19
  isOpen: boolean;
@@ -17,7 +17,7 @@ export function createAppBarProps(options = {}) {
17
17
  : Boolean(options?.isOpen),
18
18
  elements: options.useElementsFromConfig
19
19
  ? undefined
20
- : options?.elements ?? [
20
+ : (options?.elements ?? [
21
21
  {
22
22
  key: "console",
23
23
  label: "Console",
@@ -70,11 +70,11 @@ export function createAppBarProps(options = {}) {
70
70
  target: "_blank",
71
71
  href: "https://camunda.com/",
72
72
  },
73
- ],
73
+ ]),
74
74
  elementClicked: (element) => console.log(`event coming from the appBarProps: ${element} has been clicked`),
75
75
  };
76
76
  }
77
- export function createNavBarBarProps({ orgName = "Camunda", elements = undefined, showLicenseTag, showProductionLicense, } = {}) {
77
+ export function createNavBarBarProps({ orgName = "Camunda", elements = undefined, showLicenseTag, showProductionLicense, isCommercial, expiresAt, } = {}) {
78
78
  return {
79
79
  elements: elements ?? [
80
80
  {
@@ -96,6 +96,8 @@ export function createNavBarBarProps({ orgName = "Camunda", elements = undefined
96
96
  licenseTag: {
97
97
  show: showLicenseTag || false,
98
98
  isProductionLicense: showProductionLicense || false,
99
+ isCommercial: isCommercial || false,
100
+ expiresAt,
99
101
  },
100
102
  tags: [
101
103
  {
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.10.0",
7
+ "version": "0.11.0",
8
8
  "scripts": {
9
9
  "clean": "rimraf lib/",
10
10
  "build": "yarn clean && tsc",