@arquimedes.co/eureka-forms 0.2.43-test → 0.2.46
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.js
CHANGED
|
@@ -67,42 +67,11 @@ import StepTypes from './constants/FormStepTypes';
|
|
|
67
67
|
import axiosInstance from './AxiosAPI';
|
|
68
68
|
function App(_a) {
|
|
69
69
|
var _this = this;
|
|
70
|
+
var _b, _c;
|
|
70
71
|
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, handleConfirmed = _a.handleConfirmed, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps", "handleConfirmed"]);
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
//
|
|
75
|
-
function fetchOrgData(domain) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
-
var response, _a, currentOrg;
|
|
78
|
-
return __generator(this, function (_b) {
|
|
79
|
-
switch (_b.label) {
|
|
80
|
-
case 0:
|
|
81
|
-
if (!domain) return [3 /*break*/, 2];
|
|
82
|
-
return [4 /*yield*/, axios.get("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/organization?domain=").concat(domain))];
|
|
83
|
-
case 1:
|
|
84
|
-
_a = _b.sent();
|
|
85
|
-
return [3 /*break*/, 4];
|
|
86
|
-
case 2: return [4 /*yield*/, axiosInstance.get('/organization')];
|
|
87
|
-
case 3:
|
|
88
|
-
_a = _b.sent();
|
|
89
|
-
_b.label = 4;
|
|
90
|
-
case 4:
|
|
91
|
-
response = _a;
|
|
92
|
-
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
93
|
-
currentOrg = response.data;
|
|
94
|
-
// document.title = currentOrg.name;
|
|
95
|
-
// const favicon: any = document.getElementById('favicon');
|
|
96
|
-
// if (favicon !== undefined) {
|
|
97
|
-
// favicon.href = currentOrg.partialLogoUrl;
|
|
98
|
-
// }
|
|
99
|
-
return [2 /*return*/, currentOrg];
|
|
100
|
-
}
|
|
101
|
-
return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
}
|
|
72
|
+
var _d = useState(undefined), form = _d[0], setForm = _d[1];
|
|
73
|
+
var _e = useState({}), originalValues = _e[0], setOriginalValues = _e[1];
|
|
74
|
+
var _f = useState(undefined), organizationInfo = _f[0], setOrganizationInfo = _f[1];
|
|
106
75
|
function fetchPreview(formData) {
|
|
107
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
108
77
|
var response;
|
|
@@ -135,10 +104,12 @@ function App(_a) {
|
|
|
135
104
|
}
|
|
136
105
|
else if (!isWidget && apiKey) {
|
|
137
106
|
//Is iframe
|
|
107
|
+
loadOrgInfo(domain);
|
|
138
108
|
loadInfo(apiKey, domain);
|
|
139
109
|
}
|
|
140
110
|
else if (isWidget && apiKey && domain) {
|
|
141
111
|
//Is iframe
|
|
112
|
+
loadOrgInfo(domain);
|
|
142
113
|
loadInfo(apiKey, domain);
|
|
143
114
|
}
|
|
144
115
|
else {
|
|
@@ -149,38 +120,71 @@ function App(_a) {
|
|
|
149
120
|
}
|
|
150
121
|
}, []);
|
|
151
122
|
var containerRef = useRef();
|
|
152
|
-
var
|
|
153
|
-
var
|
|
123
|
+
var loadOrgInfo = function (domain) { return __awaiter(_this, void 0, void 0, function () {
|
|
124
|
+
var response, _a, error_1;
|
|
154
125
|
return __generator(this, function (_b) {
|
|
155
126
|
switch (_b.label) {
|
|
156
127
|
case 0:
|
|
157
|
-
_b.trys.push([0,
|
|
128
|
+
_b.trys.push([0, 5, , 6]);
|
|
129
|
+
if (!domain) return [3 /*break*/, 2];
|
|
130
|
+
return [4 /*yield*/, axios.get("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/organization?domain=").concat(domain))];
|
|
131
|
+
case 1:
|
|
132
|
+
_a = _b.sent();
|
|
133
|
+
return [3 /*break*/, 4];
|
|
134
|
+
case 2: return [4 /*yield*/, axiosInstance.get('/organization')];
|
|
135
|
+
case 3:
|
|
136
|
+
_a = _b.sent();
|
|
137
|
+
_b.label = 4;
|
|
138
|
+
case 4:
|
|
139
|
+
response = _a;
|
|
140
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
141
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
|
142
|
+
// document.title = currentOrg.name;
|
|
143
|
+
// const favicon: any = document.getElementById('favicon');
|
|
144
|
+
// if (favicon !== undefined) {
|
|
145
|
+
// favicon.href = currentOrg.partialLogoUrl;
|
|
146
|
+
// }
|
|
147
|
+
//TODO cambiar el color del navbar en movil
|
|
148
|
+
console.log(response === null || response === void 0 ? void 0 : response.data);
|
|
149
|
+
setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
setOrganizationInfo(null);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return [3 /*break*/, 6];
|
|
156
|
+
case 5:
|
|
157
|
+
error_1 = _b.sent();
|
|
158
|
+
console.error(error_1);
|
|
159
|
+
setOrganizationInfo(null);
|
|
160
|
+
return [3 /*break*/, 6];
|
|
161
|
+
case 6: return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}); };
|
|
165
|
+
var loadInfo = function (apiKey, domain) { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
var url, response, error_2;
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
switch (_a.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
_a.trys.push([0, 2, , 3]);
|
|
158
171
|
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/form/").concat(apiKey, "?domain=").concat(domain);
|
|
159
|
-
return [4 /*yield*/,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
])];
|
|
172
|
+
return [4 /*yield*/, (domain
|
|
173
|
+
? axios.get(url)
|
|
174
|
+
: axiosInstance.get("/form/".concat(apiKey)))];
|
|
163
175
|
case 1:
|
|
164
|
-
|
|
176
|
+
response = _a.sent();
|
|
165
177
|
if (response) {
|
|
166
178
|
setForm(migrateFormData(response.data));
|
|
167
179
|
if (valuesData !== undefined) {
|
|
168
180
|
setOriginalValues(valuesData);
|
|
169
181
|
}
|
|
170
182
|
}
|
|
171
|
-
if (orgInfo) {
|
|
172
|
-
console.log(orgInfo);
|
|
173
|
-
setOrganizationInfo(orgInfo);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
setOrganizationInfo(null);
|
|
177
|
-
}
|
|
178
183
|
return [3 /*break*/, 3];
|
|
179
184
|
case 2:
|
|
180
|
-
|
|
181
|
-
console.error(
|
|
185
|
+
error_2 = _a.sent();
|
|
186
|
+
console.error(error_2);
|
|
182
187
|
setForm(null);
|
|
183
|
-
setOrganizationInfo(null);
|
|
184
188
|
return [3 /*break*/, 3];
|
|
185
189
|
case 3: return [2 /*return*/];
|
|
186
190
|
}
|
|
@@ -188,9 +192,9 @@ function App(_a) {
|
|
|
188
192
|
}); };
|
|
189
193
|
if (form === undefined || organizationInfo === undefined) {
|
|
190
194
|
if (isWidget) {
|
|
191
|
-
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color:
|
|
195
|
+
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_b = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.navbarColor) !== null && _b !== void 0 ? _b : '#b8b8b8' }, void 0) }), void 0) }), void 0));
|
|
192
196
|
}
|
|
193
|
-
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color:
|
|
197
|
+
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.navbarColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }, void 0) }), void 0));
|
|
194
198
|
}
|
|
195
199
|
else if (form === null) {
|
|
196
200
|
console.log('FORM IS NULL');
|
|
@@ -62,7 +62,7 @@ var useDatePickerStyles = function (props) {
|
|
|
62
62
|
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
63
63
|
borderColor: props.outlineColor,
|
|
64
64
|
'& span': {
|
|
65
|
-
fontSize:
|
|
65
|
+
fontSize: '0.75rem',
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
'&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
|
package/package.json
CHANGED