@arquimedes.co/eureka-forms 0.1.2 → 0.2.5
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/@Types/@Types.d.ts +1 -1
- package/dist/@Types/@Types.js +1 -1
- package/dist/@Types/Form.d.ts +63 -63
- package/dist/@Types/Form.js +1 -1
- package/dist/@Types/FormStep.d.ts +105 -105
- package/dist/@Types/FormStep.js +1 -1
- package/dist/@Types/Organization.d.ts +16 -16
- package/dist/@Types/Organization.js +1 -1
- package/dist/App.d.ts +34 -32
- package/dist/App.js +262 -261
- package/dist/App.module.css +21 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +4 -4
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +232 -232
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.module.css +46 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.d.ts +12 -12
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +33 -33
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +48 -0
- package/dist/FormComponents/Form/Form.d.ts +24 -23
- package/dist/FormComponents/Form/Form.js +116 -116
- package/dist/FormComponents/Form/Form.module.css +39 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.d.ts +4 -4
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +6 -6
- package/dist/FormComponents/Form/StepperForm/StepperForm.module.css +0 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.d.ts +4 -4
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +42 -42
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.module.css +8 -0
- package/dist/FormComponents/Section/Section.d.ts +24 -23
- package/dist/FormComponents/Section/Section.js +25 -25
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +9 -9
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +37 -37
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +4 -4
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +105 -105
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.d.ts +9 -9
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +25 -25
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +4 -4
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +35 -35
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css +9 -0
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.d.ts +9 -9
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +25 -25
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +11 -11
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +110 -110
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +52 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +13 -13
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +165 -165
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +45 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +4 -4
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +99 -99
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.d.ts +9 -9
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +37 -37
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +4 -4
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +11 -11
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.module.css +7 -0
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.d.ts +9 -9
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +37 -37
- package/dist/FormComponents/Step/Step.d.ts +10 -10
- package/dist/FormComponents/Step/Step.js +73 -64
- package/dist/FormComponents/Step/StepFunctions.d.ts +5 -5
- package/dist/FormComponents/Step/StepFunctions.js +51 -51
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/DraftEditor.css +35 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +6 -6
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +112 -112
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +58 -0
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.d.ts +9 -9
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +25 -25
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +4 -4
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +43 -43
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.module.css +9 -0
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.d.ts +9 -9
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +25 -25
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +4 -4
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +18 -18
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +35 -0
- package/dist/FormComponents/Step/TitleStep/TitleStep.d.ts +9 -9
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +37 -37
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.d.ts +4 -4
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +77 -77
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.module.css +73 -0
- package/dist/FormComponents/Term/Term.d.ts +15 -15
- package/dist/FormComponents/Term/Term.js +25 -25
- package/dist/Widget.d.ts +1 -1
- package/dist/Widget.js +39 -56
- package/dist/constants/Files/FileExtensions.d.ts +3 -3
- package/dist/constants/Files/FileExtensions.js +65 -65
- package/dist/constants/Files/FileMaxSize.d.ts +2 -2
- package/dist/constants/Files/FileMaxSize.js +2 -2
- package/dist/constants/FormStepTypes.d.ts +33 -33
- package/dist/constants/FormStepTypes.js +39 -39
- package/dist/constants/InternalFormStyle.d.ts +3 -3
- package/dist/constants/InternalFormStyle.js +12 -12
- package/dist/constants/MaterialClassNameSeed.d.ts +1 -1
- package/dist/constants/MaterialClassNameSeed.js +1 -1
- package/dist/controllers/FileService.d.ts +5 -5
- package/dist/controllers/FileService.js +89 -89
- package/dist/index.d.ts +1 -2
- package/dist/index.js +16 -17
- package/dist/index.lib.d.ts +3 -0
- package/dist/index.lib.js +3 -0
- package/dist/index.module.css +14 -0
- package/dist/shared/Loader/Loader.d.ts +18 -18
- package/dist/shared/Loader/Loader.js +26 -26
- package/dist/shared/Loader/Loader.module.css +12 -0
- package/dist/shared/Navbar/Navbar.d.ts +9 -9
- package/dist/shared/Navbar/Navbar.js +18 -18
- package/dist/shared/Navbar/Navbar.module.css +18 -0
- package/dist/shared/RoundedButton/RoundedButton.d.ts +30 -30
- package/dist/shared/RoundedButton/RoundedButton.js +45 -45
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.d.ts +24 -24
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +101 -101
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +40 -40
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +246 -246
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +42 -42
- package/dist/shared/RoundedSelect/RoundedSelect.js +171 -171
- package/dist/shared/RoundedTextField/RoundedTextField.d.ts +41 -41
- package/dist/shared/RoundedTextField/RoundedTextField.js +138 -138
- package/package.json +2 -2
package/dist/App.js
CHANGED
|
@@ -1,261 +1,262 @@
|
|
|
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 (_) 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
|
-
};
|
|
59
|
-
var _a;
|
|
60
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
61
|
-
import axios from 'axios';
|
|
62
|
-
import { useEffect, useRef, useState } from 'react';
|
|
63
|
-
import Loader from './shared/Loader/Loader';
|
|
64
|
-
import styles from './App.module.css';
|
|
65
|
-
import FormComponent from './FormComponents/Form/Form';
|
|
66
|
-
import StepTypes from './constants/FormStepTypes';
|
|
67
|
-
function App(_a) {
|
|
68
|
-
var _this = this;
|
|
69
|
-
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData"]);
|
|
70
|
-
var _b = useState(undefined), form = _b[0], setForm = _b[1];
|
|
71
|
-
var _c = useState({}), originalValues = _c[0], setOriginalValues = _c[1];
|
|
72
|
-
var _d = useState(undefined), organizationInfo = _d[0], setOrganizationInfo = _d[1];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
favicon
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
case 1
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
SIZES["
|
|
218
|
-
SIZES["
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
_a[SIZES.
|
|
223
|
-
_a[SIZES.
|
|
224
|
-
_a
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
newForm.
|
|
239
|
-
newForm.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
step.type === StepTypes.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
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 (_) 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
|
+
};
|
|
59
|
+
var _a;
|
|
60
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
61
|
+
import axios from 'axios';
|
|
62
|
+
import { useEffect, useRef, useState } from 'react';
|
|
63
|
+
import Loader from './shared/Loader/Loader';
|
|
64
|
+
import styles from './App.module.css';
|
|
65
|
+
import FormComponent from './FormComponents/Form/Form';
|
|
66
|
+
import StepTypes from './constants/FormStepTypes';
|
|
67
|
+
function App(_a) {
|
|
68
|
+
var _this = this;
|
|
69
|
+
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSteps = _a.customSteps, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps"]);
|
|
70
|
+
var _b = useState(undefined), form = _b[0], setForm = _b[1];
|
|
71
|
+
var _c = useState({}), originalValues = _c[0], setOriginalValues = _c[1];
|
|
72
|
+
var _d = useState(undefined), organizationInfo = _d[0], setOrganizationInfo = _d[1];
|
|
73
|
+
//
|
|
74
|
+
function fetchOrgData(domain) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var url, response, currentOrg, favicon;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
url = 'https://dbsedeq00i.execute-api.us-east-1.amazonaws.com/Prod/organization';
|
|
81
|
+
if (domain) {
|
|
82
|
+
url += "?domain=" + domain;
|
|
83
|
+
}
|
|
84
|
+
return [4 /*yield*/, axios.get(url)];
|
|
85
|
+
case 1:
|
|
86
|
+
response = _a.sent();
|
|
87
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
88
|
+
currentOrg = response.data;
|
|
89
|
+
favicon = document.getElementById('favicon');
|
|
90
|
+
favicon.href = currentOrg.partialLogoUrl;
|
|
91
|
+
return [2 /*return*/, currentOrg];
|
|
92
|
+
}
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function fetchPreview(formData) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
var response;
|
|
101
|
+
return __generator(this, function (_a) {
|
|
102
|
+
switch (_a.label) {
|
|
103
|
+
case 0: return [4 /*yield*/, axios.get('https://dbsedeq00i.execute-api.us-east-1.amazonaws.com/Prod/organization')];
|
|
104
|
+
case 1:
|
|
105
|
+
response = _a.sent();
|
|
106
|
+
if (response.data) {
|
|
107
|
+
console.log('ORGANIZATON', response);
|
|
108
|
+
setOrganizationInfo(response.data);
|
|
109
|
+
setForm(migrateFormData(formData));
|
|
110
|
+
}
|
|
111
|
+
return [2 /*return*/];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
useEffect(function () {
|
|
117
|
+
if (formData !== undefined) {
|
|
118
|
+
if (preview && formData.isStandAlone) {
|
|
119
|
+
fetchPreview(formData);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
setForm(migrateFormData(__assign({}, formData)));
|
|
123
|
+
setOrganizationInfo(null);
|
|
124
|
+
}
|
|
125
|
+
if (valuesData !== undefined) {
|
|
126
|
+
setOriginalValues(valuesData);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (!isWidget && apiKey) {
|
|
130
|
+
//Is iframe
|
|
131
|
+
loadInfo(apiKey, domain);
|
|
132
|
+
}
|
|
133
|
+
else if (isWidget && apiKey && domain) {
|
|
134
|
+
//Is iframe
|
|
135
|
+
loadInfo(apiKey, domain);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
//Error in embed
|
|
139
|
+
setForm(null);
|
|
140
|
+
setOrganizationInfo(null);
|
|
141
|
+
}
|
|
142
|
+
}, []);
|
|
143
|
+
var containerRef = useRef();
|
|
144
|
+
var loadInfo = function (apiKey, domain) { return __awaiter(_this, void 0, void 0, function () {
|
|
145
|
+
var url, _a, response, orgInfo, error_1;
|
|
146
|
+
return __generator(this, function (_b) {
|
|
147
|
+
switch (_b.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
_b.trys.push([0, 2, , 3]);
|
|
150
|
+
url = "https://dbsedeq00i.execute-api.us-east-1.amazonaws.com/Prod/form/" + apiKey;
|
|
151
|
+
if (domain) {
|
|
152
|
+
url += "?domain=" + domain;
|
|
153
|
+
}
|
|
154
|
+
return [4 /*yield*/, Promise.all([
|
|
155
|
+
axios.get(url),
|
|
156
|
+
fetchOrgData(domain),
|
|
157
|
+
])];
|
|
158
|
+
case 1:
|
|
159
|
+
_a = _b.sent(), response = _a[0], orgInfo = _a[1];
|
|
160
|
+
if (response) {
|
|
161
|
+
setForm(migrateFormData(response.data));
|
|
162
|
+
if (valuesData !== undefined) {
|
|
163
|
+
setOriginalValues(valuesData);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (orgInfo) {
|
|
167
|
+
console.log(orgInfo);
|
|
168
|
+
setOrganizationInfo(orgInfo);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
setOrganizationInfo(null);
|
|
172
|
+
}
|
|
173
|
+
return [3 /*break*/, 3];
|
|
174
|
+
case 2:
|
|
175
|
+
error_1 = _b.sent();
|
|
176
|
+
setForm(null);
|
|
177
|
+
setOrganizationInfo(null);
|
|
178
|
+
return [3 /*break*/, 3];
|
|
179
|
+
case 3: return [2 /*return*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}); };
|
|
183
|
+
if (form === undefined || organizationInfo === undefined) {
|
|
184
|
+
if (isWidget) {
|
|
185
|
+
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50 }, void 0) }), void 0) }), void 0));
|
|
186
|
+
}
|
|
187
|
+
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50 }, void 0) }), void 0));
|
|
188
|
+
}
|
|
189
|
+
else if (form === null) {
|
|
190
|
+
if (organizationInfo === null) {
|
|
191
|
+
if (isWidget) {
|
|
192
|
+
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: "Error" }), void 0) }), void 0));
|
|
193
|
+
}
|
|
194
|
+
return _jsx("div", __assign({ className: styles.curtain }, { children: "Error" }), void 0);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
if (isWidget) {
|
|
198
|
+
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: "404" }), void 0) }), void 0));
|
|
199
|
+
}
|
|
200
|
+
return _jsx("div", __assign({ className: styles.curtain }, { children: "404" }), void 0);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return (_jsx("div", __assign({ ref: containerRef, className: styles.container }, { children: _jsx(FormComponent, __assign({}, others, { form: form, reload: function () {
|
|
205
|
+
var tempForm = __assign({}, form);
|
|
206
|
+
setForm(undefined);
|
|
207
|
+
setTimeout(function () {
|
|
208
|
+
setForm(tempForm);
|
|
209
|
+
}, 100);
|
|
210
|
+
}, postview: postview === true, internal: internal === true, apiKey: apiKey, domain: domain, originalValues: originalValues, containerRef: containerRef, organization: organizationInfo, customSteps: customSteps !== null && customSteps !== void 0 ? customSteps : {} }), void 0) }), void 0));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
export default App;
|
|
214
|
+
//THIS IS TEMP
|
|
215
|
+
export var SIZES;
|
|
216
|
+
(function (SIZES) {
|
|
217
|
+
SIZES["SMALL"] = "SMALL";
|
|
218
|
+
SIZES["MEDIUM"] = "MEDIUM";
|
|
219
|
+
SIZES["LARGE"] = "LARGE";
|
|
220
|
+
})(SIZES || (SIZES = {}));
|
|
221
|
+
export var SizesToNum = (_a = {},
|
|
222
|
+
_a[SIZES.LARGE] = 4,
|
|
223
|
+
_a[SIZES.MEDIUM] = 2,
|
|
224
|
+
_a[SIZES.SMALL] = 1,
|
|
225
|
+
_a);
|
|
226
|
+
var migrateFormData = function (form) {
|
|
227
|
+
var steps = __assign({}, form.steps);
|
|
228
|
+
for (var _i = 0, _a = Object.keys(form.steps); _i < _a.length; _i++) {
|
|
229
|
+
var idStep = _a[_i];
|
|
230
|
+
var step = __assign({}, form.steps[idStep]);
|
|
231
|
+
if (step.size && isNaN(step.size)) {
|
|
232
|
+
step.size = getStaticWidth(step);
|
|
233
|
+
}
|
|
234
|
+
steps[idStep] = step;
|
|
235
|
+
}
|
|
236
|
+
var newForm = __assign(__assign({}, form), { steps: steps });
|
|
237
|
+
if (form.spacingSize === undefined) {
|
|
238
|
+
newForm.spacingSize = 20;
|
|
239
|
+
newForm.blockNum = 4;
|
|
240
|
+
newForm.blockSize = 210;
|
|
241
|
+
}
|
|
242
|
+
return newForm;
|
|
243
|
+
};
|
|
244
|
+
function getStaticWidth(step) {
|
|
245
|
+
if (step.type === StepTypes.SELECTOR ||
|
|
246
|
+
step.type === StepTypes.TEXTINPUT ||
|
|
247
|
+
step.type === StepTypes.CLASSIFIER_SELECTOR) {
|
|
248
|
+
switch (step.size) {
|
|
249
|
+
case SIZES.LARGE:
|
|
250
|
+
return 4;
|
|
251
|
+
case SIZES.MEDIUM:
|
|
252
|
+
return 2;
|
|
253
|
+
case SIZES.SMALL:
|
|
254
|
+
return 1;
|
|
255
|
+
default:
|
|
256
|
+
return 1;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
return 4;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.curtain {
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
background-color: white;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.container {
|
|
13
|
+
width: 100%;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.widgetContainer {
|
|
18
|
+
position: relative;
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FormComponentProps } from '../Form';
|
|
3
|
-
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, widthStats, originalValues, }: FormComponentProps): JSX.Element;
|
|
4
|
-
export default ColumnForm;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormComponentProps } from '../Form';
|
|
3
|
+
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, widthStats, customSteps, originalValues, }: FormComponentProps): JSX.Element;
|
|
4
|
+
export default ColumnForm;
|