@arquimedes.co/eureka-forms 0.2.42 → 0.2.45
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.js +59 -55
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -6
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +12 -6
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +0 -1
- package/dist/index.js +12 -1
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +6 -4
- package/dist/shared/RoundedSelect/RoundedSelect.js +3 -8
- package/dist/shared/RoundedTextField/RoundedTextField.js +5 -6
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -67,42 +67,11 @@ import StepTypes from './constants/FormStepTypes';
|
|
|
67
67
|
import axiosInstance from './AxiosAPI';
|
|
68
68
|
function App(_a) {
|
|
69
69
|
var _this = this;
|
|
70
|
+
var _b, _c;
|
|
70
71
|
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSteps = _a.customSteps, handleConfirmed = _a.handleConfirmed, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps", "handleConfirmed"]);
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
//
|
|
75
|
-
function fetchOrgData(domain) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
-
var response, _a, currentOrg;
|
|
78
|
-
return __generator(this, function (_b) {
|
|
79
|
-
switch (_b.label) {
|
|
80
|
-
case 0:
|
|
81
|
-
if (!domain) return [3 /*break*/, 2];
|
|
82
|
-
return [4 /*yield*/, axios.get("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/organization?domain=").concat(domain))];
|
|
83
|
-
case 1:
|
|
84
|
-
_a = _b.sent();
|
|
85
|
-
return [3 /*break*/, 4];
|
|
86
|
-
case 2: return [4 /*yield*/, axiosInstance.get('/organization')];
|
|
87
|
-
case 3:
|
|
88
|
-
_a = _b.sent();
|
|
89
|
-
_b.label = 4;
|
|
90
|
-
case 4:
|
|
91
|
-
response = _a;
|
|
92
|
-
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
93
|
-
currentOrg = response.data;
|
|
94
|
-
// document.title = currentOrg.name;
|
|
95
|
-
// const favicon: any = document.getElementById('favicon');
|
|
96
|
-
// if (favicon !== undefined) {
|
|
97
|
-
// favicon.href = currentOrg.partialLogoUrl;
|
|
98
|
-
// }
|
|
99
|
-
return [2 /*return*/, currentOrg];
|
|
100
|
-
}
|
|
101
|
-
return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
72
|
+
var _d = useState(undefined), form = _d[0], setForm = _d[1];
|
|
73
|
+
var _e = useState({}), originalValues = _e[0], setOriginalValues = _e[1];
|
|
74
|
+
var _f = useState(undefined), organizationInfo = _f[0], setOrganizationInfo = _f[1];
|
|
106
75
|
function fetchPreview(formData) {
|
|
107
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
108
77
|
var response;
|
|
@@ -135,10 +104,12 @@ function App(_a) {
|
|
|
135
104
|
}
|
|
136
105
|
else if (!isWidget && apiKey) {
|
|
137
106
|
//Is iframe
|
|
107
|
+
loadOrgInfo(domain);
|
|
138
108
|
loadInfo(apiKey, domain);
|
|
139
109
|
}
|
|
140
110
|
else if (isWidget && apiKey && domain) {
|
|
141
111
|
//Is iframe
|
|
112
|
+
loadOrgInfo(domain);
|
|
142
113
|
loadInfo(apiKey, domain);
|
|
143
114
|
}
|
|
144
115
|
else {
|
|
@@ -149,38 +120,71 @@ function App(_a) {
|
|
|
149
120
|
}
|
|
150
121
|
}, []);
|
|
151
122
|
var containerRef = useRef();
|
|
152
|
-
var
|
|
153
|
-
var
|
|
123
|
+
var loadOrgInfo = function (domain) { return __awaiter(_this, void 0, void 0, function () {
|
|
124
|
+
var response, _a, error_1;
|
|
154
125
|
return __generator(this, function (_b) {
|
|
155
126
|
switch (_b.label) {
|
|
156
127
|
case 0:
|
|
157
|
-
_b.trys.push([0,
|
|
128
|
+
_b.trys.push([0, 5, , 6]);
|
|
129
|
+
if (!domain) return [3 /*break*/, 2];
|
|
130
|
+
return [4 /*yield*/, axios.get("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/organization?domain=").concat(domain))];
|
|
131
|
+
case 1:
|
|
132
|
+
_a = _b.sent();
|
|
133
|
+
return [3 /*break*/, 4];
|
|
134
|
+
case 2: return [4 /*yield*/, axiosInstance.get('/organization')];
|
|
135
|
+
case 3:
|
|
136
|
+
_a = _b.sent();
|
|
137
|
+
_b.label = 4;
|
|
138
|
+
case 4:
|
|
139
|
+
response = _a;
|
|
140
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
141
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
142
|
+
// document.title = currentOrg.name;
|
|
143
|
+
// const favicon: any = document.getElementById('favicon');
|
|
144
|
+
// if (favicon !== undefined) {
|
|
145
|
+
// favicon.href = currentOrg.partialLogoUrl;
|
|
146
|
+
// }
|
|
147
|
+
//TODO cambiar el color del navbar en movil
|
|
148
|
+
console.log(response === null || response === void 0 ? void 0 : response.data);
|
|
149
|
+
setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
setOrganizationInfo(null);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return [3 /*break*/, 6];
|
|
156
|
+
case 5:
|
|
157
|
+
error_1 = _b.sent();
|
|
158
|
+
console.error(error_1);
|
|
159
|
+
setOrganizationInfo(null);
|
|
160
|
+
return [3 /*break*/, 6];
|
|
161
|
+
case 6: return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}); };
|
|
165
|
+
var loadInfo = function (apiKey, domain) { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
var url, response, error_2;
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
switch (_a.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
_a.trys.push([0, 2, , 3]);
|
|
158
171
|
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/form/").concat(apiKey, "?domain=").concat(domain);
|
|
159
|
-
return [4 /*yield*/,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
])];
|
|
172
|
+
return [4 /*yield*/, (domain
|
|
173
|
+
? axios.get(url)
|
|
174
|
+
: axiosInstance.get("/form/".concat(apiKey)))];
|
|
163
175
|
case 1:
|
|
164
|
-
|
|
176
|
+
response = _a.sent();
|
|
165
177
|
if (response) {
|
|
166
178
|
setForm(migrateFormData(response.data));
|
|
167
179
|
if (valuesData !== undefined) {
|
|
168
180
|
setOriginalValues(valuesData);
|
|
169
181
|
}
|
|
170
182
|
}
|
|
171
|
-
if (orgInfo) {
|
|
172
|
-
console.log(orgInfo);
|
|
173
|
-
setOrganizationInfo(orgInfo);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
setOrganizationInfo(null);
|
|
177
|
-
}
|
|
178
183
|
return [3 /*break*/, 3];
|
|
179
184
|
case 2:
|
|
180
|
-
|
|
181
|
-
console.error(
|
|
185
|
+
error_2 = _a.sent();
|
|
186
|
+
console.error(error_2);
|
|
182
187
|
setForm(null);
|
|
183
|
-
setOrganizationInfo(null);
|
|
184
188
|
return [3 /*break*/, 3];
|
|
185
189
|
case 3: return [2 /*return*/];
|
|
186
190
|
}
|
|
@@ -188,9 +192,9 @@ function App(_a) {
|
|
|
188
192
|
}); };
|
|
189
193
|
if (form === undefined || organizationInfo === undefined) {
|
|
190
194
|
if (isWidget) {
|
|
191
|
-
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color:
|
|
195
|
+
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_b = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.navbarColor) !== null && _b !== void 0 ? _b : '#b8b8b8' }, void 0) }), void 0) }), void 0));
|
|
192
196
|
}
|
|
193
|
-
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color:
|
|
197
|
+
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.navbarColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }, void 0) }), void 0));
|
|
194
198
|
}
|
|
195
199
|
else if (form === null) {
|
|
196
200
|
console.log('FORM IS NULL');
|
|
@@ -22,13 +22,12 @@ function ConfirmationDialog(_a) {
|
|
|
22
22
|
maxWidth: '100vw',
|
|
23
23
|
boxSizing: 'content-box',
|
|
24
24
|
},
|
|
25
|
-
}, onClose: function () {
|
|
26
|
-
onClose();
|
|
27
25
|
}, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
|
|
28
26
|
onClose();
|
|
29
|
-
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case }), void 0), ' ', "ha sido registrado!"] }), void 0), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." }), void 0), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] }), void 0), _jsx("
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case }), void 0), ' ', "ha sido registrado!"] }), void 0), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." }), void 0), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] }), void 0), _jsx("label", __assign({ className: styles.url, onClick: function () {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
(_c = (_b = (_a = window
|
|
30
|
+
.open) === null || _a === void 0 ? void 0 : _a.call(window, confirmation.url, '_blank')) === null || _b === void 0 ? void 0 : _b.focus) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
31
|
+
} }, { children: confirmation.url }), void 0)] }), void 0)] }), void 0) }), void 0));
|
|
33
32
|
}
|
|
34
33
|
export default ConfirmationDialog;
|
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: fit-content;
|
|
5
|
-
max-height:
|
|
5
|
+
max-height: 80vh;
|
|
6
6
|
max-width: 80vw;
|
|
7
7
|
position: relative;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.container {
|
|
11
|
+
max-height: 100%;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
overflow-y: scroll;
|
|
16
|
+
}
|
|
10
17
|
.confirmationContainer,
|
|
11
18
|
.confirmationContainer *,
|
|
12
19
|
.confirmationContainer *::after,
|
|
@@ -20,8 +27,7 @@
|
|
|
20
27
|
margin-left: auto;
|
|
21
28
|
margin-right: auto;
|
|
22
29
|
padding-top: 30px;
|
|
23
|
-
|
|
24
|
-
height: 10rem;
|
|
30
|
+
height: fit-content;
|
|
25
31
|
margin-bottom: 15px;
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -36,18 +42,18 @@
|
|
|
36
42
|
.linkContainer {
|
|
37
43
|
margin-top: 20px;
|
|
38
44
|
font-size: 1.2rem;
|
|
39
|
-
margin-right: auto;
|
|
40
45
|
margin-left: 20px;
|
|
41
46
|
}
|
|
42
47
|
.url {
|
|
43
48
|
font-weight: bolder;
|
|
44
49
|
margin-left: 40px;
|
|
45
50
|
margin-right: 40px;
|
|
46
|
-
margin-top:
|
|
51
|
+
margin-top: 10px;
|
|
47
52
|
margin-bottom: 40px;
|
|
48
53
|
cursor: pointer;
|
|
49
54
|
font-size: 1rem;
|
|
50
|
-
|
|
55
|
+
max-width: calc(100% - 100px);
|
|
56
|
+
word-break: break-all;
|
|
51
57
|
}
|
|
52
58
|
.closeIcon {
|
|
53
59
|
right: 15px;
|
|
@@ -44,7 +44,6 @@ function Selector(_a) {
|
|
|
44
44
|
width: widthStats.currentBreakPoint <= step.size
|
|
45
45
|
? '100%'
|
|
46
46
|
: calcStepWidth(step.size, form),
|
|
47
|
-
maxWidth: '100%',
|
|
48
47
|
minHeight: step.description || step.required ? '55px' : '43px',
|
|
49
48
|
} }, { children: _jsxs(RoundedSelect, __assign({ value: value, fullWidth: true, inputRef: inputRef, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, label: step.label, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
|
|
50
49
|
onChange(event.target.value);
|
package/dist/index.js
CHANGED
|
@@ -13,4 +13,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import * as ReactDOM from 'react-dom';
|
|
14
14
|
import App from './App';
|
|
15
15
|
import styles from './index.module.css';
|
|
16
|
-
|
|
16
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
17
|
+
var values = urlParams.get('data-values');
|
|
18
|
+
var dataValues = undefined;
|
|
19
|
+
if (values) {
|
|
20
|
+
try {
|
|
21
|
+
dataValues = JSON.parse(decodeURIComponent(values));
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error('Invalid data-values JSON', error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
ReactDOM.render(_jsx("div", __assign({ className: styles.eurekaForm }, { children: _jsx(App, { isWidget: false, apiKey: window.location.pathname.replace('/', ''), valuesData: dataValues }, void 0) }), void 0), document.getElementById('eureka-root'));
|
|
@@ -62,9 +62,7 @@ var useDatePickerStyles = function (props) {
|
|
|
62
62
|
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
63
63
|
borderColor: props.outlineColor,
|
|
64
64
|
'& span': {
|
|
65
|
-
fontSize: props.
|
|
66
|
-
paddingRight: 0,
|
|
67
|
-
paddingLeft: 0,
|
|
65
|
+
fontSize: props.fontSize,
|
|
68
66
|
},
|
|
69
67
|
},
|
|
70
68
|
'&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
|
|
@@ -98,6 +96,10 @@ var useDatePickerStyles = function (props) {
|
|
|
98
96
|
var useDatePickerLabelStyles = function (props) {
|
|
99
97
|
return makeStyles(function () { return ({
|
|
100
98
|
root: {
|
|
99
|
+
whiteSpace: 'nowrap',
|
|
100
|
+
overflow: 'hidden',
|
|
101
|
+
maxWidth: 'calc(100% - 50px)',
|
|
102
|
+
textOverflow: 'ellipsis',
|
|
101
103
|
marginTop: '-4px',
|
|
102
104
|
fontSize: props.fontSize,
|
|
103
105
|
'&.Mui-focused': {
|
|
@@ -105,7 +107,7 @@ var useDatePickerLabelStyles = function (props) {
|
|
|
105
107
|
},
|
|
106
108
|
'&.EF-MuiInputLabel-shrink': {
|
|
107
109
|
marginTop: '0px',
|
|
108
|
-
|
|
110
|
+
maxWidth: 'calc(100% - 5px)',
|
|
109
111
|
},
|
|
110
112
|
'& .Mui-error': {
|
|
111
113
|
color: props.errorColor,
|
|
@@ -36,7 +36,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
36
36
|
return t;
|
|
37
37
|
};
|
|
38
38
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
|
-
import React
|
|
39
|
+
import React from 'react';
|
|
40
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
41
41
|
import InputLabel from '@material-ui/core/InputLabel';
|
|
42
42
|
import FormControl from '@material-ui/core/FormControl';
|
|
@@ -105,7 +105,7 @@ var useLabelInputStyles = function (props) {
|
|
|
105
105
|
marginTop: props.height != '40px' ? '-4px' : '0px',
|
|
106
106
|
'&.EF-MuiInputLabel-shrink': {
|
|
107
107
|
marginTop: '0px',
|
|
108
|
-
maxWidth: 'calc(
|
|
108
|
+
maxWidth: 'calc(100% - 5px)',
|
|
109
109
|
},
|
|
110
110
|
'& .Mui-error': {
|
|
111
111
|
color: props.errorColor,
|
|
@@ -156,16 +156,11 @@ function CustomSelect(_a) {
|
|
|
156
156
|
height: height,
|
|
157
157
|
color: color,
|
|
158
158
|
})();
|
|
159
|
-
var inputLabel = React.useRef();
|
|
160
|
-
var _k = React.useState(0), labelWidth = _k[0], setLabelWidth = _k[1];
|
|
161
|
-
useEffect(function () {
|
|
162
|
-
setLabelWidth(inputLabel.current.offsetWidth);
|
|
163
|
-
}, [label]);
|
|
164
159
|
return (_jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
|
|
165
160
|
? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
|
|
166
161
|
: {
|
|
167
162
|
margin: containerMargin,
|
|
168
|
-
}, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({
|
|
163
|
+
}, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate, input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label + (required ? ' *' : ''), classes: outlinedInputClasses }, void 0) }, { children: children }), void 0), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText }), void 0))] }), void 0));
|
|
169
164
|
}
|
|
170
165
|
/**
|
|
171
166
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -59,10 +59,14 @@ var useTextfieldStyles = function (props) {
|
|
|
59
59
|
'& label': {
|
|
60
60
|
marginTop: props.multiline ? '0px' : '-4px',
|
|
61
61
|
fontSize: props.fontSize,
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
textOverflow: 'ellipsis',
|
|
65
|
+
maxWidth: 'calc(100% - 22px)',
|
|
62
66
|
},
|
|
63
67
|
'& label.EF-MuiInputLabel-shrink': {
|
|
64
|
-
fontSize: props.shrunkenFontSize,
|
|
65
68
|
marginTop: '0px',
|
|
69
|
+
maxWidth: 'calc(100% - 5px)',
|
|
66
70
|
},
|
|
67
71
|
'& input + fieldset': {
|
|
68
72
|
borderRadius: props.borderRadius,
|
|
@@ -78,11 +82,6 @@ var useTextfieldStyles = function (props) {
|
|
|
78
82
|
},
|
|
79
83
|
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
80
84
|
borderColor: props.outlineColor,
|
|
81
|
-
'& span': {
|
|
82
|
-
fontSize: props.shrunkenFontSize,
|
|
83
|
-
paddingRight: 0,
|
|
84
|
-
paddingLeft: 0,
|
|
85
|
-
},
|
|
86
85
|
},
|
|
87
86
|
},
|
|
88
87
|
'& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
|