@camunda/camunda-composite-components 0.22.3 → 0.22.5
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/package.json +98 -0
- package/lib/esm/src/api/api.d.ts +29 -0
- package/lib/esm/src/api/api.js +92 -0
- package/lib/esm/src/api/clusters.d.ts +10 -0
- package/lib/esm/src/api/clusters.js +32 -0
- package/lib/esm/src/api/endpoints.const.d.ts +22 -0
- package/lib/esm/src/api/endpoints.const.js +70 -0
- package/lib/esm/src/api/help-center.d.ts +42 -0
- package/lib/esm/src/api/help-center.js +56 -0
- package/lib/esm/src/api/jwt.utils.d.ts +5 -0
- package/lib/esm/src/api/jwt.utils.js +26 -0
- package/lib/esm/src/api/notifications.d.ts +41 -0
- package/lib/esm/src/api/notifications.js +170 -0
- package/lib/esm/src/api/organizations.d.ts +15 -0
- package/lib/esm/src/api/organizations.js +16 -0
- package/lib/esm/src/api/profile.d.ts +20 -0
- package/lib/esm/src/api/profile.js +48 -0
- package/lib/esm/src/api/status.d.ts +7 -0
- package/lib/esm/src/api/status.js +46 -0
- package/lib/esm/src/assets/c3-icons.d.ts +5 -0
- package/lib/esm/src/assets/c3-icons.js +5 -0
- package/lib/esm/src/assets/c3-icons.types.d.ts +3 -0
- package/lib/esm/src/assets/c3-icons.types.js +6 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.d.ts +5 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.js +94 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.d.ts +17 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.js +31 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.d.ts +14 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.js +24 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.d.ts +9 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.js +48 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.d.ts +1 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.js +33 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.d.ts +14 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.js +53 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.d.ts +6 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.js +84 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.d.ts +1 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.js +13 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.d.ts +26 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.js +11 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.d.ts +3 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.js +509 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.d.ts +122 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.js +6 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.d.ts +3 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.js +15 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.d.ts +8 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.js +6 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.d.ts +3 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.js +15 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.d.ts +1 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.js +25 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.d.ts +29 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.js +6 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.d.ts +19 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.js +58 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.d.ts +16 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.js +218 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.types.d.ts +43 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.types.js +6 -0
- package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.d.ts +10 -0
- package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.js +17 -0
- package/lib/esm/src/components/c3-help-center/help-center-hint.d.ts +4 -0
- package/lib/esm/src/components/c3-help-center/help-center-hint.js +15 -0
- package/lib/esm/src/components/c3-help-center/help-center.d.ts +18 -0
- package/lib/esm/src/components/c3-help-center/help-center.js +189 -0
- package/lib/esm/src/components/c3-help-center/recommendations.d.ts +4 -0
- package/lib/esm/src/components/c3-help-center/recommendations.js +55 -0
- package/lib/esm/src/components/c3-help-center/styles.d.ts +4 -0
- package/lib/esm/src/components/c3-help-center/styles.js +48 -0
- package/lib/esm/src/components/c3-help-center/tabs/feedback.d.ts +9 -0
- package/lib/esm/src/components/c3-help-center/tabs/feedback.js +141 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.d.ts +20 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.js +22 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.d.ts +2 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.js +26 -0
- package/lib/esm/src/components/c3-help-center/tile.d.ts +10 -0
- package/lib/esm/src/components/c3-help-center/tile.js +61 -0
- package/lib/esm/src/components/c3-navigation/c3-info-button.d.ts +4 -0
- package/lib/esm/src/components/c3-navigation/c3-info-button.js +9 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +18 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +10 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.js +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.d.ts +4 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.js +380 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.d.ts +2 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.js +21 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +38 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +12 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +68 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +10 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +87 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +81 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.js +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.d.ts +5 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +107 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +29 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +54 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +57 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.d.ts +2 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.js +11 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.d.ts +7 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.js +262 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.test.d.ts +1 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.test.js +89 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.d.ts +97 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.js +6 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +13 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.js +100 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +19 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +110 -0
- package/lib/esm/src/components/c3-navigation/c3-org-name.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-org-name.js +34 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.js +188 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.d.ts +29 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.js +92 -0
- package/lib/esm/src/components/c3-navigation/helpers.d.ts +8 -0
- package/lib/esm/src/components/c3-navigation/helpers.js +58 -0
- package/lib/esm/src/components/c3-navigation/index.d.ts +2 -0
- package/lib/esm/src/components/c3-navigation/index.js +8 -0
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.d.ts +35 -0
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.js +264 -0
- package/lib/esm/src/components/c3-navigation/stories/story-templates.d.ts +9 -0
- package/lib/esm/src/components/c3-navigation/stories/story-templates.js +38 -0
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.d.ts +14 -0
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.js +94 -0
- package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.d.ts +16 -0
- package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.js +8 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.d.ts +15 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.js +58 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/inlineNotification.d.ts +3 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/inlineNotification.js +10 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.d.ts +7 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.js +53 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.d.ts +7 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.js +36 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.d.ts +6 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.js +14 -0
- package/lib/esm/src/components/c3-onboarding-survey/helpers.d.ts +1 -0
- package/lib/esm/src/components/c3-onboarding-survey/helpers.js +10 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.d.ts +30 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.js +13 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.d.ts +25 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.js +52 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.d.ts +21 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.js +35 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.d.ts +17 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.js +148 -0
- package/lib/esm/src/components/c3-onboarding-survey/step.d.ts +7 -0
- package/lib/esm/src/components/c3-onboarding-survey/step.js +44 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.d.ts +3 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.js +28 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.d.ts +19 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.js +6 -0
- package/lib/esm/src/components/c3-page/c3-page.d.ts +4 -0
- package/lib/esm/src/components/c3-page/c3-page.js +16 -0
- package/lib/esm/src/components/c3-page/c3-page.test.d.ts +1 -0
- package/lib/esm/src/components/c3-page/c3-page.test.js +25 -0
- package/lib/esm/src/components/c3-page/c3-page.types.d.ts +18 -0
- package/lib/esm/src/components/c3-page/c3-page.types.js +6 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.d.ts +3 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.js +37 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.d.ts +14 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.js +6 -0
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.d.ts +2 -0
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.js +18 -0
- package/lib/esm/src/components/c3-user-configuration/authToken.d.ts +30 -0
- package/lib/esm/src/components/c3-user-configuration/authToken.js +30 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.d.ts +26 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +117 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.d.ts +13 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.js +29 -0
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.d.ts +54 -0
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.js +43 -0
- package/lib/esm/src/components/styles.d.ts +13 -0
- package/lib/esm/src/components/styles.js +90 -0
- package/lib/esm/src/components/test-utils.d.ts +3 -0
- package/lib/esm/src/components/test-utils.js +32 -0
- package/lib/esm/src/contexts/c3-cluster-update-manager.d.ts +12 -0
- package/lib/esm/src/contexts/c3-cluster-update-manager.js +27 -0
- package/lib/esm/src/hooks/useApi.d.ts +20 -0
- package/lib/esm/src/hooks/useApi.js +54 -0
- package/lib/esm/src/index.d.ts +23 -0
- package/lib/esm/src/index.js +19 -0
- package/lib/esm/src/utils/camunda.d.ts +21 -0
- package/lib/esm/src/utils/camunda.js +59 -0
- package/lib/esm/src/utils/camunda.types.d.ts +63 -0
- package/lib/esm/src/utils/camunda.types.js +6 -0
- package/lib/esm/src/utils/versionCheck.utils.d.ts +15 -0
- package/lib/esm/src/utils/versionCheck.utils.js +79 -0
- package/package.json +18 -18
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
import { EventSourcePolyfill } from 'event-source-polyfill';
|
|
7
|
+
import { request } from './api.js';
|
|
8
|
+
import { getEndpointByOptions, NOTIFICATIONS } from './endpoints.const.js';
|
|
9
|
+
export class NotificationService {
|
|
10
|
+
static async getNotifications(options) {
|
|
11
|
+
return await request({
|
|
12
|
+
method: 'get',
|
|
13
|
+
base: 'notifications',
|
|
14
|
+
stage: options.stage,
|
|
15
|
+
endpoints: options.endpoints,
|
|
16
|
+
camundaAuth: {
|
|
17
|
+
token: options.userToken,
|
|
18
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
19
|
+
},
|
|
20
|
+
url: `notifications/orgs/${options.activeOrganizationId}`,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
static sendAnalyticsEvent(options, eventOptions) {
|
|
24
|
+
request({
|
|
25
|
+
method: 'post',
|
|
26
|
+
base: 'notifications',
|
|
27
|
+
stage: options.stage,
|
|
28
|
+
endpoints: options.endpoints,
|
|
29
|
+
camundaAuth: {
|
|
30
|
+
token: options.userToken,
|
|
31
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
32
|
+
},
|
|
33
|
+
url: `analytics/${options.activeOrganizationId}/${eventOptions.event}`,
|
|
34
|
+
body: {
|
|
35
|
+
id: eventOptions.id,
|
|
36
|
+
},
|
|
37
|
+
type: 'json',
|
|
38
|
+
responseType: 'text',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
static changeState(options, notificationId, operation) {
|
|
42
|
+
request({
|
|
43
|
+
method: 'patch',
|
|
44
|
+
base: 'notifications',
|
|
45
|
+
stage: options.stage,
|
|
46
|
+
endpoints: options.endpoints,
|
|
47
|
+
camundaAuth: {
|
|
48
|
+
token: options.userToken,
|
|
49
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
50
|
+
},
|
|
51
|
+
url: `notifications/${notificationId}/${operation}`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
static markManyAsRead(options, notificationIds) {
|
|
55
|
+
if (notificationIds.length === 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
request({
|
|
59
|
+
method: 'patch',
|
|
60
|
+
base: 'notifications',
|
|
61
|
+
stage: options.stage,
|
|
62
|
+
endpoints: options.endpoints,
|
|
63
|
+
camundaAuth: {
|
|
64
|
+
token: options.userToken,
|
|
65
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
66
|
+
},
|
|
67
|
+
url: `notifications/batch/state/read`,
|
|
68
|
+
body: {
|
|
69
|
+
uuids: notificationIds,
|
|
70
|
+
},
|
|
71
|
+
type: 'json',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
static dismissAll(options, orgId) {
|
|
75
|
+
if (!orgId) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
request({
|
|
79
|
+
method: 'patch',
|
|
80
|
+
base: 'notifications',
|
|
81
|
+
stage: options.stage,
|
|
82
|
+
endpoints: options.endpoints,
|
|
83
|
+
camundaAuth: {
|
|
84
|
+
token: options.userToken,
|
|
85
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
86
|
+
},
|
|
87
|
+
url: `notifications/dismissAll?orgId=${orgId}`,
|
|
88
|
+
type: 'json',
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
static notificationsStream(options, handler) {
|
|
92
|
+
const baseUrl = getEndpointByOptions({
|
|
93
|
+
...options,
|
|
94
|
+
endpoint: NOTIFICATIONS,
|
|
95
|
+
});
|
|
96
|
+
try {
|
|
97
|
+
const source = new EventSourcePolyfill(`${baseUrl}/notifications/events`, {
|
|
98
|
+
headers: {
|
|
99
|
+
authorization: `Bearer ${options.userToken}`,
|
|
100
|
+
},
|
|
101
|
+
heartbeatTimeout: 1000 * 60 * 60,
|
|
102
|
+
});
|
|
103
|
+
source.onmessage = (event) => {
|
|
104
|
+
try {
|
|
105
|
+
const notification = JSON.parse(event.data);
|
|
106
|
+
if (!notification.keepAlive) {
|
|
107
|
+
handler(notification);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (options.enableLogs)
|
|
112
|
+
console.error(`Failed to handle SSE event`, { error });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
116
|
+
source.onerror = (_event) => {
|
|
117
|
+
// ignore
|
|
118
|
+
};
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
120
|
+
}
|
|
121
|
+
catch (_error) {
|
|
122
|
+
// ignore
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// updates <allNotifications> with <newNotification>
|
|
126
|
+
// if <newNotification> is read or new, it will be added to <allNotifications>
|
|
127
|
+
// if <newNotification> is dismissed, it will be removed from <allNotifications>
|
|
128
|
+
static updateNotifications(allNotifications, newNotification) {
|
|
129
|
+
const updatedNotifications = allNotifications
|
|
130
|
+
.slice()
|
|
131
|
+
.filter((currentNotification) => currentNotification.uuid !== newNotification.uuid);
|
|
132
|
+
if (newNotification.state === 'read' || newNotification.state === 'new') {
|
|
133
|
+
updatedNotifications.push(newNotification);
|
|
134
|
+
}
|
|
135
|
+
updatedNotifications.sort((a, b) => b.timestamp - a.timestamp);
|
|
136
|
+
return updatedNotifications;
|
|
137
|
+
}
|
|
138
|
+
static updateNotificationState(allNotifications, notificationId, newState) {
|
|
139
|
+
let updatedNotifications = allNotifications.slice();
|
|
140
|
+
let foundNotification;
|
|
141
|
+
switch (newState) {
|
|
142
|
+
case 'dismiss':
|
|
143
|
+
updatedNotifications = updatedNotifications.filter((notification) => notification.uuid !== notificationId);
|
|
144
|
+
break;
|
|
145
|
+
case 'read':
|
|
146
|
+
foundNotification = updatedNotifications.find((currentNotification) => currentNotification.uuid === notificationId);
|
|
147
|
+
if (foundNotification) {
|
|
148
|
+
foundNotification.state = newState;
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
return updatedNotifications;
|
|
153
|
+
}
|
|
154
|
+
static updateNotificationStates(allNotifications, notificationIds, newState) {
|
|
155
|
+
let updatedNotifications = allNotifications.slice();
|
|
156
|
+
let foundNotifications = [];
|
|
157
|
+
switch (newState) {
|
|
158
|
+
case 'dismiss':
|
|
159
|
+
updatedNotifications = updatedNotifications.filter((notification) => !notificationIds.includes(notification.uuid));
|
|
160
|
+
break;
|
|
161
|
+
case 'read':
|
|
162
|
+
foundNotifications = updatedNotifications.filter((notification) => notificationIds.includes(notification.uuid));
|
|
163
|
+
foundNotifications.forEach((foundNotification) => {
|
|
164
|
+
foundNotification.state = newState;
|
|
165
|
+
});
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
return updatedNotifications;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type RequestResponse } from './api';
|
|
2
|
+
export type StartingPrice = {
|
|
3
|
+
amount: number;
|
|
4
|
+
currency: string;
|
|
5
|
+
interval: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const getStartingPrice: ({ token, audience, }: {
|
|
8
|
+
token: string;
|
|
9
|
+
audience: string;
|
|
10
|
+
}) => Promise<RequestResponse<StartingPrice>>;
|
|
11
|
+
export declare const leaveOrganization: ({ token, audience, orgId, }: {
|
|
12
|
+
token: string;
|
|
13
|
+
audience: string;
|
|
14
|
+
orgId: string;
|
|
15
|
+
}) => Promise<RequestResponse>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
import { request } from './api.js';
|
|
7
|
+
export const getStartingPrice = async ({ token, audience, }) => request({
|
|
8
|
+
url: `https://accounts.${audience}/external/organizations/startingPrice`,
|
|
9
|
+
camundaAuth: { token },
|
|
10
|
+
responseType: 'json',
|
|
11
|
+
});
|
|
12
|
+
export const leaveOrganization = async ({ token, audience, orgId, }) => request({
|
|
13
|
+
url: `https://accounts.${audience}/external/organizations/${orgId}/membership`,
|
|
14
|
+
camundaAuth: { token },
|
|
15
|
+
method: 'delete',
|
|
16
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { C3NotificationsProps } from '../components/c3-navigation/c3-navigation.types';
|
|
2
|
+
import type { Theme } from '../components/c3-user-configuration/c3-profile-provider/c3-profile-provider';
|
|
3
|
+
import type { Cluster, Organization } from '../utils/camunda.types';
|
|
4
|
+
import { type RequestResponse } from './api';
|
|
5
|
+
export type Profile = {
|
|
6
|
+
theme: Theme;
|
|
7
|
+
};
|
|
8
|
+
export type Token = {
|
|
9
|
+
sub?: string;
|
|
10
|
+
'https://camunda.com/settings'?: {
|
|
11
|
+
theme?: Theme;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const getUserTheme: (userToken: string) => Theme | null;
|
|
15
|
+
export type UpdateThemeOptions = C3NotificationsProps & {
|
|
16
|
+
theme: Profile['theme'];
|
|
17
|
+
};
|
|
18
|
+
export declare const updateTheme: ({ endpoints, stage, userToken, getNewUserToken, theme, }: UpdateThemeOptions) => Promise<void>;
|
|
19
|
+
export declare const getOrgs: (stage: string, accessToken: string) => Promise<RequestResponse<Organization[] | null>>;
|
|
20
|
+
export declare const getClusters: (stage: string, accessToken: string, orgId: string) => Promise<RequestResponse<Cluster[] | null>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
import { jwtDecode } from 'jwt-decode';
|
|
7
|
+
import { request } from './api.js';
|
|
8
|
+
const decodeJWT = (userToken) => {
|
|
9
|
+
let decodedToken = {};
|
|
10
|
+
try {
|
|
11
|
+
decodedToken = jwtDecode(userToken);
|
|
12
|
+
}
|
|
13
|
+
catch (_) {
|
|
14
|
+
// do nothing
|
|
15
|
+
}
|
|
16
|
+
return decodedToken;
|
|
17
|
+
};
|
|
18
|
+
export const getUserTheme = (userToken) => {
|
|
19
|
+
return userToken
|
|
20
|
+
? decodeJWT(userToken)['https://camunda.com/settings']?.theme || null
|
|
21
|
+
: null;
|
|
22
|
+
};
|
|
23
|
+
export const updateTheme = async ({ endpoints, stage, userToken, getNewUserToken, theme, }) => {
|
|
24
|
+
await request({
|
|
25
|
+
method: 'patch',
|
|
26
|
+
base: 'accounts',
|
|
27
|
+
stage,
|
|
28
|
+
endpoints,
|
|
29
|
+
camundaAuth: { token: userToken, refreshTokenMethod: getNewUserToken },
|
|
30
|
+
url: `external/user/theme`,
|
|
31
|
+
body: { theme },
|
|
32
|
+
responseType: 'text',
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export const getOrgs = async (stage, accessToken) => {
|
|
36
|
+
return await request({
|
|
37
|
+
url: `https://accounts.${stage}/external/organizations/my`,
|
|
38
|
+
camundaAuth: { token: accessToken },
|
|
39
|
+
type: 'json',
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export const getClusters = async (stage, accessToken, orgId) => {
|
|
43
|
+
return await request({
|
|
44
|
+
url: `https://console.${stage}/external/organizations/${orgId}/clusters`,
|
|
45
|
+
camundaAuth: { token: accessToken },
|
|
46
|
+
type: 'json',
|
|
47
|
+
});
|
|
48
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
import { request } from './api.js';
|
|
7
|
+
import { getEndpoint, STATUS } from './endpoints.const.js';
|
|
8
|
+
export class StatusService {
|
|
9
|
+
static async camundaStatus(decodedAudience) {
|
|
10
|
+
try {
|
|
11
|
+
let stage = 'dev';
|
|
12
|
+
switch (decodedAudience) {
|
|
13
|
+
case 'cloud.dev.ultrawombat.com':
|
|
14
|
+
stage = 'dev';
|
|
15
|
+
break;
|
|
16
|
+
case 'cloud.ultrawombat.com':
|
|
17
|
+
stage = 'int';
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
stage = 'prod';
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
const endpoint = getEndpoint(stage, STATUS);
|
|
24
|
+
const resp = await request({
|
|
25
|
+
url: `${endpoint}/api/v2/status.json`,
|
|
26
|
+
method: 'get',
|
|
27
|
+
type: 'json',
|
|
28
|
+
responseType: 'json',
|
|
29
|
+
});
|
|
30
|
+
const result = resp.result;
|
|
31
|
+
if (!resp.success ||
|
|
32
|
+
!result?.status.indicator ||
|
|
33
|
+
!result?.status.description) {
|
|
34
|
+
return { error: false, description: '', endpoint };
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
error: result?.status.indicator === 'major',
|
|
38
|
+
description: result?.status.description ?? '',
|
|
39
|
+
endpoint,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (_error) {
|
|
43
|
+
return { error: false, description: '', endpoint: STATUS.dev };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { C3IconProps } from './c3-icons.types';
|
|
2
|
+
export declare const C3AppMenuIcon: ({ size }: C3IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const C3NotificationsUnreadIcon: ({ size }: C3IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const C3BellIcon: ({ size }: C3IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const CamundaLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
export const C3AppMenuIcon = ({ size }) => (_jsx(_Fragment, { children: _jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, fill: 'transparent', xmlns: 'http://www.w3.org/2000/svg', children: [_jsx("path", { fill: 'transparent', style: { mixBlendMode: 'multiply' }, d: 'M0 0h20v20H0z' }), _jsx("path", { d: 'M11.5 1h-3v3h3V1ZM4 1H1v3h3V1Zm15 0h-3v3h3V1Zm-7.5 7.5h-3v3h3v-3ZM4 8.5H1v3h3v-3Zm15 0h-3v3h3v-3ZM11.5 16h-3v3h3v-3ZM4 16H1v3h3v-3Zm15 0h-3v3h3v-3Z' })] }) }));
|
|
3
|
+
export const C3NotificationsUnreadIcon = ({ size }) => (_jsx(_Fragment, { children: _jsxs("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: [_jsx("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: 'M10.625.857V.625h-1.25v1.282A6.258 6.258 0 0 0 3.75 8.125v2.241l-1.692 1.692a.625.625 0 0 0-.183.442v1.875A.625.625 0 0 0 2.5 15h4.375v.486a3.22 3.22 0 0 0 2.813 3.249 3.129 3.129 0 0 0 3.437-3.11V15H17.5a.624.624 0 0 0 .625-.625V12.5a.625.625 0 0 0-.183-.442l-.939-.939a6.174 6.174 0 0 1-1.46.308l1.332 1.332v.991H3.125v-.991l1.692-1.692A.625.625 0 0 0 5 10.625v-2.5a5 5 0 0 1 4.148-4.927A6.202 6.202 0 0 1 10.625.857Zm5.625 9.235V8.125a6.258 6.258 0 0 0-5.044-6.131 5.003 5.003 0 0 0-.743 1.152A5 5 0 0 1 15 8.125v2.125c.432 0 .85-.055 1.25-.158Zm-4.924 6.859c.351-.352.549-.829.549-1.326V15h-3.75v.625a1.875 1.875 0 0 0 3.2 1.326Z', fill: '$icon-primary' }), _jsx("path", { d: 'M15 10.25a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z', style: { fill: 'var(--cds-link-primary)' } })] }) }));
|
|
4
|
+
export const C3BellIcon = ({ size }) => (_jsx(_Fragment, { children: _jsx("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, fill: 'transparent', xmlns: 'http://www.w3.org/2000/svg', children: _jsx("path", { d: 'M50.2373 33.7627L45.5 29.0253V22.75C45.4944 18.4134 43.881 14.2329 40.9718 11.0169C38.0626 7.80093 34.0643 5.77786 29.75 5.3389V1.75H26.25V5.3389C21.9357 5.77786 17.9374 7.80093 15.0282 11.0169C12.119 14.2329 10.5056 18.4134 10.5 22.75V29.0253L5.76275 33.7627C5.60018 33.9252 5.47122 34.118 5.38324 34.3303C5.29526 34.5426 5.24998 34.7702 5.25 35V40.25C5.25 40.7141 5.43437 41.1592 5.76256 41.4874C6.09075 41.8156 6.53587 42 7 42H19.25V43.75C19.25 46.0706 20.1719 48.2962 21.8128 49.9372C23.4538 51.5781 25.6794 52.5 28 52.5C30.3206 52.5 32.5462 51.5781 34.1872 49.9372C35.8281 48.2962 36.75 46.0706 36.75 43.75V42H49C49.4641 42 49.9092 41.8156 50.2374 41.4874C50.5656 41.1592 50.75 40.7141 50.75 40.25V35C50.75 34.7702 50.7047 34.5426 50.6168 34.3303C50.5288 34.118 50.3998 33.9252 50.2373 33.7627ZM33.25 43.75C33.25 45.1424 32.6969 46.4777 31.7123 47.4623C30.7277 48.4469 29.3924 49 28 49C26.6076 49 25.2723 48.4469 24.2877 47.4623C23.3031 46.4777 22.75 45.1424 22.75 43.75V42H33.25V43.75Z', fill: '#FF8201' }) }) }));
|
|
5
|
+
export const CamundaLogo = () => (_jsx(_Fragment, { children: _jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', children: [_jsx("title", { children: "Camunda logo" }), _jsx("rect", { width: '24', height: '24', rx: '3', style: { fill: 'var(--cds-icon-primary)' } }), _jsx("path", { d: 'M11.986 15.585c1.824 0 2.762-1.075 2.776-2.967v-1.564h-1.755v1.687c0 .844-.368 1.143-.966 1.143-.585 0-.966-.3-.966-1.143V6.364c0-.843.367-1.17.966-1.156.585 0 .966.326.966 1.17v1.261h1.755V6.496c0-1.891-.94-2.965-2.762-2.965-1.823 0-2.764 1.074-2.776 2.965v6.136c0 1.864.943 2.953 2.762 2.953Z', style: { fill: 'var(--cds-text-inverse)' } }), _jsx("path", { d: 'M14.762 17.312H9.224v3.13h5.538v-3.13Z', fill: '#FC5D0D' })] }) }));
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
export const appTeaserCardsConfig = {
|
|
7
|
+
operate: [
|
|
8
|
+
{
|
|
9
|
+
title: 'Monitor processes',
|
|
10
|
+
description: 'Monitor the operational health of historic and current processes in a single place.',
|
|
11
|
+
id: 'operate-preview--monitor-process',
|
|
12
|
+
img: {
|
|
13
|
+
altText: 'Operate app dashboard screenshot showing running process instances overview',
|
|
14
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/operate-1-monitor.png',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'Drill down and inspect process instances',
|
|
19
|
+
description: 'Uncover process incidents or use visual cues paired with process models to find where instances are stuck.',
|
|
20
|
+
id: 'operate-preview-inspect-process',
|
|
21
|
+
img: {
|
|
22
|
+
altText: 'Operate app screenshot showing process instance details',
|
|
23
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/operate-2-inspect.png',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
title: 'Troubleshoot issues in near-real-time',
|
|
28
|
+
description: 'Before retrying instances and without losing any in-flight or historical data.',
|
|
29
|
+
id: 'operate-preview-troubleshoot',
|
|
30
|
+
img: {
|
|
31
|
+
altText: 'Operate app screenshot showing process instance with incidents',
|
|
32
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/operate-3-troubleshoot.png',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
tasklist: [
|
|
37
|
+
{
|
|
38
|
+
title: 'User-friendly task manager',
|
|
39
|
+
description: 'Manage and run human tasks for full end-to-end orchestration with an user-friendly interface',
|
|
40
|
+
id: 'tasklist-preview-task-manager',
|
|
41
|
+
img: {
|
|
42
|
+
altText: 'Tasklist app screenshot showing task overview',
|
|
43
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/tasklist-1-task-manager.png',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: 'Create forms with just a few clicks',
|
|
48
|
+
description: 'Connect your teams by orchestrating human tasks and create forms with just a few clicks to help with it',
|
|
49
|
+
id: 'tasklist-preview-forms',
|
|
50
|
+
img: {
|
|
51
|
+
altText: 'Modeler app screenshot showing form builder',
|
|
52
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/tasklist-2-form.png',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: 'Use APIs to extend it',
|
|
57
|
+
description: 'Extend the manual workflows and tasklist by using with the Tasklist API',
|
|
58
|
+
id: 'tasklist-preview-api',
|
|
59
|
+
img: {
|
|
60
|
+
altText: 'Camunda docs screenshot showing Tasklist API documentation',
|
|
61
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/tasklist-3-api.png',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
optimize: [
|
|
66
|
+
{
|
|
67
|
+
title: 'Monitor KPIs and get notified',
|
|
68
|
+
description: 'Monitor Process KPIs and get notified proactively about deviations',
|
|
69
|
+
id: 'optimize-preview-kpis',
|
|
70
|
+
img: {
|
|
71
|
+
altText: 'Optimize app screenshot showing KPI monitoring dashboard',
|
|
72
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/optimize-1-kpis.png',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'Find opportunities to improve',
|
|
77
|
+
description: 'Use analyses to find process improvements based on historic process executions',
|
|
78
|
+
id: 'optimize-preview-opportunities',
|
|
79
|
+
img: {
|
|
80
|
+
altText: 'Optimize app screenshot showing process branch analysis',
|
|
81
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/optimize-2-opportunities.png',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
title: 'Share reports and dashboards',
|
|
86
|
+
description: 'Share process intelligence reports & dashboards with every stakeholder',
|
|
87
|
+
id: 'optimize-preview-reports',
|
|
88
|
+
img: {
|
|
89
|
+
altText: 'Optimize app screenshot showing process report heatmap',
|
|
90
|
+
path: 'https://static-assets.camunda.io/c3/app-teaser-images/optimize-3-reports.png',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import { type AppTeaserCardProps } from './app-teaster-card';
|
|
3
|
+
type AppTeaserCardsProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle: JSX.Element;
|
|
6
|
+
cards: AppTeaserCardProps[];
|
|
7
|
+
cta: {
|
|
8
|
+
text: string;
|
|
9
|
+
action: () => void;
|
|
10
|
+
renderIcon?: unknown;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
disabledMessage?: string;
|
|
13
|
+
};
|
|
14
|
+
subtext: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const AppTeaserCards: ({ title, subtitle, cards, cta, subtext, }: AppTeaserCardsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
5
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
6
|
+
* You may not use this file except in compliance with the commercial license.
|
|
7
|
+
*/
|
|
8
|
+
import { Button, InlineNotification, Stack } from '@carbon/react';
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
import { body02 } from '../styles.js';
|
|
11
|
+
import { AppTeaserCard } from './app-teaster-card.js';
|
|
12
|
+
const Subtitle = styled.div `
|
|
13
|
+
p {
|
|
14
|
+
${body02};
|
|
15
|
+
text-align: center;
|
|
16
|
+
white-space: pre-line;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
export const AppTeaserCards = ({ title, subtitle, cards, cta, subtext, }) => {
|
|
20
|
+
const innerColumns = new Array(cards.length).fill('428px');
|
|
21
|
+
const gridTemplateColumns = `1fr ${innerColumns.join(' ')} 1fr`;
|
|
22
|
+
const gridGap = '10px';
|
|
23
|
+
return (_jsxs(Stack, { gap: 8, children: [_jsxs(Stack, { gap: 4, children: [_jsx("h1", { style: { textAlign: 'center' }, children: title }), _jsx(Subtitle, { children: _jsx("p", { children: subtitle }) })] }), _jsxs(Stack, { gap: 5, children: [_jsx("div", { style: {
|
|
24
|
+
display: 'grid',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
}, children: cta.disabled && cta.disabledMessage ? (_jsx(InlineNotification, { kind: 'info', title: cta.disabledMessage, hideCloseButton: true })) : (_jsx(Button, { id: 'teasercards-button', onClick: cta.action, renderIcon: cta.renderIcon, isExpressive: true, children: cta.text })) }), !cta.disabled && subtext && (_jsx("div", { style: {
|
|
27
|
+
display: 'grid',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
fontSize: '14px',
|
|
30
|
+
}, children: subtext }))] }), _jsx(Stack, { gap: 6, orientation: 'vertical', children: _jsx(Stack, { gap: 6, children: _jsx("div", { style: { display: 'grid', gridTemplateColumns, gap: gridGap }, children: cards.map((card, index) => (_createElement(AppTeaserCard, { ...card, key: 'teasercardz' + index, grid: { column: index + 2 } }))) }) }) })] }));
|
|
31
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
export type AppTeaserCardProps = {
|
|
3
|
+
grid?: {
|
|
4
|
+
column?: number | string;
|
|
5
|
+
};
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
img: {
|
|
9
|
+
path: string;
|
|
10
|
+
altText: string;
|
|
11
|
+
};
|
|
12
|
+
description: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const AppTeaserCard: (props: AppTeaserCardProps) => JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { Tile } from '@carbon/react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
const Description = styled.p `
|
|
10
|
+
font-size: 15px !important;
|
|
11
|
+
`;
|
|
12
|
+
export const AppTeaserCard = (props) => {
|
|
13
|
+
const gap = 1;
|
|
14
|
+
return (_jsx(Tile, { style: {
|
|
15
|
+
gridColumn: props.grid?.column ?? 1,
|
|
16
|
+
padding: '16px',
|
|
17
|
+
height: '100%',
|
|
18
|
+
}, children: _jsxs("div", { style: {
|
|
19
|
+
display: 'grid',
|
|
20
|
+
gap: `${gap}rem`,
|
|
21
|
+
gridTemplateRows: `auto auto 1fr`,
|
|
22
|
+
height: '100%',
|
|
23
|
+
}, children: [_jsx("h2", { children: props.title }), _jsx(Description, { children: props.description }), _jsx("img", { src: props.img.path, alt: props.img.altText, style: { alignSelf: 'end', width: '100%' } })] }) }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import { type C3AppTeaserProps } from './c3-app-teaser';
|
|
3
|
+
export type C3AppTeaserPageProps = {
|
|
4
|
+
appName: C3AppTeaserProps['appName'];
|
|
5
|
+
redirectToClusters?: () => void;
|
|
6
|
+
redirectToCheckout?: () => void;
|
|
7
|
+
redirectToCreateCluster?: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const C3AppTeaserPage: FC<C3AppTeaserPageProps>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
5
|
+
* You may not use this file except in compliance with the commercial license.
|
|
6
|
+
*/
|
|
7
|
+
import { Loading } from '@carbon/react';
|
|
8
|
+
import { canCreateCluster, canUpgradePlan, isTrialExpired, } from '../../utils/camunda.js';
|
|
9
|
+
import { useC3Profile } from '../c3-user-configuration/c3-profile-provider/c3-profile-provider.js';
|
|
10
|
+
import { useC3UserConfiguration } from '../c3-user-configuration/c3-user-configuration-provider.js';
|
|
11
|
+
import { C3AppTeaser } from './c3-app-teaser.js';
|
|
12
|
+
export const C3AppTeaserPage = ({ appName, redirectToClusters, redirectToCreateCluster, redirectToCheckout, }) => {
|
|
13
|
+
const { activeOrganizationId, domain, analyticsTrack } = useC3UserConfiguration();
|
|
14
|
+
const { activeOrg, clusters } = useC3Profile();
|
|
15
|
+
const hasTrialExpired = (activeOrg && isTrialExpired(activeOrg)) ?? false;
|
|
16
|
+
const sleepingCluster = clusters && clusters.find((c) => c.status[appName] === 'Suspended');
|
|
17
|
+
const hasSleepingCluster = (clusters && appName && !!sleepingCluster) ?? false;
|
|
18
|
+
const onClickCta = () => {
|
|
19
|
+
if (hasTrialExpired) {
|
|
20
|
+
analyticsTrack?.('checkout:open', { appTeaser: appName });
|
|
21
|
+
if (redirectToCheckout) {
|
|
22
|
+
redirectToCheckout();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
window.location.href = `https://console.${domain}/org/${activeOrganizationId}/checkout`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else if (hasSleepingCluster) {
|
|
29
|
+
analyticsTrack?.('clusters:manage:open', { appTeaser: appName });
|
|
30
|
+
if (redirectToClusters) {
|
|
31
|
+
redirectToClusters();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
window.location.href = `https://console.${domain}/org/${activeOrganizationId}/clusters`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
analyticsTrack?.('clusters:create:open', { appTeaser: appName });
|
|
39
|
+
if (redirectToCreateCluster) {
|
|
40
|
+
redirectToCreateCluster();
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
window.location.href = `https://console.${domain}/org/${activeOrganizationId}/clusters/create`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return activeOrg && appName ? (_jsx(C3AppTeaser, { appName: appName, canCreateCluster: canCreateCluster(activeOrg), canUpgradePlan: canUpgradePlan(activeOrg), hasTrialExpired: hasTrialExpired, hasSleepingCluster: hasSleepingCluster, onClickCta: onClickCta, pricing: null })) : (_jsx(Loading, { withOverlay: true }));
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
3
|
+
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
4
|
+
* You may not use this file except in compliance with the commercial license.
|
|
5
|
+
*/
|
|
6
|
+
import { expect, test } from '@playwright/test';
|
|
7
|
+
import { getStory } from '../test-utils.js';
|
|
8
|
+
test.describe('App teaser page', () => {
|
|
9
|
+
test('Paid plan', async ({ page }) => {
|
|
10
|
+
await getStory(page, 'components-c3appteaser--operate');
|
|
11
|
+
await expect(page).toHaveScreenshot();
|
|
12
|
+
});
|
|
13
|
+
test('Trial expired', async ({ page }) => {
|
|
14
|
+
await getStory(page, 'components-c3appteaser--trial-expired');
|
|
15
|
+
await expect(page).toHaveScreenshot();
|
|
16
|
+
});
|
|
17
|
+
test('Sleeping cluster', async ({ page }) => {
|
|
18
|
+
await getStory(page, 'components-c3appteaser--sleeping-cluster');
|
|
19
|
+
await expect(page).toHaveScreenshot();
|
|
20
|
+
});
|
|
21
|
+
test('Cannot create cluster', async ({ page }) => {
|
|
22
|
+
await getStory(page, 'components-c3appteaser--cannot-create-cluster');
|
|
23
|
+
await expect(page).toHaveScreenshot();
|
|
24
|
+
});
|
|
25
|
+
test('Cannot upgrade plan', async ({ page }) => {
|
|
26
|
+
await getStory(page, 'components-c3appteaser--cannot-upgrade-plan');
|
|
27
|
+
await expect(page).toHaveScreenshot();
|
|
28
|
+
});
|
|
29
|
+
test('Cannot resume cluster', async ({ page }) => {
|
|
30
|
+
await getStory(page, 'components-c3appteaser--cannot-resume-cluster');
|
|
31
|
+
await expect(page).toHaveScreenshot();
|
|
32
|
+
});
|
|
33
|
+
});
|