@arquimedes.co/eureka-forms 0.2.8 → 0.2.11-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/App.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Form } from './@Types/Form';
3
- interface AppProps {
3
+ export interface AppProps {
4
4
  /** If the app is currently a widget */
5
5
  isWidget?: boolean;
6
6
  /** The apikey of the Form */
@@ -18,7 +18,11 @@ interface AppProps {
18
18
  /** The data to fill the form with */
19
19
  valuesData?: Record<string, unknown>;
20
20
  /** Custom steps to display */
21
- customSteps?: Record<string, JSX.Element>;
21
+ customSteps?: Record<string, CustomStep>;
22
+ }
23
+ export interface CustomStep {
24
+ component: JSX.Element;
25
+ updateValue: (idStep: string, values: Record<string, any>, form: Form) => void;
22
26
  }
23
27
  declare function App({ apiKey, domain, preview, formData, postview, isWidget, internal, valuesData, customSteps, ...others }: AppProps): JSX.Element;
24
28
  export default App;
package/dist/App.js CHANGED
@@ -120,6 +120,7 @@ function App(_a) {
120
120
  }
121
121
  useEffect(function () {
122
122
  if (formData !== undefined) {
123
+ console.log('!');
123
124
  if (preview && formData.isStandAlone) {
124
125
  fetchPreview(formData);
125
126
  }
@@ -175,6 +176,7 @@ function App(_a) {
175
176
  return [3 /*break*/, 3];
176
177
  case 2:
177
178
  error_1 = _b.sent();
179
+ console.error(error_1);
178
180
  setForm(null);
179
181
  setOrganizationInfo(null);
180
182
  return [3 /*break*/, 3];
@@ -99,9 +99,9 @@ function ColumnForm(_a) {
99
99
  setLoading(true);
100
100
  for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
101
101
  idStep = _a[_i];
102
- updateValue(idStep, values, form);
102
+ updateValue(idStep, values, form, customSteps);
103
103
  }
104
- url = "https://xkmqdd6tr6.execute-api.us-east-1.amazonaws.com/Prod/ticket?apiKey=" + (internal ? form.apiKey : apiKey) + "&domain=" + domain;
104
+ url = "https://" + domain + ".forms." + process.env.REACT_APP_DOMAIN + "/api/ticket?apiKey=" + (internal ? form.apiKey : apiKey) + "&domain=" + domain;
105
105
  console.log(values);
106
106
  payload = {
107
107
  formValues: { steps: values },
@@ -157,7 +157,7 @@ function calcNextSection(form, idSection, sections) {
157
157
  }
158
158
  }
159
159
  }
160
- var updateValue = function (idStep, values, form) {
160
+ var updateValue = function (idStep, values, form, customSteps) {
161
161
  var step = form.steps[idStep];
162
162
  switch (step === null || step === void 0 ? void 0 : step.type) {
163
163
  case Types.TEXTAREA: {
@@ -178,6 +178,10 @@ var updateValue = function (idStep, values, form) {
178
178
  break;
179
179
  }
180
180
  default:
181
+ var custom = customSteps[idStep];
182
+ if (custom !== undefined) {
183
+ custom.updateValue(idStep, values, form);
184
+ }
181
185
  break;
182
186
  }
183
187
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Organization } from '../../@Types/@Types';
3
3
  import { Form, FormStyle } from '../../@Types/Form';
4
+ import { CustomStep } from '../../App';
4
5
  export interface WidthStats {
5
6
  currentBreakPoint: number;
6
7
  isMobile: boolean;
@@ -8,7 +9,7 @@ export interface WidthStats {
8
9
  export interface FormComponentProps {
9
10
  form: Form;
10
11
  originalValues: Record<string, unknown>;
11
- customSteps: Record<string, JSX.Element>;
12
+ customSteps: Record<string, CustomStep>;
12
13
  widthStats: WidthStats;
13
14
  internal: boolean;
14
15
  reload: Function;
@@ -46,7 +46,7 @@ function FormComponent(_a) {
46
46
  if (currentWidth !== undefined) {
47
47
  var currentBreakPoint = blockNum;
48
48
  while (currentWidth <
49
- (blockSize + spacingSize) * currentBreakPoint + 40) {
49
+ (blockSize + spacingSize) * currentBreakPoint) {
50
50
  currentBreakPoint--;
51
51
  }
52
52
  setWidthStats({
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Control, FieldValues, UseFormGetValues } from 'react-hook-form';
3
3
  import { Form, FormStyle, Section } from '../../@Types/Form';
4
+ import { CustomStep } from '../../App';
4
5
  import { WidthStats } from '../Form/Form';
5
6
  export interface RecursiveData {
6
7
  form: Form;
@@ -13,7 +14,7 @@ export interface RecursiveData {
13
14
  clearErrors: Function;
14
15
  getValues: UseFormGetValues<FieldValues>;
15
16
  originalValues: Record<string, any>;
16
- customSteps: Record<string, JSX.Element>;
17
+ customSteps: Record<string, CustomStep>;
17
18
  }
18
19
  export interface SectionComponentProps extends RecursiveData {
19
20
  section: Section;
@@ -21,7 +21,7 @@ function DatePickerStep(_a) {
21
21
  ? '100%'
22
22
  : calcStepWidth(step.size, form),
23
23
  minHeight: step.description || step.required ? '55px' : '43px',
24
- } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: new Date(), rules: {
24
+ } }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: null, rules: {
25
25
  required: step.required
26
26
  ? 'Este campo es obligatorio'
27
27
  : undefined,
@@ -63,7 +63,7 @@ function StepComponent(_a) {
63
63
  var customStep = props.customSteps[step.type];
64
64
  console.log(customStep);
65
65
  if (customStep) {
66
- return React.cloneElement(customStep, __assign({ step: step }, props));
66
+ return React.cloneElement(customStep.component, __assign({ step: step }, props));
67
67
  }
68
68
  else {
69
69
  return _jsx("div", {}, void 0);
@@ -1,3 +1,6 @@
1
- import App from './App';
2
- export { App };
3
- export default App;
1
+ import EurekaForm, { AppProps as EurekaFormProps } from './App';
2
+ import { StepProps } from './FormComponents/Step/Step';
3
+ import * as StepFunctions from './FormComponents/Step/StepFunctions';
4
+ export type { StepProps, EurekaFormProps };
5
+ export { EurekaForm, StepFunctions };
6
+ export default EurekaForm;
package/dist/index.lib.js CHANGED
@@ -1,3 +1,4 @@
1
- import App from './App';
2
- export { App };
3
- export default App;
1
+ import EurekaForm from './App';
2
+ import * as StepFunctions from './FormComponents/Step/StepFunctions';
3
+ export { EurekaForm, StepFunctions };
4
+ export default EurekaForm;
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": "0.2.8",
4
+ "version": "0.2.11-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
@@ -57,6 +57,7 @@
57
57
  "@types/react-router-dom": "^5.1.7",
58
58
  "@typescript-eslint/eslint-plugin": "^4.24.0",
59
59
  "@typescript-eslint/parser": "^4.24.0",
60
+ "dotenv-webpack": "^7.0.3",
60
61
  "eslint": "^7.27.0",
61
62
  "eslint-config-prettier": "^8.3.0",
62
63
  "eslint-plugin-prettier": "^3.4.0",