@reltio/components 1.4.890 → 1.4.894

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 (57) hide show
  1. package/cjs/components/ErrorPopup/ErrorPopup.d.ts +4 -0
  2. package/cjs/components/ErrorPopup/ErrorPopup.js +37 -2
  3. package/cjs/components/MatchRulesBlock/MatchRulesBlock.d.ts +5 -2
  4. package/cjs/components/MatchRulesBlock/MatchRulesBlock.js +2 -11
  5. package/cjs/components/ProfileCard/ProfileCard.d.ts +11 -19
  6. package/cjs/components/ProfileCard/ProfileCard.js +3 -12
  7. package/cjs/components/ProfileCard/styles.d.ts +1 -1
  8. package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +13 -0
  9. package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +21 -0
  10. package/cjs/components/ProfileMatchCard/styles.d.ts +1 -0
  11. package/cjs/components/ProfileMatchCard/styles.js +28 -0
  12. package/cjs/components/editors/TimestampEditor/TimestampEditor.js +5 -1
  13. package/cjs/components/index.d.ts +1 -0
  14. package/cjs/components/index.js +3 -1
  15. package/cjs/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.d.ts +7 -0
  16. package/cjs/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.js +41 -0
  17. package/cjs/components/workflow/cards/PotentialMatchTaskCard/styles.d.ts +1 -0
  18. package/cjs/components/workflow/cards/PotentialMatchTaskCard/styles.js +9 -0
  19. package/cjs/components/workflow/cards/WorkflowTaskCardsFactory.js +2 -2
  20. package/cjs/components/workflow/components/LineDecorator/styles.js +1 -1
  21. package/cjs/hooks/helpers/pagingSimulator.d.ts +12 -0
  22. package/cjs/hooks/helpers/pagingSimulator.js +86 -0
  23. package/cjs/hooks/index.d.ts +2 -0
  24. package/cjs/hooks/index.js +5 -1
  25. package/cjs/hooks/useMatchesLoader.d.ts +27 -0
  26. package/cjs/hooks/useMatchesLoader.js +106 -0
  27. package/cjs/hooks/usePagingSimulator.d.ts +10 -0
  28. package/cjs/hooks/usePagingSimulator.js +10 -0
  29. package/esm/components/ErrorPopup/ErrorPopup.d.ts +4 -0
  30. package/esm/components/ErrorPopup/ErrorPopup.js +19 -3
  31. package/esm/components/MatchRulesBlock/MatchRulesBlock.d.ts +5 -2
  32. package/esm/components/MatchRulesBlock/MatchRulesBlock.js +3 -12
  33. package/esm/components/ProfileCard/ProfileCard.d.ts +11 -19
  34. package/esm/components/ProfileCard/ProfileCard.js +4 -13
  35. package/esm/components/ProfileCard/styles.d.ts +1 -1
  36. package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +13 -0
  37. package/esm/components/ProfileMatchCard/ProfileMatchCard.js +14 -0
  38. package/esm/components/ProfileMatchCard/styles.d.ts +1 -0
  39. package/esm/components/ProfileMatchCard/styles.js +25 -0
  40. package/esm/components/editors/TimestampEditor/TimestampEditor.js +5 -1
  41. package/esm/components/index.d.ts +1 -0
  42. package/esm/components/index.js +1 -0
  43. package/esm/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.d.ts +7 -0
  44. package/esm/components/workflow/cards/PotentialMatchTaskCard/PotentialMatchTaskCard.js +36 -0
  45. package/esm/components/workflow/cards/PotentialMatchTaskCard/styles.d.ts +1 -0
  46. package/esm/components/workflow/cards/PotentialMatchTaskCard/styles.js +6 -0
  47. package/esm/components/workflow/cards/WorkflowTaskCardsFactory.js +2 -2
  48. package/esm/components/workflow/components/LineDecorator/styles.js +1 -1
  49. package/esm/hooks/helpers/pagingSimulator.d.ts +12 -0
  50. package/esm/hooks/helpers/pagingSimulator.js +82 -0
  51. package/esm/hooks/index.d.ts +2 -0
  52. package/esm/hooks/index.js +2 -0
  53. package/esm/hooks/useMatchesLoader.d.ts +27 -0
  54. package/esm/hooks/useMatchesLoader.js +99 -0
  55. package/esm/hooks/usePagingSimulator.d.ts +10 -0
  56. package/esm/hooks/usePagingSimulator.js +6 -0
  57. package/package.json +3 -3
@@ -0,0 +1,99 @@
1
+ import { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import { useSelector } from 'react-redux';
3
+ import mdmModule from '@reltio/mdm-module';
4
+ import { ActivityFilters, collectAllTransitiveEntitiesUris, getEntitiesMap, getMatchesForDataTenantEntity, getMatchesFromDataTenants, getTransitiveMatches, isDataTenantEntity, withDtssPotentialItems } from '@reltio/mdm-sdk';
5
+ import { usePagingSimulator } from './usePagingSimulator';
6
+ import { useSafePromise } from './useSafePromise';
7
+ import { prop } from 'ramda';
8
+ export var useMatchesLoader = function (_a) {
9
+ var enabled = _a.enabled, entity = _a.entity, filter = _a.filter, onFinishLoading = _a.onFinishLoading, onStartLoading = _a.onStartLoading, options = _a.options, page = _a.page, rowsPerPage = _a.rowsPerPage, sorting = _a.sorting;
10
+ var _b = sorting || {}, order = _b.order, field = _b.field;
11
+ var _c = useState(0), total = _c[0], setTotal = _c[1];
12
+ var _d = useState([]), matches = _d[0], setMatches = _d[1];
13
+ var _e = useState({}), entitiesMap = _e[0], setEntitiesMap = _e[1];
14
+ var tenant = useSelector(mdmModule.selectors.getTenant);
15
+ var dtssPath = useSelector(mdmModule.selectors.getDtssPath);
16
+ var dataTenants = useSelector(mdmModule.selectors.getDataTenants);
17
+ var dtssParams = useMemo(function () { return ({
18
+ dtssPath: dtssPath,
19
+ dataTenants: dataTenants,
20
+ entity: entity,
21
+ customerTenant: tenant,
22
+ dtssRequest: getMatchesFromDataTenants
23
+ }); }, [dtssPath, dataTenants, entity, tenant]);
24
+ //eslint-disable-next-line react-hooks/exhaustive-deps
25
+ var getTransitiveMatchesWithDtss = useCallback(withDtssPotentialItems(dtssParams, getTransitiveMatches), [
26
+ dtssParams
27
+ ]);
28
+ var getTransitiveMatchesWithPaging = usePagingSimulator(getTransitiveMatchesWithDtss);
29
+ var getPagedMatchesForDataTenantEntity = usePagingSimulator(getMatchesForDataTenantEntity);
30
+ var entityUri = prop('uri', entity);
31
+ var safePromise = useSafePromise();
32
+ var getMatches = useCallback(function (force) {
33
+ if (force === void 0) { force = false; }
34
+ if (!enabled) {
35
+ return;
36
+ }
37
+ onStartLoading === null || onStartLoading === void 0 ? void 0 : onStartLoading();
38
+ safePromise(isDataTenantEntity(entity)
39
+ ? getPagedMatchesForDataTenantEntity({
40
+ dtssPath: dtssPath,
41
+ entity: entity,
42
+ customerTenant: tenant,
43
+ offset: page * rowsPerPage,
44
+ max: rowsPerPage,
45
+ force: force
46
+ })
47
+ : getTransitiveMatchesWithPaging({
48
+ entityUri: entityUri,
49
+ offset: page * rowsPerPage,
50
+ max: rowsPerPage,
51
+ filter: filter,
52
+ sort: field,
53
+ order: order,
54
+ force: force,
55
+ deep: options.showTransitiveMatches ? undefined : 1,
56
+ activeness: options.showInactiveEntities ? ActivityFilters.ALL : ActivityFilters.ACTIVE_ONLY
57
+ }))
58
+ .then(function (result) {
59
+ var response = result.response, total = result.total, originalResponse = result.originalResponse;
60
+ setTotal(total);
61
+ setMatches(response);
62
+ var matchUris = collectAllTransitiveEntitiesUris(originalResponse);
63
+ if (matchUris.length > 0) {
64
+ setEntitiesMap(getEntitiesMap(originalResponse));
65
+ }
66
+ })
67
+ .finally(function () {
68
+ onFinishLoading === null || onFinishLoading === void 0 ? void 0 : onFinishLoading();
69
+ });
70
+ }, [
71
+ dtssPath,
72
+ enabled,
73
+ entityUri,
74
+ field,
75
+ filter,
76
+ getPagedMatchesForDataTenantEntity,
77
+ getTransitiveMatchesWithPaging,
78
+ onFinishLoading,
79
+ onStartLoading,
80
+ options,
81
+ order,
82
+ page,
83
+ rowsPerPage,
84
+ safePromise,
85
+ tenant
86
+ ]); // eslint-disable-line
87
+ useEffect(function () {
88
+ getMatches();
89
+ }, [getMatches]);
90
+ var loadMatches = useCallback(function () {
91
+ getMatches(true);
92
+ }, [getMatches]);
93
+ return {
94
+ total: total,
95
+ matches: matches,
96
+ entitiesMap: entitiesMap,
97
+ loadMatches: loadMatches
98
+ };
99
+ };
@@ -0,0 +1,10 @@
1
+ export declare const usePagingSimulator: (request: any) => ({ max, offset, force, ...requestParams }: {
2
+ [key: string]: unknown;
3
+ max: number;
4
+ offset: number;
5
+ force?: boolean;
6
+ }) => Promise<{
7
+ response: any[];
8
+ total: number;
9
+ originalResponse: any[];
10
+ }>;
@@ -0,0 +1,6 @@
1
+ import { useCallback } from 'react';
2
+ import { createPagingSimulator } from './helpers/pagingSimulator';
3
+ export var usePagingSimulator = function (request) {
4
+ // eslint-disable-next-line react-hooks/exhaustive-deps
5
+ return useCallback(createPagingSimulator(request), [request]);
6
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.890",
3
+ "version": "1.4.894",
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.890",
11
- "@reltio/mdm-sdk": "^1.4.890",
10
+ "@reltio/mdm-module": "^1.4.894",
11
+ "@reltio/mdm-sdk": "^1.4.894",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",