@arquimedes.co/eureka-forms 1.9.19-test → 1.9.20-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 +205 -98
  2. package/dist/AxiosAPI.js +3 -3
  3. package/dist/AxiosWidget.js +4 -4
  4. package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +207 -104
  5. package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +17 -5
  6. package/dist/FormComponents/Form/Form.js +56 -29
  7. package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
  8. package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +30 -7
  9. package/dist/FormComponents/Section/Section.js +13 -2
  10. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +13 -2
  11. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +32 -9
  12. package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +64 -47
  13. package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +102 -41
  14. package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +92 -37
  15. package/dist/FormComponents/Step/AYFStepMapper.js +75 -23
  16. package/dist/FormComponents/Step/CBRStepMapper.js +144 -56
  17. package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +26 -3
  18. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +21 -6
  19. package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +26 -3
  20. package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +65 -32
  21. package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +13 -2
  22. package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +21 -6
  23. package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +13 -2
  24. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +88 -27
  25. package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +171 -81
  26. package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +41 -15
  27. package/dist/FormComponents/Step/RatingStep/RatingStep.js +13 -2
  28. package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +52 -25
  29. package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +26 -3
  30. package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +2 -1
  31. package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +26 -3
  32. package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +145 -83
  33. package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +13 -2
  34. package/dist/FormComponents/Step/Step.js +39 -19
  35. package/dist/FormComponents/Step/StepFunctions.js +16 -14
  36. package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +62 -43
  37. package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +13 -2
  38. package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +21 -6
  39. package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +13 -2
  40. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +15 -3
  41. package/dist/FormComponents/Step/TitleStep/TitleStep.js +26 -3
  42. package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +35 -19
  43. package/dist/FormComponents/Term/Term.js +13 -2
  44. package/dist/Widget.js +25 -13
  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 +86 -29
  50. package/dist/index.js +15 -4
  51. package/dist/shared/Loader/Loader.js +17 -5
  52. package/dist/shared/Navbar/Navbar.js +14 -2
  53. package/dist/shared/Rating/Rating.js +27 -4
  54. package/dist/shared/Rating/Ratings/LikeRating.js +21 -9
  55. package/dist/shared/Rating/Ratings/SatisfactionRating.js +27 -15
  56. package/dist/shared/Rating/Ratings/ScaleRating.js +49 -22
  57. package/dist/shared/RoundedButton/RoundedButton.js +24 -12
  58. package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +84 -39
  59. package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +286 -235
  60. package/dist/shared/RoundedSelect/RoundedSelect.js +152 -103
  61. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +160 -125
  62. package/dist/shared/RoundedTextField/RoundedTextField.js +137 -92
  63. package/dist/utils/CbrFunctions.js +30 -30
  64. package/package.json +1 -3
@@ -1,3 +1,61 @@
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
+ };
1
59
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
60
  import { useEffect, useRef, useState } from 'react';
3
61
  import ReCAPTCHA from 'react-google-recaptcha';
@@ -12,20 +70,22 @@ import Loader from '../../../shared/Loader/Loader';
12
70
  import axiosInstance from '../../../AxiosAPI';
13
71
  import widgetInstance from '../../../AxiosWidget';
14
72
  import React from 'react';
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({
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({
19
79
  defaultValues: mapOriginalValues(originalValues, form),
20
80
  mode: 'onTouched',
21
81
  shouldFocusError: true,
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 = [];
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 = [];
29
89
  calcNextSection(form, form.firstSection, tempSections);
30
90
  setSections(tempSections);
31
91
  handleLoaded();
@@ -33,99 +93,134 @@ function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyl
33
93
  if (sections === undefined) {
34
94
  return _jsx("div", {});
35
95
  }
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 {
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]);
49
115
  setLoading(true);
50
- for (const idStep of Object.keys(values)) {
116
+ for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
117
+ idStep = _a[_i];
51
118
  updateValue(idStep, values, form, customSteps);
52
119
  }
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);
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;
68
131
  }
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:
69
147
  setLoading(false);
70
- }
71
- catch (error) {
72
- console.error(error);
148
+ return [3 /*break*/, 11];
149
+ case 10:
150
+ error_1 = _c.sent();
151
+ console.error(error_1);
73
152
  setLoading(false);
74
- }
153
+ return [3 /*break*/, 11];
154
+ case 11: return [2 /*return*/];
75
155
  }
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: () => {
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 () {
79
159
  reload();
80
160
  setShowConfirmation(undefined);
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 &&
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 &&
82
162
  (!internal || (internal && postview)) &&
83
- originalValues?.['INTERNAL_CREATING_AGENT'] === undefined && (_jsx("div", { className: styles.termsContainer, style: {
163
+ (originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined && (_jsx("div", __assign({ className: styles.termsContainer, style: {
84
164
  width: (form.size.blockSize + form.size.spacingSize) *
85
165
  form.size.blockNum,
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)
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:
94
182
  captcha =
95
- await recaptchaRef?.current.executeAsync();
96
- onSubmit(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*/];
97
193
  }
98
- }
99
- else {
100
- onSubmit();
101
- }
102
- }, style: {
194
+ });
195
+ }); }, style: {
103
196
  background: formStyle.primaryColor,
104
197
  color: formStyle.primaryContrastColor,
105
- }, disabled: loading, children: [_jsx("div", { style: {
198
+ }, disabled: loading }, { children: [_jsx("div", __assign({ style: {
106
199
  visibility: loading ? 'hidden' : 'visible',
107
- }, children: sendLabel ?? 'Enviar' }), loading && (_jsx("div", { className: styles.loaderContainer, children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) }))] }) })] }))] }));
200
+ } }, { children: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })) }))] }))] })));
108
201
  }
109
202
  export default ColumnForm;
110
203
  function calcNextSection(form, idSection, sections) {
111
- const section = form.sections[idSection];
204
+ var _a;
205
+ var section = form.sections[idSection];
112
206
  if (section) {
113
207
  sections.push(idSection);
114
- const nextSectionId = section.nextSection ?? '';
115
- const nextSection = form.sections[nextSectionId];
208
+ var nextSectionId = (_a = section.nextSection) !== null && _a !== void 0 ? _a : '';
209
+ var nextSection = form.sections[nextSectionId];
116
210
  if (nextSection) {
117
211
  calcNextSection(form, nextSectionId, sections);
118
212
  }
119
213
  }
120
214
  }
121
- const mapOriginalValues = (originalValues, form) => {
122
- const newValues = { ...originalValues };
123
- for (const val of Object.keys(originalValues)) {
124
- const step = form.steps[val];
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];
125
220
  if (step) {
126
- switch (step?.type) {
221
+ switch (step === null || step === void 0 ? void 0 : step.type) {
127
222
  case Types.TEXTAREA: {
128
- const value = originalValues[step.id];
223
+ var value = originalValues[step.id];
129
224
  if (step.hasTextEditor) {
130
225
  delete newValues[step.id];
131
226
  }
@@ -135,19 +230,19 @@ const mapOriginalValues = (originalValues, form) => {
135
230
  break;
136
231
  }
137
232
  case Types.SELECTOR: {
138
- const value = originalValues[step.id];
139
- const option = step.options.find((option) => option.value == value);
140
- if (!value?.value)
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))
141
236
  newValues[step.id] = option;
142
237
  break;
143
238
  }
144
239
  case Types.CLASSIFIER_SELECTOR: {
145
- const value = originalValues[step.id];
146
- const classifier = form.classifiers[step.idClassifier ?? ''];
240
+ var value_2 = originalValues[step.id];
241
+ var classifier = form.classifiers[(_a = step.idClassifier) !== null && _a !== void 0 ? _a : ''];
147
242
  if (classifier) {
148
- const option = classifier.children.find((child) => child._id == value);
149
- if (!value?.value)
150
- newValues[step.id] = { value, label: option?.name };
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 };
151
246
  }
152
247
  break;
153
248
  }
@@ -155,21 +250,26 @@ const mapOriginalValues = (originalValues, form) => {
155
250
  break;
156
251
  }
157
252
  }
253
+ };
254
+ for (var _i = 0, _b = Object.keys(originalValues); _i < _b.length; _i++) {
255
+ var val = _b[_i];
256
+ _loop_1(val);
158
257
  }
159
258
  return newValues;
160
259
  };
161
- const updateValue = (idStep, values, form, customSteps) => {
162
- const step = form.steps[idStep];
163
- const custom = customSteps[step?.type];
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];
164
264
  if (custom !== undefined) {
165
265
  custom.updateValue(idStep, values, form);
166
266
  }
167
267
  else {
168
- switch (step?.type) {
268
+ switch (step === null || step === void 0 ? void 0 : step.type) {
169
269
  case Types.TEXTAREA: {
170
- const value = values[step.id];
270
+ var value = values[step.id];
171
271
  if (step.hasTextEditor) {
172
- const currentContent = value.getCurrentContent();
272
+ var currentContent = value.getCurrentContent();
173
273
  values[step.id] = {
174
274
  value: currentContent.getPlainText(),
175
275
  draft: convertToRaw(currentContent),
@@ -177,40 +277,40 @@ const updateValue = (idStep, values, form, customSteps) => {
177
277
  }
178
278
  else {
179
279
  values[step.id] = {
180
- value,
280
+ value: value,
181
281
  draft: stringToDraft(value),
182
282
  };
183
283
  }
184
284
  break;
185
285
  }
186
286
  case Types.FILEUPLOAD: {
187
- const value = values[step.id];
188
- values[step.id] = value.map((val) => ({
287
+ var value = values[step.id];
288
+ values[step.id] = value.map(function (val) { return ({
189
289
  fileName: val.fileName,
190
290
  S3Key: val.S3Key,
191
- }));
291
+ }); });
192
292
  break;
193
293
  }
194
294
  case Types.SELECTOR:
195
295
  case Types.CLASSIFIER_SELECTOR: {
196
- const value = values[step.id];
296
+ var value = values[step.id];
197
297
  values[step.id] = value.value;
198
298
  break;
199
299
  }
200
300
  default:
201
- if (step?.type === 'CBR_INCIDENCIAS') {
202
- values[step.id] = values[step.id]?.filter((inmueble) => inmueble.deleted !== true);
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; });
203
303
  }
204
304
  break;
205
305
  }
206
306
  }
207
307
  };
208
308
  function stringToDraft(text) {
209
- let draftStructure = {
309
+ var draftStructure = {
210
310
  blocks: [],
211
311
  entityMap: {},
212
312
  };
213
- text.split('\n').forEach((element, index) => {
313
+ text.split('\n').forEach(function (element, index) {
214
314
  draftStructure.blocks.push({
215
315
  key: String(index),
216
316
  text: element,
@@ -224,13 +324,16 @@ function stringToDraft(text) {
224
324
  return draftStructure;
225
325
  }
226
326
  function calcDependencies(steps, originalValues) {
227
- const dependencies = {};
228
- for (const step of Object.values(steps)) {
327
+ var _a;
328
+ var dependencies = {};
329
+ for (var _i = 0, _b = Object.values(steps); _i < _b.length; _i++) {
330
+ var step = _b[_i];
229
331
  if (step.dependencies) {
230
- for (const idDep of step.dependencies) {
231
- const depStep = steps[idDep];
332
+ for (var _c = 0, _d = step.dependencies; _c < _d.length; _c++) {
333
+ var idDep = _d[_c];
334
+ var depStep = steps[idDep];
232
335
  if (depStep && dependencies[idDep] === undefined) {
233
- switch (depStep?.type) {
336
+ switch (depStep === null || depStep === void 0 ? void 0 : depStep.type) {
234
337
  case Types.TEXTAREA: {
235
338
  if (depStep.hasTextEditor) {
236
339
  dependencies[idDep] = null;
@@ -242,7 +345,7 @@ function calcDependencies(steps, originalValues) {
242
345
  break;
243
346
  }
244
347
  default:
245
- dependencies[idDep] = originalValues[idDep] ?? null;
348
+ dependencies[idDep] = (_a = originalValues[idDep]) !== null && _a !== void 0 ? _a : null;
246
349
  break;
247
350
  }
248
351
  }
@@ -1,19 +1,31 @@
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
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import CheckCircleOutlineRoundedIcon from '@material-ui/icons/CheckCircleOutlineRounded';
3
14
  import styles from './ConfirmationDialog.module.css';
4
15
  import Dialog from '@material-ui/core/Dialog';
5
16
  import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
6
- function ConfirmationDialog({ confirmation, formStyle, onClose, }) {
7
- return (_jsx(Dialog, { PaperProps: {
17
+ function ConfirmationDialog(_a) {
18
+ var confirmation = _a.confirmation, formStyle = _a.formStyle, onClose = _a.onClose;
19
+ return (_jsx(Dialog, __assign({ PaperProps: {
8
20
  style: {
9
21
  borderRadius: '20px',
10
22
  maxWidth: '100vw',
11
23
  boxSizing: 'content-box',
12
24
  },
13
- }, open: true, children: _jsxs("div", { className: styles.confirmationContainer, style: { color: formStyle.textColor }, children: [_jsx("div", { className: styles.closeIcon, onClick: () => {
25
+ }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
14
26
  onClose();
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: {
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: {
16
28
  color: formStyle.textColor,
17
- }, children: confirmation.url })] })] }) }));
29
+ } }, { children: confirmation.url }))] }))] })) })));
18
30
  }
19
31
  export default ConfirmationDialog;