@camunda/camunda-composite-components 0.0.39-rc.4 → 0.0.39
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.
- package/lib/esm/api/api.d.ts +19 -19
- package/lib/esm/api/api.js +67 -65
- package/lib/esm/api/endpoints.const.d.ts +12 -12
- package/lib/esm/api/endpoints.const.js +25 -24
- package/lib/esm/api/jwt.utils.d.ts +3 -3
- package/lib/esm/api/jwt.utils.js +21 -23
- package/lib/esm/api/notifications.d.ts +35 -64
- package/lib/esm/api/notifications.js +159 -168
- package/lib/esm/components/c3-empty-state/c3-empty-state.d.ts +2 -8
- package/lib/esm/components/c3-empty-state/c3-empty-state.js +17 -58
- package/lib/esm/components/c3-empty-state/c3-empty-state.types.d.ts +19 -19
- package/lib/esm/components/c3-empty-state/c3-empty-state.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +6 -0
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +8 -0
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +6 -0
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.js +1 -0
- package/lib/esm/components/c3-navigation/c3-navigation-appbar.d.ts +3 -3
- package/lib/esm/components/c3-navigation/c3-navigation-appbar.js +65 -150
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +37 -58
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +9 -9
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +33 -56
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +8 -8
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +46 -93
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +59 -69
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.d.ts +4 -4
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +88 -142
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-org-sidebar.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-org-sidebar.js +51 -105
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +24 -26
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +25 -38
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +43 -124
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/components.d.ts +1 -6
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/components.js +4 -4
- package/lib/esm/components/c3-navigation/c3-navigation.d.ts +2 -11
- package/lib/esm/components/c3-navigation/c3-navigation.js +90 -205
- package/lib/esm/components/c3-navigation/c3-navigation.types.d.ts +60 -64
- package/lib/esm/components/c3-navigation/c3-navigation.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +13 -30
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-container.js +70 -114
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +27 -29
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +90 -118
- package/lib/esm/components/c3-navigation/helpers.d.ts +3 -5
- package/lib/esm/components/c3-navigation/helpers.js +49 -53
- package/lib/esm/components/c3-navigation/index.d.ts +2 -4
- package/lib/esm/components/c3-navigation/index.js +3 -3
- package/lib/esm/components/c3-navigation/story-helpers.d.ts +18 -23
- package/lib/esm/components/c3-navigation/story-helpers.js +185 -188
- package/lib/esm/components/c3-navigation/story-templates.d.ts +8 -8
- package/lib/esm/components/c3-navigation/story-templates.js +29 -55
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.d.ts +16 -20
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.js +4 -9
- package/lib/esm/icons/c3-icons.d.ts +5 -7
- package/lib/esm/icons/c3-icons.js +14 -82
- package/lib/esm/icons/c3-icons.types.d.ts +1 -1
- package/lib/esm/icons/c3-icons.types.js +1 -1
- package/lib/esm/index.d.ts +9 -14
- package/lib/esm/index.js +4 -4
- package/package.json +1 -1
package/lib/esm/api/api.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Endpoints, Stage } from "./endpoints.const"
|
|
1
|
+
import { Endpoints, Stage } from "./endpoints.const";
|
|
2
2
|
export declare class HttpError extends Error {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
status: number;
|
|
4
|
+
constructor(message: string, status: number);
|
|
5
5
|
}
|
|
6
6
|
export interface RequestPayload {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
base?: "notifications";
|
|
8
|
+
stage?: Stage;
|
|
9
|
+
endpoints?: Endpoints;
|
|
10
|
+
url: string;
|
|
11
|
+
method: "get" | "post" | "put" | "delete" | "patch";
|
|
12
|
+
headers?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
type?: "json" | "text" | "none";
|
|
16
|
+
responseType?: "json" | "text" | "none";
|
|
17
|
+
camundaAuth?: {
|
|
18
|
+
token: string;
|
|
19
|
+
refreshTokenMethod: () => Promise<string>;
|
|
20
|
+
};
|
|
21
|
+
body?: any;
|
|
22
22
|
}
|
|
23
|
-
export declare function request(payload: RequestPayload): Promise<any
|
|
23
|
+
export declare function request(payload: RequestPayload): Promise<any>;
|
package/lib/esm/api/api.js
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
import { getEndpoint, NOTIFICATIONS } from "./endpoints.const"
|
|
2
|
-
import { JWTUtils } from "./jwt.utils"
|
|
1
|
+
import { getEndpoint, NOTIFICATIONS } from "./endpoints.const";
|
|
2
|
+
import { JWTUtils } from "./jwt.utils";
|
|
3
3
|
export class HttpError extends Error {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
status;
|
|
5
|
+
constructor(message, status) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.status = status;
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
10
|
export async function request(payload) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
11
|
+
const headers = {};
|
|
12
|
+
if (payload.camundaAuth) {
|
|
13
|
+
if (JWTUtils.isExpired(payload.camundaAuth.token)) {
|
|
14
|
+
const newToken = await payload.camundaAuth.refreshTokenMethod();
|
|
15
|
+
headers.Authorization = `Bearer ${newToken}`;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
headers.Authorization = `Bearer ${payload.camundaAuth.token}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const type = payload.type ?? "json";
|
|
22
|
+
if (type) {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case "json":
|
|
25
|
+
headers["Content-Type"] = "application/json";
|
|
26
|
+
break;
|
|
27
|
+
case "text":
|
|
28
|
+
headers["Content-Type"] = "text/plain";
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const body = payload.body ? JSON.stringify(payload.body) : undefined;
|
|
33
|
+
let base;
|
|
34
|
+
if (payload.base) {
|
|
35
|
+
switch (payload.base) {
|
|
36
|
+
case "notifications":
|
|
37
|
+
if (payload.endpoints?.notifications) {
|
|
38
|
+
base = payload.endpoints.notifications;
|
|
39
|
+
}
|
|
40
|
+
else if (payload.stage) {
|
|
41
|
+
base = getEndpoint(payload.stage, NOTIFICATIONS);
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const url = base ? `${base}/${payload.url}` : payload.url;
|
|
47
|
+
const response = await fetch(url, {
|
|
48
|
+
method: payload.method.toUpperCase(),
|
|
49
|
+
headers,
|
|
50
|
+
body,
|
|
51
|
+
});
|
|
52
|
+
let success = true;
|
|
53
|
+
if (response.status >= 400 && response.status < 500) {
|
|
54
|
+
success = false;
|
|
55
|
+
}
|
|
56
|
+
if (response.status >= 500) {
|
|
57
|
+
success = false;
|
|
58
|
+
}
|
|
59
|
+
if (!success) {
|
|
60
|
+
throw new HttpError(response.statusText, response.status);
|
|
61
|
+
}
|
|
62
|
+
const responseType = payload.responseType ?? type;
|
|
63
|
+
switch (responseType) {
|
|
64
|
+
case "json":
|
|
65
|
+
return response.json();
|
|
66
|
+
case "text":
|
|
67
|
+
return response.text();
|
|
68
|
+
default:
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
69
71
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export interface Endpoint {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
id: string;
|
|
3
|
+
dev: string;
|
|
4
|
+
int: string;
|
|
5
|
+
prod: string;
|
|
6
6
|
}
|
|
7
7
|
export interface Endpoints {
|
|
8
|
-
|
|
8
|
+
notifications?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare const NOTIFICATIONS: Endpoint
|
|
11
|
-
export declare type Stage = "dev" | "int" | "prod"
|
|
12
|
-
export declare function getEndpoint(stage: Stage, endpoint: Endpoint): string
|
|
10
|
+
export declare const NOTIFICATIONS: Endpoint;
|
|
11
|
+
export declare type Stage = "dev" | "int" | "prod";
|
|
12
|
+
export declare function getEndpoint(stage: Stage, endpoint: Endpoint): string;
|
|
13
13
|
export declare function getEndpointByOptions(options: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}): string
|
|
14
|
+
stage?: Stage;
|
|
15
|
+
endpoints?: Endpoints;
|
|
16
|
+
endpoint: Endpoint;
|
|
17
|
+
}): string;
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
export const NOTIFICATIONS = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
id: "notifications",
|
|
3
|
+
dev: "https://notifications.cloud.dev.ultrawombat.com",
|
|
4
|
+
int: "https://notifications.cloud.ultrawombat.com",
|
|
5
|
+
prod: "https://notifications.cloud.camunda.io",
|
|
6
|
+
};
|
|
7
7
|
export function getEndpoint(stage, endpoint) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
switch (stage) {
|
|
9
|
+
case "dev":
|
|
10
|
+
return endpoint.dev;
|
|
11
|
+
case "int":
|
|
12
|
+
return endpoint.int;
|
|
13
|
+
case "prod":
|
|
14
|
+
return endpoint.prod;
|
|
15
|
+
default:
|
|
16
|
+
throw new Error(`Unknown stage: ${stage}`);
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
export function getEndpointByOptions(options) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
switch (options.endpoint.id) {
|
|
21
|
+
case "notifications":
|
|
22
|
+
if (options.endpoints?.notifications) {
|
|
23
|
+
return options.endpoints.notifications;
|
|
24
|
+
}
|
|
25
|
+
else if (options.stage) {
|
|
26
|
+
return getEndpoint(options.stage, options.endpoint);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Missing stage or notifications endpoint`);
|
|
29
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare class JWTUtils {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
static decode(token: string): any;
|
|
3
|
+
static getExpiration(token: string): number;
|
|
4
|
+
static isExpired(token: string): boolean;
|
|
5
5
|
}
|
package/lib/esm/api/jwt.utils.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
export class JWTUtils {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return expiration < now
|
|
24
|
-
}
|
|
2
|
+
static decode(token) {
|
|
3
|
+
const base64Url = token.split(".")[1];
|
|
4
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
5
|
+
const jsonPayload = decodeURIComponent(window
|
|
6
|
+
.atob(base64)
|
|
7
|
+
.split("")
|
|
8
|
+
.map(function (c) {
|
|
9
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
10
|
+
})
|
|
11
|
+
.join(""));
|
|
12
|
+
return JSON.parse(jsonPayload);
|
|
13
|
+
}
|
|
14
|
+
static getExpiration(token) {
|
|
15
|
+
const decoded = JWTUtils.decode(token);
|
|
16
|
+
return decoded.exp;
|
|
17
|
+
}
|
|
18
|
+
static isExpired(token) {
|
|
19
|
+
const expiration = JWTUtils.getExpiration(token);
|
|
20
|
+
const now = new Date().getTime() / 1000;
|
|
21
|
+
return expiration < now;
|
|
22
|
+
}
|
|
25
23
|
}
|
|
@@ -1,68 +1,39 @@
|
|
|
1
|
-
import { C3NotificationsProps } from "../components/c3-navigation/c3-navigation.types"
|
|
1
|
+
import { C3NotificationsProps } from "../components/c3-navigation/c3-navigation.types";
|
|
2
2
|
export interface Notification {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
uuid: string;
|
|
4
|
+
userId?: string;
|
|
5
|
+
orgId?: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
source: string;
|
|
8
|
+
type: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
state: string;
|
|
12
|
+
meta?: {
|
|
13
|
+
identifier?: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
entity?: {
|
|
17
|
+
id: string;
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
parentEntity?: {
|
|
21
|
+
id: string;
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
25
|
}
|
|
26
|
-
export declare type AnalyticsEvent =
|
|
27
|
-
| "notification-panel-opened"
|
|
28
|
-
| "notification-clicked-cta"
|
|
26
|
+
export declare type AnalyticsEvent = "notification-panel-opened" | "notification-clicked-cta";
|
|
29
27
|
export declare class NotificationService {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
options: C3NotificationsProps,
|
|
42
|
-
notificationId: string,
|
|
43
|
-
operation: "read" | "dismiss",
|
|
44
|
-
): void
|
|
45
|
-
static changeManyStates(
|
|
46
|
-
options: C3NotificationsProps,
|
|
47
|
-
notificationIds: string[],
|
|
48
|
-
operation: "read" | "dismiss",
|
|
49
|
-
): void
|
|
50
|
-
static notificationsStream(
|
|
51
|
-
options: C3NotificationsProps,
|
|
52
|
-
handler: (notification: Notification) => void,
|
|
53
|
-
): void
|
|
54
|
-
static updateNotifications(
|
|
55
|
-
allNotifications: Notification[],
|
|
56
|
-
newNotification: Notification,
|
|
57
|
-
): Notification[]
|
|
58
|
-
static updateNotificationState(
|
|
59
|
-
allNotifications: Notification[],
|
|
60
|
-
notificationId: string,
|
|
61
|
-
newState: "read" | "dismiss",
|
|
62
|
-
): Notification[]
|
|
63
|
-
static updateNotificationStates(
|
|
64
|
-
allNotifications: Notification[],
|
|
65
|
-
notificationIds: string[],
|
|
66
|
-
newState: "read" | "dismiss",
|
|
67
|
-
): Notification[]
|
|
28
|
+
static getNotifications(options: C3NotificationsProps): Promise<Notification[]>;
|
|
29
|
+
static sendAnalyticsEvent(options: C3NotificationsProps, eventOptions: {
|
|
30
|
+
event: AnalyticsEvent;
|
|
31
|
+
id?: string;
|
|
32
|
+
}): void;
|
|
33
|
+
static changeState(options: C3NotificationsProps, notificationId: string, operation: "read" | "dismiss"): void;
|
|
34
|
+
static changeManyStates(options: C3NotificationsProps, notificationIds: string[], operation: "read" | "dismiss"): void;
|
|
35
|
+
static notificationsStream(options: C3NotificationsProps, handler: (notification: Notification) => void): void;
|
|
36
|
+
static updateNotifications(allNotifications: Notification[], newNotification: Notification): Notification[];
|
|
37
|
+
static updateNotificationState(allNotifications: Notification[], notificationId: string, newState: "read" | "dismiss"): Notification[];
|
|
38
|
+
static updateNotificationStates(allNotifications: Notification[], notificationIds: string[], newState: "read" | "dismiss"): Notification[];
|
|
68
39
|
}
|