@arquimedes.co/eureka-forms 1.9.16-test → 1.9.17-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.
Files changed (64) hide show
  1. package/dist/App.js +98 -205
  2. package/dist/AxiosAPI.js +3 -3
  3. package/dist/AxiosWidget.js +4 -4
  4. package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +104 -207
  5. package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -17
  6. package/dist/FormComponents/Form/Form.js +29 -56
  7. package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
  8. package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +7 -30
  9. package/dist/FormComponents/Section/Section.js +2 -13
  10. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
  11. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +9 -32
  12. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +47 -64
  13. package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +41 -102
  14. package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +37 -92
  15. package/dist/FormComponents/Step/AYFStepMapper.js +23 -75
  16. package/dist/FormComponents/Step/CBRStepMapper.js +56 -144
  17. package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +3 -26
  18. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +6 -21
  19. package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +3 -26
  20. package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +32 -65
  21. package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +2 -13
  22. package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +6 -21
  23. package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +2 -13
  24. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +27 -88
  25. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +81 -171
  26. package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -41
  27. package/dist/FormComponents/Step/RatingStep/RatingStep.js +2 -13
  28. package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +25 -52
  29. package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +3 -26
  30. package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +1 -2
  31. package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +3 -26
  32. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +83 -145
  33. package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +2 -13
  34. package/dist/FormComponents/Step/Step.js +19 -39
  35. package/dist/FormComponents/Step/StepFunctions.js +14 -16
  36. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +43 -62
  37. package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +2 -13
  38. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +6 -21
  39. package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +2 -13
  40. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -15
  41. package/dist/FormComponents/Step/TitleStep/TitleStep.js +3 -26
  42. package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +19 -35
  43. package/dist/FormComponents/Term/Term.js +2 -13
  44. package/dist/Widget.js +13 -25
  45. package/dist/constants/Files/FileExtensions.js +3 -3
  46. package/dist/constants/Files/FileMaxSize.js +1 -1
  47. package/dist/constants/InternalFormStyle.js +1 -1
  48. package/dist/constants/MaterialClassNameSeed.js +1 -1
  49. package/dist/controllers/FileService.js +29 -86
  50. package/dist/index.js +4 -15
  51. package/dist/shared/Loader/Loader.js +5 -17
  52. package/dist/shared/Navbar/Navbar.js +2 -14
  53. package/dist/shared/Rating/Rating.js +4 -27
  54. package/dist/shared/Rating/Ratings/LikeRating.js +9 -21
  55. package/dist/shared/Rating/Ratings/SatisfactionRating.js +15 -27
  56. package/dist/shared/Rating/Ratings/ScaleRating.js +22 -49
  57. package/dist/shared/RoundedButton/RoundedButton.js +12 -24
  58. package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +39 -84
  59. package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +235 -286
  60. package/dist/shared/RoundedSelect/RoundedSelect.js +103 -152
  61. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +125 -160
  62. package/dist/shared/RoundedTextField/RoundedTextField.js +92 -137
  63. package/dist/utils/CbrFunctions.js +30 -30
  64. package/package.json +4 -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(_a) {
74
- var _this = this;
75
- var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, sendLabel = _a.sendLabel, widthStats = _a.widthStats, customSteps = _a.customSteps, customSend = _a.customSend, handleLoaded = _a.handleLoaded, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "sendLabel", "widthStats", "customSteps", "customSend", "handleLoaded", "originalValues"]);
76
- var _b = useState(false), tempError = _b[0], setTempError = _b[1];
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
- }), getValues = _d.getValues, setValue = _d.setValue, clearErrors = _d.clearErrors, control = _d.control, errors = _d.formState.errors, trigger = _d.trigger;
83
- var recaptchaRef = useRef();
84
- var _e = useState(undefined), sections = _e[0], setSections = _e[1];
85
- var _f = useState(false), loading = _f[0], setLoading = _f[1];
86
- var _g = useState(), showConfirmation = _g[0], setShowConfirmation = _g[1];
87
- useEffect(function () {
88
- var tempSections = [];
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
- var onSubmit = function (token) { return __awaiter(_this, void 0, void 0, function () {
97
- var valid, values, _i, _a, idStep, payload, url, resp, _b, error_1;
98
- return __generator(this, function (_c) {
99
- switch (_c.label) {
100
- case 0:
101
- if (!(apiKey || internal || customSend)) return [3 /*break*/, 11];
102
- return [4 /*yield*/, trigger(undefined, { shouldFocus: true })];
103
- case 1:
104
- valid = _c.sent();
105
- values = getValues();
106
- if (!!valid) return [3 /*break*/, 2];
107
- console.error('ERRORS:', errors);
108
- setTempError(true);
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 (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
117
- idStep = _a[_i];
50
+ for (const idStep of Object.keys(values)) {
118
51
  updateValue(idStep, values, form, customSteps);
119
52
  }
120
- if (!customSend) return [3 /*break*/, 4];
121
- return [4 /*yield*/, customSend(values, reload)];
122
- case 3:
123
- _c.sent();
124
- return [3 /*break*/, 9];
125
- case 4:
126
- payload = {
127
- formValues: { steps: values },
128
- };
129
- if (token) {
130
- payload.token = token;
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
- return [3 /*break*/, 11];
149
- case 10:
150
- error_1 = _c.sent();
151
- console.error(error_1);
70
+ }
71
+ catch (error) {
72
+ console.error(error);
152
73
  setLoading(false);
153
- return [3 /*break*/, 11];
154
- case 11: return [2 /*return*/];
74
+ }
155
75
  }
156
- });
157
- }); };
158
- return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), showConfirmation !== undefined && (_jsx(ConfirmationDialog, { formStyle: formStyle, confirmation: showConfirmation, onClose: function () {
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(function (idSection, index) { return (_jsx(SectionComponent, __assign({ 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 &&
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
- (originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined && (_jsx("div", __assign({ className: styles.termsContainer, style: {
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
- } }, { children: form.terms.map(function (term, index) { return (_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", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "form__submit", className: styles.submitBtn, onClick: function () { return __awaiter(_this, void 0, void 0, function () {
167
- var valid, captcha;
168
- return __generator(this, function (_a) {
169
- switch (_a.label) {
170
- case 0:
171
- if (!(form.hasCaptcha && !internal)) return [3 /*break*/, 5];
172
- return [4 /*yield*/, trigger(undefined, {
173
- shouldFocus: true,
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
- _a.sent();
184
- _a.label = 3;
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
- }); }, style: {
98
+ }
99
+ else {
100
+ onSubmit();
101
+ }
102
+ }, style: {
196
103
  background: formStyle.primaryColor,
197
104
  color: formStyle.primaryContrastColor,
198
- }, disabled: loading }, { children: [_jsx("div", __assign({ style: {
105
+ }, disabled: loading, children: [_jsx("div", { style: {
199
106
  visibility: loading ? 'hidden' : 'visible',
200
- } }, { children: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })) }))] }))] })));
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
- var _a;
205
- var section = form.sections[idSection];
111
+ const section = form.sections[idSection];
206
112
  if (section) {
207
113
  sections.push(idSection);
208
- var nextSectionId = (_a = section.nextSection) !== null && _a !== void 0 ? _a : '';
209
- var nextSection = form.sections[nextSectionId];
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
- var mapOriginalValues = function (originalValues, form) {
216
- var _a;
217
- var newValues = __assign({}, originalValues);
218
- var _loop_1 = function (val) {
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 === null || step === void 0 ? void 0 : step.type) {
126
+ switch (step?.type) {
222
127
  case Types.TEXTAREA: {
223
- var value = originalValues[step.id];
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
- var value_1 = originalValues[step.id];
234
- var option = step.options.find(function (option) { return option.value == value_1; });
235
- if (!(value_1 === null || value_1 === void 0 ? void 0 : value_1.value))
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
- var value_2 = originalValues[step.id];
241
- var classifier = form.classifiers[(_a = step.idClassifier) !== null && _a !== void 0 ? _a : ''];
145
+ const value = originalValues[step.id];
146
+ const classifier = form.classifiers[step.idClassifier ?? ''];
242
147
  if (classifier) {
243
- var option = classifier.children.find(function (child) { return child._id == value_2; });
244
- if (!(value_2 === null || value_2 === void 0 ? void 0 : value_2.value))
245
- newValues[step.id] = { value: value_2, label: option === null || option === void 0 ? void 0 : option.name };
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
- var updateValue = function (idStep, values, form, customSteps) {
261
- var _a;
262
- var step = form.steps[idStep];
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 === null || step === void 0 ? void 0 : step.type) {
168
+ switch (step?.type) {
269
169
  case Types.TEXTAREA: {
270
- var value = values[step.id];
170
+ const value = values[step.id];
271
171
  if (step.hasTextEditor) {
272
- var currentContent = value.getCurrentContent();
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: value,
180
+ value,
281
181
  draft: stringToDraft(value),
282
182
  };
283
183
  }
284
184
  break;
285
185
  }
286
186
  case Types.FILEUPLOAD: {
287
- var value = values[step.id];
288
- values[step.id] = value.map(function (val) { return ({
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
- var value = values[step.id];
196
+ const value = values[step.id];
297
197
  values[step.id] = value.value;
298
198
  break;
299
199
  }
300
200
  default:
301
- if ((step === null || step === void 0 ? void 0 : step.type) === 'CBR_INCIDENCIAS') {
302
- values[step.id] = (_a = values[step.id]) === null || _a === void 0 ? void 0 : _a.filter(function (inmueble) { return inmueble.deleted !== true; });
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
- var draftStructure = {
209
+ let draftStructure = {
310
210
  blocks: [],
311
211
  entityMap: {},
312
212
  };
313
- text.split('\n').forEach(function (element, index) {
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
- var _a;
328
- var dependencies = {};
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 (var _c = 0, _d = step.dependencies; _c < _d.length; _c++) {
333
- var idDep = _d[_c];
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 === null || depStep === void 0 ? void 0 : depStep.type) {
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] = (_a = originalValues[idDep]) !== null && _a !== void 0 ? _a : null;
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(_a) {
18
- var confirmation = _a.confirmation, formStyle = _a.formStyle, onClose = _a.onClose;
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 }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
13
+ }, open: true, children: _jsxs("div", { className: styles.confirmationContainer, style: { color: formStyle.textColor }, children: [_jsx("div", { className: styles.closeIcon, onClick: () => {
26
14
  onClose();
27
- } }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), _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' } }) })), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case })), ' ', "ha sido registrado!"] })), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." })), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] })), _jsx("a", __assign({ className: styles.url, "data-testid": "ResUrl", target: "_blank", href: confirmation.url, style: {
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
- } }, { children: confirmation.url }))] }))] })) })));
17
+ }, children: confirmation.url })] })] }) }));
30
18
  }
31
19
  export default ConfirmationDialog;