@camunda/ccma-saas-frontend 0.9.0 → 0.10.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.
- package/lib/esm/components/c4-help-center/c4-help-center.d.ts +9 -1
- package/lib/esm/components/c4-help-center/c4-help-center.js +34 -4
- package/lib/esm/components/c4-help-center/help-center-app-host.d.ts +23 -0
- package/lib/esm/components/c4-help-center/help-center-app-host.js +69 -0
- package/lib/esm/components/c4-help-center/help-center-placeholders.d.ts +26 -0
- package/lib/esm/components/c4-help-center/help-center-placeholders.js +49 -0
- package/lib/esm/components/c4-navigation/c4-navigation.d.ts +12 -0
- package/lib/esm/components/c4-navigation/c4-navigation.js +2 -2
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/runtime/c4-console-runtime-context.d.ts +13 -3
- package/lib/esm/runtime/c4-console-runtime-context.js +14 -2
- package/lib/esm/runtime/index.d.ts +1 -1
- package/lib/esm/runtime/index.js +1 -1
- package/lib/esm/runtime/use-hub-api-naming.d.ts +15 -7
- package/lib/esm/runtime/use-hub-api-naming.js +16 -8
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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 &&
|
|
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 &&
|
|
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
|
};
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -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,11 +13,21 @@ 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.
|
|
20
|
-
*
|
|
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`.
|
|
@@ -60,11 +60,23 @@ export const useC4ConsoleRuntime = () => {
|
|
|
60
60
|
export const useC4DesignSystem = () => {
|
|
61
61
|
return useContext(RuntimeContext)?.designSystem ?? 'carbon';
|
|
62
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* The stage the host runs on. Non-throwing and provider-optional, like
|
|
65
|
+
* `useC4DesignSystem`: `undefined` with no runtime provider (a test, a
|
|
66
|
+
* Storybook story). Use it for a rule that follows the rollout of an
|
|
67
|
+
* environment; `useC4ConsoleRuntime()` stays the way to read the rest of the
|
|
68
|
+
* config.
|
|
69
|
+
*/
|
|
70
|
+
export const useC4ConsoleStage = () => {
|
|
71
|
+
return useContext(RuntimeContext)?.stage;
|
|
72
|
+
};
|
|
63
73
|
/**
|
|
64
74
|
* Whether a feature flag is on for the host. Non-throwing and
|
|
65
75
|
* provider-optional, like `useC4DesignSystem`: with no runtime provider (a
|
|
66
|
-
* test, a Storybook story) every flag reads as off.
|
|
67
|
-
*
|
|
76
|
+
* test, a Storybook story) every flag reads as off. A host that knows nothing
|
|
77
|
+
* about the flag reads it as off too, because the bridge below gives a plain
|
|
78
|
+
* boolean. Thus a flag must hold the behavior that the other hosts of this
|
|
79
|
+
* package must NOT get by default.
|
|
68
80
|
*
|
|
69
81
|
* The key is the dot path of the flag in `@camunda-cloud/featureflags`, for
|
|
70
82
|
* example `console.optionalTelemetry`.
|
|
@@ -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';
|
package/lib/esm/runtime/index.js
CHANGED
|
@@ -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
|
|
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
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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
|
|
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
|
|
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
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
|
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(
|
|
31
|
+
export const useHubApiNaming = () => !useC4FeatureFlag(LEGACY_MODELER_API_NAMING_FLAG);
|