@arquimedes.co/eureka-forms 1.9.3 → 1.9.4-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.
@@ -66,7 +66,6 @@ import Types from '../../../constants/FormStepTypes';
66
66
  import { convertToRaw } from 'draft-js';
67
67
  import TermComponent from '../../Term/Term';
68
68
  import ConfirmationDialog from '../ConfirmationDialog/ConfirmationDialog';
69
- import EntradasConfirmationDialog from '../EntradasAmarillasDialog/ConfirmationDialog';
70
69
  import Loader from '../../../shared/Loader/Loader';
71
70
  import axiosInstance from '../../../AxiosAPI';
72
71
  import widgetInstance from '../../../AxiosWidget';
@@ -85,7 +84,6 @@ function ColumnForm(_a) {
85
84
  var _e = useState(undefined), sections = _e[0], setSections = _e[1];
86
85
  var _f = useState(false), loading = _f[0], setLoading = _f[1];
87
86
  var _g = useState(), showConfirmation = _g[0], setShowConfirmation = _g[1];
88
- var _h = useState(), showEntradasConfirmation = _h[0], setShowEntradasConfirmation = _h[1];
89
87
  useEffect(function () {
90
88
  var tempSections = [];
91
89
  calcNextSection(form, form.firstSection, tempSections);
@@ -143,14 +141,7 @@ function ColumnForm(_a) {
143
141
  _c.label = 8;
144
142
  case 8:
145
143
  resp = _b;
146
- if (others.organization.idOrganization ===
147
- 'entradasamarillas' &&
148
- form.apiKey === 'precarga') {
149
- setShowEntradasConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
150
- }
151
- else {
152
- setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
153
- }
144
+ setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
154
145
  _c.label = 9;
155
146
  case 9:
156
147
  setLoading(false);
@@ -167,9 +158,6 @@ function ColumnForm(_a) {
167
158
  return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }, void 0), showConfirmation !== undefined && (_jsx(ConfirmationDialog, { formStyle: formStyle, confirmation: showConfirmation, onClose: function () {
168
159
  reload();
169
160
  setShowConfirmation(undefined);
170
- } }, void 0)), showEntradasConfirmation !== undefined && (_jsx(EntradasConfirmationDialog, { formStyle: formStyle, widthStats: widthStats, confirmation: showEntradasConfirmation, onClose: function () {
171
- reload();
172
- setShowEntradasConfirmation(undefined);
173
161
  } }, void 0)), sections.map(function (idSection, index) { return (_jsx(SectionComponent, __assign({ form: form, 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 &&
174
162
  (!internal || (internal && postview)) &&
175
163
  (originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined && (_jsx("div", __assign({ className: styles.termsContainer, style: {
@@ -66,7 +66,7 @@ import React from 'react';
66
66
  function SmartSelect(_a) {
67
67
  var _this = this;
68
68
  var _b, _c, _d, _e;
69
- var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, getValueString = _a.getValueString, changeListener = _a.changeListener, dependencyStore = _a.dependencyStore, _f = _a.calcInvalidDeps, calcInvalidDeps = _f === void 0 ? function (step, depStore) {
69
+ var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, getValueString = _a.getValueString, originalValues = _a.originalValues, changeListener = _a.changeListener, dependencyStore = _a.dependencyStore, _f = _a.calcInvalidDeps, calcInvalidDeps = _f === void 0 ? function (step, depStore) {
70
70
  var _a;
71
71
  var missingDeps = [];
72
72
  for (var _i = 0, _b = (_a = step.dependencies) !== null && _a !== void 0 ? _a : []; _i < _b.length; _i++) {
@@ -76,7 +76,7 @@ function SmartSelect(_a) {
76
76
  }
77
77
  }
78
78
  return missingDeps;
79
- } : _f, getValueWarning = _a.getValueWarning, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "organization", "calcDepError", "iconComponent", "valueOverwrite", "getValueString", "changeListener", "dependencyStore", "calcInvalidDeps", "getValueWarning", "getOptionSelected", "setDependencyStore"]);
79
+ } : _f, getValueWarning = _a.getValueWarning, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "organization", "calcDepError", "iconComponent", "valueOverwrite", "getValueString", "originalValues", "changeListener", "dependencyStore", "calcInvalidDeps", "getValueWarning", "getOptionSelected", "setDependencyStore"]);
80
80
  var _g = useState(true), first = _g[0], setFirst = _g[1];
81
81
  var _h = useState(), options = _h[0], setOptions = _h[1];
82
82
  var _j = useState(), error = _j[0], setError = _j[1];
@@ -115,7 +115,7 @@ function SmartSelect(_a) {
115
115
  if (!postview) {
116
116
  if (first) {
117
117
  setFirst(false);
118
- var invalids = calcInvalidDeps(step, dependencyStore).filter(function (idDep) { return others.originalValues[idDep]; });
118
+ var invalids = calcInvalidDeps(step, dependencyStore).filter(function (idDep) { return originalValues[idDep]; });
119
119
  setError(calcDepError === null || calcDepError === void 0 ? void 0 : calcDepError(invalids.map(function (idDep) { var _a; return (_a = form.steps[idDep]) === null || _a === void 0 ? void 0 : _a.type; })));
120
120
  calcOptions(value, invalids);
121
121
  }
@@ -132,6 +132,19 @@ function SmartSelect(_a) {
132
132
  setOptions([value]);
133
133
  }
134
134
  }, (_c = (_b = step.dependencies) === null || _b === void 0 ? void 0 : _b.map(function (dep) { return dependencyStore[dep]; })) !== null && _c !== void 0 ? _c : []);
135
+ /**
136
+ * If the original value has no label search for it in the list.
137
+ */
138
+ useEffect(function () {
139
+ var original = originalValues[step.id];
140
+ if (original &&
141
+ options &&
142
+ getValueString(original) !== undefined &&
143
+ !original.label) {
144
+ var newValue = options.find(function (option) { return getValueString(option) === getValueString(original); });
145
+ onChange(newValue);
146
+ }
147
+ }, [originalValues[step.id], options]);
135
148
  var handleMissingDep = function () { return __awaiter(_this, void 0, void 0, function () {
136
149
  var invalids;
137
150
  return __generator(this, function (_a) {
@@ -179,7 +192,7 @@ function SmartSelect(_a) {
179
192
  !!errors[step.id] }, void 0) }), void 0), children &&
180
193
  cloneElement(children, {
181
194
  value: value,
182
- stepProps: __assign({ step: step, form: form, errors: errors, trigger: trigger, postview: postview, editable: editable, formStyle: formStyle, widthStats: widthStats, organization: organization, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
195
+ stepProps: __assign({ step: step, form: form, errors: errors, trigger: trigger, postview: postview, editable: editable, formStyle: formStyle, widthStats: widthStats, organization: organization, originalValues: originalValues, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
183
196
  })] }, void 0));
184
197
  }
185
198
  function SmartSelectStep(props) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "1.9.3",
4
+ "version":"1.9.4-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormStyle } from '../../../@Types/Form';
3
- import { WidthStats } from '../Form';
4
- interface ConfirmationDialogProps {
5
- confirmation: {
6
- code: string;
7
- };
8
- onClose: Function;
9
- formStyle: FormStyle;
10
- widthStats: WidthStats;
11
- }
12
- declare function ConfirmationDialog({ confirmation, widthStats, formStyle, onClose, }: ConfirmationDialogProps): JSX.Element;
13
- export default ConfirmationDialog;
@@ -1,61 +0,0 @@
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
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import CheckCircleOutlineRoundedIcon from '@material-ui/icons/CheckCircleOutlineRounded';
14
- import styles from './ConfirmationDialog.module.css';
15
- import Dialog from '@material-ui/core/Dialog';
16
- import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
17
- import { useRef } from 'react';
18
- import RoundedButton from '../../../shared/RoundedButton/RoundedButton';
19
- import { Link } from '@material-ui/core';
20
- function ConfirmationDialog(_a) {
21
- var confirmation = _a.confirmation, widthStats = _a.widthStats, formStyle = _a.formStyle, onClose = _a.onClose;
22
- var urlRef = useRef(null);
23
- var copyRef = useRef(null);
24
- return (_jsx(Dialog, __assign({ PaperProps: {
25
- style: {
26
- borderRadius: '20px',
27
- maxWidth: '100vw',
28
- boxSizing: 'content-box',
29
- },
30
- }, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
31
- onClose();
32
- } }, { 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.secondaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer, style: widthStats.isMobile
33
- ? {
34
- margin: '0px 20px',
35
- }
36
- : {} }, { children: ["Tu c\u00F3digo de precarga es:", _jsxs("div", __assign({ className: styles.codeContainer, style: {
37
- flexDirection: widthStats.isMobile
38
- ? 'column'
39
- : 'row',
40
- } }, { children: [_jsx("input", { value: confirmation.code, className: styles.codeInput, ref: urlRef, readOnly: true, style: widthStats.isMobile
41
- ? {
42
- color: formStyle.textColor,
43
- fontWeight: 'bold',
44
- maxWidth: '100%',
45
- width: '100%',
46
- marginLeft: '0px',
47
- marginBottom: '15px',
48
- }
49
- : {
50
- color: formStyle.textColor,
51
- fontWeight: 'bold',
52
- } }, void 0), _jsx("div", __assign({ className: styles.copyLink }, { children: _jsx(RoundedButton, { text: 'Copiar', color: formStyle.primaryContrastColor, backgroundColor: '#afafaf', fontSize: '1rem', padding: '2px 5px 2px 5px', onClick: function () {
53
- var _a, _b, _c;
54
- (_a = urlRef.current) === null || _a === void 0 ? void 0 : _a.select();
55
- /* For mobile devices */
56
- (_b = urlRef.current) === null || _b === void 0 ? void 0 : _b.setSelectionRange(0, 99999);
57
- document.execCommand('copy');
58
- (_c = copyRef.current) === null || _c === void 0 ? void 0 : _c.focus();
59
- } }, void 0) }), void 0)] }), void 0)] }), void 0), _jsx("div", __assign({ className: styles.btnContainer }, { children: _jsx(Link, __assign({ href: "https://www.entradasamarillas.com/", target: "_blank", rel: "noopener" }, { children: _jsx(RoundedButton, { text: 'Precargar', color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1.2rem', padding: '5px 15px 5px 15px', onClick: function () { } }, void 0) }), void 0) }), void 0)] }), void 0)] }), void 0) }), void 0));
60
- }
61
- export default ConfirmationDialog;
@@ -1,80 +0,0 @@
1
- .confirmationContainer {
2
- display: flex;
3
- flex-direction: column;
4
- width: fit-content;
5
- max-height: 80vh;
6
- max-width: 80vw;
7
- position: relative;
8
- }
9
-
10
- .container {
11
- max-height: 100%;
12
- display: flex;
13
- flex-direction: column;
14
- overflow: hidden;
15
- overflow-y: auto;
16
- }
17
- .confirmationContainer,
18
- .confirmationContainer *,
19
- .confirmationContainer *::after,
20
- .confirmationContainer *::before {
21
- -webkit-box-sizing: content-box;
22
- -moz-box-sizing: content-box;
23
- box-sizing: content-box;
24
- }
25
-
26
- .checkContainer {
27
- margin-left: auto;
28
- margin-right: auto;
29
- padding-top: 30px;
30
- height: fit-content;
31
- margin-bottom: 10px;
32
- }
33
-
34
- .messageContainer {
35
- margin-left: 40px;
36
- margin-right: 40px;
37
- font-size: 1.6rem;
38
- text-align: center;
39
- }
40
- .closeIcon {
41
- right: 15px;
42
- top: 10px;
43
- font-size: 26px;
44
- position: absolute;
45
- cursor: pointer;
46
- }
47
-
48
- .copyLink {
49
- padding-left: 5px;
50
- padding-right: 5px;
51
- display: flex;
52
- justify-content: center;
53
- align-items: center;
54
- }
55
-
56
- .codeContainer {
57
- display: flex;
58
- flex-direction: row;
59
- justify-content: center;
60
- margin-top: 20px;
61
- margin-bottom: 20px;
62
- }
63
-
64
- .codeInput {
65
- margin-left: 69px;
66
- width: 240px;
67
- max-width: calc(100% - 120px);
68
- outline: none;
69
- border: none;
70
- font-size: 2rem;
71
- text-align: center;
72
- }
73
-
74
- .btnContainer {
75
- display: flex;
76
- flex-direction: row;
77
- align-items: center;
78
- justify-content: center;
79
- margin-bottom: 20px;
80
- }