@arquimedes.co/eureka-forms 2.0.76 → 2.0.78
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/dist/App/App.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ export interface AppProps {
|
|
|
31
31
|
customStepProps?: Record<string, unknown>;
|
|
32
32
|
/** Classifiers dict */
|
|
33
33
|
classifiers?: Record<string, Classifier>;
|
|
34
|
+
/** Custom Confirmation Content */
|
|
35
|
+
customConfirmation?: (confirmation: {
|
|
36
|
+
url: string;
|
|
37
|
+
caseNumber: string;
|
|
38
|
+
}, renderIcon: () => JSX.Element, renderConfirmation: () => JSX.Element | void, renderLink: () => JSX.Element | void) => JSX.Element;
|
|
34
39
|
/** Custom function to call on send */
|
|
35
40
|
customSubmit?: (values: Record<string, unknown>, reload: () => void) => Promise<void>;
|
|
36
41
|
/** Custom submit function, when passed it is called */
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AppProps } from '../../App/App';
|
|
2
3
|
interface ConfirmationDialogProps {
|
|
3
4
|
confirmation: {
|
|
4
5
|
case: string;
|
|
5
6
|
url: string;
|
|
6
7
|
};
|
|
8
|
+
customConfirmation?: AppProps['customConfirmation'];
|
|
7
9
|
onClose: () => void;
|
|
8
10
|
}
|
|
9
|
-
declare function ConfirmationDialog({ confirmation,
|
|
11
|
+
declare function ConfirmationDialog({ onClose, confirmation, customConfirmation, }: ConfirmationDialogProps): JSX.Element;
|
|
10
12
|
export default ConfirmationDialog;
|
|
@@ -32,7 +32,7 @@ import { useContext, useMemo } from 'react';
|
|
|
32
32
|
import { mapDraftEntities } from '../../Utils/DraftFunctions';
|
|
33
33
|
import FormContext from '../../Contexts/FormContext';
|
|
34
34
|
function ConfirmationDialog(_a) {
|
|
35
|
-
var confirmation = _a.confirmation,
|
|
35
|
+
var onClose = _a.onClose, confirmation = _a.confirmation, customConfirmation = _a.customConfirmation;
|
|
36
36
|
var _b = useAppSelector(function (state) { return state.global; }), formStyle = _b.formStyle, global = __rest(_b, ["formStyle"]);
|
|
37
37
|
var form = useContext(FormContext);
|
|
38
38
|
var dependencies = useAppSelector(function (state) { return state.site.dependencies; });
|
|
@@ -44,6 +44,33 @@ function ConfirmationDialog(_a) {
|
|
|
44
44
|
}, JSON.parse(JSON.stringify(global.confirmation.confirmationMessage)))));
|
|
45
45
|
}, [global.confirmation, dependencies, form]);
|
|
46
46
|
var hasText = editorState.getCurrentContent().hasText();
|
|
47
|
+
var renderIcon = function () {
|
|
48
|
+
return (_jsx("div", __assign({ className: styles.checkContainer, style: {
|
|
49
|
+
color: formStyle.primaryColor,
|
|
50
|
+
paddingTop: widthStats.isMobile ? '20px' : '30px',
|
|
51
|
+
} }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: {
|
|
52
|
+
fontSize: widthStats.isMobile ? '100px' : '160px',
|
|
53
|
+
} }) })));
|
|
54
|
+
};
|
|
55
|
+
var renderConfirmation = function (state) {
|
|
56
|
+
if (state === void 0) { state = editorState; }
|
|
57
|
+
if (hasText) {
|
|
58
|
+
return (_jsx("div", __assign({ className: styles.messageContainer, style: {
|
|
59
|
+
fontSize: widthStats.isMobile ? '1.1rem' : '1.4rem',
|
|
60
|
+
padding: widthStats.isMobile ? '5px 0px' : '20px 0px',
|
|
61
|
+
} }, { children: _jsx(Editor, { editorClassName: 'Erk-Forms-Confirmation', editorState: state, readOnly: true, toolbarHidden: true }) })));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var renderLink = function () {
|
|
65
|
+
if (global.confirmation.showLink) {
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", __assign({ className: widthStats.isMobile
|
|
67
|
+
? styles.mobileLinkContainer
|
|
68
|
+
: styles.linkContainer }, { children: "Puedes consultar el estado aqui:" })), _jsx("a", __assign({ className: styles.url, "data-testid": "ResUrl", target: "_blank", href: confirmation.url, style: {
|
|
69
|
+
color: '#293241',
|
|
70
|
+
fontSize: widthStats.isMobile ? '1rem' : '1.2rem',
|
|
71
|
+
} }, { children: confirmation.url }))] }));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
47
74
|
return (_jsx(Dialog, __assign({ PaperProps: {
|
|
48
75
|
style: {
|
|
49
76
|
borderRadius: '20px',
|
|
@@ -55,27 +82,9 @@ function ConfirmationDialog(_a) {
|
|
|
55
82
|
padding: widthStats.isMobile ? '0px 20px' : '0px 30px',
|
|
56
83
|
} }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
|
|
57
84
|
onClose();
|
|
58
|
-
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), _jsxs("div", __assign({ className: styles.container }, { children: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
fontSize: widthStats.isMobile
|
|
63
|
-
? '100px'
|
|
64
|
-
: '160px',
|
|
65
|
-
} }) })), hasText && (_jsx("div", __assign({ className: styles.messageContainer, style: {
|
|
66
|
-
fontSize: widthStats.isMobile
|
|
67
|
-
? '1.1rem'
|
|
68
|
-
: '1.4rem',
|
|
69
|
-
padding: widthStats.isMobile
|
|
70
|
-
? '5px 0px'
|
|
71
|
-
: '20px 0px',
|
|
72
|
-
} }, { children: _jsx(Editor, { editorClassName: 'Erk-Forms-Confirmation', editorState: editorState, readOnly: true, toolbarHidden: true }) }))), global.confirmation.showLink && (_jsxs(_Fragment, { children: [_jsx("div", __assign({ className: widthStats.isMobile
|
|
73
|
-
? styles.mobileLinkContainer
|
|
74
|
-
: styles.linkContainer }, { children: "Puedes consultar el estado aqui:" })), _jsx("a", __assign({ className: styles.url, "data-testid": "ResUrl", target: "_blank", href: confirmation.url, style: {
|
|
75
|
-
color: '#293241',
|
|
76
|
-
fontSize: widthStats.isMobile
|
|
77
|
-
? '1rem'
|
|
78
|
-
: '1.2rem',
|
|
79
|
-
} }, { children: confirmation.url }))] }))] }))] })) })));
|
|
85
|
+
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), !customConfirmation && (_jsxs("div", __assign({ className: styles.container }, { children: [renderIcon(), renderConfirmation(), renderLink()] }))), customConfirmation === null || customConfirmation === void 0 ? void 0 : customConfirmation({
|
|
86
|
+
url: confirmation.url,
|
|
87
|
+
caseNumber: confirmation.case,
|
|
88
|
+
}, renderIcon, renderConfirmation, renderLink)] })) })));
|
|
80
89
|
}
|
|
81
90
|
export default ConfirmationDialog;
|