@camunda/ccma-saas-frontend 0.9.0 → 0.11.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 (29) hide show
  1. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  2. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +17 -8
  3. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +8 -0
  4. package/lib/esm/components/c4-help-center/c4-help-center.d.ts +9 -1
  5. package/lib/esm/components/c4-help-center/c4-help-center.js +34 -4
  6. package/lib/esm/components/c4-help-center/help-center-app-host.d.ts +23 -0
  7. package/lib/esm/components/c4-help-center/help-center-app-host.js +69 -0
  8. package/lib/esm/components/c4-help-center/help-center-placeholders.d.ts +26 -0
  9. package/lib/esm/components/c4-help-center/help-center-placeholders.js +49 -0
  10. package/lib/esm/components/c4-navigation/c4-navigation.d.ts +12 -0
  11. package/lib/esm/components/c4-navigation/c4-navigation.js +2 -2
  12. package/lib/esm/i18n/en/pages/clusterdetails.json +1 -0
  13. package/lib/esm/i18n/en/pages/clusters.json +1 -0
  14. package/lib/esm/index.d.ts +3 -1
  15. package/lib/esm/index.js +2 -1
  16. package/lib/esm/runtime/c4-console-runtime-context.d.ts +20 -3
  17. package/lib/esm/runtime/c4-console-runtime-context.js +144 -4
  18. package/lib/esm/runtime/c4-console-runtime.types.d.ts +22 -0
  19. package/lib/esm/runtime/cluster-creation-blocked.d.ts +16 -0
  20. package/lib/esm/runtime/cluster-creation-blocked.js +21 -0
  21. package/lib/esm/runtime/index.d.ts +1 -1
  22. package/lib/esm/runtime/index.js +1 -1
  23. package/lib/esm/runtime/use-hub-api-naming.d.ts +15 -7
  24. package/lib/esm/runtime/use-hub-api-naming.js +16 -8
  25. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +30 -10
  26. package/lib/esm/widgets/clusters/c4-clusters-page.js +28 -4
  27. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +2 -0
  28. package/lib/esm/widgets/dashboard/c4-dashboard-app.js +9 -6
  29. package/package.json +3 -3
@@ -1,3 +1,3 @@
1
1
  import { type JSX } from 'react';
2
2
  import type { C4ClusterListProps } from './c4-cluster-list.types.js';
3
- export declare const C4ClusterList: ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isRunningOnUnsupportedGeneration, scope, }: C4ClusterListProps) => JSX.Element;
3
+ export declare const C4ClusterList: ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration, scope, }: C4ClusterListProps) => JSX.Element;
@@ -37,7 +37,7 @@ function isPlainLeftClick(event) {
37
37
  !event.ctrlKey &&
38
38
  !event.shiftKey);
39
39
  }
40
- export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isRunningOnUnsupportedGeneration, scope = 'cluster', }) => {
40
+ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate, onDeleteCluster, onAssignTag, onWakeCluster, onFailoverCluster, trialNotification, encryptionNotification, clusterCapMessage, emptyStateContent, translations, isClusterPaused, isMultiRegionCluster, isFailoverSyncPending, isFailoverSource, isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration, scope = 'cluster', }) => {
41
41
  const designSystem = useC4DesignSystem();
42
42
  const isDsMode = designSystem === 'ds';
43
43
  const tableContainerRef = useRef(null);
@@ -359,15 +359,24 @@ export const C4ClusterList = ({ clusters, loading, urls, permissions, onNavigate
359
359
  const actions = [
360
360
  {
361
361
  id: 'wake-cluster',
362
- // A failed-over source cluster stays visible in the list (so it can
363
- // still be inspected) but can never be resumed — the label explains why.
364
- label: (row) => isFailoverSource?.(row.id)
365
- ? (translations.overflowMenu.resumeUnavailableFailoverSource ??
366
- 'Resume (unavailable — this cluster was failed over)')
367
- : translations.overflowMenu.resume,
362
+ // A failed-over source cluster and a cluster on a retired alpha
363
+ // generation stay in the list, so they can still be inspected. Neither
364
+ // can resume again, and the label gives the reason.
365
+ label: (row) => {
366
+ if (isFailoverSource?.(row.id)) {
367
+ return (translations.overflowMenu.resumeUnavailableFailoverSource ??
368
+ 'Resume (unavailable — this cluster was failed over)');
369
+ }
370
+ if (isOnRetiredAlphaGeneration?.(row.id)) {
371
+ return (translations.overflowMenu.resumeUnavailableRetiredAlpha ??
372
+ 'Resume (unavailable — this generation has a known defect)');
373
+ }
374
+ return translations.overflowMenu.resume;
375
+ },
368
376
  kind: 'ghost',
369
377
  onClick: (row) => onWakeCluster(row.id),
370
- disabled: (row) => isFailoverSource?.(row.id) ?? false,
378
+ disabled: (row) => (isFailoverSource?.(row.id) ?? false) ||
379
+ (isOnRetiredAlphaGeneration?.(row.id) ?? false),
371
380
  visible: (row) => isClusterPaused(row.id) && permissions.canWakeCluster,
372
381
  },
373
382
  ...(onFailoverCluster && isMultiRegionCluster
@@ -74,6 +74,8 @@ export interface C4ClusterListProps {
74
74
  resume: string;
75
75
  /** Shown as the action label for a cluster that was failed over and can never be resumed. */
76
76
  resumeUnavailableFailoverSource?: string;
77
+ /** Shown as the action label for a cluster on a retired alpha generation, which can never be resumed. */
78
+ resumeUnavailableRetiredAlpha?: string;
77
79
  failover?: string;
78
80
  /** Shown as the action label while the initial secondary bucket sync is pending. */
79
81
  failoverSyncPending?: string;
@@ -96,5 +98,11 @@ export interface C4ClusterListProps {
96
98
  isFailoverSyncPending?: (clusterId: string) => boolean;
97
99
  /** True for a cluster that was failed over to a sibling — it can never be resumed. */
98
100
  isFailoverSource?: (clusterId: string) => boolean;
101
+ /**
102
+ * True for a cluster on a prerelease generation under
103
+ * `RESUME_ALPHA_MIN_VERSION` — it can never be resumed. The console-backend
104
+ * refuses the wake-up for the same cohort.
105
+ */
106
+ isOnRetiredAlphaGeneration?: (clusterId: string) => boolean;
99
107
  isRunningOnUnsupportedGeneration: (clusterId: string) => boolean;
100
108
  }
@@ -1,5 +1,6 @@
1
1
  import { type JSX } from 'react';
2
2
  import { type C4FeedbackPayload } from '../c4-feedback-modal/c4-feedback-modal.js';
3
+ import { type C4HelpCenterLinkPlaceholders } from './help-center-placeholders.js';
3
4
  /** Reserved tab ID for the inline feedback form. */
4
5
  export declare const FEEDBACK_TAB_ID = "feedback";
5
6
  export interface C4HelpCenterTile {
@@ -46,5 +47,12 @@ export interface C4HelpCenterProps {
46
47
  * directly to the feedback tab (e.g. from `openHelpCenter('feedback')`).
47
48
  */
48
49
  initialTabId?: string;
50
+ /**
51
+ * Values for the placeholder tokens that the CMS writes into tile and link
52
+ * URLs (`{cloudAudience}`, `{currentOrgId}`, `{clusterId}`, `{email}`). A
53
+ * link that still holds a token after the replacement does not work, thus
54
+ * this component hides it.
55
+ */
56
+ linkPlaceholders?: C4HelpCenterLinkPlaceholders;
49
57
  }
50
- export declare function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, onSubmitFeedback, feedbackEnterprise, initialTabId, }: C4HelpCenterProps): JSX.Element;
58
+ export declare function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, onSubmitFeedback, feedbackEnterprise, initialTabId, linkPlaceholders, }: C4HelpCenterProps): JSX.Element;
@@ -8,10 +8,13 @@ import { Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHead
8
8
  import { ArrowRight, ExternalLink, MessageSquare } from 'lucide-react';
9
9
  import { useEffect, useState } from 'react';
10
10
  import ReactMarkdown from 'react-markdown';
11
+ import { useC4ConsoleStage, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
11
12
  import { C4FeedbackForm, } from '../c4-feedback-modal/c4-feedback-modal.js';
13
+ import { HUB_HELP_CENTER_LINKS_FLAG, isHubLinkStage, rewriteAppHostToHub, } from './help-center-app-host.js';
14
+ import { hasUnresolvedHelpCenterPlaceholder, resolveHelpCenterPlaceholders, } from './help-center-placeholders.js';
12
15
  /** Reserved tab ID for the inline feedback form. */
13
16
  export const FEEDBACK_TAB_ID = 'feedback';
14
- export function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, onSubmitFeedback, feedbackEnterprise, initialTabId, }) {
17
+ export function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, onSubmitFeedback, feedbackEnterprise, initialTabId, linkPlaceholders, }) {
15
18
  const [activeTabId, setActiveTabId] = useState('');
16
19
  // Set the active tab when the modal opens/closes or initialTabId changes.
17
20
  useEffect(() => {
@@ -23,7 +26,32 @@ export function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, o
23
26
  setActiveTabId(initialTabId);
24
27
  }
25
28
  }, [open, initialTabId]);
26
- const tabs = data?.tabs ?? [];
29
+ // Camunda Hub serves the org-scoped routes of Console and Web Modeler, but
30
+ // the CMS still writes the host of the old app into its links. Where Hub is
31
+ // live, every link of this panel goes to it — the stage of the host decides,
32
+ // and a client with a flag system can widen that (see `help-center-app-host`).
33
+ const stage = useC4ConsoleStage();
34
+ const isHubLinkFlagOn = useC4FeatureFlag(HUB_HELP_CENTER_LINKS_FLAG);
35
+ const linksGoToHub = isHubLinkStage(stage) || isHubLinkFlagOn;
36
+ // The CMS gives every URL with its placeholder tokens in place. The tokens
37
+ // are resolved here, once, so that the render below reads one shape of URL.
38
+ const resolveUrl = (url) => {
39
+ const resolved = resolveHelpCenterPlaceholders(url, linkPlaceholders);
40
+ return linksGoToHub ? rewriteAppHostToHub(resolved) : resolved;
41
+ };
42
+ const tabs = (data?.tabs ?? []).map((tab) => ({
43
+ ...tab,
44
+ tiles: tab.tiles.map((tile) => ({
45
+ ...tile,
46
+ link: resolveUrl(tile.link),
47
+ })),
48
+ }));
49
+ const sidebarLinks = (data?.links ?? [])
50
+ .map((link) => ({
51
+ ...link,
52
+ link: resolveUrl(link.link) ?? '',
53
+ }))
54
+ .filter((link) => !hasUnresolvedHelpCenterPlaceholder(link.link));
27
55
  const hasFeedbackTab = !!onSubmitFeedback;
28
56
  const isActiveIdValid = (activeTabId === FEEDBACK_TAB_ID && hasFeedbackTab) ||
29
57
  tabs.some((t) => t.id === activeTabId);
@@ -31,10 +59,12 @@ export function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, o
31
59
  ? activeTabId
32
60
  : (tabs[0]?.id ?? '');
33
61
  const showFullUI = isLoading || tabs.length > 0 || hasFeedbackTab;
34
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: 'c4-ui flex flex-col gap-0 overflow-hidden overflow-y-hidden p-0', style: { maxWidth: 'min(900px, calc(100% - 2rem))', height: '80vh' }, children: showFullUI ? (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { className: 'flex-shrink-0 border-b px-6 py-4', children: _jsx(DialogTitle, { children: "Help Center" }) }), _jsxs(Tabs, { orientation: 'vertical', value: effectiveActiveTabId, onValueChange: (id) => setActiveTabId(id), className: 'flex min-h-0 flex-1 flex-row overflow-hidden', children: [_jsxs("div", { className: 'flex w-52 flex-shrink-0 flex-col overflow-hidden border-r', children: [_jsx("p", { className: 'px-5 pb-2 pt-4 text-xs font-semibold uppercase text-neutral-foreground-subtle', children: "Topics" }), isLoading ? (_jsx("div", { className: 'flex flex-col gap-2 px-3', children: [1, 2, 3].map((i) => (_jsx("div", { className: 'h-8 animate-pulse rounded bg-neutral-background-strong' }, i))) })) : (_jsxs(TabsList, { variant: 'line', className: 'h-auto w-full flex-col items-start gap-1 rounded-none bg-transparent px-3', children: [tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.id, className: 'w-full justify-start text-sm font-normal', children: tab.label }, tab.id))), hasFeedbackTab && tabs.length > 0 && (_jsx("div", { role: 'none', className: 'my-1 w-full px-2', children: _jsx("div", { className: 'h-px bg-border' }) })), hasFeedbackTab && (_jsxs(TabsTrigger, { value: FEEDBACK_TAB_ID, className: 'w-full justify-start gap-2 text-sm font-normal', children: [_jsx(MessageSquare, { className: 'size-4', "aria-hidden": true }), "Share your feedback"] }))] })), !isLoading && data?.links && data.links.length > 0 && (_jsx("div", { className: 'border-t px-3 py-2', children: data.links.map((link) => (_jsxs("a", { href: link.link, target: '_blank', rel: 'noopener noreferrer', className: 'flex items-center gap-1 px-2 py-1 text-xs text-neutral-foreground-subtle hover:underline', children: [link.label, _jsx(ExternalLink, { className: 'size-3', "aria-hidden": true })] }, link.id))) }))] }), isLoading ? (_jsx("div", { className: 'flex-1 p-6', children: _jsx("div", { className: 'grid grid-cols-2 gap-4', children: [1, 2, 3, 4].map((i) => (_jsx("div", { className: 'h-64 animate-pulse rounded-xl bg-neutral-background-strong' }, i))) }) })) : (_jsxs(ScrollArea, { className: 'flex-1', children: [tabs.map((tab) => (_jsx(TabsContent, { value: tab.id, className: 'mt-0 p-6', children: tab.tiles.length === 0 ? (_jsx("p", { className: 'text-sm text-neutral-foreground-subtle', children: "No content available." })) : (_jsx("div", { className: 'grid grid-cols-2 gap-4', children: tab.tiles.map((tile) => (_jsxs(Card, { className: 'flex flex-col', children: [tile.image && (_jsx("img", { src: tile.image, alt: '', className: 'h-32 w-full object-cover' })), _jsxs(CardHeader, { children: [_jsx(CardTitle, { className: 'text-sm', children: tile.title }), tile.timeToComplete && (_jsx(Badge, { variant: 'neutral', className: 'self-start text-xs', children: tile.timeToComplete }))] }), _jsx(CardContent, { className: 'flex-1', children: _jsx(CardDescription, { children: _jsx(ReactMarkdown, { components: {
62
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: 'c4-ui flex flex-col gap-0 overflow-hidden overflow-y-hidden p-0', style: { maxWidth: 'min(900px, calc(100% - 2rem))', height: '80vh' }, children: showFullUI ? (_jsxs(_Fragment, { children: [_jsx(DialogHeader, { className: 'flex-shrink-0 border-b px-6 py-4', children: _jsx(DialogTitle, { children: "Help Center" }) }), _jsxs(Tabs, { orientation: 'vertical', value: effectiveActiveTabId, onValueChange: (id) => setActiveTabId(id), className: 'flex min-h-0 flex-1 flex-row overflow-hidden', children: [_jsxs("div", { className: 'flex w-52 flex-shrink-0 flex-col overflow-hidden border-r', children: [_jsx("p", { className: 'px-5 pb-2 pt-4 text-xs font-semibold uppercase text-neutral-foreground-subtle', children: "Topics" }), isLoading ? (_jsx("div", { className: 'flex flex-col gap-2 px-3', children: [1, 2, 3].map((i) => (_jsx("div", { className: 'h-8 animate-pulse rounded bg-neutral-background-strong' }, i))) })) : (_jsxs(TabsList, { variant: 'line', className: 'h-auto w-full flex-col items-start gap-1 rounded-none bg-transparent px-3', children: [tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.id, className: 'w-full justify-start text-sm font-normal', children: tab.label }, tab.id))), hasFeedbackTab && tabs.length > 0 && (_jsx("div", { role: 'none', className: 'my-1 w-full px-2', children: _jsx("div", { className: 'h-px bg-border' }) })), hasFeedbackTab && (_jsxs(TabsTrigger, { value: FEEDBACK_TAB_ID, className: 'w-full justify-start gap-2 text-sm font-normal', children: [_jsx(MessageSquare, { className: 'size-4', "aria-hidden": true }), "Share your feedback"] }))] })), !isLoading && sidebarLinks.length > 0 && (_jsx("div", { className: 'border-t px-3 py-2', children: sidebarLinks.map((link) => (_jsxs("a", { href: link.link, target: '_blank', rel: 'noopener noreferrer', className: 'flex items-center gap-1 px-2 py-1 text-xs text-neutral-foreground-subtle hover:underline', children: [link.label, _jsx(ExternalLink, { className: 'size-3', "aria-hidden": true })] }, link.id))) }))] }), isLoading ? (_jsx("div", { className: 'flex-1 p-6', children: _jsx("div", { className: 'grid grid-cols-2 gap-4', children: [1, 2, 3, 4].map((i) => (_jsx("div", { className: 'h-64 animate-pulse rounded-xl bg-neutral-background-strong' }, i))) }) })) : (_jsxs(ScrollArea, { className: 'flex-1', children: [tabs.map((tab) => (_jsx(TabsContent, { value: tab.id, className: 'mt-0 p-6', children: tab.tiles.length === 0 ? (_jsx("p", { className: 'text-sm text-neutral-foreground-subtle', children: "No content available." })) : (_jsx("div", { className: 'grid grid-cols-2 gap-4', children: tab.tiles.map((tile) => (_jsxs(Card, { className: 'flex flex-col', children: [tile.image && (_jsx("img", { src: tile.image, alt: '', className: 'h-32 w-full object-cover' })), _jsxs(CardHeader, { children: [_jsx(CardTitle, { className: 'text-sm', children: tile.title }), tile.timeToComplete && (_jsx(Badge, { variant: 'neutral', className: 'self-start text-xs', children: tile.timeToComplete }))] }), _jsx(CardContent, { className: 'flex-1', children: _jsx(CardDescription, { children: _jsx(ReactMarkdown, { components: {
35
63
  p: ({ children }) => _jsx(_Fragment, { children: children }),
36
64
  a: ({ children, href }) => (_jsx("a", { href: href, target: '_blank', rel: 'noopener noreferrer', children: children })),
37
- }, children: tile.description }) }) }), tile.link && tile.cta && (_jsx(CardFooter, { children: _jsx(Button, { variant: 'secondary', size: 'sm', asChild: true, children: _jsxs("a", { href: tile.link, target: '_blank', rel: 'noopener noreferrer', children: [tile.cta, _jsx(ArrowRight, { className: 'ml-1 size-3', "aria-hidden": true })] }) }) }))] }, tile.card_id))) })) }, tab.id))), hasFeedbackTab && onSubmitFeedback && (_jsx(TabsContent, { value: FEEDBACK_TAB_ID, className: 'mt-0 p-6', children: _jsxs("div", { className: 'max-w-xl', children: [_jsx("p", { className: 'mb-4 text-sm text-neutral-foreground-subtle', children: "We actively use this information to fix problems and improve your experience with our products." }), _jsx(C4FeedbackForm, { onSubmit: onSubmitFeedback, isEnterprise: feedbackEnterprise, resetKey: open })] }) }))] }))] })] })) : (
65
+ }, children: tile.description }) }) }), tile.link &&
66
+ tile.cta &&
67
+ !hasUnresolvedHelpCenterPlaceholder(tile.link) && (_jsx(CardFooter, { children: _jsx(Button, { variant: 'secondary', size: 'sm', asChild: true, children: _jsxs("a", { href: tile.link, target: '_blank', rel: 'noopener noreferrer', children: [tile.cta, _jsx(ArrowRight, { className: 'ml-1 size-3', "aria-hidden": true })] }) }) }))] }, tile.card_id))) })) }, tab.id))), hasFeedbackTab && onSubmitFeedback && (_jsx(TabsContent, { value: FEEDBACK_TAB_ID, className: 'mt-0 p-6', children: _jsxs("div", { className: 'max-w-xl', children: [_jsx("p", { className: 'mb-4 text-sm text-neutral-foreground-subtle', children: "We actively use this information to fix problems and improve your experience with our products." }), _jsx(C4FeedbackForm, { onSubmit: onSubmitFeedback, isEnterprise: feedbackEnterprise, resetKey: open })] }) }))] }))] })] })) : (
38
68
  /* Fallback: simple link list when no CMS data and no feedback tab */
39
69
  _jsxs(_Fragment, { children: [_jsx(DialogHeader, { className: 'p-6', children: _jsx(DialogTitle, { children: "Help & support" }) }), _jsx("div", { className: 'flex flex-col gap-1 px-4', children: helpLinks &&
40
70
  helpLinks.map((link) => (_jsx(Button, { variant: 'ghost', className: 'w-full justify-between', asChild: true, children: _jsxs("a", { href: link.href, target: '_blank', rel: 'noopener noreferrer', children: [link.label, _jsx(ExternalLink, { className: 'size-3.5 text-neutral-foreground-subtle', "aria-hidden": true })] }) }, link.key))) })] })) }) }));
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Flag key that widens the Hub link rewrite past {@link HUB_LINK_STAGES}. A
3
+ * client with its own flag system can thus reach int or prod without a release
4
+ * of this package. Read through `useC4FeatureFlag`, which is off for a client
5
+ * that gives the runtime no `featureFlags`.
6
+ */
7
+ export declare const HUB_HELP_CENTER_LINKS_FLAG = "console.hubHelpCenterLinks";
8
+ /** True where Hub serves the org-scoped routes of Console and Web Modeler. */
9
+ export declare function isHubLinkStage(stage: string | undefined): boolean;
10
+ /**
11
+ * Sends a link of an org-scoped app to Camunda Hub. The CMS writes the host of
12
+ * the old app into its links, in either of its two forms
13
+ * (`https://console.<domain>/org/<id>/clusters`,
14
+ * `https://modeler.cloud.<domain>/...`), and both become
15
+ * `https://hub.<domain>/...`. The path does not change, because Hub serves the
16
+ * same path.
17
+ *
18
+ * A URL of another host, a relative URL, and a URL of a cluster-scoped app all
19
+ * come back unchanged. A `cloud.` label of another host also stays: only the
20
+ * app hosts move, and a service host such as `api.cloud.<domain>` or
21
+ * `helpcenter.cloud.<domain>` answers on the `cloud.` form alone.
22
+ */
23
+ export declare function rewriteAppHostToHub(url: string | undefined): string | undefined;
@@ -0,0 +1,69 @@
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
+ /**
7
+ * Flag key that widens the Hub link rewrite past {@link HUB_LINK_STAGES}. A
8
+ * client with its own flag system can thus reach int or prod without a release
9
+ * of this package. Read through `useC4FeatureFlag`, which is off for a client
10
+ * that gives the runtime no `featureFlags`.
11
+ */
12
+ export const HUB_HELP_CENTER_LINKS_FLAG = 'console.hubHelpCenterLinks';
13
+ /**
14
+ * Stages where Camunda Hub serves the org-scoped routes. Every client of this
15
+ * package gives `stage` in its runtime config, thus the default needs no work
16
+ * in a client and no flag system. Widen this set as the Hub rollout reaches int
17
+ * and prod, or use {@link HUB_HELP_CENTER_LINKS_FLAG} to widen one client
18
+ * sooner.
19
+ */
20
+ const HUB_LINK_STAGES = new Set([
21
+ 'dev',
22
+ 'devAws',
23
+ 'local',
24
+ 'localconsole',
25
+ 'localaccounts',
26
+ ]);
27
+ // Camunda Hub replaces the two org-scoped apps, Console and Web Modeler, and
28
+ // serves the routes of both under one host. The cluster-scoped apps (operate,
29
+ // tasklist, optimize, admin, identity) keep their own per-cluster hosts, thus
30
+ // this list holds two names and not every value of `CamundaWebApp`. `hub` is
31
+ // here for its own sake: a link that already names Hub still goes through the
32
+ // `cloud.` rule below.
33
+ const UNIFIED_APP_HOST_LABELS = ['console', 'modeler', 'hub'];
34
+ // Matches the scheme, the label of the app, an optional `cloud.` label, and the
35
+ // domain that follows. The `cloud.` label goes: Hub answers on `hub.<domain>`
36
+ // and on nothing else — `hub.cloud.<domain>` resolves in no environment — and
37
+ // the CMS writes both forms of the old host. The rest of the URL is kept as it
38
+ // is. A string replacement, not `new URL()`, because `URL` normalizes what it
39
+ // parses (it adds a path to a host-only URL, for example) and a CMS link must
40
+ // reach the browser as its author wrote it, minus the host.
41
+ const UNIFIED_APP_HOST_PATTERN = new RegExp(`^(https?://)(?:${UNIFIED_APP_HOST_LABELS.join('|')})\\.(?:cloud\\.)?([^/?#]+)`, 'i');
42
+ /** True where Hub serves the org-scoped routes of Console and Web Modeler. */
43
+ export function isHubLinkStage(stage) {
44
+ return stage !== undefined && HUB_LINK_STAGES.has(stage);
45
+ }
46
+ /**
47
+ * Sends a link of an org-scoped app to Camunda Hub. The CMS writes the host of
48
+ * the old app into its links, in either of its two forms
49
+ * (`https://console.<domain>/org/<id>/clusters`,
50
+ * `https://modeler.cloud.<domain>/...`), and both become
51
+ * `https://hub.<domain>/...`. The path does not change, because Hub serves the
52
+ * same path.
53
+ *
54
+ * A URL of another host, a relative URL, and a URL of a cluster-scoped app all
55
+ * come back unchanged. A `cloud.` label of another host also stays: only the
56
+ * app hosts move, and a service host such as `api.cloud.<domain>` or
57
+ * `helpcenter.cloud.<domain>` answers on the `cloud.` form alone.
58
+ */
59
+ export function rewriteAppHostToHub(url) {
60
+ if (!url) {
61
+ return url;
62
+ }
63
+ const match = UNIFIED_APP_HOST_PATTERN.exec(url);
64
+ if (!match) {
65
+ return url;
66
+ }
67
+ const [matchedHost, scheme, domain] = match;
68
+ return `${scheme}hub.${domain}${url.slice(matchedHost.length)}`;
69
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Values for the placeholder tokens that the help center CMS writes into tile
3
+ * and link URLs. A host that omits a value keeps the token in the URL, and
4
+ * {@link C4HelpCenter} then hides the link that uses it.
5
+ */
6
+ export interface C4HelpCenterLinkPlaceholders {
7
+ /**
8
+ * The domain the host puts in a link to another Camunda app — the `domain`
9
+ * value of `useC3UserConfiguration()`, which the c3 help center substitutes
10
+ * too. A host that gives c3 `noCloudInUrl` must remove the `cloud.` prefix
11
+ * here as well (`camunda.io`, not `cloud.camunda.io`), or a resolved link
12
+ * goes to a different host than the same link in carbon mode.
13
+ */
14
+ cloudAudience?: string;
15
+ currentOrgId?: string;
16
+ /** One cluster of the organization. The CMS links to a cluster page with it. */
17
+ clusterId?: string;
18
+ email?: string;
19
+ }
20
+ /**
21
+ * Replaces every placeholder token in `url` that `placeholders` gives a value
22
+ * for. A token without a value stays in the URL.
23
+ */
24
+ export declare function resolveHelpCenterPlaceholders(url: string | undefined, placeholders: C4HelpCenterLinkPlaceholders | undefined): string | undefined;
25
+ /** True when `url` still holds a placeholder token, and thus does not work. */
26
+ export declare function hasUnresolvedHelpCenterPlaceholder(url: string | undefined): boolean;
@@ -0,0 +1,49 @@
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
+ const PLACEHOLDERS = [
7
+ { key: 'cloudAudience', token: 'cloudAudience', encode: false },
8
+ { key: 'currentOrgId', token: 'currentOrgId', encode: false },
9
+ { key: 'clusterId', token: 'clusterId', encode: false },
10
+ { key: 'email', token: 'email', encode: true },
11
+ ];
12
+ // The CMS writes a token in one of two forms. A token in a path or in a query
13
+ // value can arrive percent-encoded (`%7BcurrentOrgId%7D`), because an editor
14
+ // tool encoded the URL that holds it. The case of a token is also not stable:
15
+ // production content has `{cloudaudience}` in the host of a link, next to
16
+ // `{currentOrgId}` in the path of the same link. One pattern thus matches both
17
+ // forms, in any case. The pattern is built for each use, because a `g` regex
18
+ // keeps its `lastIndex` between calls to `test`.
19
+ function tokenPattern(token) {
20
+ return new RegExp(`\\{${token}\\}|%7B${token}%7D`, 'gi');
21
+ }
22
+ /**
23
+ * Replaces every placeholder token in `url` that `placeholders` gives a value
24
+ * for. A token without a value stays in the URL.
25
+ */
26
+ export function resolveHelpCenterPlaceholders(url, placeholders) {
27
+ if (!url || !placeholders) {
28
+ return url;
29
+ }
30
+ let resolved = url;
31
+ for (const { key, token, encode } of PLACEHOLDERS) {
32
+ const value = placeholders[key];
33
+ if (value) {
34
+ const replacement = encode ? encodeURIComponent(value) : value;
35
+ // A function, not the string: `String.replace` reads `$&`, `$'` and `$1`
36
+ // in a replacement string as references to the match. A value goes into
37
+ // the URL as it is.
38
+ resolved = resolved.replace(tokenPattern(token), () => replacement);
39
+ }
40
+ }
41
+ return resolved;
42
+ }
43
+ /** True when `url` still holds a placeholder token, and thus does not work. */
44
+ export function hasUnresolvedHelpCenterPlaceholder(url) {
45
+ if (!url) {
46
+ return false;
47
+ }
48
+ return PLACEHOLDERS.some(({ token }) => tokenPattern(token).test(url));
49
+ }
@@ -2,6 +2,7 @@ import { type C3NavigationProps } from '@camunda/camunda-composite-components';
2
2
  import { type JSX, type ReactNode } from 'react';
3
3
  import type { C4FeedbackPayload } from '../c4-feedback-modal/c4-feedback-modal.js';
4
4
  import { type C4HelpCenterData } from '../c4-help-center/c4-help-center.js';
5
+ import type { C4HelpCenterLinkPlaceholders } from '../c4-help-center/help-center-placeholders.js';
5
6
  export type C4NavigationProps = C3NavigationProps & {
6
7
  /**
7
8
  * ds-mode only: navigate to a cluster by uuid (the Cluster dropdown). Carbon
@@ -51,5 +52,16 @@ export type C4NavigationProps = C3NavigationProps & {
51
52
  * and links for {@link C4HelpCenter}. Carbon mode ignores it.
52
53
  */
53
54
  onFetchHelpCenterData?: () => Promise<C4HelpCenterData | undefined>;
55
+ /**
56
+ * ds-mode only: values for the placeholder tokens that the CMS writes into
57
+ * help center URLs. See {@link C4HelpCenterLinkPlaceholders}.
58
+ *
59
+ * Carbon mode ignores it. The c3 help center does a smaller version of the
60
+ * same work — it replaces the exact, unencoded token in a card link — thus
61
+ * carbon mode resolves less: no other case of a token, no percent-encoded
62
+ * form, no sidebar link, and no Camunda Hub host. c3 is a public package
63
+ * this one does not change, thus the two modes are not equal here.
64
+ */
65
+ helpCenterLinkPlaceholders?: C4HelpCenterLinkPlaceholders;
54
66
  };
55
67
  export declare const C4Navigation: (props: C4NavigationProps) => JSX.Element;
@@ -126,7 +126,7 @@ export const C4Navigation = (props) => {
126
126
  .finally(() => setHelpCenterLoading(false));
127
127
  }, [designSystem, isHelpCenterOpen, helpCenterData, helpCenterLoading]);
128
128
  if (designSystem !== 'ds') {
129
- const { onSelectCluster: _onSelectCluster, helpLinks: _helpLinks, appElements: _appElements, onSubmitFeedback: _onSubmitFeedback, feedbackEnterprise: _feedbackEnterprise, onFetchHelpCenterData: _onFetchHelpCenterData, children, ...c3Props } = props;
129
+ const { onSelectCluster: _onSelectCluster, helpLinks: _helpLinks, appElements: _appElements, onSubmitFeedback: _onSubmitFeedback, feedbackEnterprise: _feedbackEnterprise, onFetchHelpCenterData: _onFetchHelpCenterData, helpCenterLinkPlaceholders: _helpCenterLinkPlaceholders, children, ...c3Props } = props;
130
130
  return (_jsxs(_Fragment, { children: [_jsx(C3Navigation, { ...c3Props }), children] }));
131
131
  }
132
132
  const { onSelectCluster, helpLinks, children } = props;
@@ -179,5 +179,5 @@ export const C4Navigation = (props) => {
179
179
  return (_jsx(TooltipProvider, { delayDuration: 0, children: _jsx(SidebarProvider, { children: _jsxs("div", { className: 'min-h-screen bg-background text-neutral-foreground-strong', children: [_jsx(AppHeader, { skipToContentTargetId: 'main-content', logo: logoButton, appName: appName, breadcrumb: breadcrumb, trailing: trailing, children: tagBadges }), _jsx(AppSidebar, { ariaLabel: 'Camunda apps', items: appItems }), _jsx("main", { id: 'main-content', tabIndex: -1, style: { marginLeft: 'var(--app-sidebar-width, 16rem)' }, children: children }), _jsx(C4HelpCenter, { open: isHelpCenterOpen, onOpenChange: (open) => {
180
180
  if (!open)
181
181
  setIsHelpCenterOpen(false);
182
- }, data: helpCenterData, isLoading: helpCenterLoading, helpLinks: helpLinks, onSubmitFeedback: props.onSubmitFeedback, feedbackEnterprise: props.feedbackEnterprise, initialTabId: showTabId === 'feedback' ? FEEDBACK_TAB_ID : undefined })] }) }) }));
182
+ }, data: helpCenterData, isLoading: helpCenterLoading, helpLinks: helpLinks, onSubmitFeedback: props.onSubmitFeedback, feedbackEnterprise: props.feedbackEnterprise, linkPlaceholders: props.helpCenterLinkPlaceholders, initialTabId: showTabId === 'feedback' ? FEEDBACK_TAB_ID : undefined })] }) }) }));
183
183
  };
@@ -373,6 +373,7 @@
373
373
  "label": "Status",
374
374
  "wakeLabel": "Resume cluster",
375
375
  "wakeDisabledFailoverSource": "This cluster was failed over and can no longer be resumed.",
376
+ "wakeDisabledRetiredAlpha": "This alpha generation is not supported anymore.",
376
377
  "sleepLabel": "Suspend cluster (internal)",
377
378
  "waitingForInputTooltip": "Waiting for external encryption to be configured",
378
379
  "wakeError": {
@@ -34,6 +34,7 @@
34
34
  "delete": "Delete",
35
35
  "resume": "Resume",
36
36
  "resumeUnavailableFailoverSource": "Resume (unavailable — this cluster was failed over)",
37
+ "resumeUnavailableRetiredAlpha": "Resume (unavailable — this generation has a known defect)",
37
38
  "failover": "Failover",
38
39
  "failoverSyncPending": "Failover (unavailable until backup data is synced to the secondary region)",
39
40
  "failoverAlreadyFailedOver": "Failover (unavailable — this cluster was already failed over)"
@@ -104,6 +104,8 @@ export type { C4FeedbackFormProps, C4FeedbackModalProps, C4FeedbackPayload, C4Fe
104
104
  export { C4FeedbackForm, C4FeedbackModal, } from './components/c4-feedback-modal/c4-feedback-modal.js';
105
105
  export type { C4HelpCenterData, C4HelpCenterLink, C4HelpCenterProps, C4HelpCenterTabData, C4HelpCenterTile, } from './components/c4-help-center/c4-help-center.js';
106
106
  export { C4HelpCenter, FEEDBACK_TAB_ID, } from './components/c4-help-center/c4-help-center.js';
107
+ export { HUB_HELP_CENTER_LINKS_FLAG, rewriteAppHostToHub, } from './components/c4-help-center/help-center-app-host.js';
108
+ export type { C4HelpCenterLinkPlaceholders } from './components/c4-help-center/help-center-placeholders.js';
107
109
  export { C4InfoTooltip } from './components/c4-info-tooltip/c4-info-tooltip.js';
108
110
  export type { C4InfoTooltipProps } from './components/c4-info-tooltip/c4-info-tooltip.types.js';
109
111
  export { C4InlineNotification } from './components/c4-inline-notification/c4-inline-notification.js';
@@ -202,7 +204,7 @@ export { openC4CreateConsoleApiClientModal, setC4CreateConsoleApiClientModalHand
202
204
  export { openC4InviteUserToOrganizationModal, setC4InviteUserToOrganizationModalHandle, } from './modals/c4-invite-user-to-organization-modal-handle.js';
203
205
  export { openC4RenameOrganizationModal, setC4RenameOrganizationModalHandle, } from './modals/c4-rename-organization-modal-handle.js';
204
206
  export type { AccountsPermissions, AddC4ConsoleNotificationOptions, C4BreadcrumbCrumb, C4BreadcrumbDropdownItem, C4ClusterNavAppEntry, C4ClusterNavEntry, C4ConsoleAuthzFeatures, C4ConsoleAuthzState, C4ConsoleDataState, C4ConsoleEventsProviderProps, C4ConsoleNotification, C4ConsoleNotificationAction, C4ConsoleNotificationKind, C4ConsoleNotificationsState, C4ConsoleRuntimeConfig, C4ConsoleVisibilities, C4ResolvedTheme, C4ThemePreference, C4UserNotificationsProviderProps, C4UserNotificationsState, C4UserThemeState, CacheState, CamundaWebApp, ConsoleAuth, ConsoleBackendUrls, ConsoleClickwrapConfig, ConsoleClusterDto, ConsolePermissions, ConsolePublicUrls, ConsoleStage, ConsoleTelemetry, ConsoleUser, ExternalClusterDto, ExternalOrganizationDto, NotificationDto, OrganizationPermissions, OrganizationRole, OrgCache, SseEntity, UpgradableGenerationsDto, UseC4ClusterNavEntriesOptions, UseC4WebappBreadcrumbDataOptions, } from './runtime/index.js';
205
- export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, } from './runtime/index.js';
207
+ export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4DesignSystem, useC4FeatureFlag, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, } from './runtime/index.js';
206
208
  export type { TranslateFn } from './utils/safe-translate.js';
207
209
  export { ENVIRONMENT_KEY_SUFFIX, safeTranslate, scopedTranslate, } from './utils/safe-translate.js';
208
210
  export type { C4WidgetScope } from './widgets/c4-widget-scope.types.js';
package/lib/esm/index.js CHANGED
@@ -56,6 +56,7 @@ export { C4ExtendTrialModal } from './components/c4-extend-trial-modal/c4-extend
56
56
  export { C4ExternalLink } from './components/c4-external-link/c4-external-link.js';
57
57
  export { C4FeedbackForm, C4FeedbackModal, } from './components/c4-feedback-modal/c4-feedback-modal.js';
58
58
  export { C4HelpCenter, FEEDBACK_TAB_ID, } from './components/c4-help-center/c4-help-center.js';
59
+ export { HUB_HELP_CENTER_LINKS_FLAG, rewriteAppHostToHub, } from './components/c4-help-center/help-center-app-host.js';
59
60
  export { C4InfoTooltip } from './components/c4-info-tooltip/c4-info-tooltip.js';
60
61
  export { C4InlineNotification } from './components/c4-inline-notification/c4-inline-notification.js';
61
62
  export { C4InviteUserToOrganizationModal } from './components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js';
@@ -114,7 +115,7 @@ export { openC4RenameOrganizationModal, setC4RenameOrganizationModalHandle, } fr
114
115
  // re-listed per module, so the package root and the
115
116
  // `@camunda/ccma-saas-frontend/runtime` subpath expose one identical surface.
116
117
  // Add runtime exports in `src/runtime/index.ts` and mirror them here.
117
- export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, } from './runtime/index.js';
118
+ export { addC4ConsoleNotification, buildClusterSsoCallbackUrl, buildClusterSwaggerUrl, buildModelerOrgUrl, C4ConsoleDataProvider, C4ConsoleEventsProvider, C4ConsoleNotificationsProvider, C4ConsoleRuntimeProvider, C4UserNotificationsProvider, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, removeC4ConsoleNotificationById, resolveAdminAppName, setC4ConsoleNotificationsHandle, useC4ClusterNavEntries, useC4ConsoleAuthz, useC4ConsoleData, useC4ConsoleEventsState, useC4ConsoleNotifications, useC4ConsoleRuntime, useC4ConsoleStage, useC4DesignSystem, useC4FeatureFlag, useC4UserNotifications, useC4UserTheme, useC4WebappBreadcrumbData, } from './runtime/index.js';
118
119
  export { ENVIRONMENT_KEY_SUFFIX, safeTranslate, scopedTranslate, } from './utils/safe-translate.js';
119
120
  export { C4ClusterClientDetailsApp } from './widgets/cluster-client-details/c4-cluster-client-details-app.js';
120
121
  export { C4ClusterDetailsApp } from './widgets/cluster-details/c4-cluster-details-app.js';
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { C4ConsoleRuntimeConfig, C4DesignSystem } from './c4-console-runtime.types.js';
2
+ import type { C4ConsoleRuntimeConfig, C4DesignSystem, ConsoleStage } from './c4-console-runtime.types.js';
3
3
  export interface C4ConsoleRuntimeProviderProps {
4
4
  config: C4ConsoleRuntimeConfig;
5
5
  children: React.ReactNode;
@@ -13,13 +13,30 @@ export declare const useC4ConsoleRuntime: () => C4ConsoleRuntimeConfig;
13
13
  * the Design System by setting `designSystem: 'ds'` on the runtime config.
14
14
  */
15
15
  export declare const useC4DesignSystem: () => C4DesignSystem;
16
+ /**
17
+ * The stage the host runs on. Non-throwing and provider-optional, like
18
+ * `useC4DesignSystem`: `undefined` with no runtime provider (a test, a
19
+ * Storybook story). Use it for a rule that follows the rollout of an
20
+ * environment; `useC4ConsoleRuntime()` stays the way to read the rest of the
21
+ * config.
22
+ */
23
+ export declare const useC4ConsoleStage: () => ConsoleStage | undefined;
16
24
  /**
17
25
  * Whether a feature flag is on for the host. Non-throwing and
18
26
  * provider-optional, like `useC4DesignSystem`: with no runtime provider (a
19
- * test, a Storybook story) every flag reads as off. Off is also what a
20
- * stage-gated flag gives on prod, so the default shows the public behavior.
27
+ * test, a Storybook story) every flag reads as off. A host that knows nothing
28
+ * about the flag reads it as off too, because the bridge below gives a plain
29
+ * boolean. Thus a flag must hold the behavior that the other hosts of this
30
+ * package must NOT get by default.
21
31
  *
22
32
  * The key is the dot path of the flag in `@camunda-cloud/featureflags`, for
23
33
  * example `console.optionalTelemetry`.
34
+ *
35
+ * The value comes from one of two places. A host that gives
36
+ * `config.featureFlags` answers it itself. Every other host gets the flags
37
+ * that `C4ConsoleRuntimeProvider` reads from accounts-backend. That read is a
38
+ * request, thus a flag is off on the first render and the component renders
39
+ * again when the flags arrive. Do not use this hook for a one-time effect that
40
+ * must not run twice.
24
41
  */
25
42
  export declare const useC4FeatureFlag: (flagKey: string) => boolean;
@@ -1,5 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useEffect } from 'react';
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 { ExternalAccountsService } from '@camunda/ccma-api';
8
+ import { createContext, useContext, useEffect, useMemo, useRef, useState, } from 'react';
9
+ import { toApiConfig } from './to-api-config.js';
3
10
  const RuntimeContext = createContext(undefined);
4
11
  // Carbon dark theme names (set by c3 on <html data-carbon-theme>).
5
12
  const CARBON_DARK_THEMES = new Set(['g90', 'g100']);
@@ -40,9 +47,123 @@ function useSyncCarbonThemeToDesignSystem(designSystem) {
40
47
  };
41
48
  }, [designSystem]);
42
49
  }
50
+ /** Reads a dot path such as `console.optionalTelemetry` out of the flags. */
51
+ function readFlag(flags, flagKey) {
52
+ if (!flags) {
53
+ return false;
54
+ }
55
+ let value = flags;
56
+ for (const part of flagKey.split('.')) {
57
+ if (part.length === 0 || typeof value !== 'object' || value === null) {
58
+ return false;
59
+ }
60
+ value = value[part];
61
+ }
62
+ return value === true;
63
+ }
64
+ /**
65
+ * Reads the flags of the caller from accounts-backend, one time per
66
+ * organization and user.
67
+ *
68
+ * It fetches nothing when the host gives `config.featureFlags`, thus a host
69
+ * that evaluates the flags itself makes no request. It also fetches nothing
70
+ * without an access token: the provider is mounted app-wide, and an anonymous
71
+ * route (`/login`, a public share link) must not send a request that gets a
72
+ * 401. In both cases every flag reads as off, which is the same default as a
73
+ * tree with no provider.
74
+ *
75
+ * A host that wants the fetched flags must give `config.user`. The effect runs
76
+ * again on a change of the stage, the organization, the user or the accounts
77
+ * URL. A login changes the user, thus the flags arrive. A host that gives no
78
+ * `user` and keeps one `orgId` (an org id from the URL is there on an
79
+ * anonymous route too) changes none of them at the login, thus its flags stay
80
+ * off. A warning says so in a development build.
81
+ */
82
+ function useFetchedFeatureFlags(config) {
83
+ const [flags, setFlags] = useState(undefined);
84
+ // The host usually gives `config` as an object literal, thus its identity
85
+ // changes on every render. The effect below must depend on primitives alone,
86
+ // or it fetches in a loop.
87
+ const configRef = useRef(config);
88
+ configRef.current = config;
89
+ const hostOwnsFlags = Boolean(config.featureFlags);
90
+ const { stage, orgId } = config;
91
+ const email = config.user?.email;
92
+ // The identity of the session. It makes the effect run again after a login,
93
+ // which is the point at which an access token starts to exist.
94
+ const userId = config.user?.sub;
95
+ const accountsApiBaseUrl = config.backendUrls.accountsApiBaseUrl;
96
+ useEffect(() => {
97
+ if (hostOwnsFlags) {
98
+ return;
99
+ }
100
+ // Drop the flags of the previous organization and user before the request.
101
+ // Otherwise the old values answer until the new values arrive, thus an
102
+ // allowlist flag such as `console.privateLink87` shows a feature that the
103
+ // new organization must not get. A request that never settles would keep
104
+ // the old values for the life of the page.
105
+ setFlags(undefined);
106
+ let cancelled = false;
107
+ const load = async () => {
108
+ try {
109
+ const runtime = configRef.current;
110
+ const token = await runtime.auth.getAccessToken();
111
+ if (cancelled || !token) {
112
+ if (!token &&
113
+ !runtime.user &&
114
+ process.env.NODE_ENV !== 'production') {
115
+ console.warn('[c4] C4ConsoleRuntimeProvider found no access token and no `config.user`. ' +
116
+ 'Give `config.user` when the session starts, or the feature flags stay off. ' +
117
+ 'See docs/runtime.md section 4a.');
118
+ }
119
+ return;
120
+ }
121
+ const fetched = await ExternalAccountsService.getFeatureFlags({
122
+ // The token above is current, thus the request reuses it. A second
123
+ // call to `getAccessToken` of the host is not necessary.
124
+ config: {
125
+ ...toApiConfig(runtime),
126
+ auth: { getToken: async () => token },
127
+ },
128
+ params: { orgId },
129
+ });
130
+ if (!cancelled) {
131
+ setFlags(fetched);
132
+ }
133
+ }
134
+ catch (error) {
135
+ if (!cancelled) {
136
+ // Every flag stays off. A flag holds the behavior that a host must
137
+ // not get by default, thus off is the safe answer.
138
+ setFlags(undefined);
139
+ configRef.current.telemetry?.captureException?.(error, {
140
+ source: 'C4ConsoleRuntimeProvider.featureFlags',
141
+ });
142
+ }
143
+ }
144
+ };
145
+ void load();
146
+ return () => {
147
+ cancelled = true;
148
+ };
149
+ }, [hostOwnsFlags, stage, orgId, email, userId, accountsApiBaseUrl]);
150
+ return flags;
151
+ }
43
152
  export const C4ConsoleRuntimeProvider = ({ config, children, }) => {
44
153
  useSyncCarbonThemeToDesignSystem(config.designSystem ?? 'carbon');
45
- return (_jsx(RuntimeContext.Provider, { value: config, children: children }));
154
+ const fetchedFlags = useFetchedFeatureFlags(config);
155
+ const value = useMemo(() => {
156
+ if (config.featureFlags) {
157
+ return config;
158
+ }
159
+ return {
160
+ ...config,
161
+ featureFlags: {
162
+ isEnabled: (flagKey) => readFlag(fetchedFlags, flagKey),
163
+ },
164
+ };
165
+ }, [config, fetchedFlags]);
166
+ return (_jsx(RuntimeContext.Provider, { value: value, children: children }));
46
167
  };
47
168
  export const useC4ConsoleRuntime = () => {
48
169
  const runtime = useContext(RuntimeContext);
@@ -60,14 +181,33 @@ export const useC4ConsoleRuntime = () => {
60
181
  export const useC4DesignSystem = () => {
61
182
  return useContext(RuntimeContext)?.designSystem ?? 'carbon';
62
183
  };
184
+ /**
185
+ * The stage the host runs on. Non-throwing and provider-optional, like
186
+ * `useC4DesignSystem`: `undefined` with no runtime provider (a test, a
187
+ * Storybook story). Use it for a rule that follows the rollout of an
188
+ * environment; `useC4ConsoleRuntime()` stays the way to read the rest of the
189
+ * config.
190
+ */
191
+ export const useC4ConsoleStage = () => {
192
+ return useContext(RuntimeContext)?.stage;
193
+ };
63
194
  /**
64
195
  * Whether a feature flag is on for the host. Non-throwing and
65
196
  * provider-optional, like `useC4DesignSystem`: with no runtime provider (a
66
- * test, a Storybook story) every flag reads as off. Off is also what a
67
- * stage-gated flag gives on prod, so the default shows the public behavior.
197
+ * test, a Storybook story) every flag reads as off. A host that knows nothing
198
+ * about the flag reads it as off too, because the bridge below gives a plain
199
+ * boolean. Thus a flag must hold the behavior that the other hosts of this
200
+ * package must NOT get by default.
68
201
  *
69
202
  * The key is the dot path of the flag in `@camunda-cloud/featureflags`, for
70
203
  * example `console.optionalTelemetry`.
204
+ *
205
+ * The value comes from one of two places. A host that gives
206
+ * `config.featureFlags` answers it itself. Every other host gets the flags
207
+ * that `C4ConsoleRuntimeProvider` reads from accounts-backend. That read is a
208
+ * request, thus a flag is off on the first render and the component renders
209
+ * again when the flags arrive. Do not use this hook for a one-time effect that
210
+ * must not run twice.
71
211
  */
72
212
  export const useC4FeatureFlag = (flagKey) => {
73
213
  return useContext(RuntimeContext)?.featureFlags?.isEnabled?.(flagKey) ?? false;
@@ -52,6 +52,14 @@ export interface C4ConsoleRuntimeConfig {
52
52
  designSystem?: C4DesignSystem;
53
53
  auth: ConsoleAuth;
54
54
  backendUrls: ConsoleBackendUrls;
55
+ /**
56
+ * The organization that the host shows at this time. It selects the
57
+ * org-scoped feature flags, thus give it when the host knows the
58
+ * organization. The user must be a member of it.
59
+ *
60
+ * A host that gives `featureFlags` does not need this field.
61
+ */
62
+ orgId?: string;
55
63
  publicUrls?: ConsolePublicUrls;
56
64
  user?: ConsoleUser;
57
65
  clickwrap?: ConsoleClickwrapConfig;
@@ -59,6 +67,20 @@ export interface C4ConsoleRuntimeConfig {
59
67
  i18n?: {
60
68
  t: (key: string, options?: Record<string, unknown>) => string;
61
69
  };
70
+ /**
71
+ * Overrides the feature flags of the host.
72
+ *
73
+ * Omit it and `C4ConsoleRuntimeProvider` reads the flags from
74
+ * `GET external/feature-flags` on accounts-backend. Thus the deployed
75
+ * backend owns the values, and the host holds no copy of the rules. This is
76
+ * the path for an external host such as Camunda Hub.
77
+ *
78
+ * Give it and the fetch does not happen, and this function answers every
79
+ * flag. console-frontend does this: it imports `@camunda-cloud/featureflags`
80
+ * and evaluates the flags in the browser. It is also the only host in this
81
+ * repository that mounts this provider — the control and accounts frontends
82
+ * read `features()` directly and never come through here.
83
+ */
62
84
  featureFlags?: {
63
85
  isEnabled: (flagKey: string) => boolean;
64
86
  };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The flag that blocks new clusters and generation updates. Every create button
3
+ * and the update button of this package read it, thus one name holds the dot
4
+ * path.
5
+ *
6
+ * A generation update makes the same new workloads as a new cluster. Thus one
7
+ * flag stops both. The name speaks of creation only, because the flag is older
8
+ * than the update block.
9
+ *
10
+ * The button stays visible and gives no reason, because the user cannot change
11
+ * the block. console-backend answers 503 for the same flag, in
12
+ * `createNewCluster` and in `upgradeGenerationForCluster`. A host that does not
13
+ * know the flag reads it as off (see `useC4FeatureFlag`), thus the buttons work
14
+ * as before.
15
+ */
16
+ export declare const CLUSTER_CREATION_BLOCKED_FLAG = "console.clusterCreationBlocked";
@@ -0,0 +1,21 @@
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
+ /**
7
+ * The flag that blocks new clusters and generation updates. Every create button
8
+ * and the update button of this package read it, thus one name holds the dot
9
+ * path.
10
+ *
11
+ * A generation update makes the same new workloads as a new cluster. Thus one
12
+ * flag stops both. The name speaks of creation only, because the flag is older
13
+ * than the update block.
14
+ *
15
+ * The button stays visible and gives no reason, because the user cannot change
16
+ * the block. console-backend answers 503 for the same flag, in
17
+ * `createNewCluster` and in `upgradeGenerationForCluster`. A host that does not
18
+ * know the flag reads it as off (see `useC4FeatureFlag`), thus the buttons work
19
+ * as before.
20
+ */
21
+ export const CLUSTER_CREATION_BLOCKED_FLAG = 'console.clusterCreationBlocked';
@@ -32,7 +32,7 @@ export { C4ConsoleEventsProvider, useC4ConsoleEventsState, } from './c4-console-
32
32
  export { C4ConsoleNotificationsProvider, useC4ConsoleNotifications, } from './c4-console-notifications-context.js';
33
33
  export type { AddC4ConsoleNotificationOptions, C4ConsoleNotification, C4ConsoleNotificationAction, C4ConsoleNotificationKind, C4ConsoleNotificationsState, } from './c4-console-notifications-context.types.js';
34
34
  export type { C4ConsoleRuntimeConfig, ConsoleAuth, ConsoleBackendUrls, ConsoleClickwrapConfig, ConsolePublicUrls, ConsoleStage, ConsoleTelemetry, ConsoleUser, } from './c4-console-runtime.types.js';
35
- export { C4ConsoleRuntimeProvider, useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, } from './c4-console-runtime-context.js';
35
+ export { C4ConsoleRuntimeProvider, useC4ConsoleRuntime, useC4ConsoleStage, useC4DesignSystem, useC4FeatureFlag, } from './c4-console-runtime-context.js';
36
36
  export { C4UserNotificationsProvider, useC4UserNotifications, } from './c4-user-notifications-context.js';
37
37
  export type { C4UserNotificationsProviderProps, C4UserNotificationsState, } from './c4-user-notifications-context.types.js';
38
38
  export type { C4ResolvedTheme, C4ThemePreference, C4UserThemeState, } from './c4-user-theme.js';
@@ -13,7 +13,7 @@ export { useC4ConsoleAuthz } from './c4-console-authz.js';
13
13
  export { C4ConsoleDataProvider, useC4ConsoleData, } from './c4-console-data-context.js';
14
14
  export { C4ConsoleEventsProvider, useC4ConsoleEventsState, } from './c4-console-events-context.js';
15
15
  export { C4ConsoleNotificationsProvider, useC4ConsoleNotifications, } from './c4-console-notifications-context.js';
16
- export { C4ConsoleRuntimeProvider, useC4ConsoleRuntime, useC4DesignSystem, useC4FeatureFlag, } from './c4-console-runtime-context.js';
16
+ export { C4ConsoleRuntimeProvider, useC4ConsoleRuntime, useC4ConsoleStage, useC4DesignSystem, useC4FeatureFlag, } from './c4-console-runtime-context.js';
17
17
  export { C4UserNotificationsProvider, useC4UserNotifications, } from './c4-user-notifications-context.js';
18
18
  export { useC4UserTheme } from './c4-user-theme.js';
19
19
  export { buildModelerOrgUrl, DEFAULT_NAV_APPS, getClusterStage, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, isAppHealthyOnCluster, resolveAdminAppName, } from './nav/camunda-apps.js';
@@ -1,17 +1,25 @@
1
- export declare const HUB_API_NAMING_FLAG = "console.hubApiNaming";
1
+ export declare const LEGACY_MODELER_API_NAMING_FLAG = "console.legacyModelerApiNaming";
2
2
  /**
3
3
  * Whether the Administration API surfaces use the Hub wording.
4
4
  *
5
5
  * The Hub rollout renames the Modeler scopes: the scope group in the
6
6
  * create-client modal reads "Hub API" and the scope columns read "Hub Scopes".
7
- * The flag `console.hubApiNaming` is on for local, dev and int, so a prod user
8
- * keeps the "Web Modeler API" and "Modeler Scopes" wording until Hub is
9
- * public. Only the text changes. The scope values that go to the API
10
- * (`GetModel`, `CreateModel`, ...) are the same on every stage.
7
+ * The Hub wording is the DEFAULT of this package, because a host that embeds
8
+ * these widgets ships them for Hub. Only Console keeps the old wording, and
9
+ * only on prod, until Hub is public.
10
+ *
11
+ * The gate is thus the flag `console.legacyModelerApiNaming`, which holds the
12
+ * OLD wording and is on for prod. A host that does not know the flag reads it
13
+ * as off (see `useC4FeatureFlag`) and gets "Hub API" with no code of its own.
14
+ * An opt-in flag cannot do this: the runtime bridge gives a boolean, so c4
15
+ * cannot tell an unknown flag from a flag that the host turned off.
16
+ *
17
+ * Only the text changes. The scope values that go to the API (`GetModel`,
18
+ * `CreateModel`, ...) are the same for every host and every stage.
11
19
  *
12
20
  * Each renamed i18n key has a `Hub` sibling, for example
13
21
  * `apiclients:create.fields.scopes.modeler.label` and `…modeler.labelHub`.
14
- * When the flag widens to `true`, delete this hook, the Modeler variant of
15
- * each key, and the `hubNaming` branch at every call site.
22
+ * When Console prod gets the Hub wording too, delete this hook, the Modeler
23
+ * variant of each key, and the `hubNaming` branch at every call site.
16
24
  */
17
25
  export declare const useHubApiNaming: () => boolean;
@@ -4,20 +4,28 @@
4
4
  * You may not use this file except in compliance with the commercial license.
5
5
  */
6
6
  import { useC4FeatureFlag } from './c4-console-runtime-context.js';
7
- export const HUB_API_NAMING_FLAG = 'console.hubApiNaming';
7
+ export const LEGACY_MODELER_API_NAMING_FLAG = 'console.legacyModelerApiNaming';
8
8
  /**
9
9
  * Whether the Administration API surfaces use the Hub wording.
10
10
  *
11
11
  * The Hub rollout renames the Modeler scopes: the scope group in the
12
12
  * create-client modal reads "Hub API" and the scope columns read "Hub Scopes".
13
- * The flag `console.hubApiNaming` is on for local, dev and int, so a prod user
14
- * keeps the "Web Modeler API" and "Modeler Scopes" wording until Hub is
15
- * public. Only the text changes. The scope values that go to the API
16
- * (`GetModel`, `CreateModel`, ...) are the same on every stage.
13
+ * The Hub wording is the DEFAULT of this package, because a host that embeds
14
+ * these widgets ships them for Hub. Only Console keeps the old wording, and
15
+ * only on prod, until Hub is public.
16
+ *
17
+ * The gate is thus the flag `console.legacyModelerApiNaming`, which holds the
18
+ * OLD wording and is on for prod. A host that does not know the flag reads it
19
+ * as off (see `useC4FeatureFlag`) and gets "Hub API" with no code of its own.
20
+ * An opt-in flag cannot do this: the runtime bridge gives a boolean, so c4
21
+ * cannot tell an unknown flag from a flag that the host turned off.
22
+ *
23
+ * Only the text changes. The scope values that go to the API (`GetModel`,
24
+ * `CreateModel`, ...) are the same for every host and every stage.
17
25
  *
18
26
  * Each renamed i18n key has a `Hub` sibling, for example
19
27
  * `apiclients:create.fields.scopes.modeler.label` and `…modeler.labelHub`.
20
- * When the flag widens to `true`, delete this hook, the Modeler variant of
21
- * each key, and the `hubNaming` branch at every call site.
28
+ * When Console prod gets the Hub wording too, delete this hook, the Modeler
29
+ * variant of each key, and the `hubNaming` branch at every call site.
22
30
  */
23
- export const useHubApiNaming = () => useC4FeatureFlag(HUB_API_NAMING_FLAG);
31
+ export const useHubApiNaming = () => !useC4FeatureFlag(LEGACY_MODELER_API_NAMING_FLAG);
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  */
7
7
  import { C3ClusterTag, useC3Profile, } from '@camunda/camunda-composite-components';
8
8
  import { SaaSJobsService, } from '@camunda/ccma-api';
9
- import { ADMIN_APP_RENAME_MIN_VERSION, ClusterPlanTypeAvailabilityClass, ClusterPlanTypeCategory, CONNECTORS_MANAGEMENT_LINK_MIN_VERSION, checkVersion, deriveConnectivityMessage, deriveConnectivityStatus, IDENTITY_AUTHORIZATION_MIN_VERSION, IDENTITY_AUTHORIZATION_NOTICE_MAX_VERSION, INTERNAL_CONNECTORS_MANAGEMENT_MIN_VERSION, JOB_DASHBOARD_MIN_VERSION, LINE_8_9_MIN_VERSION, LINE_8_10_MIN_VERSION, MAX_HARDWARE_PACKAGE_COUNT, SWAGGER_MIN_VERSION, sortGenerationBySemverOfZeebe, TASKLIST_V2_UPGRADE_MIN_VERSION, TASKLIST_V2_UPGRADE_TARGET_MIN_VERSION, VersionCheckOperator, } from '@camunda/ccma-shared-types';
9
+ import { ADMIN_APP_RENAME_MIN_VERSION, ClusterPlanTypeAvailabilityClass, ClusterPlanTypeCategory, CONNECTORS_MANAGEMENT_LINK_MIN_VERSION, checkVersion, deriveConnectivityMessage, deriveConnectivityStatus, IDENTITY_AUTHORIZATION_MIN_VERSION, IDENTITY_AUTHORIZATION_NOTICE_MAX_VERSION, INTERNAL_CONNECTORS_MANAGEMENT_MIN_VERSION, isGenerationResumable, JOB_DASHBOARD_MIN_VERSION, LINE_8_9_MIN_VERSION, LINE_8_10_MIN_VERSION, MAX_HARDWARE_PACKAGE_COUNT, SWAGGER_MIN_VERSION, sortGenerationBySemverOfZeebe, stripSecfixPostfix, TASKLIST_V2_UPGRADE_MIN_VERSION, TASKLIST_V2_UPGRADE_TARGET_MIN_VERSION, VersionCheckOperator, } from '@camunda/ccma-shared-types';
10
10
  import { Api_1, ApiKey, CheckmarkFilled, Renew, Security, UserAccessLocked, } from '@carbon/react/icons/index.esm.js';
11
11
  import { observer } from 'mobx-react-lite';
12
12
  import { Fragment, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
@@ -19,7 +19,8 @@ import { C4OptimizeActivationModal } from '../../../components/c4-optimize-activ
19
19
  import { addC4ConsoleNotification } from '../../../notifications/c4-console-notifications-handle.js';
20
20
  import { buildClusterSwaggerUrl } from '../../../runtime/build-cluster-swagger-url.js';
21
21
  import { useC4ConsoleData } from '../../../runtime/c4-console-data-context.js';
22
- import { useC4ConsoleRuntime } from '../../../runtime/c4-console-runtime-context.js';
22
+ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../../runtime/c4-console-runtime-context.js';
23
+ import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../../runtime/cluster-creation-blocked.js';
23
24
  import { Checkbox, Link, Modal, Stack, Tag } from '../../../ui/index.js';
24
25
  import { useRadioFamily } from '../../../ui/families.js';
25
26
  import { clusterHealthOverride } from '../../cluster-health-override.js';
@@ -70,6 +71,9 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
70
71
  const wakeInFlight = useRef(false);
71
72
  const { cluster, clusterError, creationParameters, clustersOfOrg, clusterPlanTypeReservations, clusterLoadLatest, clusterLoadPerDay, clusterLoad24h, clusterLoadLoading, canSeeClusterLoad, canEditCluster, canWakeCluster, canSleepCluster, canManageUsers, canViewConnectorsLink, hasIdentityIntegration, orgId, clusterId, jobDashboardEnabled, upgradeDocsUrls, statisticsConfig, apiConfig, t, onReloadCluster, onReloadClusterLoad, onNavigate, ignoreGracePeriod, clusterLoadDocsUrl, restoreInProgress, overviewSection, sectionVariant, } = props;
72
73
  const data = useC4ConsoleData();
74
+ // One flag blocks new clusters and generation updates. See
75
+ // `CLUSTER_CREATION_BLOCKED_FLAG` for the name.
76
+ const generationUpdateBlocked = useC4FeatureFlag(CLUSTER_CREATION_BLOCKED_FLAG);
73
77
  const [tagModalOpen, setTagModalOpen] = useState(false);
74
78
  const [selectedTag, setSelectedTag] = useState('');
75
79
  const [tagBusy, setTagBusy] = useState(false);
@@ -406,9 +410,9 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
406
410
  const lastColonIndex = withoutDigest.lastIndexOf(':');
407
411
  if (lastColonIndex > lastSlashIndex) {
408
412
  const tag = withoutDigest.slice(lastColonIndex + 1).trim();
409
- return tag || '-';
413
+ return stripSecfixPostfix(tag) || '-';
410
414
  }
411
- return raw;
415
+ return stripSecfixPostfix(raw);
412
416
  };
413
417
  const deltas = (() => {
414
418
  const currentVersions = cluster?.generation?.versions;
@@ -1058,9 +1062,9 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
1058
1062
  const lastColonIndex = withoutDigest.lastIndexOf(':');
1059
1063
  if (lastColonIndex > lastSlashIndex) {
1060
1064
  const tag = withoutDigest.slice(lastColonIndex + 1).trim();
1061
- return tag || raw;
1065
+ return stripSecfixPostfix(tag || raw);
1062
1066
  }
1063
- return raw;
1067
+ return stripSecfixPostfix(raw);
1064
1068
  };
1065
1069
  const toDisplayVersion = (version) => {
1066
1070
  if (!version)
@@ -1118,7 +1122,9 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
1118
1122
  updateType: clusterUpdateType,
1119
1123
  updateStates: {
1120
1124
  updateAvailable: {
1121
- action: restoreInProgress
1125
+ // No action disables the button and keeps it visible, with no message.
1126
+ // The user cannot change the block, thus a reason helps nobody.
1127
+ action: restoreInProgress || generationUpdateBlocked
1122
1128
  ? undefined
1123
1129
  : () => {
1124
1130
  setTasklistMode('v2');
@@ -1299,6 +1305,12 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
1299
1305
  const connectivityStatus = deriveConnectivityStatus(cluster.status?.conditions);
1300
1306
  if (!connectivityStatus)
1301
1307
  return undefined;
1308
+ // A suspended cluster has no public connectivity, but the operator can
1309
+ // still report a stale "healthy" condition. The component tiles then read
1310
+ // "Paused", so a "Healthy" connectivity tile misleads. Hide the tile in
1311
+ // this state.
1312
+ if (normalizedReadyStatus === 'suspended')
1313
+ return undefined;
1302
1314
  return {
1303
1315
  name: 'Connectivity',
1304
1316
  status: isClusterPausedReconciliation
@@ -1516,9 +1528,17 @@ const C4ClusterDetailsOverviewTabImpl = (props) => {
1516
1528
  },
1517
1529
  wakeLabel: safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeLabel', 'Resume cluster'),
1518
1530
  wakeVisibility: canWakeCluster && !isClusterPausedReconciliation && !restoreInProgress,
1519
- wakeDisabledReason: cluster?.isFailoverSource === true
1520
- ? safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeDisabledFailoverSource', 'This cluster was failed over and can no longer be resumed.')
1521
- : undefined,
1531
+ wakeDisabledReason: (() => {
1532
+ if (cluster?.isFailoverSource === true) {
1533
+ return safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeDisabledFailoverSource', 'This cluster was failed over and can no longer be resumed.');
1534
+ }
1535
+ // The console-backend refuses the wake-up for this cohort too. Both
1536
+ // sides read isGenerationResumable.
1537
+ if (!isGenerationResumable(cluster?.generation?.versions?.zeebe)) {
1538
+ return safeTranslate(t, 'clusterdetails:overview.clusterDetails.status.wakeDisabledRetiredAlpha', 'This alpha generation is not supported anymore.');
1539
+ }
1540
+ return undefined;
1541
+ })(),
1522
1542
  sleepAction: canSleepCluster && !isClusterPausedReconciliation && !restoreInProgress
1523
1543
  ? async () => {
1524
1544
  const { ConsoleClusterService } = await import('@camunda/ccma-api');
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { BackupStatus, ClusterEncryptionKey, isSupportedFailoverRegionPair, OrganizationRole, SalesPlanType, } from '@camunda/ccma-shared-types';
2
+ import { BackupStatus, ClusterEncryptionKey, isGenerationResumable, isSupportedFailoverRegionPair, OrganizationRole, SalesPlanType, } from '@camunda/ccma-shared-types';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { C4ClusterList } from '../../components/c4-cluster-list/c4-cluster-list.js';
@@ -11,7 +11,8 @@ import { getC4ClustersGettingStartedHref } from '../../externalUrls.const.js';
11
11
  import { addC4ConsoleNotification } from '../../notifications/c4-console-notifications-handle.js';
12
12
  import { hasAvailableClusterReservation, isDeveloperBlockedFromClusterCreate, useC4ConsoleAuthz, } from '../../runtime/c4-console-authz.js';
13
13
  import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
14
- import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
14
+ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
15
+ import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-blocked.js';
15
16
  import { toApiConfig } from '../../runtime/to-api-config.js';
16
17
  import { Checkbox, Modal, Stack, TextInput } from '../../ui/index.js';
17
18
  import { useSelectFamily } from '../../ui/families.js';
@@ -179,6 +180,7 @@ function buildDefaultTranslations(t) {
179
180
  delete: translate('c4console:clusters.list.overflowMenu.delete', 'Delete'),
180
181
  resume: translate('c4console:clusters.list.overflowMenu.resume', 'Resume'),
181
182
  resumeUnavailableFailoverSource: translate('c4console:clusters.list.overflowMenu.resumeUnavailableFailoverSource', 'Resume (unavailable — this cluster was failed over)'),
183
+ resumeUnavailableRetiredAlpha: translate('c4console:clusters.list.overflowMenu.resumeUnavailableRetiredAlpha', 'Resume (unavailable — this generation has a known defect)'),
182
184
  failover: translate('c4console:clusters.list.overflowMenu.failover', 'Failover'),
183
185
  failoverSyncPending: translate('c4console:clusters.list.overflowMenu.failoverSyncPending', 'Failover (unavailable until backup data is synced to the secondary region)'),
184
186
  failoverAlreadyFailedOver: translate('c4console:clusters.list.overflowMenu.failoverAlreadyFailedOver', 'Failover (unavailable — this cluster was already failed over)'),
@@ -238,6 +240,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
238
240
  const { Select, SelectItem } = useSelectFamily();
239
241
  const resolvedGettingStartedHref = useMemo(() => getC4ClustersGettingStartedHref(gettingStartedHref), [gettingStartedHref]);
240
242
  const runtime = useC4ConsoleRuntime();
243
+ const clusterCreationBlocked = useC4FeatureFlag(CLUSTER_CREATION_BLOCKED_FLAG);
241
244
  const data = useC4ConsoleData();
242
245
  const authz = useC4ConsoleAuthz({ orgId });
243
246
  const isOrgAdmin = useMemo(() => {
@@ -600,7 +603,9 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
600
603
  canSeeClusterLoad: clustersVisibility?.canSeeClusterLoad ?? false,
601
604
  canWakeCluster: clustersVisibility?.canWake ?? false,
602
605
  canFailoverCluster: (clustersVisibility?.canFailover ?? false) && orgFailoverLimitEnabled,
603
- createClusterButtonDisabled: !canCreate,
606
+ // The flag disables the button and keeps it visible. `canCreateCluster`
607
+ // hides it, thus the flag must not join that value.
608
+ createClusterButtonDisabled: !canCreate || clusterCreationBlocked,
604
609
  };
605
610
  return mergePermissions(base, permissionsOverride);
606
611
  }, [
@@ -609,6 +614,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
609
614
  reservationAvailable,
610
615
  orgFailoverLimitEnabled,
611
616
  permissionsOverride,
617
+ clusterCreationBlocked,
612
618
  ]);
613
619
  const resolvedTranslations = useMemo(() => {
614
620
  if (translations) {
@@ -874,6 +880,24 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
874
880
  return ids;
875
881
  }, [rawClusters]);
876
882
  const isFailoverSource = useCallback((clusterId) => failoverSourceClusterIds.has(clusterId), [failoverSourceClusterIds]);
883
+ const retiredAlphaClusterIds = useMemo(() => {
884
+ const ids = new Set();
885
+ for (const rawCluster of rawClusters) {
886
+ if (isGenerationResumable(getPathString(rawCluster, ['generation', 'versions', 'zeebe']))) {
887
+ continue;
888
+ }
889
+ // Must use the same priority as mapClusterToListItem so the ID stored
890
+ // here matches the row.id the action's disabled() receives.
891
+ const clusterId = getString(rawCluster, 'id') ??
892
+ getString(rawCluster, 'clusterId') ??
893
+ getString(rawCluster, 'uuid') ??
894
+ getString(rawCluster, 'clusterUuid');
895
+ if (clusterId)
896
+ ids.add(clusterId);
897
+ }
898
+ return ids;
899
+ }, [rawClusters]);
900
+ const isOnRetiredAlphaGeneration = useCallback((clusterId) => retiredAlphaClusterIds.has(clusterId), [retiredAlphaClusterIds]);
877
901
  const isPageLoading = isLoading || authz.isLoading;
878
902
  useEffect(() => {
879
903
  if (!error) {
@@ -884,7 +908,7 @@ export const C4ClustersPage = observer(({ orgId, scope = 'cluster', gettingStart
884
908
  orgId,
885
909
  });
886
910
  }, [error, orgId, runtime.telemetry]);
887
- return (_jsxs(_Fragment, { children: [_jsx(C4ClusterList, { orgId: orgId, scope: scope, clusters: clusters, loading: isPageLoading, urls: urls, permissions: derivedPermissions, onNavigate: handleNavigate, onDeleteCluster: handleDeleteCluster, onAssignTag: handleAssignTag, onWakeCluster: handleWakeCluster, onFailoverCluster: handleFailoverCluster, trialNotification: derivedTrialNotification, encryptionNotification: encryptionNotification, clusterCapMessage: clusterCapMessage, emptyStateContent: derivedEmptyStateContent, translations: resolvedTranslations, isClusterPaused: isClusterPausedOverride ?? isClusterPausedFallback, isMultiRegionCluster: isMultiRegionClusterFallback, isFailoverSyncPending: isFailoverSyncPending, isFailoverSource: isFailoverSource, isRunningOnUnsupportedGeneration: isRunningOnUnsupportedGenerationOverride ??
911
+ return (_jsxs(_Fragment, { children: [_jsx(C4ClusterList, { orgId: orgId, scope: scope, clusters: clusters, loading: isPageLoading, urls: urls, permissions: derivedPermissions, onNavigate: handleNavigate, onDeleteCluster: handleDeleteCluster, onAssignTag: handleAssignTag, onWakeCluster: handleWakeCluster, onFailoverCluster: handleFailoverCluster, trialNotification: derivedTrialNotification, encryptionNotification: encryptionNotification, clusterCapMessage: clusterCapMessage, emptyStateContent: derivedEmptyStateContent, translations: resolvedTranslations, isClusterPaused: isClusterPausedOverride ?? isClusterPausedFallback, isMultiRegionCluster: isMultiRegionClusterFallback, isFailoverSyncPending: isFailoverSyncPending, isFailoverSource: isFailoverSource, isOnRetiredAlphaGeneration: isOnRetiredAlphaGeneration, isRunningOnUnsupportedGeneration: isRunningOnUnsupportedGenerationOverride ??
888
912
  isRunningOnUnsupportedGenerationFallback }), deleteTarget ? (_jsx(Modal, { open: deleteModalOpen, danger: true, modalHeading: safeTranslate('clustermodals:delete.heading', 'Delete cluster'), primaryButtonText: safeTranslate('clustermodals:delete.buttons.primary', 'Delete'), secondaryButtonText: safeTranslate('clustermodals:delete.buttons.secondary', 'Cancel'), primaryButtonDisabled: deleteBusy || deleteConfirmation.trim() !== 'DELETE', onRequestClose: () => {
889
913
  if (deleteBusy)
890
914
  return;
@@ -29,6 +29,8 @@ export interface C4ClustersPageTranslations {
29
29
  resume: string;
30
30
  /** Shown as the action label for a cluster that was failed over and can never be resumed. */
31
31
  resumeUnavailableFailoverSource?: string;
32
+ /** Shown as the action label for a cluster on a retired alpha generation, which can never be resumed. */
33
+ resumeUnavailableRetiredAlpha?: string;
32
34
  failover?: string;
33
35
  /** Shown as the action label while the initial secondary bucket sync is pending. */
34
36
  failoverSyncPending?: string;
@@ -13,7 +13,8 @@ import { C4OldDashboard } from '../../components/c4-old-dashboard/c4-old-dashboa
13
13
  import { getC4DashboardUrls } from '../../externalUrls.const.js';
14
14
  import { hasAvailableClusterReservation, isDeveloperBlockedFromClusterCreate, useC4ConsoleAuthz, } from '../../runtime/c4-console-authz.js';
15
15
  import { useC4ConsoleData } from '../../runtime/c4-console-data-context.js';
16
- import { useC4ConsoleRuntime } from '../../runtime/c4-console-runtime-context.js';
16
+ import { useC4ConsoleRuntime, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
17
+ import { CLUSTER_CREATION_BLOCKED_FLAG } from '../../runtime/cluster-creation-blocked.js';
17
18
  import { toApiConfig } from '../../runtime/to-api-config.js';
18
19
  import { isClusterReconciliationPaused } from '../is-cluster-reconciliation-paused.js';
19
20
  const DAY = 24 * 60 * 60 * 1000;
@@ -119,6 +120,7 @@ export const C4DashboardApp = observer((props) => {
119
120
  const authz = useC4ConsoleAuthz({ orgId });
120
121
  const data = useC4ConsoleData();
121
122
  const runtime = useC4ConsoleRuntime();
123
+ const clusterCreationBlocked = useC4FeatureFlag(CLUSTER_CREATION_BLOCKED_FLAG);
122
124
  const apiConfig = useMemo(() => toApiConfig(runtime), [runtime]);
123
125
  const externalUrls = useMemo(() => getC4DashboardUrls({ orgId, overrides: urls }), [orgId, urls]);
124
126
  const { fetchClusters, fetchMembers, fetchAudits, fetchClients, fetchClusterCapacity, getClusters, } = data;
@@ -416,11 +418,12 @@ export const C4DashboardApp = observer((props) => {
416
418
  clusterCount: clusters.length,
417
419
  clusterPlanTypesToReserved: orgInfo?.organizationToSalesPlan?.clusterPlanTypesToReserved,
418
420
  });
419
- const canCreateCluster = authz.isLoading
420
- ? true
421
- : (authz.visibilities?.clusters?.canCreate ?? true) &&
422
- !developerBlockedFromClusterCreate &&
423
- reservationAvailable;
421
+ const canCreateCluster = !clusterCreationBlocked &&
422
+ (authz.isLoading
423
+ ? true
424
+ : (authz.visibilities?.clusters?.canCreate ?? true) &&
425
+ !developerBlockedFromClusterCreate &&
426
+ reservationAvailable);
424
427
  // Count members
425
428
  const usersCount = shouldLoadMembers ? members.length : 0;
426
429
  // Count Admin API clients (mirrors the Administration API tab's client list).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.9.0",
3
+ "version": "0.11.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.0.1",
100
- "@camunda/ccma-shared-types": "1.0.0",
99
+ "@camunda/ccma-api": "1.1.0",
100
+ "@camunda/ccma-shared-types": "1.1.0",
101
101
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
102
102
  "cron-parser": "5.10.0",
103
103
  "mobx": "6.16.1",