@camunda/ccma-saas-frontend 0.23.0 → 0.24.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-extend-trial-modal/c4-extend-trial-modal.js +6 -4
- package/lib/esm/components/c4-extend-trial-modal/c4-extend-trial-modal.types.d.ts +1 -1
- package/lib/esm/externalUrls.const.d.ts +1 -0
- package/lib/esm/externalUrls.const.js +2 -0
- package/lib/esm/widgets/use-extend-trial.d.ts +1 -1
- package/lib/esm/widgets/use-extend-trial.js +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
|
|
4
4
|
* under one or more contributor license agreements. Licensed under a commercial license.
|
|
@@ -6,11 +6,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
import { TRIAL_EXTENSION_SURVEY_QUESTIONS, } from '@camunda/ccma-shared-types';
|
|
8
8
|
import { useState } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { C4_EXTERNAL_URLS } from '../../externalUrls.const.js';
|
|
10
|
+
import { Checkbox, Link, Loading, Modal, Stack, TextArea } from '../../ui/index.js';
|
|
10
11
|
import { RadioButton, RadioButtonGroup } from '../../ui/families.js';
|
|
11
12
|
import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
|
|
12
13
|
export const C4ExtendTrialModal = ({ isOpen, onClose, onSubmit, isSubmitting, error, }) => {
|
|
13
14
|
const [answers, setAnswers] = useState({});
|
|
15
|
+
const [researchConsent, setResearchConsent] = useState(false);
|
|
14
16
|
const setSingleAnswer = (questionId, value) => {
|
|
15
17
|
setAnswers((prev) => ({ ...prev, [questionId]: value }));
|
|
16
18
|
};
|
|
@@ -36,7 +38,7 @@ export const C4ExtendTrialModal = ({ isOpen, onClose, onSubmit, isSubmitting, er
|
|
|
36
38
|
answer: answers[q.id] ?? (q.type === 'multiselect' ? [] : ''),
|
|
37
39
|
}));
|
|
38
40
|
return (_jsx(Modal, { open: isOpen, modalHeading: 'Extend your trial', primaryButtonText: 'Extend trial', secondaryButtonText: 'Cancel', primaryButtonDisabled: !canSubmit, onRequestClose: onClose, onSecondarySubmit: onClose, onRequestSubmit: () => {
|
|
39
|
-
void onSubmit(buildAnswers());
|
|
41
|
+
void onSubmit(buildAnswers(), researchConsent);
|
|
40
42
|
}, children: isSubmitting ? (_jsxs(Stack, { gap: 4, children: [_jsx(Loading, { small: true, withOverlay: false }), _jsx("p", { children: "Reviewing your extension request\u2026" })] })) : (_jsxs(Stack, { gap: 6, children: [error !== undefined && (_jsx(C4InlineNotification, { kind: 'error', title: 'Extension failed.', subtitle: error, hideCloseButton: true })), TRIAL_EXTENSION_SURVEY_QUESTIONS.map((question) => {
|
|
41
43
|
if (question.type === 'select' && question.options) {
|
|
42
44
|
return (_jsxs(Stack, { gap: 2, children: [_jsx("p", { children: question.question }), _jsx(RadioButtonGroup, { name: `extend-trial-q-${question.id}`, "aria-label": question.question, valueSelected: answers[question.id] ?? '', onChange: (value) => setSingleAnswer(question.id, String(value ?? '')), children: question.options.map((opt) => (_jsx(RadioButton, { id: `extend-trial-q-${question.id}-${opt.replace(/\s+/g, '-')}`, labelText: opt, value: opt }, opt))) })] }, question.id));
|
|
@@ -46,5 +48,5 @@ export const C4ExtendTrialModal = ({ isOpen, onClose, onSubmit, isSubmitting, er
|
|
|
46
48
|
return (_jsxs(Stack, { gap: 2, children: [_jsxs("p", { children: [question.question, question.required && _jsx("span", { "aria-hidden": 'true', children: " *" })] }), question.options.map((opt) => (_jsx(Checkbox, { id: `extend-trial-q-${question.id}-${opt.replace(/\s+/g, '-')}`, labelText: opt, checked: selected.includes(opt), onChange: () => toggleMultiAnswer(question.id, opt) }, opt)))] }, question.id));
|
|
47
49
|
}
|
|
48
50
|
return (_jsx(TextArea, { id: `extend-trial-q-${question.id}`, labelText: question.question, value: answers[question.id] ?? '', onChange: (e) => setSingleAnswer(question.id, e.target.value) }, question.id));
|
|
49
|
-
})] })) }));
|
|
51
|
+
}), _jsx(Checkbox, { id: 'extend-trial-research-consent', labelText: _jsxs(_Fragment, { children: ["I agree that Camunda may contact me by email about opportunities to participate in user research. I understand that participation is voluntary and that I can withdraw my consent at any time by contacting", ' ', _jsx(Link, { href: `mailto:${C4_EXTERNAL_URLS.help.researchEmail}`, children: C4_EXTERNAL_URLS.help.researchEmail }), "."] }), checked: researchConsent, onChange: (_event, { checked }) => setResearchConsent(checked) })] })) }));
|
|
50
52
|
};
|
|
@@ -2,7 +2,7 @@ import type { TrialExtensionSurveyAnswer } from '@camunda/ccma-shared-types';
|
|
|
2
2
|
export interface C4ExtendTrialModalProps {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
onClose: () => void;
|
|
5
|
-
onSubmit: (answers: TrialExtensionSurveyAnswer[]) => Promise<void>;
|
|
5
|
+
onSubmit: (answers: TrialExtensionSurveyAnswer[], researchConsent: boolean) => Promise<void>;
|
|
6
6
|
isSubmitting: boolean;
|
|
7
7
|
error?: string;
|
|
8
8
|
}
|
|
@@ -65,6 +65,7 @@ export declare const C4_EXTERNAL_URLS: {
|
|
|
65
65
|
readonly requestCelpLicence: "https://camunda.com/educationee/";
|
|
66
66
|
readonly deleteAccountTechnicalSupport: "https://jira.camunda.com/";
|
|
67
67
|
readonly deleteAccountCustomerSuccessEmail: "customer-success@camunda.com";
|
|
68
|
+
readonly researchEmail: "research@camunda.com";
|
|
68
69
|
};
|
|
69
70
|
};
|
|
70
71
|
export declare function getC4TalkToAnExpertUrl(properties?: {
|
|
@@ -66,6 +66,8 @@ export const C4_EXTERNAL_URLS = {
|
|
|
66
66
|
// owner, who must contact support instead of self-deleting.
|
|
67
67
|
deleteAccountTechnicalSupport: 'https://jira.camunda.com/',
|
|
68
68
|
deleteAccountCustomerSuccessEmail: 'customer-success@camunda.com',
|
|
69
|
+
// A user withdraws the research consent of the extend-trial modal here.
|
|
70
|
+
researchEmail: 'research@camunda.com',
|
|
69
71
|
},
|
|
70
72
|
};
|
|
71
73
|
export function getC4TalkToAnExpertUrl(properties) {
|
|
@@ -2,7 +2,7 @@ import type { TrialExtensionSurveyAnswer } from '@camunda/ccma-shared-types';
|
|
|
2
2
|
export declare function useExtendTrial(orgId: string, opts: {
|
|
3
3
|
onSuccess?: () => void;
|
|
4
4
|
}): {
|
|
5
|
-
submit: (answers: TrialExtensionSurveyAnswer[]) => Promise<void>;
|
|
5
|
+
submit: (answers: TrialExtensionSurveyAnswer[], researchConsent?: boolean) => Promise<void>;
|
|
6
6
|
isSubmitting: boolean;
|
|
7
7
|
error: string | undefined;
|
|
8
8
|
};
|
|
@@ -13,14 +13,14 @@ export function useExtendTrial(orgId, opts) {
|
|
|
13
13
|
const data = useC4ConsoleData();
|
|
14
14
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
15
15
|
const [error, setError] = useState(undefined);
|
|
16
|
-
const submit = async (answers) => {
|
|
16
|
+
const submit = async (answers, researchConsent) => {
|
|
17
17
|
setIsSubmitting(true);
|
|
18
18
|
setError(undefined);
|
|
19
19
|
try {
|
|
20
20
|
await new Promise((resolve) => setTimeout(resolve, 5000 + Math.random() * 10000));
|
|
21
21
|
await OrgsService.selfExtendTrial({
|
|
22
22
|
config: toApiConfig(runtime),
|
|
23
|
-
params: { orgId, surveyAnswers: answers },
|
|
23
|
+
params: { orgId, surveyAnswers: answers, researchConsent },
|
|
24
24
|
});
|
|
25
25
|
data.invalidateAll(orgId);
|
|
26
26
|
opts.onSuccess?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/ccma-saas-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Camunda Composite Components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"react-markdown": "^8.0.7 || ^10.0.0"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@camunda/ccma-api": "6.
|
|
88
|
+
"@camunda/ccma-api": "6.7.0",
|
|
89
89
|
"@camunda/ccma-shared-types": "11.2.0",
|
|
90
90
|
"@pactsafe/pactsafe-react-sdk": "2.15.0",
|
|
91
91
|
"cron-parser": "5.10.2",
|