@aemforms/af-core 0.22.39 → 0.22.41
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.
|
@@ -64,7 +64,7 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
|
|
|
64
64
|
else {
|
|
65
65
|
context.form.logger.error('Error invoking a rest API');
|
|
66
66
|
const eName = getCustomEventName(error);
|
|
67
|
-
context.form.dispatch(new Events_1.CustomEvent(eName,
|
|
67
|
+
context.form.dispatch(new Events_1.CustomEvent(eName, result, true));
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
exports.request = request;
|
|
@@ -118,7 +118,7 @@ const submit = (context, success, error, submitAs = 'multipart/form-data', input
|
|
|
118
118
|
if (typeof data != 'object' || data == null) {
|
|
119
119
|
data = context.form.exportData();
|
|
120
120
|
}
|
|
121
|
-
const attachments = (0, FormUtils_1.getAttachments)(context.form);
|
|
121
|
+
const attachments = (0, FormUtils_1.getAttachments)(context.form, true);
|
|
122
122
|
let submitContentType = submitAs;
|
|
123
123
|
const submitDataAndMetaData = { 'data': data, 'submitMetadata': { 'lang': context.form.lang } };
|
|
124
124
|
let formData = submitDataAndMetaData;
|
package/lib/utils/Fetch.js
CHANGED
|
@@ -20,16 +20,13 @@ const request = (url, data = null, options = {}) => {
|
|
|
20
20
|
var _a, _b, _c;
|
|
21
21
|
let body;
|
|
22
22
|
if (!response.ok) {
|
|
23
|
-
console.error(`Error fetching response from ${url} : ${response.statusText}`);
|
|
24
|
-
|
|
23
|
+
console.error(`Error while fetching response from ${url} : ${response.statusText}`);
|
|
24
|
+
}
|
|
25
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Type')) === null || _b === void 0 ? void 0 : _b.includes('application/json')) {
|
|
26
|
+
body = yield response.json();
|
|
25
27
|
}
|
|
26
28
|
else {
|
|
27
|
-
|
|
28
|
-
body = yield response.json();
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
body = yield response.text();
|
|
32
|
-
}
|
|
29
|
+
body = yield response.text();
|
|
33
30
|
}
|
|
34
31
|
const headers = {};
|
|
35
32
|
(_c = response === null || response === void 0 ? void 0 : response.headers) === null || _c === void 0 ? void 0 : _c.forEach((value, key) => {
|
package/lib/utils/FormUtils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContainerModel } from '../types/index';
|
|
2
2
|
export declare const randomWord: (l: number) => string;
|
|
3
3
|
export declare const isEmpty: (value: any) => boolean;
|
|
4
|
-
export declare const getAttachments: (input: ContainerModel) => any;
|
|
4
|
+
export declare const getAttachments: (input: ContainerModel, excludeUnbound?: boolean) => any;
|
|
5
5
|
export declare const getFileSizeInBytes: (str: any) => number;
|
|
6
6
|
export declare const IdGenerator: (initial?: number) => Generator<string, void, string>;
|
|
7
7
|
export declare const isDataUrl: (str: string) => boolean;
|
package/lib/utils/FormUtils.js
CHANGED
|
@@ -24,12 +24,15 @@ const isEmpty = (value) => {
|
|
|
24
24
|
return value === '' || value === null || value === undefined;
|
|
25
25
|
};
|
|
26
26
|
exports.isEmpty = isEmpty;
|
|
27
|
-
const getAttachments = (input) => {
|
|
27
|
+
const getAttachments = (input, excludeUnbound = false) => {
|
|
28
28
|
const items = input.items || [];
|
|
29
29
|
return items === null || items === void 0 ? void 0 : items.reduce((acc, item) => {
|
|
30
|
+
if (excludeUnbound && item.dataRef === null) {
|
|
31
|
+
return acc;
|
|
32
|
+
}
|
|
30
33
|
let ret = null;
|
|
31
34
|
if (item.isContainer) {
|
|
32
|
-
ret = (0, exports.getAttachments)(item);
|
|
35
|
+
ret = (0, exports.getAttachments)(item, excludeUnbound);
|
|
33
36
|
}
|
|
34
37
|
else {
|
|
35
38
|
if ((0, JsonUtils_1.isFile)(item.getState())) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aemforms/af-core",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.41",
|
|
4
4
|
"description": "Core Module for Forms Runtime",
|
|
5
5
|
"author": "Adobe Systems",
|
|
6
6
|
"license": "Adobe Proprietary",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@adobe/json-formula": "0.1.50",
|
|
38
|
-
"@aemforms/af-formatters": "^0.22.
|
|
38
|
+
"@aemforms/af-formatters": "^0.22.41"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/preset-env": "^7.20.2",
|