@arquimedes.co/eureka-forms 0.2.48-test → 1.0.5-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 +11 -12
- package/dist/AxiosWidget.d.ts +2 -0
- package/dist/AxiosWidget.js +8 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +5 -5
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +1 -1
- package/dist/FormComponents/Form/Form.js +3 -3
- package/dist/controllers/FileService.js +2 -4
- 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
|
@@ -58,26 +58,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
58
58
|
};
|
|
59
59
|
var _a;
|
|
60
60
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
61
|
-
import axios from 'axios';
|
|
62
61
|
import { useEffect, useRef, useState } from 'react';
|
|
63
62
|
import Loader from './shared/Loader/Loader';
|
|
64
63
|
import styles from './App.module.css';
|
|
65
64
|
import FormComponent from './FormComponents/Form/Form';
|
|
66
65
|
import StepTypes from './constants/FormStepTypes';
|
|
67
66
|
import axiosInstance from './AxiosAPI';
|
|
67
|
+
import widgetInstance from './AxiosWidget';
|
|
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;
|
|
78
78
|
return __generator(this, function (_a) {
|
|
79
79
|
switch (_a.label) {
|
|
80
|
-
case 0: return [4 /*yield*/,
|
|
80
|
+
case 0: return [4 /*yield*/, widgetInstance.get('/organization')];
|
|
81
81
|
case 1:
|
|
82
82
|
response = _a.sent();
|
|
83
83
|
if (response.data) {
|
|
@@ -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*/,
|
|
130
|
+
return [4 /*yield*/, widgetInstance.get("/organization?idOrganization=".concat(domain))];
|
|
131
131
|
case 1:
|
|
132
132
|
_a = _b.sent();
|
|
133
133
|
return [3 /*break*/, 4];
|
|
@@ -164,14 +164,13 @@ function App(_a) {
|
|
|
164
164
|
});
|
|
165
165
|
}); };
|
|
166
166
|
var loadInfo = function (apiKey, domain) { return __awaiter(_this, void 0, void 0, function () {
|
|
167
|
-
var
|
|
167
|
+
var response, error_2;
|
|
168
168
|
return __generator(this, function (_a) {
|
|
169
169
|
switch (_a.label) {
|
|
170
170
|
case 0:
|
|
171
171
|
_a.trys.push([0, 2, , 3]);
|
|
172
|
-
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/form/").concat(apiKey, "?domain=").concat(domain);
|
|
173
172
|
return [4 /*yield*/, (domain
|
|
174
|
-
?
|
|
173
|
+
? widgetInstance.get("/form/".concat(apiKey, "?idOrganization=").concat(domain))
|
|
175
174
|
: axiosInstance.get("/form/".concat(apiKey)))];
|
|
176
175
|
case 1:
|
|
177
176
|
response = _a.sent();
|
|
@@ -193,9 +192,9 @@ function App(_a) {
|
|
|
193
192
|
}); };
|
|
194
193
|
if (form === undefined || organizationInfo === undefined) {
|
|
195
194
|
if (isWidget) {
|
|
196
|
-
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.
|
|
195
|
+
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));
|
|
197
196
|
}
|
|
198
|
-
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: (_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));
|
|
199
198
|
}
|
|
200
199
|
else if (form === null) {
|
|
201
200
|
if (organizationInfo === null) {
|
|
@@ -66,8 +66,8 @@ import { convertToRaw } from 'draft-js';
|
|
|
66
66
|
import TermComponent from '../../Term/Term';
|
|
67
67
|
import ConfirmationDialog from '../ConfirmationDialog/ConfirmationDialog';
|
|
68
68
|
import Loader from '../../../shared/Loader/Loader';
|
|
69
|
-
import axios from 'axios';
|
|
70
69
|
import axiosInstance from '../../../AxiosAPI';
|
|
70
|
+
import widgetInstance from '../../../AxiosWidget';
|
|
71
71
|
function ColumnForm(_a) {
|
|
72
72
|
var _this = this;
|
|
73
73
|
var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, widthStats = _a.widthStats, customSteps = _a.customSteps, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "widthStats", "customSteps", "originalValues"]);
|
|
@@ -89,7 +89,7 @@ function ColumnForm(_a) {
|
|
|
89
89
|
return _jsx("div", {}, void 0);
|
|
90
90
|
}
|
|
91
91
|
var onSubmit = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
92
|
-
var valid, values, _i, _a, idStep,
|
|
92
|
+
var valid, values, _i, _a, idStep, payload, url, resp, _b, error_1;
|
|
93
93
|
return __generator(this, function (_c) {
|
|
94
94
|
switch (_c.label) {
|
|
95
95
|
case 0:
|
|
@@ -112,16 +112,16 @@ function ColumnForm(_a) {
|
|
|
112
112
|
idStep = _a[_i];
|
|
113
113
|
updateValue(idStep, values, form, customSteps);
|
|
114
114
|
}
|
|
115
|
-
url = "https://".concat(domain, ".forms.").concat(process.env.REACT_APP_DOMAIN, "/api/ticket?apiKey=").concat(internal ? form.apiKey : apiKey, "&domain=").concat(domain);
|
|
116
115
|
payload = {
|
|
117
116
|
formValues: { steps: values },
|
|
118
117
|
};
|
|
118
|
+
url = "/ticket/".concat(internal ? form.apiKey : apiKey);
|
|
119
119
|
if (!(domain || internal)) return [3 /*break*/, 4];
|
|
120
|
-
return [4 /*yield*/,
|
|
120
|
+
return [4 /*yield*/, widgetInstance.post("".concat(url, "?idOrganization=").concat(domain), payload)];
|
|
121
121
|
case 3:
|
|
122
122
|
_b = _c.sent();
|
|
123
123
|
return [3 /*break*/, 6];
|
|
124
|
-
case 4: return [4 /*yield*/, axiosInstance.post(
|
|
124
|
+
case 4: return [4 /*yield*/, axiosInstance.post(url, payload)];
|
|
125
125
|
case 5:
|
|
126
126
|
_b = _c.sent();
|
|
127
127
|
_c.label = 6;
|
|
@@ -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,7 +89,7 @@ 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
|
}
|
|
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import axios from 'axios';
|
|
38
38
|
import axiosInstance from '../AxiosAPI';
|
|
39
|
+
import widgetInstance from '../AxiosWidget';
|
|
39
40
|
export function getUploadUrls(files, domain) {
|
|
40
41
|
var _a;
|
|
41
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -48,10 +49,7 @@ export function getUploadUrls(files, domain) {
|
|
|
48
49
|
extension: file.name.split('.').pop(),
|
|
49
50
|
}); });
|
|
50
51
|
if (!domain) return [3 /*break*/, 2];
|
|
51
|
-
return [4 /*yield*/,
|
|
52
|
-
domain: domain,
|
|
53
|
-
files: filesArray,
|
|
54
|
-
})];
|
|
52
|
+
return [4 /*yield*/, widgetInstance.post("/uploadfile?idOrganization=".concat(domain), filesArray)];
|
|
55
53
|
case 1:
|
|
56
54
|
response = _b.sent();
|
|
57
55
|
return [3 /*break*/, 4];
|
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.
|
|
4
|
+
"version":"1.0.5-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
|
}
|