@reltio/components 1.4.1102 → 1.4.1105

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.
Files changed (93) hide show
  1. package/cjs/components/ActionButton/styles.d.ts +1 -1
  2. package/cjs/components/AttributesFiltersButton/ActionButtons/styles.d.ts +1 -1
  3. package/cjs/components/DropDownSelector/styles.d.ts +1 -1
  4. package/cjs/components/MatchRulesBlock/MatchRulesBadge/MatchRulesBadge.js +2 -1
  5. package/cjs/components/MatchRulesBlock/MatchRulesBadge/styles.d.ts +1 -1
  6. package/cjs/components/MatchRulesBlock/MatchRulesBadge/styles.js +5 -3
  7. package/cjs/components/MergeButton/MergeButton.d.ts +1 -0
  8. package/cjs/components/ModeSwitcherSelect/styles.d.ts +1 -1
  9. package/cjs/components/NotMatchButton/NotMatchButton.d.ts +1 -0
  10. package/cjs/components/Popper/styles.d.ts +1 -1
  11. package/cjs/components/ProfileBand/styles.d.ts +1 -1
  12. package/cjs/components/ProfileCard/styles.d.ts +1 -1
  13. package/cjs/components/ProfileMatchCard/styles.d.ts +1 -1
  14. package/cjs/components/ProfileMatchCard/styles.js +2 -1
  15. package/cjs/components/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +5 -1
  16. package/cjs/components/VerticalHeadingsTable/VerticalHeadingsTable.js +5 -3
  17. package/cjs/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
  18. package/cjs/components/attributes/editMode/MoreAttributesButton/styles.d.ts +1 -1
  19. package/cjs/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
  20. package/cjs/components/crosswalks/CrosswalkAttributes/styles.d.ts +1 -1
  21. package/cjs/components/editors/CustomDateRangeEditor/styles.d.ts +1 -1
  22. package/cjs/components/editors/DateEditor/styles.d.ts +1 -1
  23. package/cjs/components/editors/DateRangeEditor/styles.d.ts +1 -1
  24. package/cjs/components/editors/TimestampEditor/styles.d.ts +1 -1
  25. package/cjs/components/workflow/cards/GenericWorkflowTaskCard/styles.d.ts +1 -1
  26. package/cjs/components/workflow/components/AddWorkflowDialog/styles.d.ts +1 -1
  27. package/cjs/components/workflow/components/DueDateField/styles.d.ts +1 -1
  28. package/cjs/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  29. package/cjs/contexts/SandboxAPIContext/index.d.ts +6 -0
  30. package/cjs/contexts/SandboxAPIContext/index.js +12 -0
  31. package/cjs/contexts/index.d.ts +1 -0
  32. package/cjs/contexts/index.js +3 -1
  33. package/cjs/hooks/index.d.ts +3 -0
  34. package/cjs/hooks/index.js +6 -1
  35. package/cjs/hooks/useAPI/API.d.ts +2 -0
  36. package/cjs/hooks/useAPI/API.js +201 -0
  37. package/cjs/hooks/useAPI/helpers.d.ts +1 -0
  38. package/cjs/hooks/useAPI/helpers.js +12 -0
  39. package/cjs/hooks/useAPI/index.d.ts +5 -0
  40. package/cjs/hooks/useAPI/index.js +11 -0
  41. package/cjs/hooks/useAPI/types.d.ts +90 -0
  42. package/cjs/hooks/useAPI/types.js +42 -0
  43. package/cjs/hooks/useAPI/useAPI.d.ts +13 -0
  44. package/cjs/hooks/useAPI/useAPI.js +192 -0
  45. package/cjs/hooks/useCustomScripts.d.ts +9 -0
  46. package/cjs/hooks/useCustomScripts.js +215 -0
  47. package/esm/components/ActionButton/styles.d.ts +1 -1
  48. package/esm/components/AttributesFiltersButton/ActionButtons/styles.d.ts +1 -1
  49. package/esm/components/DropDownSelector/styles.d.ts +1 -1
  50. package/esm/components/MatchRulesBlock/MatchRulesBadge/MatchRulesBadge.js +2 -1
  51. package/esm/components/MatchRulesBlock/MatchRulesBadge/styles.d.ts +1 -1
  52. package/esm/components/MatchRulesBlock/MatchRulesBadge/styles.js +5 -3
  53. package/esm/components/MergeButton/MergeButton.d.ts +1 -0
  54. package/esm/components/ModeSwitcherSelect/styles.d.ts +1 -1
  55. package/esm/components/NotMatchButton/NotMatchButton.d.ts +1 -0
  56. package/esm/components/Popper/styles.d.ts +1 -1
  57. package/esm/components/ProfileBand/styles.d.ts +1 -1
  58. package/esm/components/ProfileCard/styles.d.ts +1 -1
  59. package/esm/components/ProfileMatchCard/styles.d.ts +1 -1
  60. package/esm/components/ProfileMatchCard/styles.js +2 -1
  61. package/esm/components/VerticalHeadingsTable/VerticalHeadingsTable.d.ts +5 -1
  62. package/esm/components/VerticalHeadingsTable/VerticalHeadingsTable.js +5 -3
  63. package/esm/components/attributes/editMode/ComplexAttribute/styles.d.ts +1 -1
  64. package/esm/components/attributes/editMode/MoreAttributesButton/styles.d.ts +1 -1
  65. package/esm/components/attributes/editMode/SimpleAttributeEditor/styles.d.ts +1 -1
  66. package/esm/components/crosswalks/CrosswalkAttributes/styles.d.ts +1 -1
  67. package/esm/components/editors/CustomDateRangeEditor/styles.d.ts +1 -1
  68. package/esm/components/editors/DateEditor/styles.d.ts +1 -1
  69. package/esm/components/editors/DateRangeEditor/styles.d.ts +1 -1
  70. package/esm/components/editors/TimestampEditor/styles.d.ts +1 -1
  71. package/esm/components/workflow/cards/GenericWorkflowTaskCard/styles.d.ts +1 -1
  72. package/esm/components/workflow/components/AddWorkflowDialog/styles.d.ts +1 -1
  73. package/esm/components/workflow/components/DueDateField/styles.d.ts +1 -1
  74. package/esm/components/workflow/components/LineDecorator/styles.d.ts +1 -1
  75. package/esm/contexts/SandboxAPIContext/index.d.ts +6 -0
  76. package/esm/contexts/SandboxAPIContext/index.js +6 -0
  77. package/esm/contexts/index.d.ts +1 -0
  78. package/esm/contexts/index.js +1 -0
  79. package/esm/hooks/index.d.ts +3 -0
  80. package/esm/hooks/index.js +2 -0
  81. package/esm/hooks/useAPI/API.d.ts +2 -0
  82. package/esm/hooks/useAPI/API.js +197 -0
  83. package/esm/hooks/useAPI/helpers.d.ts +1 -0
  84. package/esm/hooks/useAPI/helpers.js +8 -0
  85. package/esm/hooks/useAPI/index.d.ts +5 -0
  86. package/esm/hooks/useAPI/index.js +4 -0
  87. package/esm/hooks/useAPI/types.d.ts +90 -0
  88. package/esm/hooks/useAPI/types.js +39 -0
  89. package/esm/hooks/useAPI/useAPI.d.ts +13 -0
  90. package/esm/hooks/useAPI/useAPI.js +169 -0
  91. package/esm/hooks/useCustomScripts.d.ts +9 -0
  92. package/esm/hooks/useCustomScripts.js +189 -0
  93. package/package.json +3 -3
@@ -0,0 +1,169 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useContext, useEffect, useState } from 'react';
13
+ import { useDispatch, useSelector } from 'react-redux';
14
+ import mdmModule, { ui } from '@reltio/mdm-module';
15
+ import { initializeWebWorker } from '@reltio/mdm-sdk';
16
+ import { useWorkflowCheckPermission } from '../../components/workflow';
17
+ import { SandboxAPIContext } from '../../contexts';
18
+ import { processRequest } from './API';
19
+ import { getWorkerURL } from './helpers';
20
+ import { CustomAction } from './types';
21
+ export var useAPI = function (config) {
22
+ var _a = config.action, files = _a.files, permissions = _a.permissions;
23
+ var _b = useState(), html = _b[0], setHtml = _b[1];
24
+ var _c = useState([]), listenersToReset = _c[0], setListenersToReset = _c[1];
25
+ var _d = useState(true), visible = _d[0], setVisible = _d[1];
26
+ var _e = useState(null), tooltip = _e[0], setTooltip = _e[1];
27
+ var _f = useState(null), customStyles = _f[0], setCustomStyles = _f[1];
28
+ var _g = useState(''), message = _g[0], setMessage = _g[1];
29
+ var dispatch = useDispatch();
30
+ var metadata = useSelector(mdmModule.selectors.getMetadata) || {};
31
+ var entity = useSelector(mdmModule.selectors.getEntity) || {};
32
+ var uiPath = useSelector(mdmModule.selectors.getUIPath);
33
+ var tenant = useSelector(mdmModule.selectors.getTenant);
34
+ var workerUrl = getWorkerURL(uiPath, tenant);
35
+ var apiPath = useSelector(mdmModule.selectors.getApiPath);
36
+ var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
37
+ var user = useSelector(mdmModule.selectors.getUser);
38
+ var entityUri = useSelector(mdmModule.selectors.getEntityUri);
39
+ var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
40
+ var qxApi = useContext(SandboxAPIContext);
41
+ var workflowCheckPermission = useWorkflowCheckPermission();
42
+ var _h = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _h.type, search = _h.data;
43
+ var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
44
+ var process = function (task, worker, innerText) {
45
+ if (task) {
46
+ var handlersToReset_1 = [];
47
+ var processInnerHtml_1 = function (parent) {
48
+ var uiActions = parent.getAttribute('ui-actions');
49
+ var uiTooltip = parent.getAttribute('ui-tooltip');
50
+ var id = parent.getAttribute('id') || parent.getAttribute('name');
51
+ if (uiActions) {
52
+ uiActions.split(',').forEach(function (uiAction) {
53
+ var handler = function () {
54
+ var data = {
55
+ action: 'event',
56
+ type: 'uiAction',
57
+ data: {
58
+ type: uiAction,
59
+ id: id
60
+ }
61
+ };
62
+ worker.postMessage(data);
63
+ };
64
+ parent.addEventListener(uiAction, handler);
65
+ handlersToReset_1.push(function () {
66
+ parent.removeEventListener(uiAction, handler);
67
+ });
68
+ });
69
+ parent.removeAttribute('ui-actions');
70
+ }
71
+ if (uiTooltip) {
72
+ setTooltip(uiTooltip);
73
+ }
74
+ parent.childNodes.forEach(function (child) {
75
+ if (child.nodeType === 1) {
76
+ //Node.ELEMENT_NODE
77
+ processInnerHtml_1(child);
78
+ }
79
+ });
80
+ };
81
+ var resetHtml = function (html) {
82
+ var docBlock = document.createElement('div');
83
+ docBlock.innerHTML = html || innerText;
84
+ processInnerHtml_1(docBlock);
85
+ setListenersToReset(handlersToReset_1);
86
+ setHtml(docBlock);
87
+ };
88
+ if (task.action === CustomAction.SET_HTML && innerText !== task.params.html) {
89
+ resetHtml(task.params.html);
90
+ }
91
+ switch (task.action) {
92
+ case CustomAction.LOG: {
93
+ console.log(task.params); //eslint-disable-line no-console
94
+ break;
95
+ }
96
+ case CustomAction.SET_VISIBILITY: {
97
+ if (task.params === 'visible') {
98
+ setVisible(true);
99
+ resetHtml();
100
+ }
101
+ else {
102
+ setVisible(false);
103
+ }
104
+ break;
105
+ }
106
+ case CustomAction.SET_TOOLTIP: {
107
+ setTooltip(task.params);
108
+ resetHtml();
109
+ break;
110
+ }
111
+ case CustomAction.SET_HEIGHT: {
112
+ setCustomStyles(function (prev) { return (__assign(__assign({}, (prev || {})), { height: task.params })); });
113
+ break;
114
+ }
115
+ case CustomAction.SET_WIDTH: {
116
+ setCustomStyles(function (prev) { return (__assign(__assign({}, (prev || {})), { width: task.params })); });
117
+ break;
118
+ }
119
+ case CustomAction.SET_ENABLED: {
120
+ setCustomStyles(function (prev) {
121
+ var newStyles = __assign({}, (prev || {}));
122
+ if (!task.params) {
123
+ newStyles['pointer-events'] = 'none';
124
+ }
125
+ else {
126
+ delete newStyles['pointer-events'];
127
+ }
128
+ return newStyles;
129
+ });
130
+ break;
131
+ }
132
+ case CustomAction.MESSAGE: {
133
+ setMessage(task.params);
134
+ break;
135
+ }
136
+ case CustomAction.REQUEST: {
137
+ processRequest(__assign({ name: task.params.name, paramObject: task, permissions: permissions,
138
+ worker: worker,
139
+ metadata: metadata, config: config, user: user,
140
+ apiPath: apiPath,
141
+ tenant: tenant,
142
+ workflowPath: workflowPath,
143
+ entity: entity,
144
+ entityUri: entityUri,
145
+ environment: environment, query: typeSearch === 'search' ? search === null || search === void 0 ? void 0 : search.query : null, openSearch: openSearch,
146
+ workflowCheckPermission: workflowCheckPermission }, qxApi));
147
+ break;
148
+ }
149
+ }
150
+ }
151
+ };
152
+ useEffect(function () {
153
+ var worker = initializeWebWorker(workerUrl, files, process);
154
+ return function () {
155
+ worker.terminate();
156
+ };
157
+ }, []);
158
+ useEffect(function () { return function () {
159
+ listenersToReset.forEach(function (listener) { return listener(); });
160
+ }; }, [listenersToReset]);
161
+ return {
162
+ html: html,
163
+ visible: visible,
164
+ tooltip: tooltip,
165
+ customStyles: customStyles,
166
+ message: message,
167
+ onClosePopup: function () { return setMessage(''); }
168
+ };
169
+ };
@@ -0,0 +1,9 @@
1
+ import { createRequestProvider, CustomScript } from '@reltio/mdm-sdk';
2
+ declare type InterceptHandlers = {
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 {};
@@ -0,0 +1,189 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useContext, useEffect, useRef } from 'react';
13
+ import { useDispatch, useSelector } from 'react-redux';
14
+ import mdmModule, { ui } from '@reltio/mdm-module';
15
+ import { initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
16
+ import nanoid from 'nanoid';
17
+ import { find, map, pick, pipe, prop, omit } from 'ramda';
18
+ import { useWorkflowCheckPermission } from '../components/workflow';
19
+ import { SandboxAPIContext } from '../contexts';
20
+ import { CustomAction, getWorkerURL, processRequest } from './useAPI';
21
+ var isURLtoProcess = function (processApi, url) {
22
+ return (processApi || []).some(function (request) {
23
+ var regExp = new RegExp("^" + request + "$");
24
+ return request.replace(/\/*$/, '') === url || (request && regExp.test(url));
25
+ });
26
+ };
27
+ export var useCustomScripts = function (config, _a) {
28
+ var addInternalRequestInterceptor = _a.addInternalRequestInterceptor, addInternalResponseInterceptor = _a.addInternalResponseInterceptor, removeInternalRequestInterceptor = _a.removeInternalRequestInterceptor, removeInternalResponseInterceptor = _a.removeInternalResponseInterceptor;
29
+ var customScripts = config.map(function (customScript) { return (__assign(__assign({}, customScript), { actionId: nanoid() })); });
30
+ var dispatch = useDispatch();
31
+ var metadata = useSelector(mdmModule.selectors.getMetadata) || {};
32
+ var entity = useSelector(mdmModule.selectors.getEntity) || {};
33
+ var uiPath = useSelector(mdmModule.selectors.getUIPath);
34
+ var reltioPath = useSelector(mdmModule.selectors.getReltioPath);
35
+ var tenant = useSelector(mdmModule.selectors.getTenant);
36
+ var workerUrl = getWorkerURL(uiPath, tenant);
37
+ var apiPath = useSelector(mdmModule.selectors.getApiPath);
38
+ var workflowPath = useSelector(mdmModule.selectors.getWorkflowPath);
39
+ var user = useSelector(mdmModule.selectors.getUser);
40
+ var entityUri = useSelector(mdmModule.selectors.getEntityUri);
41
+ var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
42
+ var qxApi = useContext(SandboxAPIContext);
43
+ var workflowCheckPermission = useWorkflowCheckPermission();
44
+ var _b = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _b.type, search = _b.data;
45
+ var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
46
+ var requestListeners = useRef({});
47
+ var responseListeners = useRef({});
48
+ var workers = useRef({});
49
+ var process = function (task, worker) {
50
+ var _a, _b;
51
+ if (task) {
52
+ switch (task.action) {
53
+ case CustomAction.REQUEST: {
54
+ if (((_b = (_a = task.params) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.origin) !== 'ui') {
55
+ processRequest(__assign({ name: task.params.name, paramObject: task, permissions: customScripts[0].permissions, worker: worker,
56
+ metadata: metadata, config: { action: customScripts[0] }, user: user,
57
+ apiPath: apiPath,
58
+ tenant: tenant,
59
+ workflowPath: workflowPath,
60
+ entity: entity,
61
+ entityUri: entityUri,
62
+ environment: environment, query: typeSearch === 'search' ? search === null || search === void 0 ? void 0 : search.query : null, openSearch: openSearch,
63
+ workflowCheckPermission: workflowCheckPermission }, qxApi));
64
+ }
65
+ else {
66
+ var _c = task.params, headers = _c.headers, id = _c.id, fakeURL = _c.url, method = _c.method, data = _c.data;
67
+ var url = fakeURL.replace(reltioPath, apiPath);
68
+ if (requestListeners.current[headers.requestId]) {
69
+ requestListeners.current[headers.requestId].next(url, __assign(__assign({}, data), { id: id,
70
+ task: task,
71
+ headers: headers,
72
+ method: method }));
73
+ requestListeners.current = omit([headers.requestId], requestListeners.current);
74
+ }
75
+ }
76
+ break;
77
+ }
78
+ case CustomAction.RETURN_PROCESSED_API_RESPONSE:
79
+ case CustomAction.RETURN_PROCESSED_API_REQUEST: {
80
+ var _d = task.params, id = _d.id, data = _d.data;
81
+ if (responseListeners.current[id]) {
82
+ responseListeners.current[id].next(data);
83
+ responseListeners.current = omit([id], responseListeners.current);
84
+ }
85
+ break;
86
+ }
87
+ }
88
+ }
89
+ };
90
+ useEffect(function () {
91
+ workers.current = customScripts.reduce(function (acc, customScript) {
92
+ var _a;
93
+ acc = __assign(__assign({}, acc), (_a = {}, _a[customScript.actionId] = initializeWebWorker(workerUrl, customScript.files, process), _a));
94
+ return acc;
95
+ }, workers.current);
96
+ return function () {
97
+ Object.keys(workers.current).forEach(function (actionId) {
98
+ workers.current[actionId].terminate();
99
+ });
100
+ };
101
+ }, [config]);
102
+ var customScriptRequestInterceptor = function (_a) {
103
+ var _b;
104
+ var _c = _a.options, options = _c === void 0 ? {} : _c, url = _a.url, next = _a.next;
105
+ var fakeURL = url.startsWith('/') && !url.startsWith(apiPath)
106
+ ? reltioPath + "/api/" + tenant + url
107
+ : "" + reltioPath + url.replace(apiPath, '');
108
+ var actionId = pipe(map(pick(['actionId', 'processApiRequest'])), find(function (_a) {
109
+ var processApiRequest = _a.processApiRequest;
110
+ return isURLtoProcess(processApiRequest, fakeURL);
111
+ }), prop('actionId'))(customScripts);
112
+ if (actionId) {
113
+ var requestId = nanoid();
114
+ requestListeners.current = __assign(__assign({}, requestListeners.current), (_b = {}, _b[requestId] = { options: options, next: next, id: requestId }, _b));
115
+ workers.current[actionId].postMessage({
116
+ action: 'apiRequest',
117
+ id: requestId,
118
+ url: fakeURL,
119
+ method: options.method,
120
+ headers: __assign(__assign({}, options.headers), { origin: 'ui', requestId: requestId, actionId: actionId }),
121
+ data: options
122
+ });
123
+ }
124
+ else {
125
+ next(url, options);
126
+ }
127
+ };
128
+ var customScriptResponseInterceptor = function (_a) {
129
+ var _b;
130
+ var url = _a.url, response = _a.response, next = _a.next, options = _a.options, abort = _a.abort;
131
+ if (((_b = options === null || options === void 0 ? void 0 : options.headers) === null || _b === void 0 ? void 0 : _b.origin) === 'ui') {
132
+ response
133
+ .json()
134
+ .then(function (data) {
135
+ var _a;
136
+ var _b, _c, _d;
137
+ responseListeners.current = __assign(__assign({}, responseListeners.current), (_a = {}, _a[options.headers.requestId] = { next: next }, _a));
138
+ workers.current[(_b = options.headers) === null || _b === void 0 ? void 0 : _b.actionId].postMessage({
139
+ action: 'response',
140
+ result: { data: data },
141
+ id: options === null || options === void 0 ? void 0 : options.id,
142
+ name: (_d = (_c = options === null || options === void 0 ? void 0 : options.task) === null || _c === void 0 ? void 0 : _c.params) === null || _d === void 0 ? void 0 : _d.name
143
+ });
144
+ })
145
+ .catch(function (error) {
146
+ abort(error);
147
+ });
148
+ }
149
+ else {
150
+ var fakeURL_1 = "" + reltioPath + url.replace(apiPath, '');
151
+ var actionId_1 = pipe(map(pick(['actionId', 'processApiResponse'])), find(function (_a) {
152
+ var processApiResponse = _a.processApiResponse;
153
+ return isURLtoProcess(processApiResponse, fakeURL_1);
154
+ }), prop('actionId'))(customScripts);
155
+ if (actionId_1) {
156
+ var responseId_1 = nanoid();
157
+ response
158
+ .json()
159
+ .then(function (data) {
160
+ var _a;
161
+ responseListeners.current = __assign(__assign({}, responseListeners.current), (_a = {}, _a[responseId_1] = { next: next }, _a));
162
+ workers.current[actionId_1].postMessage({
163
+ action: 'apiResponse',
164
+ id: responseId_1,
165
+ url: fakeURL_1,
166
+ method: options.method,
167
+ data: data
168
+ });
169
+ })
170
+ .catch(function (error) {
171
+ abort(error);
172
+ });
173
+ }
174
+ else {
175
+ next(response);
176
+ }
177
+ }
178
+ };
179
+ useEffect(function () {
180
+ if (!isEmptyValue(config)) {
181
+ addInternalRequestInterceptor(customScriptRequestInterceptor);
182
+ addInternalResponseInterceptor(customScriptResponseInterceptor);
183
+ return function () {
184
+ removeInternalRequestInterceptor(customScriptRequestInterceptor);
185
+ removeInternalResponseInterceptor(customScriptResponseInterceptor);
186
+ };
187
+ }
188
+ }, [config]);
189
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1102",
3
+ "version": "1.4.1105",
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.1102",
11
- "@reltio/mdm-sdk": "^1.4.1102",
10
+ "@reltio/mdm-module": "^1.4.1105",
11
+ "@reltio/mdm-sdk": "^1.4.1105",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",