@camunda/ccma-saas-frontend 0.22.6 → 0.22.8

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.
@@ -4,9 +4,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * under one or more contributor license agreements. Licensed under a commercial license.
5
5
  * You may not use this file except in compliance with the commercial license.
6
6
  */
7
- import { Alert, Button, Checkbox, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, Label, Textarea, } from '@camunda/design-system';
8
- import { Bug, CheckCircle2, Lightbulb, MessageSquare, X } from 'lucide-react';
9
- import { useEffect, useState } from 'react';
7
+ import { Alert, Button, Checkbox, ChoiceCard, ChoiceCardGroup, Dialog, DialogContent, DialogHeader, DialogTitle, FileUploader, Label, Textarea, } from '@camunda/design-system';
8
+ import { Bug, CheckCircle2, Lightbulb, MessageSquare } from 'lucide-react';
9
+ import { useEffect, useId, useState } from 'react';
10
10
  const MAX_FILE_SIZE = 5_000_000;
11
11
  const ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/jpg', 'image/png'];
12
12
  const TYPES = [
@@ -39,6 +39,8 @@ const TYPES = [
39
39
  * {@link C4HelpCenter}.
40
40
  */
41
41
  export function C4FeedbackForm({ onSubmit, isEnterprise = false, resetKey, }) {
42
+ const typeLabelId = useId();
43
+ const uploaderId = useId();
42
44
  const [reportType, setReportType] = useState('feedback');
43
45
  const [suggestion, setSuggestion] = useState('');
44
46
  const [allowContact, setAllowContact] = useState(true);
@@ -57,7 +59,10 @@ export function C4FeedbackForm({ onSubmit, isEnterprise = false, resetKey, }) {
57
59
  }, [resetKey]);
58
60
  const activeType = TYPES.find((t) => t.value === reportType) ?? TYPES[0];
59
61
  const fileTooLarge = file !== undefined && file.size > MAX_FILE_SIZE;
60
- const canSubmit = suggestion.trim().length > 0 && !fileTooLarge && !submitting;
62
+ // The uploader enforces `accept` only in the native picker, not on a drop.
63
+ const fileWrongType = file !== undefined && !ACCEPTED_FILE_TYPES.includes(file.type);
64
+ const fileInvalid = fileTooLarge || fileWrongType;
65
+ const canSubmit = suggestion.trim().length > 0 && !fileInvalid && !submitting;
61
66
  const submit = async () => {
62
67
  setSubmitting(true);
63
68
  setError(false);
@@ -90,12 +95,16 @@ export function C4FeedbackForm({ onSubmit, isEnterprise = false, resetKey, }) {
90
95
  ? 'Your feedback will be forwarded to your Customer Success Manager who will ensure that your inputs are addressed promptly.'
91
96
  : 'Thanks for sharing your feedback. We use suggestions like yours to improve our service.' }), _jsx(Button, { variant: 'secondary', onClick: resetForAdditional, children: "Share additional feedback" })] }));
92
97
  }
93
- return (_jsxs("div", { className: 'flex flex-col gap-5', children: [isEnterprise ? (_jsxs(Alert, { variant: 'info', title: 'Looking for technical support?', children: ["Use our Jira support system to open a ticket.", ' ', _jsx(Button, { variant: 'link', className: 'h-auto p-0', asChild: true, children: _jsx("a", { href: 'https://jira.camunda.com/projects/SUPPORT/queues', target: '_blank', rel: 'noopener noreferrer', children: "Open a ticket" }) })] })) : (_jsxs("fieldset", { className: 'flex flex-col gap-2', children: [_jsx("legend", { className: 'mb-2 text-sm font-medium', children: "What type of feedback would you like to share?" }), _jsx("div", { className: 'grid grid-cols-3 gap-2', children: TYPES.map(({ value, label, icon: Icon }) => {
94
- const selected = value === reportType;
95
- return (_jsxs("button", { type: 'button', "aria-pressed": selected, onClick: () => setReportType(value), className: `flex flex-col items-center gap-2 rounded border p-3 text-sm ${selected
96
- ? 'border-primary-action-default bg-card'
97
- : 'border-border'}`, children: [_jsx(Icon, { className: 'size-6', "aria-hidden": true }), _jsx("span", { children: label })] }, value));
98
- }) })] })), _jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(Label, { htmlFor: 'c4-feedback-text', children: activeType.title }), _jsx(Textarea, { id: 'c4-feedback-text', rows: 4, placeholder: activeType.placeholder, value: suggestion, onChange: (event) => setSuggestion(event.target.value) })] }), !isEnterprise && (_jsxs("div", { className: 'flex flex-col gap-1', children: [_jsx(Label, { htmlFor: 'c4-feedback-file', children: "Upload file (optional)" }), _jsx("p", { className: 'text-xs text-neutral-foreground-subtle', children: "Max. file size is 5MB. Supported file types are .jpg and .png." }), file ? (_jsxs("div", { className: 'flex items-center justify-between rounded border border-border px-3 py-2 text-sm', children: [_jsxs("span", { className: fileTooLarge ? 'text-destructive' : '', children: [file.name, fileTooLarge ? ' — exceeds 5MB limit' : ''] }), _jsx(Button, { variant: 'ghost', size: 'icon', "aria-label": 'Remove file', onClick: () => setFile(undefined), children: _jsx(X, { className: 'size-4', "aria-hidden": true }) })] })) : (_jsx("input", { id: 'c4-feedback-file', type: 'file', accept: ACCEPTED_FILE_TYPES.join(','), className: 'text-sm', onChange: (event) => setFile(event.target.files?.[0]) }))] })), !isEnterprise && (_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Checkbox, { id: 'c4-feedback-allow-contact', checked: allowContact, onCheckedChange: (checked) => setAllowContact(checked === true) }), _jsx(Label, { htmlFor: 'c4-feedback-allow-contact', children: "Camunda may contact me about my feedback" })] })), error && (_jsx(Alert, { variant: 'destructive', title: "Couldn't submit feedback", children: "Something went wrong. Please try again." })), _jsx("div", { children: _jsx(Button, { onClick: submit, disabled: !canSubmit, children: submitting ? 'Submitting…' : 'Submit feedback' }) })] }));
98
+ return (_jsxs("div", { className: 'flex flex-col gap-5', children: [isEnterprise ? (_jsxs(Alert, { variant: 'info', title: 'Looking for technical support?', children: ["Use our Jira support system to open a ticket.", ' ', _jsx(Button, { variant: 'link', className: 'h-auto p-0', asChild: true, children: _jsx("a", { href: 'https://jira.camunda.com/projects/SUPPORT/queues', target: '_blank', rel: 'noopener noreferrer', children: "Open a ticket" }) })] })) : (_jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(Label, { id: typeLabelId, children: "What type of feedback would you like to share?" }), _jsx(ChoiceCardGroup, { columns: 3, "aria-labelledby": typeLabelId, value: reportType, onValueChange: (value) => setReportType(value), children: TYPES.map(({ value, label, icon }) => (_jsx(ChoiceCard, { value: value, title: label, icon: icon, style: { minHeight: '6rem', justifyContent: 'space-between' } }, value))) })] })), _jsxs("div", { className: 'flex flex-col gap-2', children: [_jsx(Label, { htmlFor: 'c4-feedback-text', children: activeType.title }), _jsx(Textarea, { id: 'c4-feedback-text', rows: 4, style: { minHeight: '6rem' }, placeholder: activeType.placeholder, helperText: 'We actively use this information to fix problems and improve your experience.', value: suggestion, onChange: (event) => setSuggestion(event.target.value) })] }), !isEnterprise && (_jsx(FileUploader, { id: uploaderId, mode: 'single', size: 'compact', labelTitle: 'Upload file (optional)', labelDescription: 'Max. file size is 5MB. Supported file types are .jpg and .png.', accept: ACCEPTED_FILE_TYPES.join(','), files: file ? [file] : [], onFilesChange: (files) => setFile(files[0]), fileStatus: file && fileInvalid ? new Map([[file, 'error']]) : undefined, fileErrors: file && fileInvalid
99
+ ? new Map([
100
+ [
101
+ file,
102
+ fileTooLarge
103
+ ? 'File exceeds the 5MB limit'
104
+ : 'Only .jpg and .png files are supported',
105
+ ],
106
+ ])
107
+ : undefined, "aria-invalid": fileInvalid })), !isEnterprise && (_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Checkbox, { id: 'c4-feedback-allow-contact', checked: allowContact, onCheckedChange: (checked) => setAllowContact(checked === true) }), _jsx(Label, { htmlFor: 'c4-feedback-allow-contact', children: "Camunda may contact me about my feedback" })] })), error && (_jsx(Alert, { variant: 'destructive', title: "Couldn't submit feedback", children: "Something went wrong. Please try again." })), _jsx("div", { children: _jsx(Button, { onClick: submit, disabled: !canSubmit, children: submitting ? 'Submitting…' : 'Submit feedback' }) })] }));
99
108
  }
100
109
  /**
101
110
  * Design-system-native Help Center "Share your feedback" modal. Mirrors the c3
@@ -105,5 +114,5 @@ export function C4FeedbackForm({ onSubmit, isEnterprise = false, resetKey, }) {
105
114
  * supplies `onSubmit` (which performs the actual POST).
106
115
  */
107
116
  export function C4FeedbackModal({ open, onOpenChange, onSubmit, isEnterprise = false, }) {
108
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: 'c4-ui sm:max-w-xl', children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Share your feedback" }), _jsx(DialogDescription, { children: "We actively use this information to fix problems and improve your experience with our products." })] }), _jsx(C4FeedbackForm, { onSubmit: onSubmit, isEnterprise: isEnterprise, resetKey: open })] }) }));
117
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: 'c4-ui sm:max-w-xl', "aria-describedby": undefined, children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Share your feedback" }) }), _jsx(C4FeedbackForm, { onSubmit: onSubmit, isEnterprise: isEnterprise, resetKey: open })] }) }));
109
118
  }
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
5
5
  * You may not use this file except in compliance with the commercial license.
6
6
  */
7
7
  import { Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Dialog, DialogContent, DialogHeader, DialogTitle, ScrollArea, Tabs, TabsContent, TabsList, TabsTrigger, } from '@camunda/design-system';
8
- import { ArrowRight, ExternalLink, MessageSquare } from 'lucide-react';
8
+ import { ArrowRight, ExternalLink } from 'lucide-react';
9
9
  import { useEffect, useState } from 'react';
10
10
  import ReactMarkdown from 'react-markdown';
11
11
  import { useC4ConsoleStage, useC4FeatureFlag, } from '../../runtime/c4-console-runtime-context.js';
@@ -60,12 +60,15 @@ export function C4HelpCenter({ open, onOpenChange, data, isLoading, helpLinks, o
60
60
  ? activeTabId
61
61
  : (tabs[0]?.id ?? '');
62
62
  const showFullUI = isLoading || tabs.length > 0 || hasFeedbackTab;
63
- 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: {
63
+ 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: '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 shrink-0 flex-col overflow-hidden', style: {
64
+ width: '15.5rem',
65
+ padding: '1.5rem 0.75rem 1.5rem 1.5rem',
66
+ }, children: [isLoading ? (_jsx("div", { className: 'flex flex-col gap-2', children: [1, 2, 3].map((i) => (_jsx("div", { className: 'h-8 animate-pulse rounded bg-neutral-background-strong' }, i))) })) : (_jsxs(TabsList, { className: 'h-auto w-full flex-col items-start gap-1', children: [tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.id, className: 'w-full justify-start text-sm', 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 && (_jsx(TabsTrigger, { value: FEEDBACK_TAB_ID, className: 'w-full justify-start text-sm', children: "Share your feedback" }))] })), !isLoading && sidebarLinks.length > 0 && (_jsx("div", { className: 'mt-auto', style: { paddingTop: '0.5rem' }, children: sidebarLinks.map((link) => (_jsxs("a", { href: link.link, target: '_blank', rel: 'noopener noreferrer', className: 'flex items-center gap-1 px-4 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: {
64
67
  p: ({ children }) => _jsx(_Fragment, { children: children }),
65
68
  a: ({ children, href }) => (_jsx(Link, { href: href, target: '_blank', rel: 'noopener noreferrer', children: children })),
66
69
  }, children: tile.description }) }) }), tile.link &&
67
70
  tile.cta &&
68
- !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 })] }) }))] }))] })] })) : (
71
+ !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: _jsx("div", { className: 'max-w-xl', children: _jsx(C4FeedbackForm, { onSubmit: onSubmitFeedback, isEnterprise: feedbackEnterprise, resetKey: open }) }) }))] }))] })] })) : (
69
72
  /* Fallback: simple link list when no CMS data and no feedback tab */
70
73
  _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 &&
71
74
  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))) })] })) }) }));
@@ -158,7 +158,7 @@ export function mapPermissionsToScopeStrings(permissions, t) {
158
158
  break;
159
159
  case 'DeleteMembers':
160
160
  case 'RemoveMember':
161
- hotBackupScopes.push(safeTranslate(t, 'orgmanagement:tabs.api.scopes.delete', 'Delete'));
161
+ memberScopes.push(safeTranslate(t, 'orgmanagement:tabs.api.scopes.delete', 'Delete'));
162
162
  break;
163
163
  case 'CreateHotBackups':
164
164
  case 'CreateHotBackup':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/ccma-saas-frontend",
3
- "version": "0.22.6",
3
+ "version": "0.22.8",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -85,8 +85,8 @@
85
85
  "react-markdown": "^8.0.7 || ^10.0.0"
86
86
  },
87
87
  "dependencies": {
88
- "@camunda/ccma-api": "6.3.0",
89
- "@camunda/ccma-shared-types": "10.10.0",
88
+ "@camunda/ccma-api": "6.4.0",
89
+ "@camunda/ccma-shared-types": "10.11.0",
90
90
  "@pactsafe/pactsafe-react-sdk": "2.15.0",
91
91
  "cron-parser": "5.10.2",
92
92
  "mobx": "6.16.1",