datastake-daf 0.6.723 → 0.6.725
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +4 -3
- package/dist/hooks/index.js +4658 -19
- package/dist/pages/index.js +160 -23
- package/dist/style/datastake/datastake.css +11 -1
- package/package.json +1 -1
- package/src/@daf/core/components/EditForm/form.jsx +7 -3
- package/src/@daf/pages/dashboards/SupplyChain/components/TradeRelationships/index.js +3 -2
- package/src/@daf/pages/dashboards/SupplyChain/index.jsx +1 -2
- package/src/@daf/pages/dashboards/UserDashboard/components/DataChainOfCustody/index.jsx +29 -5
- package/src/@daf/pages/dashboards/UserDashboard/index.jsx +15 -2
- package/src/@daf/pages/dashboards/helper.js +79 -0
- package/src/styles/datastake/datastake.css +11 -1
package/dist/pages/index.js
CHANGED
|
@@ -7361,7 +7361,7 @@ function Label({
|
|
|
7361
7361
|
}
|
|
7362
7362
|
KeyIndicatorsWidget.displayName = 'KeyIndicatorsWidget';
|
|
7363
7363
|
|
|
7364
|
-
const defaultFetchConfig$
|
|
7364
|
+
const defaultFetchConfig$7 = {
|
|
7365
7365
|
basepath: "analytics",
|
|
7366
7366
|
url: '/widgets/key-informations',
|
|
7367
7367
|
filters: {
|
|
@@ -7377,9 +7377,9 @@ function KeyIndicators$1({
|
|
|
7377
7377
|
goTo = () => {}
|
|
7378
7378
|
}) {
|
|
7379
7379
|
const fetchConfig = o.useMemo(() => ({
|
|
7380
|
-
...defaultFetchConfig$
|
|
7380
|
+
...defaultFetchConfig$7,
|
|
7381
7381
|
filters: {
|
|
7382
|
-
...defaultFetchConfig$
|
|
7382
|
+
...defaultFetchConfig$7.filters,
|
|
7383
7383
|
sources: selectedSources?.partners || []
|
|
7384
7384
|
},
|
|
7385
7385
|
stop: selectedSources?.loading
|
|
@@ -11451,7 +11451,7 @@ function withProvider(Component) {
|
|
|
11451
11451
|
return wrapper;
|
|
11452
11452
|
}
|
|
11453
11453
|
|
|
11454
|
-
const DataChainOfCustody = ({
|
|
11454
|
+
const DataChainOfCustody$1 = ({
|
|
11455
11455
|
data,
|
|
11456
11456
|
filtersConfig,
|
|
11457
11457
|
t = s => s,
|
|
@@ -11575,9 +11575,100 @@ const DataChainOfCustody = ({
|
|
|
11575
11575
|
onFilterChange: onFilterChange
|
|
11576
11576
|
});
|
|
11577
11577
|
};
|
|
11578
|
-
var
|
|
11578
|
+
var DataChainOfCustodyDaf = withProvider(DataChainOfCustody$1);
|
|
11579
11579
|
|
|
11580
|
-
const
|
|
11580
|
+
const theme = window.theme || {};
|
|
11581
|
+
const kycIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11582
|
+
name: "KYC",
|
|
11583
|
+
color: "#6C737F",
|
|
11584
|
+
width: 18,
|
|
11585
|
+
height: 18
|
|
11586
|
+
});
|
|
11587
|
+
const buildingIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11588
|
+
name: "Building",
|
|
11589
|
+
color: "#6C737F",
|
|
11590
|
+
width: 18,
|
|
11591
|
+
height: 18
|
|
11592
|
+
});
|
|
11593
|
+
const individualIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11594
|
+
name: "UserCircle",
|
|
11595
|
+
color: "#6C737F",
|
|
11596
|
+
width: 18,
|
|
11597
|
+
height: 18
|
|
11598
|
+
});
|
|
11599
|
+
const csIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11600
|
+
name: "CivilSociety",
|
|
11601
|
+
color: "#6C737F",
|
|
11602
|
+
width: 18,
|
|
11603
|
+
height: 18
|
|
11604
|
+
});
|
|
11605
|
+
const leftIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11606
|
+
name: "NashirikiSmallLogo",
|
|
11607
|
+
color: theme.colorPrimary8,
|
|
11608
|
+
width: 16,
|
|
11609
|
+
height: 16
|
|
11610
|
+
});
|
|
11611
|
+
const middleIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11612
|
+
name: "NashirikiSmallLogo",
|
|
11613
|
+
color: theme.colorPrimary2,
|
|
11614
|
+
width: 16,
|
|
11615
|
+
height: 16
|
|
11616
|
+
});
|
|
11617
|
+
const rightIcon = /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
11618
|
+
name: "NashirikiSmallLogo",
|
|
11619
|
+
color: "white",
|
|
11620
|
+
width: 16,
|
|
11621
|
+
height: 16
|
|
11622
|
+
});
|
|
11623
|
+
const mapIcon = category => {
|
|
11624
|
+
switch (category) {
|
|
11625
|
+
case "businessEntity":
|
|
11626
|
+
return buildingIcon;
|
|
11627
|
+
case "civilSociety":
|
|
11628
|
+
return csIcon;
|
|
11629
|
+
case "government":
|
|
11630
|
+
return kycIcon;
|
|
11631
|
+
case "individual":
|
|
11632
|
+
return individualIcon;
|
|
11633
|
+
default:
|
|
11634
|
+
return;
|
|
11635
|
+
}
|
|
11636
|
+
};
|
|
11637
|
+
const leftBackground = theme.colorPrimary3;
|
|
11638
|
+
const rightBackground = theme.colorPrimary6;
|
|
11639
|
+
const mapDataForChainOfCustody = (data = {}, options = [], goTo = () => {}) => {
|
|
11640
|
+
const mapChildren = (items, type, parentId, isDirect = true) => {
|
|
11641
|
+
return (items ?? []).map(item => ({
|
|
11642
|
+
id: item.id,
|
|
11643
|
+
number: 0,
|
|
11644
|
+
name: item.name,
|
|
11645
|
+
sources: parentId ? [parentId] : [],
|
|
11646
|
+
subTitle: findOptions(item.category, options),
|
|
11647
|
+
leftIcon: type === "client" ? rightIcon : leftIcon,
|
|
11648
|
+
leftBackground: type === "client" ? rightBackground : leftBackground,
|
|
11649
|
+
topIcon: mapIcon(item.category),
|
|
11650
|
+
children: mapChildren(item.sources ?? item.clients ?? [], type, item.id, false),
|
|
11651
|
+
onClick: () => {
|
|
11652
|
+
if (isDirect && parentId === data.id) {
|
|
11653
|
+
goTo(`/app/partners?datastakeId=${item.id}`);
|
|
11654
|
+
}
|
|
11655
|
+
}
|
|
11656
|
+
}));
|
|
11657
|
+
};
|
|
11658
|
+
return {
|
|
11659
|
+
id: data.id,
|
|
11660
|
+
number: 0,
|
|
11661
|
+
name: data.name,
|
|
11662
|
+
subTitle: findOptions(data.category, options),
|
|
11663
|
+
leftIcon: middleIcon,
|
|
11664
|
+
leftBackground: theme.colorPrimary10,
|
|
11665
|
+
topIcon: mapIcon(data.category),
|
|
11666
|
+
left: mapChildren(data.sources, "source", data.id),
|
|
11667
|
+
right: mapChildren(data.clients, "client", data.id)
|
|
11668
|
+
};
|
|
11669
|
+
};
|
|
11670
|
+
|
|
11671
|
+
const defaultFetchConfig$6 = {
|
|
11581
11672
|
basepath: "analytics",
|
|
11582
11673
|
url: "/widgets/datachain-of-custody",
|
|
11583
11674
|
filters: {},
|
|
@@ -11587,11 +11678,10 @@ function TradeRelationships({
|
|
|
11587
11678
|
goTo,
|
|
11588
11679
|
t = () => {},
|
|
11589
11680
|
options = {},
|
|
11590
|
-
mapDataFunction = () => {},
|
|
11591
11681
|
hardcodedData = []
|
|
11592
11682
|
}) {
|
|
11593
11683
|
const fetchConfig = o.useMemo(() => ({
|
|
11594
|
-
...defaultFetchConfig$
|
|
11684
|
+
...defaultFetchConfig$6,
|
|
11595
11685
|
filters: {}
|
|
11596
11686
|
}), []);
|
|
11597
11687
|
const {
|
|
@@ -11600,7 +11690,7 @@ function TradeRelationships({
|
|
|
11600
11690
|
} = useWidgetFetch({
|
|
11601
11691
|
config: fetchConfig
|
|
11602
11692
|
});
|
|
11603
|
-
const mappedData =
|
|
11693
|
+
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options?.category ?? [], goTo);
|
|
11604
11694
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
11605
11695
|
loading: loading,
|
|
11606
11696
|
title: t("Trade Relationships"),
|
|
@@ -11609,7 +11699,7 @@ function TradeRelationships({
|
|
|
11609
11699
|
style: {
|
|
11610
11700
|
height: 600
|
|
11611
11701
|
},
|
|
11612
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
11702
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DataChainOfCustodyDaf, {
|
|
11613
11703
|
data: mappedData,
|
|
11614
11704
|
maxZoom: 1
|
|
11615
11705
|
})
|
|
@@ -12751,7 +12841,6 @@ function SupplyChain({
|
|
|
12751
12841
|
selectedPartners,
|
|
12752
12842
|
setSelectedPartners,
|
|
12753
12843
|
informationSources,
|
|
12754
|
-
mapDataFunction,
|
|
12755
12844
|
hardcodedData,
|
|
12756
12845
|
breadCrumbs = []
|
|
12757
12846
|
}) {
|
|
@@ -12817,7 +12906,6 @@ function SupplyChain({
|
|
|
12817
12906
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
12818
12907
|
children: /*#__PURE__*/jsxRuntime.jsx(TradeRelationships, {
|
|
12819
12908
|
selectedSources: selectedPartners,
|
|
12820
|
-
mapDataFunction: mapDataFunction,
|
|
12821
12909
|
t: t,
|
|
12822
12910
|
options: options,
|
|
12823
12911
|
goTo: goTo,
|
|
@@ -13022,7 +13110,7 @@ const getRowConfig = ({
|
|
|
13022
13110
|
})
|
|
13023
13111
|
}];
|
|
13024
13112
|
|
|
13025
|
-
const defaultFetchConfig$
|
|
13113
|
+
const defaultFetchConfig$5 = {
|
|
13026
13114
|
basepath: "analytics",
|
|
13027
13115
|
url: "/widgets/key-informations",
|
|
13028
13116
|
filters: {
|
|
@@ -13037,7 +13125,7 @@ function KeyIndicators({
|
|
|
13037
13125
|
partners = []
|
|
13038
13126
|
}) {
|
|
13039
13127
|
const fetchConfig = o.useMemo(() => ({
|
|
13040
|
-
...defaultFetchConfig$
|
|
13128
|
+
...defaultFetchConfig$5
|
|
13041
13129
|
}), []);
|
|
13042
13130
|
const {
|
|
13043
13131
|
data,
|
|
@@ -13214,7 +13302,7 @@ const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
13214
13302
|
}
|
|
13215
13303
|
};
|
|
13216
13304
|
|
|
13217
|
-
const defaultFetchConfig$
|
|
13305
|
+
const defaultFetchConfig$4 = {
|
|
13218
13306
|
basepath: "forms",
|
|
13219
13307
|
url: "/location"
|
|
13220
13308
|
};
|
|
@@ -13238,7 +13326,7 @@ function MineSites({
|
|
|
13238
13326
|
const [filters, setFilters] = o.useState({});
|
|
13239
13327
|
const [activeTab, setActiveTab] = o.useState("location");
|
|
13240
13328
|
const _formFetchConfig = o.useMemo(() => ({
|
|
13241
|
-
...defaultFetchConfig$
|
|
13329
|
+
...defaultFetchConfig$4,
|
|
13242
13330
|
params: {
|
|
13243
13331
|
scope: "create",
|
|
13244
13332
|
language: user?.language || "en"
|
|
@@ -13623,7 +13711,7 @@ const useKnowledgeAccumulation = ({
|
|
|
13623
13711
|
return chartConfig;
|
|
13624
13712
|
};
|
|
13625
13713
|
|
|
13626
|
-
const defaultFetchConfig$
|
|
13714
|
+
const defaultFetchConfig$3 = {
|
|
13627
13715
|
basepath: "analytics",
|
|
13628
13716
|
url: "/widgets/knowledge-accumulation",
|
|
13629
13717
|
filters: {},
|
|
@@ -13638,7 +13726,7 @@ function AccumulationGraph({
|
|
|
13638
13726
|
}) {
|
|
13639
13727
|
const [timeFilter, setTimeFilter] = o.useState("monthly");
|
|
13640
13728
|
const fetchConfig = o.useMemo(() => ({
|
|
13641
|
-
...defaultFetchConfig$
|
|
13729
|
+
...defaultFetchConfig$3,
|
|
13642
13730
|
filters: {
|
|
13643
13731
|
section: section,
|
|
13644
13732
|
tabSelected: tabSelected
|
|
@@ -14012,7 +14100,7 @@ const useContributionsGraph = ({
|
|
|
14012
14100
|
return chartConfig;
|
|
14013
14101
|
};
|
|
14014
14102
|
|
|
14015
|
-
const defaultFetchConfig$
|
|
14103
|
+
const defaultFetchConfig$2 = {
|
|
14016
14104
|
basepath: "analytics",
|
|
14017
14105
|
url: "/widgets/contributions",
|
|
14018
14106
|
filters: {},
|
|
@@ -14026,7 +14114,7 @@ function ContributionsGraph({
|
|
|
14026
14114
|
theme = {}
|
|
14027
14115
|
}) {
|
|
14028
14116
|
const fetchConfig = o.useMemo(() => ({
|
|
14029
|
-
...defaultFetchConfig$
|
|
14117
|
+
...defaultFetchConfig$2,
|
|
14030
14118
|
filters: {
|
|
14031
14119
|
section: section,
|
|
14032
14120
|
tabSelected: tabSelected
|
|
@@ -14141,7 +14229,7 @@ const useTriangulation = ({
|
|
|
14141
14229
|
};
|
|
14142
14230
|
};
|
|
14143
14231
|
|
|
14144
|
-
const defaultFetchConfig = {
|
|
14232
|
+
const defaultFetchConfig$1 = {
|
|
14145
14233
|
basepath: "analytics",
|
|
14146
14234
|
url: "/widgets/triangulation",
|
|
14147
14235
|
defaultData: [],
|
|
@@ -14155,7 +14243,7 @@ function Triangulation({
|
|
|
14155
14243
|
theme = {}
|
|
14156
14244
|
}) {
|
|
14157
14245
|
const fetchConfig = o.useMemo(() => ({
|
|
14158
|
-
...defaultFetchConfig,
|
|
14246
|
+
...defaultFetchConfig$1,
|
|
14159
14247
|
filters: {
|
|
14160
14248
|
section: section,
|
|
14161
14249
|
tabSelected: tabSelected
|
|
@@ -14309,6 +14397,44 @@ function DataConsilidation({
|
|
|
14309
14397
|
});
|
|
14310
14398
|
}
|
|
14311
14399
|
|
|
14400
|
+
const defaultFetchConfig = {
|
|
14401
|
+
basepath: "analytics",
|
|
14402
|
+
url: "/widgets/datachain-of-custody",
|
|
14403
|
+
filters: {},
|
|
14404
|
+
defaultData: []
|
|
14405
|
+
};
|
|
14406
|
+
function DataChainOfCustody({
|
|
14407
|
+
t = () => {},
|
|
14408
|
+
goTo = () => {},
|
|
14409
|
+
options = {},
|
|
14410
|
+
hardcodedData = []
|
|
14411
|
+
}) {
|
|
14412
|
+
const fetchConfig = o.useMemo(() => ({
|
|
14413
|
+
...defaultFetchConfig
|
|
14414
|
+
}), []);
|
|
14415
|
+
const {
|
|
14416
|
+
data,
|
|
14417
|
+
loading
|
|
14418
|
+
} = useWidgetFetch({
|
|
14419
|
+
config: fetchConfig
|
|
14420
|
+
});
|
|
14421
|
+
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo);
|
|
14422
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
14423
|
+
loading: loading,
|
|
14424
|
+
title: t("Data Chain of Custody"),
|
|
14425
|
+
className: "flex flex-1 with-border-header no-p-body",
|
|
14426
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
14427
|
+
style: {
|
|
14428
|
+
height: 600
|
|
14429
|
+
},
|
|
14430
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DataChainOfCustodyDaf, {
|
|
14431
|
+
data: mappedData,
|
|
14432
|
+
maxZoom: 1
|
|
14433
|
+
})
|
|
14434
|
+
})
|
|
14435
|
+
});
|
|
14436
|
+
}
|
|
14437
|
+
|
|
14312
14438
|
function UserDashboard({
|
|
14313
14439
|
t = () => {},
|
|
14314
14440
|
goTo = () => {},
|
|
@@ -14320,7 +14446,8 @@ function UserDashboard({
|
|
|
14320
14446
|
setSelectedPartners,
|
|
14321
14447
|
informationSources,
|
|
14322
14448
|
user = {},
|
|
14323
|
-
options = {}
|
|
14449
|
+
options = {},
|
|
14450
|
+
hardcodedData = {}
|
|
14324
14451
|
}) {
|
|
14325
14452
|
const actionsWidgetsConfig = o.useMemo(() => getActionWidgetsConfig({
|
|
14326
14453
|
goTo,
|
|
@@ -14331,6 +14458,9 @@ function UserDashboard({
|
|
|
14331
14458
|
const informationSourcesCount = o.useMemo(() => {
|
|
14332
14459
|
return informationSources > 0 ? informationSources : selectedPartners?.partners?.length > 0 ? selectedPartners?.partners?.length : 0;
|
|
14333
14460
|
}, [informationSources, selectedPartners]);
|
|
14461
|
+
o.useEffect(() => {
|
|
14462
|
+
window.theme = theme;
|
|
14463
|
+
}, [theme, user]);
|
|
14334
14464
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
14335
14465
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
14336
14466
|
title: t('Dashboard Title')
|
|
@@ -14375,6 +14505,13 @@ function UserDashboard({
|
|
|
14375
14505
|
user: user,
|
|
14376
14506
|
theme: theme
|
|
14377
14507
|
})
|
|
14508
|
+
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
14509
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DataChainOfCustody, {
|
|
14510
|
+
t: t,
|
|
14511
|
+
goTo: goTo,
|
|
14512
|
+
options: options,
|
|
14513
|
+
hardcodedData: hardcodedData
|
|
14514
|
+
})
|
|
14378
14515
|
})]
|
|
14379
14516
|
});
|
|
14380
14517
|
}
|
|
@@ -4996,9 +4996,19 @@ strong {
|
|
|
4996
4996
|
width: 100%;
|
|
4997
4997
|
}
|
|
4998
4998
|
|
|
4999
|
-
.sidenav-sider.custom .ant-menu-dark .ant-menu-item-disabled {
|
|
4999
|
+
.components-layout:not(.nested) .sidenav-sider.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-item.ant-menu-item-disabled .ant-menu-title-content {
|
|
5000
5000
|
color: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5001
5001
|
}
|
|
5002
|
+
.components-layout:not(.nested) .sidenav-sider.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-item.ant-menu-item-disabled svg path {
|
|
5003
|
+
stroke: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
.components-layout:not(.nested) .sidenav-sider-collapsed.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-disabled .ant-menu-submenu-title svg path {
|
|
5007
|
+
stroke: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5008
|
+
}
|
|
5009
|
+
.components-layout:not(.nested) .sidenav-sider-collapsed.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-disabled .ant-menu-submenu-title .ant-menu-title-content {
|
|
5010
|
+
stroke: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5011
|
+
}
|
|
5002
5012
|
|
|
5003
5013
|
.sidenav-sider.nested .ant-menu-dark .ant-menu-item-disabled {
|
|
5004
5014
|
color: var(--nested-sidenav-disabled-menu-item-color) !important;
|
package/package.json
CHANGED
|
@@ -56,6 +56,7 @@ export const EditForm = ({
|
|
|
56
56
|
evaluationConfig = [],
|
|
57
57
|
staticWidth = "614px",
|
|
58
58
|
fullWidth = false,
|
|
59
|
+
noConvert = false,
|
|
59
60
|
}) => {
|
|
60
61
|
const [isSubmitting] = useState(false);
|
|
61
62
|
const formData = JSON.parse(JSON.stringify(convertUndefinedToNull(data) || {}));
|
|
@@ -369,11 +370,14 @@ export const EditForm = ({
|
|
|
369
370
|
}
|
|
370
371
|
});
|
|
371
372
|
|
|
372
|
-
const cleanedChangeValue =
|
|
373
|
-
const cleanedAllValues = {
|
|
373
|
+
const cleanedChangeValue = noConvert ? changedValue : convertUndefinedToNull(changedValue) ;
|
|
374
|
+
const cleanedAllValues = noConvert ? {
|
|
374
375
|
...values,
|
|
375
376
|
...allValues,
|
|
376
|
-
}
|
|
377
|
+
} : convertUndefinedToNull({
|
|
378
|
+
...values,
|
|
379
|
+
...allValues,
|
|
380
|
+
});
|
|
377
381
|
|
|
378
382
|
if (
|
|
379
383
|
"associatedMine" in cleanedChangeValue &&
|
|
@@ -3,6 +3,7 @@ import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
|
3
3
|
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
|
|
4
4
|
import DataChainOfCustody from '../../../../../core/components/Graphs/DataChainOfCustody/index.jsx';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { mapDataForChainOfCustody } from '../../../helper.js';
|
|
6
7
|
|
|
7
8
|
const defaultFetchConfig = {
|
|
8
9
|
basepath: "analytics",
|
|
@@ -11,7 +12,7 @@ const defaultFetchConfig = {
|
|
|
11
12
|
defaultData: [],
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
function TradeRelationships({goTo, t = () => {}, options = {},
|
|
15
|
+
function TradeRelationships({goTo, t = () => {}, options = {}, hardcodedData = [] }) {
|
|
15
16
|
|
|
16
17
|
const fetchConfig = useMemo(
|
|
17
18
|
() => ({
|
|
@@ -23,7 +24,7 @@ function TradeRelationships({goTo, t = () => {}, options = {}, mapDataFunction =
|
|
|
23
24
|
|
|
24
25
|
const { data, loading } = useWidgetFetch({config: fetchConfig});
|
|
25
26
|
|
|
26
|
-
const mappedData =
|
|
27
|
+
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options?.category ?? [], goTo);
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
30
|
<Widget
|
|
@@ -19,7 +19,6 @@ function SupplyChain({
|
|
|
19
19
|
selectedPartners,
|
|
20
20
|
setSelectedPartners,
|
|
21
21
|
informationSources,
|
|
22
|
-
mapDataFunction,
|
|
23
22
|
hardcodedData,
|
|
24
23
|
breadCrumbs = [],
|
|
25
24
|
}) {
|
|
@@ -81,7 +80,7 @@ function SupplyChain({
|
|
|
81
80
|
<SupplyChainMap selectedSources={selectedPartners} t={t} goTo={goTo} options={options} getRedirectLink={getRedirectLink} />
|
|
82
81
|
</section>
|
|
83
82
|
<section>
|
|
84
|
-
<TradeRelationships selectedSources={selectedPartners}
|
|
83
|
+
<TradeRelationships selectedSources={selectedPartners} t={t} options={options} goTo={goTo} hardcodedData={hardcodedData} />
|
|
85
84
|
</section>
|
|
86
85
|
<section>
|
|
87
86
|
<ChartsContainer selectedSources={selectedPartners} t={t} theme={theme} options={options} />
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
3
|
+
import { mapDataForChainOfCustody } from '../../../helper.js';
|
|
4
|
+
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
|
|
5
|
+
import DataChainOfCustodyDaf from '../../../../../core/components/Graphs/DataChainOfCustody/index.jsx';
|
|
2
6
|
|
|
3
7
|
|
|
4
8
|
const defaultFetchConfig = {
|
|
@@ -9,10 +13,30 @@ const defaultFetchConfig = {
|
|
|
9
13
|
};
|
|
10
14
|
|
|
11
15
|
|
|
12
|
-
function DataChainOfCustody({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
function DataChainOfCustody({
|
|
17
|
+
t = () => {},
|
|
18
|
+
goTo = () => {},
|
|
19
|
+
options = {},
|
|
20
|
+
hardcodedData = [],
|
|
21
|
+
}) {
|
|
22
|
+
const fetchConfig = useMemo(() => ({
|
|
23
|
+
...defaultFetchConfig,}),[],
|
|
24
|
+
);
|
|
25
|
+
const { data, loading } = useWidgetFetch({config: fetchConfig});
|
|
26
|
+
|
|
27
|
+
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Widget
|
|
31
|
+
loading={loading}
|
|
32
|
+
title={t("Data Chain of Custody")}
|
|
33
|
+
className="flex flex-1 with-border-header no-p-body"
|
|
34
|
+
>
|
|
35
|
+
<div style={{ height: 600 }}>
|
|
36
|
+
<DataChainOfCustodyDaf data={mappedData} maxZoom={1} />
|
|
37
|
+
</div>
|
|
38
|
+
</Widget>
|
|
39
|
+
)
|
|
16
40
|
}
|
|
17
41
|
|
|
18
42
|
export default DataChainOfCustody
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
1
|
+
import React, { useEffect, useMemo } from 'react'
|
|
2
2
|
import { getActionWidgetsConfig } from './config'
|
|
3
3
|
import ActionWidget from '../../../core/components/Dashboard/Widget/ActionWidget/index.jsx'
|
|
4
4
|
import Header from '../../../core/components/Header/index.jsx'
|
|
@@ -7,6 +7,7 @@ import KeyIndicators from './components/KeyIndicators/index.jsx'
|
|
|
7
7
|
import MineSites from './components/MineSites/index.jsx'
|
|
8
8
|
import DataCompilation from './components/DataCompilation/index.jsx'
|
|
9
9
|
import DataConsilidation from './components/DataConsilidation/index.jsx'
|
|
10
|
+
import DataChainOfCustody from './components/DataChainOfCustody/index.jsx'
|
|
10
11
|
|
|
11
12
|
function UserDashboard({
|
|
12
13
|
t = () => {},
|
|
@@ -20,6 +21,7 @@ function UserDashboard({
|
|
|
20
21
|
informationSources,
|
|
21
22
|
user = {},
|
|
22
23
|
options = {},
|
|
24
|
+
hardcodedData = {},
|
|
23
25
|
}) {
|
|
24
26
|
|
|
25
27
|
const actionsWidgetsConfig = useMemo(
|
|
@@ -35,6 +37,10 @@ function UserDashboard({
|
|
|
35
37
|
: 0
|
|
36
38
|
}, [informationSources, selectedPartners]);
|
|
37
39
|
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
window.theme = theme;
|
|
42
|
+
}, [theme, user])
|
|
43
|
+
|
|
38
44
|
return (
|
|
39
45
|
<DashboardLayout
|
|
40
46
|
header={
|
|
@@ -91,7 +97,14 @@ function UserDashboard({
|
|
|
91
97
|
theme={theme}
|
|
92
98
|
/>
|
|
93
99
|
</section>
|
|
94
|
-
|
|
100
|
+
<section>
|
|
101
|
+
<DataChainOfCustody
|
|
102
|
+
t={t}
|
|
103
|
+
goTo={goTo}
|
|
104
|
+
options={options}
|
|
105
|
+
hardcodedData={hardcodedData}
|
|
106
|
+
/>
|
|
107
|
+
</section>
|
|
95
108
|
</DashboardLayout>
|
|
96
109
|
)
|
|
97
110
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
|
|
3
|
+
import { findOptions } from '../../../helpers/StringHelper.js';
|
|
4
|
+
|
|
5
|
+
const theme = window.theme || {};
|
|
6
|
+
|
|
7
|
+
const kycIcon = <CustomIcon name="KYC" color="#6C737F" width={18} height={18} />;
|
|
8
|
+
|
|
9
|
+
const buildingIcon = <CustomIcon name="Building" color="#6C737F" width={18} height={18} />;
|
|
10
|
+
const individualIcon = <CustomIcon name="UserCircle" color="#6C737F" width={18} height={18} />;
|
|
11
|
+
const csIcon = <CustomIcon name="CivilSociety" color="#6C737F" width={18} height={18} />;
|
|
12
|
+
const leftIcon = (
|
|
13
|
+
<CustomIcon
|
|
14
|
+
name="NashirikiSmallLogo"
|
|
15
|
+
color={theme.colorPrimary8}
|
|
16
|
+
width={16}
|
|
17
|
+
height={16}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
const middleIcon = (
|
|
21
|
+
<CustomIcon
|
|
22
|
+
name="NashirikiSmallLogo"
|
|
23
|
+
color={theme.colorPrimary2}
|
|
24
|
+
width={16}
|
|
25
|
+
height={16}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const rightIcon = <CustomIcon name="NashirikiSmallLogo" color="white" width={16} height={16} />;
|
|
30
|
+
|
|
31
|
+
const mapIcon = (category) => {
|
|
32
|
+
switch (category) {
|
|
33
|
+
case "businessEntity":
|
|
34
|
+
return buildingIcon;
|
|
35
|
+
case "civilSociety":
|
|
36
|
+
return csIcon;
|
|
37
|
+
case "government":
|
|
38
|
+
return kycIcon;
|
|
39
|
+
case "individual":
|
|
40
|
+
return individualIcon;
|
|
41
|
+
default:
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const leftBackground = theme.colorPrimary3;
|
|
46
|
+
const rightBackground = theme.colorPrimary6;
|
|
47
|
+
|
|
48
|
+
export const mapDataForChainOfCustody = (data = {}, options = [], goTo = () => {}) => {
|
|
49
|
+
const mapChildren = (items, type, parentId, isDirect = true) => {
|
|
50
|
+
return (items ?? []).map((item) => ({
|
|
51
|
+
id: item.id,
|
|
52
|
+
number: 0,
|
|
53
|
+
name: item.name,
|
|
54
|
+
sources: parentId ? [parentId] : [],
|
|
55
|
+
subTitle: findOptions(item.category, options),
|
|
56
|
+
leftIcon: type === "client" ? rightIcon : leftIcon,
|
|
57
|
+
leftBackground: type === "client" ? rightBackground : leftBackground,
|
|
58
|
+
topIcon: mapIcon(item.category),
|
|
59
|
+
children: mapChildren(item.sources ?? item.clients ?? [], type, item.id, false),
|
|
60
|
+
onClick: () => {
|
|
61
|
+
if (isDirect && parentId === data.id) {
|
|
62
|
+
goTo(`/app/partners?datastakeId=${item.id}`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
id: data.id,
|
|
70
|
+
number: 0,
|
|
71
|
+
name: data.name,
|
|
72
|
+
subTitle: findOptions(data.category, options),
|
|
73
|
+
leftIcon: middleIcon,
|
|
74
|
+
leftBackground: theme.colorPrimary10,
|
|
75
|
+
topIcon: mapIcon(data.category),
|
|
76
|
+
left: mapChildren(data.sources, "source", data.id),
|
|
77
|
+
right: mapChildren(data.clients, "client", data.id),
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -4996,9 +4996,19 @@ strong {
|
|
|
4996
4996
|
width: 100%;
|
|
4997
4997
|
}
|
|
4998
4998
|
|
|
4999
|
-
.sidenav-sider.custom .ant-menu-dark .ant-menu-item-disabled {
|
|
4999
|
+
.components-layout:not(.nested) .sidenav-sider.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-item.ant-menu-item-disabled .ant-menu-title-content {
|
|
5000
5000
|
color: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5001
5001
|
}
|
|
5002
|
+
.components-layout:not(.nested) .sidenav-sider.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-item.ant-menu-item-disabled svg path {
|
|
5003
|
+
stroke: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
5006
|
+
.components-layout:not(.nested) .sidenav-sider-collapsed.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-disabled .ant-menu-submenu-title svg path {
|
|
5007
|
+
stroke: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5008
|
+
}
|
|
5009
|
+
.components-layout:not(.nested) .sidenav-sider-collapsed.custom.straatos .sidenav-cont.straatos .ant-menu-dark .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-disabled .ant-menu-submenu-title .ant-menu-title-content {
|
|
5010
|
+
stroke: var(--custom-sidenav-disabled-menu-item-color) !important;
|
|
5011
|
+
}
|
|
5002
5012
|
|
|
5003
5013
|
.sidenav-sider.nested .ant-menu-dark .ant-menu-item-disabled {
|
|
5004
5014
|
color: var(--nested-sidenav-disabled-menu-item-color) !important;
|