@arquimedes.co/eureka-forms 0.2.46 → 1.0.0-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/@Types/Organization.d.ts +8 -5
- package/dist/App.js +10 -11
- package/dist/App.module.css +4 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +3 -6
- package/dist/FormComponents/Form/Form.js +3 -4
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +1 -1
- package/dist/Widget.js +1 -0
- package/dist/controllers/FileService.js +1 -4
- package/dist/index.js +2 -0
- package/package.json +2 -2
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
export interface Organization {
|
|
2
2
|
/** The Organization's id */
|
|
3
|
-
|
|
3
|
+
idOrganization: string;
|
|
4
4
|
/** The Organization's name */
|
|
5
5
|
name: string;
|
|
6
6
|
/** The organization Logo url */
|
|
7
|
-
|
|
7
|
+
logoUrl: string;
|
|
8
8
|
/** The organization Favicon url */
|
|
9
|
-
|
|
9
|
+
iconUrl?: string;
|
|
10
10
|
/** The organization contact info */
|
|
11
11
|
contactInfo?: Array<Record<string, string>>;
|
|
12
12
|
/** The organization web page url*/
|
|
13
13
|
webUrl: string;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
styles?: {
|
|
15
|
+
primaryColor: string;
|
|
16
|
+
secondaryColor: string;
|
|
17
|
+
contrastColor: string;
|
|
18
|
+
};
|
|
16
19
|
}
|
package/dist/App.js
CHANGED
|
@@ -67,11 +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
|
+
var _b, _c, _d, _e;
|
|
71
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"]);
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
72
|
+
var _f = useState(undefined), form = _f[0], setForm = _f[1];
|
|
73
|
+
var _g = useState({}), originalValues = _g[0], setOriginalValues = _g[1];
|
|
74
|
+
var _h = useState(undefined), organizationInfo = _h[0], setOrganizationInfo = _h[1];
|
|
75
75
|
function fetchPreview(formData) {
|
|
76
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
77
77
|
var response;
|
|
@@ -113,7 +113,7 @@ function App(_a) {
|
|
|
113
113
|
loadInfo(apiKey, domain);
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
console.
|
|
116
|
+
console.error('ERROREMBED');
|
|
117
117
|
//Error in embed
|
|
118
118
|
setForm(null);
|
|
119
119
|
setOrganizationInfo(null);
|
|
@@ -127,7 +127,7 @@ function App(_a) {
|
|
|
127
127
|
case 0:
|
|
128
128
|
_b.trys.push([0, 5, , 6]);
|
|
129
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?
|
|
130
|
+
return [4 /*yield*/, axios.get("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/organization?idOrganization=").concat(domain))];
|
|
131
131
|
case 1:
|
|
132
132
|
_a = _b.sent();
|
|
133
133
|
return [3 /*break*/, 4];
|
|
@@ -145,6 +145,7 @@ function App(_a) {
|
|
|
145
145
|
// favicon.href = currentOrg.partialLogoUrl;
|
|
146
146
|
// }
|
|
147
147
|
//TODO cambiar el color del navbar en movil
|
|
148
|
+
// eslint-disable-next-line no-console
|
|
148
149
|
console.log(response === null || response === void 0 ? void 0 : response.data);
|
|
149
150
|
setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
|
|
150
151
|
}
|
|
@@ -168,7 +169,7 @@ function App(_a) {
|
|
|
168
169
|
switch (_a.label) {
|
|
169
170
|
case 0:
|
|
170
171
|
_a.trys.push([0, 2, , 3]);
|
|
171
|
-
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/form/").concat(apiKey, "?
|
|
172
|
+
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/form/").concat(apiKey, "?idOrganization=").concat(domain);
|
|
172
173
|
return [4 /*yield*/, (domain
|
|
173
174
|
? axios.get(url)
|
|
174
175
|
: axiosInstance.get("/form/".concat(apiKey)))];
|
|
@@ -192,14 +193,12 @@ function App(_a) {
|
|
|
192
193
|
}); };
|
|
193
194
|
if (form === undefined || organizationInfo === undefined) {
|
|
194
195
|
if (isWidget) {
|
|
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.
|
|
196
|
+
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = (_b = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.styles) === null || _b === void 0 ? void 0 : _b.primaryColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }, void 0) }), void 0) }), void 0));
|
|
196
197
|
}
|
|
197
|
-
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (
|
|
198
|
+
return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_e = (_d = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.styles) === null || _d === void 0 ? void 0 : _d.primaryColor) !== null && _e !== void 0 ? _e : '#b8b8b8' }, void 0) }), void 0));
|
|
198
199
|
}
|
|
199
200
|
else if (form === null) {
|
|
200
|
-
console.log('FORM IS NULL');
|
|
201
201
|
if (organizationInfo === null) {
|
|
202
|
-
console.log('ORG IS NULL');
|
|
203
202
|
if (isWidget) {
|
|
204
203
|
return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: "Error" }), void 0) }), void 0));
|
|
205
204
|
}
|
package/dist/App.module.css
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
background-color: white;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
#widget:eureka {
|
|
13
|
+
min-height: inherit;
|
|
14
|
+
}
|
|
12
15
|
.container {
|
|
13
16
|
width: 100%;
|
|
14
17
|
position: relative;
|
|
@@ -18,6 +21,7 @@
|
|
|
18
21
|
position: relative;
|
|
19
22
|
max-width: 100%;
|
|
20
23
|
height: 100%;
|
|
24
|
+
min-height: inherit;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
.container *,
|
|
@@ -98,9 +98,8 @@ function ColumnForm(_a) {
|
|
|
98
98
|
case 1:
|
|
99
99
|
valid = _c.sent();
|
|
100
100
|
values = getValues();
|
|
101
|
-
console.log(values);
|
|
102
101
|
if (!!valid) return [3 /*break*/, 2];
|
|
103
|
-
console.
|
|
102
|
+
console.error('ERRORS:', errors);
|
|
104
103
|
setTempError(true);
|
|
105
104
|
setTimeout(function () {
|
|
106
105
|
setTempError(false);
|
|
@@ -113,8 +112,7 @@ function ColumnForm(_a) {
|
|
|
113
112
|
idStep = _a[_i];
|
|
114
113
|
updateValue(idStep, values, form, customSteps);
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/ticket?apiKey=").concat(internal ? form.apiKey : apiKey, "&domain=").concat(domain);
|
|
115
|
+
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/ticket/").concat(internal ? form.apiKey : apiKey, "?idOrganization=").concat(domain);
|
|
118
116
|
payload = {
|
|
119
117
|
formValues: { steps: values },
|
|
120
118
|
};
|
|
@@ -123,13 +121,12 @@ function ColumnForm(_a) {
|
|
|
123
121
|
case 3:
|
|
124
122
|
_b = _c.sent();
|
|
125
123
|
return [3 /*break*/, 6];
|
|
126
|
-
case 4: return [4 /*yield*/, axiosInstance.post("ticket
|
|
124
|
+
case 4: return [4 /*yield*/, axiosInstance.post("ticket/".concat(internal ? form.apiKey : apiKey), payload)];
|
|
127
125
|
case 5:
|
|
128
126
|
_b = _c.sent();
|
|
129
127
|
_c.label = 6;
|
|
130
128
|
case 6:
|
|
131
129
|
resp = _b;
|
|
132
|
-
console.log(resp);
|
|
133
130
|
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
134
131
|
setLoading(false);
|
|
135
132
|
return [3 /*break*/, 8];
|
|
@@ -51,9 +51,9 @@ var blockSize = 210;
|
|
|
51
51
|
var spacingSize = 20;
|
|
52
52
|
var blockNum = 4;
|
|
53
53
|
function FormComponent(_a) {
|
|
54
|
-
var _b;
|
|
54
|
+
var _b, _c;
|
|
55
55
|
var form = _a.form, internal = _a.internal, postview = _a.postview, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "internal", "postview", "organization", "containerRef"]);
|
|
56
|
-
var
|
|
56
|
+
var _d = useState(undefined), widthStats = _d[0], setWidthStats = _d[1];
|
|
57
57
|
/** Calcs the currentBreakPoint and if is mobile */
|
|
58
58
|
var handleResize = function () {
|
|
59
59
|
var _a;
|
|
@@ -89,12 +89,11 @@ function FormComponent(_a) {
|
|
|
89
89
|
}
|
|
90
90
|
else if (organization && widthStats !== undefined) {
|
|
91
91
|
//Standalone cant have widget
|
|
92
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.
|
|
92
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (_c = organization.styles) === null || _c === void 0 ? void 0 : _c.primaryColor }, void 0), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef }, { children: _jsx("div", __assign({ className: widthStats.isMobile
|
|
93
93
|
? styles.fullScreenStandAloneForm
|
|
94
94
|
: styles.standAloneFormCard, style: { backgroundColor: form.style.backgroundColor } }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: form.style }), void 0) }), void 0) }), void 0)] }, void 0));
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
-
console.log(__assign(__assign({ form: form, internal: internal, postview: postview, organization: organization }, others), { widthStats: widthStats }));
|
|
98
97
|
return _jsx("div", {}, void 0);
|
|
99
98
|
}
|
|
100
99
|
}
|
|
@@ -34,7 +34,7 @@ function MaterialSection(_a) {
|
|
|
34
34
|
return (_createElement(StepComponent, __assign({}, others, { form: form, step: step, handleSizeChange: function () { }, key: index, level: 0 })));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
console.
|
|
37
|
+
console.error('Step not found:', idStep);
|
|
38
38
|
return _jsx("div", {}, index);
|
|
39
39
|
}
|
|
40
40
|
}) }), void 0));
|
package/dist/Widget.js
CHANGED
|
@@ -48,10 +48,7 @@ export function getUploadUrls(files, domain) {
|
|
|
48
48
|
extension: file.name.split('.').pop(),
|
|
49
49
|
}); });
|
|
50
50
|
if (!domain) return [3 /*break*/, 2];
|
|
51
|
-
return [4 /*yield*/, axios.post("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/uploadfile"),
|
|
52
|
-
domain: domain,
|
|
53
|
-
files: filesArray,
|
|
54
|
-
})];
|
|
51
|
+
return [4 /*yield*/, axios.post("https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/uploadfile?idOrganization=").concat(domain), filesArray)];
|
|
55
52
|
case 1:
|
|
56
53
|
response = _b.sent();
|
|
57
54
|
return [3 /*break*/, 4];
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ var dataValues = undefined;
|
|
|
19
19
|
if (values) {
|
|
20
20
|
try {
|
|
21
21
|
dataValues = JSON.parse(decodeURIComponent(values));
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.log('DATA:', dataValues);
|
|
22
24
|
}
|
|
23
25
|
catch (error) {
|
|
24
26
|
console.error('Invalid data-values JSON', error);
|
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":
|
|
4
|
+
"version":"1.0.0-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
7
7
|
"build": "react-scripts build",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"files": [
|
|
82
82
|
"/dist"
|
|
83
83
|
],
|
|
84
|
-
"proxy": "https://
|
|
84
|
+
"proxy": "https://api.forms.capta.co"
|
|
85
85
|
}
|