@reltio/components 1.4.1227 → 1.4.1230
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/cjs/contexts/InterceptHandlersContext/index.d.ts +3 -0
- package/cjs/contexts/InterceptHandlersContext/index.js +9 -0
- package/cjs/contexts/SandboxAPIContext/index.d.ts +6 -2
- package/cjs/contexts/index.d.ts +1 -0
- package/cjs/contexts/index.js +3 -1
- package/cjs/hooks/useAPI/API.js +5 -4
- package/cjs/hooks/useAPI/helpers.d.ts +49 -0
- package/cjs/hooks/useAPI/helpers.js +203 -1
- package/cjs/hooks/useAPI/useAPI.js +124 -86
- package/cjs/hooks/useCustomScripts.d.ts +2 -9
- package/cjs/hooks/useCustomScripts.js +9 -6
- package/esm/contexts/InterceptHandlersContext/index.d.ts +3 -0
- package/esm/contexts/InterceptHandlersContext/index.js +3 -0
- package/esm/contexts/SandboxAPIContext/index.d.ts +6 -2
- package/esm/contexts/index.d.ts +1 -0
- package/esm/contexts/index.js +1 -0
- package/esm/hooks/useAPI/API.js +5 -4
- package/esm/hooks/useAPI/helpers.d.ts +49 -0
- package/esm/hooks/useAPI/helpers.js +193 -0
- package/esm/hooks/useAPI/useAPI.js +126 -88
- package/esm/hooks/useCustomScripts.d.ts +2 -9
- package/esm/hooks/useCustomScripts.js +10 -7
- package/package.json +3 -3
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare
|
|
3
|
-
addInternalRequestInterceptor: ReturnType<typeof createRequestProvider>['addRequestInterceptor'];
|
|
4
|
-
addInternalResponseInterceptor: ReturnType<typeof createRequestProvider>['addResponseInterceptor'];
|
|
5
|
-
removeInternalRequestInterceptor: ReturnType<typeof createRequestProvider>['removeRequestInterceptor'];
|
|
6
|
-
removeInternalResponseInterceptor: ReturnType<typeof createRequestProvider>['removeResponseInterceptor'];
|
|
7
|
-
};
|
|
8
|
-
export declare const useCustomScripts: (config: CustomScript[], { addInternalRequestInterceptor, addInternalResponseInterceptor, removeInternalRequestInterceptor, removeInternalResponseInterceptor }: InterceptHandlers) => void;
|
|
9
|
-
export {};
|
|
1
|
+
import { CustomScript } from '@reltio/mdm-sdk';
|
|
2
|
+
export declare const useCustomScripts: (config: CustomScript[]) => void;
|
|
@@ -32,7 +32,7 @@ import { CustomAction, CustomScriptPlatform, initializeWebWorker, isEmptyValue }
|
|
|
32
32
|
import nanoid from 'nanoid';
|
|
33
33
|
import { find, map, omit, pick, pipe, prop } from 'ramda';
|
|
34
34
|
import { useWorkflowCheckPermission } from '../components/workflow';
|
|
35
|
-
import { SandboxAPIContext, SnackbarContext } from '../contexts';
|
|
35
|
+
import { InterceptHandlersContext, SandboxAPIContext, SnackbarContext } from '../contexts';
|
|
36
36
|
import { getWorkerURL, processRequest } from './useAPI';
|
|
37
37
|
var isURLtoProcess = function (processApi, url) {
|
|
38
38
|
return (processApi || []).some(function (request) {
|
|
@@ -44,8 +44,7 @@ var getCustomViewConfig = function (config) {
|
|
|
44
44
|
var processApiResponse = config.processApiResponse, processApiRequest = config.processApiRequest, permissions = config.permissions, files = config.files, otherProps = __rest(config, ["processApiResponse", "processApiRequest", "permissions", "files"]);
|
|
45
45
|
return __assign({ action: { processApiResponse: processApiResponse, processApiRequest: processApiRequest, permissions: permissions, files: files } }, otherProps);
|
|
46
46
|
};
|
|
47
|
-
export var useCustomScripts = function (config
|
|
48
|
-
var addInternalRequestInterceptor = _a.addInternalRequestInterceptor, addInternalResponseInterceptor = _a.addInternalResponseInterceptor, removeInternalRequestInterceptor = _a.removeInternalRequestInterceptor, removeInternalResponseInterceptor = _a.removeInternalResponseInterceptor;
|
|
47
|
+
export var useCustomScripts = function (config) {
|
|
49
48
|
var customScripts = config.reduce(function (acc, customScript) {
|
|
50
49
|
if (customScript.platform !== CustomScriptPlatform.CLASSIC) {
|
|
51
50
|
return __spreadArray(__spreadArray([], acc), [__assign(__assign({}, customScript), { actionId: nanoid() })]);
|
|
@@ -53,6 +52,8 @@ export var useCustomScripts = function (config, _a) {
|
|
|
53
52
|
return acc;
|
|
54
53
|
}, []);
|
|
55
54
|
var showSnackbarMessage = useContext(SnackbarContext);
|
|
55
|
+
var _a = useContext(InterceptHandlersContext), addInternalRequestInterceptor = _a.addInternalRequestInterceptor, addInternalResponseInterceptor = _a.addInternalResponseInterceptor, removeInternalRequestInterceptor = _a.removeInternalRequestInterceptor, removeInternalResponseInterceptor = _a.removeInternalResponseInterceptor;
|
|
56
|
+
var qxApi = useContext(SandboxAPIContext);
|
|
56
57
|
var dispatch = useDispatch();
|
|
57
58
|
var metadata = useSelector(mdmModule.selectors.getMetadata) || {};
|
|
58
59
|
var entity = useSelector(mdmModule.selectors.getEntity) || {};
|
|
@@ -66,7 +67,6 @@ export var useCustomScripts = function (config, _a) {
|
|
|
66
67
|
var user = useSelector(mdmModule.selectors.getUser);
|
|
67
68
|
var entityUri = useSelector(mdmModule.selectors.getEntityUri);
|
|
68
69
|
var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
|
|
69
|
-
var qxApi = useContext(SandboxAPIContext);
|
|
70
70
|
var workflowCheckPermission = useWorkflowCheckPermission();
|
|
71
71
|
var _b = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _b.type, search = _b.data;
|
|
72
72
|
var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
|
|
@@ -105,10 +105,13 @@ export var useCustomScripts = function (config, _a) {
|
|
|
105
105
|
var _d = task.params, headers = _d.headers, id = _d.id, fakeURL = _d.url, method = _d.method, data = _d.data;
|
|
106
106
|
var url = fakeURL.replace(reltioPath, apiPath);
|
|
107
107
|
if (requestListeners.current[headers.requestId]) {
|
|
108
|
-
requestListeners.current[headers.requestId].next(url,
|
|
108
|
+
requestListeners.current[headers.requestId].next(url, {
|
|
109
|
+
body: data,
|
|
110
|
+
id: id,
|
|
109
111
|
task: task,
|
|
110
112
|
headers: headers,
|
|
111
|
-
method: method
|
|
113
|
+
method: method
|
|
114
|
+
});
|
|
112
115
|
requestListeners.current = omit([headers.requestId], requestListeners.current);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
@@ -130,7 +133,7 @@ export var useCustomScripts = function (config, _a) {
|
|
|
130
133
|
workers.current = customScripts.reduce(function (acc, customScript) {
|
|
131
134
|
var _a;
|
|
132
135
|
var customViewConfig = getCustomViewConfig(customScript);
|
|
133
|
-
return __assign(__assign({}, acc), (_a = {}, _a[customScript.actionId] = initializeWebWorker(workerUrl,
|
|
136
|
+
return __assign(__assign({}, acc), (_a = {}, _a[customScript.actionId] = initializeWebWorker(workerUrl, process, customViewConfig), _a));
|
|
134
137
|
}, workers.current);
|
|
135
138
|
return function () {
|
|
136
139
|
Object.keys(workers.current).forEach(function (actionId) {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1230",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.1230",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1230",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|