@arquimedes.co/eureka-forms 2.0.119 → 2.0.121

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 (38) hide show
  1. package/dist/@Types/ErkValue.d.ts +16 -0
  2. package/dist/@Types/ErkValue.js +1 -0
  3. package/dist/@Types/Form.d.ts +1 -0
  4. package/dist/@Types/FormStep.d.ts +8 -1
  5. package/dist/@Types/User.d.ts +13 -0
  6. package/dist/@Types/User.js +1 -0
  7. package/dist/App/AppHooks.js +29 -10
  8. package/dist/Form/Form.js +6 -2
  9. package/dist/Form/Form.module.css +9 -0
  10. package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +3 -3
  11. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +132 -30
  12. package/dist/Icons/EmailIcon.d.ts +4 -0
  13. package/dist/Icons/EmailIcon.js +17 -0
  14. package/dist/Icons/LockedIcon.d.ts +4 -0
  15. package/dist/Icons/LockedIcon.js +17 -0
  16. package/dist/Login/Login.module.css +135 -0
  17. package/dist/Login/LoginLayout.module.css +68 -0
  18. package/dist/Login/LoginPage.d.ts +11 -0
  19. package/dist/Login/LoginPage.js +177 -0
  20. package/dist/Login/LoginTextField.d.ts +15 -0
  21. package/dist/Login/LoginTextField.js +134 -0
  22. package/dist/Services/DraftService.js +2 -5
  23. package/dist/Services/IntegrationService.d.ts +21 -0
  24. package/dist/Services/IntegrationService.js +69 -0
  25. package/dist/Services/UserService.d.ts +10 -0
  26. package/dist/Services/UserService.js +71 -0
  27. package/dist/Shared/Navbar/Navbar.d.ts +2 -1
  28. package/dist/Shared/Navbar/Navbar.js +84 -3
  29. package/dist/Shared/Navbar/Navbar.module.css +15 -0
  30. package/dist/States/GlobalSlice.d.ts +6 -1
  31. package/dist/States/GlobalSlice.js +6 -1
  32. package/dist/constants/ErkValueTypes.d.ts +6 -0
  33. package/dist/constants/ErkValueTypes.js +7 -0
  34. package/dist/constants/FormStepTypes.d.ts +2 -1
  35. package/dist/constants/FormStepTypes.js +1 -0
  36. package/dist/hooks.d.ts +3 -0
  37. package/dist/hooks.js +62 -1
  38. package/package.json +2 -1
@@ -0,0 +1,16 @@
1
+ import ErkValueTypes from '../constants/ErkValueTypes';
2
+ import { EurekaDraft } from './Draft/Draft';
3
+ export type ErkValue = StepErkValue | DraftErkValue | BooleanErkValue;
4
+ interface StepErkValue {
5
+ type: ErkValueTypes.STEP;
6
+ idStep: string;
7
+ }
8
+ interface DraftErkValue {
9
+ type: ErkValueTypes.DRAFT;
10
+ value: EurekaDraft;
11
+ }
12
+ interface BooleanErkValue {
13
+ type: ErkValueTypes.BOOLEAN;
14
+ value: boolean;
15
+ }
16
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -11,6 +11,7 @@ export interface Form {
11
11
  size: FormSize;
12
12
  firstSection: string;
13
13
  type?: FormTypes;
14
+ hasLogin?: boolean;
14
15
  hasCaptcha?: boolean;
15
16
  isStandAlone?: boolean;
16
17
  style?: FormStyle;
@@ -2,6 +2,7 @@ import FormStepTypes, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperS
2
2
  import IconTypes from '../constants/IconTypes';
3
3
  import { Condition } from './Condition';
4
4
  import { EurekaDraft } from './Draft/Draft';
5
+ import { ErkValue } from './ErkValue';
5
6
  import * as GSteps from './GenericFormSteps';
6
7
  import { Time } from './Time';
7
8
  export type FormStep = Title | TimePicker | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | ApiSelector | Mapper;
@@ -146,7 +147,7 @@ export interface ValueEntityValuePickerPath {
146
147
  type: EntityValueDataTypes.VALUE;
147
148
  idEntityValue: string | null;
148
149
  }
149
- export type EntityValuePickerFilter = StepEntityValuePickerFilter | ValueEntityValuePickerFilter | CurrentAgentEntityValuePickerFilter;
150
+ export type EntityValuePickerFilter = StepEntityValuePickerFilter | ValueEntityValuePickerFilter | CurrentAgentEntityValuePickerFilter | IntegrationEntityValuePickerFilter;
150
151
  export interface StepEntityValuePickerFilter {
151
152
  idProperty: string;
152
153
  type: EntityValueDataTypes.STEP;
@@ -163,6 +164,12 @@ export interface CurrentAgentEntityValuePickerFilter {
163
164
  idProperty: string;
164
165
  type: EntityValueDataTypes.CURRENT_AGENT;
165
166
  }
167
+ export interface IntegrationEntityValuePickerFilter {
168
+ idProperty: string;
169
+ type: EntityValueDataTypes.INTEGRATION;
170
+ idIntegration: string;
171
+ values?: Record<string, ErkValue>;
172
+ }
166
173
  export interface ApiSelector extends GSteps.GSmartSelect {
167
174
  type: FormStepTypes.API_SELECTOR;
168
175
  icon?: IconTypes;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The currently active user
3
+ */
4
+ export interface User {
5
+ /** The User's id (if capta agent)*/
6
+ _id?: string;
7
+ /** The User's name */
8
+ name?: string;
9
+ /** The user's Email*/
10
+ email: string;
11
+ /** The expiration of the token */
12
+ exp: number;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -63,6 +63,7 @@ import { fetchForm } from '../Services/FormService';
63
63
  import { calcCbrForm } from '../Utils/CBRFunctions';
64
64
  import { calcInitialSections, calcValuesStore } from './AppFunctions';
65
65
  import { useAppDispatch } from '../hooks';
66
+ import { jwtDecode } from 'jwt-decode';
66
67
  import InternalFormStyle from '../constants/InternalFormStyle';
67
68
  import { calcDependencies } from '../Form/FormFunctions';
68
69
  import { iterateNestedSteps } from '../FormSteps/StepFunctions';
@@ -108,19 +109,20 @@ export var useSetupApp = function (isEmbedded, _a) {
108
109
  });
109
110
  }); };
110
111
  var loadData = function () { return __awaiter(void 0, void 0, void 0, function () {
111
- var idOrganization, organization, form, countryCode, match, dependencies, values;
112
+ var idOrganization, organization, user, form, countryCode, match, dependencies, values, token;
112
113
  var _a;
113
- var _b, _c, _d, _e, _f;
114
- return __generator(this, function (_g) {
115
- switch (_g.label) {
114
+ var _b, _c, _d, _e, _f, _g;
115
+ return __generator(this, function (_h) {
116
+ switch (_h.label) {
116
117
  case 0:
117
118
  idOrganization = others.idOrganization;
118
119
  organization = null;
120
+ user = null;
119
121
  form = formData !== null && formData !== void 0 ? formData : null;
120
122
  if (!(form && preview && form.isStandAlone)) return [3 /*break*/, 2];
121
123
  return [4 /*yield*/, loadOrg()];
122
124
  case 1:
123
- organization = _g.sent();
125
+ organization = _h.sent();
124
126
  return [3 /*break*/, 4];
125
127
  case 2:
126
128
  if (!(!form && apiKey)) return [3 /*break*/, 4];
@@ -130,8 +132,8 @@ export var useSetupApp = function (isEmbedded, _a) {
130
132
  ])];
131
133
  case 3:
132
134
  //Is iframe or widget
133
- _a = _g.sent(), organization = _a[0], form = _a[1];
134
- _g.label = 4;
135
+ _a = _h.sent(), organization = _a[0], form = _a[1];
136
+ _h.label = 4;
135
137
  case 4:
136
138
  if (organization && !idOrganization)
137
139
  idOrganization = organization.idOrganization;
@@ -185,13 +187,30 @@ export var useSetupApp = function (isEmbedded, _a) {
185
187
  dependencies = {};
186
188
  return [4 /*yield*/, calcValuesStore({ idOrganization: idOrganization, countryCode: countryCode }, form, valuesData, postview, customSteps)];
187
189
  case 5:
188
- values = _g.sent();
189
- dispatch(reset(__assign(__assign({ apiKey: apiKey, formStyle: internal
190
+ values = _h.sent();
191
+ if (form.hasLogin && !internal && !preview) {
192
+ token = localStorage.getItem('token');
193
+ if (token) {
194
+ try {
195
+ user = jwtDecode(token);
196
+ if (user && Date.now() / 1000 >= user.exp) {
197
+ //TODO: Posible check specific login key to make sure this user is valid? or have token per key?
198
+ user = null;
199
+ localStorage.removeItem('token');
200
+ }
201
+ }
202
+ catch (error) {
203
+ user = null;
204
+ localStorage.removeItem('token');
205
+ }
206
+ }
207
+ }
208
+ dispatch(reset(__assign(__assign({ user: user, apiKey: apiKey, formStyle: internal
190
209
  ? InternalFormStyle
191
210
  : __assign(__assign({}, InternalFormStyle), ((_d = form === null || form === void 0 ? void 0 : form.style) !== null && _d !== void 0 ? _d : {})), confirmation: {
192
211
  confirmationMessage: (_e = form.confirmationMessage) !== null && _e !== void 0 ? _e : BaseConfirmationMessage,
193
212
  showLink: (_f = form.showLink) !== null && _f !== void 0 ? _f : false,
194
- }, internal: !!internal, idOrganization: idOrganization, idCurrentAgent: idCurrentAgent, preview: !!preview, partial: !!partial, postview: !!postview, editable: !!(editable !== null && editable !== void 0 ? editable : true), values: values }, calcInitialSections(form)), { dependencies: calcDependencies(form.steps, customSteps, form.steps, dependencies, values), countryCode: countryCode })));
213
+ }, internal: !!internal, idOrganization: idOrganization, idCurrentAgent: (_g = user === null || user === void 0 ? void 0 : user._id) !== null && _g !== void 0 ? _g : idCurrentAgent, preview: !!preview, partial: !!partial, postview: !!postview, editable: !!(editable !== null && editable !== void 0 ? editable : true), values: values }, calcInitialSections(form)), { dependencies: calcDependencies(form.steps, customSteps, form.steps, dependencies, values), countryCode: countryCode })));
195
214
  return [2 /*return*/];
196
215
  }
197
216
  });
package/dist/Form/Form.js CHANGED
@@ -68,6 +68,7 @@ import { useAppDispatch, useAppSelector } from '../hooks';
68
68
  import FormContext from '../Contexts/FormContext';
69
69
  import { getAppState } from '../Utils/store';
70
70
  import { focusStep } from '../States/SiteSlice';
71
+ import LoginPage from '../Login/LoginPage';
71
72
  var localeMap = {
72
73
  en: enLocale,
73
74
  'en-US': enLocale,
@@ -85,7 +86,7 @@ function FormComponent(_a) {
85
86
  var _this = this;
86
87
  var _b, _c, _d, _e, _f, _g, _h, _j, _k;
87
88
  var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, isWidget = _a.isWidget, branding = _a.branding, setSubmit = _a.setSubmit, scrollToTop = _a.scrollToTop, customSteps = _a.customSteps, containerRef = _a.containerRef, customSubmit = _a.customSubmit, customSubmitBtns = _a.customSubmitBtns, customConfirmation = _a.customConfirmation;
88
- var _l = useAppSelector(function (state) { return state.global; }), idOrganization = _l.idOrganization, internal = _l.internal, postview = _l.postview;
89
+ var _l = useAppSelector(function (state) { return state.global; }), idOrganization = _l.idOrganization, internal = _l.internal, postview = _l.postview, user = _l.user;
89
90
  var formMethods = useForm({
90
91
  mode: 'onTouched',
91
92
  shouldFocusError: true,
@@ -184,8 +185,11 @@ function FormComponent(_a) {
184
185
  } }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: renderForm() })) })));
185
186
  }
186
187
  else {
188
+ if (user === null && form.hasLogin) {
189
+ return (_jsx("div", __assign({ className: styles.loginContainer }, { children: _jsx(LoginPage, { form: form }) })));
190
+ }
187
191
  //Standalone cant have widget
188
- return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding === null || branding === void 0 ? void 0 : branding.images.logoUrl, color: (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _d === void 0 ? void 0 : _d.navbarColor) !== null && _e !== void 0 ? _e : (_f = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _f === void 0 ? void 0 : _f.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
192
+ return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { apiKey: form.apiKey, logo: branding === null || branding === void 0 ? void 0 : branding.images.logoUrl, color: (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _d === void 0 ? void 0 : _d.navbarColor) !== null && _e !== void 0 ? _e : (_f = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _f === void 0 ? void 0 : _f.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
189
193
  background: (_h = (_g = form.style) === null || _g === void 0 ? void 0 : _g.standAloneBackgroundColor) !== null && _h !== void 0 ? _h : '#ffffff',
190
194
  } }, { children: _jsx("div", __assign({ className: isResponsive
191
195
  ? styles.fullScreenStandAloneForm
@@ -14,6 +14,15 @@
14
14
  overflow: hidden;
15
15
  }
16
16
 
17
+ .loginContainer {
18
+ width: 100%;
19
+ max-width: 100%;
20
+ overflow: hidden;
21
+ min-height: 100vh;
22
+ display: flex;
23
+ overflow-x: hidden;
24
+ }
25
+
17
26
  .standAloneFormCard {
18
27
  -webkit-box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
19
28
  -moz-box-shadow: -6px 0px 8px 5px rgba(0, 0, 0, 0.2);
@@ -62,8 +62,8 @@ function ClassifierSelectorStep(_a) {
62
62
  if (!classifier)
63
63
  return _jsx("div", {});
64
64
  var options = useMemo(function () {
65
- var _a;
66
- return (_a = classifier.children) === null || _a === void 0 ? void 0 : _a.filter(function (idClassifier) {
65
+ var _a, _b;
66
+ return ((_b = (_a = classifier.children) === null || _a === void 0 ? void 0 : _a.filter(function (idClassifier) {
67
67
  var _a;
68
68
  var option = step.options[idClassifier];
69
69
  if ((option === null || option === void 0 ? void 0 : option.type) === ClassifierOptionTypes.HIDE ||
@@ -82,7 +82,7 @@ function ClassifierSelectorStep(_a) {
82
82
  ? classifier === null || classifier === void 0 ? void 0 : classifier.clientName
83
83
  : classifier === null || classifier === void 0 ? void 0 : classifier.name,
84
84
  };
85
- });
85
+ })) !== null && _b !== void 0 ? _b : []);
86
86
  }, idDependencies.map(function (id) { return dependencies[id].value; }));
87
87
  var mapNestedOption = function () {
88
88
  if (value) {
@@ -65,13 +65,53 @@ import FormContext from '../../../Contexts/FormContext';
65
65
  import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
66
66
  import { evaluateCondition } from '../../StepFunctions';
67
67
  import { recursivelyCalcConditionSteps, selectDependencies, } from '../../StepHooks';
68
- import { useAppSelector } from '../../../hooks';
68
+ import { useApiSubscribe, useAppSelector } from '../../../hooks';
69
69
  import MaterialEntityValueDialog from './MaterialEntityValueDialog/MaterialEntityValueDialog';
70
+ import ErkValueTypes from '../../../constants/ErkValueTypes';
71
+ import { IntegrationsApi } from '../../../Services/IntegrationService';
72
+ import { IdFormContext } from '../../../App/App';
70
73
  function EntityValuePickerStep(_a) {
74
+ var _this = this;
71
75
  var _b, _c;
72
76
  var step = _a.step, editable = _a.editable;
77
+ var subscribe = useApiSubscribe();
73
78
  var form = useContext(FormContext);
79
+ var idForm = useContext(IdFormContext);
80
+ // const mapDraftEntities = useContext(CustomContext).mapDraftEntities;
74
81
  var _d = useState(), dialogs = _d[0], setDialogs = _d[1];
82
+ // const path = useMemo(
83
+ // () => [...step.stepPath, step.id].join('.'),
84
+ // [step.stepPath, step.id]
85
+ // );
86
+ // //TODO: Esto toca revisarlo, es un borrador.
87
+ // const mapDraft = useCallback(
88
+ // async (property: string): Promise<EurekaDraft | undefined> => {
89
+ // const state = await dispatch(getAppState({ idForm })).unwrap();
90
+ // const dependencies = selectDependencies(state, step.dependencies);
91
+ // return await subscribe(
92
+ // DraftApi.endpoints.mapDraft.initiate({
93
+ // idForm,
94
+ // property: `${path}.${property}`,
95
+ // dependencies,
96
+ // mapDraftEntities,
97
+ // })
98
+ // );
99
+ // },
100
+ // [subscribe, idForm, mapDraftEntities, path]
101
+ // );
102
+ var fetchFilterIntegration = useCallback(function (idIntegration, payload) { return __awaiter(_this, void 0, void 0, function () {
103
+ var _a;
104
+ return __generator(this, function (_b) {
105
+ switch (_b.label) {
106
+ case 0: return [4 /*yield*/, subscribe(IntegrationsApi.endpoints.fetchFilterIntegration.initiate({
107
+ idForm: idForm,
108
+ payload: payload,
109
+ idIntegration: idIntegration,
110
+ }))];
111
+ case 1: return [2 /*return*/, ((_a = (_b.sent())) !== null && _a !== void 0 ? _a : [])];
112
+ }
113
+ });
114
+ }); }, [subscribe, idForm]);
75
115
  var dialogsIdStepDeps = useMemo(function () {
76
116
  var ids = [];
77
117
  if (!step.dialogs)
@@ -96,7 +136,17 @@ function EntityValuePickerStep(_a) {
96
136
  : undefined;
97
137
  });
98
138
  }, []);
99
- return (_jsxs(React.Fragment, { children: [dialogs !== undefined && ((_b = form.entities) === null || _b === void 0 ? void 0 : _b[step.idEntity]) && (_jsx(MaterialEntityValueDialog, { type: dialogs.current.type, entity: (_c = form.entities) === null || _c === void 0 ? void 0 : _c[step.idEntity], entityValue: dialogs.value, message: dialogs.current.message, handleClose: handleCloseDialog })), _jsx(StepFillerContainer, __assign({ step: step }, { children: _jsx(SmartSelect, { editable: editable, step: step, icon: step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined, getOptions: getEntityValueOptions, getOptionalDependencies: getOptionalDependencies, getOptionSelected: function (option, value) {
139
+ var getOptions = useCallback(function (step, dependencyStore, ids) { return __awaiter(_this, void 0, void 0, function () {
140
+ return __generator(this, function (_a) {
141
+ switch (_a.label) {
142
+ case 0: return [4 /*yield*/, getEntityValueOptions(step, dependencyStore, ids,
143
+ // mapDraft
144
+ fetchFilterIntegration)];
145
+ case 1: return [2 /*return*/, _a.sent()];
146
+ }
147
+ });
148
+ }); }, [fetchFilterIntegration]);
149
+ return (_jsxs(React.Fragment, { children: [dialogs !== undefined && ((_b = form.entities) === null || _b === void 0 ? void 0 : _b[step.idEntity]) && (_jsx(MaterialEntityValueDialog, { type: dialogs.current.type, entity: (_c = form.entities) === null || _c === void 0 ? void 0 : _c[step.idEntity], entityValue: dialogs.value, message: dialogs.current.message, handleClose: handleCloseDialog })), _jsx(StepFillerContainer, __assign({ step: step }, { children: _jsx(SmartSelect, { editable: editable, step: step, icon: step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined, getOptions: getOptions, getOptionalDependencies: getOptionalDependencies, getOptionSelected: function (option, value) {
100
150
  return option._id === value._id;
101
151
  }, calcDepError: function (steps) {
102
152
  for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
@@ -171,13 +221,15 @@ function EntityValuePickerStep(_a) {
171
221
  } }) }))] }));
172
222
  }
173
223
  export default EntityValuePickerStep;
174
- var getEntityValueOptions = function (step, dependencyStore, _a) {
224
+ var getEntityValueOptions = function (step, dependencyStore, _a, fetchFilterIntegration
225
+ // mapDraftEntities: (property: string) => Promise<EurekaDraft | undefined>
226
+ ) {
175
227
  var idOrganization = _a.idOrganization, idCurrentAgent = _a.idCurrentAgent;
176
228
  return __awaiter(void 0, void 0, void 0, function () {
177
- var urlPath, _i, _b, path, idEntityValue, currentValue, params, _c, _d, filter, currentValue, url, response;
178
- var _e, _f, _g, _h, _j;
179
- return __generator(this, function (_k) {
180
- switch (_k.label) {
229
+ var urlPath, _i, _b, path, idEntityValue, currentValue, params, _c, _d, filter, _e, payload, _f, _g, _h, key, erkValue, currentValue, filtered, currentValue, url, response;
230
+ var _j, _k, _l, _m, _o, _p, _q, _r;
231
+ return __generator(this, function (_s) {
232
+ switch (_s.label) {
181
233
  case 0:
182
234
  if (!idOrganization)
183
235
  return [2 /*return*/, null];
@@ -187,56 +239,106 @@ var getEntityValueOptions = function (step, dependencyStore, _a) {
187
239
  idEntityValue = 'null';
188
240
  switch (path.type) {
189
241
  case EntityValueDataTypes.STEP: {
190
- currentValue = (_e = dependencyStore[path.idStep]) === null || _e === void 0 ? void 0 : _e.value;
242
+ currentValue = (_j = dependencyStore[path.idStep]) === null || _j === void 0 ? void 0 : _j.value;
191
243
  if (!currentValue)
192
244
  return [2 /*return*/, null];
193
245
  if (typeof currentValue === 'string')
194
246
  idEntityValue = currentValue;
195
247
  else
196
- idEntityValue = (_f = currentValue._id) !== null && _f !== void 0 ? _f : currentValue.id;
248
+ idEntityValue = (_k = currentValue._id) !== null && _k !== void 0 ? _k : currentValue.id;
197
249
  break;
198
250
  }
199
251
  case EntityValueDataTypes.VALUE:
200
252
  default:
201
- idEntityValue = (_g = path.idEntityValue) !== null && _g !== void 0 ? _g : 'null';
253
+ idEntityValue = (_l = path.idEntityValue) !== null && _l !== void 0 ? _l : 'null';
202
254
  break;
203
255
  }
204
256
  urlPath +=
205
257
  '/' + path.idEntity + (idEntityValue ? '/' + idEntityValue : '');
206
258
  }
207
259
  params = new URLSearchParams({});
208
- for (_c = 0, _d = step.filters; _c < _d.length; _c++) {
209
- filter = _d[_c];
210
- switch (filter.type) {
211
- case EntityValueDataTypes.STEP: {
212
- currentValue = (_h = dependencyStore[filter.idStep]) === null || _h === void 0 ? void 0 : _h.value;
260
+ _c = 0, _d = step.filters;
261
+ _s.label = 1;
262
+ case 1:
263
+ if (!(_c < _d.length)) return [3 /*break*/, 8];
264
+ filter = _d[_c];
265
+ _e = filter.type;
266
+ switch (_e) {
267
+ case EntityValueDataTypes.INTEGRATION: return [3 /*break*/, 2];
268
+ case EntityValueDataTypes.STEP: return [3 /*break*/, 4];
269
+ case EntityValueDataTypes.CURRENT_AGENT: return [3 /*break*/, 5];
270
+ case EntityValueDataTypes.VALUE: return [3 /*break*/, 6];
271
+ }
272
+ return [3 /*break*/, 6];
273
+ case 2:
274
+ payload = {};
275
+ for (_f = 0, _g = Object.entries((_m = filter.values) !== null && _m !== void 0 ? _m : {}); _f < _g.length; _f++) {
276
+ _h = _g[_f], key = _h[0], erkValue = _h[1];
277
+ switch (erkValue.type) {
278
+ case ErkValueTypes.BOOLEAN:
279
+ payload[key] = erkValue.value;
280
+ break;
281
+ case ErkValueTypes.DRAFT: {
282
+ //TODO: Hacer esto bien, la lambda tiene que ser capaz de calcular un draft en un filtro
283
+ // values[key] = await mapDraftEntities(
284
+ // `filters[${index}].values.${key}`
285
+ // );
286
+ break;
287
+ }
288
+ case ErkValueTypes.STEP: {
289
+ currentValue = (_o = dependencyStore[erkValue.idStep]) === null || _o === void 0 ? void 0 : _o.value;
213
290
  if (currentValue) {
214
291
  if (typeof currentValue === 'string')
215
- params.set(filter.idProperty, currentValue);
292
+ payload[key] = currentValue;
216
293
  else
217
- params.set(filter.idProperty, (_j = currentValue._id) !== null && _j !== void 0 ? _j : currentValue.id);
218
- }
219
- else if (filter.required) {
220
- return [2 /*return*/, null];
294
+ payload[key] =
295
+ (_p = currentValue._id) !== null && _p !== void 0 ? _p : currentValue.id;
221
296
  }
297
+ else
298
+ payload[key] = null;
222
299
  break;
223
300
  }
224
- case EntityValueDataTypes.CURRENT_AGENT:
225
- if (idCurrentAgent)
226
- params.set(filter.idProperty, idCurrentAgent);
227
- break;
228
- case EntityValueDataTypes.VALUE:
229
- default:
230
- params.set(filter.idProperty, filter.value);
231
- break;
232
301
  }
233
302
  }
303
+ return [4 /*yield*/, fetchFilterIntegration(filter.idIntegration, payload)];
304
+ case 3:
305
+ filtered = _s.sent();
306
+ if (filtered.length === 0)
307
+ return [2 /*return*/, null];
308
+ params.set(filter.idProperty, filtered.join(','));
309
+ return [3 /*break*/, 7];
310
+ case 4:
311
+ {
312
+ currentValue = (_q = dependencyStore[filter.idStep]) === null || _q === void 0 ? void 0 : _q.value;
313
+ if (currentValue) {
314
+ if (typeof currentValue === 'string')
315
+ params.set(filter.idProperty, currentValue);
316
+ else
317
+ params.set(filter.idProperty, (_r = currentValue._id) !== null && _r !== void 0 ? _r : currentValue.id);
318
+ }
319
+ else if (filter.required) {
320
+ return [2 /*return*/, null];
321
+ }
322
+ return [3 /*break*/, 7];
323
+ }
324
+ _s.label = 5;
325
+ case 5:
326
+ if (idCurrentAgent)
327
+ params.set(filter.idProperty, idCurrentAgent);
328
+ return [3 /*break*/, 7];
329
+ case 6:
330
+ params.set(filter.idProperty, filter.value);
331
+ return [3 /*break*/, 7];
332
+ case 7:
333
+ _c++;
334
+ return [3 /*break*/, 1];
335
+ case 8:
234
336
  url = "".concat(idOrganization, "/entities/").concat(step.idEntity).concat(urlPath, "?").concat(params.toString());
235
337
  return [4 /*yield*/, widgetInstance.get(url, {
236
338
  timeout: 120000,
237
339
  })];
238
- case 1:
239
- response = _k.sent();
340
+ case 9:
341
+ response = _s.sent();
240
342
  return [2 /*return*/, response.data.filter(function (option) { var _a; return ((_a = step.options[option._id]) === null || _a === void 0 ? void 0 : _a.type) !== EntityValueOptionTypes.HIDE; })];
241
343
  }
242
344
  });
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from './@IconTypes';
3
+ declare function EmailIcon({ className, style, fill }: IconProps): JSX.Element;
4
+ export default EmailIcon;
@@ -0,0 +1,17 @@
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 } from "react/jsx-runtime";
13
+ function EmailIcon(_a) {
14
+ var className = _a.className, style = _a.style, fill = _a.fill;
15
+ return (_jsx("svg", __assign({ fill: fill, style: style, className: className, version: "1.1", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-1 14H5c-.55 0-1-.45-1-1V8l6.94 4.34c.65.41 1.47.41 2.12 0L20 8v9c0 .55-.45 1-1 1zm-7-7L4 6h16l-8 5z" }) })));
16
+ }
17
+ export default EmailIcon;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from './@IconTypes';
3
+ declare function LockedIcon({ className, style, fill }: IconProps): JSX.Element;
4
+ export default LockedIcon;
@@ -0,0 +1,17 @@
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 } from "react/jsx-runtime";
13
+ function LockedIcon(_a) {
14
+ var className = _a.className, style = _a.style, fill = _a.fill;
15
+ return (_jsx("svg", __assign({ fill: fill, style: style, className: className, version: "1.1", viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx("path", { d: "M81.9,49.6c0-9-0.4-9.4-9.3-9.7c0,0,0,0,0,0c0-4,0-9-0.1-12.1C72,16,64.7,8.9,53,8.7c-2,0-4,0-6.1,0 c-13,0.1-20.6,8-20.4,20.9c0,0,0,0.1,0,0.1V40c-0.7,0-1.4,0-2.2,0c-5.8,0-7.1,1.4-7.1,7.2c0,12.3,0.1,24.6-0.1,36.9 c-0.1,4.7,1.8,6.9,6.5,6.9c17.4,0,34.7,0,52.1,0c4.4,0,6.4-2,6.3-6.5C81.8,72.9,81.9,61.3,81.9,49.6z M53.1,67.5v5.8 c0,2-1.6,3.5-3.5,3.5S46,75.2,46,73.3v-5.8c-2.9-1.3-5-4.3-5-7.8c0-4.7,3.8-8.5,8.5-8.5c4.7,0,8.5,3.8,8.5,8.5 C58.1,63.2,56,66.2,53.1,67.5z M61.7,39.9C61.7,39.9,61.7,39.9,61.7,39.9c-8.1,0-16.1,0.1-24.2,0.1v-8.5c0.1-0.6,0.1-1.2,0.1-1.7 c-0.1-7.3,4-10.3,13-10.1c7.4,0.1,11.1,3.6,11.1,10.6C61.7,33.5,61.7,36.7,61.7,39.9z" }) })));
16
+ }
17
+ export default LockedIcon;
@@ -0,0 +1,135 @@
1
+ .rightPanel {
2
+ background-color: #3d5a7f;
3
+ display: flex;
4
+ border-radius: 0 20px 20px 0;
5
+ flex-grow: 0;
6
+ max-width: 41.666667%;
7
+ flex-basis: 41.666667%;
8
+ }
9
+ .rightPanelMessage {
10
+ margin: auto;
11
+ text-align: center;
12
+ padding: 0 30px 0 30px;
13
+ }
14
+ .rightPanelMessage h1 {
15
+ color: white;
16
+ font-size: 40px;
17
+ font-weight: 900;
18
+ }
19
+ .rightPanelMessage p {
20
+ color: white;
21
+ }
22
+ .leftPanel {
23
+ display: flex;
24
+ text-align: center;
25
+ flex-direction: column;
26
+ flex-grow: 1;
27
+ max-width: 100%;
28
+ min-height: fit-content;
29
+ flex-basis: 0;
30
+ position: relative;
31
+ justify-content: center;
32
+ }
33
+ .leftPanel h1 {
34
+ margin-left: auto;
35
+ margin-right: auto;
36
+ color: #3d5a7f;
37
+ font-size: 40px;
38
+ font-weight: 900;
39
+ margin-top: 40px;
40
+ padding-left: 20px;
41
+ padding-right: 20px;
42
+ margin-bottom: 40px;
43
+ }
44
+ .leftPanel a {
45
+ font-size: 22px;
46
+ cursor: pointer;
47
+ -moz-user-select: none;
48
+ -khtml-user-select: none;
49
+ -webkit-user-select: none;
50
+ -ms-user-select: none;
51
+ user-select: none;
52
+ padding-left: 20px;
53
+ padding-right: 20px;
54
+ margin: 0px auto 25px auto;
55
+ text-decoration: underline;
56
+ }
57
+ .loginButton {
58
+ background-color: #3d5a7f;
59
+ border-radius: 40px;
60
+ padding: 22px 50px;
61
+ margin: 0 auto 0 auto;
62
+ color: white;
63
+ font-weight: 800;
64
+ font-size: 22px;
65
+ cursor: pointer;
66
+ -moz-user-select: none;
67
+ -khtml-user-select: none;
68
+ -webkit-user-select: none;
69
+ -ms-user-select: none;
70
+ user-select: none;
71
+ width: fit-content;
72
+ max-width: calc(100% - 40px);
73
+ height: fit-content;
74
+ position: relative;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ }
79
+ .loginButton[disabled] {
80
+ pointer-events: none;
81
+ opacity: 0.5;
82
+ }
83
+ .loaderContainer {
84
+ position: absolute;
85
+ margin: auto;
86
+ height: 40px;
87
+ width: 40px;
88
+ }
89
+ .logo {
90
+ position: absolute;
91
+ display: flex;
92
+ flex-direction: row;
93
+ justify-content: center;
94
+ left: 40px;
95
+ top: 33px;
96
+ height: 65px;
97
+ margin-right: auto;
98
+ }
99
+ .loginInputsContainer {
100
+ width: 60%;
101
+ margin: 0 auto 0 auto;
102
+ }
103
+ .loginInput {
104
+ min-height: 80px;
105
+ }
106
+ @media screen and (max-width: 825px) {
107
+ .rightPanel {
108
+ display: none;
109
+ }
110
+ .loginInputsContainer {
111
+ width: 70%;
112
+ margin: 0 auto 0 auto;
113
+ }
114
+ .leftPanel h1 {
115
+ margin-top: 5%;
116
+ }
117
+ }
118
+
119
+ @media screen and (max-width: 678px) {
120
+ .logo {
121
+ display: none;
122
+ }
123
+ .loginInputsContainer {
124
+ width: 80%;
125
+ }
126
+ }
127
+
128
+ @media screen and (max-height: 720px) {
129
+ .logo {
130
+ display: none;
131
+ }
132
+ .loginButton {
133
+ margin-bottom: 40px;
134
+ }
135
+ }