@camunda/ccma-saas-frontend 0.27.8 → 0.28.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.
@@ -0,0 +1,20 @@
1
+ import { type JSX } from 'react';
2
+ export interface C4ActivityRetentionConfirmModalProps {
3
+ open: boolean;
4
+ loading: boolean;
5
+ title: string;
6
+ /** The change that the user is about to save. `*text*` is bold. */
7
+ intro: string;
8
+ /** What the new period does. `*text*` is bold. */
9
+ summary: string;
10
+ /** Headed lists, shown in order. `*text*` is bold in an item. */
11
+ sections: {
12
+ heading: string;
13
+ items: string[];
14
+ }[];
15
+ cancelLabel: string;
16
+ confirmLabel: string;
17
+ onCancel: () => void;
18
+ onConfirm: () => void;
19
+ }
20
+ export declare const C4ActivityRetentionConfirmModal: ({ open, loading, title, intro, summary, sections, cancelLabel, confirmLabel, onCancel, onConfirm, }: C4ActivityRetentionConfirmModalProps) => JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, 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 { Fragment } from 'react';
8
+ import { Modal } from '../../ui/index.js';
9
+ /** Turns each `*text*` into bold text. The rest stays plain. */
10
+ const withEmphasis = (text) => (_jsx(_Fragment, { children: text.split('*').map((part, index) =>
11
+ // The odd parts are between two stars.
12
+ index % 2 === 1 ? (
13
+ // biome-ignore lint/suspicious/noArrayIndexKey: the parts never change order
14
+ _jsx("strong", { children: part }, index)) : (
15
+ // biome-ignore lint/suspicious/noArrayIndexKey: the parts never change order
16
+ _jsx(Fragment, { children: part }, index))) }));
17
+ export const C4ActivityRetentionConfirmModal = ({ open, loading, title, intro, summary, sections, cancelLabel, confirmLabel, onCancel, onConfirm, }) => (_jsxs(Modal, { modalHeading: title, open: open, onRequestClose: () => {
18
+ // The save cannot stop once it starts, so the dialog stays open.
19
+ if (!loading)
20
+ onCancel();
21
+ }, onRequestSubmit: onConfirm, primaryButtonText: confirmLabel, primaryButtonDisabled: loading, secondaryButtonText: cancelLabel, size: 'sm', danger: true, id: 'activity-retention-confirm-modal', preventCloseOnClickOutside: true, children: [_jsx("p", { children: withEmphasis(intro) }), _jsx("p", { style: { marginTop: '8px' }, children: withEmphasis(summary) }), sections.map((section) => (_jsxs("section", { style: { marginTop: '16px' }, children: [_jsx("h4", { style: { fontWeight: 600 }, children: section.heading }), _jsx("ul", { style: { marginTop: '4px', paddingLeft: '20px', listStyle: 'disc' }, children: section.items.map((item) => (_jsx("li", { children: withEmphasis(item) }, item))) })] }, section.heading)))] }));
@@ -4,4 +4,4 @@ import type { C4ManagementActivityProps } from './c4-management-activity.types.j
4
4
  * A single, searchable, paginated data table with Name / Timestamp / Audit
5
5
  * columns. Any column can sort it. The default order is newest first.
6
6
  */
7
- export declare const C4ManagementActivity: ({ activities, loading, downloading, onExportJSON, onExportCSV, exportLabel, exportingLabel, exportJSONLabel, exportCSVLabel, searchLabel, nameColumnLabel, timestampColumnLabel, auditColumnLabel, }: C4ManagementActivityProps) => JSX.Element;
7
+ export declare const C4ManagementActivity: ({ activities, loading, downloading, onExportJSON, onExportCSV, exportLabel, exportingLabel, exportJSONLabel, exportCSVLabel, searchLabel, nameColumnLabel, timestampColumnLabel, auditColumnLabel, retentionNote, retentionSettingsLabel, retentionSettingsHref, onOpenRetentionSettings, }: C4ManagementActivityProps) => JSX.Element;
@@ -1,5 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
+ import { Link, Stack } from '../../ui/index.js';
3
4
  import { C4DataTable } from '../c4-data-table/c4-data-table.js';
4
5
  /**
5
6
  * Ascending timestamp comparator with `originalIndex` as a stable tie-breaker,
@@ -20,7 +21,7 @@ const compareByTimestamp = (a, b) => {
20
21
  * A single, searchable, paginated data table with Name / Timestamp / Audit
21
22
  * columns. Any column can sort it. The default order is newest first.
22
23
  */
23
- export const C4ManagementActivity = ({ activities, loading, downloading, onExportJSON, onExportCSV, exportLabel, exportingLabel, exportJSONLabel, exportCSVLabel, searchLabel = 'Search activity', nameColumnLabel = 'Name', timestampColumnLabel = 'Timestamp', auditColumnLabel = 'Audit', }) => {
24
+ export const C4ManagementActivity = ({ activities, loading, downloading, onExportJSON, onExportCSV, exportLabel, exportingLabel, exportJSONLabel, exportCSVLabel, searchLabel = 'Search activity', nameColumnLabel = 'Name', timestampColumnLabel = 'Timestamp', auditColumnLabel = 'Audit', retentionNote, retentionSettingsLabel, retentionSettingsHref, onOpenRetentionSettings, }) => {
24
25
  // Memoized so the mapped+sorted array keeps a stable identity across parent
25
26
  // re-renders; a fresh array would reset the data table's page (TanStack
26
27
  // `autoResetPageIndex`) and re-run the O(n log n) sort every render.
@@ -84,5 +85,17 @@ export const C4ManagementActivity = ({ activities, loading, downloading, onExpor
84
85
  ],
85
86
  },
86
87
  ];
87
- return (_jsx(C4DataTable, { data: rows, isLoading: loading, headers: headers, toolbar: toolbar, options: { pageSize: 20, pageSizes: [10, 20, 50, 100] }, queryPrefix: 'management-activity' }));
88
+ return (_jsxs(Stack, { gap: 5, children: [retentionNote ? (_jsxs("p", { children: [retentionNote, retentionSettingsHref && retentionSettingsLabel ? (_jsxs(_Fragment, { children: [' ', _jsx(Link, { href: retentionSettingsHref, onClick: (event) => {
89
+ // A modified click opens the href in a new tab or window.
90
+ if (!onOpenRetentionSettings ||
91
+ event.metaKey ||
92
+ event.ctrlKey ||
93
+ event.shiftKey ||
94
+ event.altKey ||
95
+ event.button !== 0) {
96
+ return;
97
+ }
98
+ event.preventDefault();
99
+ onOpenRetentionSettings();
100
+ }, children: retentionSettingsLabel })] })) : null] })) : undefined, _jsx(C4DataTable, { data: rows, isLoading: loading, headers: headers, toolbar: toolbar, options: { pageSize: 20, pageSizes: [10, 20, 50, 100] }, queryPrefix: 'management-activity' })] }));
88
101
  };
@@ -25,4 +25,15 @@ export interface C4ManagementActivityProps {
25
25
  nameColumnLabel?: string;
26
26
  timestampColumnLabel?: string;
27
27
  auditColumnLabel?: string;
28
+ /** Tells how long entries are kept. Shown above the table when set. */
29
+ retentionNote?: string;
30
+ /** The label of the link to the retention setting. */
31
+ retentionSettingsLabel?: string;
32
+ /**
33
+ * The URL of the Settings tab, from the host. The link shows only when it is
34
+ * set, so that a copy or a new tab opens Settings.
35
+ */
36
+ retentionSettingsHref?: string;
37
+ /** Called on a plain click of the link, for the navigation in the app. */
38
+ onOpenRetentionSettings?: () => void;
28
39
  }
@@ -1,3 +1,3 @@
1
1
  import { type JSX } from 'react';
2
2
  import type { C4ManagementSettingsProps } from './c4-management-settings.types.js';
3
- export declare const C4ManagementSettings: ({ orgId: _orgId, organizationName: _organizationName, hasAcceptedBetaTerms, suppressDropDisks, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onToggleEarlyAccessFeature, onOptInToBeta, onOpenFeatureOptIn, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }: C4ManagementSettingsProps) => JSX.Element;
3
+ export declare const C4ManagementSettings: ({ orgId, organizationName: _organizationName, hasAcceptedBetaTerms, suppressDropDisks, activityRetentionMonths, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onChangeActivityRetention, onToggleEarlyAccessFeature, onOptInToBeta, onOpenFeatureOptIn, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }: C4ManagementSettingsProps) => JSX.Element;
@@ -1,16 +1,38 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ACTIVITY_RETENTION_CHOICES, ACTIVITY_RETENTION_NOT_SET, activityRetentionCutoff, isActivityRetentionMonths, } from '@camunda/ccma-shared-types';
2
3
  import { LogOut, RefreshCw, Trash2 } from 'lucide-react';
3
- import { useMemo } from 'react';
4
+ import { useEffect, useMemo, useRef, useState, } from 'react';
4
5
  import { C4_ASSET_URLS } from '../../assetUrls.js';
5
6
  import { Button, DsCard, Link, Stack } from '../../ui/index.js';
7
+ import { Select, SelectItem } from '../../ui/families.js';
6
8
  import { SECTION_HEADING_STYLE } from '../../utils/section-heading-style.js';
7
9
  import { C4ActionableNotification } from '../c4-actionable-notification/c4-actionable-notification.js';
10
+ import { C4ActivityRetentionConfirmModal } from '../c4-activity-retention-confirm-modal/c4-activity-retention-confirm-modal.js';
8
11
  import { C4DataTable } from '../c4-data-table/c4-data-table.js';
9
12
  import { C4EmptyState } from '../c4-empty-state/c4-empty-state.js';
10
13
  import { C4ExternalLink } from '../c4-external-link/c4-external-link.js';
14
+ import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
11
15
  import { C4StructuredListSkeleton } from '../c4-structured-list/c4-structured-list.js';
12
16
  import { C4Toggle } from '../c4-toggle/c4-toggle.js';
13
- export const C4ManagementSettings = ({ orgId: _orgId, organizationName: _organizationName, hasAcceptedBetaTerms, suppressDropDisks, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onToggleEarlyAccessFeature, onOptInToBeta, onOpenFeatureOptIn, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }) => {
17
+ export const C4ManagementSettings = ({ orgId, organizationName: _organizationName, hasAcceptedBetaTerms, suppressDropDisks, activityRetentionMonths, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onChangeActivityRetention, onToggleEarlyAccessFeature, onOptInToBeta, onOpenFeatureOptIn, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }) => {
18
+ const [selectedRetention, setSelectedRetention] = useState(undefined);
19
+ const [retentionSaveFailed, setRetentionSaveFailed] = useState(false);
20
+ const [confirmOpen, setConfirmOpen] = useState(false);
21
+ const [savingRetention, setSavingRetention] = useState(false);
22
+ // The host can switch the org and keep this component mounted. The draft of
23
+ // one org must not show, or save, for the next org.
24
+ const [retentionOrgId, setRetentionOrgId] = useState(orgId);
25
+ if (retentionOrgId !== orgId) {
26
+ setRetentionOrgId(orgId);
27
+ setSelectedRetention(undefined);
28
+ setRetentionSaveFailed(false);
29
+ setConfirmOpen(false);
30
+ setSavingRetention(false);
31
+ }
32
+ const orgIdRef = useRef(orgId);
33
+ useEffect(() => {
34
+ orgIdRef.current = orgId;
35
+ }, [orgId]);
14
36
  const canBeToggled = (feature) => {
15
37
  return !feature.requiresClickwrap || feature.hasAcceptedFeatureTerms;
16
38
  };
@@ -87,6 +109,18 @@ export const C4ManagementSettings = ({ orgId: _orgId, organizationName: _organiz
87
109
  ...feature,
88
110
  originalIndex: index,
89
111
  })), [earlyAccessFeatures]);
112
+ const currentRetention = isActivityRetentionMonths(activityRetentionMonths)
113
+ ? activityRetentionMonths
114
+ : undefined;
115
+ const newRetention = selectedRetention ?? currentRetention;
116
+ // The stored value caught up with the selection (a push failed after the
117
+ // DB write, or another owner saved). The draft and its error are stale.
118
+ useEffect(() => {
119
+ if (retentionSaveFailed && selectedRetention === currentRetention) {
120
+ setRetentionSaveFailed(false);
121
+ setSelectedRetention(undefined);
122
+ }
123
+ }, [retentionSaveFailed, selectedRetention, currentRetention]);
90
124
  if (loading) {
91
125
  return _jsx(C4StructuredListSkeleton, { rowCount: 6 });
92
126
  }
@@ -97,6 +131,98 @@ export const C4ManagementSettings = ({ orgId: _orgId, organizationName: _organiz
97
131
  const suppressDropDisksBody = (_jsxs(_Fragment, { children: [sectionHeading(text.suppressDropDisks.title), _jsx("p", { style: { marginTop: '8px', color: 'var(--neutral-foreground-subtle)' }, children: text.suppressDropDisks.description }), _jsx(C4Toggle, { id: 'suppress-drop-disks-toggle', supported: true, enabled: suppressDropDisks, title: '', notices: [], onClick: onToggleSuppressDropDisks, permissions: {
98
132
  mayToggle: true,
99
133
  } })] }));
134
+ // A shorter period deletes entries: the new period is limited, and the
135
+ // current one is "Not set" or longer.
136
+ const deletesEntries = newRetention !== undefined &&
137
+ currentRetention !== undefined &&
138
+ newRetention !== ACTIVITY_RETENTION_NOT_SET &&
139
+ (currentRetention === ACTIVITY_RETENTION_NOT_SET ||
140
+ newRetention < currentRetention);
141
+ const saveRetention = async (months) => {
142
+ const savedOrgId = orgId;
143
+ setSavingRetention(true);
144
+ setRetentionSaveFailed(false);
145
+ let failed = false;
146
+ try {
147
+ await onChangeActivityRetention(months);
148
+ }
149
+ catch {
150
+ failed = true;
151
+ }
152
+ // A result for an org that is no longer shown must not touch the draft of
153
+ // the current org.
154
+ if (orgIdRef.current !== savedOrgId)
155
+ return;
156
+ if (failed) {
157
+ // The selection stays, so the user can retry.
158
+ setRetentionSaveFailed(true);
159
+ }
160
+ else {
161
+ setSelectedRetention(undefined);
162
+ }
163
+ setSavingRetention(false);
164
+ setConfirmOpen(false);
165
+ };
166
+ const retentionText = text.activityRetention;
167
+ // Fills the values of the dialog. The dialog shows only for a shorter period,
168
+ // so the new period is a limited one, and the date is the cutoff of today.
169
+ const fillDialogText = (template) => template
170
+ .replaceAll('{{previous}}', currentRetention === undefined
171
+ ? ''
172
+ : retentionText.options[currentRetention])
173
+ .replaceAll('{{period}}', newRetention === undefined ? '' : retentionText.options[newRetention])
174
+ .replaceAll('{{date}}', newRetention === undefined || deletesEntries === false
175
+ ? ''
176
+ : Intl.DateTimeFormat('en-US', {
177
+ dateStyle: 'long',
178
+ timeZone: 'UTC',
179
+ }).format(activityRetentionCutoff(new Date(), newRetention)));
180
+ const activityRetentionBody = currentRetention === undefined ? undefined : (_jsxs(_Fragment, { children: [sectionHeading(retentionText.title), _jsx("p", { style: {
181
+ marginTop: '8px',
182
+ color: 'var(--neutral-foreground-subtle)',
183
+ }, children: retentionText.description }), permissions.mayChangeActivityRetention ? (_jsxs(_Fragment, { children: [_jsx(Select, { id: 'activity-retention-select', labelText: retentionText.title, hideLabel: true, value: String(newRetention), disabled: savingRetention, onChange: (event) => {
184
+ const months = Number(event.target.value);
185
+ if (isActivityRetentionMonths(months)) {
186
+ setSelectedRetention(months);
187
+ setRetentionSaveFailed(false);
188
+ }
189
+ }, children: ACTIVITY_RETENTION_CHOICES.map((months) => (_jsx(SelectItem, { value: String(months), text: retentionText.options[months] }, months))) }), _jsx(Button, { style: { marginTop: '24px' }, size: 'md', disabled: savingRetention ||
190
+ newRetention === undefined ||
191
+ newRetention === currentRetention, onClick: () => {
192
+ if (newRetention === undefined)
193
+ return;
194
+ if (deletesEntries) {
195
+ setConfirmOpen(true);
196
+ }
197
+ else {
198
+ void saveRetention(newRetention);
199
+ }
200
+ }, children: retentionText.saveButton }), retentionSaveFailed && newRetention !== currentRetention ? (_jsx("div", { style: { marginTop: '16px' }, children: _jsx(C4InlineNotification, { kind: 'error', title: retentionText.saveError, hideCloseButton: true }) })) : undefined, _jsx(C4ActivityRetentionConfirmModal, { open: confirmOpen, loading: savingRetention, title: retentionText.dialogTitle, intro: fillDialogText(retentionText.dialogIntro), summary: fillDialogText(retentionText.dialogSummary), sections: [
201
+ {
202
+ heading: retentionText.dialogNextHeading,
203
+ items: [
204
+ retentionText.dialogNext1,
205
+ retentionText.dialogNext2,
206
+ retentionText.dialogNext3,
207
+ ].map(fillDialogText),
208
+ },
209
+ {
210
+ heading: retentionText.dialogBeforeHeading,
211
+ items: [
212
+ retentionText.dialogBefore1,
213
+ retentionText.dialogBefore2,
214
+ retentionText.dialogBefore3,
215
+ ].map(fillDialogText),
216
+ },
217
+ ], cancelLabel: retentionText.cancel, confirmLabel: retentionText.confirm, onCancel: () => {
218
+ if (!savingRetention)
219
+ setConfirmOpen(false);
220
+ }, onConfirm: () => {
221
+ if (newRetention !== undefined)
222
+ void saveRetention(newRetention);
223
+ } })] })) : (_jsx("p", { style: { marginTop: '8px' }, children: currentRetention === ACTIVITY_RETENTION_NOT_SET
224
+ ? retentionText.readOnlyNotSet
225
+ : retentionText.readOnlyLimited(retentionText.options[currentRetention]) }))] }));
100
226
  const deleteOrganizationBody = (_jsxs(_Fragment, { children: [sectionHeading(text.deleteOrganization.title), _jsx("p", { style: { marginTop: '8px', color: 'var(--neutral-foreground-subtle)' }, children: text.deleteOrganization.consequence }), _jsx(Button, { style: { marginTop: '24px' }, renderIcon: Trash2, kind: 'danger', size: 'md', iconDescription: text.deleteOrganization.buttonLabel, onClick: onDeleteOrganization, children: text.deleteOrganization.buttonLabel })] }));
101
227
  const earlyAccessBody = (_jsxs(_Fragment, { children: [sectionHeading(text.earlyAccess.title), _jsx("p", { style: { marginTop: '12px', color: 'var(--neutral-foreground-subtle)' }, children: text.earlyAccess.description0 }), _jsxs("p", { style: {
102
228
  marginBottom: '18px',
@@ -136,5 +262,5 @@ export const C4ManagementSettings = ({ orgId: _orgId, organizationName: _organiz
136
262
  // organization and then Delete organization come last. The card is a flex
137
263
  // column that stretches its children, so the cards with a button align them
138
264
  // to the start; Alpha features keeps its full-width table.
139
- return (_jsxs(Stack, { gap: 6, children: [permissions.maySuppressDropDisks && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: suppressDropDisksBody })), showEarlyAccess && (_jsx(DsCard, { className: 'gap-0 p-5', children: earlyAccessBody })), permissions.mayLeaveOrganization && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: leaveOrganizationBody })), permissions.mayDeleteOrganization && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: deleteOrganizationBody }))] }));
265
+ return (_jsxs(Stack, { gap: 6, children: [permissions.maySuppressDropDisks && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: suppressDropDisksBody })), activityRetentionBody && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: activityRetentionBody })), showEarlyAccess && (_jsx(DsCard, { className: 'gap-0 p-5', children: earlyAccessBody })), permissions.mayLeaveOrganization && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: leaveOrganizationBody })), permissions.mayDeleteOrganization && (_jsx(DsCard, { className: 'items-start gap-0 p-5', children: deleteOrganizationBody }))] }));
140
266
  };
@@ -1,3 +1,4 @@
1
+ import type { ActivityRetentionMonths } from '@camunda/ccma-shared-types';
1
2
  export interface EarlyAccessFeature {
2
3
  id: string;
3
4
  name: string;
@@ -14,6 +15,8 @@ export interface C4ManagementSettingsProps {
14
15
  organizationName: string;
15
16
  hasAcceptedBetaTerms: boolean;
16
17
  suppressDropDisks: boolean;
18
+ /** Months to keep Activity entries, 0 for forever. `undefined` hides the section. */
19
+ activityRetentionMonths?: number;
17
20
  earlyAccessFeatures: EarlyAccessFeature[];
18
21
  recentlyAcceptedBeta: boolean;
19
22
  loading: boolean;
@@ -24,10 +27,12 @@ export interface C4ManagementSettingsProps {
24
27
  maySuppressDropDisks: boolean;
25
28
  mayToggleEarlyAccessFeatures: boolean;
26
29
  mayOptInToBeta: boolean;
30
+ mayChangeActivityRetention: boolean;
27
31
  };
28
32
  onLeaveOrganization: () => void;
29
33
  onDeleteOrganization: () => void;
30
34
  onToggleSuppressDropDisks: () => void;
35
+ onChangeActivityRetention: (months: ActivityRetentionMonths) => Promise<void>;
31
36
  onToggleEarlyAccessFeature: (featureId: string) => void;
32
37
  onOptInToBeta: () => void;
33
38
  onOpenFeatureOptIn: (featureId: string) => void;
@@ -44,6 +49,34 @@ export interface C4ManagementSettingsProps {
44
49
  title: string;
45
50
  description: string;
46
51
  };
52
+ activityRetention: {
53
+ title: string;
54
+ description: string;
55
+ /** The label of each period, by its value in months. */
56
+ options: Record<ActivityRetentionMonths, string>;
57
+ saveButton: string;
58
+ /** Read-only text. Takes the label of the period. */
59
+ readOnlyLimited: (period: string) => string;
60
+ readOnlyNotSet: string;
61
+ dialogTitle: string;
62
+ /** `{{previous}}` and `{{period}}` are labels. `*text*` is bold. */
63
+ dialogIntro: string;
64
+ /** `{{period}}` is the label of the new period. */
65
+ dialogSummary: string;
66
+ dialogNextHeading: string;
67
+ /** `{{date}}` is the cutoff date, `{{period}}` the new period. */
68
+ dialogNext1: string;
69
+ dialogNext2: string;
70
+ dialogNext3: string;
71
+ dialogBeforeHeading: string;
72
+ dialogBefore1: string;
73
+ dialogBefore2: string;
74
+ dialogBefore3: string;
75
+ cancel: string;
76
+ confirm: string;
77
+ /** Shown when the save fails. */
78
+ saveError: string;
79
+ };
47
80
  deleteOrganization: {
48
81
  title: string;
49
82
  consequence: string;
@@ -110,6 +110,8 @@
110
110
  "title": "Activity",
111
111
  "noActivity": "No Activity",
112
112
  "search": "Search activity",
113
+ "retentionNote": "Entries older than {{period}} are deleted.",
114
+ "retentionSettingsLink": "View in Settings",
113
115
  "columns": {
114
116
  "name": "Name",
115
117
  "timestamp": "Timestamp",
@@ -470,7 +472,37 @@
470
472
  "deleteOrganization": "Delete organization",
471
473
  "deleteConsequence": "The organization and its clusters, Web Modeler files, and other assets will be deleted. This action cannot be undone.",
472
474
  "suppressDropDisks": "Suppress drop disks",
473
- "suppressDropDisksDescription": "When enabled, disks of sleeping clusters will not be dropped automatically, preserving data during idle periods."
475
+ "suppressDropDisksDescription": "When enabled, disks of sleeping clusters will not be dropped automatically, preserving data during idle periods.",
476
+ "activityRetention": {
477
+ "title": "Activity retention",
478
+ "description": "Choose how long to keep Activity entries.",
479
+ "options": {
480
+ "6": "6 months",
481
+ "12": "1 year",
482
+ "18": "1.5 years",
483
+ "24": "2 years",
484
+ "36": "3 years",
485
+ "60": "5 years",
486
+ "120": "10 years",
487
+ "0": "Not set"
488
+ },
489
+ "saveButton": "Save",
490
+ "readOnlyNotSet": "Not set. Camunda decides when to delete older entries.",
491
+ "dialogTitle": "Delete older Activity entries?",
492
+ "dialogIntro": "You're changing Activity retention from *{{previous}}* to *{{period}}*.",
493
+ "dialogSummary": "Once you save, Camunda keeps Activity entries for {{period}}. Each day, it deletes entries that pass that age.",
494
+ "dialogNextHeading": "What happens next",
495
+ "dialogNext1": "Within 2 days, Camunda deletes all Activity entries from before *{{date}}*.",
496
+ "dialogNext2": "After that, entries are deleted every day once they're older than {{period}}.",
497
+ "dialogNext3": "Deleted entries no longer show in the Activity tab, CSV exports or the Activity API.",
498
+ "dialogBeforeHeading": "Before you continue",
499
+ "dialogBefore1": "You can't undo this. Deleted entries can't be restored, even if you choose a longer period later.",
500
+ "dialogBefore2": "If you need these entries for audits or compliance, export them as CSV first.",
501
+ "dialogBefore3": "Everyone in the organization sees a note on the Activity tab saying older entries are deleted.",
502
+ "cancel": "Cancel",
503
+ "confirm": "Delete and save",
504
+ "saveError": "Couldn't save the retention period. Try again."
505
+ }
474
506
  },
475
507
  "title": "Settings",
476
508
  "dataListTitle": "Alpha features",
@@ -3,6 +3,8 @@ export { C4ActionableNotification } from './components/c4-actionable-notificatio
3
3
  export type { C4ActionableNotificationProps } from './components/c4-actionable-notification/c4-actionable-notification.types.js';
4
4
  export { C4ActivityGraph } from './components/c4-activity-graph/c4-activity-graph.js';
5
5
  export type { C4ActivityGraphProps } from './components/c4-activity-graph/c4-activity-graph.types.js';
6
+ export type { C4ActivityRetentionConfirmModalProps } from './components/c4-activity-retention-confirm-modal/c4-activity-retention-confirm-modal.js';
7
+ export { C4ActivityRetentionConfirmModal } from './components/c4-activity-retention-confirm-modal/c4-activity-retention-confirm-modal.js';
6
8
  export { C4AiUsage } from './components/c4-ai-usage/c4-ai-usage.js';
7
9
  export type { C4AiUsageProps } from './components/c4-ai-usage/c4-ai-usage.types.js';
8
10
  export { C4AlphaClusterAtCheckout } from './components/c4-alpha-cluster-at-checkout/c4-alpha-cluster-at-checkout.js';
package/lib/esm/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  export { C4_ASSET_URLS } from './assetUrls.js';
7
7
  export { C4ActionableNotification } from './components/c4-actionable-notification/c4-actionable-notification.js';
8
8
  export { C4ActivityGraph } from './components/c4-activity-graph/c4-activity-graph.js';
9
+ export { C4ActivityRetentionConfirmModal } from './components/c4-activity-retention-confirm-modal/c4-activity-retention-confirm-modal.js';
9
10
  export { C4AiUsage } from './components/c4-ai-usage/c4-ai-usage.js';
10
11
  export { C4AlphaClusterAtCheckout } from './components/c4-alpha-cluster-at-checkout/c4-alpha-cluster-at-checkout.js';
11
12
  export { C4ApiClientScopePicker } from './components/c4-api-client-scope-picker/c4-api-client-scope-picker.js';
@@ -73,6 +73,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
73
73
  const invalidateWebappClusters = useCallback((orgId) => store.invalidateWebappClusters(orgId), [store]);
74
74
  const invalidateAll = useCallback((orgId) => store.invalidateAll(orgId), [store]);
75
75
  const getClusters = useCallback((orgId) => store.getClusters(orgId), [store]);
76
+ const getOrgInfoError = useCallback((orgId) => store.getOrgInfoError(orgId), [store]);
76
77
  const getOrgInfo = useCallback((orgId) => store.getOrgInfo(orgId), [store]);
77
78
  const getOrgOwner = useCallback((orgId) => store.getOrgOwner(orgId), [store]);
78
79
  const getEarlyAccessFeatures = useCallback((orgId) => store.getEarlyAccessFeatures(orgId), [store]);
@@ -251,6 +252,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
251
252
  // Convenience getters
252
253
  getClusters,
253
254
  getOrgInfo,
255
+ getOrgInfoError,
254
256
  getOrgOwner,
255
257
  getEarlyAccessFeatures,
256
258
  getMembers,
@@ -290,6 +292,7 @@ export const C4ConsoleDataProvider = ({ children, initialState, }) => {
290
292
  invalidateAll,
291
293
  getClusters,
292
294
  getOrgInfo,
295
+ getOrgInfoError,
293
296
  getOrgOwner,
294
297
  getEarlyAccessFeatures,
295
298
  getMembers,
@@ -92,6 +92,7 @@ export interface C4ConsoleDataState {
92
92
  invalidateAll: (orgId: string) => void;
93
93
  getClusters: (orgId: string) => any[] | undefined;
94
94
  getOrgInfo: (orgId: string) => unknown | undefined;
95
+ getOrgInfoError: (orgId: string) => Error | undefined;
95
96
  getOrgOwner: (orgId: string) => {
96
97
  owner: string;
97
98
  email: string;
@@ -93,6 +93,7 @@ export declare const ConsoleDataStore: import("mobx-state-tree").IModelType<{
93
93
  } & {
94
94
  getClusters(orgId: string): any[] | undefined;
95
95
  getOrgInfo(orgId: string): unknown | undefined;
96
+ getOrgInfoError(orgId: string): Error | undefined;
96
97
  getOrgOwner(orgId: string): {
97
98
  owner: string;
98
99
  email: string;
@@ -144,6 +144,9 @@ export const ConsoleDataStore = types
144
144
  const cached = self.orgInfo.get(orgId);
145
145
  return cached?.data;
146
146
  },
147
+ getOrgInfoError(orgId) {
148
+ return self.orgInfo.get(orgId)?.error ?? undefined;
149
+ },
147
150
  getOrgOwner(orgId) {
148
151
  const cached = self.orgOwner.get(orgId);
149
152
  return cached?.data;
@@ -391,6 +394,9 @@ export const ConsoleDataStore = types
391
394
  result = yield OrgsService.getOrgInfo({
392
395
  config: apiConfig,
393
396
  orgUuid: orgId,
397
+ // A forced read follows a write. The API cache can still hold
398
+ // the org from before the write.
399
+ cacheControl: { ignoreCache: options?.force === true },
394
400
  });
395
401
  }
396
402
  catch (error) {
@@ -2,6 +2,6 @@ import { type JSX } from 'react';
2
2
  import type { CloudClientItem } from '../../components/c4-management-api/c4-management-api.types.js';
3
3
  import type { C4ManagementAppProps } from './c4-management-app.types.js';
4
4
  export declare function mapPermissionsToScopeStrings(permissions: string[], t: ((key: string, options?: Record<string, unknown>) => string) | undefined): Omit<CloudClientItem, 'id' | 'name' | 'clientId'>;
5
- export declare const C4ManagementApp: (({ orgId, embedded, environmentsEnabled, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, permissionsReworkEnabled, urls, onNeedsReload, }: C4ManagementAppProps) => JSX.Element) & {
5
+ export declare const C4ManagementApp: (({ orgId, embedded, environmentsEnabled, desiredTabId, onTabChange, onNavigate, getTabHref, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, permissionsReworkEnabled, urls, onNeedsReload, }: C4ManagementAppProps) => JSX.Element) & {
6
6
  displayName: string;
7
7
  };
@@ -7,7 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
7
  import { C4GroupsList, C4IdentityContextProvider } from '@camunda/c4-identity';
8
8
  import { useC3Profile } from '@camunda/camunda-composite-components';
9
9
  import { AuditLoggerService, ConsoleApiClientsService, ConsoleClusterParametersService, ConsoleValueMetricsService, EarlyAccessFeaturesService, HdpService, HttpError, OrganizationMembersService, OrgsService, UsageAlertsService, } from '@camunda/ccma-api';
10
- import { addMonthsClamped, checkVersion, diffInWholeMonths, getCurrentEnterpriseTerm, getDisplayedSalesPlan, getRevisitedSalesPlanName, IDENTITY_MANAGEMENT_MIN_VERSION, NEW_CLUSTER_ROLES_MIN_VERSION, OrganizationRole, peakWithinTerm, SseEntity, toUtcDayStartMs, USAGE_SALES_PLAN_TYPES, VersionCheckOperator, } from '@camunda/ccma-shared-types';
10
+ import { ACTIVITY_RETENTION_CHOICES, ACTIVITY_RETENTION_FLAG, activityRetentionLabel, addMonthsClamped, checkVersion, diffInWholeMonths, getCurrentEnterpriseTerm, getDisplayedSalesPlan, getRevisitedSalesPlanName, IDENTITY_MANAGEMENT_MIN_VERSION, isActivityRetentionMonths, isLimitedActivityRetention, NEW_CLUSTER_ROLES_MIN_VERSION, OrganizationRole, peakWithinTerm, SseEntity, toUtcDayStartMs, USAGE_SALES_PLAN_TYPES, VersionCheckOperator, } from '@camunda/ccma-shared-types';
11
11
  import { observer } from 'mobx-react-lite';
12
12
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
13
13
  import { C4AiUsage } from '../../components/c4-ai-usage/c4-ai-usage.js';
@@ -558,7 +558,7 @@ function themeNameToClassName(theme) {
558
558
  return 'g10';
559
559
  }
560
560
  }
561
- export const C4ManagementApp = observer(({ orgId, embedded = false, environmentsEnabled = false, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, permissionsReworkEnabled = false, urls, onNeedsReload, }) => {
561
+ export const C4ManagementApp = observer(({ orgId, embedded = false, environmentsEnabled = false, desiredTabId, onTabChange, onNavigate, getTabHref, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, permissionsReworkEnabled = false, urls, onNeedsReload, }) => {
562
562
  const runtime = useC4ConsoleRuntime();
563
563
  const hubNaming = useHubApiNaming();
564
564
  const data = useC4ConsoleData();
@@ -571,11 +571,14 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
571
571
  const getMembers = data.getMembers;
572
572
  const getClusters = data.getClusters;
573
573
  const getOrgInfo = data.getOrgInfo;
574
+ const getOrgInfoError = data.getOrgInfoError;
574
575
  const getOrgOwner = data.getOrgOwner;
575
576
  const getEarlyAccessFeatures = data.getEarlyAccessFeatures;
576
577
  const setOrgInfo = data.setOrgInfo;
577
578
  const setEarlyAccessFeatures = data.setEarlyAccessFeatures;
578
579
  const t = runtime.i18n?.t;
580
+ // safeTranslate does not interpolate its fallback, so fill it here.
581
+ const retentionNoteFor = useCallback((period) => safeTranslate(t, 'orgmanagement:tabs.activity.retentionNote', `Entries older than ${period} are deleted.`, { period }), [t]);
579
582
  const c3Profile = useC3Profile();
580
583
  const [resolvedUserEmail, setResolvedUserEmail] = useState(() => {
581
584
  return typeof runtime.user?.email === 'string' && runtime.user.email
@@ -873,6 +876,31 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
873
876
  mapEarlyAccessFeatures,
874
877
  orgId,
875
878
  ]);
879
+ const reconcileActivityRetention = useCallback(async (savedOrgId) => {
880
+ try {
881
+ await withTimeout(fetchOrgInfo(savedOrgId, { force: true }), 10_000, 'Timed out loading organization');
882
+ }
883
+ catch {
884
+ // The read timed out. The section shows the save error.
885
+ return;
886
+ }
887
+ // A failed read does not reject. The store keeps the old data and
888
+ // sets `error`, so applying it would write the old value back.
889
+ if (getOrgInfoError(savedOrgId))
890
+ return;
891
+ const fresh = getOrgInfo(savedOrgId);
892
+ const months = fresh?.['activityRetentionMonths'];
893
+ const current = orgRef.current;
894
+ if (!isActivityRetentionMonths(months) ||
895
+ !current ||
896
+ current['uuid'] !== savedOrgId) {
897
+ return;
898
+ }
899
+ const nextOrg = { ...current, activityRetentionMonths: months };
900
+ orgRef.current = nextOrg;
901
+ setOrg(nextOrg);
902
+ setOrgInfo(savedOrgId, nextOrg);
903
+ }, [fetchOrgInfo, getOrgInfo, getOrgInfoError, setOrgInfo]);
876
904
  const syncSettingsCache = useCallback(async ({ forceOrgInfo = false, forceEarlyAccess = false, } = {}) => {
877
905
  if (!forceOrgInfo && !forceEarlyAccess) {
878
906
  return;
@@ -2039,6 +2067,13 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2039
2067
  ]);
2040
2068
  const canReadActivity = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'activity', 'read']), [org]);
2041
2069
  const clusterDefaultsTabEnabled = useC4FeatureFlag(ORG_CLUSTER_DEFAULTS_FLAG);
2070
+ const activityRetentionEnabled = useC4FeatureFlag(ACTIVITY_RETENTION_FLAG);
2071
+ const activityRetentionMonths = useMemo(() => {
2072
+ const months = org?.['activityRetentionMonths'];
2073
+ return activityRetentionEnabled && isActivityRetentionMonths(months)
2074
+ ? months
2075
+ : undefined;
2076
+ }, [activityRetentionEnabled, org]);
2042
2077
  // The same permission that the accounts route asks for on the write.
2043
2078
  const canChangeOrgSettings = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'settings', 'update']), [org]);
2044
2079
  const loadAudits = useCallback(async (opts) => {
@@ -2322,6 +2357,7 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2322
2357
  organizationName: orgName,
2323
2358
  hasAcceptedBetaTerms,
2324
2359
  suppressDropDisks,
2360
+ activityRetentionMonths,
2325
2361
  earlyAccessFeatures: features,
2326
2362
  recentlyAcceptedBeta,
2327
2363
  loading: loading || (settingsLoading && features.length === 0),
@@ -2332,6 +2368,8 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2332
2368
  maySuppressDropDisks,
2333
2369
  mayToggleEarlyAccessFeatures,
2334
2370
  mayOptInToBeta: Boolean(betaGroupKey),
2371
+ // The route answers 403 for any other role.
2372
+ mayChangeActivityRetention: isCurrentUserOwner,
2335
2373
  },
2336
2374
  onLeaveOrganization: () => {
2337
2375
  runtime.telemetry?.track?.('orgMembers:leave:open', {
@@ -2380,6 +2418,41 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2380
2418
  }
2381
2419
  })();
2382
2420
  },
2421
+ onChangeActivityRetention: async (months) => {
2422
+ // A failure rejects. The section shows the error and keeps the selection.
2423
+ let response;
2424
+ try {
2425
+ response = await OrgsService.updateActivityRetention({
2426
+ config: apiConfig,
2427
+ params: { orgId, months },
2428
+ });
2429
+ }
2430
+ catch (error) {
2431
+ // The route can store the period and still fail. Show the stored
2432
+ // value before the next save, or Save compares with a stale value.
2433
+ // The section keeps its controls disabled until this settles.
2434
+ await reconcileActivityRetention(orgId);
2435
+ throw error;
2436
+ }
2437
+ const savedMonths = response.activityRetentionMonths;
2438
+ // The cache keeps the value for a tab change or a remount.
2439
+ const cached = getOrgInfo(orgId);
2440
+ if (cached) {
2441
+ setOrgInfo(orgId, {
2442
+ ...cached,
2443
+ activityRetentionMonths: savedMonths,
2444
+ });
2445
+ }
2446
+ // The owner can switch the org during the save. The response must
2447
+ // not change the org that shows now.
2448
+ const current = orgRef.current;
2449
+ if (!current || current['uuid'] !== orgId) {
2450
+ return;
2451
+ }
2452
+ const nextOrg = { ...current, activityRetentionMonths: savedMonths };
2453
+ orgRef.current = nextOrg;
2454
+ setOrg(nextOrg);
2455
+ },
2383
2456
  onToggleEarlyAccessFeature: (featureId) => {
2384
2457
  const feature = features.find((f) => f.id === featureId);
2385
2458
  if (!feature) {
@@ -2438,6 +2511,31 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2438
2511
  consequence: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.deleteConsequence', 'This action cannot be undone.'),
2439
2512
  buttonLabel: safeTranslate(t, 'orgmanagement:tabs.overview.actions.deleteOrg', 'Delete organization'),
2440
2513
  },
2514
+ activityRetention: {
2515
+ title: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.title', 'Activity retention'),
2516
+ description: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.description', 'Choose how long to keep Activity entries.'),
2517
+ options: Object.fromEntries(ACTIVITY_RETENTION_CHOICES.map((months) => [
2518
+ months,
2519
+ safeTranslate(t, `orgmanagement:tabs.settings.orgmanagement.activityRetention.options.${months}`, activityRetentionLabel(months)),
2520
+ ])),
2521
+ saveButton: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.saveButton', 'Save'),
2522
+ readOnlyLimited: retentionNoteFor,
2523
+ readOnlyNotSet: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.readOnlyNotSet', 'Not set. Camunda decides when to delete older entries.'),
2524
+ dialogTitle: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogTitle', 'Delete older Activity entries?'),
2525
+ dialogIntro: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogIntro', "You're changing Activity retention from *{{previous}}* to *{{period}}*."),
2526
+ dialogSummary: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogSummary', 'Once you save, Camunda keeps Activity entries for {{period}}. Each day, it deletes entries that pass that age.'),
2527
+ dialogNextHeading: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogNextHeading', 'What happens next'),
2528
+ dialogNext1: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogNext1', 'Within 2 days, Camunda deletes all Activity entries from before *{{date}}*.'),
2529
+ dialogNext2: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogNext2', "After that, entries are deleted every day once they're older than {{period}}."),
2530
+ dialogNext3: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogNext3', 'Deleted entries no longer show in the Activity tab, CSV exports or the Activity API.'),
2531
+ dialogBeforeHeading: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogBeforeHeading', 'Before you continue'),
2532
+ dialogBefore1: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogBefore1', "You can't undo this. Deleted entries can't be restored, even if you choose a longer period later."),
2533
+ dialogBefore2: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogBefore2', 'If you need these entries for audits or compliance, export them as CSV first.'),
2534
+ dialogBefore3: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.dialogBefore3', 'Everyone in the organization sees a note on the Activity tab saying older entries are deleted.'),
2535
+ cancel: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.cancel', 'Cancel'),
2536
+ confirm: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.confirm', 'Delete and save'),
2537
+ saveError: safeTranslate(t, 'orgmanagement:tabs.settings.orgmanagement.activityRetention.saveError', "Couldn't save the retention period. Try again."),
2538
+ },
2441
2539
  earlyAccess: {
2442
2540
  title: safeTranslate(t, 'orgmanagement:tabs.settings.dataListTitle', 'Early access'),
2443
2541
  description0: safeTranslate(t, 'orgmanagement:tabs.settings.description0', 'Try new features before general availability.'),
@@ -2465,6 +2563,7 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2465
2563
  earlyAccessDocsUrl: externalUrls.earlyAccessDocsUrl,
2466
2564
  };
2467
2565
  }, [
2566
+ activityRetentionMonths,
2468
2567
  apiConfig,
2469
2568
  externalUrls.earlyAccessDocsUrl,
2470
2569
  features,
@@ -2475,15 +2574,19 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2475
2574
  org,
2476
2575
  orgId,
2477
2576
  recentlyAcceptedBeta,
2577
+ reconcileActivityRetention,
2478
2578
  resolvedUserEmail,
2479
2579
  runtime.clickwrap?.betaGroupKey,
2480
2580
  runtime.user?.email,
2581
+ retentionNoteFor,
2481
2582
  settingsError,
2482
2583
  settingsLoading,
2483
2584
  syncSettingsCache,
2484
2585
  t,
2485
2586
  getEarlyAccessFeatures,
2587
+ getOrgInfo,
2486
2588
  setEarlyAccessFeatures,
2589
+ setOrgInfo,
2487
2590
  ]);
2488
2591
  const activityProps = useMemo(() => {
2489
2592
  const memberByUserId = new Map(members
@@ -2544,8 +2647,20 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2544
2647
  nameColumnLabel: safeTranslate(t, 'orgmanagement:tabs.activity.columns.name', 'Name'),
2545
2648
  timestampColumnLabel: safeTranslate(t, 'orgmanagement:tabs.activity.columns.timestamp', 'Timestamp'),
2546
2649
  auditColumnLabel: safeTranslate(t, 'orgmanagement:tabs.activity.columns.audit', 'Audit'),
2650
+ ...(activityRetentionMonths !== undefined &&
2651
+ isLimitedActivityRetention(activityRetentionMonths)
2652
+ ? {
2653
+ retentionNote: retentionNoteFor(safeTranslate(t, `orgmanagement:tabs.settings.orgmanagement.activityRetention.options.${activityRetentionMonths}`, activityRetentionLabel(activityRetentionMonths))),
2654
+ retentionSettingsLabel: safeTranslate(t, 'orgmanagement:tabs.activity.retentionSettingsLink', 'View in Settings'),
2655
+ retentionSettingsHref: getTabHref?.('settings'),
2656
+ onOpenRetentionSettings: () => changeTab('settings'),
2657
+ }
2658
+ : {}),
2547
2659
  };
2548
2660
  }, [
2661
+ activityRetentionMonths,
2662
+ changeTab,
2663
+ getTabHref,
2549
2664
  audits,
2550
2665
  auditsDownloading,
2551
2666
  auditsLoading,
@@ -2554,6 +2669,7 @@ export const C4ManagementApp = observer(({ orgId, embedded = false, environments
2554
2669
  getAuditTimestampMs,
2555
2670
  members,
2556
2671
  orgId,
2672
+ retentionNoteFor,
2557
2673
  t,
2558
2674
  ]);
2559
2675
  const apiClientPermissions = useMemo(() => {
@@ -58,6 +58,12 @@ export interface C4ManagementAppProps {
58
58
  desiredTabId?: string;
59
59
  onTabChange?: (tabId: string) => void;
60
60
  onNavigate?: (event: C4ManagementNavigateEvent) => void;
61
+ /**
62
+ * Returns the URL of a tab of this page, for a link that can open in a new
63
+ * tab. A click on the link still calls `onTabChange`. Without it, the widget
64
+ * shows no link to another tab.
65
+ */
66
+ getTabHref?: (tabId: string) => string;
61
67
  /**
62
68
  * Temporary escape hatch while migrating: pass existing tabs from the host.
63
69
  * The widget will replace the tabs it owns by ID (overview/users/settings).
@@ -1,3 +1,4 @@
1
+ import type { ActivityRetentionMonths } from '@camunda/ccma-shared-types';
1
2
  import type { JSX } from 'react';
2
3
  import type { C4ManagementSettingsProps, EarlyAccessFeature } from '../../../components/c4-management-settings/c4-management-settings.types.js';
3
4
  export interface C4ManagementSettingsTabProps {
@@ -5,6 +6,7 @@ export interface C4ManagementSettingsTabProps {
5
6
  orgName: string;
6
7
  hasAcceptedBetaTerms: boolean;
7
8
  suppressDropDisks: boolean;
9
+ activityRetentionMonths?: number;
8
10
  earlyAccessFeatures: EarlyAccessFeature[];
9
11
  recentlyAcceptedBeta: boolean;
10
12
  loading: boolean;
@@ -15,6 +17,7 @@ export interface C4ManagementSettingsTabProps {
15
17
  maySuppressDropDisks: boolean;
16
18
  mayToggleEarlyAccessFeatures: boolean;
17
19
  mayOptInToBeta: boolean;
20
+ mayChangeActivityRetention: boolean;
18
21
  };
19
22
  clickwrapAccessId?: string;
20
23
  clickwrapBetaGroupKey?: string;
@@ -29,6 +32,7 @@ export interface C4ManagementSettingsTabProps {
29
32
  onLeaveOrganization: () => void;
30
33
  onDeleteOrganization: () => void;
31
34
  onToggleSuppressDropDisks: () => void;
35
+ onChangeActivityRetention: (months: ActivityRetentionMonths) => Promise<void>;
32
36
  onToggleEarlyAccessFeature: (featureId: string) => void;
33
37
  onAcceptBetaTerms: () => Promise<void>;
34
38
  onAcceptFeatureTerms: (featureId: string) => void;
@@ -37,4 +41,4 @@ export interface C4ManagementSettingsTabProps {
37
41
  text: C4ManagementSettingsProps['text'];
38
42
  earlyAccessDocsUrl: string;
39
43
  }
40
- export declare const C4ManagementSettingsTab: ({ orgId, orgName, hasAcceptedBetaTerms, suppressDropDisks, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, clickwrapAccessId, clickwrapBetaGroupKey, runtime, t, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onToggleEarlyAccessFeature, onAcceptBetaTerms, onAcceptFeatureTerms, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }: C4ManagementSettingsTabProps) => JSX.Element;
44
+ export declare const C4ManagementSettingsTab: ({ orgId, orgName, hasAcceptedBetaTerms, suppressDropDisks, activityRetentionMonths, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, clickwrapAccessId, clickwrapBetaGroupKey, runtime, t, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onChangeActivityRetention, onToggleEarlyAccessFeature, onAcceptBetaTerms, onAcceptFeatureTerms, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }: C4ManagementSettingsTabProps) => JSX.Element;
@@ -1,15 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, 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
2
  import { PSClickWrap } from '@pactsafe/pactsafe-react-sdk';
8
3
  import { useState } from 'react';
9
4
  import { C4ManagementSettings } from '../../../components/c4-management-settings/c4-management-settings.js';
10
5
  import { Modal, Stack } from '../../../ui/index.js';
11
6
  import { safeTranslate } from '../../../utils/safe-translate.js';
12
- export const C4ManagementSettingsTab = ({ orgId, orgName, hasAcceptedBetaTerms, suppressDropDisks, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, clickwrapAccessId, clickwrapBetaGroupKey, runtime, t, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onToggleEarlyAccessFeature, onAcceptBetaTerms, onAcceptFeatureTerms, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }) => {
7
+ export const C4ManagementSettingsTab = ({ orgId, orgName, hasAcceptedBetaTerms, suppressDropDisks, activityRetentionMonths, earlyAccessFeatures, recentlyAcceptedBeta, loading, error, permissions, clickwrapAccessId, clickwrapBetaGroupKey, runtime, t, onLeaveOrganization, onDeleteOrganization, onToggleSuppressDropDisks, onChangeActivityRetention, onToggleEarlyAccessFeature, onAcceptBetaTerms, onAcceptFeatureTerms, onShareFeedback, onRetry, text, earlyAccessDocsUrl, }) => {
13
8
  const [clickwrapOpen, setClickwrapOpen] = useState(false);
14
9
  const [clickwrapGroupKey, setClickwrapGroupKey] = useState(undefined);
15
10
  const [clickwrapFeatureId, setClickwrapFeatureId] = useState(undefined);
@@ -29,6 +24,7 @@ export const C4ManagementSettingsTab = ({ orgId, orgName, hasAcceptedBetaTerms,
29
24
  organizationName: orgName,
30
25
  hasAcceptedBetaTerms,
31
26
  suppressDropDisks,
27
+ activityRetentionMonths,
32
28
  earlyAccessFeatures,
33
29
  recentlyAcceptedBeta,
34
30
  loading,
@@ -37,6 +33,7 @@ export const C4ManagementSettingsTab = ({ orgId, orgName, hasAcceptedBetaTerms,
37
33
  onLeaveOrganization,
38
34
  onDeleteOrganization,
39
35
  onToggleSuppressDropDisks,
36
+ onChangeActivityRetention,
40
37
  onToggleEarlyAccessFeature,
41
38
  onOptInToBeta: () => {
42
39
  // For beta opt-in, no feature ID is set
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.27.8",
3
+ "version": "0.28.0",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -85,8 +85,8 @@
85
85
  "react-markdown": "^8.0.7 || ^10.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@camunda/ccma-api": "7.8.1",
89
- "@camunda/ccma-shared-types": "12.10.0",
88
+ "@camunda/ccma-api": "7.8.2",
89
+ "@camunda/ccma-shared-types": "12.10.1",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",
92
92
  "mobx": "6.16.1",