@camunda/ccma-saas-frontend 0.11.0 → 0.13.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.
Files changed (116) hide show
  1. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.d.ts +1 -1
  2. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +11 -1
  3. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.js +2 -0
  4. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.types.d.ts +2 -0
  5. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  6. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +24 -2
  7. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +9 -0
  8. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.d.ts +1 -1
  9. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +2 -4
  10. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +0 -4
  11. package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +9 -1
  12. package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +5 -5
  13. package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +3 -3
  14. package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.d.ts +1 -1
  15. package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.js +2 -2
  16. package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.types.d.ts +5 -0
  17. package/lib/esm/components/c4-convert-trial-organization-modal/c4-convert-trial-organization-modal.js +1 -11
  18. package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +1 -14
  19. package/lib/esm/components/c4-create-cluster/c4-create-cluster.d.ts +1 -1
  20. package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +188 -71
  21. package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +52 -0
  22. package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +1 -11
  23. package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js +6 -13
  24. package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +1 -11
  25. package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +1 -18
  26. package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js +1 -11
  27. package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.d.ts +0 -7
  28. package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.js +1 -24
  29. package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +1 -18
  30. package/lib/esm/components/c4-divider/c4-divider.js +12 -0
  31. package/lib/esm/components/c4-empty-state/c4-empty-state.d.ts +8 -0
  32. package/lib/esm/components/c4-empty-state/c4-empty-state.js +32 -8
  33. package/lib/esm/components/c4-file-uploader/c4-file-uploader.d.ts +36 -0
  34. package/lib/esm/components/c4-file-uploader/c4-file-uploader.js +43 -0
  35. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +1 -11
  36. package/lib/esm/components/c4-leave-organization-modal/c4-leave-organization-modal.js +1 -11
  37. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.d.ts +10 -0
  38. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.js +96 -0
  39. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.d.ts +22 -0
  40. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.js +6 -0
  41. package/lib/esm/components/c4-rename-organization-modal/c4-rename-organization-modal.js +1 -11
  42. package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +50 -0
  43. package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +130 -0
  44. package/lib/esm/externalUrls.const.d.ts +7 -0
  45. package/lib/esm/externalUrls.const.js +11 -1
  46. package/lib/esm/i18n/c4-console-i18n.js +3 -0
  47. package/lib/esm/i18n/en/modals/apiclients.json +2 -1
  48. package/lib/esm/i18n/en/modals/clusterclients.json +18 -1
  49. package/lib/esm/i18n/en/pages/clusterdetails.json +12 -7
  50. package/lib/esm/i18n/en/pages/createcluster.json +43 -0
  51. package/lib/esm/i18n/en/pages/orgmanagement.json +6 -0
  52. package/lib/esm/index.d.ts +4 -0
  53. package/lib/esm/index.js +3 -0
  54. package/lib/esm/runtime/c4-console-runtime-context.d.ts +1 -1
  55. package/lib/esm/runtime/c4-console-runtime-context.js +2 -2
  56. package/lib/esm/runtime/cluster-duplication.d.ts +10 -0
  57. package/lib/esm/runtime/cluster-duplication.js +15 -0
  58. package/lib/esm/runtime/org-cluster-defaults.d.ts +14 -0
  59. package/lib/esm/runtime/org-cluster-defaults.js +19 -0
  60. package/lib/esm/ui/c4-password-input.js +1 -1
  61. package/lib/esm/ui/index.d.ts +1 -0
  62. package/lib/esm/ui/index.js +16 -2
  63. package/lib/esm/utils/role-labels.d.ts +1 -2
  64. package/lib/esm/utils/role-labels.js +1 -13
  65. package/lib/esm/utils/safe-translate.d.ts +4 -2
  66. package/lib/esm/utils/safe-translate.js +9 -2
  67. package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +80 -23
  68. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +34 -23
  69. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +6 -0
  70. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +7 -0
  71. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +3 -0
  72. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-activity-tab.js +1 -19
  73. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +1 -14
  74. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +1 -18
  75. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +57 -2
  76. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -0
  77. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +77 -28
  78. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +1 -6
  79. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +1 -18
  80. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +12 -22
  81. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +1 -6
  82. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +3 -86
  83. package/lib/esm/widgets/clusters/c4-clusters-page.js +72 -100
  84. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +7 -0
  85. package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -9
  86. package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +1 -9
  87. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +88 -1
  88. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +285 -45
  89. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +9 -0
  90. package/lib/esm/widgets/dashboard/c4-dashboard-app.js +3 -20
  91. package/lib/esm/widgets/dashboard/c4-dashboard-app.types.d.ts +6 -0
  92. package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.js +1 -1
  93. package/lib/esm/widgets/group-details/c4-group-details-page.js +1 -9
  94. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +1 -0
  95. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +4 -34
  96. package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
  97. package/lib/esm/widgets/management/c4-management-app.js +99 -23
  98. package/lib/esm/widgets/management/c4-management-app.types.d.ts +6 -0
  99. package/lib/esm/widgets/management/c4-management-page.d.ts +1 -1
  100. package/lib/esm/widgets/management/c4-management-page.js +7 -13
  101. package/lib/esm/widgets/management/c4-management-page.types.d.ts +1 -0
  102. package/lib/esm/widgets/management/management-tabs.d.ts +1 -1
  103. package/lib/esm/widgets/management/management-tabs.js +5 -0
  104. package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +1 -13
  105. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -9
  106. package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.d.ts +5 -0
  107. package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.js +5 -0
  108. package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +1 -13
  109. package/lib/esm/widgets/management/tabs/c4-management-pricing-tab.js +1 -8
  110. package/lib/esm/widgets/management/tabs/c4-management-settings-tab.js +1 -24
  111. package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +1 -13
  112. package/lib/esm/widgets/user-account/c4-delete-account-widget.js +2 -1
  113. package/lib/esm/widgets/user-details/c4-user-details-page.js +1 -9
  114. package/package.json +3 -3
  115. package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.d.ts +0 -14
  116. package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.js +0 -12
@@ -16,19 +16,22 @@ import { C4ExtendTrialModal } from '../../components/c4-extend-trial-modal/c4-ex
16
16
  import { C4LeaveOrganizationModal } from '../../components/c4-leave-organization-modal/c4-leave-organization-modal.js';
17
17
  import { getC4ManagementUrls } from '../../externalUrls.const.js';
18
18
  import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
19
- import { useC4ConsoleRuntime, useC4DesignSystem, } from '../../runtime/c4-console-runtime-context.js';
19
+ import { useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
20
+ import { ORG_CLUSTER_DEFAULTS_FLAG } from '../../runtime/org-cluster-defaults.js';
20
21
  import { toApiConfig } from '../../runtime/to-api-config.js';
21
22
  import { toIdentityApiBaseUrl } from '../../runtime/to-identity-api-base-url.js';
22
23
  import { useHubApiNaming } from '../../runtime/use-hub-api-naming.js';
23
24
  import { Link, Stack } from '../../ui/index.js';
24
25
  import { clientErrorMessage } from '../../utils/http-error-message.js';
25
26
  import { legacySectionRoles } from '../../utils/role-labels.js';
27
+ import { safeTranslate } from '../../utils/safe-translate.js';
26
28
  import { useExtendTrial } from '../use-extend-trial.js';
27
29
  import { C4ManagementPage } from './c4-management-page.js';
28
30
  import { managementTab } from './management-tabs.js';
29
31
  import { C4ManagementActivityTab } from './tabs/c4-management-activity-tab.js';
30
32
  import { C4ManagementApiTab } from './tabs/c4-management-api-tab.js';
31
33
  import { C4ManagementBillingTab } from './tabs/c4-management-billing-tab.js';
34
+ import { C4ManagementClusterDefaultsTab } from './tabs/c4-management-cluster-defaults-tab.js';
32
35
  import { C4ManagementOverviewTab } from './tabs/c4-management-overview-tab.js';
33
36
  import { C4ManagementPricingTab } from './tabs/c4-management-pricing-tab.js';
34
37
  import { C4ManagementSettingsTab } from './tabs/c4-management-settings-tab.js';
@@ -100,26 +103,6 @@ function getNestedValue(record, path) {
100
103
  function getNestedBoolean(record, path) {
101
104
  return getNestedValue(record, path) === true;
102
105
  }
103
- function safeTranslate(t, key, fallback, options) {
104
- try {
105
- const translated = t?.(key, options);
106
- if (!translated || translated === key) {
107
- return fallback;
108
- }
109
- // i18next can return the key *without* the namespace when the namespace is missing.
110
- // Example: `orgmanagement:tabs.api.search` -> `tabs.api.search`
111
- if (key.includes(':')) {
112
- const withoutNamespace = key.split(':').slice(1).join(':');
113
- if (translated === withoutNamespace) {
114
- return fallback;
115
- }
116
- }
117
- return translated;
118
- }
119
- catch {
120
- return fallback;
121
- }
122
- }
123
106
  // Usage charts render one line series (and one legend entry) per cluster. Orgs
124
107
  // with hundreds of clusters overflow the legend and break the layout, so cap the
125
108
  // number of distinct series to the top-N clusters by total value and roll the
@@ -563,7 +546,7 @@ function themeNameToClassName(theme) {
563
546
  return 'g10';
564
547
  }
565
548
  }
566
- export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, tenantsValueMetricEnabled = false, hdpValueMetricsFor2025Enabled = false, permissionsReworkEnabled = false, urls, onNeedsReload, }) => {
549
+ export const C4ManagementApp = observer(({ orgId, embedded = false, desiredTabId, onTabChange, onNavigate, legacyTabs, userPersonaRole, isLicensingModel2025: isLicensingModel2025Prop, tenantsValueMetricEnabled = false, hdpValueMetricsFor2025Enabled = false, permissionsReworkEnabled = false, urls, onNeedsReload, }) => {
567
550
  const runtime = useC4ConsoleRuntime();
568
551
  const designSystem = useC4DesignSystem();
569
552
  const hubNaming = useHubApiNaming();
@@ -965,6 +948,21 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
965
948
  const [audits, setAudits] = useState([]);
966
949
  const [auditsLoading, setAuditsLoading] = useState(false);
967
950
  const [auditsDownloading, setAuditsDownloading] = useState(false);
951
+ // Cluster creation defaults of the organization (#9732). They come from
952
+ // the organization metadata, thus accounts serves them, and console reads
953
+ // the same record when it creates a cluster.
954
+ const [clusterDefaults, setClusterDefaults] = useState({});
955
+ const [clusterDefaultsLoading, setClusterDefaultsLoading] = useState(false);
956
+ // The organization that the record above belongs to. This widget stays
957
+ // mounted when `orgId` changes, thus without it a late answer of the
958
+ // organization before could land in the page of the one now — and a save
959
+ // would write the value of the first into the second.
960
+ const clusterDefaultsOrgRef = useRef(undefined);
961
+ const [clusterDefaultsError, setClusterDefaultsError] = useState(undefined);
962
+ // A failed save is its own state. It must not make the tab read-only:
963
+ // the member changes nothing about the reason, thus the only way on is
964
+ // to try again.
965
+ const [clusterDefaultsSaveError, setClusterDefaultsSaveError] = useState(undefined);
968
966
  const [llmUsage, setLlmUsage] = useState(undefined);
969
967
  const [llmUsageLoading, setLlmUsageLoading] = useState(false);
970
968
  const [llmUsageError, setLlmUsageError] = useState(false);
@@ -2036,6 +2034,9 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
2036
2034
  usageTenantPerCluster,
2037
2035
  ]);
2038
2036
  const canReadActivity = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'activity', 'read']), [org]);
2037
+ const clusterDefaultsTabEnabled = useC4FeatureFlag(ORG_CLUSTER_DEFAULTS_FLAG);
2038
+ // The same permission that the accounts route asks for on the write.
2039
+ const canChangeOrgSettings = useMemo(() => getNestedBoolean(org, ['permissions', 'org', 'settings', 'update']), [org]);
2039
2040
  const loadAudits = useCallback(async (opts) => {
2040
2041
  if (!canReadActivity) {
2041
2042
  setAudits([]);
@@ -2163,6 +2164,63 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
2163
2164
  members,
2164
2165
  org?.name,
2165
2166
  ]);
2167
+ const loadClusterDefaults = useCallback(async () => {
2168
+ clusterDefaultsOrgRef.current = orgId;
2169
+ setClusterDefaultsLoading(true);
2170
+ setClusterDefaultsError(undefined);
2171
+ try {
2172
+ const data = await OrgsService.getOrgClusterDefaults({
2173
+ config: apiConfig,
2174
+ params: { orgId },
2175
+ });
2176
+ if (clusterDefaultsOrgRef.current !== orgId) {
2177
+ return;
2178
+ }
2179
+ setClusterDefaults(data.defaults);
2180
+ }
2181
+ catch {
2182
+ if (clusterDefaultsOrgRef.current !== orgId) {
2183
+ return;
2184
+ }
2185
+ setClusterDefaultsError('The settings could not be loaded. Reload the page to try again.');
2186
+ }
2187
+ finally {
2188
+ if (clusterDefaultsOrgRef.current === orgId) {
2189
+ setClusterDefaultsLoading(false);
2190
+ }
2191
+ }
2192
+ }, [apiConfig, orgId]);
2193
+ // `C4Tabs` calls `initializeTab` once per mounted tab id, and this widget
2194
+ // stays mounted when `orgId` changes, thus the tab would keep the record
2195
+ // of the organization before. The load belongs to the organization, not
2196
+ // to the first render of the tab.
2197
+ useEffect(() => {
2198
+ setClusterDefaults({});
2199
+ setClusterDefaultsError(undefined);
2200
+ setClusterDefaultsSaveError(undefined);
2201
+ if (clusterDefaultsTabEnabled && canChangeOrgSettings) {
2202
+ void loadClusterDefaults();
2203
+ }
2204
+ }, [
2205
+ orgId,
2206
+ clusterDefaultsTabEnabled,
2207
+ canChangeOrgSettings,
2208
+ loadClusterDefaults,
2209
+ ]);
2210
+ const saveClusterDefaults = useCallback(async (defaults) => {
2211
+ setClusterDefaultsSaveError(undefined);
2212
+ try {
2213
+ const saved = await OrgsService.updateOrgClusterDefaults({
2214
+ config: apiConfig,
2215
+ params: { orgId },
2216
+ body: { defaults },
2217
+ });
2218
+ setClusterDefaults(saved.defaults);
2219
+ }
2220
+ catch (error) {
2221
+ setClusterDefaultsSaveError(clientErrorMessage(error));
2222
+ }
2223
+ }, [apiConfig, orgId]);
2166
2224
  const loadLlmUsage = useCallback(async () => {
2167
2225
  setLlmUsageLoading(true);
2168
2226
  setLlmUsageError(false);
@@ -3172,6 +3230,16 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
3172
3230
  void loadApiClients();
3173
3231
  },
3174
3232
  },
3233
+ {
3234
+ id: 'clusterDefaults',
3235
+ label: getTabLabel(legacyTabs, 'clusterDefaults', tabTitle('clusterDefaults')),
3236
+ // Flagged, and shown to the members that may change the settings of
3237
+ // the organization. Reading alone has no value here: the tab holds
3238
+ // the values that the next cluster starts with, and a member that
3239
+ // cannot change them reads the same values on the cluster itself.
3240
+ visible: clusterDefaultsTabEnabled && canChangeOrgSettings,
3241
+ component: (_jsx(C4ManagementClusterDefaultsTab, { defaults: clusterDefaults, loading: clusterDefaultsLoading, error: clusterDefaultsError, saveError: clusterDefaultsSaveError, permissions: { mayChange: canChangeOrgSettings }, onSave: saveClusterDefaults })),
3242
+ },
3175
3243
  {
3176
3244
  id: 'settings',
3177
3245
  label: getTabLabel(legacyTabs, 'settings', tabTitle('settings')),
@@ -3264,6 +3332,14 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
3264
3332
  }, [
3265
3333
  activityProps,
3266
3334
  canReadActivity,
3335
+ canChangeOrgSettings,
3336
+ clusterDefaults,
3337
+ clusterDefaultsError,
3338
+ clusterDefaultsSaveError,
3339
+ clusterDefaultsLoading,
3340
+ clusterDefaultsTabEnabled,
3341
+ loadClusterDefaults,
3342
+ saveClusterDefaults,
3267
3343
  apiClientPermissions.canRead,
3268
3344
  apiTabProps,
3269
3345
  aiUsageProps,
@@ -3415,7 +3491,7 @@ export const C4ManagementApp = observer(({ orgId, desiredTabId, onTabChange, onN
3415
3491
  finally {
3416
3492
  setSettingsLoading(false);
3417
3493
  }
3418
- } }), isExtendModalOpen && (_jsx(C4ExtendTrialModal, { isOpen: isExtendModalOpen, onClose: () => setIsExtendModalOpen(false), onSubmit: submitExtendTrial, isSubmitting: isExtendSubmitting, error: extendError })), _jsx(C4ManagementPage, { loading: loading, notFound: notFound, tabs: {
3494
+ } }), isExtendModalOpen && (_jsx(C4ExtendTrialModal, { isOpen: isExtendModalOpen, onClose: () => setIsExtendModalOpen(false), onSubmit: submitExtendTrial, isSubmitting: isExtendSubmitting, error: extendError })), _jsx(C4ManagementPage, { loading: loading, notFound: notFound, embedded: embedded, tabs: {
3419
3495
  list: mergedTabs,
3420
3496
  desiredTabId: activeTabId,
3421
3497
  onChange: (tabId) => {
@@ -43,6 +43,12 @@ export type C4ManagementNavigateEvent = {
43
43
  };
44
44
  export interface C4ManagementAppProps {
45
45
  orgId: string;
46
+ /**
47
+ * When true, the host owns the outer page chrome. This removes the widget
48
+ * title in both design systems and its page padding in DS mode. Defaults to
49
+ * false.
50
+ */
51
+ embedded?: boolean;
46
52
  desiredTabId?: string;
47
53
  onTabChange?: (tabId: string) => void;
48
54
  onNavigate?: (event: C4ManagementNavigateEvent) => void;
@@ -1,3 +1,3 @@
1
1
  import type { JSX } from 'react';
2
2
  import type { C4ManagementPageProps } from './c4-management-page.types.js';
3
- export declare const C4ManagementPage: ({ loading, notFound, tabs, }: C4ManagementPageProps) => JSX.Element;
3
+ export declare const C4ManagementPage: ({ loading, notFound, embedded, tabs, }: C4ManagementPageProps) => JSX.Element;
@@ -2,16 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { C4PageTemplate } from '../../components/c4-page-template/c4-page-template.js';
3
3
  import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
4
4
  import { TabsSkeleton } from '../../ui/index.js';
5
- function safeTranslate(t, key, fallback) {
6
- try {
7
- const translated = t?.(key);
8
- return translated && translated !== key ? translated : fallback;
9
- }
10
- catch {
11
- return fallback;
12
- }
13
- }
14
- export const C4ManagementPage = ({ loading, notFound, tabs, }) => {
5
+ import { safeTranslate } from '../../utils/safe-translate.js';
6
+ export const C4ManagementPage = ({ loading, notFound, embedded = false, tabs, }) => {
15
7
  const runtime = useC4ConsoleRuntime();
16
8
  const t = runtime.i18n?.t;
17
9
  if (notFound) {
@@ -20,9 +12,11 @@ export const C4ManagementPage = ({ loading, notFound, tabs, }) => {
20
12
  if (loading) {
21
13
  return _jsx(TabsSkeleton, {}, 'tabs-skeleton');
22
14
  }
23
- return (_jsx(C4PageTemplate, { header: {
24
- title: safeTranslate(t, 'c4console:orgManagement.title', 'Organization management'),
25
- }, tabs: {
15
+ return (_jsx(C4PageTemplate, { header: embedded
16
+ ? undefined
17
+ : {
18
+ title: safeTranslate(t, 'c4console:orgManagement.title', 'Organization management'),
19
+ }, padding: embedded ? 'none' : 'default', tabs: {
26
20
  list: tabs.list,
27
21
  desiredTabId: tabs.desiredTabId,
28
22
  onChange: tabs.onChange,
@@ -3,6 +3,7 @@ export type C4ManagementTab = C4TabProps;
3
3
  export interface C4ManagementPageProps {
4
4
  loading: boolean;
5
5
  notFound?: boolean;
6
+ embedded?: boolean;
6
7
  tabs: {
7
8
  list: C4ManagementTab[];
8
9
  desiredTabId?: string;
@@ -1,4 +1,4 @@
1
- export type ManagementTabId = 'overview' | 'users' | 'groups' | 'activity' | 'usage' | 'aiUsage' | 'billing' | 'pricing' | 'api' | 'settings';
1
+ export type ManagementTabId = 'overview' | 'users' | 'groups' | 'activity' | 'usage' | 'aiUsage' | 'billing' | 'pricing' | 'api' | 'clusterDefaults' | 'settings';
2
2
  export interface ManagementTabDescriptor {
3
3
  id: ManagementTabId;
4
4
  /** i18n key (namespaced, e.g. `orgmanagement:tabs.overview.title`). */
@@ -60,6 +60,11 @@ export const MANAGEMENT_TABS = [
60
60
  titleKey: 'orgmanagement:tabs.api.title',
61
61
  titleFallback: 'Administration API',
62
62
  },
63
+ {
64
+ id: 'clusterDefaults',
65
+ titleKey: 'orgmanagement:tabs.clusterDefaults.title',
66
+ titleFallback: 'Cluster defaults',
67
+ },
63
68
  {
64
69
  id: 'settings',
65
70
  titleKey: 'orgmanagement:tabs.settings.title',
@@ -6,6 +6,7 @@ import { C4ManagementApi } from '../../../components/c4-management-api/c4-manage
6
6
  import { C4StructuredListBody, C4StructuredListCell, C4StructuredListRow, C4StructuredListWrapper, } from '../../../components/c4-structured-list/c4-structured-list.js';
7
7
  import { useHubApiNaming } from '../../../runtime/use-hub-api-naming.js';
8
8
  import { Form, Link, Modal, Stack, TextInput } from '../../../ui/index.js';
9
+ import { safeTranslate } from '../../../utils/safe-translate.js';
9
10
  // Helper functions
10
11
  function isApiClientNameValid(name) {
11
12
  if (!name.trim()) {
@@ -38,19 +39,6 @@ function joinUrl(baseUrl, path) {
38
39
  function toAudienceFromApiBaseUrl(apiBaseUrl) {
39
40
  return apiBaseUrl.replace(/^https?:\/\//, '');
40
41
  }
41
- function safeTranslate(t, key, defaultValue,
42
- // biome-ignore lint/suspicious/noExplicitAny: legacy compatibility
43
- opts) {
44
- if (!t)
45
- return defaultValue;
46
- try {
47
- const translated = t(key, opts);
48
- return typeof translated === 'string' ? translated : defaultValue;
49
- }
50
- catch {
51
- return defaultValue;
52
- }
53
- }
54
42
  function renderInlineLink0(value, renderLink) {
55
43
  const match = value.match(/^(.*)<0>(.*)<\/0>(.*)$/);
56
44
  if (!match)
@@ -9,15 +9,7 @@ import { useState } from 'react';
9
9
  import { C4BillingPage } from '../../../components/c4-billing-page/c4-billing-page.js';
10
10
  import { C4UsageAlertUpdateModal } from '../../../components/c4-usage-alert-update-modal/c4-usage-alert-update-modal.js';
11
11
  import { Modal, Stack } from '../../../ui/index.js';
12
- function safeTranslate(t, key, fallback, options) {
13
- try {
14
- const translated = t?.(key, options);
15
- return translated && translated !== key ? translated : fallback;
16
- }
17
- catch {
18
- return fallback;
19
- }
20
- }
12
+ import { safeTranslate } from '../../../utils/safe-translate.js';
21
13
  function formatDate(date) {
22
14
  try {
23
15
  return Intl.DateTimeFormat('en-GB', {
@@ -0,0 +1,5 @@
1
+ import type { JSX } from 'react';
2
+ import type { C4OrgClusterDefaultsProps } from '../../../components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.js';
3
+ export interface C4ManagementClusterDefaultsTabProps extends C4OrgClusterDefaultsProps {
4
+ }
5
+ export declare const C4ManagementClusterDefaultsTab: (props: C4ManagementClusterDefaultsTabProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { C4OrgClusterDefaults } from '../../../components/c4-org-cluster-defaults/c4-org-cluster-defaults.js';
3
+ export const C4ManagementClusterDefaultsTab = (props) => {
4
+ return _jsx(C4OrgClusterDefaults, { ...props });
5
+ };
@@ -8,19 +8,7 @@ import { Edit } from '@carbon/react/icons/index.esm.js';
8
8
  import { useMemo, useState } from 'react';
9
9
  import { C4ManagementOverview } from '../../../components/c4-management-overview/c4-management-overview.js';
10
10
  import { Modal, Stack, TextInput } from '../../../ui/index.js';
11
- function safeTranslate(t, key, defaultValue,
12
- // biome-ignore lint/suspicious/noExplicitAny: legacy compatibility
13
- opts) {
14
- if (!t)
15
- return defaultValue;
16
- try {
17
- const translated = t(key, opts);
18
- return typeof translated === 'string' ? translated : defaultValue;
19
- }
20
- catch {
21
- return defaultValue;
22
- }
23
- }
11
+ import { safeTranslate } from '../../../utils/safe-translate.js';
24
12
  export const C4ManagementOverviewTab = ({ orgId, orgName, salesPlan, ownerName, loading, trialExpirationLabel, mayRename, t, onRenameOrg, onExtendTrial, }) => {
25
13
  const [renameModalOpen, setRenameModalOpen] = useState(false);
26
14
  const [renameValue, setRenameValue] = useState('');
@@ -8,14 +8,7 @@ import { getDisplayedSalesPlan, } from '@camunda/ccma-shared-types';
8
8
  import { useMemo } from 'react';
9
9
  import { C4Pricing } from '../../../components/c4-pricing/c4-pricing.js';
10
10
  import { DefinitionTooltip, Link } from '../../../ui/index.js';
11
- function safeTranslate(t, key, fallback, options) {
12
- try {
13
- return t ? t(key, options) : fallback;
14
- }
15
- catch {
16
- return fallback;
17
- }
18
- }
11
+ import { safeTranslate } from '../../../utils/safe-translate.js';
19
12
  function getRecord(record, key) {
20
13
  const value = record[key];
21
14
  return value && typeof value === 'object' ? value : undefined;
@@ -8,30 +8,7 @@ import { PSClickWrap } from '@pactsafe/pactsafe-react-sdk';
8
8
  import { useState } from 'react';
9
9
  import { C4ManagementSettings } from '../../../components/c4-management-settings/c4-management-settings.js';
10
10
  import { Modal, Stack } from '../../../ui/index.js';
11
- function safeTranslate(t, key, defaultValue,
12
- // biome-ignore lint/suspicious/noExplicitAny: legacy compatibility
13
- opts) {
14
- if (!t)
15
- return defaultValue;
16
- try {
17
- const translated = t(key, opts);
18
- if (typeof translated !== 'string' || !translated || translated === key) {
19
- return defaultValue;
20
- }
21
- // i18next can return the key *without* the namespace when the namespace is missing.
22
- // Example: `orgmanagement:clickwrap.title` -> `clickwrap.title`
23
- if (key.includes(':')) {
24
- const withoutNamespace = key.split(':').slice(1).join(':');
25
- if (translated === withoutNamespace) {
26
- return defaultValue;
27
- }
28
- }
29
- return translated;
30
- }
31
- catch {
32
- return defaultValue;
33
- }
34
- }
11
+ import { safeTranslate } from '../../../utils/safe-translate.js';
35
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, }) => {
36
13
  const [clickwrapOpen, setClickwrapOpen] = useState(false);
37
14
  const [clickwrapGroupKey, setClickwrapGroupKey] = useState(undefined);
@@ -11,19 +11,7 @@ import { C4InviteUserToOrganizationModal } from '../../../components/c4-invite-u
11
11
  import { C4ManagementUsers } from '../../../components/c4-management-users/c4-management-users.js';
12
12
  import { Checkbox, Link, Modal, Stack, TextInput } from '../../../ui/index.js';
13
13
  import { isLegacyLabeledRole, isRoleAssignable, legacySectionRoles, moreRolesHeadingText, orderPrimaryRoles, roleLabelDescription, } from '../../../utils/role-labels.js';
14
- function safeTranslate(t, key, defaultValue, opts) {
15
- if (!t)
16
- return defaultValue;
17
- try {
18
- const translated = t(key, opts);
19
- return typeof translated === 'string' && translated !== key
20
- ? translated
21
- : defaultValue;
22
- }
23
- catch {
24
- return defaultValue;
25
- }
26
- }
14
+ import { safeTranslate } from '../../../utils/safe-translate.js';
27
15
  export const C4ManagementUsersTab = ({ orgId, members, loading, mayManageUsersActions, mayInviteUsers, mayAssignNewOwner, showLegacyClusterRoles = false, permissionsReworkEnabled = false, inviteModal, changeRolesModal, currentUserEmail, onNavigateToUser, t, telemetry, onRemoveUser, onInviteUser, onResendInvite, onCancelInvite, onAssignNewOwner, onUpdateUserRoles, }) => {
28
16
  const trackEvent = (eventName, message, meta) => {
29
17
  telemetry?.track?.(eventName, {
@@ -2,9 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { UsersService } from '@camunda/ccma-api';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import { useMemo } from 'react';
5
- import { C4DeleteAccountModal, safeTranslate, } from '../../components/c4-delete-account-modal/c4-delete-account-modal.js';
5
+ import { C4DeleteAccountModal } from '../../components/c4-delete-account-modal/c4-delete-account-modal.js';
6
6
  import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
7
7
  import { toApiConfig } from '../../runtime/to-api-config.js';
8
+ import { safeTranslate } from '../../utils/safe-translate.js';
8
9
  import { useDeleteAccountEligibility } from './use-delete-account-eligibility.js';
9
10
  /**
10
11
  * Whether the request was refused with 403.
@@ -19,18 +19,10 @@ import { toApiConfig } from '../../runtime/to-api-config.js';
19
19
  import { toIdentityApiBaseUrl } from '../../runtime/to-identity-api-base-url.js';
20
20
  import { Checkbox, Link, Modal, Stack, TextInput } from '../../ui/index.js';
21
21
  import { isLegacyLabeledRole, isRoleAssignable, legacySectionRoles, moreRolesHeadingText, orderPrimaryRoles, roleLabelDescription, } from '../../utils/role-labels.js';
22
+ import { safeTranslate } from '../../utils/safe-translate.js';
22
23
  function isRecord(value) {
23
24
  return Boolean(value) && typeof value === 'object';
24
25
  }
25
- function safeTranslate(t, key, fallback) {
26
- try {
27
- const translated = t?.(key);
28
- return translated && translated !== key ? translated : fallback;
29
- }
30
- catch {
31
- return fallback;
32
- }
33
- }
34
26
  function sendNavigate(onNavigate, event) {
35
27
  onNavigate?.(event);
36
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -96,8 +96,8 @@
96
96
  "react-markdown": "^8.0.7 || ^10.0.0"
97
97
  },
98
98
  "dependencies": {
99
- "@camunda/ccma-api": "1.1.0",
100
- "@camunda/ccma-shared-types": "1.1.0",
99
+ "@camunda/ccma-api": "2.0.0",
100
+ "@camunda/ccma-shared-types": "2.0.0",
101
101
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
102
102
  "cron-parser": "5.10.0",
103
103
  "mobx": "6.16.1",
@@ -1,14 +0,0 @@
1
- import type { JSX, ReactNode } from 'react';
2
- export interface OptionalTelemetryToggleProps {
3
- enabled: boolean;
4
- action: {
5
- label: string;
6
- onClick: () => void;
7
- disabled?: boolean;
8
- };
9
- description: ReactNode;
10
- permissions: {
11
- mayChange: boolean;
12
- };
13
- }
14
- export declare const OptionalTelemetryToggle: (props: OptionalTelemetryToggleProps) => JSX.Element;
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { C4Toggle } from '../../c4-toggle/c4-toggle.js';
3
- export const OptionalTelemetryToggle = (props) => {
4
- const component = (_jsx(C4Toggle, { id: 'optional-telemetry-toggle', supported: true, enabled: props.enabled, title: props.action.label, notices: [
5
- {
6
- notice: props.description,
7
- },
8
- ], onClick: props.action.onClick, permissions: {
9
- mayToggle: props.permissions.mayChange && !props.action.disabled,
10
- } }));
11
- return component;
12
- };