@arquimedes.co/eureka-forms 1.9.16-test → 1.9.19-test
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 +98 -205
- package/dist/AxiosAPI.js +3 -3
- package/dist/AxiosWidget.js +4 -4
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +104 -207
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -17
- package/dist/FormComponents/Form/Form.js +29 -56
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +7 -30
- package/dist/FormComponents/Section/Section.js +2 -13
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +9 -32
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +47 -64
- package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +41 -102
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +37 -92
- package/dist/FormComponents/Step/AYFStepMapper.js +23 -75
- package/dist/FormComponents/Step/CBRStepMapper.js +56 -144
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +3 -26
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +6 -21
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +3 -26
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +32 -65
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +2 -13
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +6 -21
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +2 -13
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +27 -88
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +81 -171
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -41
- package/dist/FormComponents/Step/RatingStep/RatingStep.js +2 -13
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +25 -52
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +3 -26
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +1 -2
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +3 -26
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +83 -145
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +2 -13
- package/dist/FormComponents/Step/Step.js +19 -39
- package/dist/FormComponents/Step/StepFunctions.js +14 -16
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +43 -62
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +2 -13
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +6 -21
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +2 -13
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -15
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +3 -26
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +19 -35
- package/dist/FormComponents/Term/Term.js +2 -13
- package/dist/Widget.js +13 -25
- package/dist/constants/Files/FileExtensions.js +3 -3
- package/dist/constants/Files/FileMaxSize.js +1 -1
- package/dist/constants/InternalFormStyle.js +1 -1
- package/dist/constants/MaterialClassNameSeed.js +1 -1
- package/dist/controllers/FileService.js +29 -86
- package/dist/index.js +4 -15
- package/dist/shared/Loader/Loader.js +5 -17
- package/dist/shared/Navbar/Navbar.js +2 -14
- package/dist/shared/Rating/Rating.js +4 -27
- package/dist/shared/Rating/Ratings/LikeRating.js +9 -21
- package/dist/shared/Rating/Ratings/SatisfactionRating.js +15 -27
- package/dist/shared/Rating/Ratings/ScaleRating.js +22 -49
- package/dist/shared/RoundedButton/RoundedButton.js +12 -24
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +39 -84
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +235 -286
- package/dist/shared/RoundedSelect/RoundedSelect.js +103 -152
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +125 -160
- package/dist/shared/RoundedTextField/RoundedTextField.js +92 -137
- package/dist/utils/CbrFunctions.js +30 -30
- package/package.json +6 -4
|
@@ -1,61 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
2
|
import { useEffect, useRef, useState } from 'react';
|
|
61
3
|
import ReCAPTCHA from 'react-google-recaptcha';
|
|
@@ -70,22 +12,20 @@ import Loader from '../../../shared/Loader/Loader';
|
|
|
70
12
|
import axiosInstance from '../../../AxiosAPI';
|
|
71
13
|
import widgetInstance from '../../../AxiosWidget';
|
|
72
14
|
import React from 'react';
|
|
73
|
-
function ColumnForm(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _c = useState(calcDependencies(form.steps, originalValues)), dependencyStore = _c[0], setDependencyStore = _c[1];
|
|
78
|
-
var _d = useForm({
|
|
15
|
+
function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend, handleLoaded, originalValues, ...others }) {
|
|
16
|
+
const [tempError, setTempError] = useState(false);
|
|
17
|
+
const [dependencyStore, setDependencyStore] = useState(calcDependencies(form.steps, originalValues));
|
|
18
|
+
const { getValues, setValue, clearErrors, control, formState: { errors }, trigger, } = useForm({
|
|
79
19
|
defaultValues: mapOriginalValues(originalValues, form),
|
|
80
20
|
mode: 'onTouched',
|
|
81
21
|
shouldFocusError: true,
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
useEffect(
|
|
88
|
-
|
|
22
|
+
});
|
|
23
|
+
const recaptchaRef = useRef();
|
|
24
|
+
const [sections, setSections] = useState(undefined);
|
|
25
|
+
const [loading, setLoading] = useState(false);
|
|
26
|
+
const [showConfirmation, setShowConfirmation] = useState();
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const tempSections = [];
|
|
89
29
|
calcNextSection(form, form.firstSection, tempSections);
|
|
90
30
|
setSections(tempSections);
|
|
91
31
|
handleLoaded();
|
|
@@ -93,134 +33,99 @@ function ColumnForm(_a) {
|
|
|
93
33
|
if (sections === undefined) {
|
|
94
34
|
return _jsx("div", {});
|
|
95
35
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
setTimeout(function () {
|
|
110
|
-
setTempError(false);
|
|
111
|
-
}, 500);
|
|
112
|
-
return [3 /*break*/, 11];
|
|
113
|
-
case 2:
|
|
114
|
-
_c.trys.push([2, 10, , 11]);
|
|
36
|
+
const onSubmit = async (token) => {
|
|
37
|
+
if (apiKey || internal || customSend) {
|
|
38
|
+
const valid = await trigger(undefined, { shouldFocus: true });
|
|
39
|
+
const values = getValues();
|
|
40
|
+
if (!valid) {
|
|
41
|
+
console.error('ERRORS:', errors);
|
|
42
|
+
setTempError(true);
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
setTempError(false);
|
|
45
|
+
}, 500);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
try {
|
|
115
49
|
setLoading(true);
|
|
116
|
-
for (
|
|
117
|
-
idStep = _a[_i];
|
|
50
|
+
for (const idStep of Object.keys(values)) {
|
|
118
51
|
updateValue(idStep, values, form, customSteps);
|
|
119
52
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
53
|
+
if (customSend) {
|
|
54
|
+
await customSend(values, reload);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const payload = {
|
|
58
|
+
formValues: { steps: values },
|
|
59
|
+
};
|
|
60
|
+
if (token) {
|
|
61
|
+
payload.token = token;
|
|
62
|
+
}
|
|
63
|
+
const url = `/ticket/${internal ? form.apiKey : apiKey}`;
|
|
64
|
+
const resp = domain || internal
|
|
65
|
+
? await widgetInstance.post(`${url}?idOrganization=${domain}`, payload)
|
|
66
|
+
: await axiosInstance.post(url, payload);
|
|
67
|
+
setShowConfirmation(resp?.data);
|
|
131
68
|
}
|
|
132
|
-
url = "/ticket/".concat(internal ? form.apiKey : apiKey);
|
|
133
|
-
if (!(domain || internal)) return [3 /*break*/, 6];
|
|
134
|
-
return [4 /*yield*/, widgetInstance.post("".concat(url, "?idOrganization=").concat(domain), payload)];
|
|
135
|
-
case 5:
|
|
136
|
-
_b = _c.sent();
|
|
137
|
-
return [3 /*break*/, 8];
|
|
138
|
-
case 6: return [4 /*yield*/, axiosInstance.post(url, payload)];
|
|
139
|
-
case 7:
|
|
140
|
-
_b = _c.sent();
|
|
141
|
-
_c.label = 8;
|
|
142
|
-
case 8:
|
|
143
|
-
resp = _b;
|
|
144
|
-
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
145
|
-
_c.label = 9;
|
|
146
|
-
case 9:
|
|
147
69
|
setLoading(false);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
console.error(error_1);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error(error);
|
|
152
73
|
setLoading(false);
|
|
153
|
-
|
|
154
|
-
case 11: return [2 /*return*/];
|
|
74
|
+
}
|
|
155
75
|
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return (_jsxs("div",
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return (_jsxs("div", { className: styles.container, style: { color: formStyle.textColor }, children: [loading && _jsx("div", { className: styles.curtain }), showConfirmation !== undefined && (_jsx(ConfirmationDialog, { formStyle: formStyle, confirmation: showConfirmation, onClose: () => {
|
|
159
79
|
reload();
|
|
160
80
|
setShowConfirmation(undefined);
|
|
161
|
-
} })), sections.map(
|
|
81
|
+
} })), sections.map((idSection, index) => (_jsx(SectionComponent, { form: form, sendLabel: sendLabel, domain: domain, postview: postview, clearErrors: clearErrors, widthStats: widthStats, control: control, getValues: getValues, originalValues: originalValues, errors: errors, index: index, setSections: setSections, section: form.sections[idSection], formStyle: formStyle, customSteps: customSteps, setDependencyStore: setDependencyStore, dependencyStore: dependencyStore, trigger: trigger, ...others }, index))), form.terms &&
|
|
162
82
|
(!internal || (internal && postview)) &&
|
|
163
|
-
|
|
83
|
+
originalValues?.['INTERNAL_CREATING_AGENT'] === undefined && (_jsx("div", { className: styles.termsContainer, style: {
|
|
164
84
|
width: (form.size.blockSize + form.size.spacingSize) *
|
|
165
85
|
form.size.blockNum,
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
})];
|
|
175
|
-
case 1:
|
|
176
|
-
valid = _a.sent();
|
|
177
|
-
if (!valid) return [3 /*break*/, 4];
|
|
178
|
-
captcha = recaptchaRef.current.getValue();
|
|
179
|
-
if (!!captcha) return [3 /*break*/, 3];
|
|
180
|
-
return [4 /*yield*/, (recaptchaRef === null || recaptchaRef === void 0 ? void 0 : recaptchaRef.current.executeAsync())];
|
|
181
|
-
case 2:
|
|
86
|
+
}, children: form.terms.map((term, index) => (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index))) })), !postview && (_jsxs(React.Fragment, { children: [form.hasCaptcha && !internal && (_jsx(ReCAPTCHA, { ref: recaptchaRef, sitekey: "6LcL22kkAAAAAEotDeAFbRATob-u5vbibbCyWL2p", size: 'invisible', badge: 'bottomright' })), _jsx("div", { className: styles.submitBtnContainer, children: _jsxs("button", { "data-testid": "form__submit", className: styles.submitBtn, onClick: async () => {
|
|
87
|
+
if (form.hasCaptcha && !internal) {
|
|
88
|
+
const valid = await trigger(undefined, {
|
|
89
|
+
shouldFocus: true,
|
|
90
|
+
});
|
|
91
|
+
if (valid) {
|
|
92
|
+
let captcha = recaptchaRef.current.getValue();
|
|
93
|
+
if (!captcha)
|
|
182
94
|
captcha =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
case 3:
|
|
186
|
-
onSubmit(captcha);
|
|
187
|
-
_a.label = 4;
|
|
188
|
-
case 4: return [3 /*break*/, 6];
|
|
189
|
-
case 5:
|
|
190
|
-
onSubmit();
|
|
191
|
-
_a.label = 6;
|
|
192
|
-
case 6: return [2 /*return*/];
|
|
95
|
+
await recaptchaRef?.current.executeAsync();
|
|
96
|
+
onSubmit(captcha);
|
|
193
97
|
}
|
|
194
|
-
}
|
|
195
|
-
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
onSubmit();
|
|
101
|
+
}
|
|
102
|
+
}, style: {
|
|
196
103
|
background: formStyle.primaryColor,
|
|
197
104
|
color: formStyle.primaryContrastColor,
|
|
198
|
-
}, disabled: loading
|
|
105
|
+
}, disabled: loading, children: [_jsx("div", { style: {
|
|
199
106
|
visibility: loading ? 'hidden' : 'visible',
|
|
200
|
-
}
|
|
107
|
+
}, children: sendLabel ?? 'Enviar' }), loading && (_jsx("div", { className: styles.loaderContainer, children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) }))] }) })] }))] }));
|
|
201
108
|
}
|
|
202
109
|
export default ColumnForm;
|
|
203
110
|
function calcNextSection(form, idSection, sections) {
|
|
204
|
-
|
|
205
|
-
var section = form.sections[idSection];
|
|
111
|
+
const section = form.sections[idSection];
|
|
206
112
|
if (section) {
|
|
207
113
|
sections.push(idSection);
|
|
208
|
-
|
|
209
|
-
|
|
114
|
+
const nextSectionId = section.nextSection ?? '';
|
|
115
|
+
const nextSection = form.sections[nextSectionId];
|
|
210
116
|
if (nextSection) {
|
|
211
117
|
calcNextSection(form, nextSectionId, sections);
|
|
212
118
|
}
|
|
213
119
|
}
|
|
214
120
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
var step = form.steps[val];
|
|
121
|
+
const mapOriginalValues = (originalValues, form) => {
|
|
122
|
+
const newValues = { ...originalValues };
|
|
123
|
+
for (const val of Object.keys(originalValues)) {
|
|
124
|
+
const step = form.steps[val];
|
|
220
125
|
if (step) {
|
|
221
|
-
switch (step
|
|
126
|
+
switch (step?.type) {
|
|
222
127
|
case Types.TEXTAREA: {
|
|
223
|
-
|
|
128
|
+
const value = originalValues[step.id];
|
|
224
129
|
if (step.hasTextEditor) {
|
|
225
130
|
delete newValues[step.id];
|
|
226
131
|
}
|
|
@@ -230,19 +135,19 @@ var mapOriginalValues = function (originalValues, form) {
|
|
|
230
135
|
break;
|
|
231
136
|
}
|
|
232
137
|
case Types.SELECTOR: {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (!
|
|
138
|
+
const value = originalValues[step.id];
|
|
139
|
+
const option = step.options.find((option) => option.value == value);
|
|
140
|
+
if (!value?.value)
|
|
236
141
|
newValues[step.id] = option;
|
|
237
142
|
break;
|
|
238
143
|
}
|
|
239
144
|
case Types.CLASSIFIER_SELECTOR: {
|
|
240
|
-
|
|
241
|
-
|
|
145
|
+
const value = originalValues[step.id];
|
|
146
|
+
const classifier = form.classifiers[step.idClassifier ?? ''];
|
|
242
147
|
if (classifier) {
|
|
243
|
-
|
|
244
|
-
if (!
|
|
245
|
-
newValues[step.id] = { value
|
|
148
|
+
const option = classifier.children.find((child) => child._id == value);
|
|
149
|
+
if (!value?.value)
|
|
150
|
+
newValues[step.id] = { value, label: option?.name };
|
|
246
151
|
}
|
|
247
152
|
break;
|
|
248
153
|
}
|
|
@@ -250,26 +155,21 @@ var mapOriginalValues = function (originalValues, form) {
|
|
|
250
155
|
break;
|
|
251
156
|
}
|
|
252
157
|
}
|
|
253
|
-
};
|
|
254
|
-
for (var _i = 0, _b = Object.keys(originalValues); _i < _b.length; _i++) {
|
|
255
|
-
var val = _b[_i];
|
|
256
|
-
_loop_1(val);
|
|
257
158
|
}
|
|
258
159
|
return newValues;
|
|
259
160
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
161
|
+
const updateValue = (idStep, values, form, customSteps) => {
|
|
162
|
+
const step = form.steps[idStep];
|
|
163
|
+
const custom = customSteps[step?.type];
|
|
264
164
|
if (custom !== undefined) {
|
|
265
165
|
custom.updateValue(idStep, values, form);
|
|
266
166
|
}
|
|
267
167
|
else {
|
|
268
|
-
switch (step
|
|
168
|
+
switch (step?.type) {
|
|
269
169
|
case Types.TEXTAREA: {
|
|
270
|
-
|
|
170
|
+
const value = values[step.id];
|
|
271
171
|
if (step.hasTextEditor) {
|
|
272
|
-
|
|
172
|
+
const currentContent = value.getCurrentContent();
|
|
273
173
|
values[step.id] = {
|
|
274
174
|
value: currentContent.getPlainText(),
|
|
275
175
|
draft: convertToRaw(currentContent),
|
|
@@ -277,40 +177,40 @@ var updateValue = function (idStep, values, form, customSteps) {
|
|
|
277
177
|
}
|
|
278
178
|
else {
|
|
279
179
|
values[step.id] = {
|
|
280
|
-
value
|
|
180
|
+
value,
|
|
281
181
|
draft: stringToDraft(value),
|
|
282
182
|
};
|
|
283
183
|
}
|
|
284
184
|
break;
|
|
285
185
|
}
|
|
286
186
|
case Types.FILEUPLOAD: {
|
|
287
|
-
|
|
288
|
-
values[step.id] = value.map(
|
|
187
|
+
const value = values[step.id];
|
|
188
|
+
values[step.id] = value.map((val) => ({
|
|
289
189
|
fileName: val.fileName,
|
|
290
190
|
S3Key: val.S3Key,
|
|
291
|
-
})
|
|
191
|
+
}));
|
|
292
192
|
break;
|
|
293
193
|
}
|
|
294
194
|
case Types.SELECTOR:
|
|
295
195
|
case Types.CLASSIFIER_SELECTOR: {
|
|
296
|
-
|
|
196
|
+
const value = values[step.id];
|
|
297
197
|
values[step.id] = value.value;
|
|
298
198
|
break;
|
|
299
199
|
}
|
|
300
200
|
default:
|
|
301
|
-
if (
|
|
302
|
-
values[step.id] =
|
|
201
|
+
if (step?.type === 'CBR_INCIDENCIAS') {
|
|
202
|
+
values[step.id] = values[step.id]?.filter((inmueble) => inmueble.deleted !== true);
|
|
303
203
|
}
|
|
304
204
|
break;
|
|
305
205
|
}
|
|
306
206
|
}
|
|
307
207
|
};
|
|
308
208
|
function stringToDraft(text) {
|
|
309
|
-
|
|
209
|
+
let draftStructure = {
|
|
310
210
|
blocks: [],
|
|
311
211
|
entityMap: {},
|
|
312
212
|
};
|
|
313
|
-
text.split('\n').forEach(
|
|
213
|
+
text.split('\n').forEach((element, index) => {
|
|
314
214
|
draftStructure.blocks.push({
|
|
315
215
|
key: String(index),
|
|
316
216
|
text: element,
|
|
@@ -324,16 +224,13 @@ function stringToDraft(text) {
|
|
|
324
224
|
return draftStructure;
|
|
325
225
|
}
|
|
326
226
|
function calcDependencies(steps, originalValues) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
for (var _i = 0, _b = Object.values(steps); _i < _b.length; _i++) {
|
|
330
|
-
var step = _b[_i];
|
|
227
|
+
const dependencies = {};
|
|
228
|
+
for (const step of Object.values(steps)) {
|
|
331
229
|
if (step.dependencies) {
|
|
332
|
-
for (
|
|
333
|
-
|
|
334
|
-
var depStep = steps[idDep];
|
|
230
|
+
for (const idDep of step.dependencies) {
|
|
231
|
+
const depStep = steps[idDep];
|
|
335
232
|
if (depStep && dependencies[idDep] === undefined) {
|
|
336
|
-
switch (depStep
|
|
233
|
+
switch (depStep?.type) {
|
|
337
234
|
case Types.TEXTAREA: {
|
|
338
235
|
if (depStep.hasTextEditor) {
|
|
339
236
|
dependencies[idDep] = null;
|
|
@@ -345,7 +242,7 @@ function calcDependencies(steps, originalValues) {
|
|
|
345
242
|
break;
|
|
346
243
|
}
|
|
347
244
|
default:
|
|
348
|
-
dependencies[idDep] =
|
|
245
|
+
dependencies[idDep] = originalValues[idDep] ?? null;
|
|
349
246
|
break;
|
|
350
247
|
}
|
|
351
248
|
}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import CheckCircleOutlineRoundedIcon from '@material-ui/icons/CheckCircleOutlineRounded';
|
|
14
3
|
import styles from './ConfirmationDialog.module.css';
|
|
15
4
|
import Dialog from '@material-ui/core/Dialog';
|
|
16
5
|
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
17
|
-
function ConfirmationDialog(
|
|
18
|
-
|
|
19
|
-
return (_jsx(Dialog, __assign({ PaperProps: {
|
|
6
|
+
function ConfirmationDialog({ confirmation, formStyle, onClose, }) {
|
|
7
|
+
return (_jsx(Dialog, { PaperProps: {
|
|
20
8
|
style: {
|
|
21
9
|
borderRadius: '20px',
|
|
22
10
|
maxWidth: '100vw',
|
|
23
11
|
boxSizing: 'content-box',
|
|
24
12
|
},
|
|
25
|
-
}, open: true
|
|
13
|
+
}, open: true, children: _jsxs("div", { className: styles.confirmationContainer, style: { color: formStyle.textColor }, children: [_jsx("div", { className: styles.closeIcon, onClick: () => {
|
|
26
14
|
onClose();
|
|
27
|
-
}
|
|
15
|
+
}, children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) }), _jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.checkContainer, style: { color: formStyle.primaryColor }, children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }) }), _jsxs("div", { className: styles.messageContainer, children: ["Tu caso n\u00FAmero", ' ', _jsx("span", { style: { fontWeight: 'bold' }, children: confirmation.case }), ' ', "ha sido registrado!"] }), _jsx("div", { className: styles.messageContainer, children: "Pronto te estaremos dando respuesta." }), _jsxs("div", { className: styles.linkContainer, children: ["Puedes consultar el estado aqui:", ' '] }), _jsx("a", { className: styles.url, "data-testid": "ResUrl", target: "_blank", href: confirmation.url, style: {
|
|
28
16
|
color: formStyle.textColor,
|
|
29
|
-
}
|
|
17
|
+
}, children: confirmation.url })] })] }) }));
|
|
30
18
|
}
|
|
31
19
|
export default ConfirmationDialog;
|