@camunda/camunda-composite-components 0.9.0 → 0.9.1-rc.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.8.1",
7
+ "version": "0.9.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;
@@ -43,6 +43,11 @@ const ClusterTagWrapper = styled.div `
43
43
  `;
44
44
  const NON_PRODUCTION_TERMS_LINK = "https://legal.camunda.com/#self-managed-non-production-terms";
45
45
  const SALES_CONTACT_LINK = "https://camunda.com/contact/";
46
+ export const SECOND = 1000;
47
+ export const MINUTE = SECOND * 60;
48
+ export const HOUR = MINUTE * 60;
49
+ export const DAY = HOUR * 24;
50
+ const LICENSE_EXPIRY = DAY * 30;
46
51
  export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, helpCenter, actionButtons, userSideBar, notificationSideBar, clusterUuid, options, }) => {
47
52
  const { openHelpCenter } = useC3HelpCenter();
48
53
  const { currentClusterUuid } = useC3UserConfiguration();
@@ -80,6 +85,41 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
80
85
  },
81
86
  ]
82
87
  : []),
88
+ ...(navbar.licenseTag?.show &&
89
+ navbar.licenseTag?.expiresAt &&
90
+ navbar.licenseTag?.isCommercial === false &&
91
+ navbar.licenseTag.expiresAt - LICENSE_EXPIRY < Date.now() &&
92
+ navbar.licenseTag.expiresAt > Date.now()
93
+ ? [
94
+ {
95
+ key: "license-tag-about-to-expire",
96
+ label: `Expires in ${Math.floor((navbar.licenseTag?.expiresAt - Date.now()) / DAY)} days`,
97
+ color: "cyan",
98
+ tooltip: {
99
+ content: (React.createElement("p", null,
100
+ "Your license is about to expire!!11elf Do something about it, NAO!",
101
+ " ")),
102
+ buttonLabel: "Learn more",
103
+ },
104
+ },
105
+ ]
106
+ : []),
107
+ ...(navbar.licenseTag?.show &&
108
+ navbar.licenseTag?.expiresAt &&
109
+ navbar.licenseTag?.isCommercial === false &&
110
+ navbar.licenseTag.expiresAt < Date.now()
111
+ ? [
112
+ {
113
+ key: "license-tag-is-expired",
114
+ label: `License expired!!! So sad! :sad-cat:`,
115
+ color: "red",
116
+ tooltip: {
117
+ content: React.createElement("p", null, "Noooo this is illegal!! "),
118
+ buttonLabel: "Learn more",
119
+ },
120
+ },
121
+ ]
122
+ : []),
83
123
  ];
84
124
  if (app.prefix)
85
125
  console.warn("The `prefix` prop is deprecated and will be removed in a future release. It has been replaced with a Camunda icon.");
@@ -45,6 +45,8 @@ export interface C3NavigationNavBarProps {
45
45
  licenseTag?: {
46
46
  show: boolean;
47
47
  isProductionLicense: boolean;
48
+ isCommercial?: boolean;
49
+ expiresAt?: number;
48
50
  };
49
51
  orgName?: string;
50
52
  }
@@ -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.0",
8
8
  "scripts": {
9
9
  "clean": "rimraf lib/",
10
10
  "build": "yarn clean && tsc",