@arquimedes.co/eureka-forms 2.0.48 → 2.0.50
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/Form/Form.js +17 -15
- package/package.json +1 -1
package/dist/Form/Form.js
CHANGED
|
@@ -102,27 +102,29 @@ function FormComponent(_a) {
|
|
|
102
102
|
}
|
|
103
103
|
}, [idFocusStep]);
|
|
104
104
|
var onSubmit = useCallback(function (values) { return __awaiter(_this, void 0, void 0, function () {
|
|
105
|
-
var token, state, newValues, deleteIds, _i, _a, idStep, _b, deleteIds_1, id, params, url, axios, resp, error_1;
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
var token, apikey, state, newValues, deleteIds, _i, _a, idStep, _b, deleteIds_1, id, params, url, axios, resp, error_1;
|
|
106
|
+
var _c;
|
|
107
|
+
return __generator(this, function (_d) {
|
|
108
|
+
switch (_d.label) {
|
|
108
109
|
case 0:
|
|
109
110
|
token = null;
|
|
110
|
-
if (!(form.hasCaptcha && !customSubmit)) return [3 /*break*/, 2];
|
|
111
|
-
token = recaptchaRef.current.getValue();
|
|
111
|
+
if (!(form.hasCaptcha && !internal && !customSubmit)) return [3 /*break*/, 2];
|
|
112
|
+
token = (_c = recaptchaRef.current) === null || _c === void 0 ? void 0 : _c.getValue();
|
|
112
113
|
if (!!token) return [3 /*break*/, 2];
|
|
113
114
|
return [4 /*yield*/, (recaptchaRef === null || recaptchaRef === void 0 ? void 0 : recaptchaRef.current.executeAsync())];
|
|
114
115
|
case 1:
|
|
115
|
-
token =
|
|
116
|
-
|
|
116
|
+
token = _d.sent();
|
|
117
|
+
_d.label = 2;
|
|
117
118
|
case 2:
|
|
118
|
-
|
|
119
|
+
apikey = internal ? form.apiKey : apiKey;
|
|
120
|
+
if (!apikey && !customSubmit && !customSubmitBtns)
|
|
119
121
|
return [2 /*return*/];
|
|
120
|
-
|
|
122
|
+
_d.label = 3;
|
|
121
123
|
case 3:
|
|
122
|
-
|
|
124
|
+
_d.trys.push([3, 8, , 9]);
|
|
123
125
|
return [4 /*yield*/, dispatch(getAppState({ idForm: idForm })).unwrap()];
|
|
124
126
|
case 4:
|
|
125
|
-
state =
|
|
127
|
+
state = _d.sent();
|
|
126
128
|
newValues = __assign({}, state.site.values.global);
|
|
127
129
|
deleteIds = [];
|
|
128
130
|
for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
|
|
@@ -135,7 +137,7 @@ function FormComponent(_a) {
|
|
|
135
137
|
}
|
|
136
138
|
if (!customSubmit) return [3 /*break*/, 6];
|
|
137
139
|
return [4 /*yield*/, customSubmit(newValues, reload)];
|
|
138
|
-
case 5: return [2 /*return*/,
|
|
140
|
+
case 5: return [2 /*return*/, _d.sent()];
|
|
139
141
|
case 6:
|
|
140
142
|
if (customSubmitBtns)
|
|
141
143
|
return [2 /*return*/, newValues];
|
|
@@ -144,18 +146,18 @@ function FormComponent(_a) {
|
|
|
144
146
|
params.set('idOrganization', idOrganization !== null && idOrganization !== void 0 ? idOrganization : '');
|
|
145
147
|
if (token)
|
|
146
148
|
params.set('token', token);
|
|
147
|
-
url = "/ticket/".concat(
|
|
149
|
+
url = "/ticket/".concat(apiKey);
|
|
148
150
|
if (params.toString()) {
|
|
149
151
|
url += "?".concat(params.toString());
|
|
150
152
|
}
|
|
151
153
|
axios = idOrganization || internal ? widgetInstance : axiosInstance;
|
|
152
154
|
return [4 /*yield*/, axios.post(url, newValues)];
|
|
153
155
|
case 7:
|
|
154
|
-
resp =
|
|
156
|
+
resp = _d.sent();
|
|
155
157
|
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
156
158
|
return [3 /*break*/, 9];
|
|
157
159
|
case 8:
|
|
158
|
-
error_1 =
|
|
160
|
+
error_1 = _d.sent();
|
|
159
161
|
console.error(error_1);
|
|
160
162
|
return [3 /*break*/, 9];
|
|
161
163
|
case 9: return [2 /*return*/];
|