@arquimedes.co/eureka-forms 2.0.5-test → 2.0.6-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/App.d.ts +1 -2
- package/dist/App/AppHooks.js +28 -25
- package/package.json +3 -3
package/dist/App/App.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Classifier, Form } from '../@Types/Form';
|
|
3
3
|
import './App.css';
|
|
4
|
-
import { FormComponentProps } from '../Form/Form';
|
|
5
4
|
import { CustomStep } from '../FormSteps/CustomStep';
|
|
6
5
|
export interface AppProps {
|
|
7
6
|
/** If the app is currently a widget */
|
|
@@ -35,7 +34,7 @@ export interface AppProps {
|
|
|
35
34
|
/** Custom function to call on send */
|
|
36
35
|
customSubmit?: (values: Record<string, unknown>, reload: () => void) => Promise<void>;
|
|
37
36
|
/** Custom submit buttons */
|
|
38
|
-
customSubmitBtns?: (onSubmit:
|
|
37
|
+
customSubmitBtns?: (onSubmit: () => Promise<Record<string, any> | void>, loading: boolean) => JSX.Element;
|
|
39
38
|
/** Function to call on postview to fetch the download url of a file */
|
|
40
39
|
fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
|
|
41
40
|
/** Function to call after the confimation dialog has been closed */
|
package/dist/App/AppHooks.js
CHANGED
|
@@ -66,6 +66,7 @@ import { useAppDispatch } from '../hooks';
|
|
|
66
66
|
import InternalFormStyle from '../constants/InternalFormStyle';
|
|
67
67
|
import { calcDependencies } from '../Form/FormFunctions';
|
|
68
68
|
import { iterateNestedSteps } from '../FormSteps/StepFunctions';
|
|
69
|
+
import { createNextState } from '@reduxjs/toolkit';
|
|
69
70
|
export var useSetupApp = function (isEmbedded, _a) {
|
|
70
71
|
var preview = _a.preview, internal = _a.internal, postview = _a.postview, partial = _a.partial, editable = _a.editable, handleConfirmed = _a.handleConfirmed, customSteps = _a.customSteps, valuesData = _a.valuesData, apiKey = _a.apiKey, formData = _a.formData, classifiers = _a.classifiers, others = __rest(_a, ["preview", "internal", "postview", "partial", "editable", "handleConfirmed", "customSteps", "valuesData", "apiKey", "formData", "classifiers"]);
|
|
71
72
|
var _b = useState(undefined), form = _b[0], setForm = _b[1];
|
|
@@ -111,11 +112,11 @@ export var useSetupApp = function (isEmbedded, _a) {
|
|
|
111
112
|
});
|
|
112
113
|
}); };
|
|
113
114
|
var loadData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
114
|
-
var idOrganization, organization, form, match,
|
|
115
|
+
var idOrganization, organization, form, match, dependencies, values;
|
|
116
|
+
var _a;
|
|
115
117
|
var _b;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
switch (_d.label) {
|
|
118
|
+
return __generator(this, function (_c) {
|
|
119
|
+
switch (_c.label) {
|
|
119
120
|
case 0:
|
|
120
121
|
idOrganization = others.idOrganization;
|
|
121
122
|
organization = null;
|
|
@@ -123,7 +124,7 @@ export var useSetupApp = function (isEmbedded, _a) {
|
|
|
123
124
|
if (!(form && preview && form.isStandAlone)) return [3 /*break*/, 2];
|
|
124
125
|
return [4 /*yield*/, loadOrg()];
|
|
125
126
|
case 1:
|
|
126
|
-
organization =
|
|
127
|
+
organization = _c.sent();
|
|
127
128
|
return [3 /*break*/, 4];
|
|
128
129
|
case 2:
|
|
129
130
|
if (!(!form && apiKey)) return [3 /*break*/, 4];
|
|
@@ -133,8 +134,8 @@ export var useSetupApp = function (isEmbedded, _a) {
|
|
|
133
134
|
])];
|
|
134
135
|
case 3:
|
|
135
136
|
//Is iframe or widget
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
_a = _c.sent(), organization = _a[0], form = _a[1];
|
|
138
|
+
_c.label = 4;
|
|
138
139
|
case 4:
|
|
139
140
|
if (organization && !idOrganization)
|
|
140
141
|
idOrganization = organization.idOrganization;
|
|
@@ -145,24 +146,26 @@ export var useSetupApp = function (isEmbedded, _a) {
|
|
|
145
146
|
idOrganization = match ? match[1] : '';
|
|
146
147
|
}
|
|
147
148
|
if (form) {
|
|
148
|
-
|
|
149
|
-
form
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
form = createNextState(form, function (form) {
|
|
150
|
+
if (form && classifiers)
|
|
151
|
+
form.classifiers = classifiers;
|
|
152
|
+
var _loop_1 = function (section) {
|
|
153
|
+
for (var _b = 0, _c = section.steps; _b < _c.length; _b++) {
|
|
154
|
+
var idStep = _c[_b];
|
|
155
|
+
iterateNestedSteps(idStep, form.steps, function (step) {
|
|
156
|
+
step.idSection = section.id;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
/** Assign the idSection to all the forms steps */
|
|
161
|
+
for (var _i = 0, _a = Object.values(form.sections); _i < _a.length; _i++) {
|
|
162
|
+
var section = _a[_i];
|
|
163
|
+
_loop_1(section);
|
|
156
164
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
_loop_1(section);
|
|
162
|
-
}
|
|
163
|
-
CBRStep = Object.values(form.steps).find(function (step) { return step.type.startsWith('CBR'); });
|
|
164
|
-
if (CBRStep)
|
|
165
|
-
form = calcCbrForm(form, valuesData !== null && valuesData !== void 0 ? valuesData : {});
|
|
165
|
+
var CBRStep = Object.values(form.steps).find(function (step) { return step.type.startsWith('CBR'); });
|
|
166
|
+
if (CBRStep)
|
|
167
|
+
form = calcCbrForm(form, valuesData !== null && valuesData !== void 0 ? valuesData : {});
|
|
168
|
+
});
|
|
166
169
|
}
|
|
167
170
|
setForm(form);
|
|
168
171
|
if (!form || !idOrganization)
|
|
@@ -171,7 +174,7 @@ export var useSetupApp = function (isEmbedded, _a) {
|
|
|
171
174
|
values = calcValuesStore(valuesData !== null && valuesData !== void 0 ? valuesData : {}, form, dependencies, customSteps !== null && customSteps !== void 0 ? customSteps : {});
|
|
172
175
|
dispatch(reset(__assign(__assign({ formStyle: internal
|
|
173
176
|
? InternalFormStyle
|
|
174
|
-
: __assign(__assign({}, InternalFormStyle), ((
|
|
177
|
+
: __assign(__assign({}, InternalFormStyle), ((_b = form === null || form === void 0 ? void 0 : form.style) !== null && _b !== void 0 ? _b : {})), internal: !!internal, idOrganization: idOrganization, preview: !!preview, partial: !!partial, postview: !!postview, editable: !!(editable !== null && editable !== void 0 ? editable : true), values: values }, calcInitialSections(form)), { dependencies: calcDependencies(form.steps, valuesData, customSteps, form.steps, dependencies) })));
|
|
175
178
|
return [2 /*return*/];
|
|
176
179
|
}
|
|
177
180
|
});
|
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":"2.0.
|
|
4
|
+
"version":"2.0.6-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
7
7
|
"build": "react-scripts build",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"test": "react-scripts test",
|
|
10
10
|
"test-ci": "react-scripts test --reporters=default --reporters=jest-junit --coverage --coverageReporters cobertura html",
|
|
11
11
|
"tsc-build": "tsc --noEmit false --outDir ./dist --incremental false",
|
|
12
|
-
"watch": "tsc
|
|
12
|
+
"watch": "tsc -w --preserveWatchOutput",
|
|
13
13
|
"storybook": "storybook dev -p 6006",
|
|
14
14
|
"build-storybook": "storybook build",
|
|
15
15
|
"cypress": "DISPLAY=:0 cypress open"
|
|
@@ -107,4 +107,4 @@
|
|
|
107
107
|
"/dist"
|
|
108
108
|
],
|
|
109
109
|
"proxy": "https://api.forms.eureka-test.click"
|
|
110
|
-
}
|
|
110
|
+
}
|