@camunda/camunda-composite-components 0.9.0 → 0.9.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.
@@ -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.8.1",
7
+ "version": "0.9.1-rc.0",
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();
@@ -80,6 +86,55 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
80
86
  },
81
87
  ]
82
88
  : []),
89
+ ...(navbar.licenseTag?.show &&
90
+ navbar.licenseTag?.isCommercial === false &&
91
+ (navbar.licenseTag.expiresAt === undefined ||
92
+ navbar.licenseTag.expiresAt - LICENSE_EXPIRY >= Date.now())
93
+ ? [
94
+ {
95
+ key: "non-commercial-license-tag-about-to-expire",
96
+ label: `Non-commercial license`,
97
+ color: "gray",
98
+ },
99
+ ]
100
+ : []),
101
+ ...(navbar.licenseTag?.show &&
102
+ navbar.licenseTag?.expiresAt &&
103
+ navbar.licenseTag?.isCommercial === false &&
104
+ navbar.licenseTag.expiresAt - LICENSE_EXPIRY < Date.now() &&
105
+ navbar.licenseTag.expiresAt > Date.now()
106
+ ? [
107
+ {
108
+ key: "non-commercial-license-tag-about-to-expire",
109
+ label: `Non-commercial license - ${Math.floor((navbar.licenseTag?.expiresAt - Date.now()) / DAY)} ${Math.floor((navbar.licenseTag?.expiresAt - Date.now()) / DAY) > 1
110
+ ? "days"
111
+ : "day"} left`,
112
+ color: "blue",
113
+ renderIcon: Time,
114
+ tooltip: {
115
+ content: (React.createElement("p", null, "Please renew and provide new license keys to continue production use of Camunda.")),
116
+ buttonLabel: "Learn more",
117
+ },
118
+ },
119
+ ]
120
+ : []),
121
+ ...(navbar.licenseTag?.show &&
122
+ navbar.licenseTag?.expiresAt &&
123
+ navbar.licenseTag?.isCommercial === false &&
124
+ navbar.licenseTag.expiresAt < Date.now()
125
+ ? [
126
+ {
127
+ key: "non-commercial-license-tag-is-expired",
128
+ label: `Non-commercial license - expired`,
129
+ color: "red",
130
+ renderIcon: Warning,
131
+ tooltip: {
132
+ content: (React.createElement("p", null, "To continue using all features, please renew your license.")),
133
+ buttonLabel: "Learn more",
134
+ },
135
+ },
136
+ ]
137
+ : []),
83
138
  ];
84
139
  if (app.prefix)
85
140
  console.warn("The `prefix` prop is deprecated and will be removed in a future release. It has been replaced with a Camunda icon.");
@@ -112,13 +167,13 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
112
167
  } },
113
168
  React.createElement(Toggletip, null,
114
169
  React.createElement(ToggletipButton, { label: buttonLabel },
115
- React.createElement(Tag, { type: tag.color, style: {
170
+ React.createElement(Tag, { type: tag.color, renderIcon: tag.renderIcon, style: {
116
171
  margin: "0",
117
172
  cursor: "pointer",
118
173
  } }, tag.label)),
119
174
  React.createElement(StyledToggletipContent, null, content))));
120
175
  }
121
- return (React.createElement(Tag, { key: tag.key, style: {
176
+ return (React.createElement(Tag, { key: tag.key, renderIcon: tag.renderIcon, style: {
122
177
  height: "1.5rem",
123
178
  marginTop: "0.75rem",
124
179
  }, type: tag.color }, tag.label));
@@ -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;
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;
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.9.0",
7
+ "version": "0.9.1-rc.1",
8
8
  "scripts": {
9
9
  "clean": "rimraf lib/",
10
10
  "build": "yarn clean && tsc",